@danielhritcu/zenstack-custom 1.2.1 → 1.2.2
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/cli.cjs +37 -8
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts +6 -2
- package/dist/cli.d.ts +6 -2
- package/dist/cli.js +37 -8
- package/dist/cli.js.map +1 -1
- package/dist/codegen/index.cjs +14 -2
- package/dist/codegen/index.cjs.map +1 -1
- package/dist/codegen/index.d.cts +3 -1
- package/dist/codegen/index.d.ts +3 -1
- package/dist/codegen/index.js +14 -2
- package/dist/codegen/index.js.map +1 -1
- package/dist/index.cjs +14 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1213,7 +1213,7 @@ function unfoldRelationSelector(relation) {
|
|
|
1213
1213
|
return relationName;
|
|
1214
1214
|
}
|
|
1215
1215
|
__name(unfoldRelationSelector, "unfoldRelationSelector");
|
|
1216
|
-
function buildRelations(tables, relationTargets = {}, filteredRelations = {}, throughRelations = {}, fkRelations = {}) {
|
|
1216
|
+
function buildRelations(tables, relationTargets = {}, filteredRelations = {}, throughRelations = {}, fkRelations = {}, options = {}) {
|
|
1217
1217
|
const baseTables = tables.filter((table) => !table.derivedFrom);
|
|
1218
1218
|
const sqlToBaseTable = /* @__PURE__ */ new Map();
|
|
1219
1219
|
const modelToTable = /* @__PURE__ */ new Map();
|
|
@@ -1302,7 +1302,19 @@ function buildRelations(tables, relationTargets = {}, filteredRelations = {}, th
|
|
|
1302
1302
|
if (!targetTable) continue;
|
|
1303
1303
|
const signature = makePhysicalFKSignature(table, targetTable, fk);
|
|
1304
1304
|
if (declaredFKRelations.has(signature)) continue;
|
|
1305
|
-
|
|
1305
|
+
const ignoreCols = options.ignoreCompositeFkColumns ?? [];
|
|
1306
|
+
if (ignoreCols.length > 0 && fk.localColumns.length > 1) {
|
|
1307
|
+
const strippedFk = {
|
|
1308
|
+
...fk,
|
|
1309
|
+
localColumns: fk.localColumns.filter((c) => !ignoreCols.includes(c)),
|
|
1310
|
+
foreignColumns: fk.foreignColumns.filter((_, i) => !ignoreCols.includes(fk.localColumns[i]))
|
|
1311
|
+
};
|
|
1312
|
+
if (strippedFk.localColumns.length > 0) {
|
|
1313
|
+
const strippedSig = makePhysicalFKSignature(table, targetTable, strippedFk);
|
|
1314
|
+
if (declaredFKRelations.has(strippedSig)) continue;
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
console.warn(`Warning: undeclared FK "${table.exportName}": [${fk.localColumns.join(", ")}] -> ${targetTable.exportName}([${fk.foreignColumns.join(", ")}]). Add a relation in orm.config.ts or it will be auto-generated.`);
|
|
1306
1318
|
}
|
|
1307
1319
|
}
|
|
1308
1320
|
const forwardByTarget = /* @__PURE__ */ new Map();
|