@ronin/compiler 0.14.13-leo-ron-1099-1-experimental-354 → 0.14.13-leo-ron-1099-1-experimental-355
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 +8 -6
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -113,7 +113,7 @@ type SetQuery = Record<string, Omit<CombinedInstructions, 'to'> & {
|
|
113
113
|
to: FieldSelector;
|
114
114
|
}>;
|
115
115
|
type AddQuery = Record<string, Omit<CombinedInstructions, 'with' | 'using'> & {
|
116
|
-
|
116
|
+
with: FieldSelector;
|
117
117
|
}>;
|
118
118
|
type RemoveQuery = Record<string, Omit<CombinedInstructions, 'to'>>;
|
119
119
|
type CountQuery = Record<string, Omit<CombinedInstructions, 'to'> | null>;
|
package/dist/index.js
CHANGED
@@ -550,7 +550,7 @@ var handleTo = (models, model, statementParams, queryType, dependencyStatements,
|
|
550
550
|
const query = compileQueryInput(
|
551
551
|
{
|
552
552
|
[subQueryType]: {
|
553
|
-
[associativeModelSlug]:
|
553
|
+
[associativeModelSlug]: { with: recordDetails }
|
554
554
|
}
|
555
555
|
},
|
556
556
|
models,
|
@@ -673,10 +673,12 @@ var compileQueryInput = (defaultQuery, models, statementParams, options) => {
|
|
673
673
|
statement += `"${model.table}" `;
|
674
674
|
}
|
675
675
|
if (queryType === "add" || queryType === "set") {
|
676
|
-
|
676
|
+
const instructionName = queryType === "add" ? "with" : "to";
|
677
|
+
const instructionValue = instructions[instructionName];
|
678
|
+
if (!(instructionValue && isObject(instructionValue)) || Object.keys(instructionValue).length === 0) {
|
677
679
|
throw new RoninError({
|
678
|
-
message: `When using a \`${queryType}\` query, the \`
|
679
|
-
code: "INVALID_TO_VALUE",
|
680
|
+
message: `When using a \`${queryType}\` query, the \`${instructionName}\` instruction must be a non-empty object.`,
|
681
|
+
code: instructionName === "to" ? "INVALID_TO_VALUE" : "INVALID_WITH_VALUE",
|
680
682
|
queries: [query]
|
681
683
|
});
|
682
684
|
}
|
@@ -686,7 +688,7 @@ var compileQueryInput = (defaultQuery, models, statementParams, options) => {
|
|
686
688
|
statementParams,
|
687
689
|
queryType,
|
688
690
|
dependencyStatements,
|
689
|
-
{ with: instructions.with, to:
|
691
|
+
{ with: instructions.with, to: instructionValue },
|
690
692
|
options?.parentModel
|
691
693
|
);
|
692
694
|
statement += `${toStatement} `;
|
@@ -1719,7 +1721,7 @@ var transformMetaQuery = (models, dependencyStatements, statementParams, query)
|
|
1719
1721
|
if (!Object.hasOwn(entities, entity2)) continue;
|
1720
1722
|
Object.defineProperty(modelWithObjects, entity2, { value: entities[entity2] });
|
1721
1723
|
}
|
1722
|
-
queryTypeDetails = {
|
1724
|
+
queryTypeDetails = { with: modelWithObjects };
|
1723
1725
|
getSystemModels(models, modelWithPresets).map((systemModel) => {
|
1724
1726
|
return handleSystemModel(models, dependencyStatements, "create", systemModel);
|
1725
1727
|
});
|
package/package.json
CHANGED