@decaf-ts/db-decorators 0.7.13 → 0.8.1

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.
Files changed (48) hide show
  1. package/README.md +1 -1
  2. package/dist/db-decorators.cjs +1 -1
  3. package/dist/db-decorators.cjs.map +1 -1
  4. package/dist/db-decorators.js +1 -1
  5. package/dist/db-decorators.js.map +1 -1
  6. package/lib/esm/index.d.ts +1 -1
  7. package/lib/esm/index.js +1 -1
  8. package/lib/esm/model/decorators.js +8 -3
  9. package/lib/esm/model/decorators.js.map +1 -1
  10. package/lib/esm/repository/Repository.d.ts +303 -48
  11. package/lib/esm/repository/Repository.js +370 -61
  12. package/lib/esm/repository/Repository.js.map +1 -1
  13. package/lib/esm/repository/constants.js +3 -0
  14. package/lib/esm/repository/constants.js.map +1 -1
  15. package/lib/esm/repository/index.d.ts +1 -2
  16. package/lib/esm/repository/index.js +1 -2
  17. package/lib/esm/repository/index.js.map +1 -1
  18. package/lib/esm/repository/types.d.ts +3 -0
  19. package/lib/esm/repository/utils.js +3 -3
  20. package/lib/esm/repository/utils.js.map +1 -1
  21. package/lib/esm/repository/wrappers.d.ts +1 -0
  22. package/lib/esm/repository/wrappers.js +28 -0
  23. package/lib/esm/repository/wrappers.js.map +1 -1
  24. package/lib/index.cjs +1 -1
  25. package/lib/index.d.ts +1 -1
  26. package/lib/model/decorators.cjs +8 -3
  27. package/lib/model/decorators.js.map +1 -1
  28. package/lib/repository/Repository.cjs +370 -61
  29. package/lib/repository/Repository.d.ts +303 -48
  30. package/lib/repository/Repository.js.map +1 -1
  31. package/lib/repository/constants.cjs +3 -0
  32. package/lib/repository/constants.js.map +1 -1
  33. package/lib/repository/index.cjs +1 -2
  34. package/lib/repository/index.d.ts +1 -2
  35. package/lib/repository/index.js.map +1 -1
  36. package/lib/repository/types.d.ts +3 -0
  37. package/lib/repository/utils.cjs +2 -2
  38. package/lib/repository/utils.js.map +1 -1
  39. package/lib/repository/wrappers.cjs +29 -0
  40. package/lib/repository/wrappers.d.ts +1 -0
  41. package/lib/repository/wrappers.js.map +1 -1
  42. package/package.json +1 -1
  43. package/lib/esm/repository/BaseRepository.d.ts +0 -352
  44. package/lib/esm/repository/BaseRepository.js +0 -423
  45. package/lib/esm/repository/BaseRepository.js.map +0 -1
  46. package/lib/repository/BaseRepository.cjs +0 -427
  47. package/lib/repository/BaseRepository.d.ts +0 -352
  48. package/lib/repository/BaseRepository.js.map +0 -1
@@ -1,423 +0,0 @@
1
- import "./../overrides/index.js";
2
- import { Model } from "@decaf-ts/decorator-validation";
3
- import { enforceDBDecorators } from "./utils.js";
4
- import { OperationKeys } from "./../operations/constants.js";
5
- import { InternalError } from "./errors.js";
6
- import { wrapMethodWithContext } from "./wrappers.js";
7
- import { Context } from "./Context.js";
8
- /**
9
- * @description Base repository implementation providing CRUD operations for models.
10
- * @summary The BaseRepository class serves as a foundation for repository implementations, providing
11
- * abstract and concrete methods for creating, reading, updating, and deleting model instances.
12
- * It handles operation lifecycles including prefix and suffix operations, and enforces decorators.
13
- * @template M - The model type extending Model
14
- * @template F - The repository flags type, defaults to RepositoryFlags
15
- * @template C - The context type, defaults to Context<F>
16
- * @param {Constructor<M>} clazz - The constructor for the model class
17
- * @class BaseRepository
18
- * @example
19
- * class UserModel extends Model {
20
- * @id()
21
- * id: string;
22
- *
23
- * @required()
24
- * name: string;
25
- * }
26
- *
27
- * class UserRepository extends BaseRepository<UserModel> {
28
- * constructor() {
29
- * super(UserModel);
30
- * }
31
- *
32
- * async create(model: UserModel): Promise<UserModel> {
33
- * // Implementation
34
- * return model;
35
- * }
36
- *
37
- * async read(key: string): Promise<UserModel> {
38
- * // Implementation
39
- * return new UserModel({ id: key, name: 'User' });
40
- * }
41
- *
42
- * async update(model: UserModel): Promise<UserModel> {
43
- * // Implementation
44
- * return model;
45
- * }
46
- *
47
- * async delete(key: string): Promise<UserModel> {
48
- * // Implementation
49
- * const model = await this.read(key);
50
- * return model;
51
- * }
52
- * }
53
- *
54
- * @mermaid
55
- * sequenceDiagram
56
- * participant C as Client
57
- * participant R as Repository
58
- * participant P as Prefix Methods
59
- * participant D as Database
60
- * participant S as Suffix Methods
61
- * participant V as Validators/Decorators
62
- *
63
- * Note over C,V: Create Operation
64
- * C->>R: create(model)
65
- * R->>P: createPrefix(model)
66
- * P->>V: enforceDBDecorators(ON)
67
- * P->>D: Database operation
68
- * D->>S: createSuffix(model)
69
- * S->>V: enforceDBDecorators(AFTER)
70
- * S->>C: Return model
71
- *
72
- * Note over C,V: Read Operation
73
- * C->>R: read(key)
74
- * R->>P: readPrefix(key)
75
- * P->>V: enforceDBDecorators(ON)
76
- * P->>D: Database operation
77
- * D->>S: readSuffix(model)
78
- * S->>V: enforceDBDecorators(AFTER)
79
- * S->>C: Return model
80
- *
81
- * Note over C,V: Update Operation
82
- * C->>R: update(model)
83
- * R->>P: updatePrefix(model)
84
- * P->>V: enforceDBDecorators(ON)
85
- * P->>D: Database operation
86
- * D->>S: updateSuffix(model)
87
- * S->>V: enforceDBDecorators(AFTER)
88
- * S->>C: Return model
89
- *
90
- * Note over C,V: Delete Operation
91
- * C->>R: delete(key)
92
- * R->>P: deletePrefix(key)
93
- * P->>V: enforceDBDecorators(ON)
94
- * P->>D: Database operation
95
- * D->>S: deleteSuffix(model)
96
- * S->>V: enforceDBDecorators(AFTER)
97
- * S->>C: Return model
98
- */
99
- export class BaseRepository {
100
- /**
101
- * @description Gets the model class constructor.
102
- * @summary Retrieves the constructor for the model class associated with this repository.
103
- * Throws an error if no class definition is found.
104
- * @return {Constructor<M>} The constructor for the model class
105
- */
106
- get class() {
107
- if (!this._class)
108
- throw new InternalError(`No class definition found for this repository`);
109
- return this._class;
110
- }
111
- /**
112
- * @description Gets the primary key property name of the model.
113
- * @summary Retrieves the name of the property that serves as the primary key for the model.
114
- * If not already determined, it finds the primary key using the model's decorators.
115
- * @return The name of the primary key property
116
- */
117
- get pk() {
118
- return Model.pk(this.class);
119
- }
120
- /**
121
- * @description Gets the primary key properties.
122
- * @summary Retrieves the properties associated with the primary key of the model.
123
- * If not already determined, it triggers the pk getter to find the primary key properties.
124
- * @return {any} The properties of the primary key
125
- */
126
- get pkProps() {
127
- return Model.pkProps(this.class);
128
- }
129
- constructor(clazz) {
130
- if (clazz)
131
- this._class = clazz;
132
- // eslint-disable-next-line @typescript-eslint/no-this-alias
133
- const self = this;
134
- [this.create, this.read, this.update, this.delete].forEach((m) => {
135
- const name = m.name;
136
- wrapMethodWithContext(self, self[name + "Prefix"], m, self[name + "Suffix"]);
137
- });
138
- }
139
- /**
140
- * @description Creates multiple model instances in the repository.
141
- * @summary Persists multiple model instances to the underlying data store by calling
142
- * the create method for each model in the array.
143
- * @param {M[]} models - The array of model instances to create
144
- * @param {any[]} args - Additional arguments for the create operation
145
- * @return {Promise<M[]>} A promise that resolves to an array of created model instances
146
- */
147
- async createAll(models, ...args) {
148
- return Promise.all(models.map((m) => this.create(m, ...args)));
149
- }
150
- /**
151
- * @description Prepares a model for creation and executes pre-creation operations.
152
- * @summary Processes a model before it is created in the data store. This includes
153
- * creating a context, instantiating a new model instance, and enforcing any decorators
154
- * that should be applied before creation.
155
- * @param {M} model - The model instance to prepare for creation
156
- * @param {any[]} args - Additional arguments for the create operation
157
- * @return A promise that resolves to an array containing the prepared model and context arguments
158
- */
159
- async createPrefix(model, ...args) {
160
- const contextArgs = await Context.args(OperationKeys.CREATE, this.class, args);
161
- model = new this.class(model);
162
- await enforceDBDecorators(this, contextArgs.context, model, OperationKeys.CREATE, OperationKeys.ON);
163
- return [model, ...contextArgs.args];
164
- }
165
- /**
166
- * @description Processes a model after creation and executes post-creation operations.
167
- * @summary Finalizes a model after it has been created in the data store. This includes
168
- * enforcing any decorators that should be applied after creation.
169
- * @param {M} model - The model instance that was created
170
- * @param {C} context - The context for the operation
171
- * @return {Promise<M>} A promise that resolves to the processed model instance
172
- */
173
- async createSuffix(model, context) {
174
- await enforceDBDecorators(this, context, model, OperationKeys.CREATE, OperationKeys.AFTER);
175
- return model;
176
- }
177
- /**
178
- * @description Prepares multiple models for creation and executes pre-creation operations.
179
- * @summary Processes multiple models before they are created in the data store. This includes
180
- * creating a context, instantiating new model instances, and enforcing any decorators
181
- * that should be applied before creation for each model.
182
- * @param {M[]} models - The array of model instances to prepare for creation
183
- * @param {any[]} args - Additional arguments for the create operation
184
- * @return A promise that resolves to an array containing the prepared models and context arguments
185
- */
186
- async createAllPrefix(models, ...args) {
187
- const contextArgs = await Context.args(OperationKeys.CREATE, this.class, args);
188
- await Promise.all(models.map(async (m) => {
189
- m = new this.class(m);
190
- await enforceDBDecorators(this, contextArgs.context, m, OperationKeys.CREATE, OperationKeys.ON);
191
- return m;
192
- }));
193
- return [models, ...contextArgs.args];
194
- }
195
- /**
196
- * @description Processes multiple models after creation and executes post-creation operations.
197
- * @summary Finalizes multiple models after they have been created in the data store. This includes
198
- * enforcing any decorators that should be applied after creation for each model.
199
- * @param {M[]} models - The array of model instances that were created
200
- * @param {C} context - The context for the operation
201
- * @return {Promise<M[]>} A promise that resolves to the array of processed model instances
202
- */
203
- async createAllSuffix(models, context) {
204
- await Promise.all(models.map((m) => enforceDBDecorators(this, context, m, OperationKeys.CREATE, OperationKeys.AFTER)));
205
- return models;
206
- }
207
- /**
208
- * @description Retrieves multiple model instances from the repository by their primary keys.
209
- * @summary Fetches multiple model instances from the underlying data store using their primary keys
210
- * by calling the read method for each key in the array.
211
- * @param {string[] | number[]} keys - The array of primary keys of the models to retrieve
212
- * @param {any[]} args - Additional arguments for the read operation
213
- * @return {Promise<M[]>} A promise that resolves to an array of retrieved model instances
214
- */
215
- async readAll(keys, ...args) {
216
- return await Promise.all(keys.map((id) => this.read(id, ...args)));
217
- }
218
- /**
219
- * @description Processes a model after retrieval and executes post-read operations.
220
- * @summary Finalizes a model after it has been retrieved from the data store. This includes
221
- * enforcing any decorators that should be applied after reading.
222
- * @param {M} model - The model instance that was retrieved
223
- * @param {C} context - The context for the operation
224
- * @return {Promise<M>} A promise that resolves to the processed model instance
225
- */
226
- async readSuffix(model, context) {
227
- await enforceDBDecorators(this, context, model, OperationKeys.READ, OperationKeys.AFTER);
228
- return model;
229
- }
230
- /**
231
- * @description Prepares for reading a model and executes pre-read operations.
232
- * @summary Processes a key before a model is read from the data store. This includes
233
- * creating a context, instantiating a new model instance with the key, and enforcing any decorators
234
- * that should be applied before reading.
235
- * @param {string} key - The primary key of the model to read
236
- * @param {any[]} args - Additional arguments for the read operation
237
- * @return A promise that resolves to an array containing the key and context arguments
238
- */
239
- async readPrefix(key, ...args) {
240
- const contextArgs = await Context.args(OperationKeys.READ, this.class, args);
241
- const model = new this.class();
242
- model[this.pk] = key;
243
- await enforceDBDecorators(this, contextArgs.context, model, OperationKeys.READ, OperationKeys.ON);
244
- return [key, ...contextArgs.args];
245
- }
246
- /**
247
- * @description Prepares for reading multiple models and executes pre-read operations.
248
- * @summary Processes multiple keys before models are read from the data store. This includes
249
- * creating a context, instantiating new model instances with the keys, and enforcing any decorators
250
- * that should be applied before reading for each key.
251
- * @param {string[] | number[]} keys - The array of primary keys of the models to read
252
- * @param {any[]} args - Additional arguments for the read operation
253
- * @return A promise that resolves to an array containing the keys and context arguments
254
- */
255
- async readAllPrefix(keys, ...args) {
256
- const contextArgs = await Context.args(OperationKeys.READ, this.class, args);
257
- await Promise.all(keys.map(async (k) => {
258
- const m = new this.class();
259
- m[this.pk] = k;
260
- return enforceDBDecorators(this, contextArgs.context, m, OperationKeys.READ, OperationKeys.ON);
261
- }));
262
- return [keys, ...contextArgs.args];
263
- }
264
- /**
265
- * @description Processes multiple models after retrieval and executes post-read operations.
266
- * @summary Finalizes multiple models after they have been retrieved from the data store. This includes
267
- * enforcing any decorators that should be applied after reading for each model.
268
- * @param {M[]} models - The array of model instances that were retrieved
269
- * @param {C} context - The context for the operation
270
- * @return {Promise<M[]>} A promise that resolves to the array of processed model instances
271
- */
272
- async readAllSuffix(models, context) {
273
- await Promise.all(models.map((m) => enforceDBDecorators(this, context, m, OperationKeys.READ, OperationKeys.AFTER)));
274
- return models;
275
- }
276
- /**
277
- * @description Updates multiple model instances in the repository.
278
- * @summary Updates multiple model instances in the underlying data store by calling
279
- * the update method for each model in the array.
280
- * @param {M[]} models - The array of model instances to update
281
- * @param {any[]} args - Additional arguments for the update operation
282
- * @return {Promise<M[]>} A promise that resolves to an array of updated model instances
283
- */
284
- async updateAll(models, ...args) {
285
- return Promise.all(models.map((m) => this.update(m, ...args)));
286
- }
287
- /**
288
- * @description Processes a model after update and executes post-update operations.
289
- * @summary Finalizes a model after it has been updated in the data store. This includes
290
- * enforcing any decorators that should be applied after updating.
291
- * @param {M} model - The model instance that was updated
292
- * @param {C} context - The context for the operation
293
- * @return {Promise<M>} A promise that resolves to the processed model instance
294
- */
295
- async updateSuffix(model, context) {
296
- await enforceDBDecorators(this, context, model, OperationKeys.UPDATE, OperationKeys.AFTER);
297
- return model;
298
- }
299
- /**
300
- * @description Prepares a model for update and executes pre-update operations.
301
- * @summary Processes a model before it is updated in the data store. This includes
302
- * creating a context, validating the primary key, retrieving the existing model,
303
- * and enforcing any decorators that should be applied before updating.
304
- * @param {M} model - The model instance to prepare for update
305
- * @param {any[]} args - Additional arguments for the update operation
306
- * @return A promise that resolves to an array containing the prepared model and context arguments
307
- */
308
- async updatePrefix(model, ...args) {
309
- const contextArgs = await Context.args(OperationKeys.UPDATE, this.class, args);
310
- const id = model[this.pk];
311
- if (!id)
312
- throw new InternalError(`No value for the Id is defined under the property ${this.pk}`);
313
- const oldModel = await this.read(id);
314
- await enforceDBDecorators(this, contextArgs.context, model, OperationKeys.UPDATE, OperationKeys.ON, oldModel);
315
- return [model, ...contextArgs.args];
316
- }
317
- /**
318
- * @description Prepares multiple models for update and executes pre-update operations.
319
- * @summary Processes multiple models before they are updated in the data store. This includes
320
- * creating a context, instantiating new model instances, and enforcing any decorators
321
- * that should be applied before updating for each model.
322
- * @param {M[]} models - The array of model instances to prepare for update
323
- * @param {any[]} args - Additional arguments for the update operation
324
- * @return A promise that resolves to an array containing the prepared models and context arguments
325
- */
326
- async updateAllPrefix(models, ...args) {
327
- const contextArgs = await Context.args(OperationKeys.UPDATE, this.class, args);
328
- await Promise.all(models.map((m) => {
329
- m = new this.class(m);
330
- enforceDBDecorators(this, contextArgs.context, m, OperationKeys.UPDATE, OperationKeys.ON);
331
- return m;
332
- }));
333
- return [models, ...contextArgs.args];
334
- }
335
- /**
336
- * @description Processes multiple models after update and executes post-update operations.
337
- * @summary Finalizes multiple models after they have been updated in the data store. This includes
338
- * enforcing any decorators that should be applied after updating for each model.
339
- * @param {M[]} models - The array of model instances that were updated
340
- * @param {C} context - The context for the operation
341
- * @return {Promise<M[]>} A promise that resolves to the array of processed model instances
342
- */
343
- async updateAllSuffix(models, context) {
344
- await Promise.all(models.map((m) => enforceDBDecorators(this, context, m, OperationKeys.UPDATE, OperationKeys.AFTER)));
345
- return models;
346
- }
347
- /**
348
- * @description Deletes multiple model instances from the repository by their primary keys.
349
- * @summary Removes multiple model instances from the underlying data store using their primary keys
350
- * by calling the delete method for each key in the array.
351
- * @param {string[] | number[]} keys - The array of primary keys of the models to delete
352
- * @param {any[]} args - Additional arguments for the delete operation
353
- * @return {Promise<M[]>} A promise that resolves to an array of deleted model instances
354
- */
355
- async deleteAll(keys, ...args) {
356
- return Promise.all(keys.map((k) => this.delete(k, ...args)));
357
- }
358
- /**
359
- * @description Processes a model after deletion and executes post-delete operations.
360
- * @summary Finalizes a model after it has been deleted from the data store. This includes
361
- * enforcing any decorators that should be applied after deletion.
362
- * @param {M} model - The model instance that was deleted
363
- * @param {C} context - The context for the operation
364
- * @return {Promise<M>} A promise that resolves to the processed model instance
365
- */
366
- async deleteSuffix(model, context) {
367
- await enforceDBDecorators(this, context, model, OperationKeys.DELETE, OperationKeys.AFTER);
368
- return model;
369
- }
370
- /**
371
- * @description Prepares for deleting a model and executes pre-delete operations.
372
- * @summary Processes a key before a model is deleted from the data store. This includes
373
- * creating a context, retrieving the model to be deleted, and enforcing any decorators
374
- * that should be applied before deletion.
375
- * @param {any} key - The primary key of the model to delete
376
- * @param {any[]} args - Additional arguments for the delete operation
377
- * @return A promise that resolves to an array containing the key and context arguments
378
- */
379
- async deletePrefix(key, ...args) {
380
- const contextArgs = await Context.args(OperationKeys.DELETE, this.class, args);
381
- const model = await this.read(key, ...contextArgs.args);
382
- await enforceDBDecorators(this, contextArgs.context, model, OperationKeys.DELETE, OperationKeys.ON);
383
- return [key, ...contextArgs.args];
384
- }
385
- /**
386
- * @description Prepares for deleting multiple models and executes pre-delete operations.
387
- * @summary Processes multiple keys before models are deleted from the data store. This includes
388
- * creating a context, retrieving the models to be deleted, and enforcing any decorators
389
- * that should be applied before deletion for each model.
390
- * @param {string[] | number[]} keys - The array of primary keys of the models to delete
391
- * @param {any[]} args - Additional arguments for the delete operation
392
- * @return A promise that resolves to an array containing the keys and context arguments
393
- */
394
- async deleteAllPrefix(keys, ...args) {
395
- const contextArgs = await Context.args(OperationKeys.DELETE, this.class, args);
396
- const models = await this.readAll(keys, ...contextArgs.args);
397
- await Promise.all(models.map(async (m) => {
398
- return enforceDBDecorators(this, contextArgs.context, m, OperationKeys.DELETE, OperationKeys.ON);
399
- }));
400
- return [keys, ...contextArgs.args];
401
- }
402
- /**
403
- * @description Processes multiple models after deletion and executes post-delete operations.
404
- * @summary Finalizes multiple models after they have been deleted from the data store. This includes
405
- * enforcing any decorators that should be applied after deletion for each model.
406
- * @param {M[]} models - The array of model instances that were deleted
407
- * @param {C} context - The context for the operation
408
- * @return {Promise<M[]>} A promise that resolves to the array of processed model instances
409
- */
410
- async deleteAllSuffix(models, context) {
411
- await Promise.all(models.map((m) => enforceDBDecorators(this, context, m, OperationKeys.DELETE, OperationKeys.AFTER)));
412
- return models;
413
- }
414
- /**
415
- * @description Returns a string representation of the repository.
416
- * @summary Creates a string that identifies this repository by the name of its model class.
417
- * @return {string} A string representation of the repository
418
- */
419
- toString() {
420
- return `${this.class.name} Repository`;
421
- }
422
- }
423
- //# sourceMappingURL=BaseRepository.js.map
@@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