@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.d.cts
CHANGED
|
@@ -281,6 +281,11 @@ interface ModelGeneratorOptions {
|
|
|
281
281
|
* @default 'app/Models'
|
|
282
282
|
*/
|
|
283
283
|
modelPath?: string;
|
|
284
|
+
/**
|
|
285
|
+
* Output path for service provider files.
|
|
286
|
+
* @default 'app/Providers'
|
|
287
|
+
*/
|
|
288
|
+
providersPath?: string;
|
|
284
289
|
/**
|
|
285
290
|
* Custom types registered by plugins.
|
|
286
291
|
* Used to expand compound types in fillable array.
|
package/dist/index.d.ts
CHANGED
|
@@ -281,6 +281,11 @@ interface ModelGeneratorOptions {
|
|
|
281
281
|
* @default 'app/Models'
|
|
282
282
|
*/
|
|
283
283
|
modelPath?: string;
|
|
284
|
+
/**
|
|
285
|
+
* Output path for service provider files.
|
|
286
|
+
* @default 'app/Providers'
|
|
287
|
+
*/
|
|
288
|
+
providersPath?: string;
|
|
284
289
|
/**
|
|
285
290
|
* Custom types registered by plugins.
|
|
286
291
|
* Used to expand compound types in fillable array.
|
package/dist/index.js
CHANGED
package/dist/plugin.cjs
CHANGED
|
@@ -202,6 +202,7 @@ function generatePolymorphicColumns(propertyName, property, allSchemas) {
|
|
|
202
202
|
if (assocProp.relation !== "MorphTo") {
|
|
203
203
|
return null;
|
|
204
204
|
}
|
|
205
|
+
const isNullable2 = assocProp.nullable !== false;
|
|
205
206
|
const targets = assocProp.targets;
|
|
206
207
|
if (!targets || targets.length === 0) {
|
|
207
208
|
return null;
|
|
@@ -213,7 +214,7 @@ function generatePolymorphicColumns(propertyName, property, allSchemas) {
|
|
|
213
214
|
name: typeColumnName,
|
|
214
215
|
method: "enum",
|
|
215
216
|
args: [typeColumnName, targets],
|
|
216
|
-
modifiers: [{ method: "nullable" }]
|
|
217
|
+
modifiers: isNullable2 ? [{ method: "nullable" }] : []
|
|
217
218
|
};
|
|
218
219
|
let idMethod = "unsignedBigInteger";
|
|
219
220
|
for (const targetName of targets) {
|
|
@@ -232,7 +233,7 @@ function generatePolymorphicColumns(propertyName, property, allSchemas) {
|
|
|
232
233
|
name: idColumnName,
|
|
233
234
|
method: idMethod,
|
|
234
235
|
args: idMethod === "string" ? [idColumnName, 255] : [idColumnName],
|
|
235
|
-
modifiers: [{ method: "nullable" }]
|
|
236
|
+
modifiers: isNullable2 ? [{ method: "nullable" }] : []
|
|
236
237
|
};
|
|
237
238
|
const indexes = [
|
|
238
239
|
{
|
|
@@ -1198,6 +1199,7 @@ var DEFAULT_OPTIONS = {
|
|
|
1198
1199
|
baseModelClassName: "BaseModel",
|
|
1199
1200
|
baseModelPath: "app/Models/OmnifyBase",
|
|
1200
1201
|
modelPath: "app/Models",
|
|
1202
|
+
providersPath: "app/Providers",
|
|
1201
1203
|
customTypes: /* @__PURE__ */ new Map()
|
|
1202
1204
|
};
|
|
1203
1205
|
function generateLocalizedDisplayNames(displayName, indent = " ") {
|
|
@@ -1246,6 +1248,7 @@ function resolveOptions(options) {
|
|
|
1246
1248
|
baseModelClassName: options?.baseModelClassName ?? DEFAULT_OPTIONS.baseModelClassName,
|
|
1247
1249
|
baseModelPath: options?.baseModelPath ?? DEFAULT_OPTIONS.baseModelPath,
|
|
1248
1250
|
modelPath: options?.modelPath ?? DEFAULT_OPTIONS.modelPath,
|
|
1251
|
+
providersPath: options?.providersPath ?? DEFAULT_OPTIONS.providersPath,
|
|
1249
1252
|
customTypes: options?.customTypes ?? /* @__PURE__ */ new Map()
|
|
1250
1253
|
};
|
|
1251
1254
|
}
|
|
@@ -2080,7 +2083,7 @@ function generateServiceProvider(schemas, options, stubContent) {
|
|
|
2080
2083
|
}).join("\n");
|
|
2081
2084
|
const content = stubContent.replace(/\{\{MORPH_MAP\}\}/g, morphMap);
|
|
2082
2085
|
return {
|
|
2083
|
-
path:
|
|
2086
|
+
path: `${options.providersPath}/OmnifyServiceProvider.php`,
|
|
2084
2087
|
content,
|
|
2085
2088
|
type: "service-provider",
|
|
2086
2089
|
overwrite: true,
|
|
@@ -2533,6 +2536,14 @@ var LARAVEL_CONFIG_SCHEMA = {
|
|
|
2533
2536
|
default: "app/Models/OmnifyBase",
|
|
2534
2537
|
group: "output"
|
|
2535
2538
|
},
|
|
2539
|
+
{
|
|
2540
|
+
key: "providersPath",
|
|
2541
|
+
type: "path",
|
|
2542
|
+
label: "Providers Path",
|
|
2543
|
+
description: "Directory for Laravel service provider files",
|
|
2544
|
+
default: "app/Providers",
|
|
2545
|
+
group: "output"
|
|
2546
|
+
},
|
|
2536
2547
|
{
|
|
2537
2548
|
key: "generateModels",
|
|
2538
2549
|
type: "boolean",
|
|
@@ -2572,6 +2583,7 @@ function resolveOptions3(options) {
|
|
|
2572
2583
|
migrationsPath: options?.migrationsPath ?? "database/migrations/omnify",
|
|
2573
2584
|
modelsPath: options?.modelsPath ?? "app/Models",
|
|
2574
2585
|
baseModelsPath: options?.baseModelsPath ?? "app/Models/OmnifyBase",
|
|
2586
|
+
providersPath: options?.providersPath ?? "app/Providers",
|
|
2575
2587
|
modelNamespace: options?.modelNamespace ?? "App\\Models",
|
|
2576
2588
|
baseModelNamespace: options?.baseModelNamespace ?? "App\\Models\\OmnifyBase",
|
|
2577
2589
|
generateModels: options?.generateModels ?? true,
|
|
@@ -2676,6 +2688,7 @@ function laravelPlugin(options) {
|
|
|
2676
2688
|
baseModelNamespace: resolved.baseModelNamespace,
|
|
2677
2689
|
modelPath: resolved.modelsPath,
|
|
2678
2690
|
baseModelPath: resolved.baseModelsPath,
|
|
2691
|
+
providersPath: resolved.providersPath,
|
|
2679
2692
|
customTypes: ctx.customTypes
|
|
2680
2693
|
};
|
|
2681
2694
|
const models = generateModels(ctx.schemas, modelOptions);
|