@famgia/omnify-laravel 0.0.50 → 0.0.51
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-JCVJ7V7S.js → chunk-FSVH5TYU.js} +24 -6
- package/dist/chunk-FSVH5TYU.js.map +1 -0
- package/dist/index.cjs +23 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/plugin.cjs +23 -5
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-JCVJ7V7S.js.map +0 -1
package/dist/index.js
CHANGED
package/dist/plugin.cjs
CHANGED
|
@@ -1330,10 +1330,28 @@ function generateEntityBaseModel(schema, schemas, options, stubContent, authStub
|
|
|
1330
1330
|
const className = toPascalCase(schema.name);
|
|
1331
1331
|
const tableName = schema.options?.tableName ?? pluralize(toSnakeCase(schema.name));
|
|
1332
1332
|
const isAuth = schema.options?.authenticatable ?? false;
|
|
1333
|
-
const
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1333
|
+
const hasAutoId2 = schema.options?.id !== false;
|
|
1334
|
+
let primaryKey = "id";
|
|
1335
|
+
let isStringKey = false;
|
|
1336
|
+
let isUuid = false;
|
|
1337
|
+
let isNonIncrementing = false;
|
|
1338
|
+
if (hasAutoId2) {
|
|
1339
|
+
const idType = schema.options?.idType ?? "BigInt";
|
|
1340
|
+
isUuid = idType === "Uuid";
|
|
1341
|
+
isStringKey = idType === "Uuid" || idType === "String";
|
|
1342
|
+
isNonIncrementing = isUuid;
|
|
1343
|
+
} else {
|
|
1344
|
+
const properties2 = schema.properties ?? {};
|
|
1345
|
+
for (const [propName, propDef] of Object.entries(properties2)) {
|
|
1346
|
+
if (propDef.primary === true) {
|
|
1347
|
+
primaryKey = toSnakeCase(propName);
|
|
1348
|
+
const propType = propDef.type;
|
|
1349
|
+
isStringKey = propType === "String" || propType === "Text" || propType === "Email";
|
|
1350
|
+
isNonIncrementing = true;
|
|
1351
|
+
break;
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1337
1355
|
const imports = [];
|
|
1338
1356
|
const traits = [];
|
|
1339
1357
|
const fillable = [];
|
|
@@ -1454,7 +1472,7 @@ ${docProperties.join("\n")}
|
|
|
1454
1472
|
protected $keyType = 'string';
|
|
1455
1473
|
|
|
1456
1474
|
` : "";
|
|
1457
|
-
const incrementing =
|
|
1475
|
+
const incrementing = isNonIncrementing ? ` /**
|
|
1458
1476
|
* Indicates if the IDs are auto-incrementing.
|
|
1459
1477
|
*/
|
|
1460
1478
|
public $incrementing = false;
|