@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/codegen/index.cjs
CHANGED
|
@@ -1000,7 +1000,7 @@ function unfoldRelationSelector(relation) {
|
|
|
1000
1000
|
return relationName;
|
|
1001
1001
|
}
|
|
1002
1002
|
__name(unfoldRelationSelector, "unfoldRelationSelector");
|
|
1003
|
-
function buildRelations(tables, relationTargets = {}, filteredRelations = {}, throughRelations = {}, fkRelations = {}) {
|
|
1003
|
+
function buildRelations(tables, relationTargets = {}, filteredRelations = {}, throughRelations = {}, fkRelations = {}, options = {}) {
|
|
1004
1004
|
const baseTables = tables.filter((table) => !table.derivedFrom);
|
|
1005
1005
|
const sqlToBaseTable = /* @__PURE__ */ new Map();
|
|
1006
1006
|
const modelToTable = /* @__PURE__ */ new Map();
|
|
@@ -1089,7 +1089,19 @@ function buildRelations(tables, relationTargets = {}, filteredRelations = {}, th
|
|
|
1089
1089
|
if (!targetTable) continue;
|
|
1090
1090
|
const signature = makePhysicalFKSignature(table, targetTable, fk);
|
|
1091
1091
|
if (declaredFKRelations.has(signature)) continue;
|
|
1092
|
-
|
|
1092
|
+
const ignoreCols = options.ignoreCompositeFkColumns ?? [];
|
|
1093
|
+
if (ignoreCols.length > 0 && fk.localColumns.length > 1) {
|
|
1094
|
+
const strippedFk = {
|
|
1095
|
+
...fk,
|
|
1096
|
+
localColumns: fk.localColumns.filter((c) => !ignoreCols.includes(c)),
|
|
1097
|
+
foreignColumns: fk.foreignColumns.filter((_, i) => !ignoreCols.includes(fk.localColumns[i]))
|
|
1098
|
+
};
|
|
1099
|
+
if (strippedFk.localColumns.length > 0) {
|
|
1100
|
+
const strippedSig = makePhysicalFKSignature(table, targetTable, strippedFk);
|
|
1101
|
+
if (declaredFKRelations.has(strippedSig)) continue;
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
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.`);
|
|
1093
1105
|
}
|
|
1094
1106
|
}
|
|
1095
1107
|
const forwardByTarget = /* @__PURE__ */ new Map();
|