@tsed/di 6.114.4 → 6.114.5-rc.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 (78) hide show
  1. package/lib/cjs/constants/constants.js +1 -3
  2. package/lib/cjs/constants/constants.js.map +1 -1
  3. package/lib/cjs/decorators/constant.js +8 -9
  4. package/lib/cjs/decorators/constant.js.map +1 -1
  5. package/lib/cjs/decorators/inject.js +26 -28
  6. package/lib/cjs/decorators/inject.js.map +1 -1
  7. package/lib/cjs/decorators/intercept.js +30 -10
  8. package/lib/cjs/decorators/intercept.js.map +1 -1
  9. package/lib/cjs/decorators/lazyInject.js +13 -14
  10. package/lib/cjs/decorators/lazyInject.js.map +1 -1
  11. package/lib/cjs/decorators/useOpts.js +1 -5
  12. package/lib/cjs/decorators/useOpts.js.map +1 -1
  13. package/lib/cjs/decorators/value.js +9 -9
  14. package/lib/cjs/decorators/value.js.map +1 -1
  15. package/lib/cjs/domain/DIContext.js +1 -1
  16. package/lib/cjs/domain/DIContext.js.map +1 -1
  17. package/lib/cjs/index.js +3 -1
  18. package/lib/cjs/index.js.map +1 -1
  19. package/lib/cjs/interfaces/{InjectableProperties.js → DILoggerOptions.js} +1 -1
  20. package/lib/cjs/interfaces/DILoggerOptions.js.map +1 -0
  21. package/lib/cjs/services/DIConfiguration.js +49 -43
  22. package/lib/cjs/services/DIConfiguration.js.map +1 -1
  23. package/lib/cjs/services/DITest.js +2 -2
  24. package/lib/cjs/services/DITest.js.map +1 -1
  25. package/lib/cjs/services/InjectorService.js +19 -133
  26. package/lib/cjs/services/InjectorService.js.map +1 -1
  27. package/lib/cjs/utils/setLoggerConfiguration.js +11 -0
  28. package/lib/cjs/utils/setLoggerConfiguration.js.map +1 -0
  29. package/lib/cjs/utils/setLoggerFormat.js +33 -0
  30. package/lib/cjs/utils/setLoggerFormat.js.map +1 -0
  31. package/lib/cjs/utils/setLoggerLevel.js +1 -2
  32. package/lib/cjs/utils/setLoggerLevel.js.map +1 -1
  33. package/lib/esm/constants/constants.js +0 -2
  34. package/lib/esm/constants/constants.js.map +1 -1
  35. package/lib/esm/decorators/constant.js +9 -10
  36. package/lib/esm/decorators/constant.js.map +1 -1
  37. package/lib/esm/decorators/inject.js +28 -30
  38. package/lib/esm/decorators/inject.js.map +1 -1
  39. package/lib/esm/decorators/intercept.js +31 -11
  40. package/lib/esm/decorators/intercept.js.map +1 -1
  41. package/lib/esm/decorators/lazyInject.js +13 -14
  42. package/lib/esm/decorators/lazyInject.js.map +1 -1
  43. package/lib/esm/decorators/useOpts.js +2 -6
  44. package/lib/esm/decorators/useOpts.js.map +1 -1
  45. package/lib/esm/decorators/value.js +10 -10
  46. package/lib/esm/decorators/value.js.map +1 -1
  47. package/lib/esm/domain/DIContext.js +1 -1
  48. package/lib/esm/domain/DIContext.js.map +1 -1
  49. package/lib/esm/index.js +3 -1
  50. package/lib/esm/index.js.map +1 -1
  51. package/lib/esm/interfaces/DILoggerOptions.js +2 -0
  52. package/lib/esm/interfaces/DILoggerOptions.js.map +1 -0
  53. package/lib/esm/services/DIConfiguration.js +50 -44
  54. package/lib/esm/services/DIConfiguration.js.map +1 -1
  55. package/lib/esm/services/DITest.js +2 -2
  56. package/lib/esm/services/DITest.js.map +1 -1
  57. package/lib/esm/services/InjectorService.js +21 -135
  58. package/lib/esm/services/InjectorService.js.map +1 -1
  59. package/lib/esm/utils/setLoggerConfiguration.js +7 -0
  60. package/lib/esm/utils/setLoggerConfiguration.js.map +1 -0
  61. package/lib/esm/utils/setLoggerFormat.js +29 -0
  62. package/lib/esm/utils/setLoggerFormat.js.map +1 -0
  63. package/lib/esm/utils/setLoggerLevel.js +1 -2
  64. package/lib/esm/utils/setLoggerLevel.js.map +1 -1
  65. package/lib/types/constants/constants.d.ts +0 -2
  66. package/lib/types/decorators/inject.d.ts +5 -2
  67. package/lib/types/index.d.ts +3 -1
  68. package/lib/types/interfaces/DILoggerOptions.d.ts +44 -0
  69. package/lib/types/services/DIConfiguration.d.ts +17 -12
  70. package/lib/types/services/InjectorService.d.ts +5 -50
  71. package/lib/types/utils/setLoggerConfiguration.d.ts +2 -0
  72. package/lib/types/utils/setLoggerFormat.d.ts +6 -0
  73. package/lib/types/utils/setLoggerLevel.d.ts +1 -1
  74. package/package.json +9 -6
  75. package/lib/cjs/interfaces/InjectableProperties.js.map +0 -1
  76. package/lib/esm/interfaces/InjectableProperties.js +0 -2
  77. package/lib/esm/interfaces/InjectableProperties.js.map +0 -1
  78. package/lib/types/interfaces/InjectableProperties.d.ts +0 -24
@@ -1,24 +1,31 @@
1
- import { ProviderScope } from "../domain/ProviderScope";
1
+ import { Env } from "@tsed/core";
2
+ import type { ProviderScope } from "../domain/ProviderScope";
3
+ import type { DILoggerOptions } from "../interfaces/DILoggerOptions";
2
4
  import type { DIResolver } from "../interfaces/DIResolver";
3
5
  import type { TokenProvider } from "../interfaces/TokenProvider";
4
- import { TokenRoute } from "../interfaces/TokenRoute";
6
+ import type { TokenRoute } from "../interfaces/TokenRoute";
5
7
  export declare class DIConfiguration {
6
8
  readonly default: Map<string, any>;
7
9
  protected map: Map<string, any>;
8
- [key: string]: any;
9
10
  constructor(initialProps?: {});
10
- get scopes(): {
11
- [key: string]: ProviderScope;
12
- };
13
- set scopes(value: {
14
- [key: string]: ProviderScope;
15
- });
11
+ get version(): string;
12
+ set version(v: string);
13
+ get rootDir(): string;
14
+ set rootDir(value: string);
15
+ get env(): Env;
16
+ set env(value: Env);
17
+ get scopes(): Record<string, ProviderScope>;
18
+ set scopes(value: Record<string, ProviderScope>);
16
19
  get resolvers(): DIResolver[];
17
20
  set resolvers(resolvers: DIResolver[]);
18
21
  get imports(): TokenProvider[];
19
22
  set imports(imports: TokenProvider[]);
20
23
  get routes(): TokenRoute[];
21
24
  set routes(routes: TokenRoute[]);
25
+ get logger(): Partial<DILoggerOptions>;
26
+ set logger(value: Partial<DILoggerOptions>);
27
+ get debug(): boolean;
28
+ set debug(debug: boolean);
22
29
  /**
23
30
  *
24
31
  * @param callbackfn
@@ -39,13 +46,11 @@ export declare class DIConfiguration {
39
46
  * @returns {undefined|any}
40
47
  */
41
48
  get<T = any>(propertyKey: string, defaultValue?: T): T;
42
- getRaw(propertyKey: string, defaultValue?: any): any;
43
- merge(obj: Partial<TsED.Configuration>): void;
49
+ protected getRaw(propertyKey: string, defaultValue?: any): any;
44
50
  /**
45
51
  *
46
52
  * @param value
47
53
  * @returns {any}
48
54
  */
49
55
  resolve(value: any): any;
50
- build(): void;
51
56
  }
@@ -1,14 +1,13 @@
1
1
  import { Container } from "../domain/Container";
2
2
  import { LocalsContainer } from "../domain/LocalsContainer";
3
3
  import { Provider } from "../domain/Provider";
4
- import { DIConfiguration } from "./DIConfiguration";
5
4
  import { ProviderScope } from "../domain/ProviderScope";
6
5
  import { DILogger } from "../interfaces/DILogger";
7
- import { TokenProvider } from "../interfaces/TokenProvider";
8
- import { ProviderOpts } from "../interfaces/ProviderOpts";
9
6
  import { InvokeOptions } from "../interfaces/InvokeOptions";
10
- import { InjectablePropertyOptions, InjectablePropertyValue } from "../interfaces/InjectableProperties";
7
+ import { ProviderOpts } from "../interfaces/ProviderOpts";
8
+ import { TokenProvider } from "../interfaces/TokenProvider";
11
9
  import { runInContext } from "../utils/runInContext";
10
+ import { DIConfiguration } from "./DIConfiguration";
12
11
  /**
13
12
  * This service contain all services collected by `@Service` or services declared manually with `InjectorService.factory()` or `InjectorService.service()`.
14
13
  *
@@ -32,17 +31,13 @@ import { runInContext } from "../utils/runInContext";
32
31
  */
33
32
  export declare class InjectorService extends Container {
34
33
  #private;
35
- settings: TsED.Configuration & DIConfiguration;
34
+ settings: DIConfiguration;
36
35
  logger: DILogger;
37
36
  runInContext: typeof runInContext;
38
37
  private resolvedConfiguration;
39
38
  constructor();
40
39
  get resolvers(): import("..").DIResolver[];
41
- get scopes(): {
42
- [key: string]: ProviderScope;
43
- } & {
44
- [key: string]: ProviderScope;
45
- };
40
+ get scopes(): Record<string, ProviderScope>;
46
41
  /**
47
42
  * Retrieve default scope for a given provider.
48
43
  * @param provider
@@ -147,46 +142,6 @@ export declare class InjectorService extends Container {
147
142
  * @param options
148
143
  */
149
144
  bindInjectableProperties(instance: any, locals: Map<TokenProvider, any>, options: Partial<InvokeOptions>): void;
150
- /**
151
- *
152
- * @param instance
153
- * @param {string} propertyKey
154
- */
155
- bindMethod(instance: any, { propertyKey }: InjectablePropertyOptions): void;
156
- /**
157
- * Create an injectable property.
158
- *
159
- * @param instance
160
- * @param {string} propertyKey
161
- * @param {any} useType
162
- * @param resolver
163
- * @param options
164
- * @param locals
165
- * @param invokeOptions
166
- */
167
- bindProperty(instance: any, { propertyKey, resolver, options }: InjectablePropertyOptions, locals: Map<TokenProvider, any>, invokeOptions: Partial<InvokeOptions>): void;
168
- /**
169
- *
170
- * @param instance
171
- * @param {string} propertyKey
172
- * @param {any} useType
173
- */
174
- bindValue(instance: any, { propertyKey, expression, defaultValue }: InjectablePropertyValue): void;
175
- /**
176
- *
177
- * @param instance
178
- * @param {string} propertyKey
179
- * @param {any} useType
180
- */
181
- bindConstant(instance: any, { propertyKey, expression, defaultValue }: InjectablePropertyValue): void;
182
- /**
183
- *
184
- * @param instance
185
- * @param propertyKey
186
- * @param useType
187
- * @param options
188
- */
189
- bindInterceptor(instance: any, { propertyKey, useType, options }: InjectablePropertyOptions): void;
190
145
  lazyInvoke<T = any>(token: TokenProvider): Promise<any>;
191
146
  /**
192
147
  * Emit an event to all service. See service [lifecycle hooks](/docs/services.md#lifecycle-hooks).
@@ -0,0 +1,2 @@
1
+ import type { InjectorService } from "../services/InjectorService";
2
+ export declare function setLoggerConfiguration(injector: InjectorService): void;
@@ -0,0 +1,6 @@
1
+ import type { InjectorService } from "../services/InjectorService";
2
+ /**
3
+ * @ignore
4
+ * @param injector
5
+ */
6
+ export declare function setLoggerFormat(injector: InjectorService): void;
@@ -1,4 +1,4 @@
1
- import { InjectorService } from "../services/InjectorService";
1
+ import type { InjectorService } from "../services/InjectorService";
2
2
  /**
3
3
  * @ignore
4
4
  * @param injector
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/di",
3
- "version": "6.114.4",
3
+ "version": "6.114.5-rc.1",
4
4
  "description": "DI module for Ts.ED Framework",
5
5
  "private": false,
6
6
  "source": "./src/index.ts",
@@ -23,14 +23,14 @@
23
23
  "tslib": "2.3.1"
24
24
  },
25
25
  "devDependencies": {
26
- "@tsed/core": "6.114.4",
26
+ "@tsed/core": "6.114.5-rc.1",
27
27
  "@tsed/logger": ">=6.1.1",
28
- "@tsed/schema": "6.114.4"
28
+ "@tsed/schema": "6.114.5-rc.1"
29
29
  },
30
30
  "peerDependencies": {
31
- "@tsed/core": "^6.114.4",
31
+ "@tsed/core": "^6.114.5-rc.1",
32
32
  "@tsed/logger": ">=6.1.1",
33
- "@tsed/schema": "^6.114.4"
33
+ "@tsed/schema": "^6.114.5-rc.1"
34
34
  },
35
35
  "peerDependenciesMeta": {
36
36
  "@tsed/core": {
@@ -49,5 +49,8 @@
49
49
  },
50
50
  "homepage": "https://github.com/tsedio/tsed/tree/production/packages/di",
51
51
  "author": "Romain Lenzotti",
52
- "license": "MIT"
52
+ "license": "MIT",
53
+ "publishConfig": {
54
+ "tag": "rc"
55
+ }
53
56
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"InjectableProperties.js","sourceRoot":"","sources":["../../../src/interfaces/InjectableProperties.ts"],"names":[],"mappings":"","sourcesContent":["import type {InjectablePropertyType} from \"../domain/InjectablePropertyType\";\nimport type {TokenProvider} from \"./TokenProvider\";\nimport type {InjectorService} from \"../services/InjectorService\";\nimport type {InvokeOptions} from \"./InvokeOptions\";\n\nexport interface InjectableProperty {\n propertyKey: string;\n}\n\nexport interface InjectablePropertyOptions extends InjectableProperty {\n bindingType: InjectablePropertyType.METHOD | InjectablePropertyType.PROPERTY | InjectablePropertyType.INTERCEPTOR;\n propertyType: string;\n useType?: TokenProvider;\n resolver: (injector: InjectorService, locals: Map<TokenProvider, any>, options: Partial<InvokeOptions> & {options: any}) => () => any;\n options?: any;\n}\n\nexport interface InjectablePropertyValue extends InjectableProperty {\n bindingType: InjectablePropertyType.CONSTANT | InjectablePropertyType.VALUE;\n expression: string;\n defaultValue?: any;\n}\n\nexport interface InjectableProperties {\n [key: string]: InjectablePropertyOptions | InjectablePropertyValue;\n}\n"]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=InjectableProperties.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InjectableProperties.js","sourceRoot":"","sources":["../../../src/interfaces/InjectableProperties.ts"],"names":[],"mappings":"","sourcesContent":["import type {InjectablePropertyType} from \"../domain/InjectablePropertyType\";\nimport type {TokenProvider} from \"./TokenProvider\";\nimport type {InjectorService} from \"../services/InjectorService\";\nimport type {InvokeOptions} from \"./InvokeOptions\";\n\nexport interface InjectableProperty {\n propertyKey: string;\n}\n\nexport interface InjectablePropertyOptions extends InjectableProperty {\n bindingType: InjectablePropertyType.METHOD | InjectablePropertyType.PROPERTY | InjectablePropertyType.INTERCEPTOR;\n propertyType: string;\n useType?: TokenProvider;\n resolver: (injector: InjectorService, locals: Map<TokenProvider, any>, options: Partial<InvokeOptions> & {options: any}) => () => any;\n options?: any;\n}\n\nexport interface InjectablePropertyValue extends InjectableProperty {\n bindingType: InjectablePropertyType.CONSTANT | InjectablePropertyType.VALUE;\n expression: string;\n defaultValue?: any;\n}\n\nexport interface InjectableProperties {\n [key: string]: InjectablePropertyOptions | InjectablePropertyValue;\n}\n"]}
@@ -1,24 +0,0 @@
1
- import type { InjectablePropertyType } from "../domain/InjectablePropertyType";
2
- import type { TokenProvider } from "./TokenProvider";
3
- import type { InjectorService } from "../services/InjectorService";
4
- import type { InvokeOptions } from "./InvokeOptions";
5
- export interface InjectableProperty {
6
- propertyKey: string;
7
- }
8
- export interface InjectablePropertyOptions extends InjectableProperty {
9
- bindingType: InjectablePropertyType.METHOD | InjectablePropertyType.PROPERTY | InjectablePropertyType.INTERCEPTOR;
10
- propertyType: string;
11
- useType?: TokenProvider;
12
- resolver: (injector: InjectorService, locals: Map<TokenProvider, any>, options: Partial<InvokeOptions> & {
13
- options: any;
14
- }) => () => any;
15
- options?: any;
16
- }
17
- export interface InjectablePropertyValue extends InjectableProperty {
18
- bindingType: InjectablePropertyType.CONSTANT | InjectablePropertyType.VALUE;
19
- expression: string;
20
- defaultValue?: any;
21
- }
22
- export interface InjectableProperties {
23
- [key: string]: InjectablePropertyOptions | InjectablePropertyValue;
24
- }