@ronin/compiler 0.14.9-leo-ron-1099-1-experimental-341 → 0.14.9-leo-ron-1099-1-experimental-342

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/README.md CHANGED
@@ -127,26 +127,7 @@ new Transaction(queries, {
127
127
  // Instead of returning an array of parameters for every statement (which allows for
128
128
  // preventing SQL injections), all parameters are inlined directly into the SQL strings.
129
129
  // This option should only be used if the generated SQL will be manually verified.
130
- inlineParams: true,
131
-
132
- // By default, in the generated SQL statements, the compiler does not alias columns if
133
- // multiple different tables with the same column names are being joined. Only the table
134
- // names themselves are aliased.
135
- //
136
- // This ensures the cleanest possible SQL statements in conjunction with the default
137
- // behavior of SQL databases, where the result of a statement is a list (array) of
138
- // values, which are inherently not prone to conflicts.
139
- //
140
- // If the driver being used instead returns an object for every row, the driver must
141
- // ensure the uniqueness of every key in that object, which means prefixing duplicated
142
- // column names with the name of the respective table, if multiple tables are joined
143
- // (example for an object key: "table_name.column_name").
144
- //
145
- // Drivers that return objects for rows offer this behavior as an option that is
146
- // usually called "expand columns". If the driver being used does not offer such an
147
- // option, you can instead activate the option in the compiler, which results in longer
148
- // SQL statements because all column names are aliased.
149
- expandColumns: true
130
+ inlineParams: true
150
131
  });
151
132
  ```
152
133
 
package/dist/index.d.ts CHANGED
@@ -394,8 +394,6 @@ interface TransactionOptions {
394
394
  * separating them out into a dedicated `params` array.
395
395
  */
396
396
  inlineParams?: boolean;
397
- /** Alias column names that are duplicated when joining multiple tables. */
398
- expandColumns?: boolean;
399
397
  }
400
398
  declare class Transaction {
401
399
  #private;
package/dist/index.js CHANGED
@@ -424,7 +424,6 @@ var handleSelecting = (models, model, statementParams, single, instructions, opt
424
424
  }
425
425
  return newField;
426
426
  });
427
- if (instructions.selecting) options.expandColumns = true;
428
427
  const joinedSelectedFields = [];
429
428
  const joinedColumns = [];
430
429
  if (instructions.including) {
@@ -440,7 +439,6 @@ var handleSelecting = (models, model, statementParams, single, instructions, opt
440
439
  const { queryModel, queryInstructions } = splitQuery(symbol2.value);
441
440
  const subQueryModel = getModelBySlug(models, queryModel);
442
441
  isJoining = true;
443
- if (queryInstructions?.selecting) options.expandColumns = true;
444
442
  const subSingle = queryModel !== subQueryModel.pluralSlug;
445
443
  if (!model.tableAlias)
446
444
  model.tableAlias = single && !subSingle ? `sub_${model.table}` : model.table;
@@ -478,11 +476,7 @@ var handleSelecting = (models, model, statementParams, single, instructions, opt
478
476
  });
479
477
  }
480
478
  }
481
- let columns = ["*"];
482
- const fieldsToExpand = options.expandColumns ? selectedFields : selectedFields.filter(
483
- (loadedField) => typeof loadedField.mountedValue !== "undefined"
484
- );
485
- const extraColumns = fieldsToExpand.map((selectedField) => {
479
+ const columns = selectedFields.map((selectedField) => {
486
480
  if (selectedField.mountedValue) {
487
481
  return `${selectedField.mountedValue} as "${selectedField.slug}"`;
488
482
  }
@@ -494,11 +488,6 @@ var handleSelecting = (models, model, statementParams, single, instructions, opt
494
488
  }
495
489
  return fieldSelector;
496
490
  });
497
- if (options.expandColumns) {
498
- columns = extraColumns;
499
- } else if (extraColumns) {
500
- columns.push(...extraColumns);
501
- }
502
491
  columns.push(...joinedColumns);
503
492
  selectedFields.push(...joinedSelectedFields);
504
493
  return { columns: columns.join(", "), isJoining, selectedFields };
@@ -1995,8 +1984,7 @@ var Transaction = class {
1995
1984
  const { dependencies, main, selectedFields } = compileQueryInput(
1996
1985
  query,
1997
1986
  modelsWithPresets,
1998
- options?.inlineParams ? null : [],
1999
- { expandColumns: options?.expandColumns }
1987
+ options?.inlineParams ? null : []
2000
1988
  );
2001
1989
  const preDependencies = dependencies.filter(({ after }) => !after);
2002
1990
  const postDependencies = dependencies.map(({ after, ...rest }) => after ? rest : null).filter((item) => item != null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ronin/compiler",
3
- "version": "0.14.9-leo-ron-1099-1-experimental-341",
3
+ "version": "0.14.9-leo-ron-1099-1-experimental-342",
4
4
  "type": "module",
5
5
  "description": "Compiles RONIN queries to SQL statements.",
6
6
  "publishConfig": {