lakutata 2.0.1 → 2.0.2

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 (45) hide show
  1. package/com/database.d.ts +4 -4
  2. package/com/docker.d.ts +5 -4
  3. package/com/entrypoint.cjs +13 -11
  4. package/com/entrypoint.d.ts +13 -8
  5. package/com/entrypoint.mjs +2 -2
  6. package/com/logger.d.ts +3 -3
  7. package/decorator/asst.d.ts +2 -2
  8. package/decorator/ctrl.d.ts +5 -5
  9. package/decorator/di.d.ts +5 -5
  10. package/decorator/dto.d.ts +5 -5
  11. package/decorator/orm.d.ts +3 -3
  12. package/helper.d.ts +2 -2
  13. package/lakutata.cjs +16 -18
  14. package/lakutata.d.ts +12 -16
  15. package/lakutata.mjs +2 -2
  16. package/orm.d.ts +4 -4
  17. package/orm.mjs +30 -30
  18. package/package.json +1 -1
  19. package/src/components/entrypoint/Entrypoint.cjs +1 -1
  20. package/src/components/entrypoint/Entrypoint.mjs +1 -1
  21. package/src/components/entrypoint/exceptions/ControllerActionNotFoundException.cjs +34 -0
  22. package/src/components/entrypoint/exceptions/ControllerActionNotFoundException.mjs +28 -0
  23. package/src/decorators/orm/Column.cjs +14 -14
  24. package/src/decorators/orm/Column.mjs +2 -2
  25. package/src/decorators/orm/PrimaryColumn.cjs +1 -1
  26. package/src/decorators/orm/PrimaryColumn.mjs +2 -2
  27. package/src/lib/core/Application.cjs +1 -1
  28. package/src/lib/core/Application.mjs +1 -1
  29. package/vendor/Package.14.cjs +20 -18
  30. package/vendor/Package.14.mjs +17 -19
  31. package/vendor/TypeDef.1.d.ts +274 -489
  32. package/vendor/TypeDef.10.d.ts +5 -6
  33. package/vendor/TypeDef.11.d.ts +4 -104
  34. package/vendor/TypeDef.12.d.ts +96 -60
  35. package/vendor/TypeDef.13.d.ts +71 -0
  36. package/vendor/TypeDef.2.d.ts +489 -948
  37. package/vendor/TypeDef.3.d.ts +662 -18813
  38. package/vendor/TypeDef.4.d.ts +18176 -3169
  39. package/vendor/TypeDef.5.d.ts +4093 -12
  40. package/vendor/TypeDef.6.d.ts +11 -2
  41. package/vendor/TypeDef.7.d.ts +20 -2
  42. package/vendor/TypeDef.8.d.ts +2 -5
  43. package/vendor/TypeDef.9.d.ts +2 -294
  44. package/src/exceptions/ControllerActionNotFoundException.cjs +0 -34
  45. package/src/exceptions/ControllerActionNotFoundException.mjs +0 -28
@@ -1,949 +1,490 @@
1
- import { D as DTO } from './TypeDef.4.js';
2
- import './TypeDef.1.js';
3
-
4
- /**
5
- * Injection mode type.
6
- */
7
- type InjectionModeType = 'PROXY' | 'CLASSIC';
8
-
9
- /**
10
- * Lifetime type.
11
- */
12
- type LifetimeType = 'APPLICATION_SINGLETON' | 'MODULE_SINGLETON' | 'SINGLETON' | 'TRANSIENT' | 'SCOPED';
13
-
14
- /**
15
- * Gets passed the container and is expected to return an object
16
- * whose properties are accessible at construction time for the
17
- * configured resolver.
18
- *
19
- * @type {Function}
20
- */
21
- type InjectorFunction = <T extends object>(container: IDependencyInjectionContainer<T>) => object;
22
- /**
23
- * A resolver object returned by asClass(), asFunction() or asValue().
24
- */
25
- interface Resolver<T> extends ResolverOptions<T> {
26
- resolve<U extends object>(container: IDependencyInjectionContainer<U>): T;
1
+ /*! *****************************************************************************
2
+ Copyright (C) Microsoft. All rights reserved.
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
+ this file except in compliance with the License. You may obtain a copy of the
5
+ License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
+ MERCHANTABLITY OR NON-INFRINGEMENT.
11
+
12
+ See the Apache Version 2.0 License for specific language governing permissions
13
+ and limitations under the License.
14
+ ***************************************************************************** */
15
+
16
+
17
+
18
+ declare global {
19
+ namespace Reflect {
20
+ /**
21
+ * Applies a set of decorators to a target object.
22
+ * @param decorators An array of decorators.
23
+ * @param target The target object.
24
+ * @returns The result of applying the provided decorators.
25
+ * @remarks Decorators are applied in reverse order of their positions in the array.
26
+ * @example
27
+ *
28
+ * class Example { }
29
+ *
30
+ * // constructor
31
+ * Example = Reflect.decorate(decoratorsArray, Example);
32
+ *
33
+ */
34
+ function decorate(decorators: ClassDecorator[], target: Function): Function;
35
+ /**
36
+ * Applies a set of decorators to a property of a target object.
37
+ * @param decorators An array of decorators.
38
+ * @param target The target object.
39
+ * @param propertyKey The property key to decorate.
40
+ * @param attributes A property descriptor.
41
+ * @remarks Decorators are applied in reverse order.
42
+ * @example
43
+ *
44
+ * class Example {
45
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
46
+ * // static staticProperty;
47
+ * // property;
48
+ *
49
+ * static staticMethod() { }
50
+ * method() { }
51
+ * }
52
+ *
53
+ * // property (on constructor)
54
+ * Reflect.decorate(decoratorsArray, Example, "staticProperty");
55
+ *
56
+ * // property (on prototype)
57
+ * Reflect.decorate(decoratorsArray, Example.prototype, "property");
58
+ *
59
+ * // method (on constructor)
60
+ * Object.defineProperty(Example, "staticMethod",
61
+ * Reflect.decorate(decoratorsArray, Example, "staticMethod",
62
+ * Object.getOwnPropertyDescriptor(Example, "staticMethod")));
63
+ *
64
+ * // method (on prototype)
65
+ * Object.defineProperty(Example.prototype, "method",
66
+ * Reflect.decorate(decoratorsArray, Example.prototype, "method",
67
+ * Object.getOwnPropertyDescriptor(Example.prototype, "method")));
68
+ *
69
+ */
70
+ function decorate(decorators: (PropertyDecorator | MethodDecorator)[], target: Object, propertyKey: string | symbol, attributes?: PropertyDescriptor): PropertyDescriptor;
71
+ /**
72
+ * A default metadata decorator factory that can be used on a class, class member, or parameter.
73
+ * @param metadataKey The key for the metadata entry.
74
+ * @param metadataValue The value for the metadata entry.
75
+ * @returns A decorator function.
76
+ * @remarks
77
+ * If `metadataKey` is already defined for the target and target key, the
78
+ * metadataValue for that key will be overwritten.
79
+ * @example
80
+ *
81
+ * // constructor
82
+ * @Reflect.metadata(key, value)
83
+ * class Example {
84
+ * }
85
+ *
86
+ * // property (on constructor, TypeScript only)
87
+ * class Example {
88
+ * @Reflect.metadata(key, value)
89
+ * static staticProperty;
90
+ * }
91
+ *
92
+ * // property (on prototype, TypeScript only)
93
+ * class Example {
94
+ * @Reflect.metadata(key, value)
95
+ * property;
96
+ * }
97
+ *
98
+ * // method (on constructor)
99
+ * class Example {
100
+ * @Reflect.metadata(key, value)
101
+ * static staticMethod() { }
102
+ * }
103
+ *
104
+ * // method (on prototype)
105
+ * class Example {
106
+ * @Reflect.metadata(key, value)
107
+ * method() { }
108
+ * }
109
+ *
110
+ */
111
+ function metadata(metadataKey: any, metadataValue: any): {
112
+ (target: Function): void;
113
+ (target: Object, propertyKey: string | symbol): void;
114
+ };
115
+ /**
116
+ * Define a unique metadata entry on the target.
117
+ * @param metadataKey A key used to store and retrieve metadata.
118
+ * @param metadataValue A value that contains attached metadata.
119
+ * @param target The target object on which to define metadata.
120
+ * @example
121
+ *
122
+ * class Example {
123
+ * }
124
+ *
125
+ * // constructor
126
+ * Reflect.defineMetadata("custom:annotation", options, Example);
127
+ *
128
+ * // decorator factory as metadata-producing annotation.
129
+ * function MyAnnotation(options): ClassDecorator {
130
+ * return target => Reflect.defineMetadata("custom:annotation", options, target);
131
+ * }
132
+ *
133
+ */
134
+ function defineMetadata(metadataKey: any, metadataValue: any, target: Object): void;
135
+ /**
136
+ * Define a unique metadata entry on the target.
137
+ * @param metadataKey A key used to store and retrieve metadata.
138
+ * @param metadataValue A value that contains attached metadata.
139
+ * @param target The target object on which to define metadata.
140
+ * @param propertyKey The property key for the target.
141
+ * @example
142
+ *
143
+ * class Example {
144
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
145
+ * // static staticProperty;
146
+ * // property;
147
+ *
148
+ * static staticMethod(p) { }
149
+ * method(p) { }
150
+ * }
151
+ *
152
+ * // property (on constructor)
153
+ * Reflect.defineMetadata("custom:annotation", Number, Example, "staticProperty");
154
+ *
155
+ * // property (on prototype)
156
+ * Reflect.defineMetadata("custom:annotation", Number, Example.prototype, "property");
157
+ *
158
+ * // method (on constructor)
159
+ * Reflect.defineMetadata("custom:annotation", Number, Example, "staticMethod");
160
+ *
161
+ * // method (on prototype)
162
+ * Reflect.defineMetadata("custom:annotation", Number, Example.prototype, "method");
163
+ *
164
+ * // decorator factory as metadata-producing annotation.
165
+ * function MyAnnotation(options): PropertyDecorator {
166
+ * return (target, key) => Reflect.defineMetadata("custom:annotation", options, target, key);
167
+ * }
168
+ *
169
+ */
170
+ function defineMetadata(metadataKey: any, metadataValue: any, target: Object, propertyKey: string | symbol): void;
171
+ /**
172
+ * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
173
+ * @param metadataKey A key used to store and retrieve metadata.
174
+ * @param target The target object on which the metadata is defined.
175
+ * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
176
+ * @example
177
+ *
178
+ * class Example {
179
+ * }
180
+ *
181
+ * // constructor
182
+ * result = Reflect.hasMetadata("custom:annotation", Example);
183
+ *
184
+ */
185
+ function hasMetadata(metadataKey: any, target: Object): boolean;
186
+ /**
187
+ * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
188
+ * @param metadataKey A key used to store and retrieve metadata.
189
+ * @param target The target object on which the metadata is defined.
190
+ * @param propertyKey The property key for the target.
191
+ * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
192
+ * @example
193
+ *
194
+ * class Example {
195
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
196
+ * // static staticProperty;
197
+ * // property;
198
+ *
199
+ * static staticMethod(p) { }
200
+ * method(p) { }
201
+ * }
202
+ *
203
+ * // property (on constructor)
204
+ * result = Reflect.hasMetadata("custom:annotation", Example, "staticProperty");
205
+ *
206
+ * // property (on prototype)
207
+ * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "property");
208
+ *
209
+ * // method (on constructor)
210
+ * result = Reflect.hasMetadata("custom:annotation", Example, "staticMethod");
211
+ *
212
+ * // method (on prototype)
213
+ * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method");
214
+ *
215
+ */
216
+ function hasMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean;
217
+ /**
218
+ * Gets a value indicating whether the target object has the provided metadata key defined.
219
+ * @param metadataKey A key used to store and retrieve metadata.
220
+ * @param target The target object on which the metadata is defined.
221
+ * @returns `true` if the metadata key was defined on the target object; otherwise, `false`.
222
+ * @example
223
+ *
224
+ * class Example {
225
+ * }
226
+ *
227
+ * // constructor
228
+ * result = Reflect.hasOwnMetadata("custom:annotation", Example);
229
+ *
230
+ */
231
+ function hasOwnMetadata(metadataKey: any, target: Object): boolean;
232
+ /**
233
+ * Gets a value indicating whether the target object has the provided metadata key defined.
234
+ * @param metadataKey A key used to store and retrieve metadata.
235
+ * @param target The target object on which the metadata is defined.
236
+ * @param propertyKey The property key for the target.
237
+ * @returns `true` if the metadata key was defined on the target object; otherwise, `false`.
238
+ * @example
239
+ *
240
+ * class Example {
241
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
242
+ * // static staticProperty;
243
+ * // property;
244
+ *
245
+ * static staticMethod(p) { }
246
+ * method(p) { }
247
+ * }
248
+ *
249
+ * // property (on constructor)
250
+ * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticProperty");
251
+ *
252
+ * // property (on prototype)
253
+ * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "property");
254
+ *
255
+ * // method (on constructor)
256
+ * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticMethod");
257
+ *
258
+ * // method (on prototype)
259
+ * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method");
260
+ *
261
+ */
262
+ function hasOwnMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean;
263
+ /**
264
+ * Gets the metadata value for the provided metadata key on the target object or its prototype chain.
265
+ * @param metadataKey A key used to store and retrieve metadata.
266
+ * @param target The target object on which the metadata is defined.
267
+ * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
268
+ * @example
269
+ *
270
+ * class Example {
271
+ * }
272
+ *
273
+ * // constructor
274
+ * result = Reflect.getMetadata("custom:annotation", Example);
275
+ *
276
+ */
277
+ function getMetadata(metadataKey: any, target: Object): any;
278
+ /**
279
+ * Gets the metadata value for the provided metadata key on the target object or its prototype chain.
280
+ * @param metadataKey A key used to store and retrieve metadata.
281
+ * @param target The target object on which the metadata is defined.
282
+ * @param propertyKey The property key for the target.
283
+ * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
284
+ * @example
285
+ *
286
+ * class Example {
287
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
288
+ * // static staticProperty;
289
+ * // property;
290
+ *
291
+ * static staticMethod(p) { }
292
+ * method(p) { }
293
+ * }
294
+ *
295
+ * // property (on constructor)
296
+ * result = Reflect.getMetadata("custom:annotation", Example, "staticProperty");
297
+ *
298
+ * // property (on prototype)
299
+ * result = Reflect.getMetadata("custom:annotation", Example.prototype, "property");
300
+ *
301
+ * // method (on constructor)
302
+ * result = Reflect.getMetadata("custom:annotation", Example, "staticMethod");
303
+ *
304
+ * // method (on prototype)
305
+ * result = Reflect.getMetadata("custom:annotation", Example.prototype, "method");
306
+ *
307
+ */
308
+ function getMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): any;
309
+ /**
310
+ * Gets the metadata value for the provided metadata key on the target object.
311
+ * @param metadataKey A key used to store and retrieve metadata.
312
+ * @param target The target object on which the metadata is defined.
313
+ * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
314
+ * @example
315
+ *
316
+ * class Example {
317
+ * }
318
+ *
319
+ * // constructor
320
+ * result = Reflect.getOwnMetadata("custom:annotation", Example);
321
+ *
322
+ */
323
+ function getOwnMetadata(metadataKey: any, target: Object): any;
324
+ /**
325
+ * Gets the metadata value for the provided metadata key on the target object.
326
+ * @param metadataKey A key used to store and retrieve metadata.
327
+ * @param target The target object on which the metadata is defined.
328
+ * @param propertyKey The property key for the target.
329
+ * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
330
+ * @example
331
+ *
332
+ * class Example {
333
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
334
+ * // static staticProperty;
335
+ * // property;
336
+ *
337
+ * static staticMethod(p) { }
338
+ * method(p) { }
339
+ * }
340
+ *
341
+ * // property (on constructor)
342
+ * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticProperty");
343
+ *
344
+ * // property (on prototype)
345
+ * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "property");
346
+ *
347
+ * // method (on constructor)
348
+ * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticMethod");
349
+ *
350
+ * // method (on prototype)
351
+ * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method");
352
+ *
353
+ */
354
+ function getOwnMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): any;
355
+ /**
356
+ * Gets the metadata keys defined on the target object or its prototype chain.
357
+ * @param target The target object on which the metadata is defined.
358
+ * @returns An array of unique metadata keys.
359
+ * @example
360
+ *
361
+ * class Example {
362
+ * }
363
+ *
364
+ * // constructor
365
+ * result = Reflect.getMetadataKeys(Example);
366
+ *
367
+ */
368
+ function getMetadataKeys(target: Object): any[];
369
+ /**
370
+ * Gets the metadata keys defined on the target object or its prototype chain.
371
+ * @param target The target object on which the metadata is defined.
372
+ * @param propertyKey The property key for the target.
373
+ * @returns An array of unique metadata keys.
374
+ * @example
375
+ *
376
+ * class Example {
377
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
378
+ * // static staticProperty;
379
+ * // property;
380
+ *
381
+ * static staticMethod(p) { }
382
+ * method(p) { }
383
+ * }
384
+ *
385
+ * // property (on constructor)
386
+ * result = Reflect.getMetadataKeys(Example, "staticProperty");
387
+ *
388
+ * // property (on prototype)
389
+ * result = Reflect.getMetadataKeys(Example.prototype, "property");
390
+ *
391
+ * // method (on constructor)
392
+ * result = Reflect.getMetadataKeys(Example, "staticMethod");
393
+ *
394
+ * // method (on prototype)
395
+ * result = Reflect.getMetadataKeys(Example.prototype, "method");
396
+ *
397
+ */
398
+ function getMetadataKeys(target: Object, propertyKey: string | symbol): any[];
399
+ /**
400
+ * Gets the unique metadata keys defined on the target object.
401
+ * @param target The target object on which the metadata is defined.
402
+ * @returns An array of unique metadata keys.
403
+ * @example
404
+ *
405
+ * class Example {
406
+ * }
407
+ *
408
+ * // constructor
409
+ * result = Reflect.getOwnMetadataKeys(Example);
410
+ *
411
+ */
412
+ function getOwnMetadataKeys(target: Object): any[];
413
+ /**
414
+ * Gets the unique metadata keys defined on the target object.
415
+ * @param target The target object on which the metadata is defined.
416
+ * @param propertyKey The property key for the target.
417
+ * @returns An array of unique metadata keys.
418
+ * @example
419
+ *
420
+ * class Example {
421
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
422
+ * // static staticProperty;
423
+ * // property;
424
+ *
425
+ * static staticMethod(p) { }
426
+ * method(p) { }
427
+ * }
428
+ *
429
+ * // property (on constructor)
430
+ * result = Reflect.getOwnMetadataKeys(Example, "staticProperty");
431
+ *
432
+ * // property (on prototype)
433
+ * result = Reflect.getOwnMetadataKeys(Example.prototype, "property");
434
+ *
435
+ * // method (on constructor)
436
+ * result = Reflect.getOwnMetadataKeys(Example, "staticMethod");
437
+ *
438
+ * // method (on prototype)
439
+ * result = Reflect.getOwnMetadataKeys(Example.prototype, "method");
440
+ *
441
+ */
442
+ function getOwnMetadataKeys(target: Object, propertyKey: string | symbol): any[];
443
+ /**
444
+ * Deletes the metadata entry from the target object with the provided key.
445
+ * @param metadataKey A key used to store and retrieve metadata.
446
+ * @param target The target object on which the metadata is defined.
447
+ * @returns `true` if the metadata entry was found and deleted; otherwise, false.
448
+ * @example
449
+ *
450
+ * class Example {
451
+ * }
452
+ *
453
+ * // constructor
454
+ * result = Reflect.deleteMetadata("custom:annotation", Example);
455
+ *
456
+ */
457
+ function deleteMetadata(metadataKey: any, target: Object): boolean;
458
+ /**
459
+ * Deletes the metadata entry from the target object with the provided key.
460
+ * @param metadataKey A key used to store and retrieve metadata.
461
+ * @param target The target object on which the metadata is defined.
462
+ * @param propertyKey The property key for the target.
463
+ * @returns `true` if the metadata entry was found and deleted; otherwise, false.
464
+ * @example
465
+ *
466
+ * class Example {
467
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
468
+ * // static staticProperty;
469
+ * // property;
470
+ *
471
+ * static staticMethod(p) { }
472
+ * method(p) { }
473
+ * }
474
+ *
475
+ * // property (on constructor)
476
+ * result = Reflect.deleteMetadata("custom:annotation", Example, "staticProperty");
477
+ *
478
+ * // property (on prototype)
479
+ * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "property");
480
+ *
481
+ * // method (on constructor)
482
+ * result = Reflect.deleteMetadata("custom:annotation", Example, "staticMethod");
483
+ *
484
+ * // method (on prototype)
485
+ * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method");
486
+ *
487
+ */
488
+ function deleteMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean;
489
+ }
27
490
  }
28
- /**
29
- * Options for disposable resolvers.
30
- */
31
- interface DisposableResolverOptions<T> extends ResolverOptions<T> {
32
- dispose?: Disposer<T>;
33
- }
34
- /**
35
- * Disposer function type.
36
- */
37
- type Disposer<T> = (value: T) => any | Promise<any>;
38
- /**
39
- * The options when registering a class, function or value.
40
- * @type RegistrationOptions
41
- */
42
- interface ResolverOptions<T> {
43
- /**
44
- * Only used for inline configuration with `loadModules`.
45
- */
46
- name?: string;
47
- /**
48
- * Lifetime setting.
49
- */
50
- lifetime?: LifetimeType;
51
- /**
52
- * Registration function to use. Only used for inline configuration with `loadModules`.
53
- */
54
- register?: (...args: any[]) => Resolver<T>;
55
- /**
56
- * True if this resolver should be excluded from lifetime leak checking. Used by resolvers that
57
- * wish to uphold the anti-leakage contract themselves. Defaults to false.
58
- */
59
- isLeakSafe?: boolean;
60
- }
61
- /**
62
- * Builder resolver options.
63
- */
64
- interface BuildResolverOptions<T> extends ResolverOptions<T>, DisposableResolverOptions<T> {
65
- /**
66
- * Resolution mode.
67
- */
68
- injectionMode?: InjectionModeType;
69
- /**
70
- * Injector function to provide additional parameters.
71
- */
72
- injector?: InjectorFunction;
73
- }
74
- /**
75
- * A class constructor. For example:
76
- *
77
- * class MyClass {}
78
- *
79
- * container.registerClass('myClass', MyClass)
80
- * ^^^^^^^
81
- */
82
- type Constructor<T> = {
83
- new (...args: any[]): T;
84
- };
85
-
86
- /**
87
- * An object containing the module name and path (full path to module).
88
- *
89
- * @interface ModuleDescriptor
90
- */
91
- interface ModuleDescriptor {
92
- name: string;
93
- path: string;
94
- opts: any;
95
- }
96
- /**
97
- * A glob pattern with associated registration options.
98
- */
99
- type GlobWithOptions = [string] | [string, BuildResolverOptions<any> | LifetimeType];
100
-
101
- /**
102
- * Metadata of the module as well as the loaded module itself.
103
- * @interface LoadedModuleDescriptor
104
- */
105
- interface LoadedModuleDescriptor extends ModuleDescriptor {
106
- value: unknown;
107
- }
108
- /**
109
- * The options when invoking loadModules().
110
- * @interface LoadModulesOptions
111
- */
112
- interface LoadModulesOptions<ESM extends boolean = false> {
113
- cwd?: string;
114
- formatName?: NameFormatter | BuiltInNameFormatters;
115
- resolverOptions?: BuildResolverOptions<any>;
116
- esModules?: ESM;
117
- }
118
- /**
119
- * Name formatting options when using loadModules().
120
- * @type BuiltInNameFormatters
121
- */
122
- type BuiltInNameFormatters = 'camelCase';
123
- /**
124
- * Takes in the filename of the module being loaded as well as the module descriptor,
125
- * and returns a string which is used to register the module in the container.
126
- *
127
- * `descriptor.name` is the same as `name`.
128
- *
129
- * @type {NameFormatter}
130
- */
131
- type NameFormatter = (name: string, descriptor: LoadedModuleDescriptor) => string;
132
-
133
- /**
134
- * The container returned from createContainer has some methods and properties.
135
- * @interface IDependencyInjectionContainer
136
- */
137
- interface IDependencyInjectionContainer<Cradle extends object = any> {
138
- /**
139
- * Options the container was configured with.
140
- */
141
- options: ContainerOptions;
142
- /**
143
- * The proxy injected when using `PROXY` injection mode.
144
- * Can be used as-is.
145
- */
146
- readonly cradle: Cradle;
147
- /**
148
- * Getter for the rolled up registrations that merges the container family tree.
149
- */
150
- readonly registrations: RegistrationHash;
151
- /**
152
- * Resolved modules cache.
153
- */
154
- readonly cache: Map<string | symbol, CacheEntry>;
155
- /**
156
- * Creates a scoped container with this one as the parent.
157
- */
158
- createScope<T extends object = object>(): IDependencyInjectionContainer<Cradle & T>;
159
- /**
160
- * Used by `util.inspect`.
161
- */
162
- inspect(depth: number, opts?: any): string;
163
- /**
164
- * Binds `lib/loadModules` to this container, and provides
165
- * real implementations of its dependencies.
166
- *
167
- * Additionally, any modules using the `dependsOn` API
168
- * will be resolved.
169
- *
170
- * @see src/load-modules.ts documentation.
171
- */
172
- loadModules<ESM extends boolean = false>(globPatterns: Array<string | GlobWithOptions>, options?: LoadModulesOptions<ESM>): ESM extends false ? this : Promise<this>;
173
- /**
174
- * Adds a single registration that using a pre-constructed resolver.
175
- */
176
- register<T>(name: string | symbol, registration: Resolver<T>): this;
177
- /**
178
- * Pairs resolvers to registration names and registers them.
179
- */
180
- register(nameAndRegistrationPair: NameAndRegistrationPair<Cradle>): this;
181
- /**
182
- * Resolves the registration with the given name.
183
- *
184
- * @param {string} name
185
- * The name of the registration to resolve.
186
- *
187
- * @return {*}
188
- * Whatever was resolved.
189
- */
190
- resolve<K extends keyof Cradle>(name: K, resolveOptions?: ResolveOptions): Cradle[K];
191
- /**
192
- * Resolves the registration with the given name.
193
- *
194
- * @param {string} name
195
- * The name of the registration to resolve.
196
- *
197
- * @return {*}
198
- * Whatever was resolved.
199
- */
200
- resolve<T>(name: string | symbol, resolveOptions?: ResolveOptions): T;
201
- /**
202
- * Checks if the registration with the given name exists.
203
- *
204
- * @param {string | symbol} name
205
- * The name of the registration to resolve.
206
- *
207
- * @return {boolean}
208
- * Whether or not the registration exists.
209
- */
210
- hasRegistration(name: string | symbol): boolean;
211
- /**
212
- * Recursively gets a registration by name if it exists in the
213
- * current container or any of its' parents.
214
- *
215
- * @param name {string | symbol} The registration name.
216
- */
217
- getRegistration<K extends keyof Cradle>(name: K): Resolver<Cradle[K]> | null;
218
- /**
219
- * Recursively gets a registration by name if it exists in the
220
- * current container or any of its' parents.
221
- *
222
- * @param name {string | symbol} The registration name.
223
- */
224
- getRegistration<T = unknown>(name: string | symbol): Resolver<T> | null;
225
- /**
226
- * Given a resolver, class or function, builds it up and returns it.
227
- * Does not cache it, this means that any lifetime configured in case of passing
228
- * a resolver will not be used.
229
- *
230
- * @param {Resolver|Class|Function} targetOrResolver
231
- * @param {ResolverOptions} opts
232
- */
233
- build<T>(targetOrResolver: ClassOrFunctionReturning<T> | Resolver<T>, opts?: BuildResolverOptions<T>): T;
234
- /**
235
- * Disposes this container and it's children, calling the disposer
236
- * on all disposable registrations and clearing the cache.
237
- * Only applies to registrations with `SCOPED` or `SINGLETON` lifetime.
238
- */
239
- dispose(): Promise<void>;
240
- }
241
- /**
242
- * Optional resolve options.
243
- */
244
- interface ResolveOptions {
245
- /**
246
- * If `true` and `resolve` cannot find the requested dependency,
247
- * returns `undefined` rather than throwing an error.
248
- */
249
- allowUnregistered?: boolean;
250
- }
251
- /**
252
- * Cache entry.
253
- */
254
- interface CacheEntry<T = any> {
255
- /**
256
- * The resolver that resolved the value.
257
- */
258
- resolver: Resolver<T>;
259
- /**
260
- * The resolved value.
261
- */
262
- value: T;
263
- }
264
- /**
265
- * Register a Registration
266
- * @interface NameAndRegistrationPair
267
- */
268
- type NameAndRegistrationPair<T> = {
269
- [U in keyof T]?: Resolver<T[U]>;
270
- };
271
- /**
272
- * Function that returns T.
273
- */
274
- type FunctionReturning<T> = (...args: Array<any>) => T;
275
- /**
276
- * A class or function returning T.
277
- */
278
- type ClassOrFunctionReturning<T> = FunctionReturning<T> | Constructor<T>;
279
- /**
280
- * The options for the createContainer function.
281
- */
282
- interface ContainerOptions {
283
- require?: (id: string) => any;
284
- injectionMode?: InjectionModeType;
285
- strict?: boolean;
286
- }
287
- /**
288
- * Contains a hash of registrations where the name is the key.
289
- */
290
- type RegistrationHash = Record<string | symbol | number, Resolver<any>>;
291
-
292
- declare class AsyncConstructor extends Object {
293
- constructor(asyncConstructor: () => PromiseLike<void>);
294
- }
295
-
296
- type BaseObjectConstructor = typeof BaseObject;
297
- interface IBaseObjectConstructor<T = any> extends BaseObjectConstructor {
298
- new (...args: any[]): T;
299
- [prop: string]: any;
300
- }
301
-
302
- type event = (symbol|string);
303
-
304
- interface ConstructorOptions {
305
- /**
306
- * @default false
307
- * @description set this to `true` to use wildcards.
308
- */
309
- wildcard?: boolean,
310
- /**
311
- * @default '.'
312
- * @description the delimiter used to segment namespaces.
313
- */
314
- delimiter?: string,
315
- /**
316
- * @default false
317
- * @description set this to `true` if you want to emit the newListener events.
318
- */
319
- newListener?: boolean,
320
- /**
321
- * @default false
322
- * @description set this to `true` if you want to emit the removeListener events.
323
- */
324
- removeListener?: boolean,
325
- /**
326
- * @default 10
327
- * @description the maximum amount of listeners that can be assigned to an event.
328
- */
329
- maxListeners?: number
330
- /**
331
- * @default false
332
- * @description show event name in memory leak message when more than maximum amount of listeners is assigned, default false
333
- */
334
- verboseMemoryLeak?: boolean
335
- /**
336
- * @default false
337
- * @description disable throwing uncaughtException if an error event is emitted and it has no listeners
338
- */
339
- ignoreErrors?: boolean
340
- }
341
- interface ListenerFn {
342
- (...values: any[]): void;
343
- }
344
- interface EventAndListener {
345
- (event: string | string[], ...values: any[]): void;
346
- }
347
-
348
- /**
349
- * Provider base class
350
- */
351
- declare class Provider extends BaseObject {
352
- /**
353
- * Get environment variable
354
- * @param name
355
- * @protected
356
- */
357
- protected getEnv(name: string): string | undefined;
358
- /**
359
- * Get environment variable
360
- * @param name
361
- * @param defaultValue
362
- * @protected
363
- */
364
- protected getEnv(name: string, defaultValue: string): string;
365
- }
366
-
367
- /**
368
- * Component base class
369
- */
370
- declare class Component extends Provider {
371
- #private;
372
- /**
373
- * Get container
374
- * @protected
375
- */
376
- protected get container(): Container;
377
- /**
378
- * Create sub scope container
379
- * @protected
380
- */
381
- protected createScope(): Container;
382
- /**
383
- * emitter.emit(event | eventNS, [arg1], [arg2], [...])
384
- * Execute each of the listeners that may be listening for the specified event name in order with the list of arguments.
385
- * @param event
386
- * @param values
387
- */
388
- emit(event: string | symbol | event[], ...values: any[]): boolean;
389
- /**
390
- * emitter.emitRequest(event | eventNS, [arg1], [arg2], [...])
391
- * Return the results of the listeners via Promise.all.
392
- * @param event
393
- * @param values
394
- */
395
- emitRequest(event: string | symbol | event[], ...values: any[]): Promise<any[]>;
396
- /**
397
- * Adds a listener to the end of the listeners array for the specified event.
398
- * @param event
399
- * @param listener
400
- */
401
- addListener(event: string | symbol | event[], listener: ListenerFn): this;
402
- /**
403
- * Adds a listener to the end of the listeners array for the specified event.
404
- * @param event
405
- * @param listener
406
- */
407
- on(event: string | symbol | event[], listener: ListenerFn): this;
408
- /**
409
- * Adds a listener to the beginning of the listeners array for the specified event.
410
- * @param event
411
- * @param listener
412
- */
413
- prependListener(event: string | symbol | event[], listener: ListenerFn): this;
414
- /**
415
- * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed.
416
- * @param event
417
- * @param listener
418
- */
419
- once(event: string | symbol | event[], listener: ListenerFn): this;
420
- /**
421
- * Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. The listener is added to the beginning of the listeners array
422
- * @param event
423
- * @param listener
424
- */
425
- prependOnceListener(event: string | symbol | event[], listener: ListenerFn): this;
426
- /**
427
- * Adds a listener that will execute n times for the event before being removed. The listener is invoked only the first n times the event is fired, after which it is removed.
428
- * @param event
429
- * @param timesToListen
430
- * @param listener
431
- */
432
- many(event: string | symbol | event[], timesToListen: number, listener: ListenerFn): this;
433
- /**
434
- * Adds a listener that will execute n times for the event before being removed. The listener is invoked only the first n times the event is fired, after which it is removed. The listener is added to the beginning of the listeners array.
435
- * @param event
436
- * @param timesToListen
437
- * @param listener
438
- */
439
- prependMany(event: string | symbol | event[], timesToListen: number, listener: ListenerFn): this;
440
- /**
441
- * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the callback.
442
- * @param listener
443
- */
444
- onAny(listener: EventAndListener): this;
445
- /**
446
- * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the callback. The listener is added to the beginning of the listeners array
447
- * @param listener
448
- */
449
- prependAny(listener: EventAndListener): this;
450
- /**
451
- * Removes the listener that will be fired when any event is emitted.
452
- * @param listener
453
- */
454
- offAny(listener: ListenerFn): this;
455
- /**
456
- * Remove a specific listener from the listener array for the specified event.
457
- * @param event
458
- * @param listener
459
- */
460
- removeListener(event: string | symbol | event[], listener: ListenerFn): this;
461
- /**
462
- * emitter.off(event | eventNS, listener)
463
- * Remove a listener from the listener array for the specified event. Caution: Calling this method changes the array indices in the listener array behind the listener.
464
- * @param event
465
- * @param listener
466
- */
467
- off(event: string | symbol | event[], listener: ListenerFn): this;
468
- /**
469
- * emitter.removeAllListeners([event | eventNS])
470
- * Removes all listeners, or those of the specified event.
471
- * @param event
472
- */
473
- removeAllListeners(event?: string | symbol | event[] | undefined): this;
474
- /**
475
- * emitter.setMaxListeners(n)
476
- * By default EventEmitters will print a warning if more than 10 listeners are added to it. This is a useful default which helps finding memory leaks. Obviously not all Emitters should be limited to 10. This function allows that to be increased. Set to zero for unlimited.
477
- * @param n
478
- */
479
- setMaxListeners(n: number): void;
480
- /**
481
- * emitter.getMaxListeners()
482
- * Returns the current max listener value for the EventEmitter which is either set by emitter.setMaxListeners(n)
483
- */
484
- getMaxListeners(): number;
485
- /**
486
- * emitter.eventNames(nsAsArray)
487
- * Returns an array listing the events for which the emitter has registered listeners.
488
- * Listeners order not guaranteed
489
- * @param nsAsArray
490
- */
491
- eventNames(nsAsArray?: boolean | undefined): (string | symbol | event[])[];
492
- /**
493
- * Returns listener count that are listening for specific event or events
494
- * @param event
495
- */
496
- listenerCount(event?: string | symbol | event[] | undefined): number;
497
- /**
498
- * emitter.listeners(event | eventNS)
499
- * Returns an array of listeners for the specified event. This array can be manipulated, e.g. to remove listeners.
500
- * @param event
501
- */
502
- listeners(event?: string | symbol | event[] | undefined): ListenerFn[];
503
- /**
504
- * Returns an array of listeners that are listening for any event that is specified. This array can be manipulated, e.g. to remove listeners.
505
- */
506
- listenersAny(): ListenerFn[];
507
- /**
508
- * hasListeners(event | eventNS?:String)
509
- * Checks whether emitter has any listeners.
510
- * @param event
511
- */
512
- hasListeners(event?: String | undefined): boolean;
513
- /**
514
- * Reload self
515
- */
516
- reload(): Promise<void>;
517
- }
518
-
519
- declare const OBJECT_ID: unique symbol;
520
- declare class LoadObjectOptions<ClassConstructor extends typeof BaseObject = typeof BaseObject> extends DTO {
521
- [OBJECT_ID]?: string | symbol;
522
- class: ClassConstructor;
523
- }
524
-
525
- declare class LoadNamedObjectOptions extends DTO {
526
- [id: string]: LoadObjectOptions;
527
- }
528
-
529
- declare class LoadAnonymousObjectOptions<ClassConstructor extends typeof BaseObject = typeof BaseObject> extends DTO {
530
- class: ClassConstructor;
531
- }
532
-
533
- type AnonymousObject = LoadAnonymousObjectOptions | typeof BaseObject | string;
534
- declare class ModuleLoadObjectsOptions extends DTO {
535
- named?: LoadNamedObjectOptions;
536
- anonymous?: AnonymousObject[];
537
- }
538
-
539
- declare class OverridableObjectOptions<ClassConstructor extends typeof BaseObject = typeof BaseObject> extends DTO {
540
- class?: ClassConstructor;
541
- }
542
-
543
- declare class OverridableNamedObjectOptions<ClassConstructor extends IBaseObjectConstructor<BaseObject> = IBaseObjectConstructor<BaseObject>> extends DTO {
544
- [id: string]: OverridableObjectOptions<ClassConstructor>;
545
- }
546
-
547
- type BootstrapAsyncFunction<T = any, U = any> = (target: T) => Promise<U>;
548
- type BootstrapOption = string | symbol | IBaseObjectConstructor | BootstrapAsyncFunction<Module, void>;
549
- declare class ModuleOptions extends DTO {
550
- /**
551
- * Load components option
552
- */
553
- components?: OverridableNamedObjectOptions<IBaseObjectConstructor<Component>>;
554
- /**
555
- * Load providers option
556
- */
557
- providers?: OverridableNamedObjectOptions<IBaseObjectConstructor<Provider>>;
558
- /**
559
- * Load modules option
560
- */
561
- modules?: OverridableNamedObjectOptions<IBaseObjectConstructor<Module>>;
562
- /**
563
- * Load objects option
564
- */
565
- objects?: ModuleLoadObjectsOptions;
566
- /**
567
- * Bootstrap option
568
- */
569
- bootstrap?: BootstrapOption[];
570
- }
571
-
572
- /**
573
- * Object Type
574
- */
575
- declare enum ObjectType {
576
- Unknown = "Unknown",
577
- Object = "Object",
578
- Provider = "Provider",
579
- Controller = "Controller",
580
- Component = "Component",
581
- Module = "Module"
582
- }
583
-
584
- /**
585
- * Module configurations loader
586
- */
587
- declare class ModuleConfigLoader {
588
- protected readonly $module: Module;
589
- protected readonly $presetLoadOptionsSet: Set<LoadObjectOptions | typeof BaseObject | string>;
590
- protected readonly $loadOptions: (LoadObjectOptions | typeof BaseObject | string)[];
591
- protected readonly $bootstrap: BootstrapOption[];
592
- /**
593
- * Constructor
594
- * @param module
595
- * @param moduleOptions
596
- * @param presetLoadOptions
597
- */
598
- constructor(module: Module, moduleOptions: ModuleOptions, presetLoadOptions?: (LoadObjectOptions | typeof BaseObject | string)[]);
599
- /**
600
- * Validate constructor's object type
601
- * @param expectObjectType
602
- * @param target
603
- * @protected
604
- */
605
- protected validateObjectType<ClassConstructor extends IBaseObjectConstructor>(expectObjectType: ObjectType, target: ClassConstructor): ClassConstructor;
606
- /**
607
- * Process overridable named object options
608
- * @param objectType
609
- * @param options
610
- * @protected
611
- */
612
- protected processOverridableNamedObjectOptions(objectType: ObjectType, options?: OverridableNamedObjectOptions): void;
613
- /**
614
- * Load options for container.load()
615
- */
616
- get loadOptions(): (LoadObjectOptions | typeof BaseObject | string)[];
617
- /**
618
- * Load bootstrap for module
619
- */
620
- get bootstrap(): BootstrapOption[];
621
- }
622
-
623
- /**
624
- * Module base class
625
- */
626
- declare class Module extends Component {
627
- #private;
628
- /**
629
- * Config loader constructor
630
- * @protected
631
- */
632
- protected readonly ConfigLoader: typeof ModuleConfigLoader;
633
- /**
634
- * Module embed options
635
- * @protected
636
- */
637
- protected options: ModuleOptions;
638
- /**
639
- * Get container
640
- * @protected
641
- */
642
- protected get container(): Container;
643
- /**
644
- * Constructor
645
- * @param cradleProxy
646
- */
647
- constructor(cradleProxy: Record<string | symbol, any>);
648
- /**
649
- * Get current runtime env is production or development
650
- */
651
- mode(): 'development' | 'production';
652
- /**
653
- * Reload self
654
- */
655
- reload(): Promise<void>;
656
- /**
657
- * Get registered object via constructor
658
- * @param constructor
659
- * @param configurableRecords
660
- */
661
- getObject<T extends BaseObject>(constructor: IBaseObjectConstructor<T>, configurableRecords?: Record<string, any>): Promise<T>;
662
- /**
663
- * Get registered object via string
664
- * @param name
665
- * @param configurableRecords
666
- */
667
- getObject<T extends BaseObject>(name: string, configurableRecords?: Record<string, any>): Promise<T>;
668
- /**
669
- * Get registered object via symbol
670
- * @param name
671
- * @param configurableRecords
672
- */
673
- getObject<T extends BaseObject>(name: symbol, configurableRecords?: Record<string, any>): Promise<T>;
674
- /**
675
- * Get registered object via string or symbol
676
- * @param name
677
- * @param configurableRecords
678
- * @protected
679
- */
680
- getObject<T extends BaseObject>(name: string | symbol, configurableRecords?: Record<string, any>): Promise<T>;
681
- /**
682
- * Get registered object via string or symbol or constructor
683
- * @param nameOrConstructor
684
- * @param configurableRecords
685
- * @protected
686
- */
687
- getObject<T extends BaseObject>(nameOrConstructor: string | symbol | IBaseObjectConstructor<T>, configurableRecords?: Record<string, any>): Promise<T>;
688
- }
689
-
690
- /**
691
- * Lakutata object base class
692
- */
693
- declare class BaseObject extends AsyncConstructor {
694
- #private;
695
- /**
696
- * Constructor
697
- * @param cradleProxy
698
- */
699
- constructor(cradleProxy: Record<string | symbol, any>);
700
- /**
701
- * Return class's name
702
- */
703
- static get className(): string;
704
- /**
705
- * Get instance's class name
706
- */
707
- get className(): string;
708
- /**
709
- * Initializer
710
- * @protected
711
- */
712
- protected init(): Promise<void>;
713
- /**
714
- * Destroyer
715
- * @protected
716
- */
717
- protected destroy(): Promise<void>;
718
- /**
719
- * Get registered object via constructor
720
- * @param constructor
721
- * @param configurableRecords
722
- */
723
- protected getObject<T extends BaseObject>(constructor: IBaseObjectConstructor<T>, configurableRecords?: Record<string, any>): Promise<T>;
724
- /**
725
- * Get registered object via string
726
- * @param name
727
- * @param configurableRecords
728
- */
729
- protected getObject<T extends BaseObject>(name: string, configurableRecords?: Record<string, any>): Promise<T>;
730
- /**
731
- * Get registered object via symbol
732
- * @param name
733
- * @param configurableRecords
734
- */
735
- protected getObject<T extends BaseObject>(name: symbol, configurableRecords?: Record<string, any>): Promise<T>;
736
- /**
737
- * Get registered object via string or symbol
738
- * @param name
739
- * @param configurableRecords
740
- * @protected
741
- */
742
- protected getObject<T extends BaseObject>(name: string | symbol, configurableRecords?: Record<string, any>): Promise<T>;
743
- /**
744
- * Get registered object via string or symbol or constructor
745
- * @param nameOrConstructor
746
- * @param configurableRecords
747
- * @protected
748
- */
749
- protected getObject<T extends BaseObject>(nameOrConstructor: string | symbol | IBaseObjectConstructor<T>, configurableRecords?: Record<string, any>): Promise<T>;
750
- /**
751
- * Instantiate an instance of a base object class by injecting dependencies, but without registering it in the container
752
- * @param constructor
753
- * @param configurableRecords
754
- * @protected
755
- */
756
- protected buildObject<T extends BaseObject>(constructor: IBaseObjectConstructor<T>, configurableRecords?: Record<string, any>): Promise<T>;
757
- /**
758
- * Get current object's parent
759
- * @protected
760
- */
761
- protected getParent(): BaseObject | undefined;
762
- /**
763
- * Get current object's parent module
764
- * @protected
765
- */
766
- protected getModule(): Module;
767
- /**
768
- * Unique object uuid
769
- */
770
- get $uuid(): string;
771
- /**
772
- * Object instance id which defined in runtime
773
- */
774
- get $id(): string | symbol;
775
- /**
776
- * Object instance symbol
777
- */
778
- get $symbol(): symbol;
779
- /**
780
- * Set object property
781
- * @param propertyKey
782
- * @param value
783
- */
784
- setProperty(propertyKey: string, value: any): void;
785
- /**
786
- * Get object's property value
787
- * @param propertyKey
788
- * @param defaultValue
789
- */
790
- getProperty<T = any>(propertyKey: string, defaultValue?: T): T;
791
- /**
792
- * Is object has property
793
- * @param propertyKey
794
- */
795
- hasProperty(propertyKey: string | symbol): boolean;
796
- /**
797
- * Get own property symbols
798
- */
799
- propertySymbols(): symbol[];
800
- /**
801
- * Get own property names
802
- */
803
- propertyNames(): string[];
804
- /**
805
- * Is object has method
806
- * @param name
807
- */
808
- hasMethod(name: string | symbol): boolean;
809
- /**
810
- * Get method from object
811
- * @param name
812
- * @param throwExceptionIfNotFound
813
- */
814
- getMethod(name: string | symbol, throwExceptionIfNotFound?: boolean): (...args: any[]) => any | Promise<any>;
815
- }
816
-
817
- declare class Container {
818
- #private;
819
- readonly parent?: Container;
820
- constructor(parent?: Container, owner?: BaseObject);
821
- /**
822
- * Destroy objects inside container
823
- * @param instance
824
- * @protected
825
- */
826
- protected disposer<T extends BaseObject>(instance: T): Promise<void>;
827
- /**
828
- * Get build resolver options by class constructor
829
- * @param target
830
- * @protected
831
- */
832
- protected buildResolverOptions<T extends BaseObject>(target: IBaseObjectConstructor<T>): BuildResolverOptions<T>;
833
- /**
834
- * Process resolved
835
- * @param resolved
836
- * @param registrationName
837
- * @param configurableRecords
838
- * @protected
839
- */
840
- protected processResolved<T extends BaseObject>(resolved: T | Promise<T>, registrationName: string | symbol, configurableRecords?: Record<string, any>): Promise<T>;
841
- /**
842
- * Build name and registration pair from container load options
843
- * @param options
844
- * @protected
845
- */
846
- protected buildNameAndRegistrationPairFromOptions<T extends BaseObject>(options: LoadObjectOptions): NameAndRegistrationPair<T>;
847
- /**
848
- * Build name and registration pair from glob
849
- * @param glob
850
- * @protected
851
- */
852
- protected buildNameAndRegistrationPairFromGlob<T extends typeof BaseObject>(glob: string): Promise<NameAndRegistrationPair<T>>;
853
- /**
854
- * Get current container owner
855
- */
856
- owner<Owner extends BaseObject = BaseObject>(): Owner | undefined;
857
- protected injectionNames: Set<string | symbol>;
858
- /**
859
- * Load objects
860
- * @param options
861
- */
862
- load<T extends typeof BaseObject>(options: (LoadObjectOptions | typeof BaseObject | string)[]): Promise<void>;
863
- /**
864
- * Get registered object via constructor
865
- * @param constructor
866
- * @param configurableRecords
867
- */
868
- get<T extends BaseObject>(constructor: IBaseObjectConstructor<T>, configurableRecords?: Record<string, any>): Promise<T>;
869
- /**
870
- * Get registered object via string
871
- * @param name
872
- * @param configurableRecords
873
- */
874
- get<T extends BaseObject>(name: string, configurableRecords?: Record<string, any>): Promise<T>;
875
- /**
876
- * Get registered object via symbol
877
- * @param name
878
- * @param configurableRecords
879
- */
880
- get<T extends BaseObject>(name: symbol, configurableRecords?: Record<string, any>): Promise<T>;
881
- /**
882
- * Get registered object via string or symbol
883
- * @param name
884
- * @param configurableRecords
885
- */
886
- get<T extends BaseObject>(name: string | symbol, configurableRecords?: Record<string, any>): Promise<T>;
887
- /**
888
- * Get registered object via string or symbol or constructor
889
- * @param nameOrConstructor
890
- * @param configurableRecords
891
- */
892
- get<T extends BaseObject>(nameOrConstructor: string | symbol | IBaseObjectConstructor<T>, configurableRecords?: Record<string, any>): Promise<T>;
893
- /**
894
- * Is object registered in container (By symbol)
895
- * @param symbol
896
- */
897
- has(symbol: symbol): boolean;
898
- /**
899
- * Is object registered in container (By name)
900
- * @param name
901
- */
902
- has(name: string): boolean;
903
- /**
904
- * Is object registered in container (By name or symbol)
905
- * @param nameOrSymbol
906
- */
907
- has(nameOrSymbol: string | symbol): boolean;
908
- /**
909
- * Is object registered in container (By constructor)
910
- * @param constructor
911
- */
912
- has<ClassConstructor extends typeof BaseObject>(constructor: ClassConstructor): boolean;
913
- /**
914
- * Builds an instance of a base object class by injecting dependencies, and registering it in the container
915
- * @param target
916
- * @param configurableRecords
917
- */
918
- set<T extends BaseObject>(target: IBaseObjectConstructor<T>, configurableRecords?: Record<string, any>): Promise<T>;
919
- /**
920
- * Register base object class in the container
921
- * @param target
922
- * @param configurableRecords
923
- */
924
- register<T extends BaseObject>(target: IBaseObjectConstructor<T>, configurableRecords?: Record<string, any>): Promise<void>;
925
- /**
926
- * Builds an instance of a base object class by injecting dependencies, but without registering it in the container
927
- * @param target
928
- * @param configurableRecords
929
- */
930
- build<T extends BaseObject>(target: IBaseObjectConstructor<T>, configurableRecords?: Record<string, any>): Promise<T>;
931
- /**
932
- * Create sub container scope
933
- */
934
- createScope(): Container;
935
- /**
936
- * Register current container to its parent subContainerSet
937
- */
938
- registerContainerToItsParent(): void;
939
- /**
940
- * Clear current container but not destroy it
941
- */
942
- clear(): Promise<void>;
943
- /**
944
- * Destroy current container
945
- */
946
- destroy(): Promise<void>;
947
- }
948
-
949
- export { BaseObject as B, Component as C, type EventAndListener as E, type IBaseObjectConstructor as I, type LifetimeType as L, Module as M, OverridableNamedObjectOptions as O, Provider as P, ModuleOptions as a, ModuleConfigLoader as b, LoadObjectOptions as c, type ListenerFn as d, type event as e, type ConstructorOptions as f, Container as g, LoadAnonymousObjectOptions as h, LoadNamedObjectOptions as i, ModuleLoadObjectsOptions as j, OverridableObjectOptions as k };