Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zenstackhq/proxy",
"version": "0.2.5",
"version": "0.2.6",
"description": "A CLI tool to run an Express server that proxies CRUD requests to a ZenStack backend",
"main": "index.js",
"publishConfig": {
Expand All @@ -24,7 +24,7 @@
"author": "",
"license": "MIT",
"dependencies": {
"@prisma/adapter-better-sqlite3": "^6.2.1",
"@prisma/adapter-better-sqlite3": "^7.3.0",
"@prisma/adapter-mariadb": "^7.1.0",
"@prisma/adapter-pg": "^6.18.0",
Comment on lines +27 to 29
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check latest versions of Prisma adapters
echo "=== Latest versions on npm registry ==="
for adapter in "adapter-pg" "adapter-better-sqlite3" "adapter-mariadb"; do
  echo "Checking `@prisma/`$adapter..."
  curl -s "https://registry.npmjs.org/@prisma/$adapter" | jq -r '.["dist-tags"] | {latest, next}' 2>/dev/null || echo "Failed to fetch"
done

Repository: zenstackhq/proxy

Length of output: 329


🏁 Script executed:

#!/bin/bash
# Also check if there are any version constraint issues by looking at package.json and package-lock.json
echo "=== Checking package.json structure ==="
head -50 package.json
echo "..."
grep -A 5 "@prisma/adapter" package.json

Repository: zenstackhq/proxy

Length of output: 1795


🏁 Script executed:

#!/bin/bash
# Check prisma version in package.json
echo "=== Prisma related dependencies ==="
grep -E '"@prisma|"prisma' package.json

Repository: zenstackhq/proxy

Length of output: 221


🏁 Script executed:

#!/bin/bash
# Search for any comments or issues about adapter versions in the codebase
echo "=== Searching for adapter version related comments ==="
rg -i "adapter-pg|adapter-pg.*version|prisma.*version" --type-list | head -20
rg -i "adapter.*version|prisma.*compat" -A 2 -B 2 2>/dev/null | head -40

Repository: zenstackhq/proxy

Length of output: 521


🏁 Script executed:

#!/bin/bash
# Check if adapter-pg v6 is intentionally constrained or just overlooked
echo "=== Checking how adapters are used in code ==="
fd -e ts -e js | xargs rg "adapter-pg|adapter-better-sqlite3|adapter-mariadb" 2>/dev/null | head -20

Repository: zenstackhq/proxy

Length of output: 742


🏁 Script executed:

#!/bin/bash
# Check `@zenstackhq/server` which likely contains Prisma
grep -A 2 -B 2 "@zenstackhq/server" package.json

Repository: zenstackhq/proxy

Length of output: 225


Update Prisma adapters to consistent versions.

The @prisma/adapter-pg is on ^6.18.0 while @prisma/adapter-better-sqlite3 and @prisma/adapter-mariadb are on ^7.x. Since all three adapters are actively used in the codebase and the latest available version for all of them is 7.3.0, they should be aligned to ^7.3.0 to avoid potential compatibility issues across the adapter layer.

🤖 Prompt for AI Agents
In `@package.json` around lines 27 - 29, The package versions for Prisma adapters
are inconsistent: `@prisma/adapter-better-sqlite3` and `@prisma/adapter-mariadb` are
at ^7.3.0 while `@prisma/adapter-pg` is at ^6.18.0; update the `@prisma/adapter-pg`
dependency in package.json to ^7.3.0 to align all three adapters
(`@prisma/adapter-better-sqlite3`, `@prisma/adapter-mariadb`, `@prisma/adapter-pg`),
then regenerate the lockfile (npm/yarn/pnpm install) to ensure a consistent
dependency tree.

"@zenstackhq/server": "^2.0.0",
Expand Down
33 changes: 23 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 19 additions & 3 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as path from 'path'
import express from 'express'
import cors from 'cors'
import { ZenStackMiddleware } from '@zenstackhq/server/express'
import { GeneratorConfig, ZModelConfig } from './zmodel-parser'
import { ZModelConfig } from './zmodel-parser'
import { getNodeModulesFolder, getPrismaVersion, getZenStackVersion } from './utils/version-utils'
import { blue, grey } from 'colors'
import semver from 'semver'
Expand Down Expand Up @@ -46,6 +46,22 @@ function resolveSQLitePath(filePath: string, prismaSchemaDir: string): string {
return path.join(prismaSchemaDir, filePath)
}

function redactDatabaseUrl(url: string): string {
try {
const parsedUrl = new URL(url)
if (parsedUrl.password) {
parsedUrl.password = '***'
}
if (parsedUrl.username) {
parsedUrl.username = '***'
}
return parsedUrl.toString()
} catch {
// If URL parsing fails, return the original (might be a file path for SQLite)
return url
}
}

/**
* Create database adapter based on provider
*/
Expand Down Expand Up @@ -79,7 +95,7 @@ function createAdapter(config: ZModelConfig, zmodelSchemaDir: string): any {
case 'postgresql': {
try {
const { PrismaPg } = require('@prisma/adapter-pg')
console.log(grey(`Connecting to PostgreSQL database at: ${url}`))
console.log(grey(`Connecting to PostgreSQL database at: ${redactDatabaseUrl(url)}`))
return new PrismaPg({ connectionString: url })
} catch (error) {
throw new CliError(
Expand All @@ -90,7 +106,7 @@ function createAdapter(config: ZModelConfig, zmodelSchemaDir: string): any {
case 'mysql': {
try {
const { PrismaMariaDB } = require('@prisma/adapter-mariadb')
console.log(grey(`Connecting to MySQL/MariaDB database at: ${url}`))
console.log(grey(`Connecting to MySQL/MariaDB database at: ${redactDatabaseUrl(url)}`))
return new PrismaMariaDB({
url,
})
Expand Down
Loading