@ronin/compiler 0.17.16 → 0.17.17-fix-result-record-type-experimental-408
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 +19 -3
- package/dist/index.js +2 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -371,15 +371,31 @@ type PublicModel<T extends ModelEntityList<ModelField> = ModelEntityList<ModelFi
|
|
371
371
|
|
372
372
|
type RawRow = Array<unknown>;
|
373
373
|
type ObjectRow = Record<string, unknown>;
|
374
|
-
type
|
374
|
+
type ResultRecordBase<T extends Date | string = string> = {
|
375
|
+
/**
|
376
|
+
* The unique identifier of the record.
|
377
|
+
*/
|
375
378
|
id: string;
|
376
379
|
ronin: {
|
377
|
-
|
380
|
+
/**
|
381
|
+
* The timestamp of when the record was created.
|
382
|
+
*/
|
383
|
+
createdAt: T;
|
384
|
+
/**
|
385
|
+
* The ID of the user who created the record.
|
386
|
+
*/
|
378
387
|
createdBy: string | null;
|
379
|
-
|
388
|
+
/**
|
389
|
+
* The timestamp of the last time the record was updated.
|
390
|
+
*/
|
391
|
+
updatedAt: T;
|
392
|
+
/**
|
393
|
+
* The ID of the user who last updated the record.
|
394
|
+
*/
|
380
395
|
updatedBy: string | null;
|
381
396
|
};
|
382
397
|
};
|
398
|
+
type ResultRecord = Record<string, unknown> & ResultRecordBase;
|
383
399
|
type SingleRecordResult<T = ResultRecord> = {
|
384
400
|
record: T | null;
|
385
401
|
modelFields: Record<ModelField['slug'], ModelField['type']>;
|
package/dist/index.js
CHANGED
@@ -444,6 +444,8 @@ var handleSelecting = (models, model, statementParams, single, instructions, opt
|
|
444
444
|
} else {
|
445
445
|
mountedValue = prepareStatementValue(statementParams, value);
|
446
446
|
}
|
447
|
+
const existingField = selectedFields.findIndex((field) => field.slug === key);
|
448
|
+
if (existingField > -1) selectedFields.splice(existingField, 1);
|
447
449
|
selectedFields.push({
|
448
450
|
slug: key,
|
449
451
|
mountingPath: key,
|