@ronin/compiler 0.11.4-leo-ron-1083-2-experimental-238 → 0.11.4-leo-ron-1083-2-experimental-239

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.
Files changed (2) hide show
  1. package/dist/index.js +4 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1209,6 +1209,7 @@ var handleOrderedBy = (model, instruction) => {
1209
1209
  // src/instructions/selecting.ts
1210
1210
  var handleSelecting = (models, model, statementParams, instructions, options) => {
1211
1211
  let loadedFields = [];
1212
+ let expandColumns = false;
1212
1213
  let statement = "*";
1213
1214
  let isJoining = false;
1214
1215
  if (instructions.including) {
@@ -1217,9 +1218,10 @@ var handleSelecting = (models, model, statementParams, instructions, options) =>
1217
1218
  for (const [key, value] of Object.entries(flatObject)) {
1218
1219
  const symbol = getSymbol(value);
1219
1220
  if (symbol?.type === "query") {
1220
- isJoining = true;
1221
1221
  const { queryModel, queryInstructions } = splitQuery(symbol.value);
1222
1222
  const subQueryModel = getModelBySlug(models, queryModel);
1223
+ isJoining = true;
1224
+ expandColumns = Boolean(options?.expandColumns || queryInstructions?.selecting);
1223
1225
  const tableAlias = composeIncludedTableAlias(key);
1224
1226
  const single = queryModel !== subQueryModel.pluralSlug;
1225
1227
  if (!single) {
@@ -1230,7 +1232,7 @@ var handleSelecting = (models, model, statementParams, instructions, options) =>
1230
1232
  }) : subQueryModel.fields;
1231
1233
  for (const field of queryModelFields) {
1232
1234
  loadedFields.push({ ...field, parentField: key });
1233
- if (options?.expandColumns) {
1235
+ if (expandColumns) {
1234
1236
  const newValue2 = parseFieldExpression(
1235
1237
  { ...subQueryModel, tableAlias },
1236
1238
  "including",
@@ -1254,7 +1256,6 @@ var handleSelecting = (models, model, statementParams, instructions, options) =>
1254
1256
  });
1255
1257
  }
1256
1258
  }
1257
- const expandColumns = isJoining && options?.expandColumns;
1258
1259
  if (expandColumns) {
1259
1260
  instructions.selecting = model.fields.filter((field) => !(field.type === "link" && field.kind === "many")).map((field) => field.slug);
1260
1261
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ronin/compiler",
3
- "version": "0.11.4-leo-ron-1083-2-experimental-238",
3
+ "version": "0.11.4-leo-ron-1083-2-experimental-239",
4
4
  "type": "module",
5
5
  "description": "Compiles RONIN queries to SQL statements.",
6
6
  "publishConfig": {