@decaf-ts/db-decorators 0.6.1 → 0.6.3

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