@adimm/x-injection 0.8.0 → 1.1.6

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/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { BindingActivation, BindingDeactivation, BindingConstraints, Container, BindingScope, BindToFluentSyntax, GetOptions, IsBoundOptions, injectFromBase, MetadataName, MetadataTag, ServiceIdentifier } from 'inversify';
2
- import { Class, Except } from 'type-fest';
1
+ import { BindingActivation, BindingDeactivation, BindingConstraints, Container, BindToFluentSyntax, GetOptions, IsBoundOptions, BindingScope, injectFromBase, MetadataName, MetadataTag, ServiceIdentifier } from 'inversify';
2
+ import { Class, RequireAtLeastOne, Except } from 'type-fest';
3
3
 
4
4
  /** The identifier of the `GlobalAppModule`. */
5
5
  declare const GLOBAL_APP_MODULE_ID = "GlobalAppModule";
@@ -95,254 +95,6 @@ interface ProviderScopeOption {
95
95
  scope?: InjectionScope;
96
96
  }
97
97
 
98
- /**
99
- * Class containing an internal set of `utils`.
100
- *
101
- * Each {@link IProviderModuleNaked.moduleUtils | ProviderModule} instance has its own {@link ProviderModuleUtils} property instance.
102
- */
103
- declare class ProviderModuleUtils {
104
- /** The low-level InversifyJS {@link Container} owned by {@link ProviderModuleUtils.module | module}. */
105
- get container(): Container;
106
- /** The parent {@link IProviderModule | ProviderModule} of `this` instance. */
107
- readonly module: IProviderModule;
108
- readonly moduleNaked: IProviderModuleNaked;
109
- private readonly appModule;
110
- constructor(module: IProviderModule, internalOptions: ProviderModuleOptionsInternal);
111
- /**
112
- * Low-level method which can be used to manually register _(bind)_ a new {@link provider} into the {@link ProviderModuleUtils.module | module} container.
113
- *
114
- * **Note:** _You shouldn't directly use this to register providers as they will not appear_
115
- * _into the module's `imports` and `exports` arrays! Therefore leading to unexpected bugs and confusion!_
116
- *
117
- * @param provider The {@link ProviderToken | provider} to register.
118
- * @param defaultScope Optionally provide the default {@link InjectionScope} to use when applicable.
119
- * @returns `true` when the {@link provider} has been bound otherwhise `false`.
120
- */
121
- bindToContainer<T>(provider: DependencyProvider<T>, defaultScope: InjectionScope): boolean;
122
- private checkIfShouldBeAddedToTheGlobalRegister;
123
- private bindSelfTokenToContainer;
124
- private bindClassTokenToContainer;
125
- private bindValueTokenToContainer;
126
- private bindFactoryTokenToContainer;
127
- /** Sets the {@link InjectionScope} of a bound {@link provider}. */
128
- private setBindingScope;
129
- /** Sets the `when` clause of a bound {@link provider}. */
130
- private setWhenBinding;
131
- /** Sets the `activation` and `deactivation` events of a bound {@link provider}. */
132
- private setBindingOnEvent;
133
- }
134
-
135
- /** Can be used to publicly expose internal properties and methods of an {@link IProviderModule} instance. */
136
- interface IProviderModuleNaked extends IProviderModule {
137
- /** It'll be true when the current module is the global `AppModule`. */
138
- readonly isAppModule: boolean;
139
- /** The low-level `InversifyJS` {@link https://inversify.io/docs/api/container/ | container} instance. */
140
- readonly container: Container;
141
- /** The default injection scope of this module. */
142
- readonly defaultScope: {
143
- /** Scope from `xInjection` {@link InjectionScope} enum. */
144
- native: InjectionScope;
145
- /** Scope from `InversifyJS` {@link BindingScope} string union. */
146
- inversify: BindingScope;
147
- };
148
- /** Instance of the {@link ProviderModuleUtils}. */
149
- readonly moduleUtils: ProviderModuleUtils;
150
- /** The {@link DependencyProvider | providers} resolved by this module. */
151
- readonly providers: DependencyProvider[];
152
- /**
153
- * The imported {@link DependencyProvider | providers} resolved by this module.
154
- *
155
- * _It is a `dictionary` where the key is the {@link IProviderModule | module} and the value an_
156
- * _array containing the imported dependencies from that module_
157
- */
158
- readonly importedProviders: Map<IProviderModuleNaked, DependencyProvider[]>;
159
- /** What is exported from this module. */
160
- readonly exports: StaticExports;
161
- /** What is exported into this module. */
162
- readonly imports: (IProviderModuleNaked | (() => IProviderModuleNaked))[];
163
- /** The module dynamic exports method. */
164
- readonly dynamicExports: DynamicExports | undefined;
165
- /** The registered `callback` which will be invoked when the internal initialization process has been completed. */
166
- readonly onReady: ProviderModuleOptions['onReady'];
167
- /** The registered `callback` which will be invoked when the {@link _dispose} method is invoked. */
168
- readonly onDispose: ProviderModuleOptions['onDispose'];
169
- /** Can be used to override all the _imported_ providers _before_ the binding process. */
170
- readonly importedProvidersMap: ProviderModuleOptionsInternal['importedProvidersMap'];
171
- readonly registeredSideEffects: RegisteredSideEffects;
172
- /** It'll _completely_ re-init the `module` with the provided {@link LazyInitOptions | options}. */
173
- _lazyInit(options: LazyInitOptions): IProviderModule;
174
- /** Can be used to get the list of all the imported modules of this module. */
175
- _getImportedModules(): IProviderModuleNaked[];
176
- /** Can be used to get the list of all the providers of this module. */
177
- _getProviders(): DependencyProvider[];
178
- /** Can be used to get the list of all the exportable modules and providers of this module. */
179
- _getExportableModulesAndProviders(): StaticExports;
180
- /**
181
- * Can be used to execute the provided {@link cb | callback} whenever a _new_ {@link https://inversify.io/docs/fundamentals/binding/ | binding}
182
- * is registered for the {@link provider}.
183
- *
184
- * @param provider The {@link ProviderToken}.
185
- * @param cb The `callback` to be invoked.
186
- */
187
- _onBind<T>(provider: ProviderToken<T>, cb: () => Promise<void> | void): void;
188
- /**
189
- * Can be used to execute the provided {@link cb | callback} whenever the
190
- * {@link IProviderModule.get | get} method is invoked.
191
- *
192
- * @param provider The {@link ProviderToken}.
193
- * @param once When set to `true` it'll invoke the provided {@link cb | callback} only once.
194
- * @param cb The `callback` to be invoked.
195
- */
196
- _onGet<T>(provider: ProviderToken<T>, once: boolean, cb: () => Promise<void> | void): void;
197
- /**
198
- * Can be used to execute the provided {@link cb | callback} whenever an existing {@link https://inversify.io/docs/fundamentals/binding/ | binding}
199
- * is re-registered for the {@link provider}.
200
- *
201
- * @param provider The {@link ProviderToken}.
202
- * @param cb The `callback` to be invoked.
203
- */
204
- _onRebind<T>(provider: ProviderToken<T>, cb: () => Promise<void> | void): void;
205
- /**
206
- * Can be used to execute the provided {@link cb | callback} whenever a {@link provider} is `unbound`.
207
- *
208
- * **Note:** _All the {@link _onBind}, {@link _onGet}, {@link _onRebind} and {@link _onUnbind} registered callbacks will be removed_
209
- *
210
- * @param provider The {@link ProviderToken}.
211
- * @param cb The `callback` to be invoked.
212
- */
213
- _onUnbind<T>(provider: ProviderToken<T>, cb: () => Promise<void> | void): void;
214
- /**
215
- * Internal method which can be used to completely overwrite the module {@link container}
216
- * with the one provided.
217
- *
218
- * @param cb Callback which when invoked must return an instance of the {@link Container}.
219
- */
220
- _overwriteContainer(cb: () => Container): void;
221
- /**
222
- * Binds a {@link ProviderToken | provider}.
223
- *
224
- * See {@link https://inversify.io/docs/api/container/#bind | Container.bind} for more details.
225
- */
226
- __bind<T>(provider: ProviderToken<T>): BindToFluentSyntax<T>;
227
- /**
228
- * Resolves a dependency by its runtime identifier.
229
- * The runtime identifier must be associated with only one binding and the binding must be synchronously resolved,
230
- * otherwise an error is thrown.
231
- *
232
- * @param provider The {@link ProviderToken}.
233
- * @param options The {@link GetOptions}.
234
- * @returns Either the {@link T | dependency} or `undefined` if {@link GetOptions.optional} is set to `true`.
235
- *
236
- * See {@link https://inversify.io/docs/api/container/#get | Container.get} for more details.
237
- */
238
- __get<T>(provider: ProviderToken<T>, options?: GetOptions): T;
239
- /**
240
- * Resolves a dependency by its runtime identifier.
241
- * The runtime identifier must be associated with only one binding,
242
- * otherwise an error is thrown.
243
- *
244
- * @param provider The {@link ProviderToken}.
245
- * @param options The {@link GetOptions}.
246
- * @returns Either the {@link T | dependency} or `undefined` if {@link GetOptions.optional} is set to `true`.
247
- *
248
- * See {@link https://inversify.io/docs/api/container/#getasync | Container.getAsync} for more details.
249
- */
250
- __getAsync<T>(provider: ProviderToken<T>, options?: GetOptions): Promise<T>;
251
- /** See {@link https://inversify.io/docs/api/container/#getall | Container.getAll} for more details. */
252
- __getAll<T>(provider: ProviderToken<T>, options?: GetOptions): T[];
253
- /** See {@link https://inversify.io/docs/api/container/#getallasync | Container.getAllAsync} for more details. */
254
- __getAllAsync<T>(provider: ProviderToken<T>, options?: GetOptions): Promise<T[]>;
255
- /**
256
- * Can be used to check if there are registered bindings for the {@link provider | provider}.
257
- *
258
- * See {@link https://inversify.io/docs/api/container/#isbound | Container.isBound} for more details.
259
- */
260
- __isBound(provider: ProviderToken, options?: IsBoundOptions): boolean;
261
- /**
262
- * Can be useed to check if there are registered bindings for the {@link provider | provider} only in the current container.
263
- *
264
- * See {@link https://inversify.io/docs/api/container/#iscurrentbound | Container.isCurrentBound} for more details.
265
- */
266
- __isCurrentBound(provider: ProviderToken, options?: IsBoundOptions): boolean;
267
- /**
268
- * Save the state of the container to be later restored with the restore method.
269
- *
270
- * See {@link https://inversify.io/docs/api/container/#snapshot | Container.snapshot} for more details.
271
- */
272
- __takeSnapshot(): void;
273
- /**
274
- * Restore container state to last snapshot.
275
- *
276
- * See {@link https://inversify.io/docs/api/container/#restore | Container.restore} for more details.
277
- */
278
- __restoreSnapshot(): void;
279
- /**
280
- * Convenience method that unbinds a {@link ProviderToken | provider} and then creates a new binding for it.
281
- * This is equivalent to calling await `container.unbind` followed by `container.bind`, but in a single method.
282
- *
283
- * @param provider The {@link ProviderToken}.
284
- * @returns A {@link BindToFluentSyntax | binding builder} to continue configuring the new binding.
285
- *
286
- * See {@link https://inversify.io/docs/api/container/#rebind | Container.rebind} for more details.
287
- */
288
- __rebind<T>(provider: ProviderToken<T>): Promise<BindToFluentSyntax<T>>;
289
- /**
290
- * Synchronous version of {@link __rebindProvider}. Unbinds a {@link ProviderToken | provider} synchronously and then creates a new binding for it.
291
- * Will throw an error if the unbind operation would be asynchronous.
292
- *
293
- * @param provider The {@link ProviderToken}.
294
- * @returns A {@link BindToFluentSyntax | binding builder} to continue configuring the new binding.
295
- *
296
- * See {@link https://inversify.io/docs/api/container/#rebindsync | Container.rebindSync} for more details.
297
- */
298
- __rebindSync<T>(provider: ProviderToken<T>): BindToFluentSyntax<T>;
299
- /**
300
- * Removes **all** the associated bindings with the {@link provider} from the container.
301
- *
302
- * This will result in the {@link https://inversify.io/docs/fundamentals/lifecycle/deactivation/ | deactivation process}.
303
- *
304
- * See {@link https://inversify.io/docs/api/container/#unbind | Container.unbind} for more details.
305
- */
306
- __unbind(provider: ProviderToken): Promise<void>;
307
- /**
308
- * Removes **all** the associated bindings with the {@link provider} from the container synchronously.
309
- * This method works like {@link __unbind} but does not return a Promise.
310
- * If the unbinding operation would be asynchronous (e.g. due to deactivation handlers),
311
- * it will throw an error. Use this method when you know the operation won't involve async deactivations.
312
- *
313
- * This will result in the {@link https://inversify.io/docs/fundamentals/lifecycle/deactivation/ | deactivation process}.
314
- *
315
- * See {@link https://inversify.io/docs/api/container/#unbindsync | Container.unbindSync} for more details.
316
- */
317
- __unbindSync(provider: ProviderToken): void;
318
- /**
319
- * Remove all bindings bound in this container.
320
- *
321
- * This will result in the {@link https://inversify.io/docs/fundamentals/lifecycle/deactivation/ | deactivation process}.
322
- *
323
- * See {@link https://inversify.io/docs/api/container/#unbindall | Container.unbindAll} for more details.
324
- */
325
- __unbindAll(): Promise<void>;
326
- }
327
- type LazyInitOptions = Except<ProviderModuleOptions & ProviderModuleOptionsInternal, 'identifier' | 'isAppModule'>;
328
- type RegisteredSideEffects = Map<ProviderToken, {
329
- onBindEffects: OnBindEffects[];
330
- onGetEffects: OnGetEffects[];
331
- onRebindEffects: OnRebindEffects[];
332
- onUnbindEffects: OnUnbindEffects[];
333
- }>;
334
- type OnBindEffects = () => Promise<void> | void;
335
- type OnGetEffects = {
336
- once: boolean;
337
- invoked: boolean;
338
- cb: () => Promise<void> | void;
339
- };
340
- type OnRebindEffects = () => Promise<void> | void;
341
- type OnUnbindEffects = {
342
- registerModule?: symbol;
343
- cb: () => Promise<void> | void;
344
- };
345
-
346
98
  /**
347
99
  * The low-level App Container.
348
100
  *
@@ -356,6 +108,8 @@ declare const GlobalContainer: Container;
356
108
  *
357
109
  * _See {@link ProviderModuleOptions | ProviderModuleOptions}_.
358
110
  *
111
+ * **Note:** _Check also the {@link IProviderModuleDefinition}._
112
+ *
359
113
  * @example
360
114
  * ```ts
361
115
  * const EngineModule = new ProviderModule({
@@ -408,63 +162,40 @@ declare const GlobalContainer: Container;
408
162
  * ```
409
163
  */
410
164
  declare class ProviderModule implements IProviderModule {
411
- readonly identifier: symbol;
412
- readonly isMarkedAsGlobal: boolean;
413
- readonly isDisposed: boolean;
414
- protected readonly isAppModule: boolean;
415
- protected readonly container: Container;
416
- protected readonly defaultScope: IProviderModuleNaked['defaultScope'];
417
- protected readonly dynamicExports: IProviderModuleNaked['dynamicExports'];
418
- protected readonly onReady: IProviderModuleNaked['onReady'];
419
- protected readonly onDispose: IProviderModuleNaked['onDispose'];
420
- protected readonly importedProvidersMap: IProviderModuleNaked['importedProvidersMap'];
421
- protected readonly moduleUtils: IProviderModuleNaked['moduleUtils'];
422
- protected readonly imports: IProviderModuleNaked['imports'];
423
- protected readonly providers: IProviderModuleNaked['providers'];
424
- protected readonly importedProviders: IProviderModuleNaked['importedProviders'];
425
- protected readonly exports: IProviderModuleNaked['exports'];
426
- protected readonly registeredSideEffects: IProviderModuleNaked['registeredSideEffects'];
427
- constructor({ identifier, imports, providers, exports, defaultScope, markAsGlobal, dynamicExports, onReady, onDispose, ..._internalParams }: ProviderModuleOptions);
165
+ isDisposed: boolean;
166
+ readonly identifier: ModuleIdentifier;
167
+ isMarkedAsGlobal: boolean;
168
+ protected isAppModule: boolean;
169
+ protected container: Container;
170
+ protected defaultScope: IProviderModuleNaked['defaultScope'];
171
+ protected onReady: IProviderModuleNaked['onReady'];
172
+ protected onDispose: IProviderModuleNaked['onDispose'];
173
+ protected moduleUtils: IProviderModuleNaked['moduleUtils'];
174
+ protected imports: IProviderModuleNaked['imports'];
175
+ protected providers: IProviderModuleNaked['providers'];
176
+ protected exports: IProviderModuleNaked['exports'];
177
+ protected registeredSideEffects: IProviderModuleNaked['registeredSideEffects'];
178
+ constructor(options: ProviderModuleOptions | IProviderModuleDefinition);
428
179
  get<T>(provider: ProviderToken<T>, isOptional?: boolean): T;
429
180
  getMany<D extends (ProviderModuleGetManyParam<any> | ProviderToken)[]>(...deps: D | unknown[]): ProviderModuleGetManySignature<D>;
181
+ lazyImport(...modules: ProviderModuleOrDefinition[]): void;
430
182
  toNaked(): IProviderModuleNaked;
431
- clone(options?: Partial<ProviderModuleOptions>): IProviderModule;
432
183
  dispose(): Promise<void>;
433
184
  toString(): string;
434
185
  private setIdentifier;
435
186
  private prepareContainer;
436
187
  private injectImportedModules;
437
188
  private injectProviders;
438
- private onUnbindInternal;
439
- private registerBindingSideEffect;
440
- private invokeRegisteredBindingSideEffects;
441
- private removeRegisteredBindingSideEffects;
442
- private removeOnUnbindEffectsFromImportedModule;
189
+ private registerSideEffect;
190
+ private invokeRegisteredSideEffects;
191
+ private removeRegisteredSideEffects;
443
192
  private shouldThrowIfDisposed;
444
193
  /**
445
194
  * **Publicly visible when the instance is casted to {@link IProviderModuleNaked}.**
446
195
  *
447
- * See {@link IProviderModuleNaked._lazyInit}.
448
- */
449
- protected _lazyInit({ markAsGlobal, imports, providers, exports, defaultScope, dynamicExports, onReady, onDispose, ..._internalParams }: LazyInitOptions): IProviderModule;
450
- /**
451
- * **Publicly visible when the instance is casted to {@link IProviderModuleNaked}.**
452
- *
453
- * See {@link IProviderModuleNaked._getImportedModules}.
454
- */
455
- protected _getImportedModules(): (IProviderModuleNaked | (() => IProviderModuleNaked))[];
456
- /**
457
- * **Publicly visible when the instance is casted to {@link IProviderModuleNaked}.**
458
- *
459
- * See {@link IProviderModuleNaked._getProviders}.
460
- */
461
- protected _getProviders(): DependencyProvider[];
462
- /**
463
- * **Publicly visible when the instance is casted to {@link IProviderModuleNaked}.**
464
- *
465
- * See {@link IProviderModuleNaked._getExportableModulesAndProviders}.
196
+ * See {@link IProviderModuleNaked._internalInit}.
466
197
  */
467
- protected _getExportableModulesAndProviders(): StaticExports;
198
+ protected _internalInit(options: InternalInitOptions | IProviderModuleDefinition): IProviderModule;
468
199
  /**
469
200
  * **Publicly visible when the instance is casted to {@link IProviderModuleNaked}.**
470
201
  *
@@ -587,6 +318,7 @@ declare class ProviderModule implements IProviderModule {
587
318
  * **You shouldn't initialize a new instance of this class, please use the {@link AppModule} instance!**
588
319
  */
589
320
  declare class GlobalAppModule extends ProviderModule implements IAppModule {
321
+ _strict: AppModuleOptions['_strict'];
590
322
  private nakedModule;
591
323
  private isLoaded;
592
324
  constructor();
@@ -612,27 +344,68 @@ declare class GlobalAppModule extends ProviderModule implements IAppModule {
612
344
  */
613
345
  declare const AppModule: GlobalAppModule;
614
346
 
615
- interface ProviderModuleOptions {
616
- /** The module unique ID. */
617
- identifier: symbol;
618
- /** The list of imported {@link IProviderModule | modules} that export the {@link Provider | providers} which are required in this module. */
619
- imports?: (IProviderModule | (() => IProviderModule))[];
620
- /** The {@link DependencyProvider | providers} that will be instantiated by the container and that may be shared at least across this module. */
621
- providers?: DependencyProvider[];
622
- /**
623
- * The subset of {@link ProviderToken | providers} or {@link IProviderModule | modules} that
624
- * are provided by this module and should be available in other modules which import this module.
625
- *
626
- * _Check also the {@link dynamicExports} property._
627
- */
628
- exports?: StaticExports;
629
- /**
630
- * The default {@link InjectionScope} to be used when a {@link ProviderToken} does not have a defined `scope`.
631
- *
632
- * Defaults to {@link InjectionScope.Singleton}.
633
- */
634
- defaultScope?: InjectionScope;
635
- /**
347
+ /**
348
+ * Can be used when you _don't_ want to initialize a `ProviderModule` eagerly as each `ProviderModule` has its own _(InversifyJS)_ container
349
+ * initialized as soon as you do `new ProviderModule({...})`.
350
+ *
351
+ * The {@link ProviderModuleDefinition} allows you to just _define_ the `ProviderModule` options so you can _import_ it later into different modules.
352
+ *
353
+ * You can always edit a property of the definition after instantiation by doing:
354
+ *
355
+ * ```ts
356
+ * const GarageModuleDefinition = new ProviderModuleDefinition({ identifier: 'GarageModuleDefinition' });
357
+ *
358
+ * // Later in your code
359
+ *
360
+ * GarageModuleDefinition.imports = [...GarageModuleDefinition.imports, PorscheModule, FerrariModuleDefinition];
361
+ *
362
+ * // ...
363
+ *
364
+ * const GarageModule = new ProviderModule(GarageModuleDefinition);
365
+ *
366
+ * // or
367
+ *
368
+ * ExistingModule.lazyImport(GarageModuleDefinition);
369
+ * ```
370
+ *
371
+ * **Note:** _This means that you can't expect to be able to inject dependencies from a {@link ProviderModuleDefinition}_
372
+ * _as how you would do with an instance of a `ProviderModule`._
373
+ */
374
+ declare class ProviderModuleDefinition implements IProviderModuleDefinition {
375
+ identifier: IProviderModuleDefinition['identifier'];
376
+ imports: IProviderModuleDefinition['imports'];
377
+ providers: IProviderModuleDefinition['providers'];
378
+ exports: IProviderModuleDefinition['exports'];
379
+ defaultScope: IProviderModuleDefinition['defaultScope'];
380
+ markAsGlobal: IProviderModuleDefinition['markAsGlobal'];
381
+ onReady: IProviderModuleDefinition['onReady'];
382
+ onDispose: IProviderModuleDefinition['onDispose'];
383
+ constructor(moduleOptions: ProviderModuleOptions);
384
+ getDefinition(): ProviderModuleOptions;
385
+ toString(): string;
386
+ }
387
+
388
+ interface ProviderModuleOptions {
389
+ /** The module unique `ID`. */
390
+ identifier: symbol | string;
391
+ /** Import additional {@link IProviderModule | modules} into _this_ module. */
392
+ imports?: ProviderModuleOrDefinition[];
393
+ /** The {@link DependencyProvider | providers} that will be instantiated by the container and that may be shared at least across _this_ module. */
394
+ providers?: DependencyProvider[];
395
+ /**
396
+ * The subset of {@link ProviderToken | providers} or {@link IProviderModule | modules} that
397
+ * are provided by _this_ module and should be available in other modules which import _this_ module.
398
+ *
399
+ * **Note:** _Supports lazy exports, see {@link LazyExport}._
400
+ */
401
+ exports?: ExportsList;
402
+ /**
403
+ * The default {@link InjectionScope} to be used when a {@link ProviderToken} does not have a defined `scope`.
404
+ *
405
+ * Defaults to {@link InjectionScope.Singleton}.
406
+ */
407
+ defaultScope?: InjectionScope;
408
+ /**
636
409
  * This option is only a _marker_, per se it doesn't do anything
637
410
  * apart from marking this module as `global`.
638
411
  * When a module is marked as `global`, it means that it is expected to be _imported_ into the `AppModule`.
@@ -644,46 +417,6 @@ interface ProviderModuleOptions {
644
417
  * Defaults to `false`.
645
418
  */
646
419
  markAsGlobal?: boolean;
647
- /**
648
- * When provided, can be used to control which providers from the {@link ProviderModuleOptions.exports | exports}
649
- * array should actually be exported into the importing module.
650
- *
651
- * **Note:** _Static {@link ProviderModuleOptions.exports | exports} should always be preferred as their static nature implies predictibility._
652
- * _This is for advanced use cases only, and most probably you may never need to use a dynamic export!_
653
- *
654
- * @example
655
- * ```ts
656
- * {
657
- * exports: [ConfigModule, UserModule, PaymentService, ReviewService],
658
- * dynamicExports: (importerModule, moduleExports) => {
659
- * const shouldExportOnlyTheServices = true;
660
- *
661
- * if (shouldExportOnlyTheServices === false) return moduleExports;
662
- *
663
- * return moduleExports.flatMap((ex) => {
664
- * // With `flatMap` we can map and filter out elements
665
- * // from the sequence at the same time
666
- * // by returning an empty array.
667
- * return ex instanceof ProviderModule ? [] : ex;
668
- * });
669
- * }
670
- * }
671
- *
672
- * // Or
673
- *
674
- * {
675
- * exports: [ConfigModule, UserModule, PaymentService, ReviewService],
676
- * dynamicExports: (importerModule, moduleExports) => {
677
- * // We export all the providers only when the importer module is not the `BULLIED_MODULE`.
678
- * if (importerModule.toNaked().name !== 'BULLIED_MODULE') return moduleExports;
679
- *
680
- * return [ConfigModule];
681
- * }
682
- * }
683
- *
684
- * ```
685
- */
686
- dynamicExports?: DynamicExports;
687
420
  /**
688
421
  * Callback which will be invoked once the module container has been initialized
689
422
  * and the providers resolved.
@@ -694,13 +427,11 @@ interface ProviderModuleOptions {
694
427
  */
695
428
  onReady?: (module: IProviderModule) => Promise<void>;
696
429
  /**
697
- * Callback which will be invoked whenever the internal module dispose method is invoked.
698
- *
699
- * **The method will be invoked right _before_ the clean-up process.**
430
+ * Callback which will be invoked when the module dispose method is invoked.
700
431
  *
701
- * @param module The instance of the {@link IProviderModule | module}.
432
+ * @returns See {@link OnDisposeOptions}.
702
433
  */
703
- onDispose?: (module: IProviderModule) => Promise<void>;
434
+ onDispose?: () => OnDisposeOptions;
704
435
  }
705
436
  interface ProviderModuleOptionsInternal {
706
437
  isAppModule?: boolean;
@@ -709,27 +440,272 @@ interface ProviderModuleOptionsInternal {
709
440
  appModule?: () => GlobalAppModule;
710
441
  /** Can be used to manually provide a {@link Container} instance. */
711
442
  container?: () => Container;
712
- /** Can be used to override all the _imported_ providers _before_ the binding process. */
713
- importedProvidersMap?: (
714
- /** The current imported {@link DependencyProvider | provider} altered to use the module from where was imported for resolution. */
715
- factorizedProvider: DependencyProvider<any>,
716
- /** The current imported {@link DependencyProvider | provider}. */
717
- provider: DependencyProvider<any>,
718
- /** The {@link IProviderModule | module} from where the {@link DependencyProvider | provider} originated. */
719
- module: IProviderModule) => DependencyProvider<any>;
720
443
  }
721
- type StaticExports = (ProviderToken | IProviderModule)[];
722
- type DynamicExports = (
723
- /** The {@link IProviderModule} which is importing this module. */
724
- importerModule: IProviderModule,
725
- /** The {@link ProviderModuleOptions.exports | exports} array of this module. */
726
- moduleExports: StaticExports) => StaticExports;
444
+ type ExportsList = (StaticExport | LazyExport)[];
445
+ type StaticExport = ProviderToken | ProviderModuleOrDefinition;
446
+ type LazyExport = (
447
+ /** The {@link IProviderModule | module} which is importing _this_ module. */
448
+ importerModule: IProviderModule) => StaticExport | void;
449
+ type OnDisposeOptions = RequireAtLeastOne<{
450
+ /**
451
+ * It'll be invoked _before_ the dispose process starts.
452
+ *
453
+ * @param module The {@link IProviderModule | module} instance.
454
+ */
455
+ before: (module: IProviderModule) => void | Promise<void>;
456
+ /**
457
+ * It'll be invoked _after_ the dispose process ended.
458
+ *
459
+ * **Note:** _At this point the internal container has been destroyed and it'll be `null` when trying to access it._
460
+ *
461
+ * @param module The {@link IProviderModule | module} instance.
462
+ */
463
+ after: (module: IProviderModule) => void | Promise<void>;
464
+ }>;
465
+
466
+ interface IProviderModuleDefinition extends ProviderModuleOptions {
467
+ /** Returns the {@link ProviderModuleOptions | definition}. */
468
+ getDefinition(): ProviderModuleOptions;
469
+ /** Returns the {@link ProviderModuleOptions.identifier | identifier}. */
470
+ toString(): string;
471
+ }
472
+
473
+ /**
474
+ * Class containing an internal set of `utils`.
475
+ *
476
+ * Each {@link IProviderModuleNaked.moduleUtils | ProviderModule} instance has its own {@link ProviderModuleUtils} property instance.
477
+ */
478
+ declare class ProviderModuleUtils {
479
+ /** The low-level InversifyJS {@link Container} owned by {@link ProviderModuleUtils.module | module}. */
480
+ get container(): Container;
481
+ /** The parent {@link IProviderModule | ProviderModule} of `this` instance. */
482
+ readonly module: IProviderModule;
483
+ readonly moduleNaked: IProviderModuleNaked;
484
+ private readonly appModule;
485
+ constructor(module: IProviderModule, internalOptions: ProviderModuleOptionsInternal);
486
+ /**
487
+ * Low-level method which can be used to manually register _(bind)_ a new {@link provider} into the {@link ProviderModuleUtils.module | module} container.
488
+ *
489
+ * **Note:** _You shouldn't directly use this to register providers as they will not appear_
490
+ * _into the module's `imports` and `exports` arrays! Therefore leading to unexpected bugs and confusion!_
491
+ *
492
+ * @param provider The {@link ProviderToken | provider} to register.
493
+ * @param defaultScope Optionally provide the default {@link InjectionScope} to use when applicable.
494
+ * @returns `true` when the {@link provider} has been bound otherwhise `false`.
495
+ */
496
+ bindToContainer<T>(provider: DependencyProvider<T>, defaultScope: InjectionScope): boolean;
497
+ private checkIfShouldBeAddedToTheGlobalRegister;
498
+ private bindSelfTokenToContainer;
499
+ private bindClassTokenToContainer;
500
+ private bindValueTokenToContainer;
501
+ private bindFactoryTokenToContainer;
502
+ /** Sets the {@link InjectionScope} of a bound {@link provider}. */
503
+ private setBindingScope;
504
+ /** Sets the `when` clause of a bound {@link provider}. */
505
+ private setWhenBinding;
506
+ /** Sets the `activation` and `deactivation` events of a bound {@link provider}. */
507
+ private setBindingOnEvent;
508
+ }
509
+
510
+ /** Can be used to publicly expose internal properties and methods of an {@link IProviderModule} instance. */
511
+ interface IProviderModuleNaked extends IProviderModule {
512
+ /** It'll be true when the current module is the global `AppModule`. */
513
+ readonly isAppModule: boolean;
514
+ /** The low-level `InversifyJS` {@link https://inversify.io/docs/api/container/ | container} instance. */
515
+ readonly container: Container;
516
+ /** The default injection scope of this module. */
517
+ readonly defaultScope: {
518
+ /** Scope from `xInjection` {@link InjectionScope} enum. */
519
+ native: InjectionScope;
520
+ /** Scope from `InversifyJS` {@link BindingScope} string union. */
521
+ inversify: BindingScope;
522
+ };
523
+ /** Instance of the {@link ProviderModuleUtils}. */
524
+ readonly moduleUtils: ProviderModuleUtils;
525
+ /** The {@link DependencyProvider | providers} resolved by this module. */
526
+ readonly providers: DependencyProvider[];
527
+ /** What is exported into this module. */
528
+ readonly imports: ProviderModuleOrDefinition[];
529
+ /** What is exported from this module. */
530
+ readonly exports: ExportsList;
531
+ /** The registered `callback` which will be invoked when the internal initialization process has been completed. */
532
+ readonly onReady: ProviderModuleOptions['onReady'];
533
+ /** The registered `callback` which will be invoked when the {@link _dispose} method is invoked. */
534
+ readonly onDispose: ProviderModuleOptions['onDispose'];
535
+ readonly registeredSideEffects: RegisteredSideEffects;
536
+ /** It'll _completely_ re-init the `module` with the provided {@link InternalInitOptions | options}. */
537
+ _internalInit(options: InternalInitOptions): IProviderModule;
538
+ /**
539
+ * Can be used to execute the provided {@link cb | callback} whenever a _new_ {@link https://inversify.io/docs/fundamentals/binding/ | binding}
540
+ * is registered for the {@link provider}.
541
+ *
542
+ * @param provider The {@link ProviderToken}.
543
+ * @param cb The `callback` to be invoked.
544
+ */
545
+ _onBind<T>(provider: ProviderToken<T>, cb: () => Promise<void> | void): void;
546
+ /**
547
+ * Can be used to execute the provided {@link cb | callback} whenever the
548
+ * {@link IProviderModule.get | get} method is invoked.
549
+ *
550
+ * @param provider The {@link ProviderToken}.
551
+ * @param once When set to `true` it'll invoke the provided {@link cb | callback} only once.
552
+ * @param cb The `callback` to be invoked.
553
+ */
554
+ _onGet<T>(provider: ProviderToken<T>, once: boolean, cb: () => Promise<void> | void): void;
555
+ /**
556
+ * Can be used to execute the provided {@link cb | callback} whenever an existing {@link https://inversify.io/docs/fundamentals/binding/ | binding}
557
+ * is re-registered for the {@link provider}.
558
+ *
559
+ * @param provider The {@link ProviderToken}.
560
+ * @param cb The `callback` to be invoked.
561
+ */
562
+ _onRebind<T>(provider: ProviderToken<T>, cb: () => Promise<void> | void): void;
563
+ /**
564
+ * Can be used to execute the provided {@link cb | callback} whenever a {@link provider} is `unbound`.
565
+ *
566
+ * **Note:** _All the {@link _onBind}, {@link _onGet}, {@link _onRebind} and {@link _onUnbind} registered callbacks will be removed_
567
+ *
568
+ * @param provider The {@link ProviderToken}.
569
+ * @param cb The `callback` to be invoked.
570
+ */
571
+ _onUnbind<T>(provider: ProviderToken<T>, cb: () => Promise<void> | void): void;
572
+ /**
573
+ * Internal method which can be used to completely overwrite the module {@link container}
574
+ * with the one provided.
575
+ *
576
+ * @param cb Callback which when invoked must return an instance of the {@link Container}.
577
+ */
578
+ _overwriteContainer(cb: () => Container): void;
579
+ /**
580
+ * Binds a {@link ProviderToken | provider}.
581
+ *
582
+ * See {@link https://inversify.io/docs/api/container/#bind | Container.bind} for more details.
583
+ */
584
+ __bind<T>(provider: ProviderToken<T>): BindToFluentSyntax<T>;
585
+ /**
586
+ * Resolves a dependency by its runtime identifier.
587
+ * The runtime identifier must be associated with only one binding and the binding must be synchronously resolved,
588
+ * otherwise an error is thrown.
589
+ *
590
+ * @param provider The {@link ProviderToken}.
591
+ * @param options The {@link GetOptions}.
592
+ * @returns Either the {@link T | dependency} or `undefined` if {@link GetOptions.optional} is set to `true`.
593
+ *
594
+ * See {@link https://inversify.io/docs/api/container/#get | Container.get} for more details.
595
+ */
596
+ __get<T>(provider: ProviderToken<T>, options?: GetOptions): T;
597
+ /**
598
+ * Resolves a dependency by its runtime identifier.
599
+ * The runtime identifier must be associated with only one binding,
600
+ * otherwise an error is thrown.
601
+ *
602
+ * @param provider The {@link ProviderToken}.
603
+ * @param options The {@link GetOptions}.
604
+ * @returns Either the {@link T | dependency} or `undefined` if {@link GetOptions.optional} is set to `true`.
605
+ *
606
+ * See {@link https://inversify.io/docs/api/container/#getasync | Container.getAsync} for more details.
607
+ */
608
+ __getAsync<T>(provider: ProviderToken<T>, options?: GetOptions): Promise<T>;
609
+ /** See {@link https://inversify.io/docs/api/container/#getall | Container.getAll} for more details. */
610
+ __getAll<T>(provider: ProviderToken<T>, options?: GetOptions): T[];
611
+ /** See {@link https://inversify.io/docs/api/container/#getallasync | Container.getAllAsync} for more details. */
612
+ __getAllAsync<T>(provider: ProviderToken<T>, options?: GetOptions): Promise<T[]>;
613
+ /**
614
+ * Can be used to check if there are registered bindings for the {@link provider | provider}.
615
+ *
616
+ * See {@link https://inversify.io/docs/api/container/#isbound | Container.isBound} for more details.
617
+ */
618
+ __isBound(provider: ProviderToken, options?: IsBoundOptions): boolean;
619
+ /**
620
+ * Can be useed to check if there are registered bindings for the {@link provider | provider} only in the current container.
621
+ *
622
+ * See {@link https://inversify.io/docs/api/container/#iscurrentbound | Container.isCurrentBound} for more details.
623
+ */
624
+ __isCurrentBound(provider: ProviderToken, options?: IsBoundOptions): boolean;
625
+ /**
626
+ * Save the state of the container to be later restored with the restore method.
627
+ *
628
+ * See {@link https://inversify.io/docs/api/container/#snapshot | Container.snapshot} for more details.
629
+ */
630
+ __takeSnapshot(): void;
631
+ /**
632
+ * Restore container state to last snapshot.
633
+ *
634
+ * See {@link https://inversify.io/docs/api/container/#restore | Container.restore} for more details.
635
+ */
636
+ __restoreSnapshot(): void;
637
+ /**
638
+ * Convenience method that unbinds a {@link ProviderToken | provider} and then creates a new binding for it.
639
+ * This is equivalent to calling await `container.unbind` followed by `container.bind`, but in a single method.
640
+ *
641
+ * @param provider The {@link ProviderToken}.
642
+ * @returns A {@link BindToFluentSyntax | binding builder} to continue configuring the new binding.
643
+ *
644
+ * See {@link https://inversify.io/docs/api/container/#rebind | Container.rebind} for more details.
645
+ */
646
+ __rebind<T>(provider: ProviderToken<T>): Promise<BindToFluentSyntax<T>>;
647
+ /**
648
+ * Synchronous version of {@link __rebindProvider}. Unbinds a {@link ProviderToken | provider} synchronously and then creates a new binding for it.
649
+ * Will throw an error if the unbind operation would be asynchronous.
650
+ *
651
+ * @param provider The {@link ProviderToken}.
652
+ * @returns A {@link BindToFluentSyntax | binding builder} to continue configuring the new binding.
653
+ *
654
+ * See {@link https://inversify.io/docs/api/container/#rebindsync | Container.rebindSync} for more details.
655
+ */
656
+ __rebindSync<T>(provider: ProviderToken<T>): BindToFluentSyntax<T>;
657
+ /**
658
+ * Removes **all** the associated bindings with the {@link provider} from the container.
659
+ *
660
+ * This will result in the {@link https://inversify.io/docs/fundamentals/lifecycle/deactivation/ | deactivation process}.
661
+ *
662
+ * See {@link https://inversify.io/docs/api/container/#unbind | Container.unbind} for more details.
663
+ */
664
+ __unbind(provider: ProviderToken): Promise<void>;
665
+ /**
666
+ * Removes **all** the associated bindings with the {@link provider} from the container synchronously.
667
+ * This method works like {@link __unbind} but does not return a Promise.
668
+ * If the unbinding operation would be asynchronous (e.g. due to deactivation handlers),
669
+ * it will throw an error. Use this method when you know the operation won't involve async deactivations.
670
+ *
671
+ * This will result in the {@link https://inversify.io/docs/fundamentals/lifecycle/deactivation/ | deactivation process}.
672
+ *
673
+ * See {@link https://inversify.io/docs/api/container/#unbindsync | Container.unbindSync} for more details.
674
+ */
675
+ __unbindSync(provider: ProviderToken): void;
676
+ /**
677
+ * Remove all bindings bound in this container.
678
+ *
679
+ * This will result in the {@link https://inversify.io/docs/fundamentals/lifecycle/deactivation/ | deactivation process}.
680
+ *
681
+ * See {@link https://inversify.io/docs/api/container/#unbindall | Container.unbindAll} for more details.
682
+ */
683
+ __unbindAll(): Promise<void>;
684
+ }
685
+ type InternalInitOptions = Except<ProviderModuleOptions & ProviderModuleOptionsInternal, 'identifier' | 'isAppModule'>;
686
+ type RegisteredSideEffects = Map<ProviderToken, {
687
+ onBindEffects: OnBindEffects[];
688
+ onGetEffects: OnGetEffects[];
689
+ onRebindEffects: OnRebindEffects[];
690
+ onUnbindEffects: OnUnbindEffects[];
691
+ }>;
692
+ type OnBindEffects = () => Promise<void> | void;
693
+ type OnGetEffects = {
694
+ once: boolean;
695
+ invoked: boolean;
696
+ cb: () => Promise<void> | void;
697
+ };
698
+ type OnRebindEffects = () => Promise<void> | void;
699
+ type OnUnbindEffects = {
700
+ registerModuleId?: ModuleIdentifier;
701
+ cb: () => Promise<void> | void;
702
+ };
727
703
 
728
704
  interface IProviderModule {
729
705
  /** The module unique ID. */
730
- readonly identifier: symbol;
706
+ readonly identifier: ModuleIdentifier;
731
707
  /** See {@link ProviderModuleOptions.markAsGlobal}. */
732
- readonly isMarkedAsGlobal: boolean;
708
+ readonly isMarkedAsGlobal: ProviderModuleOptions['markAsGlobal'];
733
709
  readonly isDisposed: boolean;
734
710
  /**
735
711
  * Can be used to retrieve a resolved `dependency` from the module container.
@@ -762,30 +738,28 @@ interface IProviderModule {
762
738
  */
763
739
  getMany<D extends (ProviderModuleGetManyParam<any> | ProviderToken)[]>(...deps: D | unknown[]): ProviderModuleGetManySignature<D>;
764
740
  /**
765
- * Casts the current module type to the {@link IProviderModuleNaked} type.
741
+ * Can be used to _lazily_ import one or more {@link IProviderModule | modules} into _this_ module.
766
742
  *
767
- * **Internally used and for testing purposes!**
743
+ * @param module The `module` to be imported.
768
744
  */
769
- toNaked(): IProviderModuleNaked;
745
+ lazyImport(...module: ProviderModuleOrDefinition[]): void;
770
746
  /**
771
- * Can be used to create a new instance of the current {@link IProviderModule | module}.
772
- *
773
- * **Note:** _All the providers will be registered again within the new module!_
774
- * _And also the new module will still refrain values by reference to its parent module because of_
775
- * _JS limitation in deeply/truly cloning an instance._
747
+ * Casts the current module type to the {@link IProviderModuleNaked} type.
776
748
  *
777
- * @param options Apply a new set of {@link ProviderModuleOptions | options}.
749
+ * **Internally used and for testing purposes!**
778
750
  */
779
- clone(options?: Partial<ProviderModuleOptions>): IProviderModule;
751
+ toNaked(): IProviderModuleNaked;
780
752
  /**
781
753
  * Removes all the bindings from the {@link IProviderModuleNaked.container | container}.
782
754
  *
783
- * **Note:** The module can be fully re-initialized by invoking the {@link _lazyInit} method.
755
+ * **Note:** The module can be fully re-initialized by invoking the {@link _internalInit} method.
784
756
  */
785
757
  dispose(): Promise<void>;
786
- /** Returns the {@link IProviderModule.identifier} `symbol` description. */
758
+ /** Returns the {@link IProviderModule.identifier}. */
787
759
  toString(): string;
788
760
  }
761
+ type ModuleIdentifier = symbol | string;
762
+ type ProviderModuleOrDefinition = IProviderModule | IProviderModuleDefinition;
789
763
  type ProviderModuleGetManySignature<Tokens extends (ProviderModuleGetManyParam<any> | ProviderToken)[]> = {
790
764
  [K in keyof Tokens]: Tokens[K] extends ProviderModuleGetManyParam<infer U> ? U : Tokens[K] extends ProviderToken<infer T> ? T : Tokens[K] extends ProviderIdentifier<infer I> ? I : never;
791
765
  };
@@ -797,11 +771,25 @@ type ProviderModuleGetManyParam<T> = {
797
771
  };
798
772
 
799
773
  interface IAppModule extends Except<IProviderModule, 'isMarkedAsGlobal'> {
774
+ readonly _strict: AppModuleOptions['_strict'];
800
775
  /** Must be invoked _(only once during the application lifecycle)_ in order to provide the {@link options} to the module. */
801
776
  register<AsNaked extends boolean = false>(options: AppModuleOptions): AsNaked extends false ? IAppModule : IAppModule & IProviderModuleNaked;
802
777
  toNaked(): IAppModule & IProviderModuleNaked;
803
778
  }
804
- type AppModuleOptions = Except<LazyInitOptions, 'exports' | 'dynamicExports'>;
779
+ interface AppModuleOptions extends Except<InternalInitOptions, 'appModule' | 'markAsGlobal' | 'exports' | 'isDisposed'> {
780
+ /**
781
+ * When set to `true` it'll enforce an opinionated set of rules
782
+ * which _can help_ in avoiding common pitfalls which may otherwise produce
783
+ * undesired side-effects or edge-case bugs.
784
+ *
785
+ * **Note:** _Do not open an `issue` if a bug or edge-case is caused by having the `strict` property disabled!_
786
+ *
787
+ * - `markAsGlobal`: Will not be enforced anymore.
788
+ *
789
+ * Defaults to `true`.
790
+ */
791
+ _strict?: boolean;
792
+ }
805
793
 
806
794
  /** See {@link https://inversify.io/docs/api/decorator/#inject} for more details. */
807
795
  declare function Inject(provider: ProviderToken): MethodDecorator & ParameterDecorator & PropertyDecorator;
@@ -881,7 +869,13 @@ declare namespace ProviderTokenHelpers {
881
869
 
882
870
  declare namespace ProviderModuleHelpers {
883
871
  function buildInternalConstructorParams(params: Partial<ProviderModuleOptions & ProviderModuleOptionsInternal>): ProviderModuleOptions;
884
- function isDynamicExport(exporter: StaticExports | DynamicExports): exporter is DynamicExports;
872
+ function getOptionsOrModuleDefinitionOptions(optionsOrDefinition: ProviderModuleOptions | IProviderModuleDefinition): {
873
+ options: ProviderModuleOptions;
874
+ internalOptions: ProviderModuleOptionsInternal;
875
+ };
876
+ function isModuleDefinition(value: any): value is IProviderModuleDefinition;
877
+ function isLazyExport(exp: any): exp is LazyExport;
878
+ function tryStaticOrLazyExportToStaticExport(module: IProviderModule, exp: StaticExport | LazyExport): StaticExport | void;
885
879
  }
886
880
 
887
881
  declare function isPlainObject(o: any): o is object;
@@ -892,4 +886,4 @@ declare function isFunction(v: any): boolean;
892
886
 
893
887
  declare function isClassOrFunction(value: any): value is Function | Class<any>;
894
888
 
895
- export { AppModule, type AppModuleOptions, type DependencyProvider, type DynamicExports, GLOBAL_APP_MODULE_ID, GlobalAppModule, GlobalContainer, type IAppModule, type IProviderModule, type IProviderModuleNaked, Inject, InjectFromBase, Injectable, InjectionError, InjectionProviderModuleDisposedError, InjectionProviderModuleError, InjectionProviderModuleGlobalMarkError, InjectionProviderModuleMissingIdentifierError, InjectionScope, type LazyInitOptions, MultiInject, Named, type OnEvent, Optional, type ProviderClassToken, type ProviderFactoryToken, type ProviderIdentifier, ProviderModule, type ProviderModuleGetManyParam, type ProviderModuleGetManySignature, ProviderModuleHelpers, type ProviderModuleOptions, type ProviderModuleOptionsInternal, type ProviderOptions, type ProviderScopeOption, type ProviderToken, ProviderTokenHelpers, type ProviderValueToken, type StaticExports, Tagged, Unmanaged, bindingScopeToInjectionScope, injectionScopeToBindingScope, isClass, isClassOrFunction, isFunction, isPlainObject };
889
+ export { AppModule, type AppModuleOptions, type DependencyProvider, type ExportsList, GLOBAL_APP_MODULE_ID, GlobalAppModule, GlobalContainer, type IAppModule, type IProviderModule, type IProviderModuleDefinition, type IProviderModuleNaked, Inject, InjectFromBase, Injectable, InjectionError, InjectionProviderModuleDisposedError, InjectionProviderModuleError, InjectionProviderModuleGlobalMarkError, InjectionProviderModuleMissingIdentifierError, InjectionScope, type InternalInitOptions, MultiInject, Named, type OnEvent, Optional, type ProviderClassToken, type ProviderFactoryToken, type ProviderIdentifier, ProviderModule, ProviderModuleDefinition, type ProviderModuleGetManyParam, type ProviderModuleGetManySignature, ProviderModuleHelpers, type ProviderModuleOptions, type ProviderModuleOptionsInternal, type ProviderModuleOrDefinition, type ProviderOptions, type ProviderScopeOption, type ProviderToken, ProviderTokenHelpers, type ProviderValueToken, Tagged, Unmanaged, bindingScopeToInjectionScope, injectionScopeToBindingScope, isClass, isClassOrFunction, isFunction, isPlainObject };