stratal 0.0.6 → 0.0.7
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/dist/application.d.ts +10 -42
- package/dist/application.d.ts.map +1 -1
- package/dist/application.js +36 -77
- package/dist/application.js.map +1 -1
- package/dist/config/config.module.d.ts.map +1 -1
- package/dist/config/config.module.js +2 -1
- package/dist/config/config.module.js.map +1 -1
- package/dist/config/errors/config-module-not-initialized.error.d.ts +10 -0
- package/dist/config/errors/config-module-not-initialized.error.d.ts.map +1 -0
- package/dist/config/errors/config-module-not-initialized.error.js +12 -0
- package/dist/config/errors/config-module-not-initialized.error.js.map +1 -0
- package/dist/config/errors/index.d.ts +1 -0
- package/dist/config/errors/index.d.ts.map +1 -1
- package/dist/config/errors/index.js +1 -0
- package/dist/config/errors/index.js.map +1 -1
- package/dist/di/container.d.ts +5 -267
- package/dist/di/container.d.ts.map +1 -1
- package/dist/di/container.js +13 -288
- package/dist/di/container.js.map +1 -1
- package/dist/di/errors/request-scope-operation-not-allowed.error.d.ts +0 -1
- package/dist/di/errors/request-scope-operation-not-allowed.error.d.ts.map +1 -1
- package/dist/di/errors/request-scope-operation-not-allowed.error.js +0 -1
- package/dist/di/errors/request-scope-operation-not-allowed.error.js.map +1 -1
- package/dist/di/index.d.ts +0 -1
- package/dist/di/index.d.ts.map +1 -1
- package/dist/di/index.js +0 -1
- package/dist/di/index.js.map +1 -1
- package/dist/errors/error-codes.d.ts +2 -0
- package/dist/errors/error-codes.d.ts.map +1 -1
- package/dist/errors/error-codes.js +2 -0
- package/dist/errors/error-codes.js.map +1 -1
- package/dist/events/types.d.ts +1 -1
- package/dist/execution-context.d.ts +4 -0
- package/dist/execution-context.d.ts.map +1 -0
- package/dist/execution-context.js +2 -0
- package/dist/execution-context.js.map +1 -0
- package/dist/i18n/messages/en/errors.d.ts +2 -2
- package/dist/i18n/messages/en/errors.js +2 -2
- package/dist/i18n/messages/en/errors.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/logger/services/logger.service.d.ts +2 -15
- package/dist/logger/services/logger.service.d.ts.map +1 -1
- package/dist/logger/services/logger.service.js +11 -16
- package/dist/logger/services/logger.service.js.map +1 -1
- package/dist/router/errors/hono-app-already-configured.error.d.ts +10 -0
- package/dist/router/errors/hono-app-already-configured.error.d.ts.map +1 -0
- package/dist/router/errors/hono-app-already-configured.error.js +12 -0
- package/dist/router/errors/hono-app-already-configured.error.js.map +1 -0
- package/dist/router/errors/index.d.ts +1 -2
- package/dist/router/errors/index.d.ts.map +1 -1
- package/dist/router/errors/index.js +1 -2
- package/dist/router/errors/index.js.map +1 -1
- package/dist/router/hono-app.d.ts +38 -0
- package/dist/router/hono-app.d.ts.map +1 -0
- package/dist/router/hono-app.js +128 -0
- package/dist/router/hono-app.js.map +1 -0
- package/dist/router/index.d.ts +3 -3
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js +6 -4
- package/dist/router/index.js.map +1 -1
- package/dist/router/router.tokens.d.ts +0 -28
- package/dist/router/router.tokens.d.ts.map +1 -1
- package/dist/router/router.tokens.js +0 -28
- package/dist/router/router.tokens.js.map +1 -1
- package/dist/router/services/index.d.ts +0 -1
- package/dist/router/services/index.d.ts.map +1 -1
- package/dist/router/services/index.js +0 -1
- package/dist/router/services/index.js.map +1 -1
- package/dist/stratal.d.ts +9 -26
- package/dist/stratal.d.ts.map +1 -1
- package/dist/stratal.js +22 -50
- package/dist/stratal.js.map +1 -1
- package/package.json +8 -8
- package/dist/di/request-context-store.d.ts +0 -122
- package/dist/di/request-context-store.d.ts.map +0 -1
- package/dist/di/request-context-store.js +0 -135
- package/dist/di/request-context-store.js.map +0 -1
- package/dist/router/errors/router-already-configured.error.d.ts +0 -5
- package/dist/router/errors/router-already-configured.error.d.ts.map +0 -1
- package/dist/router/errors/router-already-configured.error.js +0 -8
- package/dist/router/errors/router-already-configured.error.js.map +0 -1
- package/dist/router/errors/router-not-configured.error.d.ts +0 -5
- package/dist/router/errors/router-not-configured.error.d.ts.map +0 -1
- package/dist/router/errors/router-not-configured.error.js +0 -8
- package/dist/router/errors/router-not-configured.error.js.map +0 -1
- package/dist/router/router.service.d.ts +0 -62
- package/dist/router/router.service.d.ts.map +0 -1
- package/dist/router/router.service.js +0 -166
- package/dist/router/router.service.js.map +0 -1
- package/dist/router/services/request-scope.service.d.ts +0 -42
- package/dist/router/services/request-scope.service.d.ts.map +0 -1
- package/dist/router/services/request-scope.service.js +0 -76
- package/dist/router/services/request-scope.service.js.map +0 -1
package/dist/di/container.d.ts
CHANGED
|
@@ -22,8 +22,6 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import { type DependencyContainer } from 'tsyringe';
|
|
24
24
|
import type InjectionToken from 'tsyringe/dist/typings/providers/injection-token';
|
|
25
|
-
import { type StratalEnv } from '../env';
|
|
26
|
-
import type { LoggerService } from '../logger/services/logger.service';
|
|
27
25
|
import type { RouterContext } from '../router/router-context';
|
|
28
26
|
import type { Constructor } from '../types';
|
|
29
27
|
import { type ConditionalBindingBuilder, type PredicateContainer } from './conditional-binding-builder';
|
|
@@ -32,10 +30,6 @@ import type { ExtensionDecorator, Scope, WhenOptions } from './types';
|
|
|
32
30
|
* Options for creating a Container instance
|
|
33
31
|
*/
|
|
34
32
|
export interface ContainerOptions {
|
|
35
|
-
/** Cloudflare environment bindings */
|
|
36
|
-
env: StratalEnv;
|
|
37
|
-
/** Cloudflare execution context */
|
|
38
|
-
ctx: ExecutionContext;
|
|
39
33
|
/** Pre-created DependencyContainer */
|
|
40
34
|
container: DependencyContainer;
|
|
41
35
|
/** Whether this is a request-scoped container */
|
|
@@ -53,341 +47,85 @@ export interface ContainerOptions {
|
|
|
53
47
|
* import { container as tsyringeRootContainer } from 'tsyringe'
|
|
54
48
|
*
|
|
55
49
|
* const container = new Container({
|
|
56
|
-
* env,
|
|
57
|
-
* ctx,
|
|
58
50
|
* container: tsyringeRootContainer.createChildContainer()
|
|
59
51
|
* })
|
|
60
52
|
*
|
|
61
|
-
* // Auto-extract token and scope from decorator
|
|
62
53
|
* container.register(I18nService)
|
|
63
|
-
*
|
|
64
|
-
* // Explicit token with auto-scope detection
|
|
65
54
|
* container.register(MY_TOKEN, MyService)
|
|
66
|
-
*
|
|
67
|
-
* // Explicit singleton registration
|
|
68
55
|
* container.registerSingleton(ConfigService)
|
|
69
|
-
*
|
|
70
|
-
* // Register a value
|
|
71
56
|
* container.registerValue(MY_TOKEN, myInstance)
|
|
72
57
|
* ```
|
|
73
58
|
*
|
|
74
|
-
* @example Resolution
|
|
75
|
-
* ```typescript
|
|
76
|
-
* // Resolves from container
|
|
77
|
-
* const service = container.resolve(MY_TOKEN)
|
|
78
|
-
* ```
|
|
79
|
-
*
|
|
80
59
|
* @example Request scope (automatic lifecycle)
|
|
81
60
|
* ```typescript
|
|
82
|
-
* await container.runInRequestScope(routerContext, async () => {
|
|
83
|
-
* const i18n =
|
|
84
|
-
* // i18n is context-enriched for this request
|
|
85
|
-
* })
|
|
86
|
-
* ```
|
|
87
|
-
*
|
|
88
|
-
* @example Request scope (manual lifecycle)
|
|
89
|
-
* ```typescript
|
|
90
|
-
* const reqContainer = container.createRequestScope(routerContext)
|
|
91
|
-
* await reqContainer.runWithContextStore(async () => {
|
|
92
|
-
* // use reqContainer...
|
|
61
|
+
* await container.runInRequestScope(routerContext, async (requestContainer) => {
|
|
62
|
+
* const i18n = requestContainer.resolve(I18N_TOKEN)
|
|
93
63
|
* })
|
|
94
|
-
* // Cleanup is automatic
|
|
95
64
|
* ```
|
|
96
65
|
*/
|
|
97
66
|
export declare class Container {
|
|
98
67
|
private readonly container;
|
|
99
|
-
private readonly contextStore;
|
|
100
|
-
private readonly env;
|
|
101
|
-
private readonly ctx;
|
|
102
68
|
private readonly isRequestScoped;
|
|
103
69
|
constructor(options: ContainerOptions);
|
|
104
|
-
get logger(): LoggerService;
|
|
105
70
|
/**
|
|
106
71
|
* Register a service with optional explicit token and scope
|
|
107
|
-
*
|
|
108
|
-
* Lifecycle is controlled via the scope parameter, which maps to tsyringe's Lifecycle.
|
|
109
|
-
* If no scope is provided, defaults to Transient (new instance per resolution).
|
|
110
|
-
*
|
|
111
|
-
* @overload register(serviceClass, scope?) - Use class as token
|
|
112
|
-
* @overload register(token, serviceClass, scope?) - Explicit token
|
|
113
|
-
*
|
|
114
|
-
* @example
|
|
115
|
-
* ```typescript
|
|
116
|
-
* container.register(MyService) // Transient by default
|
|
117
|
-
* container.register(MyService, Scope.Singleton) // Singleton
|
|
118
|
-
* container.register(MY_TOKEN, MyService, Scope.Request) // Request-scoped with token
|
|
119
|
-
* ```
|
|
120
72
|
*/
|
|
121
73
|
register<T extends object>(serviceClass: Constructor<T>, scope?: Scope): void;
|
|
122
74
|
register<T extends object>(token: InjectionToken<T>, serviceClass: Constructor<T>, scope?: Scope): void;
|
|
123
75
|
/**
|
|
124
76
|
* Register a service as singleton
|
|
125
|
-
*
|
|
126
|
-
* Passthrough to tsyringe's registerSingleton method.
|
|
127
|
-
*
|
|
128
|
-
* @overload registerSingleton(serviceClass) - Use class as token
|
|
129
|
-
* @overload registerSingleton(token, serviceClass) - Explicit token
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* ```typescript
|
|
133
|
-
* container.registerSingleton(LoggerService) // Uses class as token
|
|
134
|
-
* container.registerSingleton(CONFIG_TOKEN, ConfigService) // Explicit token
|
|
135
|
-
* ```
|
|
136
77
|
*/
|
|
137
78
|
registerSingleton<T extends object>(serviceClass: Constructor<T>): void;
|
|
138
79
|
registerSingleton<T extends object>(token: InjectionToken<T>, serviceClass: Constructor<T>): void;
|
|
139
80
|
/**
|
|
140
81
|
* Register a value (instance) directly
|
|
141
|
-
*
|
|
142
|
-
* Use for registering pre-created instances or primitive values.
|
|
143
|
-
*
|
|
144
|
-
* @param token - DI token for resolution
|
|
145
|
-
* @param value - Value to register
|
|
146
|
-
*
|
|
147
|
-
* @example
|
|
148
|
-
* ```typescript
|
|
149
|
-
* container.registerValue(CONFIG_TOKEN, configInstance)
|
|
150
|
-
* container.registerValue(DI_TOKENS.Application, app)
|
|
151
|
-
* ```
|
|
152
82
|
*/
|
|
153
83
|
registerValue<T>(token: InjectionToken<T>, value: T): void;
|
|
154
84
|
/**
|
|
155
85
|
* Register with factory function
|
|
156
|
-
*
|
|
157
|
-
* Use when instance creation requires custom logic or other resolved dependencies.
|
|
158
|
-
*
|
|
159
|
-
* @param token - DI token for resolution
|
|
160
|
-
* @param factory - Factory function that receives the Container
|
|
161
|
-
*
|
|
162
|
-
* @example
|
|
163
|
-
* ```typescript
|
|
164
|
-
* container.registerFactory(FORMATTER_TOKEN, (c) => {
|
|
165
|
-
* const config = c.resolve(CONFIG_TOKEN)
|
|
166
|
-
* return config.get('logging').formatter === 'pretty'
|
|
167
|
-
* ? new PrettyFormatter()
|
|
168
|
-
* : new JsonFormatter()
|
|
169
|
-
* }, Scope.Singleton)
|
|
170
|
-
* ```
|
|
171
86
|
*/
|
|
172
87
|
registerFactory<T>(token: InjectionToken<T>, factory: (container: Container) => T): void;
|
|
173
88
|
/**
|
|
174
89
|
* Register an alias to an existing token
|
|
175
|
-
*
|
|
176
|
-
* Creates a redirect so that resolving the alias token returns the same
|
|
177
|
-
* instance as the target token. This is useful for:
|
|
178
|
-
* - Interface tokens that alias concrete implementations
|
|
179
|
-
* - Multiple entry points to the same service
|
|
180
|
-
*
|
|
181
|
-
* @param alias - The alias token to register
|
|
182
|
-
* @param target - The target token to redirect to
|
|
183
|
-
*
|
|
184
|
-
* @example Interface abstraction
|
|
185
|
-
* ```typescript
|
|
186
|
-
* // Register concrete implementation
|
|
187
|
-
* container.register(UserService)
|
|
188
|
-
*
|
|
189
|
-
* // Create alias for interface token
|
|
190
|
-
* container.registerExisting(I_USER_SERVICE, UserService)
|
|
191
|
-
*
|
|
192
|
-
* // Both resolve to the same instance
|
|
193
|
-
* const a = container.resolve(UserService)
|
|
194
|
-
* const b = container.resolve(I_USER_SERVICE)
|
|
195
|
-
* // a === b (same instance)
|
|
196
|
-
* ```
|
|
197
90
|
*/
|
|
198
91
|
registerExisting<T>(alias: InjectionToken<T>, target: InjectionToken<T>): void;
|
|
199
92
|
/**
|
|
200
93
|
* Resolve a service from the container
|
|
201
|
-
*
|
|
202
|
-
* @param token - DI token for the service
|
|
203
|
-
* @returns Resolved service instance
|
|
204
|
-
*
|
|
205
|
-
* @example
|
|
206
|
-
* ```typescript
|
|
207
|
-
* const logger = container.resolve(LOGGER_TOKEN)
|
|
208
|
-
* const config = container.resolve<IConfigService>(CONFIG_TOKEN)
|
|
209
|
-
* ```
|
|
210
94
|
*/
|
|
211
95
|
resolve<T>(token: InjectionToken<T>): T;
|
|
212
96
|
/**
|
|
213
97
|
* Check if a token is registered
|
|
214
|
-
*
|
|
215
|
-
* @param token - DI token to check
|
|
216
|
-
* @returns true if token is registered
|
|
217
98
|
*/
|
|
218
99
|
isRegistered<T>(token: InjectionToken<T>): boolean;
|
|
219
100
|
/**
|
|
220
101
|
* Start a conditional binding with predicate evaluation
|
|
221
|
-
*
|
|
222
|
-
* Creates a fluent builder for registering a service that chooses between
|
|
223
|
-
* two implementations based on a predicate evaluated at resolution time.
|
|
224
|
-
*
|
|
225
|
-
* @param predicate - Function that returns true/false to determine implementation.
|
|
226
|
-
* Receives a container with `resolve()` method for resolving dependencies.
|
|
227
|
-
* @param options - Optional configuration (cache: whether to cache predicate result)
|
|
228
|
-
* @returns Fluent builder for specifying token and implementations
|
|
229
|
-
*
|
|
230
|
-
* @example Environment-based implementation selection
|
|
231
|
-
* ```typescript
|
|
232
|
-
* container
|
|
233
|
-
* .when((c) => c.resolve(CONFIG_TOKEN).get('env') === 'development')
|
|
234
|
-
* .use(FORMATTER_TOKEN)
|
|
235
|
-
* .give(PrettyFormatter)
|
|
236
|
-
* .otherwise(JsonFormatter)
|
|
237
|
-
* ```
|
|
238
|
-
*
|
|
239
|
-
* @example Feature flag with cached predicate
|
|
240
|
-
* ```typescript
|
|
241
|
-
* container
|
|
242
|
-
* .when((c) => c.resolve(FEATURE_FLAGS_TOKEN).isEnabled('newPaymentGateway'), { cache: true })
|
|
243
|
-
* .use(PAYMENT_TOKEN)
|
|
244
|
-
* .give(StripePaymentService)
|
|
245
|
-
* .otherwise(LegacyPaymentService)
|
|
246
|
-
* ```
|
|
247
102
|
*/
|
|
248
103
|
when(predicate: (container: PredicateContainer) => boolean, options?: WhenOptions): ConditionalBindingBuilder;
|
|
249
104
|
/**
|
|
250
105
|
* Replace a service registration with a decorated version
|
|
251
|
-
*
|
|
252
|
-
* Resolves the current instance, applies the decorator, and re-registers
|
|
253
|
-
* the decorated instance. This is a one-time operation at initialization time.
|
|
254
|
-
*
|
|
255
|
-
* **IMPORTANT:** This method can only be used in a module's `onInitialize()` method.
|
|
256
|
-
* The `onInitialize()` hook runs after all modules have registered their services
|
|
257
|
-
* via the `@Module` decorator, ensuring all dependencies are available for resolution.
|
|
258
|
-
*
|
|
259
|
-
* @param token - DI token of the service to extend
|
|
260
|
-
* @param decorator - Function that receives the service and returns decorated version
|
|
261
|
-
*
|
|
262
|
-
* @example Add logging to database service (in onInitialize)
|
|
263
|
-
* ```typescript
|
|
264
|
-
* // In your module's onInitialize() method:
|
|
265
|
-
* import type { OnInitialize, ModuleContext } from 'stratal/module'
|
|
266
|
-
*
|
|
267
|
-
* @Module({ providers: [...] })
|
|
268
|
-
* export class MyModule implements OnInitialize {
|
|
269
|
-
* onInitialize({ container }: ModuleContext): void {
|
|
270
|
-
* container.extend(DI_TOKENS.Database, (db, c) => {
|
|
271
|
-
* const logger = c.resolve(LOGGER_TOKENS.LoggerService)
|
|
272
|
-
* return new LoggingDatabaseDecorator(db, logger)
|
|
273
|
-
* })
|
|
274
|
-
* }
|
|
275
|
-
* }
|
|
276
|
-
* // DI_TOKENS.Database now resolves to LoggingDatabaseDecorator
|
|
277
|
-
* ```
|
|
278
|
-
*
|
|
279
|
-
* @example Chain multiple decorators
|
|
280
|
-
* ```typescript
|
|
281
|
-
* // In onInitialize()
|
|
282
|
-
* container.extend(SERVICE_TOKEN, (svc) => new LoggingDecorator(svc))
|
|
283
|
-
* container.extend(SERVICE_TOKEN, (svc) => new CachingDecorator(svc))
|
|
284
|
-
* // SERVICE_TOKEN now resolves to CachingDecorator(LoggingDecorator(original))
|
|
285
|
-
* ```
|
|
286
106
|
*/
|
|
287
107
|
extend<T>(token: InjectionToken<T>, decorator: ExtensionDecorator<T>): void;
|
|
288
|
-
/**
|
|
289
|
-
* Check if currently in request context
|
|
290
|
-
*
|
|
291
|
-
* @returns true if in request context (inside runInRequestScope or runWithContextStore)
|
|
292
|
-
*/
|
|
293
|
-
isInRequestContext(): boolean;
|
|
294
108
|
/**
|
|
295
109
|
* Run callback within request scope
|
|
296
110
|
*
|
|
297
111
|
* Creates a child container with fresh instances for services registered with `scope: Scope.Request`.
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
* Also wraps with RequestContextStore for Zod i18n validation support.
|
|
112
|
+
* Callback receives the request-scoped container as argument.
|
|
301
113
|
*
|
|
302
114
|
* Can only be called on global container (not request-scoped).
|
|
303
|
-
*
|
|
304
|
-
* @param routerContext - RouterContext for the current request
|
|
305
|
-
* @param callback - Async operation to run with request context
|
|
306
|
-
* @returns Result of callback execution
|
|
307
|
-
*
|
|
308
|
-
* @example
|
|
309
|
-
* ```typescript
|
|
310
|
-
* await container.runInRequestScope(routerContext, async () => {
|
|
311
|
-
* const i18n = container.resolve(I18N_TOKEN)
|
|
312
|
-
* const message = i18n.t('common.welcome')
|
|
313
|
-
* // ...
|
|
314
|
-
* })
|
|
315
|
-
* ```
|
|
316
115
|
*/
|
|
317
|
-
runInRequestScope<T>(routerContext: RouterContext, callback: () => T | Promise<T>): Promise<T>;
|
|
116
|
+
runInRequestScope<T>(routerContext: RouterContext, callback: (requestContainer: Container) => T | Promise<T>): Promise<T>;
|
|
318
117
|
/**
|
|
319
118
|
* Create request scope container
|
|
320
119
|
*
|
|
321
|
-
* Use when you need manual control over the request container lifecycle,
|
|
322
|
-
* typically in middleware. Returns a new Container instance wrapping
|
|
323
|
-
* a request-scoped child container.
|
|
324
|
-
*
|
|
325
120
|
* Can only be called on global container (not request-scoped).
|
|
326
|
-
*
|
|
327
|
-
* @param routerContext - RouterContext for the current request
|
|
328
|
-
* @returns Request-scoped Container instance
|
|
329
|
-
*
|
|
330
|
-
* @example
|
|
331
|
-
* ```typescript
|
|
332
|
-
* const reqContainer = container.createRequestScope(routerContext)
|
|
333
|
-
* await reqContainer.runWithContextStore(async () => {
|
|
334
|
-
* // use reqContainer...
|
|
335
|
-
* })
|
|
336
|
-
* // Cleanup is automatic
|
|
337
|
-
* ```
|
|
338
121
|
*/
|
|
339
122
|
createRequestScope(routerContext: RouterContext): Container;
|
|
340
|
-
/**
|
|
341
|
-
* Run callback within request scope context store
|
|
342
|
-
*
|
|
343
|
-
* Wraps callback with RequestContextStore (for Zod i18n validation)
|
|
344
|
-
* and automatically handles cleanup after callback completes.
|
|
345
|
-
*
|
|
346
|
-
* Can only be called on request-scoped container (not global).
|
|
347
|
-
*
|
|
348
|
-
* @param callback - Async operation to run with context
|
|
349
|
-
* @returns Result of callback execution
|
|
350
|
-
*
|
|
351
|
-
* @example
|
|
352
|
-
* ```typescript
|
|
353
|
-
* const reqContainer = container.createRequestScope(routerContext)
|
|
354
|
-
* await reqContainer.runWithContextStore(async () => {
|
|
355
|
-
* const i18n = reqContainer.resolve(I18N_TOKENS.I18nService)
|
|
356
|
-
* // ...
|
|
357
|
-
* })
|
|
358
|
-
* // Cleanup is automatic
|
|
359
|
-
* ```
|
|
360
|
-
*/
|
|
361
|
-
runWithContextStore<T>(callback: () => T | Promise<T>): Promise<T>;
|
|
362
123
|
/**
|
|
363
124
|
* Get underlying tsyringe container
|
|
364
|
-
*
|
|
365
|
-
* Use sparingly - prefer Container methods for most operations.
|
|
366
|
-
* Useful for advanced scenarios or compatibility with existing code.
|
|
367
|
-
* @returns The underlying DependencyContainer
|
|
368
125
|
*/
|
|
369
126
|
getTsyringeContainer(): DependencyContainer;
|
|
370
|
-
/**
|
|
371
|
-
* Get current request container from context store (if in request context)
|
|
372
|
-
* @deprecated Use container.runWithContextStore() instead
|
|
373
|
-
* @returns Request container if in request context, undefined otherwise
|
|
374
|
-
*/
|
|
375
|
-
getRequestContainer(): DependencyContainer | undefined;
|
|
376
|
-
/**
|
|
377
|
-
* Create request child container with RouterContext registered
|
|
378
|
-
*
|
|
379
|
-
* Services registered with `scope: Scope.Request` will automatically get fresh instances
|
|
380
|
-
* in the child container. RouterContext is registered so services can inject it for
|
|
381
|
-
* request-specific data.
|
|
382
|
-
*/
|
|
383
|
-
private createRequestChildContainer;
|
|
384
|
-
/**
|
|
385
|
-
* Cleanup request container resources.
|
|
386
|
-
* This is called after each request.
|
|
387
|
-
*/
|
|
388
|
-
private cleanupRequestContainer;
|
|
389
127
|
dispose(): void | Promise<void>;
|
|
390
128
|
}
|
|
391
|
-
export { container, inject, injectable, singleton } from 'tsyringe';
|
|
129
|
+
export { container, delay, inject, injectable, singleton } from 'tsyringe';
|
|
392
130
|
export type { DependencyContainer } from 'tsyringe';
|
|
393
131
|
//# sourceMappingURL=container.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/di/container.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,KAAK,mBAAmB,EAAkB,MAAM,UAAU,CAAA;AACnE,OAAO,KAAK,cAAc,MAAM,iDAAiD,CAAA;AACjF,OAAO,
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/di/container.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,KAAK,mBAAmB,EAAkB,MAAM,UAAU,CAAA;AACnE,OAAO,KAAK,cAAc,MAAM,iDAAiD,CAAA;AACjF,OAAO,KAAK,EAAE,aAA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