@supacloud/db-zenstack 0.2.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/model-cli.d.ts +8 -1
- package/dist/model-cli.js +9 -5
- package/dist/model.d.ts +4 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
The required ZenStack adapter for model compilation and `createZenStackDatabase`.
|
|
4
4
|
|
|
5
|
+
Install `@supacloud/model-tooling` for the development-only `supacloud-model`
|
|
6
|
+
commands. This adapter keeps the Bun SQL runtime path separate from the
|
|
7
|
+
Management API's PostgreSQL introspection path; the user CLI never opens a
|
|
8
|
+
database connection.
|
|
9
|
+
|
|
5
10
|
`@supacloud/db` re-exports `@supacloud/db/zenstack` and `@supacloud/db/model` from this package so existing imports keep working. The selected Vibecoding stack installs this adapter together with `@supacloud/db`.
|
|
6
11
|
|
|
7
12
|
`@supacloud/db` catalog, RLS, and command-receipt code does not import this adapter.
|
package/dist/model-cli.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
export
|
|
2
|
+
export type ModelToolCommand = {
|
|
3
|
+
readonly executable: string;
|
|
4
|
+
readonly args?: readonly string[];
|
|
5
|
+
};
|
|
6
|
+
export interface ModelToolchain {
|
|
7
|
+
resolve(binary: "zen" | "prisma"): ModelToolCommand;
|
|
8
|
+
}
|
|
9
|
+
export declare function modelMain(argv: string[], toolchain?: ModelToolchain): Promise<void>;
|
package/dist/model-cli.js
CHANGED
|
@@ -65,7 +65,10 @@ function modelProcess(command, schema, generated, candidate) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
// src/model-cli.ts
|
|
68
|
-
|
|
68
|
+
function defaultToolchain(root = process.cwd()) {
|
|
69
|
+
return { resolve: (binary) => ({ executable: resolve2(root, "node_modules/.bin", binary) }) };
|
|
70
|
+
}
|
|
71
|
+
async function modelMain(argv, toolchain = defaultToolchain()) {
|
|
69
72
|
const [command, ...flags] = argv;
|
|
70
73
|
if (!["generate", "check", "diff", "pull"].includes(command ?? ""))
|
|
71
74
|
throw new Error("Usage: supacloud-model generate|check|diff|pull [--schema file] [--output dir] [--candidate file]");
|
|
@@ -119,12 +122,13 @@ async function modelMain(argv) {
|
|
|
119
122
|
await compileModel(source, join2(validation, "generated"));
|
|
120
123
|
}
|
|
121
124
|
const operation = modelProcess(command, source, output, candidate);
|
|
122
|
-
const
|
|
123
|
-
if (!existsSync(
|
|
125
|
+
const tool = toolchain.resolve(operation.binary);
|
|
126
|
+
if (!existsSync(tool.executable))
|
|
124
127
|
throw new Error(`Install the pinned ${operation.binary} tooling in the application`);
|
|
125
128
|
await mkdir2(dirname2(candidate), { recursive: true });
|
|
126
|
-
const
|
|
127
|
-
|
|
129
|
+
const { SUPACLOUD_MODEL_DATABASE_URL: _selectedDatabaseUrl, ...parentEnv } = process.env;
|
|
130
|
+
const child = Bun.spawn([tool.executable, ...tool.args ?? [], ...operation.args], {
|
|
131
|
+
env: { ...parentEnv, DATABASE_URL: databaseUrl },
|
|
128
132
|
stdio: ["ignore", "inherit", "inherit"]
|
|
129
133
|
});
|
|
130
134
|
if (await child.exited !== 0)
|
package/dist/model.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ export declare const BOOTSTRAP_MODEL_SCHEMA = "datasource db {\n provider = \"p
|
|
|
7
7
|
/** Offline model compilation: no plugin execution, no database or migration ledger writes. */
|
|
8
8
|
export declare function compileModel(schemaFile: string, output: string, check?: boolean): Promise<string[]>;
|
|
9
9
|
export type ModelCommand = "generate" | "check" | "diff" | "pull";
|
|
10
|
-
export
|
|
11
|
-
binary:
|
|
12
|
-
args: string[];
|
|
10
|
+
export type ModelProcess = {
|
|
11
|
+
readonly binary: "prisma" | "zen";
|
|
12
|
+
readonly args: readonly string[];
|
|
13
13
|
};
|
|
14
|
+
export declare function modelProcess(command: "diff" | "pull", schema: string, generated: string, candidate: string): ModelProcess;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/db-zenstack",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Required ZenStack model adapter for the SupaCloud Vibecoding stack.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@supacloud/contracts": "0.16.2",
|
|
47
|
-
"@supacloud/db": "0.
|
|
47
|
+
"@supacloud/db": "0.25.1",
|
|
48
48
|
"@zenstackhq/language": "3.10.0",
|
|
49
49
|
"@zenstackhq/orm": "3.10.0",
|
|
50
50
|
"@zenstackhq/plugin-policy": "3.10.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
},
|
|
62
62
|
"overrides": {
|
|
63
63
|
"@supacloud/contracts": "0.16.2",
|
|
64
|
-
"@supacloud/db": "0.
|
|
64
|
+
"@supacloud/db": "0.25.1",
|
|
65
65
|
"deepmerge-ts": "8.0.2",
|
|
66
66
|
"prisma": "6.19.3"
|
|
67
67
|
},
|