@decaf-ts/db-decorators 0.7.3 → 0.7.5

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 (84) 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/interfaces/BulkCrudOperator.d.ts +5 -4
  9. package/lib/esm/interfaces/Contextual.d.ts +3 -3
  10. package/lib/esm/interfaces/CrudOperator.d.ts +5 -4
  11. package/lib/esm/interfaces/IRepository.d.ts +2 -4
  12. package/lib/esm/model/decorators.d.ts +4 -5
  13. package/lib/esm/model/decorators.js.map +1 -1
  14. package/lib/esm/operations/Operations.d.ts +3 -7
  15. package/lib/esm/operations/Operations.js +1 -3
  16. package/lib/esm/operations/Operations.js.map +1 -1
  17. package/lib/esm/operations/OperationsRegistry.d.ts +2 -6
  18. package/lib/esm/operations/OperationsRegistry.js +0 -2
  19. package/lib/esm/operations/OperationsRegistry.js.map +1 -1
  20. package/lib/esm/operations/decorators.d.ts +42 -28
  21. package/lib/esm/operations/decorators.js +34 -11
  22. package/lib/esm/operations/decorators.js.map +1 -1
  23. package/lib/esm/operations/types.d.ts +9 -10
  24. package/lib/esm/overrides/Model.d.ts +16 -4
  25. package/lib/esm/overrides/overrides.js +21 -0
  26. package/lib/esm/overrides/overrides.js.map +1 -1
  27. package/lib/esm/repository/BaseRepository.d.ts +16 -27
  28. package/lib/esm/repository/BaseRepository.js +2 -28
  29. package/lib/esm/repository/BaseRepository.js.map +1 -1
  30. package/lib/esm/repository/Context.d.ts +9 -8
  31. package/lib/esm/repository/Context.js +9 -1
  32. package/lib/esm/repository/Context.js.map +1 -1
  33. package/lib/esm/repository/Repository.d.ts +9 -6
  34. package/lib/esm/repository/Repository.js +52 -38
  35. package/lib/esm/repository/Repository.js.map +1 -1
  36. package/lib/esm/repository/constants.d.ts +1 -1
  37. package/lib/esm/repository/constants.js +2 -0
  38. package/lib/esm/repository/constants.js.map +1 -1
  39. package/lib/esm/repository/types.d.ts +16 -2
  40. package/lib/esm/repository/utils.d.ts +6 -32
  41. package/lib/esm/repository/utils.js +9 -106
  42. package/lib/esm/repository/utils.js.map +1 -1
  43. package/lib/esm/validation/decorators.d.ts +4 -5
  44. package/lib/esm/validation/decorators.js.map +1 -1
  45. package/lib/index.cjs +1 -1
  46. package/lib/index.d.ts +1 -1
  47. package/lib/interfaces/BulkCrudOperator.d.ts +5 -4
  48. package/lib/interfaces/Contextual.d.ts +3 -3
  49. package/lib/interfaces/CrudOperator.d.ts +5 -4
  50. package/lib/interfaces/IRepository.d.ts +2 -4
  51. package/lib/model/decorators.d.ts +4 -5
  52. package/lib/model/decorators.js.map +1 -1
  53. package/lib/operations/Operations.cjs +1 -3
  54. package/lib/operations/Operations.d.ts +3 -7
  55. package/lib/operations/Operations.js.map +1 -1
  56. package/lib/operations/OperationsRegistry.cjs +0 -2
  57. package/lib/operations/OperationsRegistry.d.ts +2 -6
  58. package/lib/operations/OperationsRegistry.js.map +1 -1
  59. package/lib/operations/decorators.cjs +36 -12
  60. package/lib/operations/decorators.d.ts +42 -28
  61. package/lib/operations/decorators.js.map +1 -1
  62. package/lib/operations/types.d.ts +9 -10
  63. package/lib/overrides/Model.d.ts +16 -4
  64. package/lib/overrides/overrides.cjs +21 -0
  65. package/lib/overrides/overrides.js.map +1 -1
  66. package/lib/repository/BaseRepository.cjs +2 -28
  67. package/lib/repository/BaseRepository.d.ts +16 -27
  68. package/lib/repository/BaseRepository.js.map +1 -1
  69. package/lib/repository/Context.cjs +9 -1
  70. package/lib/repository/Context.d.ts +9 -8
  71. package/lib/repository/Context.js.map +1 -1
  72. package/lib/repository/Repository.cjs +51 -37
  73. package/lib/repository/Repository.d.ts +9 -6
  74. package/lib/repository/Repository.js.map +1 -1
  75. package/lib/repository/constants.cjs +2 -0
  76. package/lib/repository/constants.d.ts +1 -1
  77. package/lib/repository/constants.js.map +1 -1
  78. package/lib/repository/types.d.ts +16 -2
  79. package/lib/repository/utils.cjs +10 -108
  80. package/lib/repository/utils.d.ts +6 -32
  81. package/lib/repository/utils.js.map +1 -1
  82. package/lib/validation/decorators.d.ts +4 -5
  83. package/lib/validation/decorators.js.map +1 -1
  84. package/package.json +11 -10
@@ -2,7 +2,7 @@ import "../overrides";
2
2
  import { IRepository } from "../interfaces/IRepository";
3
3
  import { Model } from "@decaf-ts/decorator-validation";
4
4
  import { Context } from "./Context";
5
- import { RepositoryFlags } from "./types";
5
+ import { PrimaryKeyType } from "./types";
6
6
  import { Constructor } from "@decaf-ts/decoration";
7
7
  /**
8
8
  * @description Base repository implementation providing CRUD operations for models.
@@ -95,10 +95,8 @@ import { Constructor } from "@decaf-ts/decoration";
95
95
  * S->>V: enforceDBDecorators(AFTER)
96
96
  * S->>C: Return model
97
97
  */
98
- export declare abstract class BaseRepository<M extends Model<boolean>, F extends RepositoryFlags = RepositoryFlags, C extends Context<F> = Context<F>> implements IRepository<M, F, C> {
98
+ export declare abstract class BaseRepository<M extends Model<boolean>, C extends Context<any>> implements IRepository<M, C> {
99
99
  private readonly _class;
100
- private _pk;
101
- private _pkProps;
102
100
  /**
103
101
  * @description Gets the model class constructor.
104
102
  * @summary Retrieves the constructor for the model class associated with this repository.
@@ -112,7 +110,7 @@ export declare abstract class BaseRepository<M extends Model<boolean>, F extends
112
110
  * If not already determined, it finds the primary key using the model's decorators.
113
111
  * @return The name of the primary key property
114
112
  */
115
- get pk(): keyof M;
113
+ protected get pk(): keyof M;
116
114
  /**
117
115
  * @description Gets the primary key properties.
118
116
  * @summary Retrieves the properties associated with the primary key of the model.
@@ -148,7 +146,7 @@ export declare abstract class BaseRepository<M extends Model<boolean>, F extends
148
146
  * @param {any[]} args - Additional arguments for the create operation
149
147
  * @return A promise that resolves to an array containing the prepared model and context arguments
150
148
  */
151
- protected createPrefix(model: M, ...args: any[]): Promise<any[]>;
149
+ protected createPrefix(model: M, ...args: any[]): Promise<[M, ...any[], C]>;
152
150
  /**
153
151
  * @description Processes a model after creation and executes post-creation operations.
154
152
  * @summary Finalizes a model after it has been created in the data store. This includes
@@ -167,7 +165,7 @@ export declare abstract class BaseRepository<M extends Model<boolean>, F extends
167
165
  * @param {any[]} args - Additional arguments for the create operation
168
166
  * @return A promise that resolves to an array containing the prepared models and context arguments
169
167
  */
170
- protected createAllPrefix(models: M[], ...args: any[]): Promise<any[]>;
168
+ protected createAllPrefix(models: M[], ...args: any[]): Promise<[M[], ...any[], C]>;
171
169
  /**
172
170
  * @description Processes multiple models after creation and executes post-creation operations.
173
171
  * @summary Finalizes multiple models after they have been created in the data store. This includes
@@ -181,11 +179,11 @@ export declare abstract class BaseRepository<M extends Model<boolean>, F extends
181
179
  * @description Retrieves a model instance from the repository by its primary key.
182
180
  * @summary Fetches a model instance from the underlying data store using its primary key.
183
181
  * This method must be implemented by concrete repository classes.
184
- * @param {string | number} key - The primary key of the model to retrieve
182
+ * @param {PrimaryKeyType} key - The primary key of the model to retrieve
185
183
  * @param {any[]} args - Additional arguments for the read operation
186
184
  * @return {Promise<M>} A promise that resolves to the retrieved model instance
187
185
  */
188
- abstract read(key: string | number, ...args: any[]): Promise<M>;
186
+ abstract read(key: PrimaryKeyType, ...args: any[]): Promise<M>;
189
187
  /**
190
188
  * @description Retrieves multiple model instances from the repository by their primary keys.
191
189
  * @summary Fetches multiple model instances from the underlying data store using their primary keys
@@ -194,7 +192,7 @@ export declare abstract class BaseRepository<M extends Model<boolean>, F extends
194
192
  * @param {any[]} args - Additional arguments for the read operation
195
193
  * @return {Promise<M[]>} A promise that resolves to an array of retrieved model instances
196
194
  */
197
- readAll(keys: string[] | number[], ...args: any[]): Promise<M[]>;
195
+ readAll(keys: PrimaryKeyType[], ...args: any[]): Promise<M[]>;
198
196
  /**
199
197
  * @description Processes a model after retrieval and executes post-read operations.
200
198
  * @summary Finalizes a model after it has been retrieved from the data store. This includes
@@ -213,7 +211,7 @@ export declare abstract class BaseRepository<M extends Model<boolean>, F extends
213
211
  * @param {any[]} args - Additional arguments for the read operation
214
212
  * @return A promise that resolves to an array containing the key and context arguments
215
213
  */
216
- protected readPrefix(key: string, ...args: any[]): Promise<any[]>;
214
+ protected readPrefix(key: PrimaryKeyType, ...args: any[]): Promise<[PrimaryKeyType, ...any[], C]>;
217
215
  /**
218
216
  * @description Prepares for reading multiple models and executes pre-read operations.
219
217
  * @summary Processes multiple keys before models are read from the data store. This includes
@@ -223,7 +221,7 @@ export declare abstract class BaseRepository<M extends Model<boolean>, F extends
223
221
  * @param {any[]} args - Additional arguments for the read operation
224
222
  * @return A promise that resolves to an array containing the keys and context arguments
225
223
  */
226
- protected readAllPrefix(keys: string[] | number[], ...args: any[]): Promise<any[]>;
224
+ protected readAllPrefix(keys: PrimaryKeyType[], ...args: any[]): Promise<[PrimaryKeyType[], ...any[], C]>;
227
225
  /**
228
226
  * @description Processes multiple models after retrieval and executes post-read operations.
229
227
  * @summary Finalizes multiple models after they have been retrieved from the data store. This includes
@@ -269,7 +267,7 @@ export declare abstract class BaseRepository<M extends Model<boolean>, F extends
269
267
  * @param {any[]} args - Additional arguments for the update operation
270
268
  * @return A promise that resolves to an array containing the prepared model and context arguments
271
269
  */
272
- protected updatePrefix(model: M, ...args: any[]): Promise<any[]>;
270
+ protected updatePrefix(model: M, ...args: any[]): Promise<[M, ...any[], C]>;
273
271
  /**
274
272
  * @description Prepares multiple models for update and executes pre-update operations.
275
273
  * @summary Processes multiple models before they are updated in the data store. This includes
@@ -279,7 +277,7 @@ export declare abstract class BaseRepository<M extends Model<boolean>, F extends
279
277
  * @param {any[]} args - Additional arguments for the update operation
280
278
  * @return A promise that resolves to an array containing the prepared models and context arguments
281
279
  */
282
- protected updateAllPrefix(models: M[], ...args: any[]): Promise<any[]>;
280
+ protected updateAllPrefix(models: M[], ...args: any[]): Promise<[M[], ...any[], C]>;
283
281
  /**
284
282
  * @description Processes multiple models after update and executes post-update operations.
285
283
  * @summary Finalizes multiple models after they have been updated in the data store. This includes
@@ -297,7 +295,7 @@ export declare abstract class BaseRepository<M extends Model<boolean>, F extends
297
295
  * @param {any[]} args - Additional arguments for the delete operation
298
296
  * @return {Promise<M>} A promise that resolves to the deleted model instance
299
297
  */
300
- abstract delete(key: string | number, ...args: any[]): Promise<M>;
298
+ abstract delete(key: PrimaryKeyType, ...args: any[]): Promise<M>;
301
299
  /**
302
300
  * @description Deletes multiple model instances from the repository by their primary keys.
303
301
  * @summary Removes multiple model instances from the underlying data store using their primary keys
@@ -306,7 +304,7 @@ export declare abstract class BaseRepository<M extends Model<boolean>, F extends
306
304
  * @param {any[]} args - Additional arguments for the delete operation
307
305
  * @return {Promise<M[]>} A promise that resolves to an array of deleted model instances
308
306
  */
309
- deleteAll(keys: string[] | number[], ...args: any[]): Promise<M[]>;
307
+ deleteAll(keys: PrimaryKeyType[], ...args: any[]): Promise<M[]>;
310
308
  /**
311
309
  * @description Processes a model after deletion and executes post-delete operations.
312
310
  * @summary Finalizes a model after it has been deleted from the data store. This includes
@@ -325,7 +323,7 @@ export declare abstract class BaseRepository<M extends Model<boolean>, F extends
325
323
  * @param {any[]} args - Additional arguments for the delete operation
326
324
  * @return A promise that resolves to an array containing the key and context arguments
327
325
  */
328
- protected deletePrefix(key: any, ...args: any[]): Promise<any[]>;
326
+ protected deletePrefix(key: PrimaryKeyType, ...args: any[]): Promise<[PrimaryKeyType, ...any[], C]>;
329
327
  /**
330
328
  * @description Prepares for deleting multiple models and executes pre-delete operations.
331
329
  * @summary Processes multiple keys before models are deleted from the data store. This includes
@@ -335,7 +333,7 @@ export declare abstract class BaseRepository<M extends Model<boolean>, F extends
335
333
  * @param {any[]} args - Additional arguments for the delete operation
336
334
  * @return A promise that resolves to an array containing the keys and context arguments
337
335
  */
338
- protected deleteAllPrefix(keys: string[] | number[], ...args: any[]): Promise<any[]>;
336
+ protected deleteAllPrefix(keys: PrimaryKeyType[], ...args: any[]): Promise<[PrimaryKeyType[], ...any[], C]>;
339
337
  /**
340
338
  * @description Processes multiple models after deletion and executes post-delete operations.
341
339
  * @summary Finalizes multiple models after they have been deleted from the data store. This includes
@@ -345,15 +343,6 @@ export declare abstract class BaseRepository<M extends Model<boolean>, F extends
345
343
  * @return {Promise<M[]>} A promise that resolves to the array of processed model instances
346
344
  */
347
345
  protected deleteAllSuffix(models: M[], context: C): Promise<M[]>;
348
- /**
349
- * @description Merges two model instances into a new instance.
350
- * @summary Creates a new model instance by combining properties from an old model and a new model.
351
- * Properties from the new model override properties from the old model if they are defined.
352
- * @param {M} oldModel - The original model instance
353
- * @param {M} model - The new model instance with updated properties
354
- * @return {M} A new model instance with merged properties
355
- */
356
- protected merge(oldModel: M, model: M): M;
357
346
  /**
358
347
  * @description Returns a string representation of the repository.
359
348
  * @summary Creates a string that identifies this repository by the name of its model class.
@@ -1 +1 @@
1
- {"version":3,"file":"BaseRepository.js","sourceRoot":"","sources":["../../src/repository/BaseRepository.ts"],"names":[],"mappings":";;;AAAA,oCAAsB;AAEtB,yEAAuD;AACvD,uCAA8C;AAC9C,6DAAwD;AACxD,yCAAyC;AACzC,6CAAmD;AACnD,2CAAoC;AAEpC,qDAA6D;AAC7D,wDAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FG;AACH,MAAsB,cAAc;IAUlC;;;;;OAKG;IACH,IAAI,KAAK;QACP,IAAI,CAAC,IAAI,CAAC,MAAM;YACd,MAAM,IAAI,sBAAa,CAAC,+CAA+C,CAAC,CAAC;QAC3E,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;;;OAKG;IACH,IAAI,EAAE;QACJ,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YACd,IAAI,CAAC,GAAG,GAAG,4BAAK,CAAC,EAAE,C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I,aAAa,CAAC;IACzC,CAAC;CACF;AAhkBD,wCAgkBC"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Context = exports.DefaultContextFactory = void 0;
4
4
  const constants_1 = require("./constants.cjs");
5
5
  const typed_object_accumulator_1 = require("typed-object-accumulator");
6
+ const logging_1 = require("@decaf-ts/logging");
6
7
  /**
7
8
  * @description Default factory for creating context instances.
8
9
  * @summary A factory function that creates new Context instances with the provided repository flags.
@@ -11,7 +12,10 @@ const typed_object_accumulator_1 = require("typed-object-accumulator");
11
12
  * @memberOf module:db-decorators
12
13
  */
13
14
  const DefaultContextFactory = (arg) => {
14
- return new Context().accumulate(Object.assign({}, arg, { timestamp: new Date() }));
15
+ return new Context().accumulate(Object.assign({}, arg, {
16
+ timestamp: new Date(),
17
+ logger: arg.logger || logging_1.Logging.get(),
18
+ }));
15
19
  };
16
20
  exports.DefaultContextFactory = DefaultContextFactory;
17
21
  /**
@@ -97,6 +101,9 @@ class Context {
97
101
  });
98
102
  return this;
99
103
  }
104
+ get logger() {
105
+ return this.cache.logger;
106
+ }
100
107
  get timestamp() {
101
108
  return this.cache.timestamp;
102
109
  }
@@ -131,6 +138,7 @@ class Context {
131
138
  return Context.factory(Object.assign({}, constants_1.DefaultRepositoryFlags, overrides, {
132
139
  operation: operation,
133
140
  model: model,
141
+ logger: overrides.logger || logging_1.Logging.get(),
134
142
  }));
135
143
  }
136
144
  /**
@@ -1,9 +1,9 @@
1
1
  import { ContextArgs } from "./utils";
2
- import { Contextual } from "../interfaces/Contextual";
2
+ import { Contextual, FlagsOf } from "../interfaces/Contextual";
3
3
  import { OperationKeys } from "../operations/constants";
4
4
  import { Model } from "@decaf-ts/decorator-validation";
5
5
  import { ObjectAccumulator } from "typed-object-accumulator";
6
- import { RepositoryFlags } from "./types";
6
+ import { FlagsOfContext, LoggerOfFlags, RepositoryFlags } from "./types";
7
7
  import { Constructor } from "@decaf-ts/decoration";
8
8
  /**
9
9
  * @description Factory type for creating context instances.
@@ -12,7 +12,7 @@ import { Constructor } from "@decaf-ts/decoration";
12
12
  * @typedef {Function} ContextFactory
13
13
  * @memberOf module:db-decorators
14
14
  */
15
- export type ContextFactory<F extends RepositoryFlags> = <C extends Context<F>>(arg: Omit<F, "timestamp">) => C;
15
+ export type ContextFactory<C extends Context<any>> = (arg: Partial<Omit<FlagsOf<C>, "timestamp">>) => C;
16
16
  /**
17
17
  * @description Default factory for creating context instances.
18
18
  * @summary A factory function that creates new Context instances with the provided repository flags.
@@ -79,16 +79,17 @@ export declare const DefaultContextFactory: ContextFactory<any>;
79
79
  * end
80
80
  * Ctx-->>C: requested value
81
81
  */
82
- export declare class Context<F extends RepositoryFlags> {
82
+ export declare class Context<F extends RepositoryFlags<any> = RepositoryFlags> {
83
83
  constructor();
84
84
  static factory: ContextFactory<any>;
85
- readonly cache: RepositoryFlags & ObjectAccumulator<any>;
85
+ readonly cache: RepositoryFlags<any> & ObjectAccumulator<any>;
86
86
  /**
87
87
  * @description Accumulates new values into the context.
88
88
  * @summary Merges the provided value object with the existing context state,
89
89
  * creating a new immutable cache state.
90
90
  */
91
91
  accumulate<V extends object>(value: V): Context<F & V>;
92
+ get logger(): LoggerOfFlags<F>;
92
93
  get timestamp(): F["timestamp"];
93
94
  /**
94
95
  * @description Retrieves a value from the context by key.
@@ -99,13 +100,13 @@ export declare class Context<F extends RepositoryFlags> {
99
100
  /**
100
101
  * @description Creates a child context from another context
101
102
  */
102
- static childFrom<F extends RepositoryFlags, C extends Context<F>>(context: C, overrides?: Partial<F>): C;
103
+ static childFrom<C extends Context<any>>(context: C, overrides?: Partial<FlagsOf<C>>): C;
103
104
  /**
104
105
  * @description Creates a new context from operation parameters
105
106
  */
106
- static from<M extends Model, F extends RepositoryFlags, C extends Context<F>>(operation: OperationKeys.CREATE | OperationKeys.READ | OperationKeys.UPDATE | OperationKeys.DELETE, overrides: Partial<F>, model: Constructor<M>, ...args: any[]): Promise<C>;
107
+ static from<M extends Model, C extends Context<any>>(operation: OperationKeys.CREATE | OperationKeys.READ | OperationKeys.UPDATE | OperationKeys.DELETE | string, overrides: Partial<FlagsOfContext<C>>, model: Constructor<M>, ...args: any[]): Promise<C>;
107
108
  /**
108
109
  * @description Prepares arguments for context operations
109
110
  */
110
- static args<M extends Model<any>, C extends Context<F>, F extends RepositoryFlags>(operation: OperationKeys.CREATE | OperationKeys.READ | OperationKeys.UPDATE | OperationKeys.DELETE, model: Constructor<M>, args: any[], contextual?: Contextual<F>, overrides?: Partial<F>): Promise<ContextArgs<F, C>>;
111
+ static args<M extends Model<any>, C extends Context<any>>(operation: OperationKeys.CREATE | OperationKeys.READ | OperationKeys.UPDATE | OperationKeys.DELETE | string, model: Constructor<M>, args: any[], contextual?: Contextual<C>, overrides?: Partial<FlagsOf<C>>): Promise<ContextArgs<C>>;
111
112
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Context.js","sourceRoot":"","sources":["../../src/repository/Context.ts"],"names":[],"mappings":";;;AAIA,+CAAqD;AACrD,uEAA6D;AAe7D;;;;;;GAMG;AACI,MAAM,qBAAqB,GAAwB,CAIxD,GAAyB,EACzB,EAAE;IACF,OAAO,IAAI,OAAO,EAAK,CAAC,UAAU,CAChC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE,CAAM,CAClD,CAAC;AACT,CAAC,CAAC;AATW,QAAA,qBAAqB,yBAShC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,MAAa,OAAO;IAClB;QAWS,UAAK,GACZ,IAAI,4CAAiB,EACG,CAAC;QAZzB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE;YACnC,KAAK,EAAE,IAAI,4CAAiB,EAAK;YACjC,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,KAAK;YACjB,YAAY,EAAE,IAAI;SACnB,CAAC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E,GAAG,IAAI,CAAC,CAAC;QACxE,CAAC;QAED,IAAI,CAAI,CAAC;QACT,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,IAAI,YAAY,OAAO,EAAE,CAAC;gBAC5B,CAAC,GAAG,IAAS,CAAC;gBACd,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAChB,CAAC,GAAG,CAAC,MAAM,UAAU,EAAE,CAAM,CAAC;gBAC9B,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACf,CAAC;QACH,CAAC;aAAM,CAAC;YACN,CAAC,GAAG,CAAC,MAAM,UAAU,EAAE,CAAM,CAAC;YAC9B,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACf,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,IAAqB,EAAE,CAAC;IACrD,CAAC;;AArIH,0BAsIC"}
@@ -5,6 +5,7 @@ const utils_1 = require("./utils.cjs");
5
5
  const constants_1 = require("./../operations/constants.cjs");
6
6
  const errors_1 = require("./errors.cjs");
7
7
  const BaseRepository_1 = require("./BaseRepository.cjs");
8
+ const decorator_validation_1 = require("@decaf-ts/decorator-validation");
8
9
  const Context_1 = require("./Context.cjs");
9
10
  /**
10
11
  * @description Concrete repository implementation with validation support.
@@ -61,10 +62,13 @@ class Repository extends BaseRepository_1.BaseRepository {
61
62
  async createPrefix(model, ...args) {
62
63
  const contextArgs = await Context_1.Context.args(constants_1.OperationKeys.CREATE, this.class, args);
63
64
  model = new this.class(model);
64
- await (0, utils_1.enforceDBDecorators)(this, contextArgs.context, model, constants_1.OperationKeys.CREATE, constants_1.OperationKeys.ON);
65
- const errors = await Promise.resolve(model.hasErrors());
66
- if (errors)
67
- throw new errors_1.ValidationError(errors.toString());
65
+ if (contextArgs.context.get("ignoreHandlers") !== false)
66
+ await (0, utils_1.enforceDBDecorators)(this, contextArgs.context, model, constants_1.OperationKeys.CREATE, constants_1.OperationKeys.ON);
67
+ if (!contextArgs.context.get("ignoreValidation")) {
68
+ const errors = await Promise.resolve(model.hasErrors());
69
+ if (errors)
70
+ throw new errors_1.ValidationError(errors.toString());
71
+ }
68
72
  return [model, ...contextArgs.args];
69
73
  }
70
74
  /**
@@ -79,22 +83,20 @@ class Repository extends BaseRepository_1.BaseRepository {
79
83
  */
80
84
  async createAllPrefix(models, ...args) {
81
85
  const contextArgs = await Context_1.Context.args(constants_1.OperationKeys.CREATE, this.class, args);
82
- await Promise.all(models.map(async (m) => {
83
- m = new this.class(m);
84
- await (0, utils_1.enforceDBDecorators)(this, contextArgs.context, m, constants_1.OperationKeys.CREATE, constants_1.OperationKeys.ON);
85
- return m;
86
+ const shouldRunHandlers = contextArgs.context.get("ignoreHandlers") !== false;
87
+ const shouldValidate = !contextArgs.context.get("ignoreValidation");
88
+ models = await Promise.all(models.map(async (m) => {
89
+ const model = new this.class(m);
90
+ if (shouldRunHandlers)
91
+ await (0, utils_1.enforceDBDecorators)(this, contextArgs.context, model, constants_1.OperationKeys.CREATE, constants_1.OperationKeys.ON);
92
+ return model;
86
93
  }));
87
- const modelsValidation = await Promise.all(models.map((m) => Promise.resolve(m.hasErrors())));
88
- const errors = modelsValidation.reduce((accum, e, i) => {
89
- if (e)
90
- accum =
91
- typeof accum === "string"
92
- ? accum + `\n - ${i}: ${e.toString()}`
93
- : ` - ${i}: ${e.toString()}`;
94
- return accum;
95
- }, undefined);
96
- if (errors)
97
- throw new errors_1.ValidationError(errors);
94
+ if (shouldValidate) {
95
+ const modelsValidation = await Promise.all(models.map((m) => Promise.resolve(m.hasErrors())));
96
+ const errors = (0, utils_1.reduceErrorsToPrint)(modelsValidation);
97
+ if (errors)
98
+ throw new errors_1.ValidationError(errors);
99
+ }
98
100
  return [models, ...contextArgs.args];
99
101
  }
100
102
  /**
@@ -111,15 +113,20 @@ class Repository extends BaseRepository_1.BaseRepository {
111
113
  */
112
114
  async updatePrefix(model, ...args) {
113
115
  const contextArgs = await Context_1.Context.args(constants_1.OperationKeys.UPDATE, this.class, args);
116
+ const shouldRunHandlers = contextArgs.context.get("ignoreHandlers") !== false;
117
+ const shouldValidate = !contextArgs.context.get("ignoreValidation");
114
118
  const pk = model[this.pk];
115
119
  if (!pk)
116
120
  throw new errors_1.InternalError(`No value for the Id is defined under the property ${this.pk}`);
117
121
  const oldModel = await this.read(pk);
118
- model = this.merge(oldModel, model);
119
- await (0, utils_1.enforceDBDecorators)(this, contextArgs.context, model, constants_1.OperationKeys.UPDATE, constants_1.OperationKeys.ON, oldModel);
120
- const errors = await Promise.resolve(model.hasErrors(oldModel));
121
- if (errors)
122
- throw new errors_1.ValidationError(errors.toString());
122
+ model = decorator_validation_1.Model.merge(oldModel, model, this.class);
123
+ if (shouldRunHandlers)
124
+ await (0, utils_1.enforceDBDecorators)(this, contextArgs.context, model, constants_1.OperationKeys.UPDATE, constants_1.OperationKeys.ON, oldModel);
125
+ if (shouldValidate) {
126
+ const errors = await Promise.resolve(model.hasErrors(oldModel));
127
+ if (errors)
128
+ throw new errors_1.ValidationError(errors.toString());
129
+ }
123
130
  return [model, ...contextArgs.args];
124
131
  }
125
132
  /**
@@ -136,6 +143,8 @@ class Repository extends BaseRepository_1.BaseRepository {
136
143
  */
137
144
  async updateAllPrefix(models, ...args) {
138
145
  const contextArgs = await Context_1.Context.args(constants_1.OperationKeys.UPDATE, this.class, args);
146
+ const shouldRunHandlers = contextArgs.context.get("ignoreHandlers") !== false;
147
+ const shouldValidate = !contextArgs.context.get("ignoreValidation");
139
148
  const ids = models.map((m) => {
140
149
  const id = m[this.pk];
141
150
  if (typeof id === "undefined")
@@ -143,21 +152,26 @@ class Repository extends BaseRepository_1.BaseRepository {
143
152
  return id;
144
153
  });
145
154
  const oldModels = await this.readAll(ids, ...contextArgs.args);
146
- models = models.map((m, i) => this.merge(oldModels[i], m));
147
- await Promise.all(models.map((m, i) => (0, utils_1.enforceDBDecorators)(this, contextArgs.context, m, constants_1.OperationKeys.UPDATE, constants_1.OperationKeys.ON, oldModels[i])));
148
- const modelsValidation = await Promise.all(models.map((m, i) => Promise.resolve(m.hasErrors(oldModels[i]))));
149
- const errors = modelsValidation.reduce((accum, e, i) => {
150
- if (e)
151
- accum =
152
- typeof accum === "string"
153
- ? accum + `\n - ${i}: ${e.toString()}`
154
- : ` - ${i}: ${e.toString()}`;
155
- return accum;
156
- }, undefined);
157
- if (errors)
158
- throw new errors_1.ValidationError(errors);
155
+ models = models.map((m, i) => decorator_validation_1.Model.merge(oldModels[i], m, this.class));
156
+ if (shouldRunHandlers)
157
+ await Promise.all(models.map((m, i) => (0, utils_1.enforceDBDecorators)(this, contextArgs.context, m, constants_1.OperationKeys.UPDATE, constants_1.OperationKeys.ON, oldModels[i])));
158
+ if (shouldValidate) {
159
+ const modelsValidation = await Promise.all(models.map((m, i) => Promise.resolve(m.hasErrors(oldModels[i]))));
160
+ const errors = (0, utils_1.reduceErrorsToPrint)(modelsValidation);
161
+ if (errors)
162
+ throw new errors_1.ValidationError(errors);
163
+ }
159
164
  return [models, ...contextArgs.args];
160
165
  }
166
+ async readPrefix(key, ...args) {
167
+ return super.readPrefix(key, ...args);
168
+ }
169
+ async readAllPrefix(keys, ...args) {
170
+ return super.readAllPrefix(keys, ...args);
171
+ }
172
+ async deleteAllPrefix(keys, ...args) {
173
+ return super.deleteAllPrefix(keys, ...args);
174
+ }
161
175
  }
162
176
  exports.Repository = Repository;
163
177
  //# sourceMappingURL=Repository.js.map
@@ -1,7 +1,7 @@
1
1
  import { BaseRepository } from "./BaseRepository";
2
2
  import { Model } from "@decaf-ts/decorator-validation";
3
3
  import { Context } from "./Context";
4
- import { RepositoryFlags } from "./types";
4
+ import { PrimaryKeyType, RepositoryFlags } from "./types";
5
5
  import { Constructor } from "@decaf-ts/decoration";
6
6
  /**
7
7
  * @description Concrete repository implementation with validation support.
@@ -41,7 +41,7 @@ import { Constructor } from "@decaf-ts/decoration";
41
41
  * console.error(error); // ValidationError: name must be at least 3 characters
42
42
  * }
43
43
  */
44
- export declare abstract class Repository<M extends Model<boolean>, F extends RepositoryFlags = RepositoryFlags, C extends Context<F> = Context<F>> extends BaseRepository<M, F, C> {
44
+ export declare abstract class Repository<M extends Model<boolean>, C extends Context<any> = Context<RepositoryFlags>> extends BaseRepository<M, C> {
45
45
  protected constructor(clazz?: Constructor<M>);
46
46
  /**
47
47
  * @description Prepares a model for creation with validation.
@@ -53,7 +53,7 @@ export declare abstract class Repository<M extends Model<boolean>, F extends Rep
53
53
  * @return A promise that resolves to an array containing the validated model and context arguments
54
54
  * @throws {ValidationError} If the model fails validation
55
55
  */
56
- protected createPrefix(model: M, ...args: any[]): Promise<[M, ...any[]]>;
56
+ protected createPrefix(model: M, ...args: any[]): Promise<[M, ...any[], C]>;
57
57
  /**
58
58
  * @description Prepares multiple models for creation with validation.
59
59
  * @summary Overrides the base createAllPrefix method to add validation checks for multiple models.
@@ -64,7 +64,7 @@ export declare abstract class Repository<M extends Model<boolean>, F extends Rep
64
64
  * @return {Promise<any[]>} A promise that resolves to an array containing the validated models and context arguments
65
65
  * @throws {ValidationError} If any model fails validation, with details about which models failed
66
66
  */
67
- protected createAllPrefix(models: M[], ...args: any[]): Promise<any[]>;
67
+ protected createAllPrefix(models: M[], ...args: any[]): Promise<[M[], ...any[], C]>;
68
68
  /**
69
69
  * @description Prepares a model for update with validation.
70
70
  * @summary Overrides the base updatePrefix method to add validation checks.
@@ -77,7 +77,7 @@ export declare abstract class Repository<M extends Model<boolean>, F extends Rep
77
77
  * @throws {InternalError} If the model doesn't have a primary key value
78
78
  * @throws {ValidationError} If the model fails validation
79
79
  */
80
- protected updatePrefix(model: M, ...args: any[]): Promise<[M, ...args: any[]]>;
80
+ protected updatePrefix(model: M, ...args: any[]): Promise<[M, ...args: any[], C]>;
81
81
  /**
82
82
  * @description Prepares multiple models for update with validation.
83
83
  * @summary Overrides the base updateAllPrefix method to add validation checks for multiple models.
@@ -90,5 +90,8 @@ export declare abstract class Repository<M extends Model<boolean>, F extends Rep
90
90
  * @throws {InternalError} If any model doesn't have a primary key value
91
91
  * @throws {ValidationError} If any model fails validation, with details about which models failed
92
92
  */
93
- protected updateAllPrefix(models: M[], ...args: any[]): Promise<any[]>;
93
+ protected updateAllPrefix(models: M[], ...args: any[]): Promise<[M[], ...any[], C]>;
94
+ protected readPrefix(key: PrimaryKeyType, ...args: any[]): Promise<[PrimaryKeyType, ...any[], C]>;
95
+ protected readAllPrefix(keys: PrimaryKeyType[], ...args: any[]): Promise<[PrimaryKeyType[], ...any[], C]>;
96
+ protected deleteAllPrefix(keys: PrimaryKeyType[], ...args: any[]): Promise<[PrimaryKeyType[], ...any[], C]>;
94
97
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Repository.js","sourceRoot":"","sources":["../../src/repository/Repository.ts"],"names":[],"mappings":";;;AAAA,uCAA8C;AAC9C,6DAAwD;AACxD,yCAA0D;AAC1D,yDAAkD;AAElD,2CAAoC;AAIpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAsB,UAIpB,SAAQ,+BAAuB;IAC/B,YAAsB,KAAsB;QAC1C,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;IAED;;;;;;;;;OASG;IACgB,KAAK,CAAC,YAAY,CACnC,KAAQ,EACR,GAAG,IAAW;QAEd,MAAM,WAAW,GAAG,MAAM,iBAAO,CAAC,IAAI,CACpC,yBAAa,CAAC,MAAM,EACpB,IAAI,CAAC,KAAK,EACV,IAAI,CACL,CAAC;QACF,KAAK,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC9B,MAAM,IAAA,2BAAmB,EACvB,IAAI,EACJ,WAAW,CAAC,OAAO,EACnB,KAAK,EACL,yBAAa,CAAC,MAAM,EACpB,yBAAa,CAAC,EAAE,CACjB,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,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C;CACF;AAlOD,gCAkOC"}
@@ -18,5 +18,7 @@ exports.DefaultRepositoryFlags = {
18
18
  operation: undefined,
19
19
  breakOnHandlerError: true,
20
20
  rebuildWithTransient: true,
21
+ ignoreValidation: false,
22
+ ignoreHandlers: true,
21
23
  };
22
24
  //# sourceMappingURL=constants.js.map
@@ -6,4 +6,4 @@ import { RepositoryFlags } from "./types";
6
6
  * @const DefaultRepositoryFlags
7
7
  * @memberOf module:db-decorators
8
8
  */
9
- export declare const DefaultRepositoryFlags: Omit<RepositoryFlags, "timestamp">;
9
+ export declare const DefaultRepositoryFlags: Omit<RepositoryFlags, "timestamp" | "logger">;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/repository/constants.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;AACU,QAAA,sBAAsB,GAAuC;IACxE,aAAa,EAAE,SAAS;IACxB,aAAa,EAAE,EAAE;IACjB,2BAA2B,EAAE,EAAE;IAC/B,QAAQ,EAAE,EAAE;IACZ,cAAc,EAAE,KAAK;IACrB,cAAc,EAAE,EAAE;IAClB,SAAS,EAAE,SAAS;IACpB,mBAAmB,EAAE,IAAI;IACzB,oBAAoB,EAAE,IAAI;CAC3B,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/repository/constants.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;AACU,QAAA,sBAAsB,GAG/B;IACF,aAAa,EAAE,SAAS;IACxB,aAAa,EAAE,EAAE;IACjB,2BAA2B,EAAE,EAAE;IAC/B,QAAQ,EAAE,EAAE;IACZ,cAAc,EAAE,KAAK;IACrB,cAAc,EAAE,EAAE;IAClB,SAAS,EAAE,SAAS;IACpB,mBAAmB,EAAE,IAAI;IACzB,oBAAoB,EAAE,IAAI;IAC1B,gBAAgB,EAAE,KAAK;IACvB,cAAc,EAAE,IAAI;CACrB,CAAC"}
@@ -1,7 +1,9 @@
1
1
  import { Context } from "./Context";
2
- import { Model } from "@decaf-ts/decorator-validation";
2
+ import { ExtendedMetadata, Model } from "@decaf-ts/decorator-validation";
3
3
  import { OperationKeys } from "../operations";
4
4
  import { Constructor } from "@decaf-ts/decoration";
5
+ import { Logger } from "@decaf-ts/logging";
6
+ import { IRepository } from "../interfaces/index";
5
7
  /**
6
8
  * @description Type utility for ensuring model extension.
7
9
  * @summary A conditional type that ensures a type extends the Model class.
@@ -28,7 +30,7 @@ export type ModelExtension<M extends Model = Model> = M extends Model ? M : neve
28
30
  * @property {boolean} rebuildWithTransient - Whether to include transient properties when rebuilding models
29
31
  * @memberOf module:db-decorators
30
32
  */
31
- export interface RepositoryFlags {
33
+ export interface RepositoryFlags<LOG extends Logger = Logger> {
32
34
  parentContext?: Context<any>;
33
35
  childContexts?: Context<any>[];
34
36
  callArgs?: any[];
@@ -39,4 +41,16 @@ export interface RepositoryFlags {
39
41
  operation?: OperationKeys;
40
42
  breakOnHandlerError: boolean;
41
43
  rebuildWithTransient: boolean;
44
+ ignoreValidation: boolean;
45
+ ignoreHandlers: boolean | string | RegExp;
46
+ logger: LOG;
47
+ correlationId?: string;
42
48
  }
49
+ export type LoggerOfFlags<R extends RepositoryFlags<any>> = R extends RepositoryFlags<infer L> ? L : never;
50
+ export type FlagsOfContext<C extends Context<any>> = C extends Context<infer F> ? F : never;
51
+ export type LoggerOfContext<C extends Context<any>> = LoggerOfFlags<FlagsOfContext<C>>;
52
+ export type ContextOfRepository<R extends IRepository<any, any>> = R extends IRepository<any, infer C> ? C : never;
53
+ export type LoggerOfRepository<R extends IRepository<any, any>> = LoggerOfContext<ContextOfRepository<R>>;
54
+ export type FlagsOfRepository<R extends IRepository<any, any>> = R extends IRepository<any, infer C> ? FlagsOfContext<C> : never;
55
+ export type PrimaryKeyType = string | number | bigint;
56
+ export type InferredPrimaryKeyType<M extends Model> = ExtendedMetadata<M>;