@tsed/di 6.79.1 → 6.82.0

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.
@@ -1,13 +1,17 @@
1
1
  import type { InjectablePropertyType } from "../domain/InjectablePropertyType";
2
2
  import type { TokenProvider } from "./TokenProvider";
3
+ import type { InjectorService } from "../services/InjectorService";
4
+ import type { InvokeOptions } from "./InvokeOptions";
3
5
  export interface InjectableProperty {
4
6
  propertyKey: string;
5
7
  }
6
- export interface InjectablePropertyService extends InjectableProperty {
8
+ export interface InjectablePropertyOptions extends InjectableProperty {
7
9
  bindingType: InjectablePropertyType.METHOD | InjectablePropertyType.PROPERTY | InjectablePropertyType.INTERCEPTOR;
8
10
  propertyType: string;
9
- useType: TokenProvider;
10
- onGet?: (bean: any) => any;
11
+ useType?: TokenProvider;
12
+ resolver: (injector: InjectorService, locals: Map<TokenProvider, any>, options: Partial<InvokeOptions> & {
13
+ options: any;
14
+ }) => () => any;
11
15
  options?: any;
12
16
  }
13
17
  export interface InjectablePropertyValue extends InjectableProperty {
@@ -16,5 +20,5 @@ export interface InjectablePropertyValue extends InjectableProperty {
16
20
  defaultValue?: any;
17
21
  }
18
22
  export interface InjectableProperties {
19
- [key: string]: InjectablePropertyService | InjectablePropertyValue;
23
+ [key: string]: InjectablePropertyOptions | InjectablePropertyValue;
20
24
  }
@@ -2,7 +2,7 @@ import { DIContext, ProviderScope } from "../domain";
2
2
  import { Container } from "../domain/Container";
3
3
  import { LocalsContainer } from "../domain/LocalsContainer";
4
4
  import { Provider } from "../domain/Provider";
5
- import { DILogger, InjectablePropertyService, InjectablePropertyValue, InvokeOptions, IProvider, TokenProvider } from "../interfaces";
5
+ import { DILogger, InjectablePropertyOptions, InjectablePropertyValue, InvokeOptions, IProvider, TokenProvider } from "../interfaces";
6
6
  import { DIConfiguration } from "./DIConfiguration";
7
7
  /**
8
8
  * This service contain all services collected by `@Service` or services declared manually with `InjectorService.factory()` or `InjectorService.service()`.
@@ -134,19 +134,19 @@ export declare class InjectorService extends Container {
134
134
  * @param instance
135
135
  * @param {string} propertyKey
136
136
  */
137
- bindMethod(instance: any, { propertyKey }: InjectablePropertyService): void;
137
+ bindMethod(instance: any, { propertyKey }: InjectablePropertyOptions): void;
138
138
  /**
139
139
  * Create an injectable property.
140
140
  *
141
141
  * @param instance
142
142
  * @param {string} propertyKey
143
143
  * @param {any} useType
144
- * @param onGet
144
+ * @param resolver
145
145
  * @param options
146
146
  * @param locals
147
147
  * @param invokeOptions
148
148
  */
149
- bindProperty(instance: any, { propertyKey, useType, onGet, options }: InjectablePropertyService, locals: Map<TokenProvider, any>, invokeOptions: Partial<InvokeOptions>): void;
149
+ bindProperty(instance: any, { propertyKey, resolver, options }: InjectablePropertyOptions, locals: Map<TokenProvider, any>, invokeOptions: Partial<InvokeOptions>): void;
150
150
  /**
151
151
  *
152
152
  * @param instance
@@ -168,7 +168,7 @@ export declare class InjectorService extends Container {
168
168
  * @param useType
169
169
  * @param options
170
170
  */
171
- bindInterceptor(instance: any, { propertyKey, useType, options }: InjectablePropertyService): void;
171
+ bindInterceptor(instance: any, { propertyKey, useType, options }: InjectablePropertyOptions): void;
172
172
  /**
173
173
  * Allow handler hack for AsyncHookContext plugin.
174
174
  * @param ctx
@@ -176,7 +176,9 @@ export declare class InjectorService extends Container {
176
176
  * @protected
177
177
  */
178
178
  runInContext(ctx: DIContext, cb: any): any;
179
+ lazyInvoke(token: TokenProvider): Promise<any>;
179
180
  protected ensureProvider(token: TokenProvider): Provider | undefined;
181
+ protected getInstance(token: any): any;
180
182
  /**
181
183
  * Invoke a class method and inject service.
182
184
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/di",
3
- "version": "6.79.1",
3
+ "version": "6.82.0",
4
4
  "description": "DI module for Ts.ED Framework",
5
5
  "private": false,
6
6
  "source": "./src/index.ts",
@@ -14,9 +14,8 @@
14
14
  "build": "microbundle --target node --no-compress --format modern,cjs --tsconfig ./tsconfig.compile.json"
15
15
  },
16
16
  "dependencies": {
17
- "@tsed/core": "6.79.1",
18
- "@tsed/schema": "6.79.1",
19
- "chalk": "4.1.0",
17
+ "@tsed/core": "6.82.0",
18
+ "@tsed/schema": "6.82.0",
20
19
  "tslib": "2.2.0"
21
20
  },
22
21
  "devDependencies": {