@ronin/compiler 0.17.1 → 0.17.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/index.d.ts +1 -1
- package/dist/index.js +6 -9
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -324,7 +324,7 @@ type ModelPreset = {
|
|
324
324
|
};
|
325
325
|
type ModelEntityList<T extends {
|
326
326
|
slug: string;
|
327
|
-
}> = Record<NonNullable<T['slug']>,
|
327
|
+
}> = Record<NonNullable<T['slug']>, T extends infer U ? Omit<U, 'slug'> : never>;
|
328
328
|
interface Model<T extends ModelEntityList<ModelField> = ModelEntityList<ModelField>> {
|
329
329
|
id: string;
|
330
330
|
name: string;
|
package/dist/index.js
CHANGED
@@ -587,7 +587,8 @@ var handleTo = (models, model, statementParams, queryType, dependencyStatements,
|
|
587
587
|
var handleUsing = (model, instructions) => {
|
588
588
|
const normalizedUsing = Array.isArray(instructions.using) ? Object.fromEntries(instructions.using.map((presetSlug) => [presetSlug, null])) : instructions.using;
|
589
589
|
if ("links" in normalizedUsing) {
|
590
|
-
for (const [fieldSlug,
|
590
|
+
for (const [fieldSlug, rest] of Object.entries(model.fields)) {
|
591
|
+
const field = { slug: fieldSlug, ...rest };
|
591
592
|
if (field.type !== "link" || field.kind === "many") continue;
|
592
593
|
normalizedUsing[fieldSlug] = null;
|
593
594
|
}
|
@@ -1394,7 +1395,8 @@ var addDefaultModelPresets = (list, model) => {
|
|
1394
1395
|
}
|
1395
1396
|
const childModels = list.map((subModel) => {
|
1396
1397
|
if (subModel.system?.associationSlug) return null;
|
1397
|
-
const field = Object.entries(subModel.fields).find(([
|
1398
|
+
const field = Object.entries(subModel.fields).find(([fieldSlug, rest]) => {
|
1399
|
+
const field2 = { slug: fieldSlug, ...rest };
|
1398
1400
|
return field2.type === "link" && field2.target === model.slug;
|
1399
1401
|
});
|
1400
1402
|
if (!field) return null;
|
@@ -1497,30 +1499,25 @@ var getSystemFields = (idPrefix) => ({
|
|
1497
1499
|
id: {
|
1498
1500
|
name: "ID",
|
1499
1501
|
type: "string",
|
1500
|
-
slug: "id",
|
1501
1502
|
defaultValue: ID_EXPRESSION(idPrefix)
|
1502
1503
|
},
|
1503
1504
|
"ronin.createdAt": {
|
1504
1505
|
name: "RONIN - Created At",
|
1505
1506
|
type: "date",
|
1506
|
-
slug: "ronin.createdAt",
|
1507
1507
|
defaultValue: CURRENT_TIME_EXPRESSION
|
1508
1508
|
},
|
1509
1509
|
"ronin.createdBy": {
|
1510
1510
|
name: "RONIN - Created By",
|
1511
|
-
type: "string"
|
1512
|
-
slug: "ronin.createdBy"
|
1511
|
+
type: "string"
|
1513
1512
|
},
|
1514
1513
|
"ronin.updatedAt": {
|
1515
1514
|
name: "RONIN - Updated At",
|
1516
1515
|
type: "date",
|
1517
|
-
slug: "ronin.updatedAt",
|
1518
1516
|
defaultValue: CURRENT_TIME_EXPRESSION
|
1519
1517
|
},
|
1520
1518
|
"ronin.updatedBy": {
|
1521
1519
|
name: "RONIN - Updated By",
|
1522
|
-
type: "string"
|
1523
|
-
slug: "ronin.updatedBy"
|
1520
|
+
type: "string"
|
1524
1521
|
}
|
1525
1522
|
});
|
1526
1523
|
var ROOT_MODEL = {
|