@zenstackhq/cli 3.8.0-beta.1 → 3.8.0-beta.3

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.cjs CHANGED
@@ -71,7 +71,7 @@ let cors = require("cors");
71
71
  cors = __toESM(cors, 1);
72
72
  let express = require("express");
73
73
  express = __toESM(express, 1);
74
- let mixpanel = require("mixpanel");
74
+ require("mixpanel");
75
75
  let os = require("os");
76
76
  os = __toESM(os, 1);
77
77
  let node_process = require("node:process");
@@ -319,7 +319,7 @@ async function checkPluginResolution(schemaFile, model) {
319
319
  for (const plugin of plugins) {
320
320
  const provider = getPluginProvider(plugin);
321
321
  if (!provider.startsWith("@core/")) {
322
- const pluginSourcePath = plugin.$cstNode?.parent?.element.$document?.uri?.fsPath ?? schemaFile;
322
+ const pluginSourcePath = plugin.$cstNode?.container?.astNode.$document?.uri?.fsPath ?? schemaFile;
323
323
  await loadPluginModule(provider, node_path.default.dirname(pluginSourcePath));
324
324
  }
325
325
  }
@@ -2335,7 +2335,7 @@ async function runPull(options) {
2335
2335
  model.declarations.splice(index, 1);
2336
2336
  deletedEnums.push(colors.default.red(`- Enum ${decl.name} deleted`));
2337
2337
  });
2338
- newModel.declarations.filter((d) => [_zenstackhq_language_ast.DataModel, _zenstackhq_language_ast.Enum].includes(d.$type)).forEach((_declaration) => {
2338
+ newModel.declarations.filter((d) => d.$type === _zenstackhq_language_ast.DataModel.$type || d.$type === _zenstackhq_language_ast.Enum.$type).forEach((_declaration) => {
2339
2339
  const newDataModel = _declaration;
2340
2340
  const declarations = services.shared.workspace.IndexManager.allElements(newDataModel.$type, docsSet).toArray();
2341
2341
  const originalDataModel = declarations.find((d) => getDbName(d.node) === getDbName(newDataModel))?.node;
@@ -2632,8 +2632,9 @@ const plugin = {
2632
2632
  }
2633
2633
  const lite = pluginOptions["lite"] === true;
2634
2634
  const liteOnly = pluginOptions["liteOnly"] === true;
2635
- const importWithFileExtension = pluginOptions["importWithFileExtension"];
2636
- if (importWithFileExtension && typeof importWithFileExtension !== "string") throw new Error("The \"importWithFileExtension\" option must be a string if specified.");
2635
+ let importWithFileExtension = pluginOptions["importWithFileExtension"];
2636
+ if (importWithFileExtension === void 0) importWithFileExtension = (0, _zenstackhq_sdk.detectImportFileExtension)(outDir);
2637
+ else if (typeof importWithFileExtension !== "string") throw new Error("The \"importWithFileExtension\" option must be a string if specified.");
2637
2638
  const generateModelTypes = pluginOptions["generateModels"] !== false;
2638
2639
  const generateInputTypes = pluginOptions["generateInput"] !== false;
2639
2640
  await new _zenstackhq_sdk.TsSchemaGenerator().generate(model, {
@@ -2670,7 +2671,7 @@ async function run$5(options) {
2670
2671
  const logsEnabled = !options.silent;
2671
2672
  if (logsEnabled) console.log(colors.default.green(`\nEnabled watch mode!`));
2672
2673
  const schemaExtensions = _zenstackhq_language.ZModelLanguageMetaData.fileExtensions;
2673
- const getRootModelWatchPaths = (model) => new Set(model.declarations.filter((v) => v.$cstNode?.parent?.element.$type === "Model" && !!v.$cstNode.parent.element.$document?.uri?.fsPath).map((v) => v.$cstNode.parent.element.$document.uri.fsPath));
2674
+ const getRootModelWatchPaths = (model) => new Set(model.declarations.filter((v) => v.$cstNode?.container?.astNode.$type === "Model" && !!v.$cstNode.container.astNode.$document?.uri?.fsPath).map((v) => v.$cstNode.container.astNode.$document.uri.fsPath));
2674
2675
  const watchedPaths = getRootModelWatchPaths(model);
2675
2676
  if (logsEnabled) {
2676
2677
  const logPaths = [...watchedPaths].map((at) => `- ${at}`).join("\n");
@@ -2752,7 +2753,7 @@ async function runPlugins(schemaFile, model, outputPath, options) {
2752
2753
  cliPlugin = plugins_exports[provider.slice(6)];
2753
2754
  if (!cliPlugin) throw new CliError(`Unknown core plugin: ${provider}`);
2754
2755
  } else {
2755
- const pluginSourcePath = plugin.$cstNode?.parent?.element.$document?.uri?.fsPath ?? schemaFile;
2756
+ const pluginSourcePath = plugin.$cstNode?.container?.astNode.$document?.uri?.fsPath ?? schemaFile;
2756
2757
  cliPlugin = await loadPluginModule(provider, node_path.default.dirname(pluginSourcePath));
2757
2758
  }
2758
2759
  if (cliPlugin) {
@@ -3223,9 +3224,6 @@ function startServer(client, schema, options) {
3223
3224
  });
3224
3225
  }
3225
3226
  //#endregion
3226
- //#region src/constants.ts
3227
- const TELEMETRY_TRACKING_TOKEN = "<TELEMETRY_TRACKING_TOKEN>";
3228
- //#endregion
3229
3227
  //#region src/utils/is-ci.ts
3230
3228
  const isInCi = node_process.env["CI"] !== "0" && node_process.env["CI"] !== "false" && ("CI" in node_process.env || "CONTINUOUS_INTEGRATION" in node_process.env || Object.keys(node_process.env).some((key) => key.startsWith("CI_")));
3231
3229
  //#endregion
@@ -3334,9 +3332,7 @@ var Telemetry = class {
3334
3332
  isWsl = isWsl();
3335
3333
  isContainer = isInContainer();
3336
3334
  isCi = isInCi;
3337
- constructor() {
3338
- if (process.env["DO_NOT_TRACK"] !== "1" && "<TELEMETRY_TRACKING_TOKEN>") this.mixpanel = (0, mixpanel.init)(TELEMETRY_TRACKING_TOKEN, { geolocate: true });
3339
- }
3335
+ constructor() {}
3340
3336
  get isTracking() {
3341
3337
  return !!this.mixpanel;
3342
3338
  }