@ronin/compiler 0.12.7-leo-ron-1071-experimental-261 → 0.12.8-leo-ron-1071-experimental-262
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 +85 -15408
- package/dist/index.js +11 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -688,7 +688,7 @@ var handleSystemModel = (models, dependencyStatements, action, systemModel, newM
|
|
688
688
|
const query = {
|
689
689
|
[action]: { model: action === "create" ? systemModelClean : systemModelClean.slug }
|
690
690
|
};
|
691
|
-
if (action === "alter" && newModel) {
|
691
|
+
if (action === "alter" && newModel && "alter" in query && typeof query.alter !== "undefined") {
|
692
692
|
const { system: _2, ...newModelClean } = newModel;
|
693
693
|
query.alter.to = newModelClean;
|
694
694
|
}
|
@@ -697,19 +697,19 @@ var handleSystemModel = (models, dependencyStatements, action, systemModel, newM
|
|
697
697
|
};
|
698
698
|
var transformMetaQuery = (models, dependencyStatements, statementParams, query) => {
|
699
699
|
const { queryType } = splitQuery(query);
|
700
|
-
const subAltering = query.alter && !("to" in query.alter);
|
700
|
+
const subAltering = "alter" in query && query.alter && !("to" in query.alter);
|
701
701
|
const action = subAltering && query.alter ? Object.keys(query.alter).filter((key) => key !== "model")[0] : queryType;
|
702
702
|
const actionReadable = action === "create" ? "creating" : action === "alter" ? "altering" : "dropping";
|
703
703
|
const entity = subAltering && query.alter ? Object.keys(query.alter[action])[0] : "model";
|
704
704
|
let slug = entity === "model" && action === "create" ? null : query[queryType].model;
|
705
705
|
let modelSlug = slug;
|
706
706
|
let jsonValue;
|
707
|
-
if (query.create) {
|
707
|
+
if ("create" in query && typeof query.create !== "undefined") {
|
708
708
|
const init = query.create.model;
|
709
709
|
jsonValue = "to" in query.create ? { slug: init, ...query.create.to } : init;
|
710
710
|
slug = modelSlug = jsonValue.slug;
|
711
711
|
}
|
712
|
-
if (query.alter) {
|
712
|
+
if ("alter" in query && typeof query.alter !== "undefined") {
|
713
713
|
if ("to" in query.alter) {
|
714
714
|
jsonValue = query.alter.to;
|
715
715
|
} else {
|
@@ -719,7 +719,9 @@ var transformMetaQuery = (models, dependencyStatements, statementParams, query)
|
|
719
719
|
slug = item.slug || `${entity}Slug`;
|
720
720
|
jsonValue = { slug, ...item };
|
721
721
|
}
|
722
|
-
if ("alter" in query.alter
|
722
|
+
if ("alter" in query.alter && typeof query.alter.alter !== "undefined") {
|
723
|
+
jsonValue = query.alter.alter.to;
|
724
|
+
}
|
723
725
|
}
|
724
726
|
}
|
725
727
|
if (!(modelSlug && slug)) return query;
|
@@ -1395,10 +1397,11 @@ var handleTo = (models, model, statementParams, queryType, dependencyStatements,
|
|
1395
1397
|
dependencyStatements.push(composeStatement("add", record));
|
1396
1398
|
}
|
1397
1399
|
} else if (isObject(fieldValue)) {
|
1398
|
-
|
1400
|
+
const value = fieldValue;
|
1401
|
+
for (const recordToAdd of value.containing || []) {
|
1399
1402
|
dependencyStatements.push(composeStatement("add", recordToAdd));
|
1400
1403
|
}
|
1401
|
-
for (const recordToRemove of
|
1404
|
+
for (const recordToRemove of value.notContaining || []) {
|
1402
1405
|
dependencyStatements.push(composeStatement("remove", recordToRemove));
|
1403
1406
|
}
|
1404
1407
|
}
|
@@ -1507,7 +1510,7 @@ var compileQueryInput = (defaultQuery, models, statementParams, options) => {
|
|
1507
1510
|
statementParams,
|
1508
1511
|
queryType,
|
1509
1512
|
dependencyStatements,
|
1510
|
-
{ with: instructions
|
1513
|
+
{ with: instructions?.with, to: instructions.to },
|
1511
1514
|
options?.parentModel
|
1512
1515
|
);
|
1513
1516
|
statement += `${toStatement} `;
|
package/package.json
CHANGED