@famgia/omnify-laravel 0.0.53 → 0.0.55
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-TSRWUG2I.js → chunk-TIMQTRAC.js} +17 -4
- package/dist/chunk-TIMQTRAC.js.map +1 -0
- package/dist/index.cjs +16 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1 -1
- package/dist/plugin.cjs +16 -3
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +5 -0
- package/dist/plugin.d.ts +5 -0
- package/dist/plugin.js +1 -1
- package/package.json +7 -7
- package/dist/chunk-TSRWUG2I.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -221,6 +221,7 @@ function generatePolymorphicColumns(propertyName, property, allSchemas) {
|
|
|
221
221
|
if (assocProp.relation !== "MorphTo") {
|
|
222
222
|
return null;
|
|
223
223
|
}
|
|
224
|
+
const isNullable2 = assocProp.nullable !== false;
|
|
224
225
|
const targets = assocProp.targets;
|
|
225
226
|
if (!targets || targets.length === 0) {
|
|
226
227
|
return null;
|
|
@@ -232,7 +233,7 @@ function generatePolymorphicColumns(propertyName, property, allSchemas) {
|
|
|
232
233
|
name: typeColumnName,
|
|
233
234
|
method: "enum",
|
|
234
235
|
args: [typeColumnName, targets],
|
|
235
|
-
modifiers: [{ method: "nullable" }]
|
|
236
|
+
modifiers: isNullable2 ? [{ method: "nullable" }] : []
|
|
236
237
|
};
|
|
237
238
|
let idMethod = "unsignedBigInteger";
|
|
238
239
|
for (const targetName of targets) {
|
|
@@ -251,7 +252,7 @@ function generatePolymorphicColumns(propertyName, property, allSchemas) {
|
|
|
251
252
|
name: idColumnName,
|
|
252
253
|
method: idMethod,
|
|
253
254
|
args: idMethod === "string" ? [idColumnName, 255] : [idColumnName],
|
|
254
|
-
modifiers: [{ method: "nullable" }]
|
|
255
|
+
modifiers: isNullable2 ? [{ method: "nullable" }] : []
|
|
255
256
|
};
|
|
256
257
|
const indexes = [
|
|
257
258
|
{
|
|
@@ -1267,6 +1268,7 @@ var DEFAULT_OPTIONS = {
|
|
|
1267
1268
|
baseModelClassName: "BaseModel",
|
|
1268
1269
|
baseModelPath: "app/Models/OmnifyBase",
|
|
1269
1270
|
modelPath: "app/Models",
|
|
1271
|
+
providersPath: "app/Providers",
|
|
1270
1272
|
customTypes: /* @__PURE__ */ new Map()
|
|
1271
1273
|
};
|
|
1272
1274
|
function generateLocalizedDisplayNames(displayName, indent = " ") {
|
|
@@ -1315,6 +1317,7 @@ function resolveOptions(options) {
|
|
|
1315
1317
|
baseModelClassName: options?.baseModelClassName ?? DEFAULT_OPTIONS.baseModelClassName,
|
|
1316
1318
|
baseModelPath: options?.baseModelPath ?? DEFAULT_OPTIONS.baseModelPath,
|
|
1317
1319
|
modelPath: options?.modelPath ?? DEFAULT_OPTIONS.modelPath,
|
|
1320
|
+
providersPath: options?.providersPath ?? DEFAULT_OPTIONS.providersPath,
|
|
1318
1321
|
customTypes: options?.customTypes ?? /* @__PURE__ */ new Map()
|
|
1319
1322
|
};
|
|
1320
1323
|
}
|
|
@@ -2149,7 +2152,7 @@ function generateServiceProvider(schemas, options, stubContent) {
|
|
|
2149
2152
|
}).join("\n");
|
|
2150
2153
|
const content = stubContent.replace(/\{\{MORPH_MAP\}\}/g, morphMap);
|
|
2151
2154
|
return {
|
|
2152
|
-
path:
|
|
2155
|
+
path: `${options.providersPath}/OmnifyServiceProvider.php`,
|
|
2153
2156
|
content,
|
|
2154
2157
|
type: "service-provider",
|
|
2155
2158
|
overwrite: true,
|
|
@@ -2606,6 +2609,14 @@ var LARAVEL_CONFIG_SCHEMA = {
|
|
|
2606
2609
|
default: "app/Models/OmnifyBase",
|
|
2607
2610
|
group: "output"
|
|
2608
2611
|
},
|
|
2612
|
+
{
|
|
2613
|
+
key: "providersPath",
|
|
2614
|
+
type: "path",
|
|
2615
|
+
label: "Providers Path",
|
|
2616
|
+
description: "Directory for Laravel service provider files",
|
|
2617
|
+
default: "app/Providers",
|
|
2618
|
+
group: "output"
|
|
2619
|
+
},
|
|
2609
2620
|
{
|
|
2610
2621
|
key: "generateModels",
|
|
2611
2622
|
type: "boolean",
|
|
@@ -2645,6 +2656,7 @@ function resolveOptions3(options) {
|
|
|
2645
2656
|
migrationsPath: options?.migrationsPath ?? "database/migrations/omnify",
|
|
2646
2657
|
modelsPath: options?.modelsPath ?? "app/Models",
|
|
2647
2658
|
baseModelsPath: options?.baseModelsPath ?? "app/Models/OmnifyBase",
|
|
2659
|
+
providersPath: options?.providersPath ?? "app/Providers",
|
|
2648
2660
|
modelNamespace: options?.modelNamespace ?? "App\\Models",
|
|
2649
2661
|
baseModelNamespace: options?.baseModelNamespace ?? "App\\Models\\OmnifyBase",
|
|
2650
2662
|
generateModels: options?.generateModels ?? true,
|
|
@@ -2749,6 +2761,7 @@ function laravelPlugin(options) {
|
|
|
2749
2761
|
baseModelNamespace: resolved.baseModelNamespace,
|
|
2750
2762
|
modelPath: resolved.modelsPath,
|
|
2751
2763
|
baseModelPath: resolved.baseModelsPath,
|
|
2764
|
+
providersPath: resolved.providersPath,
|
|
2752
2765
|
customTypes: ctx.customTypes
|
|
2753
2766
|
};
|
|
2754
2767
|
const models = generateModels(ctx.schemas, modelOptions);
|