@ronin/compiler 0.11.2 → 0.11.3-leo-ron-1083-1-experimental-234

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.d.ts CHANGED
@@ -5990,14 +5990,14 @@ type NativeRecord = Record<string, unknown> & {
5990
5990
  id: string;
5991
5991
  ronin: {
5992
5992
  locked: boolean;
5993
- createdAt: Date;
5993
+ createdAt: string;
5994
5994
  createdBy: string | null;
5995
- updatedAt: Date;
5995
+ updatedAt: string;
5996
5996
  updatedBy: string | null;
5997
5997
  };
5998
5998
  };
5999
- type SingleRecordResult = {
6000
- record: NativeRecord | null;
5999
+ type SingleRecordResult<T = NativeRecord> = {
6000
+ record: T | null;
6001
6001
  };
6002
6002
  type MultipleRecordResult = {
6003
6003
  records: Array<NativeRecord>;
package/dist/index.js CHANGED
@@ -1256,7 +1256,7 @@ var handleSelecting = (models, model, statementParams, instructions, options) =>
1256
1256
  }
1257
1257
  const expandColumns = isJoining && options?.expandColumns;
1258
1258
  if (expandColumns) {
1259
- instructions.selecting = model.fields.map((field) => field.slug);
1259
+ instructions.selecting = model.fields.filter((field) => !(field.type === "link" && field.kind === "many")).map((field) => field.slug);
1260
1260
  }
1261
1261
  if (instructions.selecting) {
1262
1262
  const usableModel = expandColumns ? { ...model, tableAlias: model.tableAlias || model.table } : model;
@@ -1672,22 +1672,31 @@ var Transaction = class {
1672
1672
  records: this.formatRows(fields, rows, single)
1673
1673
  };
1674
1674
  if (pageSize && output.records.length > 0) {
1675
- if (queryInstructions?.before || queryInstructions?.after) {
1676
- const direction = queryInstructions?.before ? "moreAfter" : "moreBefore";
1677
- const firstRecord = output.records[0];
1675
+ if (output.records.length > pageSize) {
1676
+ if (queryInstructions?.before) {
1677
+ output.records.shift();
1678
+ } else {
1679
+ output.records.pop();
1680
+ }
1681
+ const direction = queryInstructions?.before ? "moreBefore" : "moreAfter";
1682
+ const lastRecord = output.records.at(
1683
+ direction === "moreAfter" ? -1 : 0
1684
+ );
1678
1685
  output[direction] = generatePaginationCursor(
1679
1686
  model,
1680
1687
  queryInstructions.orderedBy,
1681
- firstRecord
1688
+ lastRecord
1682
1689
  );
1683
1690
  }
1684
- if (output.records.length > pageSize) {
1685
- const direction = queryInstructions?.before ? "moreBefore" : "moreAfter";
1686
- const lastRecord = output.records.pop();
1691
+ if (queryInstructions?.before || queryInstructions?.after) {
1692
+ const direction = queryInstructions?.before ? "moreAfter" : "moreBefore";
1693
+ const firstRecord = output.records.at(
1694
+ direction === "moreAfter" ? -1 : 0
1695
+ );
1687
1696
  output[direction] = generatePaginationCursor(
1688
1697
  model,
1689
1698
  queryInstructions.orderedBy,
1690
- lastRecord
1699
+ firstRecord
1691
1700
  );
1692
1701
  }
1693
1702
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ronin/compiler",
3
- "version": "0.11.2",
3
+ "version": "0.11.3-leo-ron-1083-1-experimental-234",
4
4
  "type": "module",
5
5
  "description": "Compiles RONIN queries to SQL statements.",
6
6
  "publishConfig": {