@ronin/compiler 0.14.0-leo-ron-1099-1-experimental-313 → 0.14.0-leo-ron-1099-1-experimental-314
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.js +11 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -419,12 +419,16 @@ var handleSelecting = (models, model, statementParams, single, instructions, opt
|
|
419
419
|
const joinedSelectedFields = [];
|
420
420
|
const joinedColumns = [];
|
421
421
|
if (instructions.including) {
|
422
|
+
const symbol = getSymbol(instructions.including);
|
423
|
+
if (symbol?.type === "query") {
|
424
|
+
instructions.including.ronin_root = { ...instructions.including };
|
425
|
+
delete instructions.including[QUERY_SYMBOLS.QUERY];
|
426
|
+
}
|
422
427
|
const flatObject = flatten(instructions.including);
|
423
|
-
instructions.including = {};
|
424
428
|
for (const [key, value] of Object.entries(flatObject)) {
|
425
|
-
const
|
426
|
-
if (
|
427
|
-
const { queryModel, queryInstructions } = splitQuery(
|
429
|
+
const symbol2 = getSymbol(value);
|
430
|
+
if (symbol2?.type === "query") {
|
431
|
+
const { queryModel, queryInstructions } = splitQuery(symbol2.value);
|
428
432
|
const subQueryModel = getModelBySlug(models, queryModel);
|
429
433
|
isJoining = true;
|
430
434
|
if (queryInstructions?.selecting) options.expandColumns = true;
|
@@ -432,7 +436,7 @@ var handleSelecting = (models, model, statementParams, single, instructions, opt
|
|
432
436
|
const subSingle = queryModel !== subQueryModel.pluralSlug;
|
433
437
|
if (!model.tableAlias)
|
434
438
|
model.tableAlias = single && !subSingle ? `sub_${model.table}` : model.table;
|
435
|
-
const subMountingPath = `${options?.mountingPath ? `${options?.mountingPath}.` : ""}${subSingle ? key : `${key}[0]`}`;
|
439
|
+
const subMountingPath = key === "ronin_root" ? options.mountingPath : `${options?.mountingPath ? `${options?.mountingPath}.` : ""}${subSingle ? key : `${key}[0]`}`;
|
436
440
|
const { columns: nestedColumns, selectedFields: nestedSelectedFields } = handleSelecting(
|
437
441
|
models,
|
438
442
|
{ ...subQueryModel, tableAlias },
|
@@ -449,8 +453,8 @@ var handleSelecting = (models, model, statementParams, single, instructions, opt
|
|
449
453
|
continue;
|
450
454
|
}
|
451
455
|
let mountedValue = value;
|
452
|
-
if (
|
453
|
-
mountedValue = `(${parseFieldExpression(model, "including",
|
456
|
+
if (symbol2?.type === "expression") {
|
457
|
+
mountedValue = `(${parseFieldExpression(model, "including", symbol2.value)})`;
|
454
458
|
} else {
|
455
459
|
mountedValue = prepareStatementValue(statementParams, value);
|
456
460
|
}
|
package/package.json
CHANGED