@ronin/compiler
Advanced tools
Comparing version 0.11.6 to 0.11.7
@@ -1670,5 +1670,8 @@ // src/utils/helpers.ts | ||
const query = this.queries.at(-index); | ||
const fields = this.fields.at(-index); | ||
const rawModelFields = this.fields.at(-index); | ||
const { queryType, queryModel, queryInstructions } = splitQuery(query); | ||
const model = getModelBySlug(this.models, queryModel); | ||
const modelFields = Object.fromEntries( | ||
model.fields.map((field) => [field.slug, field.type]) | ||
); | ||
if (queryType === "count") { | ||
@@ -1679,7 +1682,11 @@ return { amount: rows[0][0] }; | ||
if (single) { | ||
return { record: rows[0] ? this.formatRows(fields, rows, single) : null }; | ||
return { | ||
record: rows[0] ? this.formatRows(rawModelFields, rows, single) : null, | ||
modelFields | ||
}; | ||
} | ||
const pageSize = queryInstructions?.limitedTo; | ||
const output = { | ||
records: this.formatRows(fields, rows, single) | ||
records: this.formatRows(rawModelFields, rows, single), | ||
modelFields | ||
}; | ||
@@ -1686,0 +1693,0 @@ if (pageSize && output.records.length > 0) { |
{ | ||
"name": "@ronin/compiler", | ||
"version": "0.11.6", | ||
"version": "0.11.7", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "Compiles RONIN queries to SQL statements.", |
Sorry, the diff of this file is too big to display
462955
7803