@zenstackhq/cli 3.4.3 → 3.4.4

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/dist/index.js CHANGED
@@ -18,16 +18,23 @@ import colors12 from "colors";
18
18
  import { Command, CommanderError, Option } from "commander";
19
19
 
20
20
  // src/actions/check.ts
21
+ import { isPlugin } from "@zenstackhq/language/ast";
21
22
  import colors2 from "colors";
23
+ import path2 from "path";
22
24
 
23
25
  // src/actions/action-utils.ts
26
+ import { invariant } from "@zenstackhq/common-helpers";
24
27
  import { loadDocument } from "@zenstackhq/language";
25
28
  import { isDataSource } from "@zenstackhq/language/ast";
26
29
  import { PrismaSchemaGenerator } from "@zenstackhq/sdk";
27
30
  import colors from "colors";
31
+ import { createJiti } from "jiti";
28
32
  import fs from "fs";
29
33
  import { createRequire } from "module";
30
34
  import path from "path";
35
+ import { pathToFileURL } from "url";
36
+ import terminalLink from "terminal-link";
37
+ import { z } from "zod";
31
38
 
32
39
  // src/cli-error.ts
33
40
  var CliError = class extends Error {
@@ -37,8 +44,6 @@ var CliError = class extends Error {
37
44
  };
38
45
 
39
46
  // src/actions/action-utils.ts
40
- import terminalLink from "terminal-link";
41
- import { z } from "zod";
42
47
  function getSchemaFile(file) {
43
48
  if (file) {
44
49
  if (!fs.existsSync(file)) {
@@ -214,6 +219,80 @@ async function getZenStackPackages(searchPath) {
214
219
  return result.filter((p) => !!p);
215
220
  }
216
221
  __name(getZenStackPackages, "getZenStackPackages");
222
+ function getPluginProvider(plugin3) {
223
+ const providerField = plugin3.fields.find((f) => f.name === "provider");
224
+ invariant(providerField, `Plugin ${plugin3.name} does not have a provider field`);
225
+ const provider = providerField.value.value;
226
+ return provider;
227
+ }
228
+ __name(getPluginProvider, "getPluginProvider");
229
+ async function loadPluginModule(provider, basePath) {
230
+ if (provider.toLowerCase().endsWith(".zmodel")) {
231
+ return void 0;
232
+ }
233
+ let moduleSpec = provider;
234
+ if (moduleSpec.startsWith(".")) {
235
+ moduleSpec = path.resolve(basePath, moduleSpec);
236
+ }
237
+ const importAsEsm = /* @__PURE__ */ __name(async (spec) => {
238
+ try {
239
+ const result = (await import(spec)).default;
240
+ return result;
241
+ } catch (err) {
242
+ throw new CliError(`Failed to load plugin module from ${spec}: ${err.message}`);
243
+ }
244
+ }, "importAsEsm");
245
+ const jiti = createJiti(pathToFileURL(basePath).toString());
246
+ const importAsTs = /* @__PURE__ */ __name(async (spec) => {
247
+ try {
248
+ const result = await jiti.import(spec, {
249
+ default: true
250
+ });
251
+ return result;
252
+ } catch (err) {
253
+ throw new CliError(`Failed to load plugin module from ${spec}: ${err.message}`);
254
+ }
255
+ }, "importAsTs");
256
+ const esmSuffixes = [
257
+ ".js",
258
+ ".mjs"
259
+ ];
260
+ const tsSuffixes = [
261
+ ".ts",
262
+ ".mts"
263
+ ];
264
+ if (fs.existsSync(moduleSpec) && fs.statSync(moduleSpec).isFile()) {
265
+ if (esmSuffixes.some((suffix) => moduleSpec.endsWith(suffix))) {
266
+ return await importAsEsm(pathToFileURL(moduleSpec).toString());
267
+ }
268
+ if (tsSuffixes.some((suffix) => moduleSpec.endsWith(suffix))) {
269
+ return await importAsTs(moduleSpec);
270
+ }
271
+ }
272
+ for (const suffix of esmSuffixes) {
273
+ const indexPath = path.join(moduleSpec, `index${suffix}`);
274
+ if (fs.existsSync(indexPath)) {
275
+ return await importAsEsm(pathToFileURL(indexPath).toString());
276
+ }
277
+ }
278
+ for (const suffix of tsSuffixes) {
279
+ const indexPath = path.join(moduleSpec, `index${suffix}`);
280
+ if (fs.existsSync(indexPath)) {
281
+ return await importAsTs(indexPath);
282
+ }
283
+ }
284
+ try {
285
+ const mod = await import(moduleSpec);
286
+ return mod.default;
287
+ } catch (err) {
288
+ const errorCode = err?.code;
289
+ if (errorCode === "ERR_MODULE_NOT_FOUND" || errorCode === "MODULE_NOT_FOUND") {
290
+ throw new CliError(`Cannot find plugin module "${provider}". Please make sure the package exists.`);
291
+ }
292
+ throw new CliError(`Failed to load plugin module "${provider}": ${err.message}`);
293
+ }
294
+ }
295
+ __name(loadPluginModule, "loadPluginModule");
217
296
  var FETCH_CLI_MAX_TIME = 1e3;
218
297
  var CLI_CONFIG_ENDPOINT = "https://zenstack.dev/config/cli-v3.json";
219
298
  var usageTipsSchema = z.object({
@@ -271,7 +350,8 @@ __name(startUsageTipsFetch, "startUsageTipsFetch");
271
350
  async function run(options) {
272
351
  const schemaFile = getSchemaFile(options.schema);
273
352
  try {
274
- await loadSchemaDocument(schemaFile);
353
+ const model = await loadSchemaDocument(schemaFile);
354
+ await checkPluginResolution(schemaFile, model);
275
355
  console.log(colors2.green("\u2713 Schema validation completed successfully."));
276
356
  } catch (error) {
277
357
  console.error(colors2.red("\u2717 Schema validation failed."));
@@ -279,13 +359,23 @@ async function run(options) {
279
359
  }
280
360
  }
281
361
  __name(run, "run");
362
+ async function checkPluginResolution(schemaFile, model) {
363
+ const plugins = model.declarations.filter(isPlugin);
364
+ for (const plugin3 of plugins) {
365
+ const provider = getPluginProvider(plugin3);
366
+ if (!provider.startsWith("@core/")) {
367
+ await loadPluginModule(provider, path2.dirname(schemaFile));
368
+ }
369
+ }
370
+ }
371
+ __name(checkPluginResolution, "checkPluginResolution");
282
372
 
283
373
  // src/actions/db.ts
284
374
  import { formatDocument, ZModelCodeGenerator } from "@zenstackhq/language";
285
375
  import { DataModel, Enum } from "@zenstackhq/language/ast";
286
376
  import colors4 from "colors";
287
377
  import fs2 from "fs";
288
- import path2 from "path";
378
+ import path3 from "path";
289
379
  import ora from "ora";
290
380
 
291
381
  // src/utils/exec-utils.ts
@@ -2516,8 +2606,8 @@ async function runPull(options) {
2516
2606
  const spinner = ora();
2517
2607
  try {
2518
2608
  const schemaFile = getSchemaFile(options.schema);
2519
- const outPath = options.output ? path2.resolve(options.output) : void 0;
2520
- const treatAsFile = !!outPath && (fs2.existsSync(outPath) && fs2.lstatSync(outPath).isFile() || path2.extname(outPath) !== "");
2609
+ const outPath = options.output ? path3.resolve(options.output) : void 0;
2610
+ const treatAsFile = !!outPath && (fs2.existsSync(outPath) && fs2.lstatSync(outPath).isFile() || path3.extname(outPath) !== "");
2521
2611
  const { model, services } = await loadSchemaDocument(schemaFile, {
2522
2612
  returnServices: true,
2523
2613
  mergeImports: treatAsFile
@@ -2591,7 +2681,7 @@ async function runPull(options) {
2591
2681
  oldModel: model
2592
2682
  });
2593
2683
  console.log(colors4.blue("Schema synced"));
2594
- const baseDir = path2.dirname(path2.resolve(schemaFile));
2684
+ const baseDir = path3.dirname(path3.resolve(schemaFile));
2595
2685
  const baseDirUrlPath = new URL(`file://${baseDir}`).pathname;
2596
2686
  const docs = services.shared.workspace.LangiumDocuments.all.filter(({ uri }) => uri.path.toLowerCase().startsWith(baseDirUrlPath.toLowerCase())).toArray();
2597
2687
  const docsSet = new Set(docs.map((d) => d.uri.toString()));
@@ -2876,7 +2966,7 @@ async function runPull(options) {
2876
2966
  if (treatAsFile) {
2877
2967
  const zmodelSchema = await formatDocument(generator.generate(newModel));
2878
2968
  console.log(colors4.blue(`Writing to ${outPath}`));
2879
- fs2.mkdirSync(path2.dirname(outPath), {
2969
+ fs2.mkdirSync(path3.dirname(outPath), {
2880
2970
  recursive: true
2881
2971
  });
2882
2972
  fs2.writeFileSync(outPath, zmodelSchema);
@@ -2884,12 +2974,12 @@ async function runPull(options) {
2884
2974
  fs2.mkdirSync(outPath, {
2885
2975
  recursive: true
2886
2976
  });
2887
- const baseDir2 = path2.dirname(path2.resolve(schemaFile));
2977
+ const baseDir2 = path3.dirname(path3.resolve(schemaFile));
2888
2978
  for (const { uri, parseResult: { value: documentModel } } of docs) {
2889
2979
  const zmodelSchema = await formatDocument(generator.generate(documentModel));
2890
- const relPath = path2.relative(baseDir2, uri.fsPath);
2891
- const targetFile = path2.join(outPath, relPath);
2892
- fs2.mkdirSync(path2.dirname(targetFile), {
2980
+ const relPath = path3.relative(baseDir2, uri.fsPath);
2981
+ const targetFile = path3.join(outPath, relPath);
2982
+ fs2.mkdirSync(path3.dirname(targetFile), {
2893
2983
  recursive: true
2894
2984
  });
2895
2985
  console.log(colors4.blue(`Writing to ${targetFile}`));
@@ -2899,7 +2989,7 @@ async function runPull(options) {
2899
2989
  } else {
2900
2990
  for (const { uri, parseResult: { value: documentModel } } of docs) {
2901
2991
  const zmodelSchema = await formatDocument(generator.generate(documentModel));
2902
- console.log(colors4.blue(`Writing to ${path2.relative(process.cwd(), uri.fsPath).replace(/\\/g, "/")}`));
2992
+ console.log(colors4.blue(`Writing to ${path3.relative(process.cwd(), uri.fsPath).replace(/\\/g, "/")}`));
2903
2993
  fs2.writeFileSync(uri.fsPath, zmodelSchema);
2904
2994
  }
2905
2995
  }
@@ -2931,16 +3021,13 @@ async function run3(options) {
2931
3021
  __name(run3, "run");
2932
3022
 
2933
3023
  // src/actions/generate.ts
2934
- import { invariant, singleDebounce } from "@zenstackhq/common-helpers";
3024
+ import { invariant as invariant2, singleDebounce } from "@zenstackhq/common-helpers";
2935
3025
  import { ZModelLanguageMetaData } from "@zenstackhq/language";
2936
- import { isPlugin } from "@zenstackhq/language/ast";
3026
+ import { isPlugin as isPlugin2 } from "@zenstackhq/language/ast";
2937
3027
  import { getLiteral, getLiteralArray as getLiteralArray2 } from "@zenstackhq/language/utils";
2938
3028
  import { watch } from "chokidar";
2939
3029
  import colors6 from "colors";
2940
- import { createJiti } from "jiti";
2941
- import fs6 from "fs";
2942
- import path5 from "path";
2943
- import { pathToFileURL } from "url";
3030
+ import path6 from "path";
2944
3031
  import ora2 from "ora";
2945
3032
  import semver from "semver";
2946
3033
 
@@ -2954,16 +3041,16 @@ __export(plugins_exports, {
2954
3041
  // src/plugins/prisma.ts
2955
3042
  import { PrismaSchemaGenerator as PrismaSchemaGenerator2 } from "@zenstackhq/sdk";
2956
3043
  import fs4 from "fs";
2957
- import path3 from "path";
3044
+ import path4 from "path";
2958
3045
  var plugin = {
2959
3046
  name: "Prisma Schema Generator",
2960
3047
  statusText: "Generating Prisma schema",
2961
3048
  async generate({ model, defaultOutputPath, pluginOptions }) {
2962
- let outFile = path3.join(defaultOutputPath, "schema.prisma");
3049
+ let outFile = path4.join(defaultOutputPath, "schema.prisma");
2963
3050
  if (typeof pluginOptions["output"] === "string") {
2964
- outFile = path3.resolve(defaultOutputPath, pluginOptions["output"]);
2965
- if (!fs4.existsSync(path3.dirname(outFile))) {
2966
- fs4.mkdirSync(path3.dirname(outFile), {
3051
+ outFile = path4.resolve(defaultOutputPath, pluginOptions["output"]);
3052
+ if (!fs4.existsSync(path4.dirname(outFile))) {
3053
+ fs4.mkdirSync(path4.dirname(outFile), {
2967
3054
  recursive: true
2968
3055
  });
2969
3056
  }
@@ -2977,14 +3064,14 @@ var prisma_default = plugin;
2977
3064
  // src/plugins/typescript.ts
2978
3065
  import { TsSchemaGenerator } from "@zenstackhq/sdk";
2979
3066
  import fs5 from "fs";
2980
- import path4 from "path";
3067
+ import path5 from "path";
2981
3068
  var plugin2 = {
2982
3069
  name: "TypeScript Schema Generator",
2983
3070
  statusText: "Generating TypeScript schema",
2984
3071
  async generate({ model, defaultOutputPath, pluginOptions }) {
2985
3072
  let outDir = defaultOutputPath;
2986
3073
  if (typeof pluginOptions["output"] === "string") {
2987
- outDir = path4.resolve(defaultOutputPath, pluginOptions["output"]);
3074
+ outDir = path5.resolve(defaultOutputPath, pluginOptions["output"]);
2988
3075
  if (!fs5.existsSync(outDir)) {
2989
3076
  fs5.mkdirSync(outDir, {
2990
3077
  recursive: true
@@ -3108,7 +3195,7 @@ async function pureGenerate(options, fromWatch) {
3108
3195
 
3109
3196
  \`\`\`ts
3110
3197
  import { ZenStackClient } from '@zenstackhq/orm';
3111
- import { schema } from '${path5.relative(".", outputPath)}/schema';
3198
+ import { schema } from '${path6.relative(".", outputPath)}/schema';
3112
3199
 
3113
3200
  const client = new ZenStackClient(schema, {
3114
3201
  dialect: { ... }
@@ -3122,7 +3209,7 @@ Check documentation: https://zenstack.dev/docs/`);
3122
3209
  }
3123
3210
  __name(pureGenerate, "pureGenerate");
3124
3211
  async function runPlugins(schemaFile, model, outputPath, options) {
3125
- const plugins = model.declarations.filter(isPlugin);
3212
+ const plugins = model.declarations.filter(isPlugin2);
3126
3213
  const processedPlugins = [];
3127
3214
  for (const plugin3 of plugins) {
3128
3215
  const provider = getPluginProvider(plugin3);
@@ -3133,7 +3220,7 @@ async function runPlugins(schemaFile, model, outputPath, options) {
3133
3220
  throw new CliError(`Unknown core plugin: ${provider}`);
3134
3221
  }
3135
3222
  } else {
3136
- cliPlugin = await loadPluginModule(provider, path5.dirname(schemaFile));
3223
+ cliPlugin = await loadPluginModule(provider, path6.dirname(schemaFile));
3137
3224
  }
3138
3225
  if (cliPlugin) {
3139
3226
  const pluginOptions = getPluginOptions(plugin3);
@@ -3177,7 +3264,7 @@ async function runPlugins(schemaFile, model, outputPath, options) {
3177
3264
  }
3178
3265
  });
3179
3266
  for (const { cliPlugin, pluginOptions } of processedPlugins) {
3180
- invariant(typeof cliPlugin.generate === "function", `Plugin ${cliPlugin.name} does not have a generate function`);
3267
+ invariant2(typeof cliPlugin.generate === "function", `Plugin ${cliPlugin.name} does not have a generate function`);
3181
3268
  let spinner;
3182
3269
  if (!options.silent) {
3183
3270
  spinner = ora2(cliPlugin.statusText ?? `Running plugin ${cliPlugin.name}`).start();
@@ -3197,13 +3284,6 @@ async function runPlugins(schemaFile, model, outputPath, options) {
3197
3284
  }
3198
3285
  }
3199
3286
  __name(runPlugins, "runPlugins");
3200
- function getPluginProvider(plugin3) {
3201
- const providerField = plugin3.fields.find((f) => f.name === "provider");
3202
- invariant(providerField, `Plugin ${plugin3.name} does not have a provider field`);
3203
- const provider = providerField.value.value;
3204
- return provider;
3205
- }
3206
- __name(getPluginProvider, "getPluginProvider");
3207
3287
  function getPluginOptions(plugin3) {
3208
3288
  const result = {};
3209
3289
  for (const field of plugin3.fields) {
@@ -3220,65 +3300,6 @@ function getPluginOptions(plugin3) {
3220
3300
  return result;
3221
3301
  }
3222
3302
  __name(getPluginOptions, "getPluginOptions");
3223
- async function loadPluginModule(provider, basePath) {
3224
- let moduleSpec = provider;
3225
- if (moduleSpec.startsWith(".")) {
3226
- moduleSpec = path5.resolve(basePath, moduleSpec);
3227
- }
3228
- const importAsEsm = /* @__PURE__ */ __name(async (spec) => {
3229
- try {
3230
- const result = (await import(spec)).default;
3231
- return result;
3232
- } catch (err) {
3233
- throw new CliError(`Failed to load plugin module from ${spec}: ${err.message}`);
3234
- }
3235
- }, "importAsEsm");
3236
- const jiti = createJiti(pathToFileURL(basePath).toString());
3237
- const importAsTs = /* @__PURE__ */ __name(async (spec) => {
3238
- try {
3239
- const result = await jiti.import(spec, {
3240
- default: true
3241
- });
3242
- return result;
3243
- } catch (err) {
3244
- throw new CliError(`Failed to load plugin module from ${spec}: ${err.message}`);
3245
- }
3246
- }, "importAsTs");
3247
- const esmSuffixes = [
3248
- ".js",
3249
- ".mjs"
3250
- ];
3251
- const tsSuffixes = [
3252
- ".ts",
3253
- ".mts"
3254
- ];
3255
- if (fs6.existsSync(moduleSpec) && fs6.statSync(moduleSpec).isFile()) {
3256
- if (esmSuffixes.some((suffix) => moduleSpec.endsWith(suffix))) {
3257
- return await importAsEsm(pathToFileURL(moduleSpec).toString());
3258
- }
3259
- if (tsSuffixes.some((suffix) => moduleSpec.endsWith(suffix))) {
3260
- return await importAsTs(moduleSpec);
3261
- }
3262
- }
3263
- for (const suffix of esmSuffixes) {
3264
- const indexPath = path5.join(moduleSpec, `index${suffix}`);
3265
- if (fs6.existsSync(indexPath)) {
3266
- return await importAsEsm(pathToFileURL(indexPath).toString());
3267
- }
3268
- }
3269
- for (const suffix of tsSuffixes) {
3270
- const indexPath = path5.join(moduleSpec, `index${suffix}`);
3271
- if (fs6.existsSync(indexPath)) {
3272
- return await importAsTs(indexPath);
3273
- }
3274
- }
3275
- try {
3276
- return (await import(moduleSpec)).default;
3277
- } catch {
3278
- return void 0;
3279
- }
3280
- }
3281
- __name(loadPluginModule, "loadPluginModule");
3282
3303
  async function checkForMismatchedPackages(projectPath) {
3283
3304
  const packages = await getZenStackPackages(projectPath);
3284
3305
  if (!packages.length) {
@@ -3338,8 +3359,8 @@ __name(run5, "run");
3338
3359
 
3339
3360
  // src/actions/init.ts
3340
3361
  import colors8 from "colors";
3341
- import fs7 from "fs";
3342
- import path6 from "path";
3362
+ import fs6 from "fs";
3363
+ import path7 from "path";
3343
3364
  import ora3 from "ora";
3344
3365
  import { detect, resolveCommand } from "package-manager-detector";
3345
3366
 
@@ -3418,11 +3439,11 @@ async function run6(projectPath) {
3418
3439
  }
3419
3440
  }
3420
3441
  const generationFolder = "zenstack";
3421
- if (!fs7.existsSync(path6.join(projectPath, generationFolder))) {
3422
- fs7.mkdirSync(path6.join(projectPath, generationFolder));
3442
+ if (!fs6.existsSync(path7.join(projectPath, generationFolder))) {
3443
+ fs6.mkdirSync(path7.join(projectPath, generationFolder));
3423
3444
  }
3424
- if (!fs7.existsSync(path6.join(projectPath, generationFolder, "schema.zmodel"))) {
3425
- fs7.writeFileSync(path6.join(projectPath, generationFolder, "schema.zmodel"), STARTER_ZMODEL);
3445
+ if (!fs6.existsSync(path7.join(projectPath, generationFolder, "schema.zmodel"))) {
3446
+ fs6.writeFileSync(path7.join(projectPath, generationFolder, "schema.zmodel"), STARTER_ZMODEL);
3426
3447
  } else {
3427
3448
  console.log(colors8.yellow("Schema file already exists. Skipping generation of sample."));
3428
3449
  }
@@ -3433,8 +3454,8 @@ async function run6(projectPath) {
3433
3454
  __name(run6, "run");
3434
3455
 
3435
3456
  // src/actions/migrate.ts
3436
- import fs8 from "fs";
3437
- import path7 from "path";
3457
+ import fs7 from "fs";
3458
+ import path8 from "path";
3438
3459
 
3439
3460
  // src/actions/seed.ts
3440
3461
  import colors9 from "colors";
@@ -3467,7 +3488,7 @@ __name(run7, "run");
3467
3488
  async function run8(command, options) {
3468
3489
  const schemaFile = getSchemaFile(options.schema);
3469
3490
  await requireDataSourceUrl(schemaFile);
3470
- const prismaSchemaDir = options.migrations ? path7.dirname(options.migrations) : void 0;
3491
+ const prismaSchemaDir = options.migrations ? path8.dirname(options.migrations) : void 0;
3471
3492
  const prismaSchemaFile = await generateTempPrismaSchema(schemaFile, prismaSchemaDir);
3472
3493
  try {
3473
3494
  switch (command) {
@@ -3488,8 +3509,8 @@ async function run8(command, options) {
3488
3509
  break;
3489
3510
  }
3490
3511
  } finally {
3491
- if (fs8.existsSync(prismaSchemaFile)) {
3492
- fs8.unlinkSync(prismaSchemaFile);
3512
+ if (fs7.existsSync(prismaSchemaFile)) {
3513
+ fs7.unlinkSync(prismaSchemaFile);
3493
3514
  }
3494
3515
  }
3495
3516
  }
@@ -3590,20 +3611,20 @@ import colors11 from "colors";
3590
3611
  import cors from "cors";
3591
3612
  import express from "express";
3592
3613
  import { createJiti as createJiti2 } from "jiti";
3593
- import path9 from "path";
3614
+ import path10 from "path";
3594
3615
 
3595
3616
  // src/utils/version-utils.ts
3596
3617
  import colors10 from "colors";
3597
- import fs9 from "fs";
3598
- import path8 from "path";
3618
+ import fs8 from "fs";
3619
+ import path9 from "path";
3599
3620
  import { fileURLToPath as fileURLToPath2 } from "url";
3600
3621
  import semver2 from "semver";
3601
3622
  var CHECK_VERSION_TIMEOUT = 2e3;
3602
3623
  var VERSION_CHECK_TAG = "latest";
3603
3624
  function getVersion() {
3604
3625
  try {
3605
- const _dirname = typeof __dirname !== "undefined" ? __dirname : path8.dirname(fileURLToPath2(import.meta.url));
3606
- return JSON.parse(fs9.readFileSync(path8.join(_dirname, "../package.json"), "utf8")).version;
3626
+ const _dirname = typeof __dirname !== "undefined" ? __dirname : path9.dirname(fileURLToPath2(import.meta.url));
3627
+ return JSON.parse(fs8.readFileSync(path9.join(_dirname, "../package.json"), "utf8")).version;
3607
3628
  } catch {
3608
3629
  return void 0;
3609
3630
  }
@@ -3650,8 +3671,8 @@ async function run9(options) {
3650
3671
  const schemaFile = getSchemaFile(options.schema);
3651
3672
  console.log(colors11.gray(`Loading ZModel schema from: ${schemaFile}`));
3652
3673
  let outputPath = getOutputPath(options, schemaFile);
3653
- if (!path9.isAbsolute(outputPath)) {
3654
- outputPath = path9.resolve(process.cwd(), outputPath);
3674
+ if (!path10.isAbsolute(outputPath)) {
3675
+ outputPath = path10.resolve(process.cwd(), outputPath);
3655
3676
  }
3656
3677
  const model = await loadSchemaDocument(schemaFile);
3657
3678
  const dataSource = model.declarations.find(isDataSource2);
@@ -3667,18 +3688,18 @@ async function run9(options) {
3667
3688
  const dialect = await createDialect(provider, databaseUrl, outputPath);
3668
3689
  const fileUrl = typeof __filename !== "undefined" ? __filename : import.meta.url;
3669
3690
  const jiti = createJiti2(fileUrl);
3670
- const schemaModule = await jiti.import(path9.join(outputPath, "schema"));
3691
+ const schemaModule = await jiti.import(path10.join(outputPath, "schema"));
3671
3692
  const schema = schemaModule.schema;
3672
3693
  const omit = {};
3673
3694
  for (const [modelName, modelDef] of Object.entries(schema.models)) {
3674
- const computedFields = {};
3695
+ const omitFields = {};
3675
3696
  for (const [fieldName, fieldDef] of Object.entries(modelDef.fields)) {
3676
- if (fieldDef.computed === true) {
3677
- computedFields[fieldName] = true;
3697
+ if (fieldDef.computed === true || fieldDef.type === "Unsupported") {
3698
+ omitFields[fieldName] = true;
3678
3699
  }
3679
3700
  }
3680
- if (Object.keys(computedFields).length > 0) {
3681
- omit[modelName] = computedFields;
3701
+ if (Object.keys(omitFields).length > 0) {
3702
+ omit[modelName] = omitFields;
3682
3703
  }
3683
3704
  }
3684
3705
  const db = new ZenStackClient(schema, {
@@ -3738,8 +3759,8 @@ async function createDialect(provider, databaseUrl, outputPath) {
3738
3759
  let resolvedUrl = databaseUrl.trim();
3739
3760
  if (resolvedUrl.startsWith("file:")) {
3740
3761
  const filePath = resolvedUrl.substring("file:".length);
3741
- if (!path9.isAbsolute(filePath)) {
3742
- resolvedUrl = path9.join(outputPath, filePath);
3762
+ if (!path10.isAbsolute(filePath)) {
3763
+ resolvedUrl = path10.join(outputPath, filePath);
3743
3764
  }
3744
3765
  }
3745
3766
  console.log(colors11.gray(`Connecting to SQLite database at: ${resolvedUrl}`));
@@ -3837,7 +3858,7 @@ __name(startServer, "startServer");
3837
3858
  // src/telemetry.ts
3838
3859
  import { init } from "mixpanel";
3839
3860
  import { randomUUID as randomUUID2 } from "crypto";
3840
- import fs13 from "fs";
3861
+ import fs12 from "fs";
3841
3862
  import * as os2 from "os";
3842
3863
 
3843
3864
  // src/constants.ts
@@ -3848,14 +3869,14 @@ import { env } from "process";
3848
3869
  var isInCi = env["CI"] !== "0" && env["CI"] !== "false" && ("CI" in env || "CONTINUOUS_INTEGRATION" in env || Object.keys(env).some((key) => key.startsWith("CI_")));
3849
3870
 
3850
3871
  // src/utils/is-container.ts
3851
- import fs11 from "fs";
3872
+ import fs10 from "fs";
3852
3873
 
3853
3874
  // src/utils/is-docker.ts
3854
- import fs10 from "fs";
3875
+ import fs9 from "fs";
3855
3876
  var isDockerCached;
3856
3877
  function hasDockerEnv() {
3857
3878
  try {
3858
- fs10.statSync("/.dockerenv");
3879
+ fs9.statSync("/.dockerenv");
3859
3880
  return true;
3860
3881
  } catch {
3861
3882
  return false;
@@ -3864,7 +3885,7 @@ function hasDockerEnv() {
3864
3885
  __name(hasDockerEnv, "hasDockerEnv");
3865
3886
  function hasDockerCGroup() {
3866
3887
  try {
3867
- return fs10.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
3888
+ return fs9.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
3868
3889
  } catch {
3869
3890
  return false;
3870
3891
  }
@@ -3882,7 +3903,7 @@ __name(isDocker, "isDocker");
3882
3903
  var cachedResult;
3883
3904
  var hasContainerEnv = /* @__PURE__ */ __name(() => {
3884
3905
  try {
3885
- fs11.statSync("/run/.containerenv");
3906
+ fs10.statSync("/run/.containerenv");
3886
3907
  return true;
3887
3908
  } catch {
3888
3909
  return false;
@@ -3899,7 +3920,7 @@ __name(isInContainer, "isInContainer");
3899
3920
  // src/utils/is-wsl.ts
3900
3921
  import process2 from "process";
3901
3922
  import os from "os";
3902
- import fs12 from "fs";
3923
+ import fs11 from "fs";
3903
3924
  var isWsl = /* @__PURE__ */ __name(() => {
3904
3925
  if (process2.platform !== "linux") {
3905
3926
  return false;
@@ -3908,7 +3929,7 @@ var isWsl = /* @__PURE__ */ __name(() => {
3908
3929
  return true;
3909
3930
  }
3910
3931
  try {
3911
- return fs12.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft");
3932
+ return fs11.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft");
3912
3933
  } catch {
3913
3934
  return false;
3914
3935
  }
@@ -4064,7 +4085,7 @@ var Telemetry = class {
4064
4085
  try {
4065
4086
  const packageJsonPath = import.meta.resolve("prisma/package.json");
4066
4087
  const packageJsonUrl = new URL(packageJsonPath);
4067
- const packageJson = JSON.parse(fs13.readFileSync(packageJsonUrl, "utf8"));
4088
+ const packageJson = JSON.parse(fs12.readFileSync(packageJsonUrl, "utf8"));
4068
4089
  return packageJson.version;
4069
4090
  } catch {
4070
4091
  return void 0;