@decaf-ts/db-decorators 0.7.4 → 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.
- package/README.md +1 -1
- package/dist/db-decorators.cjs +1 -1
- package/dist/db-decorators.cjs.map +1 -1
- package/dist/db-decorators.js +1 -1
- package/dist/db-decorators.js.map +1 -1
- package/lib/esm/interfaces/BulkCrudOperator.d.ts +5 -4
- package/lib/esm/interfaces/Contextual.d.ts +3 -3
- package/lib/esm/interfaces/CrudOperator.d.ts +5 -4
- package/lib/esm/interfaces/IRepository.d.ts +2 -4
- package/lib/esm/model/decorators.d.ts +4 -5
- package/lib/esm/model/decorators.js.map +1 -1
- package/lib/esm/operations/Operations.d.ts +3 -7
- package/lib/esm/operations/Operations.js +1 -3
- package/lib/esm/operations/Operations.js.map +1 -1
- package/lib/esm/operations/OperationsRegistry.d.ts +2 -6
- package/lib/esm/operations/OperationsRegistry.js +0 -2
- package/lib/esm/operations/OperationsRegistry.js.map +1 -1
- package/lib/esm/operations/decorators.d.ts +42 -28
- package/lib/esm/operations/decorators.js +34 -11
- package/lib/esm/operations/decorators.js.map +1 -1
- package/lib/esm/operations/types.d.ts +9 -10
- package/lib/esm/overrides/Model.d.ts +16 -4
- package/lib/esm/overrides/overrides.js +21 -0
- package/lib/esm/overrides/overrides.js.map +1 -1
- package/lib/esm/repository/BaseRepository.d.ts +16 -27
- package/lib/esm/repository/BaseRepository.js +2 -28
- package/lib/esm/repository/BaseRepository.js.map +1 -1
- package/lib/esm/repository/Context.d.ts +9 -8
- package/lib/esm/repository/Context.js +9 -1
- package/lib/esm/repository/Context.js.map +1 -1
- package/lib/esm/repository/Repository.d.ts +9 -6
- package/lib/esm/repository/Repository.js +52 -38
- package/lib/esm/repository/Repository.js.map +1 -1
- package/lib/esm/repository/constants.d.ts +1 -1
- package/lib/esm/repository/constants.js +2 -0
- package/lib/esm/repository/constants.js.map +1 -1
- package/lib/esm/repository/types.d.ts +16 -2
- package/lib/esm/repository/utils.d.ts +6 -32
- package/lib/esm/repository/utils.js +9 -106
- package/lib/esm/repository/utils.js.map +1 -1
- package/lib/esm/validation/decorators.d.ts +4 -5
- package/lib/esm/validation/decorators.js.map +1 -1
- package/lib/interfaces/BulkCrudOperator.d.ts +5 -4
- package/lib/interfaces/Contextual.d.ts +3 -3
- package/lib/interfaces/CrudOperator.d.ts +5 -4
- package/lib/interfaces/IRepository.d.ts +2 -4
- package/lib/model/decorators.d.ts +4 -5
- package/lib/model/decorators.js.map +1 -1
- package/lib/operations/Operations.cjs +1 -3
- package/lib/operations/Operations.d.ts +3 -7
- package/lib/operations/Operations.js.map +1 -1
- package/lib/operations/OperationsRegistry.cjs +0 -2
- package/lib/operations/OperationsRegistry.d.ts +2 -6
- package/lib/operations/OperationsRegistry.js.map +1 -1
- package/lib/operations/decorators.cjs +36 -12
- package/lib/operations/decorators.d.ts +42 -28
- package/lib/operations/decorators.js.map +1 -1
- package/lib/operations/types.d.ts +9 -10
- package/lib/overrides/Model.d.ts +16 -4
- package/lib/overrides/overrides.cjs +21 -0
- package/lib/overrides/overrides.js.map +1 -1
- package/lib/repository/BaseRepository.cjs +2 -28
- package/lib/repository/BaseRepository.d.ts +16 -27
- package/lib/repository/BaseRepository.js.map +1 -1
- package/lib/repository/Context.cjs +9 -1
- package/lib/repository/Context.d.ts +9 -8
- package/lib/repository/Context.js.map +1 -1
- package/lib/repository/Repository.cjs +51 -37
- package/lib/repository/Repository.d.ts +9 -6
- package/lib/repository/Repository.js.map +1 -1
- package/lib/repository/constants.cjs +2 -0
- package/lib/repository/constants.d.ts +1 -1
- package/lib/repository/constants.js.map +1 -1
- package/lib/repository/types.d.ts +16 -2
- package/lib/repository/utils.cjs +10 -108
- package/lib/repository/utils.d.ts +6 -32
- package/lib/repository/utils.js.map +1 -1
- package/lib/validation/decorators.d.ts +4 -5
- package/lib/validation/decorators.js.map +1 -1
- package/package.json +11 -10
|
@@ -2,8 +2,7 @@ import { GeneralOperationHandler, GeneralUpdateOperationHandler, IdOperationHand
|
|
|
2
2
|
import { CrudOperations, OperationKeys } from "./constants";
|
|
3
3
|
import { Model } from "@decaf-ts/decorator-validation";
|
|
4
4
|
import { IRepository } from "../interfaces";
|
|
5
|
-
import {
|
|
6
|
-
import { Context } from "../repository/Context";
|
|
5
|
+
import { Constructor } from "@decaf-ts/decoration";
|
|
7
6
|
/**
|
|
8
7
|
* @description Represents sorting parameters for grouping decorators
|
|
9
8
|
* @summary Defines the structure for specifying group sorting options
|
|
@@ -22,16 +21,31 @@ export type GroupSort = {
|
|
|
22
21
|
* @description DecoratorObject type definition
|
|
23
22
|
* @summary Defines the structure of an object used to represent a decorator in the context of database operations.
|
|
24
23
|
* @typedef {Object} DecoratorObject
|
|
25
|
-
* @property {OperationHandler<any, any, any
|
|
24
|
+
* @property {OperationHandler<any, any, any>} handler - The handler function to be executed during the operation
|
|
26
25
|
* @property {object} data - Optional metadata to be passed to the handler function
|
|
27
26
|
* @property {string} prop - The property key to which the decorator is applied
|
|
28
27
|
* @category Type Definitions
|
|
29
28
|
*/
|
|
30
29
|
export type DecoratorObject = {
|
|
31
|
-
handler: OperationHandler<any, any, any
|
|
30
|
+
handler: OperationHandler<any, any, any>;
|
|
32
31
|
data: Record<string, any>[];
|
|
33
32
|
prop: string[];
|
|
34
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* @summary retrieves the arguments for the handler
|
|
36
|
+
* @param {any} dec the decorator
|
|
37
|
+
* @param {string} prop the property name
|
|
38
|
+
* @param {{}} m the model
|
|
39
|
+
* @param {{}} [accum] accumulator used for internal recursiveness
|
|
40
|
+
*
|
|
41
|
+
* @function getHandlerArgs
|
|
42
|
+
* @memberOf module:db-decorators.Repository
|
|
43
|
+
*/
|
|
44
|
+
export declare const getHandlerArgs: (dec: any, prop: string, m: Constructor<any>, accum?: Record<string, {
|
|
45
|
+
args: string[];
|
|
46
|
+
}>) => Record<string, {
|
|
47
|
+
args: string[];
|
|
48
|
+
}> | void;
|
|
35
49
|
/**
|
|
36
50
|
* @description Retrieves decorator objects for handling database operations
|
|
37
51
|
* @summary Retrieves a list of decorator objects representing operation handlers for a given model and decorators
|
|
@@ -47,7 +61,7 @@ export type DecoratorObject = {
|
|
|
47
61
|
* @function getHandlersDecorators
|
|
48
62
|
* @category Function
|
|
49
63
|
*/
|
|
50
|
-
export declare function getHandlersDecorators<M extends Model<true | false>, R extends IRepository<M,
|
|
64
|
+
export declare function getHandlersDecorators<M extends Model<true | false>, R extends IRepository<M, any>, V extends object = object>(model: Model, decorators: Record<string, DecoratorMetadata[]>, prefix: string): DecoratorObject[];
|
|
51
65
|
/**
|
|
52
66
|
* @description Groups decorators based on their group property
|
|
53
67
|
* @summary Groups decorator objects by their group property, combining data and properties within each group
|
|
@@ -76,7 +90,7 @@ export declare function sortDecorators(decorators: DecoratorObject[]): Decorator
|
|
|
76
90
|
* @function onCreateUpdate
|
|
77
91
|
* @category Property Decorators
|
|
78
92
|
*/
|
|
79
|
-
export declare function onCreateUpdate<V = object>(handler: GeneralOperationHandler<any, any, V
|
|
93
|
+
export declare function onCreateUpdate<V = object>(handler: GeneralOperationHandler<any, any, V> | GeneralUpdateOperationHandler<any, any, V>, data?: V, groupsort?: GroupSort): (target: any, propertyKey?: any) => void;
|
|
80
94
|
/**
|
|
81
95
|
* @description Decorator for handling update operations
|
|
82
96
|
* @summary Defines a behavior to execute during update operations
|
|
@@ -87,29 +101,29 @@ export declare function onCreateUpdate<V = object>(handler: GeneralOperationHand
|
|
|
87
101
|
* @function onUpdate
|
|
88
102
|
* @category Property Decorators
|
|
89
103
|
*/
|
|
90
|
-
export declare function onUpdate<V = object>(handler: UpdateOperationHandler<any, any, V
|
|
104
|
+
export declare function onUpdate<V = object>(handler: UpdateOperationHandler<any, any, V>, data?: V, groupsort?: GroupSort): (target: any, propertyKey?: any) => void;
|
|
91
105
|
/**
|
|
92
106
|
* @description Decorator for handling create operations
|
|
93
107
|
* @summary Defines a behavior to execute during create operations
|
|
94
108
|
* @template V - Type for metadata, defaults to object
|
|
95
|
-
* @param {GeneralOperationHandler<any, any, V
|
|
109
|
+
* @param {GeneralOperationHandler<any, any, V>} handler - The method called upon the operation
|
|
96
110
|
* @param {V} [data] - Optional metadata to pass to the handler
|
|
97
111
|
* @return {PropertyDecorator} A decorator that can be applied to class properties
|
|
98
112
|
* @function onCreate
|
|
99
113
|
* @category Property Decorators
|
|
100
114
|
*/
|
|
101
|
-
export declare function onCreate<V = object>(handler: GeneralOperationHandler<any, any, V
|
|
115
|
+
export declare function onCreate<V = object>(handler: GeneralOperationHandler<any, any, V>, data?: V, groupsort?: GroupSort): (target: any, propertyKey?: any) => void;
|
|
102
116
|
/**
|
|
103
117
|
* @description Decorator for handling read operations
|
|
104
118
|
* @summary Defines a behavior to execute during read operations
|
|
105
119
|
* @template V - Type for metadata, defaults to object
|
|
106
|
-
* @param {IdOperationHandler<any, any, V
|
|
120
|
+
* @param {IdOperationHandler<any, any, V>} handler - The method called upon the operation
|
|
107
121
|
* @param {V} [data] - Optional metadata to pass to the handler
|
|
108
122
|
* @return {PropertyDecorator} A decorator that can be applied to class properties
|
|
109
123
|
* @function onRead
|
|
110
124
|
* @category Property Decorators
|
|
111
125
|
*/
|
|
112
|
-
export declare function onRead<V = object>(handler: IdOperationHandler<any, any, V
|
|
126
|
+
export declare function onRead<V = object>(handler: IdOperationHandler<any, any, V>, data: V, groupsort?: GroupSort): (target: any, propertyKey?: any) => void;
|
|
113
127
|
/**
|
|
114
128
|
* @description Decorator for handling delete operations
|
|
115
129
|
* @summary Defines a behavior to execute during delete operations
|
|
@@ -120,7 +134,7 @@ export declare function onRead<V = object>(handler: IdOperationHandler<any, any,
|
|
|
120
134
|
* @function onDelete
|
|
121
135
|
* @category Property Decorators
|
|
122
136
|
*/
|
|
123
|
-
export declare function onDelete<V = object>(handler: OperationHandler<any, any, V
|
|
137
|
+
export declare function onDelete<V = object>(handler: OperationHandler<any, any, V>, data: V, groupsort?: GroupSort): (target: any, propertyKey?: any) => void;
|
|
124
138
|
/**
|
|
125
139
|
* @description Decorator for handling all operation types
|
|
126
140
|
* @summary Defines a behavior to execute during any database operation
|
|
@@ -131,7 +145,7 @@ export declare function onDelete<V = object>(handler: OperationHandler<any, any,
|
|
|
131
145
|
* @function onAny
|
|
132
146
|
* @category Property Decorators
|
|
133
147
|
*/
|
|
134
|
-
export declare function onAny<V = object>(handler: OperationHandler<any, any, V
|
|
148
|
+
export declare function onAny<V = object>(handler: OperationHandler<any, any, V>, data: V, groupsort?: GroupSort): (target: any, propertyKey?: any) => void;
|
|
135
149
|
/**
|
|
136
150
|
* @description Base decorator for handling database operations
|
|
137
151
|
* @summary Defines a behavior to execute during specified database operations
|
|
@@ -149,40 +163,40 @@ export declare function onAny<V = object>(handler: OperationHandler<any, any, V,
|
|
|
149
163
|
* myProperty: string;
|
|
150
164
|
* }
|
|
151
165
|
*/
|
|
152
|
-
export declare function on<V = object>(op: OperationKeys[] | undefined, handler: OperationHandler<any, any, V
|
|
166
|
+
export declare function on<V = object>(op: OperationKeys[] | undefined, handler: OperationHandler<any, any, V>, data?: V, groupsort?: GroupSort): (target: any, propertyKey?: any) => void;
|
|
153
167
|
/**
|
|
154
168
|
* @description Decorator for handling post-create and post-update operations
|
|
155
169
|
* @summary Defines a behavior to execute after both create and update operations
|
|
156
170
|
* @template V - Type for metadata, defaults to object
|
|
157
|
-
* @param {StandardOperationHandler<any, any, V
|
|
171
|
+
* @param {StandardOperationHandler<any, any, V> | UpdateOperationHandler<any, any, V, any, any>} handler - The method called after the operation
|
|
158
172
|
* @param {V} [data] - Optional metadata to pass to the handler
|
|
159
173
|
* @return {PropertyDecorator} A decorator that can be applied to class properties
|
|
160
174
|
* @function afterCreateUpdate
|
|
161
175
|
* @category Property Decorators
|
|
162
176
|
*/
|
|
163
|
-
export declare function afterCreateUpdate<V = object>(handler: StandardOperationHandler<any, any, V
|
|
177
|
+
export declare function afterCreateUpdate<V = object>(handler: StandardOperationHandler<any, any, V> | UpdateOperationHandler<any, any, V>, data: V, groupsort?: GroupSort): (target: any, propertyKey?: any) => void;
|
|
164
178
|
/**
|
|
165
179
|
* @description Decorator for handling post-update operations
|
|
166
180
|
* @summary Defines a behavior to execute after update operations
|
|
167
181
|
* @template V - Type for metadata, defaults to object
|
|
168
|
-
* @param {UpdateOperationHandler<any, any, V
|
|
182
|
+
* @param {UpdateOperationHandler<any, any, V>} handler - The method called after the operation
|
|
169
183
|
* @param {V} [data] - Optional metadata to pass to the handler
|
|
170
184
|
* @return {PropertyDecorator} A decorator that can be applied to class properties
|
|
171
185
|
* @function afterUpdate
|
|
172
186
|
* @category Property Decorators
|
|
173
187
|
*/
|
|
174
|
-
export declare function afterUpdate<V = object>(handler: UpdateOperationHandler<any, any, V
|
|
188
|
+
export declare function afterUpdate<V = object>(handler: UpdateOperationHandler<any, any, V>, data: V, groupsort?: GroupSort): (target: any, propertyKey?: any) => void;
|
|
175
189
|
/**
|
|
176
190
|
* @description Decorator for handling post-create operations
|
|
177
191
|
* @summary Defines a behavior to execute after create operations
|
|
178
192
|
* @template V - Type for metadata, defaults to object
|
|
179
|
-
* @param {StandardOperationHandler<any, any, V
|
|
193
|
+
* @param {StandardOperationHandler<any, any, V>} handler - The method called after the operation
|
|
180
194
|
* @param {V} [data] - Optional metadata to pass to the handler
|
|
181
195
|
* @return {PropertyDecorator} A decorator that can be applied to class properties
|
|
182
196
|
* @function afterCreate
|
|
183
197
|
* @category Property Decorators
|
|
184
198
|
*/
|
|
185
|
-
export declare function afterCreate<V = object>(handler: StandardOperationHandler<any, any, V
|
|
199
|
+
export declare function afterCreate<V = object>(handler: StandardOperationHandler<any, any, V>, data: V, groupsort?: GroupSort): (target: any, propertyKey?: any) => void;
|
|
186
200
|
/**
|
|
187
201
|
* @description Decorator for handling post-read operations
|
|
188
202
|
* @summary Defines a behavior to execute after read operations
|
|
@@ -193,7 +207,7 @@ export declare function afterCreate<V = object>(handler: StandardOperationHandle
|
|
|
193
207
|
* @function afterRead
|
|
194
208
|
* @category Property Decorators
|
|
195
209
|
*/
|
|
196
|
-
export declare function afterRead<V = object>(handler: StandardOperationHandler<any, any, V
|
|
210
|
+
export declare function afterRead<V = object>(handler: StandardOperationHandler<any, any, V>, data?: V, groupsort?: GroupSort): (target: any, propertyKey?: any) => void;
|
|
197
211
|
/**
|
|
198
212
|
* @description Decorator for handling post-delete operations
|
|
199
213
|
* @summary Defines a behavior to execute after delete operations
|
|
@@ -204,24 +218,24 @@ export declare function afterRead<V = object>(handler: StandardOperationHandler<
|
|
|
204
218
|
* @function afterDelete
|
|
205
219
|
* @category Property Decorators
|
|
206
220
|
*/
|
|
207
|
-
export declare function afterDelete<V = object>(handler: StandardOperationHandler<any, any, V
|
|
221
|
+
export declare function afterDelete<V = object>(handler: StandardOperationHandler<any, any, V>, data?: V, groupsort?: GroupSort): (target: any, propertyKey?: any) => void;
|
|
208
222
|
/**
|
|
209
223
|
* @description Decorator for handling post-operation for all operation types
|
|
210
224
|
* @summary Defines a behavior to execute after any database operation
|
|
211
225
|
* @template V - Type for metadata, defaults to object
|
|
212
|
-
* @param {StandardOperationHandler<any, any, V
|
|
226
|
+
* @param {StandardOperationHandler<any, any, V>} handler - The method called after the operation
|
|
213
227
|
* @param {V} [data] - Optional metadata to pass to the handler
|
|
214
228
|
* @return {PropertyDecorator} A decorator that can be applied to class properties
|
|
215
229
|
* @function afterAny
|
|
216
230
|
* @category Property Decorators
|
|
217
231
|
*/
|
|
218
|
-
export declare function afterAny<V = object>(handler: StandardOperationHandler<any, any, V
|
|
232
|
+
export declare function afterAny<V = object>(handler: StandardOperationHandler<any, any, V>, data?: V, groupsort?: GroupSort): (target: any, propertyKey?: any) => void;
|
|
219
233
|
/**
|
|
220
234
|
* @description Base decorator for handling post-operation behaviors
|
|
221
235
|
* @summary Defines a behavior to execute after specified database operations
|
|
222
236
|
* @template V - Type for metadata, defaults to object
|
|
223
237
|
* @param {OperationKeys[] | DBOperations} [op=DBOperations.ALL] - One or more operation types to handle
|
|
224
|
-
* @param {OperationHandler<any, any,
|
|
238
|
+
* @param {OperationHandler<any, any, Vy>} handler - The method called after the operation
|
|
225
239
|
* @param {V} [data] - Optional metadata to pass to the handler
|
|
226
240
|
* @return {PropertyDecorator} A decorator that can be applied to class properties
|
|
227
241
|
* @function after
|
|
@@ -233,14 +247,14 @@ export declare function afterAny<V = object>(handler: StandardOperationHandler<a
|
|
|
233
247
|
* myProperty: string;
|
|
234
248
|
* }
|
|
235
249
|
*/
|
|
236
|
-
export declare function after<V = object>(op: OperationKeys[] | undefined, handler: OperationHandler<any, any, V
|
|
250
|
+
export declare function after<V = object>(op: OperationKeys[] | undefined, handler: OperationHandler<any, any, V>, data?: V, groupsort?: GroupSort): (target: any, propertyKey?: any) => void;
|
|
237
251
|
/**
|
|
238
252
|
* @description Core decorator factory for operation handlers
|
|
239
253
|
* @summary Creates decorators that register handlers for database operations
|
|
240
254
|
* @template V - Type for metadata, defaults to object
|
|
241
255
|
* @param {OperationKeys.ON | OperationKeys.AFTER} baseOp - Whether the handler runs during or after the operation
|
|
242
256
|
* @param {OperationKeys[]} [operation=DBOperations.ALL] - The specific operations to handle
|
|
243
|
-
* @param {OperationHandler<any, any, V
|
|
257
|
+
* @param {OperationHandler<any, any, V>} handler - The handler function to execute
|
|
244
258
|
* @param {V} [dataToAdd] - Optional metadata to pass to the handler
|
|
245
259
|
* @return {PropertyDecorator} A decorator that can be applied to class properties
|
|
246
260
|
* @function operation
|
|
@@ -262,7 +276,7 @@ export declare function after<V = object>(op: OperationKeys[] | undefined, handl
|
|
|
262
276
|
* Handler-->>Operations: Return result
|
|
263
277
|
* Operations-->>Client: Return final result
|
|
264
278
|
*/
|
|
265
|
-
export declare function operation<V = object>(baseOp: OperationKeys.ON | OperationKeys.AFTER, operation: OperationKeys[] | undefined, handler: OperationHandler<any, any, V
|
|
279
|
+
export declare function operation<V = object>(baseOp: OperationKeys.ON | OperationKeys.AFTER, operation: OperationKeys[] | undefined, handler: OperationHandler<any, any, V>, dataToAdd?: V, groupsort?: GroupSort): (target: any, propertyKey?: any) => void;
|
|
266
280
|
/**
|
|
267
281
|
* @description
|
|
268
282
|
* Creates a higher-order function that attaches a metadata entry containing a handler
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { DBOperations, ModelOperations, OperationKeys, } from "./constants.js";
|
|
2
2
|
import { Operations } from "./Operations.js";
|
|
3
3
|
import { InternalError } from "./../repository/errors.js";
|
|
4
|
-
import {
|
|
5
|
-
import { propMetadata, apply, metadata, Metadata } from "@decaf-ts/decoration";
|
|
4
|
+
import { propMetadata, apply, metadata, Metadata, } from "@decaf-ts/decoration";
|
|
6
5
|
const defaultPriority = 50;
|
|
7
6
|
const DefaultGroupSort = { priority: defaultPriority };
|
|
8
7
|
/**
|
|
9
8
|
* @description Internal function to register operation handlers
|
|
10
9
|
* @summary Registers an operation handler for a specific operation key on a target property
|
|
11
10
|
* @param {OperationKeys} op - The operation key to handle
|
|
12
|
-
* @param {OperationHandler<any, any, any
|
|
11
|
+
* @param {OperationHandler<any, any, any>} handler - The handler function to register
|
|
13
12
|
* @return {PropertyDecorator} A decorator that registers the handler
|
|
14
13
|
* @function handle
|
|
15
14
|
* @category Property Decorators
|
|
@@ -19,6 +18,30 @@ function handle(op, handler) {
|
|
|
19
18
|
Operations.register(handler, op, target, propertyKey);
|
|
20
19
|
};
|
|
21
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* @summary retrieves the arguments for the handler
|
|
23
|
+
* @param {any} dec the decorator
|
|
24
|
+
* @param {string} prop the property name
|
|
25
|
+
* @param {{}} m the model
|
|
26
|
+
* @param {{}} [accum] accumulator used for internal recursiveness
|
|
27
|
+
*
|
|
28
|
+
* @function getHandlerArgs
|
|
29
|
+
* @memberOf module:db-decorators.Repository
|
|
30
|
+
*/
|
|
31
|
+
export const getHandlerArgs = function (dec, prop, m, accum) {
|
|
32
|
+
const name = m.constructor.name;
|
|
33
|
+
if (!name)
|
|
34
|
+
throw new InternalError("Could not determine model class");
|
|
35
|
+
accum = accum || {};
|
|
36
|
+
if (dec.props.handlers[name] && dec.props.handlers[name][prop])
|
|
37
|
+
accum = { ...dec.props.handlers[name][prop], ...accum };
|
|
38
|
+
let proto = Object.getPrototypeOf(m);
|
|
39
|
+
if (proto === Object.prototype)
|
|
40
|
+
return accum;
|
|
41
|
+
if (proto.constructor.name === name)
|
|
42
|
+
proto = Object.getPrototypeOf(proto);
|
|
43
|
+
return getHandlerArgs(dec, prop, proto, accum);
|
|
44
|
+
};
|
|
22
45
|
/**
|
|
23
46
|
* @description Retrieves decorator objects for handling database operations
|
|
24
47
|
* @summary Retrieves a list of decorator objects representing operation handlers for a given model and decorators
|
|
@@ -151,7 +174,7 @@ export function onUpdate(handler, data, groupsort) {
|
|
|
151
174
|
* @description Decorator for handling create operations
|
|
152
175
|
* @summary Defines a behavior to execute during create operations
|
|
153
176
|
* @template V - Type for metadata, defaults to object
|
|
154
|
-
* @param {GeneralOperationHandler<any, any, V
|
|
177
|
+
* @param {GeneralOperationHandler<any, any, V>} handler - The method called upon the operation
|
|
155
178
|
* @param {V} [data] - Optional metadata to pass to the handler
|
|
156
179
|
* @return {PropertyDecorator} A decorator that can be applied to class properties
|
|
157
180
|
* @function onCreate
|
|
@@ -164,7 +187,7 @@ export function onCreate(handler, data, groupsort) {
|
|
|
164
187
|
* @description Decorator for handling read operations
|
|
165
188
|
* @summary Defines a behavior to execute during read operations
|
|
166
189
|
* @template V - Type for metadata, defaults to object
|
|
167
|
-
* @param {IdOperationHandler<any, any, V
|
|
190
|
+
* @param {IdOperationHandler<any, any, V>} handler - The method called upon the operation
|
|
168
191
|
* @param {V} [data] - Optional metadata to pass to the handler
|
|
169
192
|
* @return {PropertyDecorator} A decorator that can be applied to class properties
|
|
170
193
|
* @function onRead
|
|
@@ -223,7 +246,7 @@ export function on(op = DBOperations.ALL, handler, data, groupsort) {
|
|
|
223
246
|
* @description Decorator for handling post-create and post-update operations
|
|
224
247
|
* @summary Defines a behavior to execute after both create and update operations
|
|
225
248
|
* @template V - Type for metadata, defaults to object
|
|
226
|
-
* @param {StandardOperationHandler<any, any, V
|
|
249
|
+
* @param {StandardOperationHandler<any, any, V> | UpdateOperationHandler<any, any, V, any, any>} handler - The method called after the operation
|
|
227
250
|
* @param {V} [data] - Optional metadata to pass to the handler
|
|
228
251
|
* @return {PropertyDecorator} A decorator that can be applied to class properties
|
|
229
252
|
* @function afterCreateUpdate
|
|
@@ -236,7 +259,7 @@ export function afterCreateUpdate(handler, data, groupsort) {
|
|
|
236
259
|
* @description Decorator for handling post-update operations
|
|
237
260
|
* @summary Defines a behavior to execute after update operations
|
|
238
261
|
* @template V - Type for metadata, defaults to object
|
|
239
|
-
* @param {UpdateOperationHandler<any, any, V
|
|
262
|
+
* @param {UpdateOperationHandler<any, any, V>} handler - The method called after the operation
|
|
240
263
|
* @param {V} [data] - Optional metadata to pass to the handler
|
|
241
264
|
* @return {PropertyDecorator} A decorator that can be applied to class properties
|
|
242
265
|
* @function afterUpdate
|
|
@@ -249,7 +272,7 @@ export function afterUpdate(handler, data, groupsort) {
|
|
|
249
272
|
* @description Decorator for handling post-create operations
|
|
250
273
|
* @summary Defines a behavior to execute after create operations
|
|
251
274
|
* @template V - Type for metadata, defaults to object
|
|
252
|
-
* @param {StandardOperationHandler<any, any, V
|
|
275
|
+
* @param {StandardOperationHandler<any, any, V>} handler - The method called after the operation
|
|
253
276
|
* @param {V} [data] - Optional metadata to pass to the handler
|
|
254
277
|
* @return {PropertyDecorator} A decorator that can be applied to class properties
|
|
255
278
|
* @function afterCreate
|
|
@@ -288,7 +311,7 @@ export function afterDelete(handler, data, groupsort) {
|
|
|
288
311
|
* @description Decorator for handling post-operation for all operation types
|
|
289
312
|
* @summary Defines a behavior to execute after any database operation
|
|
290
313
|
* @template V - Type for metadata, defaults to object
|
|
291
|
-
* @param {StandardOperationHandler<any, any, V
|
|
314
|
+
* @param {StandardOperationHandler<any, any, V>} handler - The method called after the operation
|
|
292
315
|
* @param {V} [data] - Optional metadata to pass to the handler
|
|
293
316
|
* @return {PropertyDecorator} A decorator that can be applied to class properties
|
|
294
317
|
* @function afterAny
|
|
@@ -302,7 +325,7 @@ export function afterAny(handler, data, groupsort) {
|
|
|
302
325
|
* @summary Defines a behavior to execute after specified database operations
|
|
303
326
|
* @template V - Type for metadata, defaults to object
|
|
304
327
|
* @param {OperationKeys[] | DBOperations} [op=DBOperations.ALL] - One or more operation types to handle
|
|
305
|
-
* @param {OperationHandler<any, any,
|
|
328
|
+
* @param {OperationHandler<any, any, Vy>} handler - The method called after the operation
|
|
306
329
|
* @param {V} [data] - Optional metadata to pass to the handler
|
|
307
330
|
* @return {PropertyDecorator} A decorator that can be applied to class properties
|
|
308
331
|
* @function after
|
|
@@ -323,7 +346,7 @@ export function after(op = DBOperations.ALL, handler, data, groupsort) {
|
|
|
323
346
|
* @template V - Type for metadata, defaults to object
|
|
324
347
|
* @param {OperationKeys.ON | OperationKeys.AFTER} baseOp - Whether the handler runs during or after the operation
|
|
325
348
|
* @param {OperationKeys[]} [operation=DBOperations.ALL] - The specific operations to handle
|
|
326
|
-
* @param {OperationHandler<any, any, V
|
|
349
|
+
* @param {OperationHandler<any, any, V>} handler - The handler function to execute
|
|
327
350
|
* @param {V} [dataToAdd] - Optional metadata to pass to the handler
|
|
328
351
|
* @return {PropertyDecorator} A decorator that can be applied to class properties
|
|
329
352
|
* @function operation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../src/operations/decorators.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,YAAY,EACZ,eAAe,EACf,aAAa,GACd,uBAAoB;AACrB,OAAO,EAAE,UAAU,EAAE,wBAAqB;
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../src/operations/decorators.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,YAAY,EACZ,eAAe,EACf,aAAa,GACd,uBAAoB;AACrB,OAAO,EAAE,UAAU,EAAE,wBAAqB;AAG1C,OAA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AkB,EAAE,EAAE;QAC/B,OAAO,QAAQ,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAClD,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,UAA4B,EAAE,EAAE,CAC9D,oBAAoB,CAClB,aAAa,CAAC,OAAO,GAAG,aAAa,CAAC,KAAK,EAC3C,CAAC,UAA4B,EAAE,SAAyB,EAAE,EAAE;IAC1D,OAAO,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AACxC,CAAC,CACF,CAAC,UAAU,CAAC,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { OperationKeys } from "./constants";
|
|
2
2
|
import { IRepository } from "../interfaces/IRepository";
|
|
3
3
|
import { Model } from "@decaf-ts/decorator-validation";
|
|
4
|
-
import {
|
|
5
|
-
import { RepositoryFlags } from "../repository/types";
|
|
4
|
+
import { ContextOfRepository } from "../repository/index";
|
|
6
5
|
/**
|
|
7
6
|
* @description Metadata for database operations
|
|
8
7
|
* @summary Contains information about an operation, its handler, and associated metadata
|
|
@@ -28,12 +27,12 @@ export type OperationMetadata<V> = {
|
|
|
28
27
|
* @template C - Context type extending Context<F>
|
|
29
28
|
* @memberOf module:db-decorators
|
|
30
29
|
*/
|
|
31
|
-
export type OperationHandler<M extends Model, R extends IRepository<M,
|
|
32
|
-
export type StandardOperationHandler<M extends Model, R extends IRepository<M,
|
|
33
|
-
export type IdOperationHandler<M extends Model, R extends IRepository<M,
|
|
34
|
-
export type UpdateOperationHandler<M extends Model, R extends IRepository<M,
|
|
35
|
-
export type GroupOperationHandler<M extends Model, R extends IRepository<M,
|
|
36
|
-
export type GroupUpdateOperationHandler<M extends Model, R extends IRepository<M,
|
|
30
|
+
export type OperationHandler<M extends Model, R extends IRepository<M, any>, V = object> = StandardOperationHandler<M, R, V> | UpdateOperationHandler<M, R, V> | IdOperationHandler<M, R, V> | GroupOperationHandler<M, R, V> | GroupUpdateOperationHandler<M, R, V>;
|
|
31
|
+
export type StandardOperationHandler<M extends Model, R extends IRepository<M, any>, V = object> = (this: R, context: ContextOfRepository<R>, metadata: V, key: keyof M, model: M) => Promise<void> | void;
|
|
32
|
+
export type IdOperationHandler<M extends Model, R extends IRepository<M, any>, V = object> = (this: R, context: ContextOfRepository<R>, decorator: V, key: keyof M, id: string) => Promise<void> | void;
|
|
33
|
+
export type UpdateOperationHandler<M extends Model, R extends IRepository<M, any>, V = object> = (this: R, context: ContextOfRepository<R>, decorator: V, key: keyof M, model: M, oldModel: M) => Promise<void> | void;
|
|
34
|
+
export type GroupOperationHandler<M extends Model, R extends IRepository<M, any>, V = object> = (this: R, context: ContextOfRepository<R>, metadata: V[], keys: (keyof M)[], model: M) => Promise<void> | void;
|
|
35
|
+
export type GroupUpdateOperationHandler<M extends Model, R extends IRepository<M, any>, V = object> = (this: R, context: ContextOfRepository<R>, decorator: V[], keys: (keyof M)[], model: M, oldModel: M) => Promise<void> | void;
|
|
37
36
|
/**
|
|
38
37
|
* @description General handler type for database operations
|
|
39
38
|
* @summary Function signature for handlers that process operations like create and read
|
|
@@ -46,7 +45,7 @@ export type GroupUpdateOperationHandler<M extends Model, R extends IRepository<M
|
|
|
46
45
|
* @return {Promise<void> | void} Nothing or a Promise resolving to nothing
|
|
47
46
|
* @memberOf module:db-decorators
|
|
48
47
|
*/
|
|
49
|
-
export type GeneralOperationHandler<M extends Model, R extends IRepository<M,
|
|
48
|
+
export type GeneralOperationHandler<M extends Model, R extends IRepository<M, any>, V = object> = StandardOperationHandler<M, R, V> | GroupOperationHandler<M, R, V>;
|
|
50
49
|
/**
|
|
51
50
|
* @description General handler type for group update database operations
|
|
52
51
|
* @summary Function signature for handlers that process update operations with both new and old model states
|
|
@@ -58,4 +57,4 @@ export type GeneralOperationHandler<M extends Model, R extends IRepository<M, F,
|
|
|
58
57
|
* @typedef {Function} GeneralUpdateOperationHandler
|
|
59
58
|
* @memberOf module:db-decorators
|
|
60
59
|
*/
|
|
61
|
-
export type GeneralUpdateOperationHandler<M extends Model, R extends IRepository<M,
|
|
60
|
+
export type GeneralUpdateOperationHandler<M extends Model, R extends IRepository<M, any>, V = object> = UpdateOperationHandler<M, R, V> | GroupUpdateOperationHandler<M, R, V>;
|
|
@@ -3,7 +3,7 @@ import "@decaf-ts/decorator-validation";
|
|
|
3
3
|
declare module "@decaf-ts/decorator-validation" {
|
|
4
4
|
interface Model {
|
|
5
5
|
isTransient(): boolean;
|
|
6
|
-
segregate<M extends Model
|
|
6
|
+
segregate<M extends Model<boolean>>(this: M): {
|
|
7
7
|
model: M;
|
|
8
8
|
transient?: Record<keyof M, M[keyof M]>;
|
|
9
9
|
};
|
|
@@ -24,8 +24,11 @@ declare module "@decaf-ts/decorator-validation" {
|
|
|
24
24
|
* const idProp = Model.pk(newModel);
|
|
25
25
|
* const id = Model.pk(newModel, true);
|
|
26
26
|
*/
|
|
27
|
-
function pk<M
|
|
28
|
-
function
|
|
27
|
+
function pk<M extends Model<boolean>>(model: M | Constructor<M>): keyof M;
|
|
28
|
+
function pk<M extends Model<boolean>>(model: M, keyValue: boolean): M[keyof M];
|
|
29
|
+
function pk<M extends Model<boolean>>(model: M | Constructor<M>, keyValue?: boolean): keyof M | M[keyof M];
|
|
30
|
+
function pkProps<M extends Model<boolean>>(model: Constructor<M>): any;
|
|
31
|
+
function isTransient<M extends Model<boolean>>(model: M | Constructor<M>): boolean;
|
|
29
32
|
/**
|
|
30
33
|
* @description Separates transient properties from a model
|
|
31
34
|
* @summary Extracts properties marked as transient into a separate object
|
|
@@ -55,9 +58,18 @@ declare module "@decaf-ts/decorator-validation" {
|
|
|
55
58
|
* modelToTransient-->>Caller: {model, transient}
|
|
56
59
|
* end
|
|
57
60
|
*/
|
|
58
|
-
function segregate<M extends Model
|
|
61
|
+
function segregate<M extends Model<boolean>>(model: M): {
|
|
59
62
|
model: M;
|
|
60
63
|
transient?: Record<keyof M, M[keyof M]>;
|
|
61
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* @description Merges two model instances into a new instance.
|
|
67
|
+
* @summary Creates a new model instance by combining properties from an old model and a new model.
|
|
68
|
+
* Properties from the new model override properties from the old model if they are defined.
|
|
69
|
+
* @param {M} oldModel - The original model instance
|
|
70
|
+
* @param {M} model - The new model instance with updated properties
|
|
71
|
+
* @return {M} A new model instance with merged properties
|
|
72
|
+
*/
|
|
73
|
+
function merge<M extends Model<boolean>>(oldModel: M, newModel: M, constructor?: Constructor<M>): M;
|
|
62
74
|
}
|
|
63
75
|
}
|
|
@@ -83,9 +83,30 @@ Model.pk = function (model, keyValue = false) {
|
|
|
83
83
|
return model[key];
|
|
84
84
|
throw new Error("Cannot get the value of the pk from the constructor");
|
|
85
85
|
}.bind(Model);
|
|
86
|
+
Model.pkProps = function (model) {
|
|
87
|
+
return Metadata.get(model, Metadata.key(DBKeys.ID, Model.pk(model)));
|
|
88
|
+
}.bind(Model);
|
|
86
89
|
Model.isTransient = function isTransient(model) {
|
|
87
90
|
return Metadata.isTransient(model);
|
|
88
91
|
}.bind(Model);
|
|
92
|
+
/**
|
|
93
|
+
* @description Merges two model instances into a new instance.
|
|
94
|
+
* @summary Creates a new model instance by combining properties from an old model and a new model.
|
|
95
|
+
* Properties from the new model override properties from the old model if they are defined.
|
|
96
|
+
* @template {M} - Type extending Model
|
|
97
|
+
* @param {M} oldModel - The original model instance
|
|
98
|
+
* @param {M} model - The new model instance with updated properties
|
|
99
|
+
* @return {M} A new model instance with merged properties
|
|
100
|
+
*/
|
|
101
|
+
Model.merge = function merge(oldModel, newModel, constructor) {
|
|
102
|
+
constructor = constructor || oldModel.constructor;
|
|
103
|
+
const extract = (model) => Object.entries(model).reduce((accum, [key, val]) => {
|
|
104
|
+
if (typeof val !== "undefined")
|
|
105
|
+
accum[key] = val;
|
|
106
|
+
return accum;
|
|
107
|
+
}, {});
|
|
108
|
+
return new constructor(Object.assign({}, extract(oldModel), extract(newModel)));
|
|
109
|
+
}.bind(Model);
|
|
89
110
|
Metadata.saveOperation = function (model, propertyKey, operation, metadata) {
|
|
90
111
|
if (!propertyKey)
|
|
91
112
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overrides.js","sourceRoot":"","sources":["../../../src/overrides/overrides.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAEL,QAAQ,GACT,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,iCAA4B;AACtD,OAAO,EAAe,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,gCAA2B;AAC5C,OAAO,EAAE,eAAe,EAAE,qCAAgC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,kCAA6B;AAE1D,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG;IAC5B,OAAO,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC,CAAC;AAEF;;;;;;;;;GASG;AACH,KAAK,CAAC,SAAS,CAAC,SAAS,GAAG,UAE1B,eAAyB,EACzB,GAAG,UAAiB;IAEpB,IAAI,eAAe,IAAI,CAAC,CAAC,eAAe,YAAY,KAAK,CAAC,EAAE,CAAC;QAC3D,UAAU,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QACpC,eAAe,GAAG,SAAS,CAAC;IAC9B,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;IAC7B,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC,CAAC;IAElD,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,EAAE;YACjD,IAAI,YAAY,IAAI,CAAC,eAAe,EAAE,CAAC;gBACrC,OAAO,YAAY,CAAC;YACtB,CAAC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