bigal 13.0.6 → 13.0.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 13.0.7 - 2024-03-10
4
+
5
+ - Update npms
6
+
3
7
  ## 13.0.6 - 2024-01-08
4
8
 
5
9
  - Update npms
package/dist/index.cjs CHANGED
@@ -92,6 +92,7 @@ class ColumnCollectionMetadata extends ColumnBaseMetadata {
92
92
  _throughFn;
93
93
  /**
94
94
  * Type of the items in the collection
95
+ * @returns Name of collection
95
96
  */
96
97
  get collection() {
97
98
  if (this._collectionString) {
@@ -109,6 +110,7 @@ class ColumnCollectionMetadata extends ColumnBaseMetadata {
109
110
  via;
110
111
  /**
111
112
  * Name of the junction table for multi-multi associations
113
+ * @returns Name of junction table
112
114
  */
113
115
  get through() {
114
116
  if (this._throughString) {
@@ -118,7 +120,7 @@ class ColumnCollectionMetadata extends ColumnBaseMetadata {
118
120
  this._throughString = this._throughFn();
119
121
  return this._throughString;
120
122
  }
121
- return undefined;
123
+ return void 0;
122
124
  }
123
125
  constructor({
124
126
  target,
@@ -167,6 +169,7 @@ class ColumnModelMetadata extends ColumnBaseMetadata {
167
169
  _modelFn;
168
170
  /**
169
171
  * Name of the model represented by this column id
172
+ * @returns Name of model
170
173
  */
171
174
  get model() {
172
175
  if (this._modelString) {
@@ -1331,6 +1334,7 @@ class ReadonlyRepository {
1331
1334
  * @param {string[]} [args.select] - Array of model property names to return from the query.
1332
1335
  * @param {object} [args.where] - Object representing the where query
1333
1336
  * @param {string|object} [args.sort] - Property name(s) to sort by
1337
+ * @returns Database record or null
1334
1338
  */
1335
1339
  findOne(args = {}) {
1336
1340
  const { stack } = new Error(`${this.model.name}.findOne()`);
@@ -1356,7 +1360,7 @@ class ReadonlyRepository {
1356
1360
  poolOverride = value;
1357
1361
  break;
1358
1362
  default:
1359
- select = undefined;
1363
+ select = void 0;
1360
1364
  where = args;
1361
1365
  sort = null;
1362
1366
  isWhereCriteria = true;
@@ -1374,6 +1378,7 @@ class ReadonlyRepository {
1374
1378
  /**
1375
1379
  * Filters the query
1376
1380
  * @param {object} value - Object representing the where query
1381
+ * @returns Query instance
1377
1382
  */
1378
1383
  where(value) {
1379
1384
  where = value;
@@ -1388,6 +1393,7 @@ class ReadonlyRepository {
1388
1393
  * @param {string|object} [options.sort] - Property name(s) to sort by
1389
1394
  * @param {string|number} [options.skip] - Number of records to skip
1390
1395
  * @param {string|number} [options.limit] - Number of results to return
1396
+ * @returns Query instance
1391
1397
  */
1392
1398
  populate(propertyName, options) {
1393
1399
  if (select && !select.has(propertyName)) {
@@ -1411,6 +1417,7 @@ class ReadonlyRepository {
1411
1417
  /**
1412
1418
  * Sorts the query
1413
1419
  * @param {string|object} [value]
1420
+ * @returns Query instance
1414
1421
  */
1415
1422
  sort(value) {
1416
1423
  if (value) {
@@ -1478,6 +1485,7 @@ ${stack ?? ""}`;
1478
1485
  * @param {string|object} [args.sort] - Property name(s) to sort by
1479
1486
  * @param {string|number} [args.skip] - Number of records to skip
1480
1487
  * @param {string|number} [args.limit] - Number of results to return
1488
+ * @returns Database records
1481
1489
  */
1482
1490
  find(args = {}) {
1483
1491
  const { stack } = new Error(`${this.model.name}.find()`);
@@ -1511,7 +1519,7 @@ ${stack ?? ""}`;
1511
1519
  poolOverride = value;
1512
1520
  break;
1513
1521
  default:
1514
- select = undefined;
1522
+ select = void 0;
1515
1523
  where = args;
1516
1524
  sort = null;
1517
1525
  skip = null;
@@ -1530,6 +1538,7 @@ ${stack ?? ""}`;
1530
1538
  /**
1531
1539
  * Filters the query
1532
1540
  * @param {object} value - Object representing the where query
1541
+ * @returns Query instance
1533
1542
  */
1534
1543
  where(value) {
1535
1544
  where = value;
@@ -1544,6 +1553,7 @@ ${stack ?? ""}`;
1544
1553
  * @param {string|object} [options.sort] - Property name(s) to sort by
1545
1554
  * @param {string|number} [options.skip] - Number of records to skip
1546
1555
  * @param {string|number} [options.limit] - Number of results to return
1556
+ * @returns Query instance
1547
1557
  */
1548
1558
  populate(propertyName, options) {
1549
1559
  if (select && !select.has(propertyName)) {
@@ -1567,6 +1577,7 @@ ${stack ?? ""}`;
1567
1577
  /**
1568
1578
  * Sorts the query
1569
1579
  * @param {string|string[]|object} [value]
1580
+ * @returns Query instance
1570
1581
  */
1571
1582
  sort(value) {
1572
1583
  if (value) {
@@ -1577,6 +1588,7 @@ ${stack ?? ""}`;
1577
1588
  /**
1578
1589
  * Limits results returned by the query
1579
1590
  * @param {number} value
1591
+ * @returns Query instance
1580
1592
  */
1581
1593
  limit(value) {
1582
1594
  limit = value;
@@ -1585,6 +1597,7 @@ ${stack ?? ""}`;
1585
1597
  /**
1586
1598
  * Skips records returned by the query
1587
1599
  * @param {number} value
1600
+ * @returns Query instance
1588
1601
  */
1589
1602
  skip(value) {
1590
1603
  skip = value;
@@ -1596,8 +1609,9 @@ ${stack ?? ""}`;
1596
1609
  },
1597
1610
  /**
1598
1611
  * Pages records returned by the query
1599
- * @param {number} [page=1] - Page to return - Starts at 1
1600
- * @param {number} [limit=10] - Number of records to return
1612
+ * @param {number} [page] - Page to return - Starts at 1
1613
+ * @param {number} [limit] - Number of records to return
1614
+ * @returns Query instance
1601
1615
  */
1602
1616
  paginate({ page = 1, limit: paginateLimit = 10 }) {
1603
1617
  const safePage = Math.max(page, 1);
@@ -1671,6 +1685,7 @@ ${stack ?? ""}`;
1671
1685
  /**
1672
1686
  * Filters the query
1673
1687
  * @param {object} value - Object representing the where query
1688
+ * @returns Count result
1674
1689
  */
1675
1690
  where(value) {
1676
1691
  where = value;
@@ -1968,7 +1983,7 @@ class Repository extends ReadonlyRepository {
1968
1983
  * Creates an object using the specified values
1969
1984
  * @param {object|object[]} values - Values to insert as a new object. If an array is specified, multiple rows will be inserted
1970
1985
  * @param {object} [options]
1971
- * @param {boolean} [options.returnRecords=true] - Determines if inserted records should be returned
1986
+ * @param {boolean} [options.returnRecords] - Determines if inserted records should be returned
1972
1987
  * @param {string[]} [options.returnSelect] - Array of model property names to return from the query.
1973
1988
  * @param {object} [options.onConflict] - Options to handle conflicts due to a unique constraint or exclusion constraint error during insert
1974
1989
  * @returns {object|object[]|void} Return value from the db
@@ -2015,14 +2030,14 @@ class Repository extends ReadonlyRepository {
2015
2030
  }
2016
2031
  throw new Error("Unknown error getting created rows back from the database");
2017
2032
  }
2018
- return undefined;
2033
+ return void 0;
2019
2034
  }
2020
2035
  /**
2021
2036
  * Updates object(s) matching the where query, with the specified values
2022
2037
  * @param {object} where - Object representing the where query
2023
2038
  * @param {object} values - Values to update
2024
2039
  * @param {object} [options]
2025
- * @param {boolean} [options.returnRecords=true] - Determines if inserted records should be returned
2040
+ * @param {boolean} [options.returnRecords] - Determines if inserted records should be returned
2026
2041
  * @param {string[]} [options.returnSelect] - Array of model property names to return from the query.
2027
2042
  * @returns {object[]|void} Return values from the db or `true` if returnRecords=false
2028
2043
  */
@@ -2057,13 +2072,13 @@ class Repository extends ReadonlyRepository {
2057
2072
  if (returnRecords) {
2058
2073
  return this._buildInstances(results.rows);
2059
2074
  }
2060
- return undefined;
2075
+ return void 0;
2061
2076
  }
2062
2077
  /**
2063
2078
  * Destroys object(s) matching the where query
2064
2079
  * @param {object} where - Object representing the where query
2065
2080
  * @param {object} [options]
2066
- * @param {boolean} [options.returnRecords=false] - Determines if inserted records should be returned
2081
+ * @param {boolean} [options.returnRecords] - Determines if inserted records should be returned
2067
2082
  * @param {string[]} [options.returnSelect] - Array of model property names to return from the query.
2068
2083
  * @returns {object[]|void} `void` or records affected if returnRecords=true
2069
2084
  */
@@ -2079,6 +2094,7 @@ class Repository extends ReadonlyRepository {
2079
2094
  /**
2080
2095
  * Filters the query
2081
2096
  * @param {object} value - Object representing the where query
2097
+ * @returns Query instance
2082
2098
  */
2083
2099
  where(value) {
2084
2100
  where = value;
@@ -2214,7 +2230,7 @@ function createDateColumn(dbColumnNameOrOptions, options) {
2214
2230
  name: dbColumnName ?? ___default.snakeCase(propertyName),
2215
2231
  propertyName,
2216
2232
  createDate: true,
2217
- required: options ? options.required : undefined,
2233
+ required: options ? options.required : void 0,
2218
2234
  type: options ? options.type : "datetime"
2219
2235
  });
2220
2236
  }
@@ -2269,9 +2285,9 @@ function primaryColumn(dbColumnNameOrOptions, options) {
2269
2285
  name: dbColumnName ?? ___default.snakeCase(propertyName),
2270
2286
  propertyName,
2271
2287
  primary: true,
2272
- required: options ? options.required : undefined,
2273
- type: options ? options.type : undefined,
2274
- model: options ? options.model : undefined
2288
+ required: options ? options.required : void 0,
2289
+ type: options ? options.type : void 0,
2290
+ model: options ? options.model : void 0
2275
2291
  });
2276
2292
  }
2277
2293
  };
@@ -2337,7 +2353,7 @@ function updateDateColumn(dbColumnNameOrOptions, options) {
2337
2353
  name: dbColumnName ?? ___default.snakeCase(propertyName),
2338
2354
  propertyName,
2339
2355
  updateDate: true,
2340
- required: options ? options.required : undefined,
2356
+ required: options ? options.required : void 0,
2341
2357
  type: options ? options.type : "datetime"
2342
2358
  });
2343
2359
  }
@@ -2377,8 +2393,8 @@ function versionColumn(dbColumnNameOrOptions, options) {
2377
2393
  name: dbColumnName ?? ___default.snakeCase(propertyName),
2378
2394
  propertyName,
2379
2395
  version: true,
2380
- required: options ? options.required : undefined,
2381
- type: options ? options.type : undefined
2396
+ required: options ? options.required : void 0,
2397
+ type: options ? options.type : void 0
2382
2398
  });
2383
2399
  }
2384
2400
  };
@@ -2457,6 +2473,7 @@ function initialize({ models, pool, readonlyPool = pool, connections = {}, expos
2457
2473
  throw new Error(`Unable to find @table() on ${model.name}`);
2458
2474
  }
2459
2475
  modelMetadataByModelName[model.name] = new ModelMetadata({
2476
+ // eslint-disable-next-line @typescript-eslint/no-misused-spread
2460
2477
  ...modelMetadata,
2461
2478
  name: model.name,
2462
2479
  type: model
package/dist/index.d.cts CHANGED
@@ -223,6 +223,7 @@ declare class ColumnCollectionMetadata extends ColumnBaseMetadata {
223
223
  private _throughFn?;
224
224
  /**
225
225
  * Type of the items in the collection
226
+ * @returns Name of collection
226
227
  */
227
228
  get collection(): string;
228
229
  /**
@@ -231,6 +232,7 @@ declare class ColumnCollectionMetadata extends ColumnBaseMetadata {
231
232
  via: string;
232
233
  /**
233
234
  * Name of the junction table for multi-multi associations
235
+ * @returns Name of junction table
234
236
  */
235
237
  get through(): string | undefined;
236
238
  constructor({ target, //
@@ -248,6 +250,7 @@ declare class ColumnModelMetadata extends ColumnBaseMetadata {
248
250
  private _modelFn?;
249
251
  /**
250
252
  * Name of the model represented by this column id
253
+ * @returns Name of model
251
254
  */
252
255
  get model(): string;
253
256
  constructor({ target, //
@@ -439,7 +442,7 @@ interface DestroyResult<TEntity extends Entity, TReturn> extends PromiseLike<TRe
439
442
  where(args: WhereQuery<TEntity>): DestroyResult<TEntity, TReturn>;
440
443
  }
441
444
 
442
- type SortString<T extends Entity> = `${string & keyof OmitFunctions<OmitEntityCollections<T>>} ASC` | `${string & keyof OmitFunctions<OmitEntityCollections<T>>} asc` | `${string & keyof OmitFunctions<OmitEntityCollections<T>>} DESC` | `${string & keyof OmitFunctions<OmitEntityCollections<T>>} desc` | `${string & keyof OmitFunctions<OmitEntityCollections<T>>}`;
445
+ type SortString<T extends Entity> = `${string & keyof OmitFunctions<OmitEntityCollections<T>>} ASC` | `${string & keyof OmitFunctions<OmitEntityCollections<T>>} asc` | `${string & keyof OmitFunctions<OmitEntityCollections<T>>} DESC` | `${string & keyof OmitFunctions<OmitEntityCollections<T>>} desc` | (string & keyof OmitFunctions<OmitEntityCollections<T>>);
443
446
  type ValidateMultipleSorts<T extends Entity, TNextSortPart extends string, TPreviouslyValidatedSortString extends string, TSortString extends string> = TNextSortPart extends `, ${SortString<T>}${infer TRestSortPart}` ? TRestSortPart extends '' ? TSortString : ValidateMultipleSorts<T, TRestSortPart, TNextSortPart extends `${infer TValidatedSortPart}${TRestSortPart}` ? `${TPreviouslyValidatedSortString}${TValidatedSortPart}` : never, TSortString> : `${TPreviouslyValidatedSortString}, ${SortString<T>}`;
444
447
  type MultipleSortString<T extends Entity, TSortString extends string = string> = TSortString extends `${SortString<T>}${infer TRestSortPart}` ? TRestSortPart extends '' ? TSortString : ValidateMultipleSorts<T, TRestSortPart, TSortString extends `${infer TPreviouslyValidatedSortString}${TRestSortPart}` ? TPreviouslyValidatedSortString : never, TSortString> : SortString<T>;
445
448
  type SortObjectValue = -1 | 'asc' | 'desc' | 1;
@@ -679,6 +682,7 @@ declare class ReadonlyRepository<T extends Entity> implements IReadonlyRepositor
679
682
  * @param {string[]} [args.select] - Array of model property names to return from the query.
680
683
  * @param {object} [args.where] - Object representing the where query
681
684
  * @param {string|object} [args.sort] - Property name(s) to sort by
685
+ * @returns Database record or null
682
686
  */
683
687
  findOne<K extends string & keyof T, TReturn = QueryResult<Pick<T, K | keyof PickFunctions<T> | 'id'>>>(args?: FindOneArgs<T, K> | WhereQuery<T>): FindOneResult<T, TReturn>;
684
688
  /**
@@ -689,6 +693,7 @@ declare class ReadonlyRepository<T extends Entity> implements IReadonlyRepositor
689
693
  * @param {string|object} [args.sort] - Property name(s) to sort by
690
694
  * @param {string|number} [args.skip] - Number of records to skip
691
695
  * @param {string|number} [args.limit] - Number of results to return
696
+ * @returns Database records
692
697
  */
693
698
  find<K extends string & keyof T, TReturn = QueryResult<Pick<T, K | keyof PickFunctions<T> | 'id'>>>(args?: FindArgs<T, K> | WhereQuery<T>): FindResult<T, TReturn>;
694
699
  /**
package/dist/index.d.mts CHANGED
@@ -223,6 +223,7 @@ declare class ColumnCollectionMetadata extends ColumnBaseMetadata {
223
223
  private _throughFn?;
224
224
  /**
225
225
  * Type of the items in the collection
226
+ * @returns Name of collection
226
227
  */
227
228
  get collection(): string;
228
229
  /**
@@ -231,6 +232,7 @@ declare class ColumnCollectionMetadata extends ColumnBaseMetadata {
231
232
  via: string;
232
233
  /**
233
234
  * Name of the junction table for multi-multi associations
235
+ * @returns Name of junction table
234
236
  */
235
237
  get through(): string | undefined;
236
238
  constructor({ target, //
@@ -248,6 +250,7 @@ declare class ColumnModelMetadata extends ColumnBaseMetadata {
248
250
  private _modelFn?;
249
251
  /**
250
252
  * Name of the model represented by this column id
253
+ * @returns Name of model
251
254
  */
252
255
  get model(): string;
253
256
  constructor({ target, //
@@ -439,7 +442,7 @@ interface DestroyResult<TEntity extends Entity, TReturn> extends PromiseLike<TRe
439
442
  where(args: WhereQuery<TEntity>): DestroyResult<TEntity, TReturn>;
440
443
  }
441
444
 
442
- type SortString<T extends Entity> = `${string & keyof OmitFunctions<OmitEntityCollections<T>>} ASC` | `${string & keyof OmitFunctions<OmitEntityCollections<T>>} asc` | `${string & keyof OmitFunctions<OmitEntityCollections<T>>} DESC` | `${string & keyof OmitFunctions<OmitEntityCollections<T>>} desc` | `${string & keyof OmitFunctions<OmitEntityCollections<T>>}`;
445
+ type SortString<T extends Entity> = `${string & keyof OmitFunctions<OmitEntityCollections<T>>} ASC` | `${string & keyof OmitFunctions<OmitEntityCollections<T>>} asc` | `${string & keyof OmitFunctions<OmitEntityCollections<T>>} DESC` | `${string & keyof OmitFunctions<OmitEntityCollections<T>>} desc` | (string & keyof OmitFunctions<OmitEntityCollections<T>>);
443
446
  type ValidateMultipleSorts<T extends Entity, TNextSortPart extends string, TPreviouslyValidatedSortString extends string, TSortString extends string> = TNextSortPart extends `, ${SortString<T>}${infer TRestSortPart}` ? TRestSortPart extends '' ? TSortString : ValidateMultipleSorts<T, TRestSortPart, TNextSortPart extends `${infer TValidatedSortPart}${TRestSortPart}` ? `${TPreviouslyValidatedSortString}${TValidatedSortPart}` : never, TSortString> : `${TPreviouslyValidatedSortString}, ${SortString<T>}`;
444
447
  type MultipleSortString<T extends Entity, TSortString extends string = string> = TSortString extends `${SortString<T>}${infer TRestSortPart}` ? TRestSortPart extends '' ? TSortString : ValidateMultipleSorts<T, TRestSortPart, TSortString extends `${infer TPreviouslyValidatedSortString}${TRestSortPart}` ? TPreviouslyValidatedSortString : never, TSortString> : SortString<T>;
445
448
  type SortObjectValue = -1 | 'asc' | 'desc' | 1;
@@ -679,6 +682,7 @@ declare class ReadonlyRepository<T extends Entity> implements IReadonlyRepositor
679
682
  * @param {string[]} [args.select] - Array of model property names to return from the query.
680
683
  * @param {object} [args.where] - Object representing the where query
681
684
  * @param {string|object} [args.sort] - Property name(s) to sort by
685
+ * @returns Database record or null
682
686
  */
683
687
  findOne<K extends string & keyof T, TReturn = QueryResult<Pick<T, K | keyof PickFunctions<T> | 'id'>>>(args?: FindOneArgs<T, K> | WhereQuery<T>): FindOneResult<T, TReturn>;
684
688
  /**
@@ -689,6 +693,7 @@ declare class ReadonlyRepository<T extends Entity> implements IReadonlyRepositor
689
693
  * @param {string|object} [args.sort] - Property name(s) to sort by
690
694
  * @param {string|number} [args.skip] - Number of records to skip
691
695
  * @param {string|number} [args.limit] - Number of results to return
696
+ * @returns Database records
692
697
  */
693
698
  find<K extends string & keyof T, TReturn = QueryResult<Pick<T, K | keyof PickFunctions<T> | 'id'>>>(args?: FindArgs<T, K> | WhereQuery<T>): FindResult<T, TReturn>;
694
699
  /**
package/dist/index.d.ts CHANGED
@@ -223,6 +223,7 @@ declare class ColumnCollectionMetadata extends ColumnBaseMetadata {
223
223
  private _throughFn?;
224
224
  /**
225
225
  * Type of the items in the collection
226
+ * @returns Name of collection
226
227
  */
227
228
  get collection(): string;
228
229
  /**
@@ -231,6 +232,7 @@ declare class ColumnCollectionMetadata extends ColumnBaseMetadata {
231
232
  via: string;
232
233
  /**
233
234
  * Name of the junction table for multi-multi associations
235
+ * @returns Name of junction table
234
236
  */
235
237
  get through(): string | undefined;
236
238
  constructor({ target, //
@@ -248,6 +250,7 @@ declare class ColumnModelMetadata extends ColumnBaseMetadata {
248
250
  private _modelFn?;
249
251
  /**
250
252
  * Name of the model represented by this column id
253
+ * @returns Name of model
251
254
  */
252
255
  get model(): string;
253
256
  constructor({ target, //
@@ -439,7 +442,7 @@ interface DestroyResult<TEntity extends Entity, TReturn> extends PromiseLike<TRe
439
442
  where(args: WhereQuery<TEntity>): DestroyResult<TEntity, TReturn>;
440
443
  }
441
444
 
442
- type SortString<T extends Entity> = `${string & keyof OmitFunctions<OmitEntityCollections<T>>} ASC` | `${string & keyof OmitFunctions<OmitEntityCollections<T>>} asc` | `${string & keyof OmitFunctions<OmitEntityCollections<T>>} DESC` | `${string & keyof OmitFunctions<OmitEntityCollections<T>>} desc` | `${string & keyof OmitFunctions<OmitEntityCollections<T>>}`;
445
+ type SortString<T extends Entity> = `${string & keyof OmitFunctions<OmitEntityCollections<T>>} ASC` | `${string & keyof OmitFunctions<OmitEntityCollections<T>>} asc` | `${string & keyof OmitFunctions<OmitEntityCollections<T>>} DESC` | `${string & keyof OmitFunctions<OmitEntityCollections<T>>} desc` | (string & keyof OmitFunctions<OmitEntityCollections<T>>);
443
446
  type ValidateMultipleSorts<T extends Entity, TNextSortPart extends string, TPreviouslyValidatedSortString extends string, TSortString extends string> = TNextSortPart extends `, ${SortString<T>}${infer TRestSortPart}` ? TRestSortPart extends '' ? TSortString : ValidateMultipleSorts<T, TRestSortPart, TNextSortPart extends `${infer TValidatedSortPart}${TRestSortPart}` ? `${TPreviouslyValidatedSortString}${TValidatedSortPart}` : never, TSortString> : `${TPreviouslyValidatedSortString}, ${SortString<T>}`;
444
447
  type MultipleSortString<T extends Entity, TSortString extends string = string> = TSortString extends `${SortString<T>}${infer TRestSortPart}` ? TRestSortPart extends '' ? TSortString : ValidateMultipleSorts<T, TRestSortPart, TSortString extends `${infer TPreviouslyValidatedSortString}${TRestSortPart}` ? TPreviouslyValidatedSortString : never, TSortString> : SortString<T>;
445
448
  type SortObjectValue = -1 | 'asc' | 'desc' | 1;
@@ -679,6 +682,7 @@ declare class ReadonlyRepository<T extends Entity> implements IReadonlyRepositor
679
682
  * @param {string[]} [args.select] - Array of model property names to return from the query.
680
683
  * @param {object} [args.where] - Object representing the where query
681
684
  * @param {string|object} [args.sort] - Property name(s) to sort by
685
+ * @returns Database record or null
682
686
  */
683
687
  findOne<K extends string & keyof T, TReturn = QueryResult<Pick<T, K | keyof PickFunctions<T> | 'id'>>>(args?: FindOneArgs<T, K> | WhereQuery<T>): FindOneResult<T, TReturn>;
684
688
  /**
@@ -689,6 +693,7 @@ declare class ReadonlyRepository<T extends Entity> implements IReadonlyRepositor
689
693
  * @param {string|object} [args.sort] - Property name(s) to sort by
690
694
  * @param {string|number} [args.skip] - Number of records to skip
691
695
  * @param {string|number} [args.limit] - Number of results to return
696
+ * @returns Database records
692
697
  */
693
698
  find<K extends string & keyof T, TReturn = QueryResult<Pick<T, K | keyof PickFunctions<T> | 'id'>>>(args?: FindArgs<T, K> | WhereQuery<T>): FindResult<T, TReturn>;
694
699
  /**
package/dist/index.mjs CHANGED
@@ -86,6 +86,7 @@ class ColumnCollectionMetadata extends ColumnBaseMetadata {
86
86
  _throughFn;
87
87
  /**
88
88
  * Type of the items in the collection
89
+ * @returns Name of collection
89
90
  */
90
91
  get collection() {
91
92
  if (this._collectionString) {
@@ -103,6 +104,7 @@ class ColumnCollectionMetadata extends ColumnBaseMetadata {
103
104
  via;
104
105
  /**
105
106
  * Name of the junction table for multi-multi associations
107
+ * @returns Name of junction table
106
108
  */
107
109
  get through() {
108
110
  if (this._throughString) {
@@ -112,7 +114,7 @@ class ColumnCollectionMetadata extends ColumnBaseMetadata {
112
114
  this._throughString = this._throughFn();
113
115
  return this._throughString;
114
116
  }
115
- return undefined;
117
+ return void 0;
116
118
  }
117
119
  constructor({
118
120
  target,
@@ -161,6 +163,7 @@ class ColumnModelMetadata extends ColumnBaseMetadata {
161
163
  _modelFn;
162
164
  /**
163
165
  * Name of the model represented by this column id
166
+ * @returns Name of model
164
167
  */
165
168
  get model() {
166
169
  if (this._modelString) {
@@ -1325,6 +1328,7 @@ class ReadonlyRepository {
1325
1328
  * @param {string[]} [args.select] - Array of model property names to return from the query.
1326
1329
  * @param {object} [args.where] - Object representing the where query
1327
1330
  * @param {string|object} [args.sort] - Property name(s) to sort by
1331
+ * @returns Database record or null
1328
1332
  */
1329
1333
  findOne(args = {}) {
1330
1334
  const { stack } = new Error(`${this.model.name}.findOne()`);
@@ -1350,7 +1354,7 @@ class ReadonlyRepository {
1350
1354
  poolOverride = value;
1351
1355
  break;
1352
1356
  default:
1353
- select = undefined;
1357
+ select = void 0;
1354
1358
  where = args;
1355
1359
  sort = null;
1356
1360
  isWhereCriteria = true;
@@ -1368,6 +1372,7 @@ class ReadonlyRepository {
1368
1372
  /**
1369
1373
  * Filters the query
1370
1374
  * @param {object} value - Object representing the where query
1375
+ * @returns Query instance
1371
1376
  */
1372
1377
  where(value) {
1373
1378
  where = value;
@@ -1382,6 +1387,7 @@ class ReadonlyRepository {
1382
1387
  * @param {string|object} [options.sort] - Property name(s) to sort by
1383
1388
  * @param {string|number} [options.skip] - Number of records to skip
1384
1389
  * @param {string|number} [options.limit] - Number of results to return
1390
+ * @returns Query instance
1385
1391
  */
1386
1392
  populate(propertyName, options) {
1387
1393
  if (select && !select.has(propertyName)) {
@@ -1405,6 +1411,7 @@ class ReadonlyRepository {
1405
1411
  /**
1406
1412
  * Sorts the query
1407
1413
  * @param {string|object} [value]
1414
+ * @returns Query instance
1408
1415
  */
1409
1416
  sort(value) {
1410
1417
  if (value) {
@@ -1472,6 +1479,7 @@ ${stack ?? ""}`;
1472
1479
  * @param {string|object} [args.sort] - Property name(s) to sort by
1473
1480
  * @param {string|number} [args.skip] - Number of records to skip
1474
1481
  * @param {string|number} [args.limit] - Number of results to return
1482
+ * @returns Database records
1475
1483
  */
1476
1484
  find(args = {}) {
1477
1485
  const { stack } = new Error(`${this.model.name}.find()`);
@@ -1505,7 +1513,7 @@ ${stack ?? ""}`;
1505
1513
  poolOverride = value;
1506
1514
  break;
1507
1515
  default:
1508
- select = undefined;
1516
+ select = void 0;
1509
1517
  where = args;
1510
1518
  sort = null;
1511
1519
  skip = null;
@@ -1524,6 +1532,7 @@ ${stack ?? ""}`;
1524
1532
  /**
1525
1533
  * Filters the query
1526
1534
  * @param {object} value - Object representing the where query
1535
+ * @returns Query instance
1527
1536
  */
1528
1537
  where(value) {
1529
1538
  where = value;
@@ -1538,6 +1547,7 @@ ${stack ?? ""}`;
1538
1547
  * @param {string|object} [options.sort] - Property name(s) to sort by
1539
1548
  * @param {string|number} [options.skip] - Number of records to skip
1540
1549
  * @param {string|number} [options.limit] - Number of results to return
1550
+ * @returns Query instance
1541
1551
  */
1542
1552
  populate(propertyName, options) {
1543
1553
  if (select && !select.has(propertyName)) {
@@ -1561,6 +1571,7 @@ ${stack ?? ""}`;
1561
1571
  /**
1562
1572
  * Sorts the query
1563
1573
  * @param {string|string[]|object} [value]
1574
+ * @returns Query instance
1564
1575
  */
1565
1576
  sort(value) {
1566
1577
  if (value) {
@@ -1571,6 +1582,7 @@ ${stack ?? ""}`;
1571
1582
  /**
1572
1583
  * Limits results returned by the query
1573
1584
  * @param {number} value
1585
+ * @returns Query instance
1574
1586
  */
1575
1587
  limit(value) {
1576
1588
  limit = value;
@@ -1579,6 +1591,7 @@ ${stack ?? ""}`;
1579
1591
  /**
1580
1592
  * Skips records returned by the query
1581
1593
  * @param {number} value
1594
+ * @returns Query instance
1582
1595
  */
1583
1596
  skip(value) {
1584
1597
  skip = value;
@@ -1590,8 +1603,9 @@ ${stack ?? ""}`;
1590
1603
  },
1591
1604
  /**
1592
1605
  * Pages records returned by the query
1593
- * @param {number} [page=1] - Page to return - Starts at 1
1594
- * @param {number} [limit=10] - Number of records to return
1606
+ * @param {number} [page] - Page to return - Starts at 1
1607
+ * @param {number} [limit] - Number of records to return
1608
+ * @returns Query instance
1595
1609
  */
1596
1610
  paginate({ page = 1, limit: paginateLimit = 10 }) {
1597
1611
  const safePage = Math.max(page, 1);
@@ -1665,6 +1679,7 @@ ${stack ?? ""}`;
1665
1679
  /**
1666
1680
  * Filters the query
1667
1681
  * @param {object} value - Object representing the where query
1682
+ * @returns Count result
1668
1683
  */
1669
1684
  where(value) {
1670
1685
  where = value;
@@ -1962,7 +1977,7 @@ class Repository extends ReadonlyRepository {
1962
1977
  * Creates an object using the specified values
1963
1978
  * @param {object|object[]} values - Values to insert as a new object. If an array is specified, multiple rows will be inserted
1964
1979
  * @param {object} [options]
1965
- * @param {boolean} [options.returnRecords=true] - Determines if inserted records should be returned
1980
+ * @param {boolean} [options.returnRecords] - Determines if inserted records should be returned
1966
1981
  * @param {string[]} [options.returnSelect] - Array of model property names to return from the query.
1967
1982
  * @param {object} [options.onConflict] - Options to handle conflicts due to a unique constraint or exclusion constraint error during insert
1968
1983
  * @returns {object|object[]|void} Return value from the db
@@ -2009,14 +2024,14 @@ class Repository extends ReadonlyRepository {
2009
2024
  }
2010
2025
  throw new Error("Unknown error getting created rows back from the database");
2011
2026
  }
2012
- return undefined;
2027
+ return void 0;
2013
2028
  }
2014
2029
  /**
2015
2030
  * Updates object(s) matching the where query, with the specified values
2016
2031
  * @param {object} where - Object representing the where query
2017
2032
  * @param {object} values - Values to update
2018
2033
  * @param {object} [options]
2019
- * @param {boolean} [options.returnRecords=true] - Determines if inserted records should be returned
2034
+ * @param {boolean} [options.returnRecords] - Determines if inserted records should be returned
2020
2035
  * @param {string[]} [options.returnSelect] - Array of model property names to return from the query.
2021
2036
  * @returns {object[]|void} Return values from the db or `true` if returnRecords=false
2022
2037
  */
@@ -2051,13 +2066,13 @@ class Repository extends ReadonlyRepository {
2051
2066
  if (returnRecords) {
2052
2067
  return this._buildInstances(results.rows);
2053
2068
  }
2054
- return undefined;
2069
+ return void 0;
2055
2070
  }
2056
2071
  /**
2057
2072
  * Destroys object(s) matching the where query
2058
2073
  * @param {object} where - Object representing the where query
2059
2074
  * @param {object} [options]
2060
- * @param {boolean} [options.returnRecords=false] - Determines if inserted records should be returned
2075
+ * @param {boolean} [options.returnRecords] - Determines if inserted records should be returned
2061
2076
  * @param {string[]} [options.returnSelect] - Array of model property names to return from the query.
2062
2077
  * @returns {object[]|void} `void` or records affected if returnRecords=true
2063
2078
  */
@@ -2073,6 +2088,7 @@ class Repository extends ReadonlyRepository {
2073
2088
  /**
2074
2089
  * Filters the query
2075
2090
  * @param {object} value - Object representing the where query
2091
+ * @returns Query instance
2076
2092
  */
2077
2093
  where(value) {
2078
2094
  where = value;
@@ -2208,7 +2224,7 @@ function createDateColumn(dbColumnNameOrOptions, options) {
2208
2224
  name: dbColumnName ?? _.snakeCase(propertyName),
2209
2225
  propertyName,
2210
2226
  createDate: true,
2211
- required: options ? options.required : undefined,
2227
+ required: options ? options.required : void 0,
2212
2228
  type: options ? options.type : "datetime"
2213
2229
  });
2214
2230
  }
@@ -2263,9 +2279,9 @@ function primaryColumn(dbColumnNameOrOptions, options) {
2263
2279
  name: dbColumnName ?? _.snakeCase(propertyName),
2264
2280
  propertyName,
2265
2281
  primary: true,
2266
- required: options ? options.required : undefined,
2267
- type: options ? options.type : undefined,
2268
- model: options ? options.model : undefined
2282
+ required: options ? options.required : void 0,
2283
+ type: options ? options.type : void 0,
2284
+ model: options ? options.model : void 0
2269
2285
  });
2270
2286
  }
2271
2287
  };
@@ -2331,7 +2347,7 @@ function updateDateColumn(dbColumnNameOrOptions, options) {
2331
2347
  name: dbColumnName ?? _.snakeCase(propertyName),
2332
2348
  propertyName,
2333
2349
  updateDate: true,
2334
- required: options ? options.required : undefined,
2350
+ required: options ? options.required : void 0,
2335
2351
  type: options ? options.type : "datetime"
2336
2352
  });
2337
2353
  }
@@ -2371,8 +2387,8 @@ function versionColumn(dbColumnNameOrOptions, options) {
2371
2387
  name: dbColumnName ?? _.snakeCase(propertyName),
2372
2388
  propertyName,
2373
2389
  version: true,
2374
- required: options ? options.required : undefined,
2375
- type: options ? options.type : undefined
2390
+ required: options ? options.required : void 0,
2391
+ type: options ? options.type : void 0
2376
2392
  });
2377
2393
  }
2378
2394
  };
@@ -2451,6 +2467,7 @@ function initialize({ models, pool, readonlyPool = pool, connections = {}, expos
2451
2467
  throw new Error(`Unable to find @table() on ${model.name}`);
2452
2468
  }
2453
2469
  modelMetadataByModelName[model.name] = new ModelMetadata({
2470
+ // eslint-disable-next-line @typescript-eslint/no-misused-spread
2454
2471
  ...modelMetadata,
2455
2472
  name: model.name,
2456
2473
  type: model
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bigal",
3
- "version": "13.0.6",
3
+ "version": "13.0.7",
4
4
  "description": "A fast and lightweight orm for postgres and node.js, written in typescript.",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -33,32 +33,32 @@
33
33
  "node": ">=18"
34
34
  },
35
35
  "dependencies": {
36
- "@types/pg": "^8.11.10",
36
+ "@types/pg": "^8.11.11",
37
37
  "lodash": "^4.17.21",
38
- "pg": "^8.13.1",
39
- "postgres-pool": "^9.0.6"
38
+ "pg": "^8.13.3",
39
+ "postgres-pool": "^10.0.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@faker-js/faker": "^9.3.0",
43
- "@types/chai": "^5.0.1",
44
- "@types/lodash": "^4.17.14",
42
+ "@faker-js/faker": "^9.6.0",
43
+ "@types/chai": "^5.2.0",
44
+ "@types/lodash": "^4.17.16",
45
45
  "@types/mocha": "10.0.10",
46
46
  "@types/node": ">=22",
47
- "chai": "^5.1.2",
48
- "eslint": "^9.17.0",
49
- "eslint-config-decent": "^2.3.1",
47
+ "chai": "^5.2.0",
48
+ "eslint": "^9.22.0",
49
+ "eslint-config-decent": "^2.6.1",
50
50
  "husky": "^9.1.7",
51
- "lint-staged": "^15.3.0",
52
- "markdownlint-cli": "^0.43.0",
53
- "mocha": "^11.0.1",
51
+ "lint-staged": "^15.4.3",
52
+ "markdownlint-cli": "^0.44.0",
53
+ "mocha": "^11.1.0",
54
54
  "npm-run-all": "^4.1.5",
55
55
  "pinst": "^3.0.0",
56
- "prettier": "^3.4.2",
56
+ "prettier": "^3.5.3",
57
57
  "strict-event-emitter-types": "^2.0.0",
58
58
  "ts-mockito": "^2.6.1",
59
59
  "ts-node": "^10.9.2",
60
- "typescript": "^5.7.2",
61
- "unbuild": "^3.2.0"
60
+ "typescript": "^5.8.2",
61
+ "unbuild": "^3.5.0"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "unbuild",