velocious 1.0.111 → 1.0.113

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.
@@ -0,0 +1,249 @@
1
+ // @ts-check
2
+ import { incorporate } from "incorporator";
3
+ import * as inflection from "inflection";
4
+ import { Logger } from "../../logger.js";
5
+ import Preloader from "./preloader.js";
6
+ import DatabaseQuery from "./index.js";
7
+ import RecordNotFoundError from "../record/record-not-found-error.js";
8
+ import SelectBase from "./select-base.js";
9
+ import SelectPlain from "./select-plain.js";
10
+ /**
11
+ * @typedef {{[key: string]: boolean | NestedPreloadRecord }} NestedPreloadRecord
12
+ * @typedef {string | string[] | import("./select-base.js").default | import("./select-base.js").default[]} SelectArgumentType
13
+ * @typedef {object | string} WhereArgumentType
14
+ */
15
+ /**
16
+ * @template {typeof import("../record/index.js").default} MC
17
+ * @typedef {InstanceType<MC>} ModelOf
18
+ */
19
+ /**
20
+ * @template {typeof import("../record/index.js").default} MC
21
+ * @typedef {import("./index.js").QueryArgsType & object} ModelClassQueryArgsType
22
+ * @property {MC} modelClass
23
+ */
24
+ /**
25
+ * A generic query over some model type.
26
+ * @template {typeof import("../record/index.js").default} MC
27
+ */
28
+ export default class VelociousDatabaseQueryModelClassQuery extends DatabaseQuery {
29
+ /**
30
+ * @param {ModelClassQueryArgsType<MC>} args
31
+ */
32
+ constructor(args) {
33
+ const { modelClass } = args;
34
+ if (!modelClass)
35
+ throw new Error(`No modelClass given in ${Object.keys(args).join(", ")}`);
36
+ super(args);
37
+ this.logger = new Logger(this);
38
+ this.modelClass = modelClass;
39
+ }
40
+ /** @returns {this} */
41
+ clone() {
42
+ // @ts-expect-error
43
+ const newQuery = /** @type {new (args: ModelClassQueryArgsType<MC>) => this} */ (new VelociousDatabaseQueryModelClassQuery({
44
+ driver: this.driver,
45
+ froms: [...this._froms],
46
+ handler: this.handler.clone(),
47
+ groups: [...this._groups],
48
+ joins: [...this._joins],
49
+ limit: this._limit,
50
+ modelClass: this.modelClass,
51
+ offset: this._offset,
52
+ orders: [...this._orders],
53
+ page: this._page,
54
+ perPage: this._perPage,
55
+ preload: { ...this._preload },
56
+ selects: [...this._selects],
57
+ wheres: [...this._wheres]
58
+ }));
59
+ // @ts-expect-error
60
+ return newQuery;
61
+ }
62
+ /** @returns {Promise<number>} */
63
+ async count() {
64
+ // Generate count SQL
65
+ let sql = `COUNT(${this.driver.quoteTable(this.getModelClass().tableName())}.${this.driver.quoteColumn(this.getModelClass().primaryKey())})`;
66
+ if (this.driver.getType() == "pgsql")
67
+ sql += "::int";
68
+ sql += " AS count";
69
+ // Clone query and execute count
70
+ const countQuery = this.clone();
71
+ countQuery._selects = [];
72
+ countQuery.select(sql);
73
+ const results = /** @type {{ count: number }[]} */ (await countQuery._executeQuery());
74
+ // The query isn't grouped and a single result has been given
75
+ if (results.length == 1) {
76
+ return results[0].count;
77
+ }
78
+ // The query may be grouped and a lot of different counts a given
79
+ let countResult = 0;
80
+ for (const result of results) {
81
+ if (!("count" in result)) {
82
+ throw new Error("Invalid count result");
83
+ }
84
+ countResult += result.count;
85
+ }
86
+ return countResult;
87
+ }
88
+ /** @returns {MC} */
89
+ getModelClass() {
90
+ if (!this.modelClass)
91
+ throw new Error("modelClass not set");
92
+ return this.modelClass;
93
+ }
94
+ /** @returns {Promise<void>} */
95
+ async destroyAll() {
96
+ const records = await this.toArray();
97
+ for (const record of records) {
98
+ await record.destroy();
99
+ }
100
+ }
101
+ /**
102
+ * @param {number|string} recordId
103
+ * @returns {Promise<InstanceType<MC>>}
104
+ */
105
+ async find(recordId) {
106
+ /** @type {{[key: string]: number | string}} */
107
+ const conditions = {};
108
+ conditions[this.getModelClass().primaryKey()] = recordId;
109
+ const newQuery = /** @type {VelociousDatabaseQueryModelClassQuery<MC>} */ (this.clone());
110
+ newQuery.where(conditions);
111
+ const record = (await newQuery.first());
112
+ if (!record) {
113
+ throw new RecordNotFoundError(`Couldn't find ${this.getModelClass().name} with '${this.getModelClass().primaryKey()}'=${recordId}`);
114
+ }
115
+ return record;
116
+ }
117
+ /**
118
+ * @param {{[key: string]: any}} conditions
119
+ * @returns {Promise<InstanceType<MC> | null>}
120
+ */
121
+ async findBy(conditions) {
122
+ /** @type {{[key: string]: number | string}} */
123
+ const newConditions = {};
124
+ for (const key in conditions) {
125
+ const keyUnderscore = inflection.underscore(key);
126
+ newConditions[keyUnderscore] = conditions[key];
127
+ }
128
+ const newQuery = /** @type {VelociousDatabaseQueryModelClassQuery<MC>} */ (this.clone());
129
+ newQuery.where(newConditions);
130
+ return await newQuery.first();
131
+ }
132
+ /**
133
+ * @param {{[key: string]: any}} conditions
134
+ * @param {function() : void} callback
135
+ * @returns {Promise<InstanceType<MC>>}
136
+ */
137
+ async findOrCreateBy(conditions, callback) {
138
+ const record = await this.findOrInitializeBy(conditions, callback);
139
+ if (record.isNewRecord()) {
140
+ await record.save();
141
+ }
142
+ return record;
143
+ }
144
+ /**
145
+ * @param {{[key: string]: any}} conditions
146
+ * @returns {Promise<InstanceType<MC>>}
147
+ */
148
+ async findByOrFail(conditions) {
149
+ /** @type {{[key: string]: number | string}} */
150
+ const newConditions = {};
151
+ for (const key in conditions) {
152
+ const keyUnderscore = inflection.underscore(key);
153
+ newConditions[keyUnderscore] = conditions[key];
154
+ }
155
+ const newQuery = /** @type {VelociousDatabaseQueryModelClassQuery<MC>} */ (this.clone());
156
+ newQuery.where(newConditions);
157
+ const model = await newQuery.first();
158
+ if (!model) {
159
+ throw new Error("Record not found");
160
+ }
161
+ return model;
162
+ }
163
+ /**
164
+ * @param {object} conditions
165
+ * @param {function(import("../record/index.js").default) : void} callback
166
+ * @returns {Promise<InstanceType<MC>>}
167
+ */
168
+ async findOrInitializeBy(conditions, callback) {
169
+ const record = await this.findBy(conditions);
170
+ if (record)
171
+ return record;
172
+ const ModelClass = this.getModelClass();
173
+ const newRecord = /** @type {InstanceType<MC>} */ (new ModelClass(conditions));
174
+ if (callback) {
175
+ callback(newRecord);
176
+ }
177
+ return newRecord;
178
+ }
179
+ /**
180
+ * @returns {Promise<InstanceType<MC>>}
181
+ */
182
+ async first() {
183
+ const newQuery = this.clone().limit(1).reorder(`${this.driver.quoteTable(this.getModelClass().tableName())}.${this.driver.quoteColumn(this.getModelClass().orderableColumn())}`);
184
+ const results = await newQuery.toArray();
185
+ return results[0];
186
+ }
187
+ /**
188
+ * @returns {Promise<InstanceType<MC>>}
189
+ */
190
+ async last() {
191
+ const primaryKey = this.getModelClass().primaryKey();
192
+ const tableName = this.getModelClass().tableName();
193
+ const results = await this.clone().reorder(`${this.driver.quoteTable(tableName)}.${this.driver.quoteColumn(primaryKey)} DESC`).limit(1).toArray();
194
+ return results[0];
195
+ }
196
+ /**
197
+ * @param {NestedPreloadRecord} data
198
+ * @returns {this}
199
+ */
200
+ preload(data) {
201
+ incorporate(this._preload, data);
202
+ return this;
203
+ }
204
+ /**
205
+ * @param {SelectArgumentType} select
206
+ * @returns {this}
207
+ */
208
+ select(select) {
209
+ if (Array.isArray(select)) {
210
+ for (const selectInArray of select) {
211
+ this.select(selectInArray);
212
+ }
213
+ return this;
214
+ }
215
+ if (typeof select == "string") {
216
+ this._selects.push(new SelectPlain(select));
217
+ }
218
+ else if (select instanceof SelectBase) {
219
+ this._selects.push(select);
220
+ }
221
+ else {
222
+ throw new Error(`Invalid select type: ${typeof select}`);
223
+ }
224
+ return this;
225
+ }
226
+ /**
227
+ * Converts query results to array of model instances
228
+ * @returns {Promise<Array<InstanceType<MC>>>}
229
+ */
230
+ async toArray() {
231
+ const models = [];
232
+ const results = await this.results();
233
+ for (const result of results) {
234
+ const ModelClass = this.getModelClass();
235
+ const model = /** @type {InstanceType<MC>} */ (new ModelClass());
236
+ model.loadExistingRecord(result);
237
+ models.push(model);
238
+ }
239
+ if (Object.keys(this._preload).length > 0 && models.length > 0) {
240
+ const preloader = new Preloader({
241
+ modelClass: this.modelClass,
242
+ models,
243
+ preload: this._preload
244
+ });
245
+ await preloader.run();
246
+ }
247
+ return models;
248
+ }
249
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"select-parser.d.ts","sourceRoot":"","sources":["../../../../src/database/query-parser/select-parser.js"],"names":[],"mappings":"AAIA;IACE;;;;OAIG;IACH,4CAHG;QAAsB,MAAM,EAApB,OAAO;QACmC,KAAK,EAA/C,OAAO,mBAAmB,EAAE,OAAO;KAC7C,EAMA;IAFC,gBAAoB;IACpB,2CAAkB;IAGpB,gBAyCC;CACF"}
1
+ {"version":3,"file":"select-parser.d.ts","sourceRoot":"","sources":["../../../../src/database/query-parser/select-parser.js"],"names":[],"mappings":"AAIA;IACE;;;;OAIG;IACH,4CAHG;QAAsB,MAAM,EAApB,OAAO;QACmC,KAAK,EAA/C,OAAO,mBAAmB,EAAE,OAAO;KAC7C,EAMA;IAFC,gBAAoB;IACpB,2CAAkB;IAGpB,gBA2CC;CACF"}
@@ -37,7 +37,9 @@ export default class VelociousDatabaseQueryParserSelectParser {
37
37
  count++;
38
38
  }
39
39
  if (query.getSelects().length == 0) {
40
- if (query.modelClass) {
40
+ // @ts-expect-error
41
+ if (query.constructor.name == "VelociousDatabaseQueryModelClassQuery" && query.modelClass) {
42
+ // @ts-expect-error
41
43
  sql += `${query.modelClass.connection().quoteTable(query.modelClass.tableName())}.*`;
42
44
  }
43
45
  else {
@@ -10,16 +10,13 @@ export class ValidationError extends Error {
10
10
  getModel(): VelociousDatabaseRecord;
11
11
  /**
12
12
  * @param {VelociousDatabaseRecord} model
13
+ * @returns {void}
13
14
  */
14
15
  setModel(model: VelociousDatabaseRecord): void;
15
16
  _model: VelociousDatabaseRecord;
16
- /**
17
- * @returns {Record<string, ValidationErrorObjectType[]>}
18
- */
17
+ /** @returns {Record<string, ValidationErrorObjectType[]>} */
19
18
  getValidationErrors(): Record<string, ValidationErrorObjectType[]>;
20
- /**
21
- * @param {Record<string, ValidationErrorObjectType[]>} validationErrors
22
- */
19
+ /** @param {Record<string, ValidationErrorObjectType[]>} validationErrors */
23
20
  setValidationErrors(validationErrors: Record<string, ValidationErrorObjectType[]>): void;
24
21
  _validationErrors: Record<string, ValidationErrorObjectType[]>;
25
22
  }
@@ -207,17 +204,17 @@ declare class VelociousDatabaseRecord {
207
204
  */
208
205
  static validates(attributeName: string, validators: Record<string, boolean | Record<string, any>>): Promise<void>;
209
206
  /**
210
- * @returns {Query}
207
+ * @returns {ModelClassQuery<typeof this>}
211
208
  */
212
- static _newQuery(): Query;
209
+ static _newQuery(): ModelClassQuery<typeof this>;
213
210
  /**
214
211
  * @returns {string}
215
212
  */
216
213
  static orderableColumn(): string;
217
214
  /**
218
- * @returns {Query}
215
+ * @returns {ModelClassQuery<typeof this>}
219
216
  */
220
- static all(): Query;
217
+ static all(): ModelClassQuery<typeof this>;
221
218
  /**
222
219
  * @returns {Promise<number>}
223
220
  */
@@ -244,62 +241,62 @@ declare class VelociousDatabaseRecord {
244
241
  }): Promise<InstanceType<typeof this>>;
245
242
  /**
246
243
  * @param {{[key: string]: any}} conditions
247
- * @param {function() : void} callback
244
+ * @param {function() : void} [callback]
248
245
  * @returns {Promise<InstanceType<typeof this>>}
249
246
  */
250
247
  static findOrCreateBy(conditions: {
251
248
  [key: string]: any;
252
- }, callback: () => void): Promise<InstanceType<typeof this>>;
249
+ }, callback?: () => void): Promise<InstanceType<typeof this>>;
253
250
  /**
254
251
  * @param {object} conditions
255
- * @param {function(import("../record/index.js").default) : void} callback
252
+ * @param {function(import("../record/index.js").default) : void} [callback]
256
253
  * @returns {Promise<InstanceType<typeof this>>}
257
254
  */
258
- static findOrInitializeBy(conditions: object, callback: (arg0: import("../record/index.js").default) => void): Promise<InstanceType<typeof this>>;
255
+ static findOrInitializeBy(conditions: object, callback?: (arg0: import("../record/index.js").default) => void): Promise<InstanceType<typeof this>>;
259
256
  /**
260
257
  * @returns {Promise<InstanceType<typeof this>>}
261
258
  */
262
259
  static first(): Promise<InstanceType<typeof this>>;
263
260
  /**
264
261
  * @param {string|{[key: string]: any}} join
265
- * @returns {Query}
262
+ * @returns {ModelClassQuery<typeof this>}
266
263
  */
267
264
  static joins(join: string | {
268
265
  [key: string]: any;
269
- }): Query;
266
+ }): ModelClassQuery<typeof this>;
270
267
  /**
271
268
  * @returns {Promise<InstanceType<typeof this>>}
272
269
  */
273
270
  static last(): Promise<InstanceType<typeof this>>;
274
271
  /**
275
272
  * @param {number} value
276
- * @returns {Query}
273
+ * @returns {ModelClassQuery<typeof this>}
277
274
  */
278
- static limit(value: number): Query;
275
+ static limit(value: number): ModelClassQuery<typeof this>;
279
276
  /**
280
277
  * @param {string | number} order
281
- * @returns {Query}
278
+ * @returns {ModelClassQuery<typeof this>}
282
279
  */
283
- static order(order: string | number): Query;
280
+ static order(order: string | number): ModelClassQuery<typeof this>;
284
281
  /**
285
282
  * @param {import("../query/index.js").NestedPreloadRecord} preload
286
- * @returns {Query}
283
+ * @returns {ModelClassQuery<typeof this>}
287
284
  */
288
- static preload(preload: import("../query/index.js").NestedPreloadRecord): Query;
285
+ static preload(preload: import("../query/index.js").NestedPreloadRecord): ModelClassQuery<typeof this>;
289
286
  /**
290
287
  * @param {import("../query/index.js").SelectArgumentType} select
291
- * @returns {Query}
288
+ * @returns {ModelClassQuery<typeof this>}
292
289
  */
293
- static select(select: import("../query/index.js").SelectArgumentType): Query;
290
+ static select(select: import("../query/index.js").SelectArgumentType): ModelClassQuery<typeof this>;
294
291
  /**
295
292
  * @returns {Promise<VelociousDatabaseRecord[]>}
296
293
  */
297
294
  static toArray(): Promise<VelociousDatabaseRecord[]>;
298
295
  /**
299
296
  * @param {import("../query/index.js").WhereArgumentType} where
300
- * @returns {Query}
297
+ * @returns {ModelClassQuery<typeof this>}
301
298
  */
302
- static where(where: import("../query/index.js").WhereArgumentType): Query;
299
+ static where(where: import("../query/index.js").WhereArgumentType): ModelClassQuery<typeof this>;
303
300
  /**
304
301
  * @param {Record<string, any>} changes
305
302
  */
@@ -440,25 +437,15 @@ declare class VelociousDatabaseRecord {
440
437
  */
441
438
  readColumn(attributeName: string): any;
442
439
  _belongsToChanges(): Record<string, any>;
443
- /**
444
- * @returns {Promise<void>}
445
- */
440
+ /** @returns {Promise<void>} */
446
441
  _createNewRecord(): Promise<void>;
447
- /**
448
- * @returns {Promise<void>}
449
- */
442
+ /** @returns {Promise<void>} */
450
443
  _updateRecordWithChanges(): Promise<void>;
451
- /**
452
- * @returns {number|string}
453
- */
444
+ /** @returns {number|string} */
454
445
  id(): number | string;
455
- /**
456
- * @returns {boolean}
457
- */
446
+ /** @returns {boolean} */
458
447
  isPersisted(): boolean;
459
- /**
460
- * @returns {boolean}
461
- */
448
+ /** @returns {boolean} */
462
449
  isNewRecord(): boolean;
463
450
  /**
464
451
  * @param {boolean} newIsNewRecord
@@ -466,17 +453,17 @@ declare class VelociousDatabaseRecord {
466
453
  */
467
454
  setIsNewRecord(newIsNewRecord: boolean): void;
468
455
  /**
456
+ * @template {typeof VelociousDatabaseRecord} MC
469
457
  * @param {string | number} id
458
+ * @returns {Promise<void>}
470
459
  */
471
- _reloadWithId(id: string | number): Promise<void>;
460
+ _reloadWithId<MC extends typeof VelociousDatabaseRecord>(id: string | number): Promise<void>;
472
461
  /**
473
462
  * @returns {Promise<void>}
474
463
  */
475
464
  reload(): Promise<void>;
476
465
  _runValidations(): Promise<void>;
477
- /**
478
- * @returns {string[]}
479
- */
466
+ /** @returns {string[]} */
480
467
  fullErrorMessages(): string[];
481
468
  /**
482
469
  * Assigns the attributes to the record and saves it.
@@ -491,5 +478,5 @@ declare class TranslationBase extends VelociousDatabaseRecord {
491
478
  */
492
479
  locale(): string;
493
480
  }
494
- import Query from "../query/index.js";
481
+ import ModelClassQuery from "../query/model-class-query.js";
495
482
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/database/record/index.js"],"names":[],"mappings":";wCAGa;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC;AAkB5C;IACE;;OAEG;IACH,YAFa,uBAAuB,CAMnC;IAED;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;;OAEG;IACH,MAFa,MAAM,GAAC,MAAM,CAezB;IAED;;OAEG;IACH,eAFa,OAAO,CAEuB;IAE3C;;OAEG;IACH,eAFa,OAAO,CAEsB;IAE1C;;;OAGG;IACH,+BAHW,OAAO,GACL,IAAI,CAIhB;IAED;;OAEG;IACH,kBAFW,MAAM,GAAG,MAAM,iBAiBzB;IAED;;OAEG;IACH,UAFa,OAAO,CAAC,IAAI,CAAC,CAIzB;IAED,iCAwBC;IAED;;OAEG;IACH,qBAFa,MAAM,EAAE,CAiBpB;IAED;;;OAGG;IACH,2BAFW,MAAM,iBAMhB;CACF;AAED;IACE;;;OAGG;IACH,UAFa,MAAM,CAIlB;CACF;kBA3nDiB,mBAAmB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/database/record/index.js"],"names":[],"mappings":";wCAGa;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC;AAkB5C;IACE;;OAEG;IACH,YAFa,uBAAuB,CAMnC;IAED;;;OAGG;IACH,gBAHW,uBAAuB,GACrB,IAAI,CAIhB;IADC,gCAAmB;IAGrB,6DAA6D;IAC7D,uBADc,MAAM,CAAC,MAAM,EAAE,yBAAyB,EAAE,CAAC,CAKxD;IAED,4EAA4E;IAC5E,sCADY,MAAM,CAAC,MAAM,EAAE,yBAAyB,EAAE,CAAC,QAGtD;IADC,+DAAyC;CAE5C;AAED;IACE,iEAOC;IAED,iEAOC;IAED,iDAOC;IAED,oFAOC;IAED,6FAOC;IAuBD,uFAEC;IAED;;;OAGG;IACH,mCAHW,MAAM,kBACN,cAAc,sBAAsB,EAAE,OAAO,QAIvD;IAED;;;OAGG;IACH,uCAHW,MAAM,GACJ,cAAc,sBAAsB,EAAE,OAAO,CAMzD;IAED;;;OAGG;IACH,6CAHW,MAAM,GACJ,OAAO,CAQnB;IAED;;;;;OAKG;IACH;;;OAGG;IACH,6CAHW,MAAM;oBALH,MAAM;gBACN,OAAO,uBAA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