@tsed/di 7.79.4 → 7.80.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/lib/types-esm/common/constants/constants.d.ts +3 -0
  2. package/lib/types-esm/common/decorators/configuration.d.ts +8 -0
  3. package/lib/types-esm/common/decorators/constant.d.ts +36 -0
  4. package/lib/types-esm/common/decorators/controller.d.ts +42 -0
  5. package/lib/types-esm/common/decorators/inject.d.ts +22 -0
  6. package/lib/types-esm/common/decorators/injectable.d.ts +20 -0
  7. package/lib/types-esm/common/decorators/intercept.d.ts +10 -0
  8. package/lib/types-esm/common/decorators/interceptor.d.ts +10 -0
  9. package/lib/types-esm/common/decorators/lazyInject.d.ts +43 -0
  10. package/lib/types-esm/common/decorators/module.d.ts +37 -0
  11. package/lib/types-esm/common/decorators/opts.d.ts +41 -0
  12. package/lib/types-esm/common/decorators/overrideProvider.d.ts +8 -0
  13. package/lib/types-esm/common/decorators/scope.d.ts +8 -0
  14. package/lib/types-esm/common/decorators/service.d.ts +10 -0
  15. package/lib/types-esm/common/decorators/useOpts.d.ts +42 -0
  16. package/lib/types-esm/common/decorators/value.d.ts +36 -0
  17. package/lib/types-esm/common/domain/Container.d.ts +43 -0
  18. package/lib/types-esm/common/domain/ControllerProvider.d.ts +17 -0
  19. package/lib/types-esm/common/domain/InjectablePropertyType.d.ts +7 -0
  20. package/lib/types-esm/common/domain/LocalsContainer.d.ts +6 -0
  21. package/lib/types-esm/common/domain/Provider.d.ts +71 -0
  22. package/lib/types-esm/common/domain/ProviderScope.d.ts +5 -0
  23. package/lib/types-esm/common/domain/ProviderType.d.ts +10 -0
  24. package/lib/types-esm/common/errors/InjectionError.d.ts +8 -0
  25. package/lib/types-esm/common/errors/InvalidPropertyTokenError.d.ts +4 -0
  26. package/lib/types-esm/common/errors/UndefinedTokenError.d.ts +4 -0
  27. package/lib/types-esm/common/index.d.ts +55 -0
  28. package/lib/types-esm/common/interfaces/DIConfigurationOptions.d.ts +29 -0
  29. package/lib/types-esm/common/interfaces/DILogger.d.ts +8 -0
  30. package/lib/types-esm/common/interfaces/DILoggerOptions.d.ts +53 -0
  31. package/lib/types-esm/common/interfaces/DIResolver.d.ts +5 -0
  32. package/lib/types-esm/common/interfaces/ImportTokenProviderOpts.d.ts +19 -0
  33. package/lib/types-esm/common/interfaces/InjectableProperties.d.ts +25 -0
  34. package/lib/types-esm/common/interfaces/InterceptorContext.d.ts +11 -0
  35. package/lib/types-esm/common/interfaces/InterceptorMethods.d.ts +4 -0
  36. package/lib/types-esm/common/interfaces/InvokeOptions.d.ts +10 -0
  37. package/lib/types-esm/common/interfaces/OnDestroy.d.ts +3 -0
  38. package/lib/types-esm/common/interfaces/OnInit.d.ts +3 -0
  39. package/lib/types-esm/common/interfaces/ProviderOpts.d.ts +59 -0
  40. package/lib/types-esm/common/interfaces/RegistrySettings.d.ts +20 -0
  41. package/lib/types-esm/common/interfaces/ResolvedInvokeOptions.d.ts +12 -0
  42. package/lib/types-esm/common/interfaces/TokenProvider.d.ts +6 -0
  43. package/lib/types-esm/common/interfaces/TokenRoute.d.ts +5 -0
  44. package/lib/types-esm/common/registries/GlobalProviders.d.ts +58 -0
  45. package/lib/types-esm/common/registries/ProviderRegistry.d.ts +58 -0
  46. package/lib/types-esm/common/services/DIConfiguration.d.ts +57 -0
  47. package/lib/types-esm/common/services/DILogger.d.ts +3 -0
  48. package/lib/types-esm/common/services/InjectorService.d.ts +224 -0
  49. package/lib/types-esm/common/utils/colors.d.ts +5 -0
  50. package/lib/types-esm/common/utils/createContainer.d.ts +3 -0
  51. package/lib/types-esm/common/utils/getConfiguration.d.ts +3 -0
  52. package/lib/types-esm/common/utils/getConstructorDependencies.d.ts +2 -0
  53. package/lib/types-esm/common/utils/resolveControllers.d.ts +12 -0
  54. package/lib/types-esm/index.d.ts +2 -0
  55. package/lib/types-esm/node/decorators/injectContext.d.ts +15 -0
  56. package/lib/types-esm/node/domain/ContextLogger.d.ts +37 -0
  57. package/lib/types-esm/node/domain/DIContext.d.ts +61 -0
  58. package/lib/types-esm/node/index.d.ts +14 -0
  59. package/lib/types-esm/node/interfaces/AlterRunInContext.d.ts +3 -0
  60. package/lib/types-esm/node/services/DILogger.d.ts +1 -0
  61. package/lib/types-esm/node/services/DITest.d.ts +37 -0
  62. package/lib/types-esm/node/utils/asyncHookContext.d.ts +14 -0
  63. package/lib/types-esm/node/utils/attachLogger.d.ts +2 -0
  64. package/lib/types-esm/node/utils/setLoggerConfiguration.d.ts +2 -0
  65. package/lib/types-esm/node/utils/setLoggerFormat.d.ts +6 -0
  66. package/lib/types-esm/node/utils/setLoggerLevel.d.ts +6 -0
  67. package/package.json +19 -16
  68. package/vitest.config.mts +21 -0
  69. package/jest.config.js +0 -14
  70. package/lib/cjs/package.json +0 -3
  71. package/lib/esm/package.json +0 -3
  72. package/tsconfig.esm.json +0 -39
@@ -0,0 +1,3 @@
1
+ export declare const INJECTABLE_PROP = "DI:INJECTABLE_PROP";
2
+ export declare const DI_PARAMS = "DI:PARAMS";
3
+ export declare const DI_PARAM_OPTIONS = "DI:PARAM:OPTIONS";
@@ -0,0 +1,8 @@
1
+ import { DIConfiguration } from "../services/DIConfiguration.js";
2
+ /**
3
+ * Get or set Configuration on a class.
4
+ *
5
+ * @decorator
6
+ */
7
+ export declare function Configuration(configuration?: Partial<TsED.Configuration>): Function;
8
+ export type Configuration = TsED.Configuration & DIConfiguration;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Return value from Configuration.
3
+ *
4
+ * ## Example
5
+ *
6
+ * ```typescript
7
+ * import {Env} from "@tsed/core";
8
+ * import {Constant, Value} from "@tsed/di";
9
+ *
10
+ * export class MyClass {
11
+ *
12
+ * @Constant("env")
13
+ * env: Env;
14
+ *
15
+ * @Value("swagger.path")
16
+ * swaggerPath: string;
17
+ *
18
+ * @Value("swagger.path", "defaultValue")
19
+ * swaggerPath: string;
20
+ *
21
+ * constructor() {
22
+ * console.log(this.swaggerPath) // undefined. Not available on constructor
23
+ * }
24
+ *
25
+ * $onInit() {
26
+ * console.log(this.swaggerPath) // something
27
+ * }
28
+ * }
29
+ * ```
30
+ *
31
+ * @param {string} expression
32
+ * @param defaultValue
33
+ * @returns {(targetClass: any, attributeName: string) => any}
34
+ * @decorator
35
+ */
36
+ export declare function Constant(expression: string, defaultValue?: any): any;
@@ -0,0 +1,42 @@
1
+ import { Type } from "@tsed/core";
2
+ import { ProviderOpts } from "../interfaces/ProviderOpts.js";
3
+ export type PathType = string | RegExp | (string | RegExp)[];
4
+ export interface ControllerMiddlewares {
5
+ useBefore: any[];
6
+ use: any[];
7
+ useAfter: any[];
8
+ }
9
+ export interface ControllerOptions extends Partial<ProviderOpts<any>> {
10
+ path?: PathType;
11
+ children?: Type<any>[];
12
+ middlewares?: Partial<ControllerMiddlewares>;
13
+ }
14
+ /**
15
+ * Declare a new controller with his Rest path. His methods annotated will be collected to build the routing list.
16
+ * This routing listing will be built with the `express.Router` object.
17
+ *
18
+ * ::: tip
19
+ * See [Controllers](/docs/controllers.md) section for more details
20
+ * :::
21
+ *
22
+ * ```typescript
23
+ * @Controller("/calendars")
24
+ * export provide CalendarCtrl {
25
+ *
26
+ * @Get("/:id")
27
+ * public get(
28
+ * @Req() request: Req,
29
+ * @Res() response: Res,
30
+ * @Next() next: Next
31
+ * ): void {
32
+ *
33
+ * }
34
+ * }
35
+ * ```
36
+ *
37
+ * @param options
38
+ * @controller
39
+ * @decorator
40
+ * @classDecorator
41
+ */
42
+ export declare function Controller(options: PathType | ControllerOptions): ClassDecorator;
@@ -0,0 +1,22 @@
1
+ import type { InjectablePropertyOptions } from "../interfaces/InjectableProperties.js";
2
+ import { TokenProvider } from "../interfaces/TokenProvider.js";
3
+ export declare function injectProperty(target: any, propertyKey: string, options: Partial<InjectablePropertyOptions>): void;
4
+ /**
5
+ * Inject a provider to another provider.
6
+ *
7
+ * Use this decorator to inject a custom provider on constructor parameter or property.
8
+ *
9
+ * ```typescript
10
+ * @Injectable()
11
+ * export class MyService {
12
+ * @Inject(CONNECTION)
13
+ * connection: CONNECTION;
14
+ * }
15
+ * ```
16
+ *
17
+ * @param token A token provider or token provider group
18
+ * @param onGet Use the given name method to inject
19
+ * @returns {Function}
20
+ * @decorator
21
+ */
22
+ export declare function Inject(token?: TokenProvider | (() => TokenProvider), onGet?: (bean: any) => any): Function;
@@ -0,0 +1,20 @@
1
+ import type { ProviderOpts } from "../interfaces/ProviderOpts.js";
2
+ /**
3
+ * The decorators `@Injectable()` declare a new service can be injected in other service, controller, interceptor, etc.. on there `constructor`.
4
+ * All classes annotated with `@Injectable()` are built one time, excepted if you change the default provider configuration.
5
+ *
6
+ * ::: tip
7
+ * `@Injectable()` use the `reflect-metadata` to collect and inject the built provided to other services.
8
+ * :::
9
+ *
10
+ * ### Options
11
+ *
12
+ * - type (@@ProviderType@@ or `string`): Kind of provider. (Default: `ProviderType.PROVIDER`)
13
+ * - scope (@@ProviderScope@@): Kind of provider. (Default: `ProviderScope.SINGLETON`)
14
+ * - provide (@@TokenProvider@@): An injection token (Note: This option override default metadata generated by Typescript).
15
+ * - deps (`Type<any>`): List of class or provider which will be injected to the constructor (Note: This options override default metadata generated by Typescript).
16
+ *
17
+ * @returns {Function}
18
+ * @decorator
19
+ */
20
+ export declare function Injectable(options?: Partial<ProviderOpts>): ClassDecorator;
@@ -0,0 +1,10 @@
1
+ import { Type } from "@tsed/core";
2
+ import type { InterceptorMethods } from "../interfaces/InterceptorMethods.js";
3
+ /**
4
+ * Attaches interceptor to method call and executes the before and after methods
5
+ *
6
+ * @param interceptor
7
+ * @param options
8
+ * @decorator
9
+ */
10
+ export declare function Intercept<T extends InterceptorMethods>(interceptor: Type<T>, options?: any): any;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The decorators `@Service()` declare a new service can be injected in other service or controller on there `constructor`.
3
+ * All services annotated with `@Service()` are constructed one time.
4
+ *
5
+ * > `@Service()` use the `reflect-metadata` to collect and inject service on controllers or other services.
6
+ *
7
+ * @returns {Function}
8
+ * @decorator
9
+ */
10
+ export declare function Interceptor(): Function;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Lazy load a provider from his package and invoke only when the provider is used
3
+ *
4
+ * ```typescript
5
+ * import type {PlatformException} from "@tsed/platform-exceptions";
6
+ *
7
+ * @Injectable()
8
+ * export class MyService {
9
+ * @LazyInject("PlatformException", () => import("@tsed/platform-exceptions"))
10
+ * exceptions: Promise<PlatformException>;
11
+ * }
12
+ * ```
13
+ *
14
+ * @param key
15
+ * @param packageName
16
+ * @param resolver
17
+ * @param optional
18
+ * @returns {Function}
19
+ * @decorator
20
+ */
21
+ export declare function LazyInject(key: string, resolver: () => any, { optional, packageName }?: {
22
+ optional?: boolean;
23
+ packageName?: string;
24
+ }): PropertyDecorator;
25
+ /**
26
+ * Optionally Lazy load a provider from his package and invoke only when the provider is used
27
+ *
28
+ * ```typescript
29
+ * import type {PlatformException} from "@tsed/platform-exceptions";
30
+ *
31
+ * @Injectable()
32
+ * export class MyService {
33
+ * @OptionalLazyInject("@tsed/platform-exceptions")
34
+ * exceptions: Promise<PlatformException>;
35
+ * }
36
+ * ```
37
+ *
38
+ * @param key
39
+ * @param resolver
40
+ * @returns {Function}
41
+ * @decorator
42
+ */
43
+ export declare function OptionalLazyInject(key: string, resolver: () => any): PropertyDecorator;
@@ -0,0 +1,37 @@
1
+ import { ProviderScope } from "../domain/ProviderScope.js";
2
+ import { TokenProvider } from "../interfaces/TokenProvider.js";
3
+ import { DIResolver } from "../interfaces/DIResolver.js";
4
+ export interface ModuleOptions extends Omit<TsED.Configuration, "scopes"> {
5
+ /**
6
+ * Provider scope
7
+ */
8
+ scope?: ProviderScope;
9
+ /**
10
+ * Providers must be initialized before building this module
11
+ */
12
+ imports?: TokenProvider[];
13
+ /**
14
+ * Explicit token must be injected in the constructor
15
+ */
16
+ deps?: TokenProvider[];
17
+ /**
18
+ * A list of resolvers to inject provider from external DI.
19
+ */
20
+ resolvers?: DIResolver[];
21
+ /**
22
+ * Additional properties are stored as provider configuration.
23
+ */
24
+ [key: string]: any;
25
+ }
26
+ /**
27
+ * Declare a new Ts.ED module
28
+ *
29
+ * ## Options
30
+ * - imports: List of Provider which must be built by injector before invoking the module
31
+ * - resolvers: List of external DI must be used to resolve unknown provider
32
+ * - deps: List of provider must be injected to the module constructor (explicit declaration)
33
+ *
34
+ * @param options
35
+ * @decorator
36
+ */
37
+ export declare function Module(options?: Partial<ModuleOptions>): any;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Get instance options. This options depending on his invocation context.
3
+ *
4
+ * ```typescript
5
+ * import {Injectable, Opts, UseOpts} from "@tsed/di";
6
+ *
7
+ * @Injectable()
8
+ * class MyConfigurableService {
9
+ * source: string;
10
+ * constructor(@Opts options: any = {}) {
11
+ * console.log("Hello ", options.source); // log: Hello Service1 then Hello Service2
12
+ *
13
+ * this.source = options.source;
14
+ * }
15
+ * }
16
+ *
17
+ * @Injectable()
18
+ * class MyService1 {
19
+ * constructor(@UseOpts({source: 'Service1'}) service: MyConfigurableService) {
20
+ * console.log(service.source) // log: Service1
21
+ * }
22
+ * }
23
+ *
24
+ * @Injectable()
25
+ * class MyService2 {
26
+ * constructor(@UseOpts({source: 'Service2'}) service: MyConfigurableService) {
27
+ * console.log(service.source) // log: Service2
28
+ * }
29
+ * }
30
+ * ```
31
+ *
32
+ * ::: warning
33
+ * Using @@Opts@@ decorator on a constructor parameter change the Scope of the provider to `ProviderScope.INSTANCE`.
34
+ * :::
35
+ *
36
+ * @param target
37
+ * @param propertyKey
38
+ * @param index
39
+ * @decorator
40
+ */
41
+ export declare function Opts(target: any, propertyKey: string | symbol | undefined, index: number): void;
@@ -0,0 +1,8 @@
1
+ import { Type } from "@tsed/core";
2
+ /**
3
+ * Override a provider which is already registered in ProviderRegistry.
4
+ * @returns {Function}
5
+ * @decorators
6
+ * @param originalProvider
7
+ */
8
+ export declare function OverrideProvider(originalProvider: Type<any>): Function;
@@ -0,0 +1,8 @@
1
+ import { ProviderScope } from "../domain/ProviderScope.js";
2
+ /**
3
+ *
4
+ * @param {"request" | "singleton" | ProviderScope} scope
5
+ * @returns {Function}
6
+ * @constructor
7
+ */
8
+ export declare function Scope(scope?: "request" | "singleton" | ProviderScope): Function;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The decorators `@Service()` declare a new service can be injected in other service or controller on there `constructor`.
3
+ * All services annotated with `@Service()` are constructed one time.
4
+ *
5
+ * > `@Service()` use the `reflect-metadata` to collect and inject service on controllers or other services.
6
+ *
7
+ * @returns {Function}
8
+ * @decorator
9
+ */
10
+ export declare function Service(): Function;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Add options to invoke the Service.
3
+ *
4
+ * ```typescript
5
+ * import {Injectable, Opts, UseOpts} from "@tsed/di";
6
+ *
7
+ * @Injectable()
8
+ * class MyConfigurableService {
9
+ * source: string;
10
+ * constructor(@Opts options: any = {}) {
11
+ * console.log("Hello ", options.source); // log: Hello Service1 then Hello Service2
12
+ *
13
+ * this.source = options.source;
14
+ * }
15
+ * }
16
+ *
17
+ * @Injectable()
18
+ * class MyService1 {
19
+ * constructor(@UseOpts({source: 'Service1'}) service: MyConfigurableService) {
20
+ * console.log(service.source) // log: Service1
21
+ * }
22
+ * }
23
+ *
24
+ * @Injectable()
25
+ * class MyService2 {
26
+ * constructor(@UseOpts({source: 'Service2'}) service: MyConfigurableService) {
27
+ * console.log(service.source) // log: Service2
28
+ * }
29
+ * }
30
+ * ```
31
+ *
32
+ * ::: warning
33
+ * Using @@Opts@@ decorator on a constructor parameter change the Scope of the provider to `ProviderScope.INSTANCE`.
34
+ * :::
35
+ *
36
+ * @returns {Function}
37
+ * @decorator
38
+ * @param options
39
+ */
40
+ export declare function UseOpts(options: {
41
+ [key: string]: any;
42
+ }): Function;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Return value from Configuration.
3
+ *
4
+ * ## Example
5
+ *
6
+ * ```typescript
7
+ * import {Env} from "@tsed/core";
8
+ * import {Constant, Value} from "@tsed/di";
9
+ *
10
+ * export class MyClass {
11
+ *
12
+ * @Constant("env")
13
+ * env: Env;
14
+ *
15
+ * @Value("swagger.path")
16
+ * swaggerPath: string;
17
+ *
18
+ * @Value("swagger.path", "defaultValue")
19
+ * swaggerPath: string;
20
+ *
21
+ * constructor() {
22
+ * console.log(this.swaggerPath) // undefined. Not available on constructor
23
+ * }
24
+ *
25
+ * $onInit() {
26
+ * console.log(this.swaggerPath) // something
27
+ * }
28
+ * }
29
+ * ```
30
+ *
31
+ * @param expression
32
+ * @param defaultValue
33
+ * @returns {(targetClass: any, attributeName: string) => any}
34
+ * @decorator
35
+ */
36
+ export declare function Value(expression: any, defaultValue?: any): (target: any, propertyKey: string) => void;
@@ -0,0 +1,43 @@
1
+ import type { ProviderOpts } from "../interfaces/ProviderOpts.js";
2
+ import type { ProviderType } from "./ProviderType.js";
3
+ import type { TokenProvider } from "../interfaces/TokenProvider.js";
4
+ import { Provider } from "./Provider.js";
5
+ export declare class Container extends Map<TokenProvider, Provider> {
6
+ /**
7
+ *
8
+ * @param token
9
+ * @param settings
10
+ */
11
+ add(token: TokenProvider, settings?: Partial<ProviderOpts>): this;
12
+ /**
13
+ * Add a provider to the
14
+ * @param token
15
+ * @param settings
16
+ */
17
+ addProvider(token: TokenProvider, settings?: Partial<ProviderOpts>): this;
18
+ /**
19
+ *
20
+ * @param token
21
+ */
22
+ hasProvider(token: TokenProvider): boolean;
23
+ /**
24
+ * Add a provider to the
25
+ * @param token
26
+ * @param provider
27
+ */
28
+ setProvider(token: TokenProvider, provider: Provider): this;
29
+ /**
30
+ * The getProvider() method returns a specified element from a Map object.
31
+ * @returns {T} Returns the element associated with the specified key or undefined if the key can't be found in the Map object.
32
+ * @param token
33
+ */
34
+ getProvider<T extends Provider = Provider>(token: TokenProvider): T | undefined;
35
+ /**
36
+ * Get all providers registered in the injector container.
37
+ *
38
+ * @param {ProviderType} type Filter the list by the given ProviderType.
39
+ * @returns {[TokenProvider , Provider<any>][]}
40
+ */
41
+ getProviders(type?: ProviderType | string | string[]): Provider[];
42
+ addProviders(container: Map<TokenProvider, Provider>): void;
43
+ }
@@ -0,0 +1,17 @@
1
+ import { ControllerMiddlewares } from "../decorators/controller.js";
2
+ import { TokenProvider } from "../interfaces/TokenProvider.js";
3
+ import { Provider } from "./Provider.js";
4
+ export declare class ControllerProvider<T = any> extends Provider<T> {
5
+ tokenRouter: string;
6
+ constructor(provide: TokenProvider, options?: Partial<Provider>);
7
+ /**
8
+ *
9
+ * @returns {any[]}
10
+ */
11
+ get middlewares(): ControllerMiddlewares;
12
+ /**
13
+ *
14
+ * @param middlewares
15
+ */
16
+ set middlewares(middlewares: ControllerMiddlewares);
17
+ }
@@ -0,0 +1,7 @@
1
+ export declare enum InjectablePropertyType {
2
+ METHOD = "method",
3
+ PROPERTY = "property",
4
+ CONSTANT = "constant",
5
+ VALUE = "value",
6
+ INTERCEPTOR = "interceptor"
7
+ }
@@ -0,0 +1,6 @@
1
+ import { Hooks } from "@tsed/core";
2
+ import type { TokenProvider } from "../interfaces/TokenProvider.js";
3
+ export declare class LocalsContainer extends Map<TokenProvider, any> {
4
+ readonly hooks: Hooks;
5
+ destroy(): Promise<void>;
6
+ }
@@ -0,0 +1,71 @@
1
+ import { Store, Type } from "@tsed/core";
2
+ import type { ProviderOpts } from "../interfaces/ProviderOpts.js";
3
+ import type { TokenProvider } from "../interfaces/TokenProvider.js";
4
+ import { ProviderScope } from "./ProviderScope.js";
5
+ import { ProviderType } from "./ProviderType.js";
6
+ export type ProviderHookCallback<T = any> = (instance: T, ...args: unknown[]) => Promise<void> | void;
7
+ export declare class Provider<T = any> implements ProviderOpts<T> {
8
+ /**
9
+ * Token group provider to retrieve all provider from the same type
10
+ */
11
+ type: TokenProvider | ProviderType;
12
+ deps: TokenProvider[];
13
+ imports: (TokenProvider | [TokenProvider])[];
14
+ alias?: string;
15
+ useFactory?: Function;
16
+ useAsyncFactory?: Function;
17
+ useValue?: unknown;
18
+ hooks?: Record<string, ProviderHookCallback<T>>;
19
+ private _useClass;
20
+ private _provide;
21
+ private _store;
22
+ private _tokenStore;
23
+ [key: string]: any;
24
+ constructor(token: TokenProvider, options?: Partial<Provider>);
25
+ get token(): any;
26
+ get provide(): TokenProvider;
27
+ set provide(value: TokenProvider);
28
+ get useClass(): Type<T>;
29
+ /**
30
+ * Create a new store if the given value is a class. Otherwise the value is ignored.
31
+ * @param value
32
+ */
33
+ set useClass(value: Type<T>);
34
+ get className(): string;
35
+ get name(): string;
36
+ get store(): Store;
37
+ get path(): string;
38
+ set path(path: string);
39
+ /**
40
+ * Get the scope of the provider.
41
+ *
42
+ * ::: tip Note
43
+ * Async provider is always a SINGLETON
44
+ * :::
45
+ *
46
+ * @returns {boolean}
47
+ */
48
+ get scope(): ProviderScope;
49
+ /**
50
+ * Change the scope value of the provider.
51
+ * @param scope
52
+ */
53
+ set scope(scope: ProviderScope);
54
+ get configuration(): Partial<TsED.Configuration>;
55
+ set configuration(configuration: Partial<TsED.Configuration>);
56
+ get children(): TokenProvider[];
57
+ get(key: string): any;
58
+ isAsync(): boolean;
59
+ clone(): Provider;
60
+ /**
61
+ *
62
+ * @returns {boolean}
63
+ */
64
+ hasChildren(): boolean;
65
+ /**
66
+ *
67
+ * @returns {boolean}
68
+ */
69
+ hasParent(): boolean;
70
+ toString(): string;
71
+ }
@@ -0,0 +1,5 @@
1
+ export declare enum ProviderScope {
2
+ SINGLETON = "singleton",
3
+ REQUEST = "request",
4
+ INSTANCE = "instance"
5
+ }
@@ -0,0 +1,10 @@
1
+ export declare enum ProviderType {
2
+ VALUE = "value",
3
+ FACTORY = "factory",
4
+ SERVICE = "service",
5
+ PROVIDER = "provider",
6
+ MODULE = "module",
7
+ CONTROLLER = "controller",
8
+ INTERCEPTOR = "interceptor",
9
+ MIDDLEWARE = "middleware"
10
+ }
@@ -0,0 +1,8 @@
1
+ import { TokenProvider } from "../interfaces/TokenProvider.js";
2
+ export declare class InjectionError extends Error {
3
+ name: string;
4
+ tokens: TokenProvider[];
5
+ origin: any;
6
+ constructor(token: TokenProvider, origin?: any);
7
+ static throwInjectorError(token: any, currentDependency: any, error: any): void;
8
+ }
@@ -0,0 +1,4 @@
1
+ export declare class InvalidPropertyTokenError extends Error {
2
+ name: string;
3
+ constructor(target: any, propertyKey: string);
4
+ }
@@ -0,0 +1,4 @@
1
+ export declare class UndefinedTokenError extends Error {
2
+ name: string;
3
+ constructor();
4
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @file Automatically generated by @tsed/barrels.
3
+ */
4
+ export * from "./constants/constants.js";
5
+ export * from "./decorators/configuration.js";
6
+ export * from "./decorators/constant.js";
7
+ export * from "./decorators/controller.js";
8
+ export * from "./decorators/inject.js";
9
+ export * from "./decorators/injectable.js";
10
+ export * from "./decorators/intercept.js";
11
+ export * from "./decorators/interceptor.js";
12
+ export * from "./decorators/lazyInject.js";
13
+ export * from "./decorators/module.js";
14
+ export * from "./decorators/opts.js";
15
+ export * from "./decorators/overrideProvider.js";
16
+ export * from "./decorators/scope.js";
17
+ export * from "./decorators/service.js";
18
+ export * from "./decorators/useOpts.js";
19
+ export * from "./decorators/value.js";
20
+ export * from "./domain/Container.js";
21
+ export * from "./domain/ControllerProvider.js";
22
+ export * from "./domain/InjectablePropertyType.js";
23
+ export * from "./domain/LocalsContainer.js";
24
+ export * from "./domain/Provider.js";
25
+ export * from "./domain/ProviderScope.js";
26
+ export * from "./domain/ProviderType.js";
27
+ export * from "./errors/InjectionError.js";
28
+ export * from "./errors/InvalidPropertyTokenError.js";
29
+ export * from "./errors/UndefinedTokenError.js";
30
+ export * from "./interfaces/DIConfigurationOptions.js";
31
+ export * from "./interfaces/DILogger.js";
32
+ export * from "./interfaces/DILoggerOptions.js";
33
+ export * from "./interfaces/DIResolver.js";
34
+ export * from "./interfaces/ImportTokenProviderOpts.js";
35
+ export * from "./interfaces/InjectableProperties.js";
36
+ export * from "./interfaces/InterceptorContext.js";
37
+ export * from "./interfaces/InterceptorMethods.js";
38
+ export * from "./interfaces/InvokeOptions.js";
39
+ export * from "./interfaces/OnDestroy.js";
40
+ export * from "./interfaces/OnInit.js";
41
+ export * from "./interfaces/ProviderOpts.js";
42
+ export * from "./interfaces/RegistrySettings.js";
43
+ export * from "./interfaces/ResolvedInvokeOptions.js";
44
+ export * from "./interfaces/TokenProvider.js";
45
+ export * from "./interfaces/TokenRoute.js";
46
+ export * from "./registries/GlobalProviders.js";
47
+ export * from "./registries/ProviderRegistry.js";
48
+ export * from "./services/DIConfiguration.js";
49
+ export * from "./services/DILogger.js";
50
+ export * from "./services/InjectorService.js";
51
+ export * from "./utils/colors.js";
52
+ export * from "./utils/createContainer.js";
53
+ export * from "./utils/getConfiguration.js";
54
+ export * from "./utils/getConstructorDependencies.js";
55
+ export * from "./utils/resolveControllers.js";