@veloxts/core 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +697 -16
- package/dist/app.d.ts +67 -10
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +79 -12
- package/dist/app.js.map +1 -1
- package/dist/di/container.d.ts +406 -0
- package/dist/di/container.d.ts.map +1 -0
- package/dist/di/container.js +693 -0
- package/dist/di/container.js.map +1 -0
- package/dist/di/decorators.d.ts +221 -0
- package/dist/di/decorators.d.ts.map +1 -0
- package/dist/di/decorators.js +297 -0
- package/dist/di/decorators.js.map +1 -0
- package/dist/di/index.d.ts +65 -0
- package/dist/di/index.d.ts.map +1 -0
- package/dist/di/index.js +73 -0
- package/dist/di/index.js.map +1 -0
- package/dist/di/providers.d.ts +357 -0
- package/dist/di/providers.d.ts.map +1 -0
- package/dist/di/providers.js +380 -0
- package/dist/di/providers.js.map +1 -0
- package/dist/di/scope.d.ts +209 -0
- package/dist/di/scope.d.ts.map +1 -0
- package/dist/di/scope.js +262 -0
- package/dist/di/scope.js.map +1 -0
- package/dist/di/tokens.d.ts +227 -0
- package/dist/di/tokens.d.ts.map +1 -0
- package/dist/di/tokens.js +192 -0
- package/dist/di/tokens.js.map +1 -0
- package/dist/index.d.ts +9 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/di/index.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency Injection Module
|
|
3
|
+
*
|
|
4
|
+
* VeloxTS provides a powerful, type-safe dependency injection container
|
|
5
|
+
* inspired by Angular and NestJS, designed for the VeloxTS framework.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Class, factory, value, and alias providers
|
|
9
|
+
* - Singleton, transient, and request-scoped lifecycles
|
|
10
|
+
* - Automatic constructor injection via decorators
|
|
11
|
+
* - Circular dependency detection
|
|
12
|
+
* - Fastify integration for request-scoped services
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import {
|
|
17
|
+
* Container,
|
|
18
|
+
* Injectable,
|
|
19
|
+
* Inject,
|
|
20
|
+
* Scope,
|
|
21
|
+
* token
|
|
22
|
+
* } from '@veloxts/core';
|
|
23
|
+
*
|
|
24
|
+
* // Create tokens for interfaces
|
|
25
|
+
* const DATABASE = token<DatabaseClient>('DATABASE');
|
|
26
|
+
* const LOGGER = token.symbol<Logger>('LOGGER');
|
|
27
|
+
*
|
|
28
|
+
* // Define injectable services
|
|
29
|
+
* @Injectable({ scope: Scope.REQUEST })
|
|
30
|
+
* class UserService {
|
|
31
|
+
* constructor(
|
|
32
|
+
* @Inject(DATABASE) private db: DatabaseClient,
|
|
33
|
+
* private config: ConfigService,
|
|
34
|
+
* ) {}
|
|
35
|
+
* }
|
|
36
|
+
*
|
|
37
|
+
* // Register providers
|
|
38
|
+
* const container = new Container();
|
|
39
|
+
* container.register({
|
|
40
|
+
* provide: DATABASE,
|
|
41
|
+
* useFactory: () => createDatabaseClient(),
|
|
42
|
+
* scope: Scope.SINGLETON
|
|
43
|
+
* });
|
|
44
|
+
* container.register({
|
|
45
|
+
* provide: UserService,
|
|
46
|
+
* useClass: UserService,
|
|
47
|
+
* scope: Scope.REQUEST
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* // Resolve services
|
|
51
|
+
* const userService = container.resolve(UserService, { request });
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @module di
|
|
55
|
+
*/
|
|
56
|
+
export { Container, container, createContainer } from './container.js';
|
|
57
|
+
export { getConstructorTokens, getExplicitInjectTokens, getInjectableScope, getOptionalParams, INJECT_METADATA_KEY, INJECTABLE_METADATA_KEY, Inject, Injectable, isInjectable, makeInjectable, OPTIONAL_METADATA_KEY, Optional, SCOPE_METADATA_KEY, setInjectTokens, } from './decorators.js';
|
|
58
|
+
export {
|
|
59
|
+
// Succinct scope helpers (preferred)
|
|
60
|
+
singleton, scoped, transient, value, factory,
|
|
61
|
+
// Legacy helpers (still supported)
|
|
62
|
+
asClass, asExisting, asFactory, asValue,
|
|
63
|
+
// Type guards
|
|
64
|
+
isClassProvider, isExistingProvider, isFactoryProvider, isValueProvider, validateProvider, } from './providers.js';
|
|
65
|
+
export { Scope, ScopeManager } from './scope.js';
|
|
66
|
+
export {
|
|
67
|
+
// Succinct API (preferred)
|
|
68
|
+
token,
|
|
69
|
+
// Legacy (deprecated) - keep for backwards compatibility
|
|
70
|
+
createStringToken, createSymbolToken,
|
|
71
|
+
// Utilities
|
|
72
|
+
getTokenName, isClassToken, isStringToken, isSymbolToken, validateToken, } from './tokens.js';
|
|
73
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/di/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAGH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEvE,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,uBAAuB,EACvB,MAAM,EACN,UAAU,EACV,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,QAAQ,EACR,kBAAkB,EAClB,eAAe,GAChB,MAAM,iBAAiB,CAAC;AAQzB,OAAO;AACL,qCAAqC;AACrC,SAAS,EACT,MAAM,EACN,SAAS,EACT,KAAK,EACL,OAAO;AACP,mCAAmC;AACnC,OAAO,EACP,UAAU,EACV,SAAS,EACT,OAAO;AACP,cAAc;AACd,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AASjD,OAAO;AACL,2BAA2B;AAC3B,KAAK;AACL,yDAAyD;AACzD,iBAAiB,EACjB,iBAAiB;AACjB,YAAY;AACZ,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,EACb,aAAa,GACd,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider types and registration interfaces for dependency injection
|
|
3
|
+
*
|
|
4
|
+
* Providers define how services are created and configured.
|
|
5
|
+
* VeloxTS supports four provider types:
|
|
6
|
+
* - Class providers: Instantiate a class
|
|
7
|
+
* - Factory providers: Use a factory function
|
|
8
|
+
* - Value providers: Use an existing value
|
|
9
|
+
* - Existing providers: Alias another token
|
|
10
|
+
*
|
|
11
|
+
* @module di/providers
|
|
12
|
+
*/
|
|
13
|
+
import { Scope } from './scope.js';
|
|
14
|
+
import type { ClassConstructor, InjectionToken } from './tokens.js';
|
|
15
|
+
/**
|
|
16
|
+
* Base provider interface
|
|
17
|
+
*
|
|
18
|
+
* All providers must specify the token they provide
|
|
19
|
+
* and optionally their lifecycle scope.
|
|
20
|
+
*
|
|
21
|
+
* @template T - The type of service being provided
|
|
22
|
+
*/
|
|
23
|
+
interface BaseProvider<T = unknown> {
|
|
24
|
+
/**
|
|
25
|
+
* The token that identifies this service
|
|
26
|
+
*/
|
|
27
|
+
provide: InjectionToken<T>;
|
|
28
|
+
/**
|
|
29
|
+
* The lifecycle scope for this service
|
|
30
|
+
* @default Scope.SINGLETON
|
|
31
|
+
*/
|
|
32
|
+
scope?: Scope;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Class provider
|
|
36
|
+
*
|
|
37
|
+
* Creates instances by calling `new` on the specified class.
|
|
38
|
+
* Constructor dependencies are automatically injected.
|
|
39
|
+
*
|
|
40
|
+
* @template T - The type of service being provided
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* container.register({
|
|
45
|
+
* provide: UserService,
|
|
46
|
+
* useClass: UserService,
|
|
47
|
+
* scope: Scope.REQUEST
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* // Or with a different implementation
|
|
51
|
+
* container.register({
|
|
52
|
+
* provide: IUserRepository,
|
|
53
|
+
* useClass: PrismaUserRepository
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export interface ClassProvider<T = unknown> extends BaseProvider<T> {
|
|
58
|
+
/**
|
|
59
|
+
* The class to instantiate
|
|
60
|
+
*/
|
|
61
|
+
useClass: ClassConstructor<T>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Factory provider
|
|
65
|
+
*
|
|
66
|
+
* Creates instances using a factory function.
|
|
67
|
+
* Dependencies can be injected into the factory via the `inject` array.
|
|
68
|
+
*
|
|
69
|
+
* @template T - The type of service being provided
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* container.register({
|
|
74
|
+
* provide: DATABASE,
|
|
75
|
+
* useFactory: (config: ConfigService) => {
|
|
76
|
+
* return createDatabaseClient(config.databaseUrl);
|
|
77
|
+
* },
|
|
78
|
+
* inject: [ConfigService],
|
|
79
|
+
* scope: Scope.SINGLETON
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export interface FactoryProvider<T = unknown> extends BaseProvider<T> {
|
|
84
|
+
/**
|
|
85
|
+
* The factory function that creates the service
|
|
86
|
+
*
|
|
87
|
+
* Receives resolved dependencies in order matching the `inject` array.
|
|
88
|
+
*/
|
|
89
|
+
useFactory: (...args: never[]) => T | Promise<T>;
|
|
90
|
+
/**
|
|
91
|
+
* Tokens for dependencies to inject into the factory
|
|
92
|
+
*
|
|
93
|
+
* Dependencies are resolved and passed to the factory in order.
|
|
94
|
+
*/
|
|
95
|
+
inject?: InjectionToken[];
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Value provider
|
|
99
|
+
*
|
|
100
|
+
* Uses an existing value directly without any instantiation.
|
|
101
|
+
* Useful for configuration objects, constants, or pre-created instances.
|
|
102
|
+
*
|
|
103
|
+
* @template T - The type of service being provided
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* container.register({
|
|
108
|
+
* provide: CONFIG,
|
|
109
|
+
* useValue: {
|
|
110
|
+
* port: 3210,
|
|
111
|
+
* host: 'localhost',
|
|
112
|
+
* debug: true
|
|
113
|
+
* }
|
|
114
|
+
* });
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export interface ValueProvider<T = unknown> extends BaseProvider<T> {
|
|
118
|
+
/**
|
|
119
|
+
* The value to use as the service instance
|
|
120
|
+
*/
|
|
121
|
+
useValue: T;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Existing provider (alias)
|
|
125
|
+
*
|
|
126
|
+
* Aliases one token to another, allowing multiple tokens
|
|
127
|
+
* to resolve to the same service.
|
|
128
|
+
*
|
|
129
|
+
* @template T - The type of service being provided
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```typescript
|
|
133
|
+
* // Register the concrete implementation
|
|
134
|
+
* container.register({
|
|
135
|
+
* provide: ConsoleLogger,
|
|
136
|
+
* useClass: ConsoleLogger
|
|
137
|
+
* });
|
|
138
|
+
*
|
|
139
|
+
* // Create an alias using the interface token
|
|
140
|
+
* container.register({
|
|
141
|
+
* provide: LOGGER,
|
|
142
|
+
* useExisting: ConsoleLogger
|
|
143
|
+
* });
|
|
144
|
+
*
|
|
145
|
+
* // Both resolve to the same instance
|
|
146
|
+
* const logger1 = container.resolve(LOGGER);
|
|
147
|
+
* const logger2 = container.resolve(ConsoleLogger);
|
|
148
|
+
* // logger1 === logger2
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
export interface ExistingProvider<T = unknown> extends BaseProvider<T> {
|
|
152
|
+
/**
|
|
153
|
+
* The token to alias to
|
|
154
|
+
*
|
|
155
|
+
* Resolving the `provide` token will resolve this token instead.
|
|
156
|
+
*/
|
|
157
|
+
useExisting: InjectionToken<T>;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Union of all provider types
|
|
161
|
+
*/
|
|
162
|
+
export type Provider<T = unknown> = ClassProvider<T> | FactoryProvider<T> | ValueProvider<T> | ExistingProvider<T>;
|
|
163
|
+
/**
|
|
164
|
+
* Type guard for class providers
|
|
165
|
+
*/
|
|
166
|
+
export declare function isClassProvider<T>(provider: Provider<T>): provider is ClassProvider<T>;
|
|
167
|
+
/**
|
|
168
|
+
* Type guard for factory providers
|
|
169
|
+
*/
|
|
170
|
+
export declare function isFactoryProvider<T>(provider: Provider<T>): provider is FactoryProvider<T>;
|
|
171
|
+
/**
|
|
172
|
+
* Type guard for value providers
|
|
173
|
+
*/
|
|
174
|
+
export declare function isValueProvider<T>(provider: Provider<T>): provider is ValueProvider<T>;
|
|
175
|
+
/**
|
|
176
|
+
* Type guard for existing/alias providers
|
|
177
|
+
*/
|
|
178
|
+
export declare function isExistingProvider<T>(provider: Provider<T>): provider is ExistingProvider<T>;
|
|
179
|
+
/**
|
|
180
|
+
* Validates a provider configuration
|
|
181
|
+
*
|
|
182
|
+
* @param provider - The provider to validate
|
|
183
|
+
* @throws {VeloxError} If the provider is invalid
|
|
184
|
+
*/
|
|
185
|
+
export declare function validateProvider(provider: unknown): asserts provider is Provider;
|
|
186
|
+
/**
|
|
187
|
+
* Normalized provider with all optional fields filled in
|
|
188
|
+
*
|
|
189
|
+
* @internal
|
|
190
|
+
*/
|
|
191
|
+
export interface NormalizedProvider<T = unknown> {
|
|
192
|
+
provide: InjectionToken<T>;
|
|
193
|
+
scope: Scope;
|
|
194
|
+
type: 'class' | 'factory' | 'value' | 'existing';
|
|
195
|
+
implementation: {
|
|
196
|
+
class?: ClassConstructor<T>;
|
|
197
|
+
factory?: (...args: never[]) => T | Promise<T>;
|
|
198
|
+
inject?: InjectionToken[];
|
|
199
|
+
value?: T;
|
|
200
|
+
existing?: InjectionToken<T>;
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Normalizes a provider to a consistent internal format
|
|
205
|
+
*
|
|
206
|
+
* @param provider - The provider to normalize
|
|
207
|
+
* @returns The normalized provider
|
|
208
|
+
*
|
|
209
|
+
* @internal
|
|
210
|
+
*/
|
|
211
|
+
export declare function normalizeProvider<T>(provider: Provider<T>): NormalizedProvider<T>;
|
|
212
|
+
/**
|
|
213
|
+
* Creates a class provider with type inference
|
|
214
|
+
*
|
|
215
|
+
* @param cls - The class to provide
|
|
216
|
+
* @param scope - The lifecycle scope
|
|
217
|
+
* @returns A class provider configuration
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```typescript
|
|
221
|
+
* container.register(asClass(UserService, Scope.REQUEST));
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
export declare function asClass<T>(cls: ClassConstructor<T>, scope?: Scope): ClassProvider<T>;
|
|
225
|
+
/**
|
|
226
|
+
* Creates a factory provider with type inference
|
|
227
|
+
*
|
|
228
|
+
* @param token - The token to provide
|
|
229
|
+
* @param factory - The factory function
|
|
230
|
+
* @param options - Factory options (inject, scope)
|
|
231
|
+
* @returns A factory provider configuration
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```typescript
|
|
235
|
+
* container.register(asFactory(
|
|
236
|
+
* DATABASE,
|
|
237
|
+
* (config: ConfigService) => createDb(config.dbUrl),
|
|
238
|
+
* { inject: [ConfigService] }
|
|
239
|
+
* ));
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
export declare function asFactory<T>(token: InjectionToken<T>, factory: (...args: never[]) => T | Promise<T>, options?: {
|
|
243
|
+
inject?: InjectionToken[];
|
|
244
|
+
scope?: Scope;
|
|
245
|
+
}): FactoryProvider<T>;
|
|
246
|
+
/**
|
|
247
|
+
* Creates a value provider with type inference
|
|
248
|
+
*
|
|
249
|
+
* @param token - The token to provide
|
|
250
|
+
* @param value - The value to use
|
|
251
|
+
* @returns A value provider configuration
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```typescript
|
|
255
|
+
* container.register(asValue(CONFIG, { port: 3210 }));
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
258
|
+
export declare function asValue<T>(token: InjectionToken<T>, value: T): ValueProvider<T>;
|
|
259
|
+
/**
|
|
260
|
+
* Creates an existing/alias provider with type inference
|
|
261
|
+
*
|
|
262
|
+
* @param token - The token to provide (alias)
|
|
263
|
+
* @param existing - The token to alias to
|
|
264
|
+
* @returns An existing provider configuration
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* ```typescript
|
|
268
|
+
* container.register(asExisting(LOGGER, ConsoleLogger));
|
|
269
|
+
* ```
|
|
270
|
+
*/
|
|
271
|
+
export declare function asExisting<T>(token: InjectionToken<T>, existing: InjectionToken<T>): ExistingProvider<T>;
|
|
272
|
+
/**
|
|
273
|
+
* Creates a singleton class provider
|
|
274
|
+
*
|
|
275
|
+
* Singleton services are instantiated once and shared across all requests.
|
|
276
|
+
* This is the default scope and the most common pattern.
|
|
277
|
+
*
|
|
278
|
+
* @param cls - The class to provide as a singleton
|
|
279
|
+
* @returns A class provider configured as singleton
|
|
280
|
+
*
|
|
281
|
+
* @example
|
|
282
|
+
* ```typescript
|
|
283
|
+
* container.register(singleton(ConfigService));
|
|
284
|
+
* container.register(singleton(DatabasePool));
|
|
285
|
+
* ```
|
|
286
|
+
*/
|
|
287
|
+
export declare function singleton<T>(cls: ClassConstructor<T>): ClassProvider<T>;
|
|
288
|
+
/**
|
|
289
|
+
* Creates a request-scoped class provider
|
|
290
|
+
*
|
|
291
|
+
* Request-scoped services are instantiated once per HTTP request.
|
|
292
|
+
* Ideal for services that need request-specific state.
|
|
293
|
+
*
|
|
294
|
+
* @param cls - The class to provide with request scope
|
|
295
|
+
* @returns A class provider configured as request-scoped
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```typescript
|
|
299
|
+
* container.register(scoped(RequestContext));
|
|
300
|
+
* container.register(scoped(UserSession));
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
export declare function scoped<T>(cls: ClassConstructor<T>): ClassProvider<T>;
|
|
304
|
+
/**
|
|
305
|
+
* Creates a transient class provider
|
|
306
|
+
*
|
|
307
|
+
* Transient services are instantiated every time they are resolved.
|
|
308
|
+
* Useful for stateful objects that should not be shared.
|
|
309
|
+
*
|
|
310
|
+
* @param cls - The class to provide as transient
|
|
311
|
+
* @returns A class provider configured as transient
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* ```typescript
|
|
315
|
+
* container.register(transient(EmailBuilder));
|
|
316
|
+
* container.register(transient(RequestId));
|
|
317
|
+
* ```
|
|
318
|
+
*/
|
|
319
|
+
export declare function transient<T>(cls: ClassConstructor<T>): ClassProvider<T>;
|
|
320
|
+
/**
|
|
321
|
+
* Creates a value provider (convenience alias)
|
|
322
|
+
*
|
|
323
|
+
* @param token - The token to provide
|
|
324
|
+
* @param val - The value to use
|
|
325
|
+
* @returns A value provider configuration
|
|
326
|
+
*
|
|
327
|
+
* @example
|
|
328
|
+
* ```typescript
|
|
329
|
+
* container.register(value(CONFIG, { port: 3210 }));
|
|
330
|
+
* ```
|
|
331
|
+
*/
|
|
332
|
+
export declare function value<T>(token: InjectionToken<T>, val: T): ValueProvider<T>;
|
|
333
|
+
/**
|
|
334
|
+
* Creates a factory provider (convenience alias)
|
|
335
|
+
*
|
|
336
|
+
* @param token - The token to provide
|
|
337
|
+
* @param factoryFn - The factory function
|
|
338
|
+
* @param deps - Dependencies to inject into the factory
|
|
339
|
+
* @returns A factory provider configuration
|
|
340
|
+
*
|
|
341
|
+
* @example
|
|
342
|
+
* ```typescript
|
|
343
|
+
* container.register(factory(DATABASE, createDb, [ConfigService]));
|
|
344
|
+
* ```
|
|
345
|
+
*/
|
|
346
|
+
export declare function factory<T>(token: InjectionToken<T>, factoryFn: (...args: never[]) => T | Promise<T>, deps?: InjectionToken[]): FactoryProvider<T>;
|
|
347
|
+
/**
|
|
348
|
+
* Gets a human-readable description of a provider
|
|
349
|
+
*
|
|
350
|
+
* @param provider - The provider to describe
|
|
351
|
+
* @returns A string description
|
|
352
|
+
*
|
|
353
|
+
* @internal
|
|
354
|
+
*/
|
|
355
|
+
export declare function describeProvider(provider: Provider): string;
|
|
356
|
+
export {};
|
|
357
|
+
//# sourceMappingURL=providers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/di/providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAiC,KAAK,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAOpE;;;;;;;GAOG;AACH,UAAU,YAAY,CAAC,CAAC,GAAG,OAAO;IAChC;;OAEG;IACH,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IAE3B;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,YAAY,CAAC,CAAC,CAAC;IACjE;;OAEG;IACH,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,YAAY,CAAC,CAAC,CAAC;IACnE;;;;OAIG;IACH,UAAU,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAEjD;;;;OAIG;IACH,MAAM,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