@ronin/compiler 0.14.14-leo-ron-1099-1-experimental-358 → 0.14.14-leo-ron-1099-1-experimental-359
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 +16 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -266,6 +266,7 @@ var handleIncluding = (models, model, statementParams, single, instruction, opti
|
|
266
266
|
if (symbol?.type !== "query") continue;
|
267
267
|
const { queryType, queryModel, queryInstructions } = splitQuery(symbol.value);
|
268
268
|
let modifiableQueryInstructions = queryInstructions;
|
269
|
+
if (queryType === "count") continue;
|
269
270
|
const relatedModel = getModelBySlug(models, queryModel);
|
270
271
|
let joinType = "LEFT";
|
271
272
|
let relatedTableSelector = `"${relatedModel.table}"`;
|
@@ -291,7 +292,8 @@ var handleIncluding = (models, model, statementParams, single, instruction, opti
|
|
291
292
|
}
|
292
293
|
},
|
293
294
|
models,
|
294
|
-
statementParams
|
295
|
+
statementParams,
|
296
|
+
{ parentModel: model }
|
295
297
|
);
|
296
298
|
relatedTableSelector = `(${subSelect.main.statement})`;
|
297
299
|
}
|
@@ -389,8 +391,20 @@ var handleSelecting = (models, model, statementParams, single, instructions, opt
|
|
389
391
|
for (const [key, value] of Object.entries(flatObject)) {
|
390
392
|
const symbol2 = getQuerySymbol(value);
|
391
393
|
if (symbol2?.type === "query") {
|
392
|
-
const { queryModel, queryInstructions } = splitQuery(symbol2.value);
|
394
|
+
const { queryType, queryModel, queryInstructions } = splitQuery(symbol2.value);
|
393
395
|
const subQueryModel = getModelBySlug(models, queryModel);
|
396
|
+
if (queryType === "count") {
|
397
|
+
const subSelect = compileQueryInput(symbol2.value, models, statementParams, {
|
398
|
+
parentModel: { ...model, tableAlias: model.table }
|
399
|
+
});
|
400
|
+
selectedFields.push({
|
401
|
+
slug: key,
|
402
|
+
mountingPath: key,
|
403
|
+
type: "number",
|
404
|
+
mountedValue: `(${subSelect.main.statement})`
|
405
|
+
});
|
406
|
+
continue;
|
407
|
+
}
|
394
408
|
isJoining = true;
|
395
409
|
const subSingle = queryModel !== subQueryModel.pluralSlug;
|
396
410
|
if (!model.tableAlias)
|
package/package.json
CHANGED