@famgia/omnify-laravel 2.0.35 → 2.0.36
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/{chunk-BN5HLOML.js → chunk-FE7YXEZW.js} +18 -3
- package/dist/chunk-FE7YXEZW.js.map +1 -0
- package/dist/index.cjs +17 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/plugin.cjs +17 -2
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-BN5HLOML.js.map +0 -1
|
@@ -288,6 +288,11 @@ function generateForeignKey(propertyName, property, allSchemas, options = {}) {
|
|
|
288
288
|
const columnName = toColumnName(propertyName) + "_id";
|
|
289
289
|
const targetSchema = assocProp.target ? allSchemas[assocProp.target] : void 0;
|
|
290
290
|
const targetTable = assocProp.target ? toTableName(assocProp.target) : "unknown";
|
|
291
|
+
if (assocProp.target && !targetSchema && !assocProp.targetNamespace && !assocProp.idType) {
|
|
292
|
+
throw new Error(
|
|
293
|
+
`Association "${propertyName}" references target "${assocProp.target}" which was not found in loaded schemas. Available schemas: [${Object.keys(allSchemas).join(", ")}]. If this is an external package reference, add "targetNamespace" and "idType" to the association.`
|
|
294
|
+
);
|
|
295
|
+
}
|
|
291
296
|
const targetPkType = assocProp.idType ?? (targetSchema ? getIdType(targetSchema) : "BigInt");
|
|
292
297
|
let method = "unsignedBigInteger";
|
|
293
298
|
if (targetPkType === "Int") {
|
|
@@ -444,8 +449,13 @@ function schemaToBlueprint(schema, allSchemas, options = {}) {
|
|
|
444
449
|
for (const targetSchemaName of pivotFor) {
|
|
445
450
|
const targetSchema = allSchemas[targetSchemaName];
|
|
446
451
|
const fkColumnName = `${toColumnName(targetSchemaName)}_id`;
|
|
452
|
+
if (!targetSchema) {
|
|
453
|
+
throw new Error(
|
|
454
|
+
`Pivot schema "${schema.name}" references target "${targetSchemaName}" in pivotFor which was not found in loaded schemas. Available schemas: [${Object.keys(allSchemas).join(", ")}]. Make sure the target schema is defined and loaded.`
|
|
455
|
+
);
|
|
456
|
+
}
|
|
447
457
|
if (!explicitColumnNames.has(fkColumnName)) {
|
|
448
|
-
const targetIdType = targetSchema
|
|
458
|
+
const targetIdType = targetSchema.options?.idType ?? "BigInt";
|
|
449
459
|
const columnType = targetIdType === "Uuid" ? "uuid" : targetIdType === "String" ? "string" : "unsignedBigInteger";
|
|
450
460
|
columns.push({
|
|
451
461
|
name: fkColumnName,
|
|
@@ -690,7 +700,12 @@ function extractManyToManyRelations(schema, allSchemas) {
|
|
|
690
700
|
}
|
|
691
701
|
const targetSchema = allSchemas[targetName];
|
|
692
702
|
const targetTable = toTableName(targetName);
|
|
693
|
-
|
|
703
|
+
if (!targetSchema && !assocProp.targetNamespace && !assocProp.idType) {
|
|
704
|
+
throw new Error(
|
|
705
|
+
`ManyToMany association in "${schema.name}" references target "${targetName}" which was not found in loaded schemas. Available schemas: [${Object.keys(allSchemas).join(", ")}]. If this is an external package reference, add "targetNamespace" and "idType" to the association.`
|
|
706
|
+
);
|
|
707
|
+
}
|
|
708
|
+
const targetPkType = assocProp.idType ?? (targetSchema ? getIdType(targetSchema) : "BigInt");
|
|
694
709
|
let isOwningSide;
|
|
695
710
|
if (assocProp.owning !== void 0) {
|
|
696
711
|
isOwningSide = assocProp.owning;
|
|
@@ -5675,4 +5690,4 @@ export {
|
|
|
5675
5690
|
getFactoryPath,
|
|
5676
5691
|
laravelPlugin
|
|
5677
5692
|
};
|
|
5678
|
-
//# sourceMappingURL=chunk-
|
|
5693
|
+
//# sourceMappingURL=chunk-FE7YXEZW.js.map
|