@ronin/compiler 0.17.21-leo-pagination-bug-experimental-424 → 0.17.21-leo-pagination-bug-experimental-425

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 +14 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -448,6 +448,7 @@ var handleSelecting = (models, model, statementParams, single, instructions, que
448
448
  {
449
449
  selecting: queryInstructions?.selecting,
450
450
  including: queryInstructions?.including,
451
+ orderedBy: queryInstructions?.orderedBy,
451
452
  limitedTo: instructions.limitedTo
452
453
  },
453
454
  queryType2,
@@ -473,13 +474,19 @@ var handleSelecting = (models, model, statementParams, single, instructions, que
473
474
  });
474
475
  }
475
476
  }
476
- if (queryType === "get" && !single && !selectedFields.some((field) => field.slug === "ronin.createdAt") && instructions.limitedTo) {
477
- selectedFields.push({
478
- ...getSystemFields(model.idPrefix)["ronin.createdAt"],
479
- slug: "ronin.createdAt",
480
- excluded: true,
481
- mountingPath: "ronin.createdAt"
477
+ if (queryType === "get" && !single && typeof instructions.limitedTo !== "undefined") {
478
+ const orderedFields = Object.values(instructions.orderedBy || {}).flat().map((fieldSlug) => {
479
+ return getFieldFromModel(model, fieldSlug, { instructionName: "orderedBy" });
482
480
  });
481
+ for (const orderedField of orderedFields) {
482
+ const { field } = orderedField;
483
+ if (selectedFields.some(({ slug }) => slug === field.slug)) continue;
484
+ selectedFields.push({
485
+ slug: field.slug,
486
+ mountingPath: field.slug,
487
+ excluded: true
488
+ });
489
+ }
483
490
  }
484
491
  const columns = selectedFields.map((selectedField) => {
485
492
  if (selectedField.mountedValue) {
@@ -1124,6 +1131,7 @@ var compileQueryInput = (defaultQuery, models, statementParams, options) => {
1124
1131
  {
1125
1132
  selecting: instructions?.selecting,
1126
1133
  including: instructions?.including,
1134
+ orderedBy: instructions?.orderedBy,
1127
1135
  limitedTo: instructions?.limitedTo
1128
1136
  },
1129
1137
  queryType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ronin/compiler",
3
- "version": "0.17.21-leo-pagination-bug-experimental-424",
3
+ "version": "0.17.21-leo-pagination-bug-experimental-425",
4
4
  "type": "module",
5
5
  "description": "Compiles RONIN queries to SQL statements.",
6
6
  "publishConfig": {