@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.cjs +16 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -1025,9 +1025,23 @@ async function run9(options) {
|
|
|
1025
1025
|
const dialect = createDialect(provider, databaseUrl, outputPath);
|
|
1026
1026
|
const jiti = (0, import_jiti2.createJiti)(import_meta3.url);
|
|
1027
1027
|
const schemaModule = await jiti.import(import_node_path9.default.join(outputPath, "schema"));
|
|
1028
|
-
const
|
|
1028
|
+
const schema = schemaModule.schema;
|
|
1029
|
+
const omit = {};
|
|
1030
|
+
for (const [modelName, modelDef] of Object.entries(schema.models)) {
|
|
1031
|
+
const computedFields = {};
|
|
1032
|
+
for (const [fieldName, fieldDef] of Object.entries(modelDef.fields)) {
|
|
1033
|
+
if (fieldDef.computed === true) {
|
|
1034
|
+
computedFields[fieldName] = true;
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
if (Object.keys(computedFields).length > 0) {
|
|
1038
|
+
omit[modelName] = computedFields;
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
const db = new import_orm.ZenStackClient(schema, {
|
|
1029
1042
|
dialect,
|
|
1030
|
-
log: log && log.length > 0 ? log : void 0
|
|
1043
|
+
log: log && log.length > 0 ? log : void 0,
|
|
1044
|
+
omit: Object.keys(omit).length > 0 ? omit : void 0
|
|
1031
1045
|
});
|
|
1032
1046
|
try {
|
|
1033
1047
|
await db.$connect();
|