@zenstackhq/cli 3.3.2 → 3.3.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.js CHANGED
@@ -1006,9 +1006,23 @@ async function run9(options) {
1006
1006
  const dialect = createDialect(provider, databaseUrl, outputPath);
1007
1007
  const jiti = createJiti2(import.meta.url);
1008
1008
  const schemaModule = await jiti.import(path9.join(outputPath, "schema"));
1009
- const db = new ZenStackClient(schemaModule.schema, {
1009
+ const schema = schemaModule.schema;
1010
+ const omit = {};
1011
+ for (const [modelName, modelDef] of Object.entries(schema.models)) {
1012
+ const computedFields = {};
1013
+ for (const [fieldName, fieldDef] of Object.entries(modelDef.fields)) {
1014
+ if (fieldDef.computed === true) {
1015
+ computedFields[fieldName] = true;
1016
+ }
1017
+ }
1018
+ if (Object.keys(computedFields).length > 0) {
1019
+ omit[modelName] = computedFields;
1020
+ }
1021
+ }
1022
+ const db = new ZenStackClient(schema, {
1010
1023
  dialect,
1011
- log: log && log.length > 0 ? log : void 0
1024
+ log: log && log.length > 0 ? log : void 0,
1025
+ omit: Object.keys(omit).length > 0 ? omit : void 0
1012
1026
  });
1013
1027
  try {
1014
1028
  await db.$connect();