bigal 13.0.6 → 13.0.8

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/CONTRIBUTING.md CHANGED
@@ -1,22 +1,25 @@
1
- # Contributors
1
+ # Contributing Guidelines
2
2
 
3
- ## Checkin
3
+ ## Pull Request Format
4
4
 
5
- - Do checkin source (src)
6
- - Do not checkin build output (dist)
7
- - Do not checkin node_modules
5
+ The title of your PR should match the following format:
8
6
 
9
- ## Development
7
+ ```text
8
+ <type>: <short description>
9
+ ```
10
10
 
11
- In order to handle code style and static analysis, we run [Husky](https://github.com/typicode/husky) before each commit.
12
- This step ensures that formatting and checkin rules are followed. To make sure Husky runs correctly, please use the
13
- following workflow:
11
+ ### Types
14
12
 
15
- ```sh
16
- npm install # installs all devDependencies including Husky
17
- git add abc.ext # Add the files you've changed. This should include files in src, lib, and node_modules (see above)
18
- git commit -m "Informative commit message" # Commit. This will run Husky
19
- ```
13
+ - **docs** - Documentation changes only
14
+ - **feat** - Any new functionality additions
15
+ - **fix** - Bugfixes that don't add new functionality
16
+ - **test** - Test changes only
17
+ - **chore** - Anything else
18
+
19
+ Within the body of your PR, make sure you reference the issue that you have worked on, as well as pointing out anything
20
+ of note you wish us to look at during our review.
21
+
22
+ ### Commits
20
23
 
21
- During the commit step, Husky will take care of formatting all files with [Prettier](https://github.com/prettier/prettier).
22
- It will also make sure these changes are appropriately included in your commit (no further work is needed)
24
+ We do not care about the number, or style of commits in your history, because we squash merge every PR into main.
25
+ Feel free to commit in whatever style you feel comfortable with.
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;
@@ -2119,21 +2135,15 @@ ${stack}`;
2119
2135
 
2120
2136
  function column(dbColumnNameOrOptions, options) {
2121
2137
  return function columnDecorator(object, propertyName) {
2122
- if (!dbColumnNameOrOptions) {
2123
- dbColumnNameOrOptions = ___default.snakeCase(propertyName);
2124
- }
2138
+ dbColumnNameOrOptions ??= ___default.snakeCase(propertyName);
2125
2139
  let dbColumnName;
2126
2140
  if (typeof dbColumnNameOrOptions === "string") {
2127
2141
  dbColumnName = dbColumnNameOrOptions;
2128
2142
  } else {
2129
2143
  options = dbColumnNameOrOptions;
2130
2144
  }
2131
- if (!options) {
2132
- options = {};
2133
- }
2134
- if (!dbColumnName) {
2135
- dbColumnName = options.name ?? ___default.snakeCase(propertyName);
2136
- }
2145
+ options ??= {};
2146
+ dbColumnName ??= options.name ?? ___default.snakeCase(propertyName);
2137
2147
  const metadataStorage = getMetadataStorage();
2138
2148
  const columnCollectionOptions = options;
2139
2149
  if (columnCollectionOptions.collection || columnCollectionOptions.via) {
@@ -2192,12 +2202,8 @@ function createDateColumn(dbColumnNameOrOptions, options) {
2192
2202
  options = dbColumnNameOrOptions;
2193
2203
  }
2194
2204
  if (dbColumnNameOrOptions) {
2195
- if (!options) {
2196
- options = {};
2197
- }
2198
- if (!dbColumnName) {
2199
- dbColumnName = options.name ?? ___default.snakeCase(propertyName);
2200
- }
2205
+ options ??= {};
2206
+ dbColumnName ??= options.name ?? ___default.snakeCase(propertyName);
2201
2207
  metadataStorage.columns.push(
2202
2208
  new ColumnTypeMetadata({
2203
2209
  target: object.constructor.name,
@@ -2214,7 +2220,7 @@ function createDateColumn(dbColumnNameOrOptions, options) {
2214
2220
  name: dbColumnName ?? ___default.snakeCase(propertyName),
2215
2221
  propertyName,
2216
2222
  createDate: true,
2217
- required: options ? options.required : undefined,
2223
+ required: options ? options.required : void 0,
2218
2224
  type: options ? options.type : "datetime"
2219
2225
  });
2220
2226
  }
@@ -2230,12 +2236,8 @@ function primaryColumn(dbColumnNameOrOptions, options) {
2230
2236
  options = dbColumnNameOrOptions;
2231
2237
  }
2232
2238
  if (dbColumnNameOrOptions) {
2233
- if (!options) {
2234
- options = {};
2235
- }
2236
- if (!dbColumnName) {
2237
- dbColumnName = options.name ?? ___default.snakeCase(propertyName);
2238
- }
2239
+ options ??= {};
2240
+ dbColumnName ??= options.name ?? ___default.snakeCase(propertyName);
2239
2241
  const { type } = options;
2240
2242
  const { model } = options;
2241
2243
  const metadataStorage = getMetadataStorage();
@@ -2269,9 +2271,9 @@ function primaryColumn(dbColumnNameOrOptions, options) {
2269
2271
  name: dbColumnName ?? ___default.snakeCase(propertyName),
2270
2272
  propertyName,
2271
2273
  primary: true,
2272
- required: options ? options.required : undefined,
2273
- type: options ? options.type : undefined,
2274
- model: options ? options.model : undefined
2274
+ required: options ? options.required : void 0,
2275
+ type: options ? options.type : void 0,
2276
+ model: options ? options.model : void 0
2275
2277
  });
2276
2278
  }
2277
2279
  };
@@ -2286,12 +2288,8 @@ function table(dbNameOrTableOptions, options) {
2286
2288
  } else {
2287
2289
  options = dbNameOrTableOptions;
2288
2290
  }
2289
- if (!options) {
2290
- options = {};
2291
- }
2292
- if (!options.name) {
2293
- options.name = dbTableName ?? ___default.snakeCase(className);
2294
- }
2291
+ options ??= {};
2292
+ options.name ??= dbTableName ?? ___default.snakeCase(className);
2295
2293
  const metadataStorage = getMetadataStorage();
2296
2294
  const modelMetadata = new ModelMetadata({
2297
2295
  name: className,
@@ -2313,12 +2311,8 @@ function updateDateColumn(dbColumnNameOrOptions, options) {
2313
2311
  options = dbColumnNameOrOptions;
2314
2312
  }
2315
2313
  if (dbColumnNameOrOptions) {
2316
- if (!options) {
2317
- options = {};
2318
- }
2319
- if (!dbColumnName) {
2320
- dbColumnName = options.name ?? ___default.snakeCase(propertyName);
2321
- }
2314
+ options ??= {};
2315
+ dbColumnName ??= options.name ?? ___default.snakeCase(propertyName);
2322
2316
  const metadataStorage = getMetadataStorage();
2323
2317
  metadataStorage.columns.push(
2324
2318
  new ColumnTypeMetadata({
@@ -2337,7 +2331,7 @@ function updateDateColumn(dbColumnNameOrOptions, options) {
2337
2331
  name: dbColumnName ?? ___default.snakeCase(propertyName),
2338
2332
  propertyName,
2339
2333
  updateDate: true,
2340
- required: options ? options.required : undefined,
2334
+ required: options ? options.required : void 0,
2341
2335
  type: options ? options.type : "datetime"
2342
2336
  });
2343
2337
  }
@@ -2353,12 +2347,8 @@ function versionColumn(dbColumnNameOrOptions, options) {
2353
2347
  options = dbColumnNameOrOptions;
2354
2348
  }
2355
2349
  if (dbColumnNameOrOptions) {
2356
- if (!options) {
2357
- options = {};
2358
- }
2359
- if (!dbColumnName) {
2360
- dbColumnName = options.name ?? ___default.snakeCase(propertyName);
2361
- }
2350
+ options ??= {};
2351
+ dbColumnName ??= options.name ?? ___default.snakeCase(propertyName);
2362
2352
  const metadataStorage = getMetadataStorage();
2363
2353
  metadataStorage.columns.push(
2364
2354
  new ColumnTypeMetadata({
@@ -2377,8 +2367,8 @@ function versionColumn(dbColumnNameOrOptions, options) {
2377
2367
  name: dbColumnName ?? ___default.snakeCase(propertyName),
2378
2368
  propertyName,
2379
2369
  version: true,
2380
- required: options ? options.required : undefined,
2381
- type: options ? options.type : undefined
2370
+ required: options ? options.required : void 0,
2371
+ type: options ? options.type : void 0
2382
2372
  });
2383
2373
  }
2384
2374
  };
@@ -2457,6 +2447,7 @@ function initialize({ models, pool, readonlyPool = pool, connections = {}, expos
2457
2447
  throw new Error(`Unable to find @table() on ${model.name}`);
2458
2448
  }
2459
2449
  modelMetadataByModelName[model.name] = new ModelMetadata({
2450
+ // eslint-disable-next-line @typescript-eslint/no-misused-spread
2460
2451
  ...modelMetadata,
2461
2452
  name: model.name,
2462
2453
  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
  /**