@ronin/compiler 0.11.5-leo-ron-1083-experimental-245 → 0.11.6-leo-ron-1071-experimental-246

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
@@ -5998,11 +5998,13 @@ type NativeRecord = Record<string, unknown> & {
5998
5998
  };
5999
5999
  type SingleRecordResult<T = NativeRecord> = {
6000
6000
  record: T | null;
6001
+ modelFields: Record<ModelField['slug'], ModelField['type']>;
6001
6002
  };
6002
6003
  type MultipleRecordResult = {
6003
6004
  records: Array<NativeRecord>;
6004
6005
  moreAfter?: string;
6005
6006
  moreBefore?: string;
6007
+ modelFields: Record<ModelField['slug'], ModelField['type']>;
6006
6008
  };
6007
6009
  type AmountResult = {
6008
6010
  amount: number;
package/dist/index.js CHANGED
@@ -1667,19 +1667,26 @@ var Transaction = class {
1667
1667
  });
1668
1668
  return normalizedResults.map((rows, index) => {
1669
1669
  const query = this.queries.at(-index);
1670
- const fields = this.fields.at(-index);
1670
+ const rawModelFields = this.fields.at(-index);
1671
1671
  const { queryType, queryModel, queryInstructions } = splitQuery(query);
1672
1672
  const model = getModelBySlug(this.models, queryModel);
1673
+ const modelFields = Object.fromEntries(
1674
+ model.fields.map((field) => [field.slug, field.type])
1675
+ );
1673
1676
  if (queryType === "count") {
1674
1677
  return { amount: rows[0][0] };
1675
1678
  }
1676
1679
  const single = queryModel !== model.pluralSlug;
1677
1680
  if (single) {
1678
- return { record: rows[0] ? this.formatRows(fields, rows, single) : null };
1681
+ return {
1682
+ record: rows[0] ? this.formatRows(rawModelFields, rows, single) : null,
1683
+ modelFields
1684
+ };
1679
1685
  }
1680
1686
  const pageSize = queryInstructions?.limitedTo;
1681
1687
  const output = {
1682
- records: this.formatRows(fields, rows, single)
1688
+ records: this.formatRows(rawModelFields, rows, single),
1689
+ modelFields
1683
1690
  };
1684
1691
  if (pageSize && output.records.length > 0) {
1685
1692
  if (output.records.length > pageSize) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ronin/compiler",
3
- "version": "0.11.5-leo-ron-1083-experimental-245",
3
+ "version": "0.11.6-leo-ron-1071-experimental-246",
4
4
  "type": "module",
5
5
  "description": "Compiles RONIN queries to SQL statements.",
6
6
  "publishConfig": {