@adimm/x-injection 2.0.3 → 2.0.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 CHANGED
@@ -41,6 +41,7 @@ xInjection&nbsp;<a href="https://www.npmjs.com/package/@adimm/x-injection" targe
41
41
  - [Blueprints](#blueprints-1)
42
42
  - [Import Behavior](#import-behavior)
43
43
  - [isGlobal](#isglobal)
44
+ - [Definitions](#definitions)
44
45
  - [Advanced Usage](#advanced-usage)
45
46
  - [Events](#events)
46
47
  - [Middlewares](#middlewares)
@@ -408,6 +409,7 @@ A [ProviderToken](https://adimarianmutu.github.io/x-injection/types/ProviderToke
408
409
  const THEY_MAY_KNOW_PROVIDER = { provide: CONSTANT_SECRET_PROVIDER, useValue: 'Maybe they know?' };
409
410
 
410
411
  // As you can see we now have 2 different ProviderTokens which use the same `provide` key.
412
+ // This means that resolving the `CONSTANT_SECRET_PROVIDER` will return an array of strings.
411
413
  ```
412
414
 
413
415
  - [ProviderFactoryToken](https://adimarianmutu.github.io/x-injection/types/ProviderFactoryToken.html)
@@ -475,6 +477,45 @@ MyModule.update.addProvider(PizzaService, true);
475
477
  MyModule.update.addProvider({ provide: HumanService, useClass: FemaleService });
476
478
  ```
477
479
 
480
+ Now you may probably ask yourself `If we import with the 'addImport' method a new module into an already imported module, will we have access to the providers of that newly imported module?`
481
+
482
+ The ansuwer is `yes`, we do have access thanks to the _dynamic_ nature of the `ProviderModule` class. Meaning that doing the following will work as expected:
483
+
484
+ ```ts
485
+ const InnerModule = ProviderModule.create({
486
+ id: 'InnerModule',
487
+ providers: [FirstService],
488
+ exports: [FirstService],
489
+ });
490
+
491
+ const OuterModule = ProviderModule.create({
492
+ id: 'OuterModule',
493
+ imports: [InnerModule],
494
+ });
495
+
496
+ const UnknownModule = ProviderModule.create({
497
+ id: 'UnknownModule',
498
+ providers: [SecondService],
499
+ exports: [SecondService],
500
+ });
501
+
502
+ InnerModule.update.addImport(UnknownModule);
503
+
504
+ const secondService = OuterModule.get(SecondService);
505
+ ```
506
+
507
+ The `OuterModule` has now access to the `UnknownModule` exports because it has been _dynamically_ imported _(later at run-time)_ into the `InnerModule` _(which has been imported into `OuterModule` during the `bootstrap` phase)_
508
+
509
+ Basically what happens is that when a `module` is imported, it takes care of _notify_ the `host` module if its _definiton_ changed.
510
+
511
+ > [!WARNING]
512
+ >
513
+ > This is a very powerful feature which comes in with some costs, _most of the time negligible_, but if you have an app which has thousand and thousand of `modules` doing this type of _dynamic_ behavior, you may incur in some performance issues which will require proper design to keep under control.
514
+ >
515
+ > _Most of the times the best solution is to leverage the nature of `blueprints`._
516
+
517
+ ---
518
+
478
519
  Sometimes you may actually want to _lazy_ import a `module` from a _file_, this can be done very easily with `xInjection`:
479
520
 
480
521
  ```ts
@@ -490,13 +531,13 @@ Sometimes you may actually want to _lazy_ import a `module` from a _file_, this
490
531
  >
491
532
  > This design pattern is _extremely_ powerful and useful when you may have a lot of `modules` initializing during the app bootstrap process as you can defer their initialization, or even never load them if the user never needs those specific `modules` _(this is mostly applicable on the client-side rather than the server-side)_
492
533
 
493
- Keep reading to understand how you can defer initialization of the modules _both_ `client-side` and `server-side`.
534
+ Keep reading to understand how you can defer initialization of the `modules` by using `blueprints`.
494
535
 
495
536
  ## Blueprints
496
537
 
497
538
  The [ProviderModuleBlueprint](https://adimarianmutu.github.io/x-injection/classes/ProviderModuleBlueprint.html) `class` main purpose is to encapsulate the `definitions` of a `Module`, when you do `ProviderModule.blueprint({...})` you are _not_ actually creating an instance of the `ProviderModule` class, but an instance of the `ProviderModuleBlueprint` class.
498
539
 
499
- Before diving into some examples, let's first clarify some important aspects about the behavior of the `blueprint` class.
540
+ > To better understand the above concept; imagine the `blueprint` as being a _dormant_ _(static)_ `module` which is not fully awake _(dynamic)_ till it is actually _imported_ into a `module`.
500
541
 
501
542
  ### Import Behavior
502
543
 
@@ -522,7 +563,7 @@ Now you can decide when to import it into the `AppModule` by doing `AppModule.ad
522
563
 
523
564
  ---
524
565
 
525
- I highly recommend to take advantage of the `blueprints` nature in order to plan-ahead your `modules` and import them wherever you have to import only when needed;
566
+ I highly recommend to take advantage of the `blueprints` nature in order to plan-ahead your `modules`;
526
567
 
527
568
  Why?
528
569
 
@@ -530,6 +571,31 @@ Why?
530
571
  - To reuse module _definitions across_ different parts of your application while maintaining isolated instances. _(when possible/applicable)_
531
572
  - To _compose modules flexibly_, allowing you to adjust module dependencies dynamically before instantiation.
532
573
 
574
+ ### Definitions
575
+
576
+ After you have provided the _initial_ `definitons` of a `blueprint`, you can always modify them with the [updateDefinition](https://adimarianmutu.github.io/x-injection/classes/ProviderModuleBlueprint.html#updatedefinition) `method`.
577
+
578
+ > [!NOTE]
579
+ >
580
+ > Updating the `definitions` of a `blueprint` after has been _imported_ into a `module` will **_not_** propagate those changes to the `module` where it has been imported.
581
+
582
+ ---
583
+
584
+ This means that we can actually _leverage_ the `blueprints` nature to _defer_ the actual initialization of a `module` by doing so:
585
+
586
+ ```ts
587
+ const UserModuleBp = ProviderModule.blueprint({
588
+ id: 'UserModule',
589
+ ...
590
+ });
591
+
592
+ // Later in your code
593
+
594
+ const UserModule = ProviderModule.create(UserModuleBp);
595
+ ```
596
+
597
+ The `UserModule` will be created only when _necessary_ and it'll use the same exact definitons which are available into the `UserModuleBp` at the time of the `create` invokation.
598
+
533
599
  ## Advanced Usage
534
600
 
535
601
  > [!WARNING]
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/decorators/injectable.ts","../src/enums/injection-scope.enum.ts","../src/enums/middleware-type.enum.ts","../src/enums/definition-event-type.enum.ts","../src/helpers/scope-converter.ts","../src/helpers/provider-token.ts","../src/helpers/is-class.ts","../src/helpers/is-class-or-function.ts","../src/helpers/is-plain-object.ts","../src/errors/base.error.ts","../src/errors/provider-module.error.ts","../src/errors/provider-module-unknown-provider.ts","../src/errors/provider-module-disposed.error.ts","../src/errors/provider-module-missing-identifier.ts","../src/errors/provider-module-missing-provider.ts","../src/core/container/module-container.ts","../src/core/app-module/container.ts","../src/core/container/imported-module-container.ts","../src/utils/signal.ts","../src/core/dynamic-module-definition/dynamic-module-definition.ts","../src/core/middlewares-manager/middlewares-manager.ts","../src/core/provider-module-blueprint/provider-module-blueprint.ts","../src/core/provider-module/provider-module.ts","../src/helpers/provider-module.ts","../src/helpers/is-function.ts","../src/helpers/deep-clone.ts","../src/decorators/inject.ts","../src/decorators/multi-inject.ts","../src/decorators/inject-from-base.ts","../src/decorators/named.ts","../src/decorators/optional.ts","../src/decorators/tagged.ts","../src/decorators/unmanaged.ts","../src/core/app-module/app.module.ts"],"sourcesContent":["export * from './decorators';\nexport * from './errors';\nexport * from './enums';\nexport * from './helpers';\n\nexport { AppModule, ProviderModule, ProviderModuleBlueprint } from './core';\n\nexport type {\n IProviderModule,\n ProviderModuleOptions,\n ProviderModuleOptionsInternal,\n ProviderModuleGetReturn,\n ProviderModuleGetManyParam,\n ProviderModuleGetManyReturn,\n} from './core';\nexport type {\n DependencyProvider,\n ProviderToken,\n ProviderClassToken,\n ProviderValueToken,\n ProviderFactoryToken,\n ProviderIdentifier,\n ProviderOptions,\n ProviderScopeOption,\n ExportDefinition,\n ExportsDefinition,\n ExportsDefinitionOptimized,\n} from './types';\n","import { injectable as _injectable } from 'inversify';\n\nimport { InjectionScope } from '../enums';\nimport { injectionScopeToBindingScope } from '../helpers';\n\n/** See {@link https://inversify.io/docs/api/decorator/#injectable} for more details. */\nexport function Injectable(scope?: InjectionScope) {\n if (scope === undefined) return _injectable();\n\n return _injectable(injectionScopeToBindingScope(scope));\n}\n","export enum InjectionScope {\n /** When the service is resolved, the same cached resolved value will be used. */\n Singleton,\n\n /** When the service is resolved, a new resolved value will be used each time. */\n Transient,\n\n /** When the service is resolved within the same container request, the same resolved value will be used. */\n Request,\n}\n","export enum MiddlewareType {\n /**\n * Can be used to register a `middleware` which will be invoked right before importing a `module` into _this_ module.\n *\n * The provided middleware `callback` can either return a `boolean` or a `ProviderModule` instance.\n *\n * **Note:** _Returning `true` can be used to pass through the middleware without modifying_\n * _the `ProviderModule` instance, while returning `false` will reject the request of importing that specific module._\n */\n BeforeAddImport,\n\n /**\n * Can be used to register a `middleware` which will be invoked right before adding a provider to _this_ module.\n *\n * The provided middleware `callback` can either return a `boolean` or a `ProviderToken` object type.\n *\n * **Note:** _Returning `true` can be used to pass through the middleware without modifying_\n * _the `ProviderToken` object, while returning `false` will reject the request of adding that specific provider._\n */\n BeforeAddProvider,\n\n /**\n * Can be used to register a `middleware` which will be invoked right before a provider is returned to the consumer from _this_ module container.\n *\n * The provided middleware `callback` can return `anything`.\n */\n BeforeGet,\n\n /**\n * Can be used to register a `middleware` which will be invoked right before removing an imported module from _this_ module.\n *\n * **Note:** _The provided middleware `callback` must return a `boolean` where `true` means that_\n * _the imported module can be removed and `false` means to keep it._\n */\n BeforeRemoveImport,\n\n /**\n * Can be used to register a `middleware` which will be invoked right before removing a provider from _this_ module.\n *\n * **Note:** _The provided middleware `callback` must return a `boolean` where `true` means that_\n * _the provider can be removed and `false` means to keep it._\n */\n BeforeRemoveProvider,\n\n /**\n * Can be used to register a `middleware` which will be invoked right before removing an `ExportDefinition` from _this_ module.\n *\n * **Note:** _The provided middleware `callback` must return a `boolean` where `true` means that_\n * _the `ExportDefinition` can be removed and `false` means to keep it._\n */\n BeforeRemoveExport,\n\n /**\n * Can be used to register a `middleware` which will be invoked each time\n * a _consumer_ `module` tries to access the `ExportDefinition` list of _this_ module to `get` a provider.\n *\n * **Note:** _The provided middleware `callback` will be invoked for each `ProviderToken` of the `ExportsDefinition` list_\n * _and must return a `boolean` where `true` means that the `ProviderToken` is authorized to be used by the importer module._\n */\n OnExportAccess,\n}\n","export enum DefinitionEventType {\n /** No-Operation, yet. */\n Noop,\n\n /**\n * A new `module` or `blueprint` has been added.\n *\n * **Note:** _The occurred change type is: `ModuleOrBlueprint`_\n */\n Import,\n\n /**\n * A new `provider` has been added.\n *\n * **Note:** _The occurred change type is: `DependencyProvider`_\n */\n Provider,\n\n /**\n * A `module` is retrieving from its container a `provider`.\n *\n * **Note:** _The occurred change type is: `any`_\n */\n GetProvider,\n\n /**\n * A new `module` or `provider` has been added to the `exports` definition.\n *\n * **Note:** _The occurred change type is: `ExportDefinition`_\n */\n Export,\n\n /**\n * A new `module` or `blueprint` has been added to the `exports` definition.\n *\n * **Note:** _The occurred change type is: `ModuleOrBlueprint`_\n */\n ExportModule,\n\n /**\n * A new `provider` has been added to the `exports` definition.\n *\n * **Note:** _The occurred change type is: `ProviderToken`_\n */\n ExportProvider,\n\n /**\n * A `module` has been removed.\n *\n * **Note:** _The occurred change type is: `IProviderModule`_\n */\n ImportRemoved,\n\n /**\n * A `provider` has been removed.\n *\n * **Note:** _The occurred change type is: `DependencyProvider`_\n */\n ProviderRemoved,\n\n /**\n * An `ExportDefinition` has been removed.\n *\n * **Note:** _The occurred change type is: `ExportDefinition`_\n */\n ExportRemoved,\n\n /**\n * A `module` has been removed from the `export` definition.\n *\n * **Note:** _The occurred change type is: `IProviderModule`_\n */\n ExportModuleRemoved,\n\n /**\n * A `provider` has been removed from the `export` definition.\n *\n * **Note:** _The occurred change type is: `ProviderToken`_\n */\n ExportProviderRemoved,\n}\n","import type { BindingScope } from 'inversify';\n\nimport { InjectionScope } from '../enums';\n\nexport function injectionScopeToBindingScope(injectionScope: InjectionScope): BindingScope {\n switch (injectionScope) {\n case InjectionScope.Singleton:\n return 'Singleton';\n case InjectionScope.Transient:\n return 'Transient';\n case InjectionScope.Request:\n return 'Request';\n }\n}\n\nexport function bindingScopeToInjectionScope(bindingScope: BindingScope): InjectionScope {\n switch (bindingScope) {\n case 'Singleton':\n return InjectionScope.Singleton;\n case 'Transient':\n return InjectionScope.Transient;\n case 'Request':\n return InjectionScope.Request;\n }\n}\n","import { getClassMetadata } from '@inversifyjs/core';\n\nimport { InjectionScope } from '../enums';\nimport type {\n ProviderClassToken,\n ProviderFactoryToken,\n ProviderIdentifier,\n ProviderOptions,\n ProviderScopeOption,\n ProviderToken,\n ProviderValueToken,\n} from '../types';\nimport { isClass } from './is-class';\nimport { isClassOrFunction } from './is-class-or-function';\nimport { isPlainObject } from './is-plain-object';\nimport { bindingScopeToInjectionScope } from './scope-converter';\n\nexport namespace ProviderTokenHelpers {\n export function isClassToken<T>(provider: ProviderToken<T>): provider is ProviderClassToken<T> {\n return hasProvideProperty(provider) && 'useClass' in provider;\n }\n\n export function isValueToken<T>(provider: ProviderToken<T>): provider is ProviderValueToken<T> {\n return hasProvideProperty(provider) && 'useValue' in provider;\n }\n\n export function isFactoryToken<T>(provider: ProviderToken<T>): provider is ProviderFactoryToken<T> {\n return hasProvideProperty(provider) && 'useFactory' in provider;\n }\n\n export function isProviderIdentifier<T = any>(value: any): value is ProviderIdentifier<T> {\n return typeof value === 'string' || typeof value === 'symbol' || isClassOrFunction(value);\n }\n\n export function toProviderIdentifier<T = any>(provider: ProviderToken<T>): ProviderIdentifier<T> {\n return isProviderIdentifier(provider) ? provider : provider.provide;\n }\n\n export function toProviderIdentifiers(providers: ProviderToken[]): ProviderIdentifier<unknown>[] {\n return providers.map((provider) => toProviderIdentifier(provider));\n }\n\n export function providerIdentifierToString(providerIdentifier: ProviderIdentifier): string {\n if (typeof providerIdentifier === 'symbol' || typeof providerIdentifier === 'string') {\n return providerIdentifier.toString();\n }\n\n return providerIdentifier.name;\n }\n\n export function providerTokenToString(providerToken: ProviderToken): string {\n const providerIdentifier = toProviderIdentifier(providerToken);\n\n return providerIdentifierToString(providerIdentifier);\n }\n\n export function providerTokensAreEqual(p0: ProviderToken, p1: ProviderToken): boolean {\n if (p0 === p1) return true;\n\n const id0 = toProviderIdentifier(p0);\n const id1 = toProviderIdentifier(p1);\n\n if (id0 !== id1) return false;\n\n if (isClassToken(p0) && isClassToken(p1)) {\n return p0.useClass === p1.useClass;\n }\n\n if (isValueToken(p0) && isValueToken(p1)) {\n return p0.useValue === p1.useValue;\n }\n\n if (isFactoryToken(p0) && isFactoryToken(p1)) {\n if (p0.useFactory !== p1.useFactory) return false;\n\n // const inject0 = p0.inject ?? [];\n // const inject1 = p1.inject ?? [];\n\n // if (inject0.length !== inject1.length) return false;\n\n // for (let i = 0; i < inject0.length; i++) {\n // if (inject0[i] !== inject1[i]) return false;\n // }\n\n return true;\n }\n\n // At this point, identifiers are equal but tokens are not class/value/factory tokens,\n // so consider them equal based on identifier alone.\n return true;\n }\n\n /**\n * The priority order is as follows:\n * 1. From the `ProviderToken.scope`\n * 2. From the class `@Injectable(scope)` decorator\n * 3. From the `ProviderModule` default scope.\n *\n * @param provider The {@link ProviderToken}.\n * @param moduleDefaultScope The module default scope.\n */\n export function getInjectionScopeByPriority(\n provider: ProviderToken,\n moduleDefaultScope: InjectionScope\n ): InjectionScope {\n return tryGetScopeFromProvider(provider) ?? tryGetDecoratorScopeFromClass(provider) ?? moduleDefaultScope;\n }\n\n export function tryGetProviderOptions<T>(\n provider: ProviderToken<T>\n ): (ProviderOptions<T> & ProviderScopeOption) | undefined {\n if (!hasProvideProperty(provider)) return;\n\n return provider as any;\n }\n\n export function tryGetScopeFromProvider(provider: ProviderToken): InjectionScope | undefined {\n const providerOptions = tryGetProviderOptions(provider);\n if (!providerOptions) return;\n\n return providerOptions.scope;\n }\n\n export function tryGetDecoratorScopeFromClass<T = any>(provider: ProviderToken<T>): InjectionScope | undefined {\n const providerClass = toProviderIdentifier(provider);\n if (!isClass(providerClass)) return;\n\n const inversifyScope = getClassMetadata(providerClass as any)?.scope;\n if (!inversifyScope) return;\n\n return bindingScopeToInjectionScope(inversifyScope);\n }\n\n function hasProvideProperty(provider: any): provider is object {\n return isPlainObject(provider) && typeof provider === 'object' && 'provide' in provider;\n }\n}\n","export function isClass(v: any): boolean {\n if (typeof v !== 'function') return false;\n\n return Function.prototype.toString.call(v).startsWith('class ');\n}\n","import type { Class } from 'type-fest';\n\nexport function isClassOrFunction(value: any): value is Function | Class<any> {\n return typeof value === 'function';\n}\n","/*\n * is-plain-object <https://github.com/jonschlinkert/is-plain-object>\n *\n * Copyright (c) 2014-2017, Jon Schlinkert.\n * Released under the MIT License.\n */\n\nfunction isObject(o: any): boolean {\n return Object.prototype.toString.call(o) === '[object Object]';\n}\n\nexport function isPlainObject(o: any): o is object {\n if (isObject(o) === false) return false;\n\n // If has modified constructor\n const ctor = o.constructor;\n if (ctor === undefined) return true;\n\n // If has modified prototype\n const prot = ctor.prototype;\n if (isObject(prot) === false) return false;\n\n // If constructor does not have an Object-specific method\n if (prot.hasOwnProperty('isPrototypeOf') === false) {\n return false;\n }\n\n // Most likely a plain Object\n return true;\n}\n","/** Exception which indicates that there is a generic error. */\nexport class InjectionError extends Error {\n override name = InjectionError.name;\n}\n","import type { IProviderModule } from '../core';\n\n/** Exception which indicates that there is a generic error with an instance of {@link IProviderModule}. */\nexport class InjectionProviderModuleError extends Error {\n override name = InjectionProviderModuleError.name;\n\n constructor(module: IProviderModule, message: string) {\n let moduleId = 'Unknown';\n\n try {\n moduleId = module.toString();\n } catch {}\n\n super(`{ProviderModule.${moduleId}} => ${message}`);\n }\n}\n","import type { IProviderModule } from '../core';\nimport { ProviderTokenHelpers } from '../helpers';\nimport type { ProviderToken } from '../types';\nimport { InjectionProviderModuleError } from './provider-module.error';\n\n/** Exception which indicates that an `unknown` type of {@link ProviderToken} has been supplied. */\nexport class InjectionProviderModuleUnknownProviderError extends InjectionProviderModuleError {\n override name = InjectionProviderModuleUnknownProviderError.name;\n\n constructor(module: IProviderModule, providerToken: ProviderToken) {\n super(module, `The [${ProviderTokenHelpers.providerTokenToString(providerToken)}] provider is of an unknown type!`);\n }\n}\n","import type { IProviderModule } from '../core';\nimport { InjectionProviderModuleError } from './provider-module.error';\n\n/** Exception which indicates an invokation of a disposed module. */\nexport class InjectionProviderModuleDisposedError extends InjectionProviderModuleError {\n override name = InjectionProviderModuleDisposedError.name;\n\n constructor(module: IProviderModule) {\n super(module, 'Has been disposed!');\n }\n}\n","import type { IProviderModule } from '../core';\nimport { InjectionProviderModuleError } from './provider-module.error';\n\n/** Exception which indicates that a module has been initialized without an `identifier`. */\nexport class InjectionProviderModuleMissingIdentifierError extends InjectionProviderModuleError {\n override name = InjectionProviderModuleMissingIdentifierError.name;\n\n constructor(module: IProviderModule) {\n super(module, 'An `identifier` must be supplied!');\n }\n}\n","import type { IProviderModule } from '../core';\nimport { ProviderTokenHelpers } from '../helpers';\nimport type { ProviderToken } from '../types';\nimport { InjectionProviderModuleError } from './provider-module.error';\n\n/** Exception which indicates that a module container does not contain the requested provider. */\nexport class InjectionProviderModuleMissingProviderError extends InjectionProviderModuleError {\n override name = InjectionProviderModuleMissingProviderError.name;\n\n constructor(module: IProviderModule, providerToken: ProviderToken) {\n super(\n module,\n `The [${ProviderTokenHelpers.providerTokenToString(providerToken)}] provider is not bound to this (or any imported) module container, and was not found either in the 'AppModule'!`\n );\n }\n}\n","import { Container, type BindInWhenOnFluentSyntax, type BindWhenOnFluentSyntax } from 'inversify';\n\nimport { InjectionScope, MiddlewareType } from '../../enums';\nimport { InjectionProviderModuleMissingProviderError, InjectionProviderModuleUnknownProviderError } from '../../errors';\nimport { injectionScopeToBindingScope, isPlainObject, ProviderTokenHelpers } from '../../helpers';\nimport type {\n DependencyProvider,\n ProviderClassToken,\n ProviderFactoryToken,\n ProviderOptions,\n ProviderToken,\n ProviderValueToken,\n} from '../../types';\nimport { AppModuleInversifyContainer } from '../app-module/container';\nimport type {\n ProviderModuleGetManyParam,\n ProviderModuleGetManyReturn,\n ProviderModuleGetReturn,\n} from '../provider-module';\nimport { ProviderModule } from '../provider-module/provider-module';\n\nexport class ModuleContainer {\n readonly container: Container;\n private readonly providerModule: ProviderModule;\n\n constructor(providerModule: ProviderModule, inversifyParentContainer?: Container) {\n this.providerModule = providerModule;\n\n const { defaultScope = InjectionScope.Singleton } = providerModule.options;\n\n this.container =\n providerModule.id === 'AppModule'\n ? AppModuleInversifyContainer\n : new Container({\n parent: inversifyParentContainer ?? this.providerModule.appModuleRef.moduleContainer.container,\n defaultScope: injectionScopeToBindingScope(defaultScope),\n });\n\n this.providerModule.options.providers?.forEach((x) => this.bindToContainer(x));\n }\n\n get<T, IsOptional extends boolean | undefined = undefined, AsList extends boolean | undefined = undefined>(\n provider: ProviderToken<T>,\n isOptional?: IsOptional,\n asList?: AsList\n ): ProviderModuleGetReturn<T, IsOptional, AsList> {\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares<any>(\n MiddlewareType.BeforeGet,\n this.getProvider(provider, asList),\n provider,\n this.getProvider.bind(this)\n );\n if (middlewareResult || middlewareResult === null) return middlewareResult;\n\n if (isOptional) return undefined as any;\n\n throw new InjectionProviderModuleMissingProviderError(this.providerModule, provider);\n }\n\n getMany<D extends (ProviderModuleGetManyParam<any> | ProviderToken)[]>(\n ...deps: D | unknown[]\n ): ProviderModuleGetManyReturn<D> {\n return (deps as D).map((dep) => {\n const withOptions = isPlainObject(dep) && 'provider' in dep;\n\n return this.get(\n withOptions ? dep.provider : dep,\n withOptions ? dep.isOptional : false,\n withOptions ? dep.asList : false\n );\n }) as any;\n }\n\n bindToContainer<T>(provider: DependencyProvider<T>): void {\n const providerIdentifier = ProviderTokenHelpers.toProviderIdentifier(provider);\n\n const binders: Array<{\n providerTypeMatches: (p: any) => boolean;\n bind: () => BindInWhenOnFluentSyntax<any> | BindWhenOnFluentSyntax<any>;\n }> = [\n {\n providerTypeMatches: ProviderTokenHelpers.isProviderIdentifier,\n bind: () => this.container.bind(providerIdentifier).toSelf(),\n },\n {\n providerTypeMatches: ProviderTokenHelpers.isClassToken,\n bind: () => this.container.bind(providerIdentifier).to((provider as ProviderClassToken<T>).useClass),\n },\n {\n providerTypeMatches: ProviderTokenHelpers.isValueToken,\n bind: () =>\n this.container.bind(providerIdentifier).toConstantValue((provider as ProviderValueToken<T>).useValue),\n },\n {\n providerTypeMatches: ProviderTokenHelpers.isFactoryToken,\n bind: () =>\n this.container.bind(providerIdentifier).toResolvedValue(() => {\n const p = provider as ProviderFactoryToken<T>;\n\n const dependencies = this.providerModule.getMany(...(p.inject ?? []));\n\n return p.useFactory(...dependencies);\n }),\n },\n ];\n\n const { bind } = binders.find(({ providerTypeMatches }) => providerTypeMatches(provider)) ?? {};\n if (!bind) {\n throw new InjectionProviderModuleUnknownProviderError(this.providerModule, provider);\n }\n\n const isProviderIdentifier = ProviderTokenHelpers.isProviderIdentifier(provider);\n\n // Create initial inversify binding fluent syntax object\n let binding = bind();\n\n // A `ValueToken` is always a constant, so there's no point in binding a specific scope.\n // And if the provider is a simple `ProviderIdentifier` then it means that it'll use the container default scope.\n if (!ProviderTokenHelpers.isValueToken(provider) && !isProviderIdentifier) {\n binding = this.setBindingScope(provider, binding as BindInWhenOnFluentSyntax<any>);\n }\n\n // If it is a simple `ProviderIdentifier` there's nothing more we can do\n // as it is not an object which contains the `ProviderOptions` properties.\n if (isProviderIdentifier) return;\n\n const opts = provider as ProviderOptions<unknown>;\n\n if (opts.when) {\n binding.when(opts.when) as any;\n }\n }\n\n setBindingScope<T>(provider: ProviderToken<T>, binding: BindInWhenOnFluentSyntax<T>): BindWhenOnFluentSyntax<T> {\n const injectionScope = ProviderTokenHelpers.getInjectionScopeByPriority(\n provider,\n this.providerModule.options.defaultScope ?? InjectionScope.Singleton\n );\n\n switch (injectionScope) {\n case InjectionScope.Singleton:\n return binding.inSingletonScope();\n case InjectionScope.Transient:\n return binding.inTransientScope();\n case InjectionScope.Request:\n return binding.inRequestScope();\n }\n }\n\n dispose(): void {\n //@ts-expect-error Read-only property.\n this.providerModule = null;\n //@ts-expect-error Read-only property.\n this.container = null;\n }\n\n private getProvider<T>(provider: ProviderToken<T>, asList?: boolean): T | T[] | void {\n const providerIdentifier = ProviderTokenHelpers.toProviderIdentifier(provider);\n\n if (asList) {\n return this.container.getAll(providerIdentifier, { optional: true });\n }\n\n return this.container.get(providerIdentifier, { optional: true });\n }\n}\n","import { Container } from 'inversify';\n\nexport const AppModuleInversifyContainer = new Container({ defaultScope: 'Singleton' });\n","import { ContainerModule, type ContainerModuleLoadOptions } from 'inversify';\n\nimport { DefinitionEventType, MiddlewareType } from '../../enums';\nimport { ProviderModuleHelpers, ProviderTokenHelpers } from '../../helpers';\nimport type { ExportsDefinitionOptimized, ModuleDefinition, ProviderToken } from '../../types';\nimport { ProviderModule } from '../provider-module/provider-module';\n\nexport class ImportedModuleContainer {\n get moduleDef(): ModuleDefinition<true> {\n return this.providerModule.dynamicModuleDef.moduleDef;\n }\n\n /** The {@link ProviderModule} which imported {@link providerModule | this} module. */\n private readonly importedIntoModule: ProviderModule;\n private readonly providerModule: ProviderModule;\n private readonly proxyContainer: ContainerModule;\n private proxyContainerOptions!: ContainerModuleLoadOptions;\n\n constructor(importedIntoModule: ProviderModule, providerModule: ProviderModule) {\n this.importedIntoModule = importedIntoModule;\n this.providerModule = providerModule;\n\n this.proxyContainer = this.buildProxyContainer();\n }\n\n dispose(): void {\n this.importedIntoModule.moduleContainer.container.unloadSync(this.proxyContainer);\n\n //@ts-expect-error Read-only property.\n this.importedIntoModule = null;\n //@ts-expect-error Read-only property.\n this.providerModule = null;\n //@ts-expect-error Read-only property.\n this.proxyContainer = null;\n //@ts-expect-error Read-only property.\n this.proxyContainerOptions = null;\n }\n\n private buildProxyContainer(): ContainerModule {\n const proxyContainer = new ContainerModule((options) => {\n this.proxyContainerOptions = options;\n\n this.traverseExportGraph((providerToken, foundInModule) => {\n this.proxyProviderIdentifier(providerToken, foundInModule);\n }, this.moduleDef.exports);\n\n // Subscribe to export changes only on this imported module.\n this.providerModule.dynamicModuleDef.event$.subscribe(({ type, change }) => {\n if (type !== DefinitionEventType.Export && type !== DefinitionEventType.ExportRemoved) return;\n\n const changeIsProvider = !ProviderModuleHelpers.isModule(change);\n\n if (changeIsProvider) {\n if (type === DefinitionEventType.Export) {\n this.proxyProviderIdentifier(change, this.providerModule);\n } else if (type === DefinitionEventType.ExportRemoved) {\n this.unproxyProviderIdentifier(change);\n }\n\n return;\n }\n\n // change is a module added or removed from exports\n const changedModule = change as ProviderModule;\n\n if (type === DefinitionEventType.Export) {\n // New exported module added: bind its providers recursively\n this.traverseExportGraph((providerToken, foundInModule) => {\n this.proxyProviderIdentifier(providerToken, foundInModule);\n }, changedModule.dynamicModuleDef.moduleDef.exports);\n } else {\n // Exported module removed: unbind its providers recursively\n this.traverseExportGraph((providerToken) => {\n this.unproxyProviderIdentifier(providerToken);\n }, changedModule.dynamicModuleDef.moduleDef.exports);\n }\n });\n });\n\n this.importedIntoModule.moduleContainer.container.loadSync(proxyContainer);\n\n return proxyContainer;\n }\n\n private proxyProviderIdentifier(providerToken: ProviderToken, fromModule: ProviderModule): void {\n const providerIdentifier = ProviderTokenHelpers.toProviderIdentifier(providerToken);\n\n if (this.proxyContainerOptions.isBound(providerIdentifier)) return;\n\n const bind = this.proxyContainerOptions.bind(providerIdentifier).toDynamicValue(() => {\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares(\n MiddlewareType.OnExportAccess,\n this.importedIntoModule,\n providerIdentifier\n );\n\n if (middlewareResult === false) {\n this.proxyContainerOptions.unbind(providerIdentifier);\n return undefined;\n }\n\n return fromModule.moduleContainer.container.get(providerIdentifier);\n });\n\n this.providerModule.moduleContainer.setBindingScope(providerToken, bind);\n }\n\n private unproxyProviderIdentifier(providerToken: ProviderToken): void {\n const providerIdentifier = ProviderTokenHelpers.toProviderIdentifier(providerToken);\n\n /* istanbul ignore next */\n if (!this.proxyContainerOptions.isBound(providerIdentifier)) return;\n\n this.proxyContainerOptions.unbind(providerIdentifier);\n }\n\n private traverseExportGraph(\n cb: (providerToken: ProviderToken, foundInModule: ProviderModule) => void,\n currentExportsNode: ExportsDefinitionOptimized\n ): void {\n // As the `exports` array can be a mix of `Providers` and `Modules`\n // we want to tap into the `exports` of an imported module as the last resort\n // as that could mean recursively going into the `exports` of the imported module and so on.\n //\n // Therefore we first iterate over the entire array and cache any module we find\n // into the `discoveredExportedModules` temporary array, then skip over the iteration,\n // this allows us to make sure that we always 1st try to get the provider from the current `export`\n // and only as a last resort to tap into the `exports` of the imported modules by iterating over the `discoveredExportedModules` temp array.\n\n const discoveredExportedModules: ProviderModule[] = [];\n\n for (const exportedModuleOrProvider of currentExportsNode) {\n const isModule = exportedModuleOrProvider instanceof ProviderModule;\n if (isModule) {\n discoveredExportedModules.push(exportedModuleOrProvider);\n\n // Will get to it later in the eventuality we'll not find the\n // provider into the current `exports` of the imported module.\n continue;\n } else {\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares(\n MiddlewareType.OnExportAccess,\n this.importedIntoModule,\n exportedModuleOrProvider\n );\n\n if (middlewareResult === false) continue;\n\n // Found it into the `exports` of this imported module.\n cb(exportedModuleOrProvider as any, this.providerModule);\n }\n }\n\n // If we got here it means that the `provider` has not been found in the\n // `exports` of the current imported module, therefore we must recursively drill into\n // the exported modules of the imported module.\n for (const exportedModule of discoveredExportedModules) {\n this.traverseExportGraph(cb, exportedModule.dynamicModuleDef.moduleDef.exports);\n }\n }\n}\n","export class Signal<T> {\n private value: T;\n\n private readonly subscribers = new Set<SignalCallback<T>>();\n\n constructor(initialValue: T) {\n this.value = initialValue;\n }\n\n /** Can be used to `emit` a _new_ value and notify the _subscribers_. */\n emit(newValue: T): void {\n this.value = newValue;\n\n this.subscribers.forEach((cb) => cb(this.value));\n }\n\n /** Can be used to retrieve the _current_ value of the {@link Signal} imperatively. */\n get(): T {\n return this.value;\n }\n\n /**\n * Can be used to `subscribe` to the emitted values of this {@link Signal}.\n *\n * @param callback The `callback` which will be invoked when a _new_ value is emitted.\n * @param invokeImmediately When set to `true` it'll invoke the provided {@link callback} immediately with the latest value available. _(defaults to `false`)_\n */\n subscribe(callback: SignalCallback<T>, invokeImmediately?: boolean): () => void {\n this.subscribers.add(callback);\n\n if (invokeImmediately) callback(this.value);\n\n return () => this.subscribers.delete(callback);\n }\n\n /** Disposes of the internal references. */\n dispose(): void {\n //@ts-expect-error Read-only property.\n this.subscribers = null;\n this.value = null as any;\n }\n}\n\ntype SignalCallback<T> = (value: T) => void | Promise<void>;\n","import { DefinitionEventType, MiddlewareType } from '../../enums';\nimport { InjectionProviderModuleDisposedError, InjectionProviderModuleError } from '../../errors';\nimport { ProviderModuleHelpers, ProviderTokenHelpers } from '../../helpers';\nimport type {\n AsyncMethod,\n DependencyProvider,\n ExportDefinition,\n ModuleDefinition,\n ModuleOrBlueprint,\n} from '../../types';\nimport { Signal } from '../../utils';\nimport { ImportedModuleContainer, type ModuleContainer } from '../container';\nimport type { IProviderModule, ProviderModuleOptions } from '../provider-module';\nimport type { ProviderModule } from '../provider-module/provider-module';\nimport type { DefinitionEvent, IDynamicModuleDefinition } from './interfaces';\n\nexport class DynamicModuleDefinition implements IDynamicModuleDefinition {\n get moduleContainer(): ModuleContainer {\n return this.providerModule.moduleContainer;\n }\n\n get subscribe(): IDynamicModuleDefinition['subscribe'] {\n /* istanbul ignore next */\n if (this.event$ === null) {\n throw new InjectionProviderModuleDisposedError(this.providerModule);\n }\n\n return this.event$.subscribe.bind(this.event$);\n }\n\n readonly moduleDef: ModuleDefinition<true>;\n readonly event$ = new Signal<DefinitionEvent>({\n type: DefinitionEventType.Noop,\n change: null,\n });\n\n private readonly providerModule: ProviderModule;\n private emittingModules = new Set<ProviderModule>();\n\n // Track subscriptions to imported modules' events for bubbling\n private importedModuleSubscriptions = new Map<ProviderModule, () => void>();\n\n constructor(providerModule: ProviderModule) {\n this.providerModule = providerModule;\n this.moduleDef = {\n imports: new Set(),\n providers: new Set(),\n exports: new Set(),\n };\n\n this.buildInitialDefinition(providerModule.options);\n }\n\n addImport(moduleOrBlueprint: ModuleOrBlueprint, addToExports = false): void {\n let providerModule = ProviderModuleHelpers.tryBlueprintToModule(moduleOrBlueprint) as ProviderModule;\n\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares<ProviderModule | false>(\n MiddlewareType.BeforeAddImport,\n providerModule\n );\n\n if (middlewareResult === false) return;\n providerModule = middlewareResult;\n\n this.moduleDef.imports.add(providerModule);\n\n this.createImportedModuleContainer(providerModule);\n\n // Subscribe to imported module's export events to bubble them\n this.subscribeToImportedModuleEvents(providerModule);\n\n this.emitEventSafely({\n type: DefinitionEventType.Export,\n change: providerModule,\n });\n\n this.emitEventSafely({\n type: DefinitionEventType.Import,\n change: providerModule,\n });\n\n if (!addToExports) return;\n\n this.moduleDef.exports.add(providerModule);\n\n this.emitEventSafely({\n type: DefinitionEventType.ExportModule,\n change: providerModule,\n });\n }\n\n async addImportLazy(lazyCb: AsyncMethod<ProviderModule>, addToExports?: boolean): Promise<void> {\n const providerModule = await lazyCb();\n\n this.addImport(providerModule, addToExports);\n }\n\n addProvider<T>(provider: DependencyProvider<T>, addToExports = false): void {\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares<DependencyProvider<T> | false>(\n MiddlewareType.BeforeAddProvider,\n provider\n );\n\n if (middlewareResult === false) return;\n provider = middlewareResult;\n\n this.moduleDef.providers.add(provider);\n\n this.moduleContainer.bindToContainer(provider);\n\n this.emitEventSafely({\n type: DefinitionEventType.Provider,\n change: provider,\n });\n\n if (!addToExports) return;\n\n this.moduleDef.exports.add(provider);\n\n this.emitEventSafely({\n type: DefinitionEventType.Export,\n change: provider,\n });\n\n this.emitEventSafely({\n type: DefinitionEventType.ExportProvider,\n change: provider,\n });\n }\n\n async addProviderLazy<T>(lazyCb: AsyncMethod<DependencyProvider<T>>, addToExports?: boolean): Promise<void> {\n const provider = await lazyCb();\n\n this.addProvider(provider, addToExports);\n }\n\n removeImport(module: IProviderModule): boolean {\n /* istanbul ignore next */\n if (!this.moduleDef.imports.has(module)) return false;\n\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares(\n MiddlewareType.BeforeRemoveImport,\n module\n );\n\n if (middlewareResult === false) return false;\n\n this.unsubscribeFromImportedModuleEvents(module as ProviderModule);\n\n const importedModuleContainer = this.providerModule.importedModuleContainers.get(module)!;\n importedModuleContainer.dispose();\n this.providerModule.importedModuleContainers.delete(module);\n this.moduleDef.imports.delete(module);\n\n this.emitEventSafely({\n type: DefinitionEventType.ImportRemoved,\n change: module,\n });\n\n this.removeFromExports(module);\n\n return true;\n }\n\n removeProvider<T>(provider: DependencyProvider<T>): boolean {\n if (!this.moduleDef.providers.has(provider)) return false;\n\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares(\n MiddlewareType.BeforeRemoveProvider,\n provider\n );\n\n if (middlewareResult === false) return false;\n\n this.moduleDef.providers.delete(provider);\n this.moduleContainer.container.unbindSync(ProviderTokenHelpers.toProviderIdentifier(provider));\n\n this.emitEventSafely({\n type: DefinitionEventType.ProviderRemoved,\n change: provider,\n });\n\n this.removeFromExports(provider);\n\n return true;\n }\n\n removeFromExports(exportDefinition: ExportDefinition): boolean {\n if (!this.moduleDef.exports.has(exportDefinition)) return false;\n\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares(\n MiddlewareType.BeforeRemoveExport,\n exportDefinition\n );\n\n if (middlewareResult === false) return false;\n\n this.moduleDef.exports.delete(exportDefinition);\n\n this.emitEventSafely({\n type: DefinitionEventType.ExportRemoved,\n change: exportDefinition,\n });\n\n if (ProviderModuleHelpers.isModule(exportDefinition)) {\n this.emitEventSafely({\n type: DefinitionEventType.ExportModuleRemoved,\n change: exportDefinition,\n });\n } else {\n this.emitEventSafely({\n type: DefinitionEventType.ExportProviderRemoved,\n change: exportDefinition,\n });\n }\n\n return true;\n }\n\n emitEventSafely(event: DefinitionEvent): void {\n if (this.emittingModules.has(this.providerModule)) {\n // Already emitting for this module, skip to prevent cycle\n return;\n }\n\n try {\n this.emittingModules.add(this.providerModule);\n this.event$.emit(event);\n } finally {\n this.emittingModules.delete(this.providerModule);\n }\n }\n\n dispose(): void {\n //@ts-expect-error Null not assignable.\n this.importedModuleSubscriptions = null;\n //@ts-expect-error Null not assignable.\n this.emittingModules = null;\n\n this.event$.dispose();\n //@ts-expect-error Read-only property.\n this.event$ = null;\n //@ts-expect-error Read-only property.\n this.moduleDef = null;\n }\n\n private buildInitialDefinition({ imports = [], providers = [], exports = [] }: ProviderModuleOptions): void {\n //@ts-expect-error Read-only property.\n this.moduleDef.providers = new Set(providers);\n\n exports.forEach((x) => {\n // We do not want to add `modules` or `blueprint` at this stage in the `exports` definition,\n // as if it is a `blueprint` we must first \"convert\" it to a `module`.\n // (which will happen down here in the `imports.forEach` loop)\n\n if (ProviderModuleHelpers.isModuleOrBlueprint(x)) return;\n\n this.moduleDef.exports.add(x);\n });\n\n imports.forEach((imp) => {\n const isModule = ProviderModuleHelpers.isModule(imp);\n const isGlobal = isModule ? (imp as ProviderModule).options.isGlobal : imp.isGlobal;\n\n // Importing global modules is pointless as\n // each module has access to the `AppModule`.\n if (isGlobal) return;\n\n const importedModule = ProviderModuleHelpers.tryBlueprintToModule(imp) as ProviderModule;\n const isPartOfTheExportsList = exports.some(\n (x) => ProviderModuleHelpers.isModuleOrBlueprint(x) && x.id === importedModule.id\n );\n\n this.addImport(importedModule, isPartOfTheExportsList);\n });\n }\n\n private createImportedModuleContainer(importedModule: ProviderModule): void {\n if (importedModule.isAppModule) {\n throw new InjectionProviderModuleError(this.providerModule, `The 'AppModule' can't be imported!`);\n }\n\n this.providerModule.importedModuleContainers.set(\n importedModule,\n new ImportedModuleContainer(this.providerModule, importedModule)\n );\n }\n\n private subscribeToImportedModuleEvents(importedModule: ProviderModule): void {\n if (this.importedModuleSubscriptions.has(importedModule)) return;\n\n const subscription = importedModule.dynamicModuleDef.event$.subscribe(({ type, change }) => {\n // Bubble only export-related events up to this module's event$\n switch (type) {\n case DefinitionEventType.Export:\n case DefinitionEventType.ExportRemoved:\n case DefinitionEventType.ExportModule:\n case DefinitionEventType.ExportModuleRemoved:\n case DefinitionEventType.ExportProvider:\n case DefinitionEventType.ExportProviderRemoved:\n this.emitEventSafely({ type, change });\n break;\n }\n });\n\n this.importedModuleSubscriptions.set(importedModule, subscription);\n }\n\n private unsubscribeFromImportedModuleEvents(importedModule: ProviderModule): void {\n const unsubscribe = this.importedModuleSubscriptions.get(importedModule);\n /* istanbul ignore next */\n if (!unsubscribe) return;\n\n unsubscribe();\n this.importedModuleSubscriptions.delete(importedModule);\n }\n}\n","import { MiddlewareType } from '../../enums';\nimport { InjectionProviderModuleDisposedError } from '../../errors';\nimport type { ProviderModule } from '../provider-module';\nimport type { AddMiddlewareCallbackType, IMiddlewaresManager } from './middlewares-manager.interfaces';\n\nexport class MiddlewaresManager implements IMiddlewaresManager {\n private middlewaresMap: Map<MiddlewareType, Function[]> = new Map();\n private readonly providerModule: ProviderModule;\n\n constructor(providerModule: ProviderModule) {\n this.providerModule = providerModule;\n }\n\n add<T extends MiddlewareType>(type: MiddlewareType, cb: AddMiddlewareCallbackType<T>): void {\n const currentMiddlewares = this.middlewaresMap.get(type);\n\n if (currentMiddlewares) {\n currentMiddlewares.push(cb);\n\n return;\n }\n\n // First middleware\n this.middlewaresMap.set(type, [cb]);\n }\n\n applyMiddlewares<T>(type: MiddlewareType, ...args: any[]): T {\n if (this.middlewaresMap === null) throw new InjectionProviderModuleDisposedError(this.providerModule);\n\n const middlewares = this.middlewaresMap.get(type);\n\n switch (type) {\n case MiddlewareType.BeforeAddImport:\n case MiddlewareType.BeforeAddProvider:\n if (!middlewares) return args[0];\n\n let chainedArg = args[0];\n\n for (const middleware of middlewares) {\n const result = middleware(chainedArg);\n\n if (result === false) return false as T;\n if (result === true) continue;\n\n chainedArg = result;\n }\n\n return chainedArg;\n\n case MiddlewareType.BeforeGet:\n return !middlewares\n ? args[0]\n : middlewares.reduce((arg, middleware) => middleware(arg, args[1], args[2]), args[0]);\n\n case MiddlewareType.BeforeRemoveImport:\n case MiddlewareType.BeforeRemoveProvider:\n case MiddlewareType.BeforeRemoveExport:\n case MiddlewareType.OnExportAccess:\n return (!middlewares || !middlewares.some((middleware) => !middleware(args[0], args[1]))) as T;\n }\n }\n\n clear(): void {\n this.middlewaresMap.clear();\n }\n\n dispose(): void {\n //@ts-expect-error `null` not being assignable to Map.\n this.middlewaresMap = null;\n }\n}\n","import { deepClone } from '../../helpers';\nimport { ProviderModule, type ProviderModuleOptions } from '../provider-module';\nimport type { ModuleBlueprintOptions } from './interfaces';\n\nexport class ProviderModuleBlueprint {\n id!: ProviderModuleOptions['id'];\n imports?: ProviderModuleOptions['imports'];\n providers?: ProviderModuleOptions['providers'];\n exports?: ProviderModuleOptions['exports'];\n defaultScope?: ProviderModuleOptions['defaultScope'];\n isGlobal?: ProviderModuleOptions['isGlobal'];\n onReady?: ProviderModuleOptions['onReady'];\n onReset?: ProviderModuleOptions['onReset'];\n onDispose?: ProviderModuleOptions['onDispose'];\n\n private readonly blueprintOptions: ModuleBlueprintOptions;\n\n constructor(options: ProviderModuleOptions, blueprintOptions?: ModuleBlueprintOptions) {\n this.updateDefinition(options);\n\n this.blueprintOptions = {\n autoImportIntoAppModuleWhenGlobal: blueprintOptions?.autoImportIntoAppModuleWhenGlobal ?? true,\n };\n\n this.convertToModuleAndInjectIntoAppModuleIfGlobal();\n }\n\n /** Can be used to update the {@link ProviderModuleBlueprint | Blueprint} definition. */\n updateDefinition(options: ProviderModuleOptions): this {\n this.id = options.id;\n this.imports = options.imports;\n this.providers = options.providers;\n this.exports = options.exports;\n this.defaultScope = options.defaultScope;\n this.isGlobal = options.isGlobal;\n this.onReady = options.onReady;\n this.onReset = options.onReset;\n this.onDispose = options.onDispose;\n\n return this;\n }\n\n /** Returns the {@link ProviderModuleOptions} of this {@link ProviderModuleBlueprint | Blueprint}. */\n getDefinition(): ProviderModuleOptions {\n return {\n id: this.id,\n imports: this.imports,\n providers: this.providers,\n exports: this.exports,\n defaultScope: this.defaultScope,\n isGlobal: this.isGlobal,\n onReady: this.onReady,\n onReset: this.onReset,\n onDispose: this.onDispose,\n };\n }\n\n /**\n * Can be used to instantiate a _new_ `blueprint` with the same exact options as _this_ one.\n *\n * **Note:** _Everything is deep cloned, you can safely overwrite all the properties of the cloned instance._\n */\n clone(): ProviderModuleBlueprint {\n return new ProviderModuleBlueprint(deepClone(this.getDefinition()), { ...this.blueprintOptions });\n }\n\n private convertToModuleAndInjectIntoAppModuleIfGlobal(): void {\n if (!this.isGlobal || !this.blueprintOptions?.autoImportIntoAppModuleWhenGlobal) return;\n\n ProviderModule.APP_MODULE_REF.update.addImport(this);\n }\n}\n","import { DefinitionEventType } from '../../enums';\nimport {\n InjectionError,\n InjectionProviderModuleDisposedError,\n InjectionProviderModuleMissingIdentifierError,\n} from '../../errors';\nimport { ProviderModuleHelpers, ProviderTokenHelpers } from '../../helpers';\nimport type { ModuleDefinition, ModuleIdentifier, ProviderIdentifier, ProviderToken } from '../../types';\nimport { ModuleContainer } from '../container';\nimport { ImportedModuleContainer } from '../container/imported-module-container';\nimport { DynamicModuleDefinition, type IDynamicModuleDefinition } from '../dynamic-module-definition';\nimport { MiddlewaresManager, type IMiddlewaresManager } from '../middlewares-manager';\nimport { ProviderModuleBlueprint, type ModuleBlueprintOptions } from '../provider-module-blueprint';\nimport type {\n IProviderModule,\n OnCleanupOptions,\n ProviderModuleGetManyParam,\n ProviderModuleGetManyReturn,\n ProviderModuleGetReturn,\n ProviderModuleOptions,\n ProviderModuleOptionsInternal,\n} from './types';\n\nexport class ProviderModule implements IProviderModule {\n get id(): ModuleIdentifier {\n return this.options.id;\n }\n\n get definition(): ModuleDefinition<true> {\n this.throwIfDisposed();\n\n return this.dynamicModuleDef.moduleDef;\n }\n\n get update(): IDynamicModuleDefinition {\n this.throwIfDisposed();\n\n return this.dynamicModuleDef;\n }\n\n get middlewares(): IMiddlewaresManager {\n this.throwIfDisposed();\n\n return this.middlewaresManager;\n }\n\n get isDisposed(): boolean {\n return this.disposed;\n }\n\n get isAppModule(): boolean {\n return this.id === 'AppModule';\n }\n\n /**\n * Holds a reference to the `AppModule`.\n *\n * Static property needed in order to avoid introducing a _cirular dependency_ between\n * the `AppModule` instance and the `ProviderModule` class.\n */\n static readonly APP_MODULE_REF: IProviderModule;\n\n readonly appModuleRef: ProviderModule;\n readonly options: ProviderModuleOptions;\n readonly middlewaresManager: MiddlewaresManager;\n readonly dynamicModuleDef: DynamicModuleDefinition;\n readonly moduleContainer: ModuleContainer;\n readonly importedModuleContainers: Map<IProviderModule, ImportedModuleContainer> = new Map();\n\n private disposed = false;\n\n constructor({\n appModuleRef: appModule = ProviderModule.APP_MODULE_REF,\n inversify,\n ...publicOptions\n }: ProviderModuleOptionsInternal) {\n this.appModuleRef = appModule as ProviderModule;\n this.options = publicOptions;\n\n this.throwIfIdIsMissing();\n\n this.middlewaresManager = new MiddlewaresManager(this);\n this.moduleContainer = new ModuleContainer(this, inversify?.parentContainer);\n this.dynamicModuleDef = new DynamicModuleDefinition(this);\n\n if (!this.isAppModule && this.options.isGlobal) {\n this.appModuleRef.update.addImport(this, true);\n }\n\n this.options.onReady?.(this);\n }\n\n static create(optionsOrBlueprint: ProviderModuleOptions | ProviderModuleBlueprint): IProviderModule {\n const options = ProviderModuleHelpers.isBlueprint(optionsOrBlueprint)\n ? optionsOrBlueprint.getDefinition()\n : optionsOrBlueprint;\n\n if (options.id === 'AppModule') {\n throw new InjectionError(\n `The 'AppModule' id can't be used as it is already being used by the built-in 'AppModule'`\n );\n }\n\n return new ProviderModule(options as any);\n }\n\n static blueprint(\n moduleOptions: ProviderModuleOptions,\n blueprintOptions?: ModuleBlueprintOptions\n ): ProviderModuleBlueprint {\n return new ProviderModuleBlueprint(moduleOptions, blueprintOptions);\n }\n\n isImportingModule(idOrModule: ModuleIdentifier | IProviderModule): boolean {\n this.throwIfDisposed();\n\n if (ProviderModuleHelpers.isModule(idOrModule)) {\n return this.importedModuleContainers.has(idOrModule);\n }\n\n return this.importedModuleContainers.keys().some((m) => m.id === idOrModule);\n }\n\n hasProvider<T>(provider: ProviderToken<T>): boolean {\n this.throwIfDisposed();\n\n const providerIdentifier = ProviderTokenHelpers.toProviderIdentifier(provider);\n\n return this.moduleContainer.container.isBound(providerIdentifier);\n }\n\n get<T, IsOptional extends boolean | undefined = undefined, AsList extends boolean | undefined = undefined>(\n provider: ProviderToken<T>,\n isOptional?: IsOptional,\n asList?: AsList\n ): ProviderModuleGetReturn<T, IsOptional, AsList> {\n this.throwIfDisposed();\n\n const value = this.moduleContainer.get<T, IsOptional, AsList>(provider, isOptional, asList);\n\n this.dynamicModuleDef.emitEventSafely({\n type: DefinitionEventType.GetProvider,\n change: value,\n });\n\n return value;\n }\n\n getMany<D extends (ProviderModuleGetManyParam<any> | ProviderToken)[]>(\n ...deps: D | unknown[]\n ): ProviderModuleGetManyReturn<D> {\n this.throwIfDisposed();\n\n return this.moduleContainer.getMany<D>(...deps);\n }\n\n isExportingModule(idOrModule: ModuleIdentifier | IProviderModule): boolean {\n this.throwIfDisposed();\n\n if (!this.isImportingModule(idOrModule)) return false;\n\n if (ProviderModuleHelpers.isModule(idOrModule)) {\n return this.definition.exports.has(idOrModule);\n }\n\n // It means that we have to search by the `ModuleIdentifier` instead,\n // this may be slower, but most times should be negligible.\n\n return this.definition.exports.keys().some((x) => ProviderModuleHelpers.isModule(x) && x.id === idOrModule);\n }\n\n isExportingProvider(tokenOrIdentifier: ProviderToken | ProviderIdentifier): boolean {\n this.throwIfDisposed();\n\n let found = this.definition.exports.has(tokenOrIdentifier);\n\n if (!found && ProviderTokenHelpers.isProviderIdentifier(tokenOrIdentifier)) {\n // It means that we have to search by the `ProviderIdentifier` instead,\n // this may be slower, but most times should be negligible.\n\n found = this.definition.exports\n .keys()\n .some(\n (x) =>\n !ProviderModuleHelpers.isModuleOrBlueprint(x) &&\n ProviderTokenHelpers.toProviderIdentifier(x) === tokenOrIdentifier\n );\n }\n\n return found;\n }\n\n async reset(shouldInvokeCb = true): Promise<void> {\n this.throwIfDisposed();\n\n let before: OnCleanupOptions['before'];\n let after: OnCleanupOptions['after'];\n\n if (shouldInvokeCb) {\n const cbs = (this.options.onReset?.() ?? {}) as OnCleanupOptions;\n\n before = cbs.before;\n after = cbs.after;\n\n await before?.(this);\n }\n\n this.middlewaresManager.clear();\n this.moduleContainer.container.unbindAll();\n this.definition.imports.clear();\n this.definition.providers.clear();\n this.definition.exports.clear();\n this.importedModuleContainers.clear();\n\n if (shouldInvokeCb) {\n await after?.();\n }\n }\n\n async dispose(): Promise<void> {\n this.throwIfDisposed();\n\n const { before, after } = this.options.onDispose?.() ?? {};\n await before?.(this);\n\n await this.reset(false);\n\n this.middlewaresManager.dispose();\n this.dynamicModuleDef.dispose();\n /* istanbul ignore next */\n this.importedModuleContainers.forEach((x) => x.dispose());\n this.moduleContainer.dispose();\n\n //@ts-expect-error Read-only property.\n this.options = {\n // We leave only the `id` as it is needed\n // to correctly show it when the `InjectionProviderModuleDisposedError` is thrown.\n id: this.options.id,\n };\n //@ts-expect-error Read-only property.\n this.dynamicModuleDef = null;\n //@ts-expect-error Read-only property.\n this.importedModuleContainers = null;\n //@ts-expect-error Read-only property.\n this.moduleContainer = null;\n\n this.disposed = true;\n\n await after?.();\n }\n\n toString(): string {\n return this.id.toString();\n }\n\n private throwIfIdIsMissing(): void {\n if (!this.options.id || this.options.id.toString().trim().length === 0) {\n throw new InjectionProviderModuleMissingIdentifierError(this);\n }\n }\n\n private throwIfDisposed(): void {\n if (!this.isDisposed) return;\n\n throw new InjectionProviderModuleDisposedError(this);\n }\n}\n","import { ProviderModule, type IProviderModule } from '../core/provider-module';\r\nimport { ProviderModuleBlueprint } from '../core/provider-module-blueprint/provider-module-blueprint';\r\n\r\nexport namespace ProviderModuleHelpers {\r\n export function isModule(value: any): value is IProviderModule {\r\n return value instanceof ProviderModule;\r\n }\r\n\r\n export function isBlueprint(value: any): value is ProviderModuleBlueprint {\r\n return value instanceof ProviderModuleBlueprint;\r\n }\r\n\r\n export function isModuleOrBlueprint(value: any): value is IProviderModule | ProviderModuleBlueprint {\r\n return isModule(value) || isBlueprint(value);\r\n }\r\n\r\n export function tryBlueprintToModule(value: IProviderModule | ProviderModuleBlueprint): IProviderModule {\r\n if (!(value instanceof ProviderModuleBlueprint)) return value;\r\n\r\n return blueprintToModule(value);\r\n }\r\n\r\n export function blueprintToModule(moduleBlueprint: ProviderModuleBlueprint): IProviderModule {\r\n return ProviderModule.create(moduleBlueprint.getDefinition());\r\n }\r\n}\r\n","export function isFunction(v: any): boolean {\n if (typeof v !== 'function') return false;\n\n return !Function.prototype.toString.call(v).startsWith('class ');\n}\n","export function deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== 'object') return obj;\n\n if (typeof obj === 'function') {\n // Create a new function that calls the original function\n // This ensures the cloned function is a different reference\n return ((...args: any[]) => (obj as any)(...args)) as any;\n }\n\n if (Array.isArray(obj)) return obj.map((item) => deepClone(item)) as T;\n\n const clonedObj: any = {};\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n clonedObj[key] = deepClone((obj as any)[key]);\n }\n }\n\n return clonedObj;\n}\n","import { inject as _inject } from 'inversify';\n\nimport { ProviderTokenHelpers } from '../helpers';\nimport type { ProviderToken } from '../types';\n\n/** See {@link https://inversify.io/docs/api/decorator/#inject} for more details. */\nexport function Inject(provider: ProviderToken) {\n return _inject(ProviderTokenHelpers.toProviderIdentifier(provider));\n}\n","import { multiInject as _multiInject } from 'inversify';\n\nimport { ProviderTokenHelpers } from '../helpers';\nimport type { ProviderToken } from '../types';\n\n/** See {@link https://inversify.io/docs/api/decorator/#multiinject} for more details. */\nexport function MultiInject(provider: ProviderToken) {\n return _multiInject(ProviderTokenHelpers.toProviderIdentifier(provider));\n}\n","import { injectFromBase as _injectFromBase } from 'inversify';\n\n/** See {@link https://inversify.io/docs/api/decorator/#injectfrombase} for more details. */\nexport function InjectFromBase(options?: Parameters<typeof _injectFromBase>[0]) {\n return _injectFromBase(options);\n}\n","import { named as _named, type MetadataName } from 'inversify';\n\n/** See {@link https://inversify.io/docs/api/decorator/#named} for more details. */\nexport function Named(name: MetadataName) {\n return _named(name);\n}\n","import { optional as _optional } from 'inversify';\n\n/** See {@link https://inversify.io/docs/api/decorator/#optional} for more details. */\nexport function Optional() {\n return _optional();\n}\n","import { tagged as _tagged, type MetadataTag } from 'inversify';\n\n/** See {@link https://inversify.io/docs/api/decorator/#tagged} for more details. */\nexport function Tagged(key: MetadataTag, value: unknown) {\n return _tagged(key, value);\n}\n","import { unmanaged as _unmanaged } from 'inversify';\n\n/** See {@link https://inversify.io/docs/api/decorator/#unmanaged} for more details. */\nexport function Unmanaged() {\n return _unmanaged();\n}\n","import type { IProviderModule } from '../provider-module';\nimport { ProviderModule } from '../provider-module/provider-module';\n\n/**\n * The `root` {@link IProviderModule} of your application.\n *\n * All global modules are imported into the {@link AppModule} and all your custom\n * modules inherit from it.\n */\nexport const AppModule = new ProviderModule({\n id: 'AppModule',\n}) as IProviderModule;\n\n//@ts-expect-error Read-only property.\n// This is done to avoid a circular dependency between\n// the `ProviderModule` class and the `AppModule` instance.\nProviderModule.APP_MODULE_REF = AppModule;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA,IAAAA,oBAA0C;;;ACAnC,IAAKC,iBAAAA,yBAAAA,iBAAAA;AACqE,EAAAA,gBAAAA,gBAAA,WAAA,IAAA,CAAA,IAAA;AAGA,EAAAA,gBAAAA,gBAAA,WAAA,IAAA,CAAA,IAAA;AAG2B,EAAAA,gBAAAA,gBAAA,SAAA,IAAA,CAAA,IAAA;SAPhGA;;;;ACAL,IAAKC,iBAAAA,yBAAAA,iBAAAA;AAQT,EAAAA,gBAAAA,gBAAA,iBAAA,IAAA,CAAA,IAAA;AAUA,EAAAA,gBAAAA,gBAAA,mBAAA,IAAA,CAAA,IAAA;AAOA,EAAAA,gBAAAA,gBAAA,WAAA,IAAA,CAAA,IAAA;AAQA,EAAAA,gBAAAA,gBAAA,oBAAA,IAAA,CAAA,IAAA;AAQA,EAAAA,gBAAAA,gBAAA,sBAAA,IAAA,CAAA,IAAA;AAQA,EAAAA,gBAAAA,gBAAA,oBAAA,IAAA,CAAA,IAAA;AASA,EAAAA,gBAAAA,gBAAA,gBAAA,IAAA,CAAA,IAAA;SA1DSA;;;;ACAL,IAAKC,sBAAAA,yBAAAA,sBAAAA;AACa,EAAAA,qBAAAA,qBAAA,MAAA,IAAA,CAAA,IAAA;AAOtB,EAAAA,qBAAAA,qBAAA,QA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BAAAA,aAAaC,qBAAqBC,qBAAqBH,QAAAA,CAAAA;AAChE;AAFgBD;;;ACNhB,IAAAK,oBAAkD;AAG3C,SAASC,eAAeC,SAA+C;AAC5E,aAAOC,kBAAAA,gBAAgBD,OAAAA;AACzB;AAFgBD;;;ACHhB,IAAAG,oBAAmD;AAG5C,SAASC,MAAMC,MAAkB;AACtC,aAAOC,kBAAAA,OAAOD,IAAAA;AAChB;AAFgBD;;;ACHhB,IAAAG,oBAAsC;AAG/B,SAASC,WAAAA;AACd,aAAOC,kBAAAA,UAAAA;AACT;AAFgBD;;;ACHhB,IAAAE,qBAAoD;AAG7C,SAASC,OAAOC,KAAkBC,OAAc;AACrD,aAAOC,mBAAAA,QAAQF,KAAKC,KAAAA;AACtB;AAFgBF;;;ACHhB,IAAAI,qBAAwC;AAGjC,SAASC,YAAAA;AACd,aAAOC,mBAAAA,WAAAA;AACT;AAFgBD;;;ACMT,IAAME,YAAY,IAAIC,eAAe;EAC1CC,IAAI;AACN,CAAA;AAKAD,eAAeE,iBAAiBH;","names":["import_inversify","InjectionScope","MiddlewareType","DefinitionEventType","injectionScopeToBindingScope","injectionScope","InjectionScope","Singleton","Transient","Request","bindingScopeToInjectionScope","bindingScope","isClass","v","Function","prototype","toString","call","startsWith","isClassOrFunction","value","isObject","o","Object","prototype","toString","call","isPlainObject","ctor","constructor","undefined","prot","hasOwnProperty","ProviderTokenHelpers","isClassToken","provider","hasProvideProperty","isValueToken","isFactoryToken","isProviderIdentifier","value","isClassOrFunction","toProviderIdentifier","provide","toProviderIdentifiers","providers","map","providerIdentifierToString","providerIdentifier","toString","name","providerTokenToString","providerToken","providerTokensAreEqual","p0","p1","id0","id1","useClass","useValue","useFactory","getInjectionScopeByPriority","moduleDefaultScope","tryGetScopeFromProvider","tryGetDecoratorScopeFromClass","tryGetProviderOptions","providerOptions","scope","providerClass","isClass","inversifyScope","getClassMetadata","bindingScopeToInjectionScope","isPlainObject","InjectionError","Error","name","InjectionProviderModuleError","Error","name","constructor","module","message","moduleId","toString","InjectionProviderModuleUnknownProviderError","InjectionProviderModuleError","name","constructor","module","providerToken","ProviderTokenHelpers","providerTokenToString","InjectionProviderModuleDisposedError","InjectionProviderModuleError","name","constructor","module","InjectionProviderModuleMissingIdentifierError","InjectionProviderModuleError","name","constructor","module","InjectionProviderModuleMissingProviderError","InjectionProviderModuleError","name","constructor","module","providerToken","ProviderTokenHelpers","providerTokenToString","import_inversify","AppModuleInversifyContainer","Container","defaultScope","ModuleContainer","container","providerModule","constructor","inversifyParentContainer","defaultScope","InjectionScope","Singleton","options","id","AppModuleInversifyContainer","Container","parent","appModuleRef","moduleContainer","injectionScopeToBindingScope","providers","forEach","x","bindToContainer","get","provider","isOptional","asList","middlewareResult","middlewaresManager","applyMiddlewares","MiddlewareType","BeforeGet","getProvider","bind","undefined","InjectionProviderModuleMissingProviderError","getMany","deps","map","dep","withOptions","isPlainObject","providerIdentifier","ProviderTokenHelpers","toProviderIdentifier","binders","providerTypeMatches","isProviderIdentifier","toSelf","isClassToken","to","useClass","isValueToken","toConstantValue","useValue","isFactoryToken","toResolvedValue","p","dependencies","inject","useFactory","find","InjectionProviderModuleUnknownProviderError","binding","setBindingScope","opts","when","injectionScope","getInjectionScopeByPriority","inSingletonScope","Transient","inTransientScope","Request","inRequestScope","dispose","getAll","optional","import_inversify","ImportedModuleContainer","moduleDef","providerModule","dynamicModuleDef","importedIntoModule","proxyContainer","proxyContainerOptions","constructor","buildProxyContainer","dispose","moduleContainer","container","unloadSync","ContainerModule","options","traverseExportGraph","providerToken","foundInModule","proxyProviderIdentifier","exports","event$","subscribe","type","change","DefinitionEventType","Export","ExportRemoved","changeIsProvider","ProviderModuleHelpers","isModule","unproxyProviderIdentifier","changedModule","loadSync","fromModule","providerIdentifier","ProviderTokenHelpers","toProviderIdentifier","isBound","bind","toDynamicValue","middlewareResult","middlewaresManager","applyMiddlewares","MiddlewareType","OnExportAccess","unbind","undefined","get","setBindingScope","cb","currentExportsNode","discoveredExportedModules","exportedModuleOrProvider","ProviderModule","push","exportedModule","Signal","value","subscribers","Set","constructor","initialValue","emit","newValue","forEach","cb","get","subscribe","callback","invokeImmediately","add","delete","dispose","DynamicModuleDefinition","moduleContainer","providerModule","subscribe","event$","InjectionProviderModuleDisposedError","bind","moduleDef","Signal","type","DefinitionEventType","Noop","change","emittingModules","Set","importedModuleSubscriptions","Map","constructor","imports","providers","exports","buildInitialDefinition","options","addImport","moduleOrBlueprint","addToExports","ProviderModuleHelpers","tryBlueprintToModule","middlewareResult","middlewaresManager","applyMiddlewares","MiddlewareType","BeforeAddImport","add","createImportedModuleContainer","subscribeToImportedModuleEvents","emitEventSafely","Export","Import","ExportModule","addImportLazy","lazyCb","addProvider","provider","BeforeAddProvider","bindToContainer","Provider","ExportProvider","addProviderLazy","removeImport","module","has","BeforeRemoveImport","unsubscribeFromImportedModuleEvents","importedModuleContainer","importedModuleContainers","get","dispose","delete","ImportRemoved","removeFromExports","removeProvider","BeforeRemoveProvider","container","unbindSync","ProviderTokenHelpers","toProviderIdentifier","ProviderRemoved","exportDefinition","BeforeRemoveExport","ExportRemoved","isModule","ExportModuleRemoved","ExportProviderRemoved","event","emit","forEach","x","isModuleOrBlueprint","imp","isGlobal","importedModule","isPartOfTheExportsList","some","id","isAppModule","InjectionProviderModuleError","set","ImportedModuleContainer","subscription","dynamicModuleDef","unsubscribe","MiddlewaresManager","middlewaresMap","Map","providerModule","constructor","add","type","cb","currentMiddlewares","get","push","set","applyMiddlewares","args","InjectionProviderModuleDisposedError","middlewares","MiddlewareType","BeforeAddImport","BeforeAddProvider","chainedArg","middleware","result","BeforeGet","reduce","arg","BeforeRemoveImport","BeforeRemoveProvider","BeforeRemoveExport","OnExportAccess","some","clear","dispose","ProviderModuleBlueprint","id","imports","providers","exports","defaultScope","isGlobal","onReady","onReset","onDispose","blueprintOptions","constructor","options","updateDefinition","autoImportIntoAppModuleWhenGlobal","convertToModuleAndInjectIntoAppModuleIfGlobal","getDefinition","clone","deepClone","ProviderModule","APP_MODULE_REF","update","addImport","ProviderModule","id","options","definition","throwIfDisposed","dynamicModuleDef","moduleDef","update","middlewares","middlewaresManager","isDisposed","disposed","isAppModule","APP_MODULE_REF","appModuleRef","moduleContainer","importedModuleContainers","Map","constructor","appModule","inversify","publicOptions","throwIfIdIsMissing","MiddlewaresManager","ModuleContainer","parentContainer","DynamicModuleDefinition","isGlobal","addImport","onReady","create","optionsOrBlueprint","ProviderModuleHelpers","isBlueprint","getDefinition","InjectionError","blueprint","moduleOptions","blueprintOptions","ProviderModuleBlueprint","isImportingModule","idOrModule","isModule","has","keys","some","m","hasProvider","provider","providerIdentifier","ProviderTokenHelpers","toProviderIdentifier","container","isBound","get","isOptional","asList","value","emitEventSafely","type","DefinitionEventType","GetProvider","change","getMany","deps","isExportingModule","exports","x","isExportingProvider","tokenOrIdentifier","found","isProviderIdentifier","isModuleOrBlueprint","reset","shouldInvokeCb","before","after","cbs","onReset","clear","unbindAll","imports","providers","dispose","onDispose","forEach","toString","trim","length","InjectionProviderModuleMissingIdentifierError","InjectionProviderModuleDisposedError","ProviderModuleHelpers","isModule","value","ProviderModule","isBlueprint","ProviderModuleBlueprint","isModuleOrBlueprint","tryBlueprintToModule","blueprintToModule","moduleBlueprint","create","getDefinition","isFunction","v","Function","prototype","toString","call","startsWith","deepClone","obj","args","Array","isArray","map","item","clonedObj","key","Object","prototype","hasOwnProperty","call","Injectable","scope","undefined","_injectable","injectionScopeToBindingScope","import_inversify","Inject","provider","_inject","ProviderTokenHelpers","toProviderIdentifier","import_inversify","MultiInject","provider","_multiInject","ProviderTokenHelpers","toProviderIdentifier","import_inversify","InjectFromBase","options","_injectFromBase","import_inversify","Named","name","_named","import_inversify","Optional","_optional","import_inversify","Tagged","key","value","_tagged","import_inversify","Unmanaged","_unmanaged","AppModule","ProviderModule","id","APP_MODULE_REF"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/decorators/injectable.ts","../src/enums/injection-scope.enum.ts","../src/enums/middleware-type.enum.ts","../src/enums/definition-event-type.enum.ts","../src/helpers/scope-converter.ts","../src/helpers/provider-token.ts","../src/helpers/is-class.ts","../src/helpers/is-class-or-function.ts","../src/helpers/is-plain-object.ts","../src/errors/base.error.ts","../src/errors/provider-module.error.ts","../src/errors/provider-module-unknown-provider.ts","../src/errors/provider-module-disposed.error.ts","../src/errors/provider-module-missing-identifier.ts","../src/errors/provider-module-missing-provider.ts","../src/core/container/module-container.ts","../src/core/app-module/container.ts","../src/core/container/imported-module-container.ts","../src/utils/signal.ts","../src/core/dynamic-module-definition/dynamic-module-definition.ts","../src/core/middlewares-manager/middlewares-manager.ts","../src/core/provider-module-blueprint/provider-module-blueprint.ts","../src/core/provider-module/provider-module.ts","../src/helpers/provider-module.ts","../src/helpers/is-function.ts","../src/helpers/deep-clone.ts","../src/decorators/inject.ts","../src/decorators/multi-inject.ts","../src/decorators/inject-from-base.ts","../src/decorators/named.ts","../src/decorators/optional.ts","../src/decorators/tagged.ts","../src/decorators/unmanaged.ts","../src/core/app-module/app.module.ts"],"sourcesContent":["export * from './decorators';\nexport * from './errors';\nexport * from './enums';\nexport * from './helpers';\n\nexport { AppModule, ProviderModule, ProviderModuleBlueprint } from './core';\n\nexport type {\n IProviderModule,\n ProviderModuleOptions,\n ProviderModuleOptionsInternal,\n ProviderModuleGetReturn,\n ProviderModuleGetManyParam,\n ProviderModuleGetManyReturn,\n} from './core';\nexport type {\n DependencyProvider,\n ProviderToken,\n ProviderClassToken,\n ProviderValueToken,\n ProviderFactoryToken,\n ProviderIdentifier,\n ProviderOptions,\n ProviderScopeOption,\n ExportDefinition,\n ExportsDefinition,\n ExportsDefinitionOptimized,\n} from './types';\n","import { injectable as _injectable } from 'inversify';\n\nimport { InjectionScope } from '../enums';\nimport { injectionScopeToBindingScope } from '../helpers';\n\n/** See {@link https://inversify.io/docs/api/decorator/#injectable} for more details. */\nexport function Injectable(scope?: InjectionScope) {\n if (scope === undefined) return _injectable();\n\n return _injectable(injectionScopeToBindingScope(scope));\n}\n","export enum InjectionScope {\n /** When the service is resolved, the same cached resolved value will be used. */\n Singleton,\n\n /** When the service is resolved, a new resolved value will be used each time. */\n Transient,\n\n /** When the service is resolved within the same container request, the same resolved value will be used. */\n Request,\n}\n","export enum MiddlewareType {\n /**\n * Can be used to register a `middleware` which will be invoked right before importing a `module` into _this_ module.\n *\n * The provided middleware `callback` can either return a `boolean` or a `ProviderModule` instance.\n *\n * **Note:** _Returning `true` can be used to pass through the middleware without modifying_\n * _the `ProviderModule` instance, while returning `false` will reject the request of importing that specific module._\n */\n BeforeAddImport,\n\n /**\n * Can be used to register a `middleware` which will be invoked right before adding a provider to _this_ module.\n *\n * The provided middleware `callback` can either return a `boolean` or a `ProviderToken` object type.\n *\n * **Note:** _Returning `true` can be used to pass through the middleware without modifying_\n * _the `ProviderToken` object, while returning `false` will reject the request of adding that specific provider._\n */\n BeforeAddProvider,\n\n /**\n * Can be used to register a `middleware` which will be invoked right before a provider is returned to the consumer from _this_ module container.\n *\n * The provided middleware `callback` can return `anything`.\n */\n BeforeGet,\n\n /**\n * Can be used to register a `middleware` which will be invoked right before removing an imported module from _this_ module.\n *\n * **Note:** _The provided middleware `callback` must return a `boolean` where `true` means that_\n * _the imported module can be removed and `false` means to keep it._\n */\n BeforeRemoveImport,\n\n /**\n * Can be used to register a `middleware` which will be invoked right before removing a provider from _this_ module.\n *\n * **Note:** _The provided middleware `callback` must return a `boolean` where `true` means that_\n * _the provider can be removed and `false` means to keep it._\n */\n BeforeRemoveProvider,\n\n /**\n * Can be used to register a `middleware` which will be invoked right before removing an `ExportDefinition` from _this_ module.\n *\n * **Note:** _The provided middleware `callback` must return a `boolean` where `true` means that_\n * _the `ExportDefinition` can be removed and `false` means to keep it._\n */\n BeforeRemoveExport,\n\n /**\n * Can be used to register a `middleware` which will be invoked each time\n * a _consumer_ `module` tries to access the `ExportDefinition` list of _this_ module to `get` a provider.\n *\n * **Note:** _The provided middleware `callback` will be invoked for each `ProviderToken` of the `ExportsDefinition` list_\n * _and must return a `boolean` where `true` means that the `ProviderToken` is authorized to be used by the importer module._\n */\n OnExportAccess,\n}\n","export enum DefinitionEventType {\n /** No-Operation, yet. */\n Noop,\n\n /**\n * A new `module` or `blueprint` has been added.\n *\n * **Note:** _The occurred change type is: `ModuleOrBlueprint`_\n */\n Import,\n\n /**\n * A new `provider` has been added.\n *\n * **Note:** _The occurred change type is: `DependencyProvider`_\n */\n Provider,\n\n /**\n * A `module` is retrieving from its container a `provider`.\n *\n * **Note:** _The occurred change type is: `any`_\n */\n GetProvider,\n\n /**\n * A new `module` or `provider` has been added to the `exports` definition.\n *\n * **Note:** _The occurred change type is: `ExportDefinition`_\n */\n Export,\n\n /**\n * A new `module` or `blueprint` has been added to the `exports` definition.\n *\n * **Note:** _The occurred change type is: `ModuleOrBlueprint`_\n */\n ExportModule,\n\n /**\n * A new `provider` has been added to the `exports` definition.\n *\n * **Note:** _The occurred change type is: `ProviderToken`_\n */\n ExportProvider,\n\n /**\n * A `module` has been removed.\n *\n * **Note:** _The occurred change type is: `IProviderModule`_\n */\n ImportRemoved,\n\n /**\n * A `provider` has been removed.\n *\n * **Note:** _The occurred change type is: `DependencyProvider`_\n */\n ProviderRemoved,\n\n /**\n * An `ExportDefinition` has been removed.\n *\n * **Note:** _The occurred change type is: `ExportDefinition`_\n */\n ExportRemoved,\n\n /**\n * A `module` has been removed from the `export` definition.\n *\n * **Note:** _The occurred change type is: `IProviderModule`_\n */\n ExportModuleRemoved,\n\n /**\n * A `provider` has been removed from the `export` definition.\n *\n * **Note:** _The occurred change type is: `ProviderToken`_\n */\n ExportProviderRemoved,\n}\n","import type { BindingScope } from 'inversify';\n\nimport { InjectionScope } from '../enums';\n\nexport function injectionScopeToBindingScope(injectionScope: InjectionScope): BindingScope {\n switch (injectionScope) {\n case InjectionScope.Singleton:\n return 'Singleton';\n case InjectionScope.Transient:\n return 'Transient';\n case InjectionScope.Request:\n return 'Request';\n }\n}\n\nexport function bindingScopeToInjectionScope(bindingScope: BindingScope): InjectionScope {\n switch (bindingScope) {\n case 'Singleton':\n return InjectionScope.Singleton;\n case 'Transient':\n return InjectionScope.Transient;\n case 'Request':\n return InjectionScope.Request;\n }\n}\n","import { getClassMetadata } from '@inversifyjs/core';\n\nimport { InjectionScope } from '../enums';\nimport type {\n ProviderClassToken,\n ProviderFactoryToken,\n ProviderIdentifier,\n ProviderOptions,\n ProviderScopeOption,\n ProviderToken,\n ProviderValueToken,\n} from '../types';\nimport { isClass } from './is-class';\nimport { isClassOrFunction } from './is-class-or-function';\nimport { isPlainObject } from './is-plain-object';\nimport { bindingScopeToInjectionScope } from './scope-converter';\n\nexport namespace ProviderTokenHelpers {\n export function isClassToken<T>(provider: ProviderToken<T>): provider is ProviderClassToken<T> {\n return hasProvideProperty(provider) && 'useClass' in provider;\n }\n\n export function isValueToken<T>(provider: ProviderToken<T>): provider is ProviderValueToken<T> {\n return hasProvideProperty(provider) && 'useValue' in provider;\n }\n\n export function isFactoryToken<T>(provider: ProviderToken<T>): provider is ProviderFactoryToken<T> {\n return hasProvideProperty(provider) && 'useFactory' in provider;\n }\n\n export function isProviderIdentifier<T = any>(value: any): value is ProviderIdentifier<T> {\n return typeof value === 'string' || typeof value === 'symbol' || isClassOrFunction(value);\n }\n\n export function toProviderIdentifier<T = any>(provider: ProviderToken<T>): ProviderIdentifier<T> {\n return isProviderIdentifier(provider) ? provider : provider.provide;\n }\n\n export function toProviderIdentifiers(providers: ProviderToken[]): ProviderIdentifier<unknown>[] {\n return providers.map((provider) => toProviderIdentifier(provider));\n }\n\n export function providerIdentifierToString(providerIdentifier: ProviderIdentifier): string {\n if (typeof providerIdentifier === 'symbol' || typeof providerIdentifier === 'string') {\n return providerIdentifier.toString();\n }\n\n return providerIdentifier.name;\n }\n\n export function providerTokenToString(providerToken: ProviderToken): string {\n const providerIdentifier = toProviderIdentifier(providerToken);\n\n return providerIdentifierToString(providerIdentifier);\n }\n\n export function providerTokensAreEqual(p0: ProviderToken, p1: ProviderToken): boolean {\n if (p0 === p1) return true;\n\n const id0 = toProviderIdentifier(p0);\n const id1 = toProviderIdentifier(p1);\n\n if (id0 !== id1) return false;\n\n if (isClassToken(p0) && isClassToken(p1)) {\n return p0.useClass === p1.useClass;\n }\n\n if (isValueToken(p0) && isValueToken(p1)) {\n return p0.useValue === p1.useValue;\n }\n\n if (isFactoryToken(p0) && isFactoryToken(p1)) {\n if (p0.useFactory !== p1.useFactory) return false;\n\n // const inject0 = p0.inject ?? [];\n // const inject1 = p1.inject ?? [];\n\n // if (inject0.length !== inject1.length) return false;\n\n // for (let i = 0; i < inject0.length; i++) {\n // if (inject0[i] !== inject1[i]) return false;\n // }\n\n return true;\n }\n\n // At this point, identifiers are equal but tokens are not class/value/factory tokens,\n // so consider them equal based on identifier alone.\n return true;\n }\n\n /**\n * The priority order is as follows:\n * 1. From the `ProviderToken.scope`\n * 2. From the class `@Injectable(scope)` decorator\n * 3. From the `ProviderModule` default scope.\n *\n * @param provider The {@link ProviderToken}.\n * @param moduleDefaultScope The module default scope.\n */\n export function getInjectionScopeByPriority(\n provider: ProviderToken,\n moduleDefaultScope: InjectionScope\n ): InjectionScope {\n return tryGetScopeFromProvider(provider) ?? tryGetDecoratorScopeFromClass(provider) ?? moduleDefaultScope;\n }\n\n export function tryGetProviderOptions<T>(\n provider: ProviderToken<T>\n ): (ProviderOptions<T> & ProviderScopeOption) | undefined {\n if (!hasProvideProperty(provider)) return;\n\n return provider as any;\n }\n\n export function tryGetScopeFromProvider(provider: ProviderToken): InjectionScope | undefined {\n const providerOptions = tryGetProviderOptions(provider);\n if (!providerOptions) return;\n\n return providerOptions.scope;\n }\n\n export function tryGetDecoratorScopeFromClass<T = any>(provider: ProviderToken<T>): InjectionScope | undefined {\n const providerClass = toProviderIdentifier(provider);\n if (!isClass(providerClass)) return;\n\n const inversifyScope = getClassMetadata(providerClass as any)?.scope;\n if (!inversifyScope) return;\n\n return bindingScopeToInjectionScope(inversifyScope);\n }\n\n function hasProvideProperty(provider: any): provider is object {\n return isPlainObject(provider) && typeof provider === 'object' && 'provide' in provider;\n }\n}\n","export function isClass(v: any): boolean {\n if (typeof v !== 'function') return false;\n\n return Function.prototype.toString.call(v).startsWith('class ');\n}\n","import type { Class } from 'type-fest';\n\nexport function isClassOrFunction(value: any): value is Function | Class<any> {\n return typeof value === 'function';\n}\n","/*\n * is-plain-object <https://github.com/jonschlinkert/is-plain-object>\n *\n * Copyright (c) 2014-2017, Jon Schlinkert.\n * Released under the MIT License.\n */\n\nfunction isObject(o: any): boolean {\n return Object.prototype.toString.call(o) === '[object Object]';\n}\n\nexport function isPlainObject(o: any): o is object {\n if (isObject(o) === false) return false;\n\n // If has modified constructor\n const ctor = o.constructor;\n if (ctor === undefined) return true;\n\n // If has modified prototype\n const prot = ctor.prototype;\n if (isObject(prot) === false) return false;\n\n // If constructor does not have an Object-specific method\n if (prot.hasOwnProperty('isPrototypeOf') === false) {\n return false;\n }\n\n // Most likely a plain Object\n return true;\n}\n","/** Exception which indicates that there is a generic error. */\nexport class InjectionError extends Error {\n override name = InjectionError.name;\n}\n","import type { IProviderModule } from '../core';\n\n/** Exception which indicates that there is a generic error with an instance of {@link IProviderModule}. */\nexport class InjectionProviderModuleError extends Error {\n override name = InjectionProviderModuleError.name;\n\n constructor(module: IProviderModule, message: string) {\n let moduleId = 'Unknown';\n\n try {\n moduleId = module.toString();\n } catch {}\n\n super(`{ProviderModule.${moduleId}} => ${message}`);\n }\n}\n","import type { IProviderModule } from '../core';\nimport { ProviderTokenHelpers } from '../helpers';\nimport type { ProviderToken } from '../types';\nimport { InjectionProviderModuleError } from './provider-module.error';\n\n/** Exception which indicates that an `unknown` type of {@link ProviderToken} has been supplied. */\nexport class InjectionProviderModuleUnknownProviderError extends InjectionProviderModuleError {\n override name = InjectionProviderModuleUnknownProviderError.name;\n\n constructor(module: IProviderModule, providerToken: ProviderToken) {\n super(module, `The [${ProviderTokenHelpers.providerTokenToString(providerToken)}] provider is of an unknown type!`);\n }\n}\n","import type { IProviderModule } from '../core';\nimport { InjectionProviderModuleError } from './provider-module.error';\n\n/** Exception which indicates an invokation of a disposed module. */\nexport class InjectionProviderModuleDisposedError extends InjectionProviderModuleError {\n override name = InjectionProviderModuleDisposedError.name;\n\n constructor(module: IProviderModule) {\n super(module, 'Has been disposed!');\n }\n}\n","import type { IProviderModule } from '../core';\nimport { InjectionProviderModuleError } from './provider-module.error';\n\n/** Exception which indicates that a module has been initialized without an `identifier`. */\nexport class InjectionProviderModuleMissingIdentifierError extends InjectionProviderModuleError {\n override name = InjectionProviderModuleMissingIdentifierError.name;\n\n constructor(module: IProviderModule) {\n super(module, 'An `identifier` must be supplied!');\n }\n}\n","import type { IProviderModule } from '../core';\nimport { ProviderTokenHelpers } from '../helpers';\nimport type { ProviderToken } from '../types';\nimport { InjectionProviderModuleError } from './provider-module.error';\n\n/** Exception which indicates that a module container does not contain the requested provider. */\nexport class InjectionProviderModuleMissingProviderError extends InjectionProviderModuleError {\n override name = InjectionProviderModuleMissingProviderError.name;\n\n constructor(module: IProviderModule, providerToken: ProviderToken) {\n super(\n module,\n `The [${ProviderTokenHelpers.providerTokenToString(providerToken)}] provider is not bound to this (or any imported) module container, and was not found either in the 'AppModule'!`\n );\n }\n}\n","import { Container, type BindInWhenOnFluentSyntax, type BindWhenOnFluentSyntax } from 'inversify';\n\nimport { InjectionScope, MiddlewareType } from '../../enums';\nimport { InjectionProviderModuleMissingProviderError, InjectionProviderModuleUnknownProviderError } from '../../errors';\nimport { injectionScopeToBindingScope, isPlainObject, ProviderTokenHelpers } from '../../helpers';\nimport type {\n DependencyProvider,\n ProviderClassToken,\n ProviderFactoryToken,\n ProviderOptions,\n ProviderToken,\n ProviderValueToken,\n} from '../../types';\nimport { AppModuleInversifyContainer } from '../app-module/container';\nimport type {\n ProviderModuleGetManyParam,\n ProviderModuleGetManyReturn,\n ProviderModuleGetReturn,\n} from '../provider-module';\nimport { ProviderModule } from '../provider-module/provider-module';\n\nexport class ModuleContainer {\n readonly container: Container;\n private readonly providerModule: ProviderModule;\n\n constructor(providerModule: ProviderModule, inversifyParentContainer?: Container) {\n this.providerModule = providerModule;\n\n const { defaultScope = InjectionScope.Singleton } = providerModule.options;\n\n this.container =\n providerModule.id === 'AppModule'\n ? AppModuleInversifyContainer\n : new Container({\n parent: inversifyParentContainer ?? this.providerModule.appModuleRef.moduleContainer.container,\n defaultScope: injectionScopeToBindingScope(defaultScope),\n });\n\n this.providerModule.options.providers?.forEach((x) => this.bindToContainer(x));\n }\n\n get<T, IsOptional extends boolean | undefined = undefined, AsList extends boolean | undefined = undefined>(\n provider: ProviderToken<T>,\n isOptional?: IsOptional,\n asList?: AsList\n ): ProviderModuleGetReturn<T, IsOptional, AsList> {\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares<any>(\n MiddlewareType.BeforeGet,\n this.getProvider(provider, asList),\n provider,\n this.getProvider.bind(this)\n );\n if (middlewareResult || middlewareResult === null) return middlewareResult;\n\n if (isOptional) return undefined as any;\n\n throw new InjectionProviderModuleMissingProviderError(this.providerModule, provider);\n }\n\n getMany<D extends (ProviderModuleGetManyParam<any> | ProviderToken)[]>(\n ...deps: D | unknown[]\n ): ProviderModuleGetManyReturn<D> {\n return (deps as D).map((dep) => {\n const withOptions = isPlainObject(dep) && 'provider' in dep;\n\n return this.get(\n withOptions ? dep.provider : dep,\n withOptions ? dep.isOptional : false,\n withOptions ? dep.asList : false\n );\n }) as any;\n }\n\n bindToContainer<T>(provider: DependencyProvider<T>): void {\n const providerIdentifier = ProviderTokenHelpers.toProviderIdentifier(provider);\n\n const binders: Array<{\n providerTypeMatches: (p: any) => boolean;\n bind: () => BindInWhenOnFluentSyntax<any> | BindWhenOnFluentSyntax<any>;\n }> = [\n {\n providerTypeMatches: ProviderTokenHelpers.isProviderIdentifier,\n bind: () => this.container.bind(providerIdentifier).toSelf(),\n },\n {\n providerTypeMatches: ProviderTokenHelpers.isClassToken,\n bind: () => this.container.bind(providerIdentifier).to((provider as ProviderClassToken<T>).useClass),\n },\n {\n providerTypeMatches: ProviderTokenHelpers.isValueToken,\n bind: () =>\n this.container.bind(providerIdentifier).toConstantValue((provider as ProviderValueToken<T>).useValue),\n },\n {\n providerTypeMatches: ProviderTokenHelpers.isFactoryToken,\n bind: () =>\n this.container.bind(providerIdentifier).toResolvedValue(() => {\n const p = provider as ProviderFactoryToken<T>;\n\n const dependencies = this.providerModule.getMany(...(p.inject ?? []));\n\n return p.useFactory(...dependencies);\n }),\n },\n ];\n\n const { bind } = binders.find(({ providerTypeMatches }) => providerTypeMatches(provider)) ?? {};\n if (!bind) {\n throw new InjectionProviderModuleUnknownProviderError(this.providerModule, provider);\n }\n\n const isProviderIdentifier = ProviderTokenHelpers.isProviderIdentifier(provider);\n\n // Create initial inversify binding fluent syntax object\n let binding = bind();\n\n // A `ValueToken` is always a constant, so there's no point in binding a specific scope.\n // And if the provider is a simple `ProviderIdentifier` then it means that it'll use the container default scope.\n if (!ProviderTokenHelpers.isValueToken(provider) && !isProviderIdentifier) {\n binding = this.setBindingScope(provider, binding as BindInWhenOnFluentSyntax<any>);\n }\n\n // If it is a simple `ProviderIdentifier` there's nothing more we can do\n // as it is not an object which contains the `ProviderOptions` properties.\n if (isProviderIdentifier) return;\n\n const opts = provider as ProviderOptions<unknown>;\n\n if (opts.when) {\n binding.when(opts.when) as any;\n }\n }\n\n setBindingScope<T>(provider: ProviderToken<T>, binding: BindInWhenOnFluentSyntax<T>): BindWhenOnFluentSyntax<T> {\n const injectionScope = ProviderTokenHelpers.getInjectionScopeByPriority(\n provider,\n this.providerModule.options.defaultScope ?? InjectionScope.Singleton\n );\n\n switch (injectionScope) {\n case InjectionScope.Singleton:\n return binding.inSingletonScope();\n case InjectionScope.Transient:\n return binding.inTransientScope();\n case InjectionScope.Request:\n return binding.inRequestScope();\n }\n }\n\n dispose(): void {\n //@ts-expect-error Read-only property.\n this.providerModule = null;\n //@ts-expect-error Read-only property.\n this.container = null;\n }\n\n private getProvider<T>(provider: ProviderToken<T>, asList?: boolean): T | T[] | void {\n const providerIdentifier = ProviderTokenHelpers.toProviderIdentifier(provider);\n\n if (asList) {\n return this.container.getAll(providerIdentifier, { optional: true });\n }\n\n return this.container.get(providerIdentifier, { optional: true });\n }\n}\n","import { Container } from 'inversify';\n\nexport const AppModuleInversifyContainer = new Container({ defaultScope: 'Singleton' });\n","import { ContainerModule, type ContainerModuleLoadOptions } from 'inversify';\n\nimport { DefinitionEventType, MiddlewareType } from '../../enums';\nimport { ProviderModuleHelpers, ProviderTokenHelpers } from '../../helpers';\nimport type { ExportsDefinitionOptimized, ModuleDefinition, ProviderToken } from '../../types';\nimport { ProviderModule } from '../provider-module/provider-module';\n\nexport class ImportedModuleContainer {\n get moduleDef(): ModuleDefinition<true> {\n return this.providerModule.dynamicModuleDef.moduleDef;\n }\n\n /** The {@link ProviderModule} which imported {@link providerModule | this} module. */\n private readonly importedIntoModule: ProviderModule;\n private readonly providerModule: ProviderModule;\n private readonly proxyContainer: ContainerModule;\n private proxyContainerOptions!: ContainerModuleLoadOptions;\n\n constructor(importedIntoModule: ProviderModule, providerModule: ProviderModule) {\n this.importedIntoModule = importedIntoModule;\n this.providerModule = providerModule;\n\n this.proxyContainer = this.buildProxyContainer();\n }\n\n dispose(): void {\n this.importedIntoModule.moduleContainer.container.unloadSync(this.proxyContainer);\n\n //@ts-expect-error Read-only property.\n this.importedIntoModule = null;\n //@ts-expect-error Read-only property.\n this.providerModule = null;\n //@ts-expect-error Read-only property.\n this.proxyContainer = null;\n //@ts-expect-error Read-only property.\n this.proxyContainerOptions = null;\n }\n\n private buildProxyContainer(): ContainerModule {\n const proxyContainer = new ContainerModule((options) => {\n this.proxyContainerOptions = options;\n\n this.traverseExportGraph((providerToken, foundInModule) => {\n this.proxyProviderIdentifier(providerToken, foundInModule);\n }, this.moduleDef.exports);\n\n // Subscribe to export changes only on this imported module.\n this.providerModule.dynamicModuleDef.event$.subscribe(({ type, change }) => {\n if (type !== DefinitionEventType.Export && type !== DefinitionEventType.ExportRemoved) return;\n\n const changeIsProvider = !ProviderModuleHelpers.isModule(change);\n\n if (changeIsProvider) {\n if (type === DefinitionEventType.Export) {\n this.proxyProviderIdentifier(change, this.providerModule);\n } else if (type === DefinitionEventType.ExportRemoved) {\n this.unproxyProviderIdentifier(change);\n }\n\n return;\n }\n\n // change is a module added or removed from exports\n const changedModule = change as ProviderModule;\n\n if (type === DefinitionEventType.Export) {\n // New exported module added: bind its providers recursively\n this.traverseExportGraph((providerToken, foundInModule) => {\n this.proxyProviderIdentifier(providerToken, foundInModule);\n }, changedModule.dynamicModuleDef.moduleDef.exports);\n } else {\n // Exported module removed: unbind its providers recursively\n this.traverseExportGraph((providerToken) => {\n this.unproxyProviderIdentifier(providerToken);\n }, changedModule.dynamicModuleDef.moduleDef.exports);\n }\n });\n });\n\n this.importedIntoModule.moduleContainer.container.loadSync(proxyContainer);\n\n return proxyContainer;\n }\n\n private proxyProviderIdentifier(providerToken: ProviderToken, fromModule: ProviderModule): void {\n const providerIdentifier = ProviderTokenHelpers.toProviderIdentifier(providerToken);\n\n if (this.proxyContainerOptions.isBound(providerIdentifier)) return;\n\n const bind = this.proxyContainerOptions.bind(providerIdentifier).toDynamicValue(() => {\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares(\n MiddlewareType.OnExportAccess,\n this.importedIntoModule,\n providerIdentifier\n );\n\n if (middlewareResult === false) {\n this.proxyContainerOptions.unbind(providerIdentifier);\n return undefined;\n }\n\n return fromModule.moduleContainer.container.get(providerIdentifier);\n });\n\n this.providerModule.moduleContainer.setBindingScope(providerToken, bind);\n }\n\n private unproxyProviderIdentifier(providerToken: ProviderToken): void {\n const providerIdentifier = ProviderTokenHelpers.toProviderIdentifier(providerToken);\n\n /* istanbul ignore next */\n if (!this.proxyContainerOptions.isBound(providerIdentifier)) return;\n\n this.proxyContainerOptions.unbind(providerIdentifier);\n }\n\n private traverseExportGraph(\n cb: (providerToken: ProviderToken, foundInModule: ProviderModule) => void,\n currentExportsNode: ExportsDefinitionOptimized\n ): void {\n // As the `exports` array can be a mix of `Providers` and `Modules`\n // we want to tap into the `exports` of an imported module as the last resort\n // as that could mean recursively going into the `exports` of the imported module and so on.\n //\n // Therefore we first iterate over the entire array and cache any module we find\n // into the `discoveredExportedModules` temporary array, then skip over the iteration,\n // this allows us to make sure that we always 1st try to get the provider from the current `export`\n // and only as a last resort to tap into the `exports` of the imported modules by iterating over the `discoveredExportedModules` temp array.\n\n const discoveredExportedModules: ProviderModule[] = [];\n\n for (const exportedModuleOrProvider of currentExportsNode) {\n const isModule = exportedModuleOrProvider instanceof ProviderModule;\n if (isModule) {\n discoveredExportedModules.push(exportedModuleOrProvider);\n\n // Will get to it later in the eventuality we'll not find the\n // provider into the current `exports` of the imported module.\n continue;\n } else {\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares(\n MiddlewareType.OnExportAccess,\n this.importedIntoModule,\n exportedModuleOrProvider\n );\n\n if (middlewareResult === false) continue;\n\n // Found it into the `exports` of this imported module.\n cb(exportedModuleOrProvider as any, this.providerModule);\n }\n }\n\n // If we got here it means that the `provider` has not been found in the\n // `exports` of the current imported module, therefore we must recursively drill into\n // the exported modules of the imported module.\n for (const exportedModule of discoveredExportedModules) {\n this.traverseExportGraph(cb, exportedModule.dynamicModuleDef.moduleDef.exports);\n }\n }\n}\n","export class Signal<T> {\n private value: T;\n\n private readonly subscribers = new Set<SignalCallback<T>>();\n\n constructor(initialValue: T) {\n this.value = initialValue;\n }\n\n /** Can be used to `emit` a _new_ value and notify the _subscribers_. */\n emit(newValue: T): void {\n this.value = newValue;\n\n this.subscribers.forEach((cb) => cb(this.value));\n }\n\n /** Can be used to retrieve the _current_ value of the {@link Signal} imperatively. */\n get(): T {\n return this.value;\n }\n\n /**\n * Can be used to `subscribe` to the emitted values of this {@link Signal}.\n *\n * @param callback The `callback` which will be invoked when a _new_ value is emitted.\n * @param invokeImmediately When set to `true` it'll invoke the provided {@link callback} immediately with the latest value available. _(defaults to `false`)_\n */\n subscribe(callback: SignalCallback<T>, invokeImmediately?: boolean): () => void {\n this.subscribers.add(callback);\n\n if (invokeImmediately) callback(this.value);\n\n return () => this.subscribers.delete(callback);\n }\n\n /** Disposes of the internal references. */\n dispose(): void {\n //@ts-expect-error Read-only property.\n this.subscribers = null;\n this.value = null as any;\n }\n}\n\ntype SignalCallback<T> = (value: T) => void | Promise<void>;\n","import { DefinitionEventType, MiddlewareType } from '../../enums';\nimport { InjectionProviderModuleDisposedError, InjectionProviderModuleError } from '../../errors';\nimport { ProviderModuleHelpers, ProviderTokenHelpers } from '../../helpers';\nimport type {\n AsyncMethod,\n DependencyProvider,\n ExportDefinition,\n ModuleDefinition,\n ModuleOrBlueprint,\n} from '../../types';\nimport { Signal } from '../../utils';\nimport { ImportedModuleContainer, type ModuleContainer } from '../container';\nimport type { IProviderModule, ProviderModuleOptions } from '../provider-module';\nimport type { ProviderModule } from '../provider-module/provider-module';\nimport type { DefinitionEvent, IDynamicModuleDefinition } from './interfaces';\n\nexport class DynamicModuleDefinition implements IDynamicModuleDefinition {\n get moduleContainer(): ModuleContainer {\n return this.providerModule.moduleContainer;\n }\n\n get subscribe(): IDynamicModuleDefinition['subscribe'] {\n /* istanbul ignore next */\n if (this.event$ === null) {\n throw new InjectionProviderModuleDisposedError(this.providerModule);\n }\n\n return this.event$.subscribe.bind(this.event$);\n }\n\n readonly moduleDef: ModuleDefinition<true>;\n readonly event$ = new Signal<DefinitionEvent>({\n type: DefinitionEventType.Noop,\n change: null,\n });\n\n private readonly providerModule: ProviderModule;\n private emittingModules = new Set<ProviderModule>();\n\n // Track subscriptions to imported modules' events for bubbling\n private importedModuleSubscriptions = new Map<ProviderModule, () => void>();\n\n constructor(providerModule: ProviderModule) {\n this.providerModule = providerModule;\n this.moduleDef = {\n imports: new Set(),\n providers: new Set(),\n exports: new Set(),\n };\n\n this.buildInitialDefinition(providerModule.options);\n }\n\n addImport(moduleOrBlueprint: ModuleOrBlueprint, addToExports = false): void {\n let providerModule = ProviderModuleHelpers.tryBlueprintToModule(moduleOrBlueprint) as ProviderModule;\n\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares<ProviderModule | false>(\n MiddlewareType.BeforeAddImport,\n providerModule\n );\n\n if (middlewareResult === false) return;\n providerModule = middlewareResult;\n\n this.moduleDef.imports.add(providerModule);\n\n this.createImportedModuleContainer(providerModule);\n\n // Subscribe to imported module's export events to bubble them\n this.subscribeToImportedModuleEvents(providerModule);\n\n this.emitEventSafely({\n type: DefinitionEventType.Export,\n change: providerModule,\n });\n\n this.emitEventSafely({\n type: DefinitionEventType.Import,\n change: providerModule,\n });\n\n if (!addToExports) return;\n\n this.moduleDef.exports.add(providerModule);\n\n this.emitEventSafely({\n type: DefinitionEventType.ExportModule,\n change: providerModule,\n });\n }\n\n async addImportLazy(lazyCb: AsyncMethod<ProviderModule>, addToExports?: boolean): Promise<void> {\n const providerModule = await lazyCb();\n\n this.addImport(providerModule, addToExports);\n }\n\n addProvider<T>(provider: DependencyProvider<T>, addToExports = false): void {\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares<DependencyProvider<T> | false>(\n MiddlewareType.BeforeAddProvider,\n provider\n );\n\n if (middlewareResult === false) return;\n provider = middlewareResult;\n\n this.moduleDef.providers.add(provider);\n\n this.moduleContainer.bindToContainer(provider);\n\n this.emitEventSafely({\n type: DefinitionEventType.Provider,\n change: provider,\n });\n\n if (!addToExports) return;\n\n this.moduleDef.exports.add(provider);\n\n this.emitEventSafely({\n type: DefinitionEventType.Export,\n change: provider,\n });\n\n this.emitEventSafely({\n type: DefinitionEventType.ExportProvider,\n change: provider,\n });\n }\n\n async addProviderLazy<T>(lazyCb: AsyncMethod<DependencyProvider<T>>, addToExports?: boolean): Promise<void> {\n const provider = await lazyCb();\n\n this.addProvider(provider, addToExports);\n }\n\n removeImport(module: IProviderModule): boolean {\n /* istanbul ignore next */\n if (!this.moduleDef.imports.has(module)) return false;\n\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares(\n MiddlewareType.BeforeRemoveImport,\n module\n );\n\n if (middlewareResult === false) return false;\n\n this.unsubscribeFromImportedModuleEvents(module as ProviderModule);\n\n const importedModuleContainer = this.providerModule.importedModuleContainers.get(module)!;\n importedModuleContainer.dispose();\n this.providerModule.importedModuleContainers.delete(module);\n this.moduleDef.imports.delete(module);\n\n this.emitEventSafely({\n type: DefinitionEventType.ImportRemoved,\n change: module,\n });\n\n this.removeFromExports(module);\n\n return true;\n }\n\n removeProvider<T>(provider: DependencyProvider<T>): boolean {\n if (!this.moduleDef.providers.has(provider)) return false;\n\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares(\n MiddlewareType.BeforeRemoveProvider,\n provider\n );\n\n if (middlewareResult === false) return false;\n\n this.moduleDef.providers.delete(provider);\n this.moduleContainer.container.unbindSync(ProviderTokenHelpers.toProviderIdentifier(provider));\n\n this.emitEventSafely({\n type: DefinitionEventType.ProviderRemoved,\n change: provider,\n });\n\n this.removeFromExports(provider);\n\n return true;\n }\n\n removeFromExports(exportDefinition: ExportDefinition): boolean {\n if (!this.moduleDef.exports.has(exportDefinition)) return false;\n\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares(\n MiddlewareType.BeforeRemoveExport,\n exportDefinition\n );\n\n if (middlewareResult === false) return false;\n\n this.moduleDef.exports.delete(exportDefinition);\n\n this.emitEventSafely({\n type: DefinitionEventType.ExportRemoved,\n change: exportDefinition,\n });\n\n if (ProviderModuleHelpers.isModule(exportDefinition)) {\n this.emitEventSafely({\n type: DefinitionEventType.ExportModuleRemoved,\n change: exportDefinition,\n });\n } else {\n this.emitEventSafely({\n type: DefinitionEventType.ExportProviderRemoved,\n change: exportDefinition,\n });\n }\n\n return true;\n }\n\n emitEventSafely(event: DefinitionEvent): void {\n if (this.emittingModules.has(this.providerModule)) {\n // Already emitting for this module, skip to prevent cycle\n return;\n }\n\n try {\n this.emittingModules.add(this.providerModule);\n this.event$.emit(event);\n } finally {\n this.emittingModules.delete(this.providerModule);\n }\n }\n\n dispose(): void {\n //@ts-expect-error Null not assignable.\n this.importedModuleSubscriptions = null;\n //@ts-expect-error Null not assignable.\n this.emittingModules = null;\n\n this.event$.dispose();\n //@ts-expect-error Read-only property.\n this.event$ = null;\n //@ts-expect-error Read-only property.\n this.moduleDef = null;\n }\n\n private buildInitialDefinition({ imports = [], providers = [], exports = [] }: ProviderModuleOptions): void {\n //@ts-expect-error Read-only property.\n this.moduleDef.providers = new Set(providers);\n\n exports.forEach((x) => {\n // We do not want to add `modules` or `blueprint` at this stage in the `exports` definition,\n // as if it is a `blueprint` we must first \"convert\" it to a `module`.\n // (which will happen down here in the `imports.forEach` loop)\n\n if (ProviderModuleHelpers.isModuleOrBlueprint(x)) return;\n\n this.moduleDef.exports.add(x);\n });\n\n imports.forEach((imp) => {\n const isModule = ProviderModuleHelpers.isModule(imp);\n const isGlobal = isModule ? (imp as ProviderModule).options.isGlobal : imp.isGlobal;\n\n // Importing global modules is pointless as\n // each module has access to the `AppModule`.\n if (isGlobal) return;\n\n const importedModule = ProviderModuleHelpers.tryBlueprintToModule(imp) as ProviderModule;\n const isPartOfTheExportsList = exports.some(\n (x) => ProviderModuleHelpers.isModuleOrBlueprint(x) && x.id === importedModule.id\n );\n\n this.addImport(importedModule, isPartOfTheExportsList);\n });\n }\n\n private createImportedModuleContainer(importedModule: ProviderModule): void {\n if (importedModule.isAppModule) {\n throw new InjectionProviderModuleError(this.providerModule, `The 'AppModule' can't be imported!`);\n }\n\n this.providerModule.importedModuleContainers.set(\n importedModule,\n new ImportedModuleContainer(this.providerModule, importedModule)\n );\n }\n\n private subscribeToImportedModuleEvents(importedModule: ProviderModule): void {\n if (this.importedModuleSubscriptions.has(importedModule)) return;\n\n const subscription = importedModule.dynamicModuleDef.event$.subscribe(({ type, change }) => {\n // Bubble only export-related events up to this module's event$\n switch (type) {\n case DefinitionEventType.Export:\n case DefinitionEventType.ExportRemoved:\n case DefinitionEventType.ExportModule:\n case DefinitionEventType.ExportModuleRemoved:\n case DefinitionEventType.ExportProvider:\n case DefinitionEventType.ExportProviderRemoved:\n this.emitEventSafely({ type, change });\n break;\n }\n });\n\n this.importedModuleSubscriptions.set(importedModule, subscription);\n }\n\n private unsubscribeFromImportedModuleEvents(importedModule: ProviderModule): void {\n const unsubscribe = this.importedModuleSubscriptions.get(importedModule);\n /* istanbul ignore next */\n if (!unsubscribe) return;\n\n unsubscribe();\n this.importedModuleSubscriptions.delete(importedModule);\n }\n}\n","import { MiddlewareType } from '../../enums';\nimport { InjectionProviderModuleDisposedError } from '../../errors';\nimport type { ProviderModule } from '../provider-module';\nimport type { AddMiddlewareCallbackType, IMiddlewaresManager } from './middlewares-manager.interfaces';\n\nexport class MiddlewaresManager implements IMiddlewaresManager {\n private middlewaresMap: Map<MiddlewareType, Function[]> = new Map();\n private readonly providerModule: ProviderModule;\n\n constructor(providerModule: ProviderModule) {\n this.providerModule = providerModule;\n }\n\n add<T extends MiddlewareType>(type: MiddlewareType, cb: AddMiddlewareCallbackType<T>): void {\n const currentMiddlewares = this.middlewaresMap.get(type);\n\n if (currentMiddlewares) {\n currentMiddlewares.push(cb);\n\n return;\n }\n\n // First middleware\n this.middlewaresMap.set(type, [cb]);\n }\n\n applyMiddlewares<T>(type: MiddlewareType, ...args: any[]): T {\n if (this.middlewaresMap === null) throw new InjectionProviderModuleDisposedError(this.providerModule);\n\n const middlewares = this.middlewaresMap.get(type);\n\n switch (type) {\n case MiddlewareType.BeforeAddImport:\n case MiddlewareType.BeforeAddProvider:\n if (!middlewares) return args[0];\n\n let chainedArg = args[0];\n\n for (const middleware of middlewares) {\n const result = middleware(chainedArg);\n\n if (result === false) return false as T;\n if (result === true) continue;\n\n chainedArg = result;\n }\n\n return chainedArg;\n\n case MiddlewareType.BeforeGet:\n return !middlewares\n ? args[0]\n : middlewares.reduce((arg, middleware) => middleware(arg, args[1], args[2]), args[0]);\n\n case MiddlewareType.BeforeRemoveImport:\n case MiddlewareType.BeforeRemoveProvider:\n case MiddlewareType.BeforeRemoveExport:\n case MiddlewareType.OnExportAccess:\n return (!middlewares || !middlewares.some((middleware) => !middleware(args[0], args[1]))) as T;\n }\n }\n\n clear(): void {\n this.middlewaresMap.clear();\n }\n\n dispose(): void {\n //@ts-expect-error `null` not being assignable to Map.\n this.middlewaresMap = null;\n }\n}\n","import { deepClone } from '../../helpers';\nimport { ProviderModule, type ProviderModuleOptions } from '../provider-module';\nimport type { ModuleBlueprintOptions } from './interfaces';\n\nexport class ProviderModuleBlueprint {\n id!: ProviderModuleOptions['id'];\n imports?: ProviderModuleOptions['imports'];\n providers?: ProviderModuleOptions['providers'];\n exports?: ProviderModuleOptions['exports'];\n defaultScope?: ProviderModuleOptions['defaultScope'];\n isGlobal?: ProviderModuleOptions['isGlobal'];\n onReady?: ProviderModuleOptions['onReady'];\n onReset?: ProviderModuleOptions['onReset'];\n onDispose?: ProviderModuleOptions['onDispose'];\n\n private readonly blueprintOptions: ModuleBlueprintOptions;\n\n constructor(options: ProviderModuleOptions, blueprintOptions?: ModuleBlueprintOptions) {\n this.updateDefinition(options);\n\n this.blueprintOptions = {\n autoImportIntoAppModuleWhenGlobal: blueprintOptions?.autoImportIntoAppModuleWhenGlobal ?? true,\n };\n\n this.convertToModuleAndInjectIntoAppModuleIfGlobal();\n }\n\n /** Can be used to update the {@link ProviderModuleBlueprint | Blueprint} definition. */\n updateDefinition(options: ProviderModuleOptions): this {\n this.id = options.id;\n this.imports = options.imports;\n this.providers = options.providers;\n this.exports = options.exports;\n this.defaultScope = options.defaultScope;\n this.isGlobal = options.isGlobal;\n this.onReady = options.onReady;\n this.onReset = options.onReset;\n this.onDispose = options.onDispose;\n\n return this;\n }\n\n /** Returns the {@link ProviderModuleOptions} of this {@link ProviderModuleBlueprint | Blueprint}. */\n getDefinition(): ProviderModuleOptions {\n return {\n id: this.id,\n imports: this.imports,\n providers: this.providers,\n exports: this.exports,\n defaultScope: this.defaultScope,\n isGlobal: this.isGlobal,\n onReady: this.onReady,\n onReset: this.onReset,\n onDispose: this.onDispose,\n };\n }\n\n /**\n * Can be used to instantiate a _new_ `blueprint` with the same exact options as _this_ one.\n *\n * **Note:** _Everything is deep cloned, you can safely overwrite all the properties of the cloned instance._\n */\n clone(): ProviderModuleBlueprint {\n return new ProviderModuleBlueprint(deepClone(this.getDefinition()), { ...this.blueprintOptions });\n }\n\n private convertToModuleAndInjectIntoAppModuleIfGlobal(): void {\n if (!this.isGlobal || !this.blueprintOptions?.autoImportIntoAppModuleWhenGlobal) return;\n\n ProviderModule.APP_MODULE_REF.update.addImport(this);\n }\n}\n","import { DefinitionEventType } from '../../enums';\nimport {\n InjectionError,\n InjectionProviderModuleDisposedError,\n InjectionProviderModuleMissingIdentifierError,\n} from '../../errors';\nimport { ProviderModuleHelpers, ProviderTokenHelpers } from '../../helpers';\nimport type { ModuleDefinition, ModuleIdentifier, ProviderIdentifier, ProviderToken } from '../../types';\nimport { ModuleContainer } from '../container';\nimport { ImportedModuleContainer } from '../container/imported-module-container';\nimport { DynamicModuleDefinition, type IDynamicModuleDefinition } from '../dynamic-module-definition';\nimport { MiddlewaresManager, type IMiddlewaresManager } from '../middlewares-manager';\nimport { ProviderModuleBlueprint, type ModuleBlueprintOptions } from '../provider-module-blueprint';\nimport type {\n IProviderModule,\n OnCleanupOptions,\n ProviderModuleGetManyParam,\n ProviderModuleGetManyReturn,\n ProviderModuleGetReturn,\n ProviderModuleOptions,\n ProviderModuleOptionsInternal,\n} from './types';\n\nexport class ProviderModule implements IProviderModule {\n get id(): ModuleIdentifier {\n return this.options.id;\n }\n\n get definition(): ModuleDefinition<true> {\n this.throwIfDisposed();\n\n return this.dynamicModuleDef.moduleDef;\n }\n\n get update(): IDynamicModuleDefinition {\n this.throwIfDisposed();\n\n return this.dynamicModuleDef;\n }\n\n get middlewares(): IMiddlewaresManager {\n this.throwIfDisposed();\n\n return this.middlewaresManager;\n }\n\n get isDisposed(): boolean {\n return this.disposed;\n }\n\n get isAppModule(): boolean {\n return this.id === 'AppModule';\n }\n\n /**\n * Holds a reference to the `AppModule`.\n *\n * Static property needed in order to avoid introducing a _cirular dependency_ between\n * the `AppModule` instance and the `ProviderModule` class.\n */\n static readonly APP_MODULE_REF: IProviderModule;\n\n readonly appModuleRef: ProviderModule;\n readonly options: ProviderModuleOptions;\n readonly middlewaresManager: MiddlewaresManager;\n readonly dynamicModuleDef: DynamicModuleDefinition;\n readonly moduleContainer: ModuleContainer;\n readonly importedModuleContainers: Map<IProviderModule, ImportedModuleContainer> = new Map();\n\n private disposed = false;\n\n constructor({\n appModuleRef: appModule = ProviderModule.APP_MODULE_REF,\n inversify,\n ...publicOptions\n }: ProviderModuleOptionsInternal) {\n this.appModuleRef = appModule as ProviderModule;\n this.options = publicOptions;\n\n this.throwIfIdIsMissing();\n\n this.middlewaresManager = new MiddlewaresManager(this);\n this.moduleContainer = new ModuleContainer(this, inversify?.parentContainer);\n this.dynamicModuleDef = new DynamicModuleDefinition(this);\n\n if (!this.isAppModule && this.options.isGlobal) {\n this.appModuleRef.update.addImport(this, true);\n }\n\n this.options.onReady?.(this);\n }\n\n static create(optionsOrBlueprint: ProviderModuleOptions | ProviderModuleBlueprint): IProviderModule {\n const options = ProviderModuleHelpers.isBlueprint(optionsOrBlueprint)\n ? optionsOrBlueprint.getDefinition()\n : optionsOrBlueprint;\n\n if (options.id === 'AppModule') {\n throw new InjectionError(\n `The 'AppModule' id can't be used as it is already being used by the built-in 'AppModule'`\n );\n }\n\n return new ProviderModule(options as any);\n }\n\n static blueprint(\n moduleOptions: ProviderModuleOptions,\n blueprintOptions?: ModuleBlueprintOptions\n ): ProviderModuleBlueprint {\n return new ProviderModuleBlueprint(moduleOptions, blueprintOptions);\n }\n\n isImportingModule(idOrModule: ModuleIdentifier | IProviderModule): boolean {\n this.throwIfDisposed();\n\n if (ProviderModuleHelpers.isModule(idOrModule)) {\n return this.importedModuleContainers.has(idOrModule);\n }\n\n return this.importedModuleContainers.keys().some((m) => m.id === idOrModule);\n }\n\n hasProvider<T>(provider: ProviderToken<T>): boolean {\n this.throwIfDisposed();\n\n const providerIdentifier = ProviderTokenHelpers.toProviderIdentifier(provider);\n\n return this.moduleContainer.container.isBound(providerIdentifier);\n }\n\n get<T, IsOptional extends boolean | undefined = undefined, AsList extends boolean | undefined = undefined>(\n provider: ProviderToken<T>,\n isOptional?: IsOptional,\n asList?: AsList\n ): ProviderModuleGetReturn<T, IsOptional, AsList> {\n this.throwIfDisposed();\n\n const value = this.moduleContainer.get<T, IsOptional, AsList>(provider, isOptional, asList);\n\n this.dynamicModuleDef.emitEventSafely({\n type: DefinitionEventType.GetProvider,\n change: value,\n });\n\n return value;\n }\n\n getMany<D extends (ProviderModuleGetManyParam<any> | ProviderToken)[]>(\n ...deps: D | unknown[]\n ): ProviderModuleGetManyReturn<D> {\n this.throwIfDisposed();\n\n return this.moduleContainer.getMany<D>(...deps);\n }\n\n isExportingModule(idOrModule: ModuleIdentifier | IProviderModule): boolean {\n this.throwIfDisposed();\n\n if (!this.isImportingModule(idOrModule)) return false;\n\n if (ProviderModuleHelpers.isModule(idOrModule)) {\n return this.definition.exports.has(idOrModule);\n }\n\n // It means that we have to search by the `ModuleIdentifier` instead,\n // this may be slower, but most times should be negligible.\n\n return this.definition.exports.keys().some((x) => ProviderModuleHelpers.isModule(x) && x.id === idOrModule);\n }\n\n isExportingProvider(tokenOrIdentifier: ProviderToken | ProviderIdentifier): boolean {\n this.throwIfDisposed();\n\n let found = this.definition.exports.has(tokenOrIdentifier);\n\n if (!found && ProviderTokenHelpers.isProviderIdentifier(tokenOrIdentifier)) {\n // It means that we have to search by the `ProviderIdentifier` instead,\n // this may be slower, but most times should be negligible.\n\n found = this.definition.exports\n .keys()\n .some(\n (x) =>\n !ProviderModuleHelpers.isModuleOrBlueprint(x) &&\n ProviderTokenHelpers.toProviderIdentifier(x) === tokenOrIdentifier\n );\n }\n\n return found;\n }\n\n async reset(shouldInvokeCb = true): Promise<void> {\n this.throwIfDisposed();\n\n let before: OnCleanupOptions['before'];\n let after: OnCleanupOptions['after'];\n\n if (shouldInvokeCb) {\n const cbs = (this.options.onReset?.() ?? {}) as OnCleanupOptions;\n\n before = cbs.before;\n after = cbs.after;\n\n await before?.(this);\n }\n\n this.middlewaresManager.clear();\n this.moduleContainer.container.unbindAll();\n this.definition.imports.clear();\n this.definition.providers.clear();\n this.definition.exports.clear();\n this.importedModuleContainers.clear();\n\n if (shouldInvokeCb) {\n await after?.();\n }\n }\n\n async dispose(): Promise<void> {\n this.throwIfDisposed();\n\n const { before, after } = this.options.onDispose?.() ?? {};\n await before?.(this);\n\n await this.reset(false);\n\n this.middlewaresManager.dispose();\n this.dynamicModuleDef.dispose();\n /* istanbul ignore next */\n this.importedModuleContainers.forEach((x) => x.dispose());\n this.moduleContainer.dispose();\n\n //@ts-expect-error Read-only property.\n this.options = {\n // We leave only the `id` as it is needed\n // to correctly show it when the `InjectionProviderModuleDisposedError` is thrown.\n id: this.options.id,\n };\n //@ts-expect-error Read-only property.\n this.dynamicModuleDef = null;\n //@ts-expect-error Read-only property.\n this.importedModuleContainers = null;\n //@ts-expect-error Read-only property.\n this.moduleContainer = null;\n\n this.disposed = true;\n\n await after?.();\n }\n\n toString(): string {\n return this.id.toString();\n }\n\n private throwIfIdIsMissing(): void {\n if (!this.options.id || this.options.id.toString().trim().length === 0) {\n throw new InjectionProviderModuleMissingIdentifierError(this);\n }\n }\n\n private throwIfDisposed(): void {\n if (!this.isDisposed) return;\n\n throw new InjectionProviderModuleDisposedError(this);\n }\n}\n","import { ProviderModule, type IProviderModule } from '../core/provider-module';\r\nimport { ProviderModuleBlueprint } from '../core/provider-module-blueprint/provider-module-blueprint';\r\n\r\nexport namespace ProviderModuleHelpers {\r\n export function isModule(value: any): value is IProviderModule {\r\n return value instanceof ProviderModule;\r\n }\r\n\r\n export function isBlueprint(value: any): value is ProviderModuleBlueprint {\r\n return value instanceof ProviderModuleBlueprint;\r\n }\r\n\r\n export function isModuleOrBlueprint(value: any): value is IProviderModule | ProviderModuleBlueprint {\r\n return isModule(value) || isBlueprint(value);\r\n }\r\n\r\n export function tryBlueprintToModule(value: IProviderModule | ProviderModuleBlueprint): IProviderModule {\r\n if (!(value instanceof ProviderModuleBlueprint)) return value;\r\n\r\n return blueprintToModule(value);\r\n }\r\n\r\n export function blueprintToModule(moduleBlueprint: ProviderModuleBlueprint): IProviderModule {\r\n return ProviderModule.create(moduleBlueprint.getDefinition());\r\n }\r\n}\r\n","export function isFunction(v: any): boolean {\n if (typeof v !== 'function') return false;\n\n return !Function.prototype.toString.call(v).startsWith('class ');\n}\n","export function deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== 'object') return obj;\n\n if (typeof obj === 'function') {\n // Create a new function that calls the original function\n // This ensures the cloned function is a different reference\n return ((...args: any[]) => (obj as any)(...args)) as any;\n }\n\n if (Array.isArray(obj)) return obj.map((item) => deepClone(item)) as T;\n\n const clonedObj: any = {};\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n clonedObj[key] = deepClone((obj as any)[key]);\n }\n }\n\n return clonedObj;\n}\n","import { inject as _inject } from 'inversify';\n\nimport { ProviderTokenHelpers } from '../helpers';\nimport type { ProviderToken } from '../types';\n\n/** See {@link https://inversify.io/docs/api/decorator/#inject} for more details. */\nexport function Inject(provider: ProviderToken) {\n return _inject(ProviderTokenHelpers.toProviderIdentifier(provider));\n}\n","import { multiInject as _multiInject } from 'inversify';\n\nimport { ProviderTokenHelpers } from '../helpers';\nimport type { ProviderToken } from '../types';\n\n/** See {@link https://inversify.io/docs/api/decorator/#multiinject} for more details. */\nexport function MultiInject(provider: ProviderToken) {\n return _multiInject(ProviderTokenHelpers.toProviderIdentifier(provider));\n}\n","import { injectFromBase as _injectFromBase } from 'inversify';\n\n/** See {@link https://inversify.io/docs/api/decorator/#injectfrombase} for more details. */\nexport function InjectFromBase(options?: Parameters<typeof _injectFromBase>[0]) {\n return _injectFromBase(options);\n}\n","import { named as _named, type MetadataName } from 'inversify';\n\n/** See {@link https://inversify.io/docs/api/decorator/#named} for more details. */\nexport function Named(name: MetadataName) {\n return _named(name);\n}\n","import { optional as _optional } from 'inversify';\n\n/** See {@link https://inversify.io/docs/api/decorator/#optional} for more details. */\nexport function Optional() {\n return _optional();\n}\n","import { tagged as _tagged, type MetadataTag } from 'inversify';\n\n/** See {@link https://inversify.io/docs/api/decorator/#tagged} for more details. */\nexport function Tagged(key: MetadataTag, value: unknown) {\n return _tagged(key, value);\n}\n","import { unmanaged as _unmanaged } from 'inversify';\n\n/** See {@link https://inversify.io/docs/api/decorator/#unmanaged} for more details. */\nexport function Unmanaged() {\n return _unmanaged();\n}\n","import type { IProviderModule } from '../provider-module';\nimport { ProviderModule } from '../provider-module/provider-module';\n\n/**\n * The `root` {@link IProviderModule} of your application.\n *\n * All global modules are imported into the {@link AppModule} and all your custom\n * modules inherit from it.\n */\nexport const AppModule = new ProviderModule({\n id: 'AppModule',\n}) as IProviderModule;\n\n//@ts-expect-error Read-only property.\n// This is done to avoid a circular dependency between\n// the `ProviderModule` class and the `AppModule` instance.\nProviderModule.APP_MODULE_REF = AppModule;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA,IAAAA,oBAA0C;;;ACAnC,IAAKC,iBAAAA,yBAAAA,iBAAAA;AACqE,EAAAA,gBAAAA,gBAAA,WAAA,IAAA,CAAA,IAAA;AAGA,EAAAA,gBAAAA,gBAAA,WAAA,IAAA,CAAA,IAAA;AAG2B,EAAAA,gBAAAA,gBAAA,SAAA,IAAA,CAAA,IAAA;SAPhGA;;;;ACAL,IAAKC,iBAAAA,yBAAAA,iBAAAA;AAQT,EAAAA,gBAAAA,gBAAA,iBAAA,IAAA,CAAA,IAAA;AAUA,EAAAA,gBAAAA,gBAAA,mBAAA,IAAA,CAAA,IAAA;AAOA,EAAAA,gBAAAA,gBAAA,WAAA,IAAA,CAAA,IAAA;AAQA,EAAAA,gBAAAA,gBAAA,oBAAA,IAAA,CAAA,IAAA;AAQA,EAAAA,gBAAAA,gBAAA,sBAAA,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AA6BH,KAAAA,CAAAA;AAClD;AAJgBD;;;A0BNhB,IAAAK,oBAAkC;AAM3B,SAASC,OAAOC,UAAuB;AAC5C,aAAOC,kBAAAA,QAAQC,qBAAqBC,qBAAqBH,QAAAA,CAAAA;AAC3D;AAFgBD;;;ACNhB,IAAAK,oBAA4C;AAMrC,SAASC,YAAYC,UAAuB;AACjD,aAAOC,kBAAAA,aAAaC,qBAAqBC,qBAAqBH,QAAAA,CAAAA;AAChE;AAFgBD;;;ACNhB,IAAAK,oBAAkD;AAG3C,SAASC,eAAeC,SAA+C;AAC5E,aAAOC,kBAAAA,gBAAgBD,OAAAA;AACzB;AAFgBD;;;ACHhB,IAAAG,oBAAmD;AAG5C,SAASC,MAAMC,MAAkB;AACtC,aAAOC,kBAAAA,OAAOD,IAAAA;AAChB;AAFgBD;;;ACHhB,IAAAG,oBAAsC;AAG/B,SAASC,WAAAA;AACd,aAAOC,kBAAAA,UAAAA;AACT;AAFgBD;;;ACHhB,IAAAE,qBAAoD;AAG7C,SAASC,OAAOC,KAAkBC,OAAc;AACrD,aAAOC,mBAAAA,QAAQF,KAAKC,KAAAA;AACtB;AAFgBF;;;ACHhB,IAAAI,qBAAwC;AAGjC,SAASC,YAAAA;AACd,aAAOC,mBAAAA,WAAAA;AACT;AAFgBD;;;ACMT,IAAME,YAAY,IAAIC,eAAe;EAC1CC,IAAI;AACN,CAAA;AAKAD,eAAeE,iBAAiBH;","names":["import_inversify","InjectionScope","MiddlewareType","DefinitionEventType","injectionScopeToBindingScope","injectionScope","InjectionScope","Singleton","Transient","Request","bindingScopeToInjectionScope","bindingScope","isClass","v","Function","prototype","toString","call","startsWith","isClassOrFunction","value","isObject","o","Object","prototype","toString","call","isPlainObject","ctor","undefined","prot","hasOwnProperty","ProviderTokenHelpers","isClassToken","provider","hasProvideProperty","isValueToken","isFactoryToken","isProviderIdentifier","value","isClassOrFunction","toProviderIdentifier","provide","toProviderIdentifiers","providers","map","providerIdentifierToString","providerIdentifier","toString","name","providerTokenToString","providerToken","providerTokensAreEqual","p0","p1","id0","id1","useClass","useValue","useFactory","getInjectionScopeByPriority","moduleDefaultScope","tryGetScopeFromProvider","tryGetDecoratorScopeFromClass","tryGetProviderOptions","providerOptions","scope","providerClass","isClass","inversifyScope","getClassMetadata","bindingScopeToInjectionScope","isPlainObject","InjectionError","Error","name","InjectionProviderModuleError","Error","name","module","message","moduleId","toString","InjectionProviderModuleUnknownProviderError","InjectionProviderModuleError","name","module","providerToken","ProviderTokenHelpers","providerTokenToString","InjectionProviderModuleDisposedError","InjectionProviderModuleError","name","module","InjectionProviderModuleMissingIdentifierError","InjectionProviderModuleError","name","module","InjectionProviderModuleMissingProviderError","InjectionProviderModuleError","name","module","providerToken","ProviderTokenHelpers","providerTokenToString","import_inversify","AppModuleInversifyContainer","Container","defaultScope","ModuleContainer","container","providerModule","inversifyParentContainer","defaultScope","InjectionScope","Singleton","options","id","AppModuleInversifyContainer","Container","parent","appModuleRef","moduleContainer","injectionScopeToBindingScope","providers","forEach","x","bindToContainer","get","provider","isOptional","asList","middlewareResult","middlewaresManager","applyMiddlewares","MiddlewareType","BeforeGet","getProvider","bind","undefined","InjectionProviderModuleMissingProviderError","getMany","deps","map","dep","withOptions","isPlainObject","providerIdentifier","ProviderTokenHelpers","toProviderIdentifier","binders","providerTypeMatches","isProviderIdentifier","toSelf","isClassToken","to","useClass","isValueToken","toConstantValue","useValue","isFactoryToken","toResolvedValue","p","dependencies","inject","useFactory","find","InjectionProviderModuleUnknownProviderError","binding","setBindingScope","opts","when","injectionScope","getInjectionScopeByPriority","inSingletonScope","Transient","inTransientScope","Request","inRequestScope","dispose","getAll","optional","import_inversify","ImportedModuleContainer","moduleDef","providerModule","dynamicModuleDef","importedIntoModule","proxyContainer","proxyContainerOptions","buildProxyContainer","dispose","moduleContainer","container","unloadSync","ContainerModule","options","traverseExportGraph","providerToken","foundInModule","proxyProviderIdentifier","exports","event$","subscribe","type","change","DefinitionEventType","Export","ExportRemoved","changeIsProvider","ProviderModuleHelpers","isModule","unproxyProviderIdentifier","changedModule","loadSync","fromModule","providerIdentifier","ProviderTokenHelpers","toProviderIdentifier","isBound","bind","toDynamicValue","middlewareResult","middlewaresManager","applyMiddlewares","MiddlewareType","OnExportAccess","unbind","undefined","get","setBindingScope","cb","currentExportsNode","discoveredExportedModules","exportedModuleOrProvider","ProviderModule","push","exportedModule","Signal","value","subscribers","Set","initialValue","emit","newValue","forEach","cb","get","subscribe","callback","invokeImmediately","add","delete","dispose","DynamicModuleDefinition","moduleContainer","providerModule","subscribe","event$","InjectionProviderModuleDisposedError","bind","moduleDef","Signal","type","DefinitionEventType","Noop","change","emittingModules","Set","importedModuleSubscriptions","Map","imports","providers","exports","buildInitialDefinition","options","addImport","moduleOrBlueprint","addToExports","ProviderModuleHelpers","tryBlueprintToModule","middlewareResult","middlewaresManager","applyMiddlewares","MiddlewareType","BeforeAddImport","add","createImportedModuleContainer","subscribeToImportedModuleEvents","emitEventSafely","Export","Import","ExportModule","addImportLazy","lazyCb","addProvider","provider","BeforeAddProvider","bindToContainer","Provider","ExportProvider","addProviderLazy","removeImport","module","has","BeforeRemoveImport","unsubscribeFromImportedModuleEvents","importedModuleContainer","importedModuleContainers","get","dispose","delete","ImportRemoved","removeFromExports","removeProvider","BeforeRemoveProvider","container","unbindSync","ProviderTokenHelpers","toProviderIdentifier","ProviderRemoved","exportDefinition","BeforeRemoveExport","ExportRemoved","isModule","ExportModuleRemoved","ExportProviderRemoved","event","emit","forEach","x","isModuleOrBlueprint","imp","isGlobal","importedModule","isPartOfTheExportsList","some","id","isAppModule","InjectionProviderModuleError","set","ImportedModuleContainer","subscription","dynamicModuleDef","unsubscribe","MiddlewaresManager","middlewaresMap","Map","providerModule","add","type","cb","currentMiddlewares","get","push","set","applyMiddlewares","args","InjectionProviderModuleDisposedError","middlewares","MiddlewareType","BeforeAddImport","BeforeAddProvider","chainedArg","middleware","result","BeforeGet","reduce","arg","BeforeRemoveImport","BeforeRemoveProvider","BeforeRemoveExport","OnExportAccess","some","clear","dispose","ProviderModuleBlueprint","id","imports","providers","exports","defaultScope","isGlobal","onReady","onReset","onDispose","blueprintOptions","options","updateDefinition","autoImportIntoAppModuleWhenGlobal","convertToModuleAndInjectIntoAppModuleIfGlobal","getDefinition","clone","deepClone","ProviderModule","APP_MODULE_REF","update","addImport","ProviderModule","id","options","definition","throwIfDisposed","dynamicModuleDef","moduleDef","update","middlewares","middlewaresManager","isDisposed","disposed","isAppModule","APP_MODULE_REF","appModuleRef","moduleContainer","importedModuleContainers","Map","appModule","inversify","publicOptions","throwIfIdIsMissing","MiddlewaresManager","ModuleContainer","parentContainer","DynamicModuleDefinition","isGlobal","addImport","onReady","create","optionsOrBlueprint","ProviderModuleHelpers","isBlueprint","getDefinition","InjectionError","blueprint","moduleOptions","blueprintOptions","ProviderModuleBlueprint","isImportingModule","idOrModule","isModule","has","keys","some","m","hasProvider","provider","providerIdentifier","ProviderTokenHelpers","toProviderIdentifier","container","isBound","get","isOptional","asList","value","emitEventSafely","type","DefinitionEventType","GetProvider","change","getMany","deps","isExportingModule","exports","x","isExportingProvider","tokenOrIdentifier","found","isProviderIdentifier","isModuleOrBlueprint","reset","shouldInvokeCb","before","after","cbs","onReset","clear","unbindAll","imports","providers","dispose","onDispose","forEach","toString","trim","length","InjectionProviderModuleMissingIdentifierError","InjectionProviderModuleDisposedError","ProviderModuleHelpers","isModule","value","ProviderModule","isBlueprint","ProviderModuleBlueprint","isModuleOrBlueprint","tryBlueprintToModule","blueprintToModule","moduleBlueprint","create","getDefinition","isFunction","v","Function","prototype","toString","call","startsWith","deepClone","obj","args","Array","isArray","map","item","clonedObj","key","Object","prototype","hasOwnProperty","call","Injectable","scope","undefined","_injectable","injectionScopeToBindingScope","import_inversify","Inject","provider","_inject","ProviderTokenHelpers","toProviderIdentifier","import_inversify","MultiInject","provider","_multiInject","ProviderTokenHelpers","toProviderIdentifier","import_inversify","InjectFromBase","options","_injectFromBase","import_inversify","Named","name","_named","import_inversify","Optional","_optional","import_inversify","Tagged","key","value","_tagged","import_inversify","Unmanaged","_unmanaged","AppModule","ProviderModule","id","APP_MODULE_REF"]}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/decorators/injectable.ts","../src/enums/injection-scope.enum.ts","../src/enums/middleware-type.enum.ts","../src/enums/definition-event-type.enum.ts","../src/helpers/scope-converter.ts","../src/helpers/provider-token.ts","../src/helpers/is-class.ts","../src/helpers/is-class-or-function.ts","../src/helpers/is-plain-object.ts","../src/errors/base.error.ts","../src/errors/provider-module.error.ts","../src/errors/provider-module-unknown-provider.ts","../src/errors/provider-module-disposed.error.ts","../src/errors/provider-module-missing-identifier.ts","../src/errors/provider-module-missing-provider.ts","../src/core/container/module-container.ts","../src/core/app-module/container.ts","../src/core/container/imported-module-container.ts","../src/utils/signal.ts","../src/core/dynamic-module-definition/dynamic-module-definition.ts","../src/core/middlewares-manager/middlewares-manager.ts","../src/core/provider-module-blueprint/provider-module-blueprint.ts","../src/core/provider-module/provider-module.ts","../src/helpers/provider-module.ts","../src/helpers/is-function.ts","../src/helpers/deep-clone.ts","../src/decorators/inject.ts","../src/decorators/multi-inject.ts","../src/decorators/inject-from-base.ts","../src/decorators/named.ts","../src/decorators/optional.ts","../src/decorators/tagged.ts","../src/decorators/unmanaged.ts","../src/core/app-module/app.module.ts"],"sourcesContent":["import { injectable as _injectable } from 'inversify';\n\nimport { InjectionScope } from '../enums';\nimport { injectionScopeToBindingScope } from '../helpers';\n\n/** See {@link https://inversify.io/docs/api/decorator/#injectable} for more details. */\nexport function Injectable(scope?: InjectionScope) {\n if (scope === undefined) return _injectable();\n\n return _injectable(injectionScopeToBindingScope(scope));\n}\n","export enum InjectionScope {\n /** When the service is resolved, the same cached resolved value will be used. */\n Singleton,\n\n /** When the service is resolved, a new resolved value will be used each time. */\n Transient,\n\n /** When the service is resolved within the same container request, the same resolved value will be used. */\n Request,\n}\n","export enum MiddlewareType {\n /**\n * Can be used to register a `middleware` which will be invoked right before importing a `module` into _this_ module.\n *\n * The provided middleware `callback` can either return a `boolean` or a `ProviderModule` instance.\n *\n * **Note:** _Returning `true` can be used to pass through the middleware without modifying_\n * _the `ProviderModule` instance, while returning `false` will reject the request of importing that specific module._\n */\n BeforeAddImport,\n\n /**\n * Can be used to register a `middleware` which will be invoked right before adding a provider to _this_ module.\n *\n * The provided middleware `callback` can either return a `boolean` or a `ProviderToken` object type.\n *\n * **Note:** _Returning `true` can be used to pass through the middleware without modifying_\n * _the `ProviderToken` object, while returning `false` will reject the request of adding that specific provider._\n */\n BeforeAddProvider,\n\n /**\n * Can be used to register a `middleware` which will be invoked right before a provider is returned to the consumer from _this_ module container.\n *\n * The provided middleware `callback` can return `anything`.\n */\n BeforeGet,\n\n /**\n * Can be used to register a `middleware` which will be invoked right before removing an imported module from _this_ module.\n *\n * **Note:** _The provided middleware `callback` must return a `boolean` where `true` means that_\n * _the imported module can be removed and `false` means to keep it._\n */\n BeforeRemoveImport,\n\n /**\n * Can be used to register a `middleware` which will be invoked right before removing a provider from _this_ module.\n *\n * **Note:** _The provided middleware `callback` must return a `boolean` where `true` means that_\n * _the provider can be removed and `false` means to keep it._\n */\n BeforeRemoveProvider,\n\n /**\n * Can be used to register a `middleware` which will be invoked right before removing an `ExportDefinition` from _this_ module.\n *\n * **Note:** _The provided middleware `callback` must return a `boolean` where `true` means that_\n * _the `ExportDefinition` can be removed and `false` means to keep it._\n */\n BeforeRemoveExport,\n\n /**\n * Can be used to register a `middleware` which will be invoked each time\n * a _consumer_ `module` tries to access the `ExportDefinition` list of _this_ module to `get` a provider.\n *\n * **Note:** _The provided middleware `callback` will be invoked for each `ProviderToken` of the `ExportsDefinition` list_\n * _and must return a `boolean` where `true` means that the `ProviderToken` is authorized to be used by the importer module._\n */\n OnExportAccess,\n}\n","export enum DefinitionEventType {\n /** No-Operation, yet. */\n Noop,\n\n /**\n * A new `module` or `blueprint` has been added.\n *\n * **Note:** _The occurred change type is: `ModuleOrBlueprint`_\n */\n Import,\n\n /**\n * A new `provider` has been added.\n *\n * **Note:** _The occurred change type is: `DependencyProvider`_\n */\n Provider,\n\n /**\n * A `module` is retrieving from its container a `provider`.\n *\n * **Note:** _The occurred change type is: `any`_\n */\n GetProvider,\n\n /**\n * A new `module` or `provider` has been added to the `exports` definition.\n *\n * **Note:** _The occurred change type is: `ExportDefinition`_\n */\n Export,\n\n /**\n * A new `module` or `blueprint` has been added to the `exports` definition.\n *\n * **Note:** _The occurred change type is: `ModuleOrBlueprint`_\n */\n ExportModule,\n\n /**\n * A new `provider` has been added to the `exports` definition.\n *\n * **Note:** _The occurred change type is: `ProviderToken`_\n */\n ExportProvider,\n\n /**\n * A `module` has been removed.\n *\n * **Note:** _The occurred change type is: `IProviderModule`_\n */\n ImportRemoved,\n\n /**\n * A `provider` has been removed.\n *\n * **Note:** _The occurred change type is: `DependencyProvider`_\n */\n ProviderRemoved,\n\n /**\n * An `ExportDefinition` has been removed.\n *\n * **Note:** _The occurred change type is: `ExportDefinition`_\n */\n ExportRemoved,\n\n /**\n * A `module` has been removed from the `export` definition.\n *\n * **Note:** _The occurred change type is: `IProviderModule`_\n */\n ExportModuleRemoved,\n\n /**\n * A `provider` has been removed from the `export` definition.\n *\n * **Note:** _The occurred change type is: `ProviderToken`_\n */\n ExportProviderRemoved,\n}\n","import type { BindingScope } from 'inversify';\n\nimport { InjectionScope } from '../enums';\n\nexport function injectionScopeToBindingScope(injectionScope: InjectionScope): BindingScope {\n switch (injectionScope) {\n case InjectionScope.Singleton:\n return 'Singleton';\n case InjectionScope.Transient:\n return 'Transient';\n case InjectionScope.Request:\n return 'Request';\n }\n}\n\nexport function bindingScopeToInjectionScope(bindingScope: BindingScope): InjectionScope {\n switch (bindingScope) {\n case 'Singleton':\n return InjectionScope.Singleton;\n case 'Transient':\n return InjectionScope.Transient;\n case 'Request':\n return InjectionScope.Request;\n }\n}\n","import { getClassMetadata } from '@inversifyjs/core';\n\nimport { InjectionScope } from '../enums';\nimport type {\n ProviderClassToken,\n ProviderFactoryToken,\n ProviderIdentifier,\n ProviderOptions,\n ProviderScopeOption,\n ProviderToken,\n ProviderValueToken,\n} from '../types';\nimport { isClass } from './is-class';\nimport { isClassOrFunction } from './is-class-or-function';\nimport { isPlainObject } from './is-plain-object';\nimport { bindingScopeToInjectionScope } from './scope-converter';\n\nexport namespace ProviderTokenHelpers {\n export function isClassToken<T>(provider: ProviderToken<T>): provider is ProviderClassToken<T> {\n return hasProvideProperty(provider) && 'useClass' in provider;\n }\n\n export function isValueToken<T>(provider: ProviderToken<T>): provider is ProviderValueToken<T> {\n return hasProvideProperty(provider) && 'useValue' in provider;\n }\n\n export function isFactoryToken<T>(provider: ProviderToken<T>): provider is ProviderFactoryToken<T> {\n return hasProvideProperty(provider) && 'useFactory' in provider;\n }\n\n export function isProviderIdentifier<T = any>(value: any): value is ProviderIdentifier<T> {\n return typeof value === 'string' || typeof value === 'symbol' || isClassOrFunction(value);\n }\n\n export function toProviderIdentifier<T = any>(provider: ProviderToken<T>): ProviderIdentifier<T> {\n return isProviderIdentifier(provider) ? provider : provider.provide;\n }\n\n export function toProviderIdentifiers(providers: ProviderToken[]): ProviderIdentifier<unknown>[] {\n return providers.map((provider) => toProviderIdentifier(provider));\n }\n\n export function providerIdentifierToString(providerIdentifier: ProviderIdentifier): string {\n if (typeof providerIdentifier === 'symbol' || typeof providerIdentifier === 'string') {\n return providerIdentifier.toString();\n }\n\n return providerIdentifier.name;\n }\n\n export function providerTokenToString(providerToken: ProviderToken): string {\n const providerIdentifier = toProviderIdentifier(providerToken);\n\n return providerIdentifierToString(providerIdentifier);\n }\n\n export function providerTokensAreEqual(p0: ProviderToken, p1: ProviderToken): boolean {\n if (p0 === p1) return true;\n\n const id0 = toProviderIdentifier(p0);\n const id1 = toProviderIdentifier(p1);\n\n if (id0 !== id1) return false;\n\n if (isClassToken(p0) && isClassToken(p1)) {\n return p0.useClass === p1.useClass;\n }\n\n if (isValueToken(p0) && isValueToken(p1)) {\n return p0.useValue === p1.useValue;\n }\n\n if (isFactoryToken(p0) && isFactoryToken(p1)) {\n if (p0.useFactory !== p1.useFactory) return false;\n\n // const inject0 = p0.inject ?? [];\n // const inject1 = p1.inject ?? [];\n\n // if (inject0.length !== inject1.length) return false;\n\n // for (let i = 0; i < inject0.length; i++) {\n // if (inject0[i] !== inject1[i]) return false;\n // }\n\n return true;\n }\n\n // At this point, identifiers are equal but tokens are not class/value/factory tokens,\n // so consider them equal based on identifier alone.\n return true;\n }\n\n /**\n * The priority order is as follows:\n * 1. From the `ProviderToken.scope`\n * 2. From the class `@Injectable(scope)` decorator\n * 3. From the `ProviderModule` default scope.\n *\n * @param provider The {@link ProviderToken}.\n * @param moduleDefaultScope The module default scope.\n */\n export function getInjectionScopeByPriority(\n provider: ProviderToken,\n moduleDefaultScope: InjectionScope\n ): InjectionScope {\n return tryGetScopeFromProvider(provider) ?? tryGetDecoratorScopeFromClass(provider) ?? moduleDefaultScope;\n }\n\n export function tryGetProviderOptions<T>(\n provider: ProviderToken<T>\n ): (ProviderOptions<T> & ProviderScopeOption) | undefined {\n if (!hasProvideProperty(provider)) return;\n\n return provider as any;\n }\n\n export function tryGetScopeFromProvider(provider: ProviderToken): InjectionScope | undefined {\n const providerOptions = tryGetProviderOptions(provider);\n if (!providerOptions) return;\n\n return providerOptions.scope;\n }\n\n export function tryGetDecoratorScopeFromClass<T = any>(provider: ProviderToken<T>): InjectionScope | undefined {\n const providerClass = toProviderIdentifier(provider);\n if (!isClass(providerClass)) return;\n\n const inversifyScope = getClassMetadata(providerClass as any)?.scope;\n if (!inversifyScope) return;\n\n return bindingScopeToInjectionScope(inversifyScope);\n }\n\n function hasProvideProperty(provider: any): provider is object {\n return isPlainObject(provider) && typeof provider === 'object' && 'provide' in provider;\n }\n}\n","export function isClass(v: any): boolean {\n if (typeof v !== 'function') return false;\n\n return Function.prototype.toString.call(v).startsWith('class ');\n}\n","import type { Class } from 'type-fest';\n\nexport function isClassOrFunction(value: any): value is Function | Class<any> {\n return typeof value === 'function';\n}\n","/*\n * is-plain-object <https://github.com/jonschlinkert/is-plain-object>\n *\n * Copyright (c) 2014-2017, Jon Schlinkert.\n * Released under the MIT License.\n */\n\nfunction isObject(o: any): boolean {\n return Object.prototype.toString.call(o) === '[object Object]';\n}\n\nexport function isPlainObject(o: any): o is object {\n if (isObject(o) === false) return false;\n\n // If has modified constructor\n const ctor = o.constructor;\n if (ctor === undefined) return true;\n\n // If has modified prototype\n const prot = ctor.prototype;\n if (isObject(prot) === false) return false;\n\n // If constructor does not have an Object-specific method\n if (prot.hasOwnProperty('isPrototypeOf') === false) {\n return false;\n }\n\n // Most likely a plain Object\n return true;\n}\n","/** Exception which indicates that there is a generic error. */\nexport class InjectionError extends Error {\n override name = InjectionError.name;\n}\n","import type { IProviderModule } from '../core';\n\n/** Exception which indicates that there is a generic error with an instance of {@link IProviderModule}. */\nexport class InjectionProviderModuleError extends Error {\n override name = InjectionProviderModuleError.name;\n\n constructor(module: IProviderModule, message: string) {\n let moduleId = 'Unknown';\n\n try {\n moduleId = module.toString();\n } catch {}\n\n super(`{ProviderModule.${moduleId}} => ${message}`);\n }\n}\n","import type { IProviderModule } from '../core';\nimport { ProviderTokenHelpers } from '../helpers';\nimport type { ProviderToken } from '../types';\nimport { InjectionProviderModuleError } from './provider-module.error';\n\n/** Exception which indicates that an `unknown` type of {@link ProviderToken} has been supplied. */\nexport class InjectionProviderModuleUnknownProviderError extends InjectionProviderModuleError {\n override name = InjectionProviderModuleUnknownProviderError.name;\n\n constructor(module: IProviderModule, providerToken: ProviderToken) {\n super(module, `The [${ProviderTokenHelpers.providerTokenToString(providerToken)}] provider is of an unknown type!`);\n }\n}\n","import type { IProviderModule } from '../core';\nimport { InjectionProviderModuleError } from './provider-module.error';\n\n/** Exception which indicates an invokation of a disposed module. */\nexport class InjectionProviderModuleDisposedError extends InjectionProviderModuleError {\n override name = InjectionProviderModuleDisposedError.name;\n\n constructor(module: IProviderModule) {\n super(module, 'Has been disposed!');\n }\n}\n","import type { IProviderModule } from '../core';\nimport { InjectionProviderModuleError } from './provider-module.error';\n\n/** Exception which indicates that a module has been initialized without an `identifier`. */\nexport class InjectionProviderModuleMissingIdentifierError extends InjectionProviderModuleError {\n override name = InjectionProviderModuleMissingIdentifierError.name;\n\n constructor(module: IProviderModule) {\n super(module, 'An `identifier` must be supplied!');\n }\n}\n","import type { IProviderModule } from '../core';\nimport { ProviderTokenHelpers } from '../helpers';\nimport type { ProviderToken } from '../types';\nimport { InjectionProviderModuleError } from './provider-module.error';\n\n/** Exception which indicates that a module container does not contain the requested provider. */\nexport class InjectionProviderModuleMissingProviderError extends InjectionProviderModuleError {\n override name = InjectionProviderModuleMissingProviderError.name;\n\n constructor(module: IProviderModule, providerToken: ProviderToken) {\n super(\n module,\n `The [${ProviderTokenHelpers.providerTokenToString(providerToken)}] provider is not bound to this (or any imported) module container, and was not found either in the 'AppModule'!`\n );\n }\n}\n","import { Container, type BindInWhenOnFluentSyntax, type BindWhenOnFluentSyntax } from 'inversify';\n\nimport { InjectionScope, MiddlewareType } from '../../enums';\nimport { InjectionProviderModuleMissingProviderError, InjectionProviderModuleUnknownProviderError } from '../../errors';\nimport { injectionScopeToBindingScope, isPlainObject, ProviderTokenHelpers } from '../../helpers';\nimport type {\n DependencyProvider,\n ProviderClassToken,\n ProviderFactoryToken,\n ProviderOptions,\n ProviderToken,\n ProviderValueToken,\n} from '../../types';\nimport { AppModuleInversifyContainer } from '../app-module/container';\nimport type {\n ProviderModuleGetManyParam,\n ProviderModuleGetManyReturn,\n ProviderModuleGetReturn,\n} from '../provider-module';\nimport { ProviderModule } from '../provider-module/provider-module';\n\nexport class ModuleContainer {\n readonly container: Container;\n private readonly providerModule: ProviderModule;\n\n constructor(providerModule: ProviderModule, inversifyParentContainer?: Container) {\n this.providerModule = providerModule;\n\n const { defaultScope = InjectionScope.Singleton } = providerModule.options;\n\n this.container =\n providerModule.id === 'AppModule'\n ? AppModuleInversifyContainer\n : new Container({\n parent: inversifyParentContainer ?? this.providerModule.appModuleRef.moduleContainer.container,\n defaultScope: injectionScopeToBindingScope(defaultScope),\n });\n\n this.providerModule.options.providers?.forEach((x) => this.bindToContainer(x));\n }\n\n get<T, IsOptional extends boolean | undefined = undefined, AsList extends boolean | undefined = undefined>(\n provider: ProviderToken<T>,\n isOptional?: IsOptional,\n asList?: AsList\n ): ProviderModuleGetReturn<T, IsOptional, AsList> {\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares<any>(\n MiddlewareType.BeforeGet,\n this.getProvider(provider, asList),\n provider,\n this.getProvider.bind(this)\n );\n if (middlewareResult || middlewareResult === null) return middlewareResult;\n\n if (isOptional) return undefined as any;\n\n throw new InjectionProviderModuleMissingProviderError(this.providerModule, provider);\n }\n\n getMany<D extends (ProviderModuleGetManyParam<any> | ProviderToken)[]>(\n ...deps: D | unknown[]\n ): ProviderModuleGetManyReturn<D> {\n return (deps as D).map((dep) => {\n const withOptions = isPlainObject(dep) && 'provider' in dep;\n\n return this.get(\n withOptions ? dep.provider : dep,\n withOptions ? dep.isOptional : false,\n withOptions ? dep.asList : false\n );\n }) as any;\n }\n\n bindToContainer<T>(provider: DependencyProvider<T>): void {\n const providerIdentifier = ProviderTokenHelpers.toProviderIdentifier(provider);\n\n const binders: Array<{\n providerTypeMatches: (p: any) => boolean;\n bind: () => BindInWhenOnFluentSyntax<any> | BindWhenOnFluentSyntax<any>;\n }> = [\n {\n providerTypeMatches: ProviderTokenHelpers.isProviderIdentifier,\n bind: () => this.container.bind(providerIdentifier).toSelf(),\n },\n {\n providerTypeMatches: ProviderTokenHelpers.isClassToken,\n bind: () => this.container.bind(providerIdentifier).to((provider as ProviderClassToken<T>).useClass),\n },\n {\n providerTypeMatches: ProviderTokenHelpers.isValueToken,\n bind: () =>\n this.container.bind(providerIdentifier).toConstantValue((provider as ProviderValueToken<T>).useValue),\n },\n {\n providerTypeMatches: ProviderTokenHelpers.isFactoryToken,\n bind: () =>\n this.container.bind(providerIdentifier).toResolvedValue(() => {\n const p = provider as ProviderFactoryToken<T>;\n\n const dependencies = this.providerModule.getMany(...(p.inject ?? []));\n\n return p.useFactory(...dependencies);\n }),\n },\n ];\n\n const { bind } = binders.find(({ providerTypeMatches }) => providerTypeMatches(provider)) ?? {};\n if (!bind) {\n throw new InjectionProviderModuleUnknownProviderError(this.providerModule, provider);\n }\n\n const isProviderIdentifier = ProviderTokenHelpers.isProviderIdentifier(provider);\n\n // Create initial inversify binding fluent syntax object\n let binding = bind();\n\n // A `ValueToken` is always a constant, so there's no point in binding a specific scope.\n // And if the provider is a simple `ProviderIdentifier` then it means that it'll use the container default scope.\n if (!ProviderTokenHelpers.isValueToken(provider) && !isProviderIdentifier) {\n binding = this.setBindingScope(provider, binding as BindInWhenOnFluentSyntax<any>);\n }\n\n // If it is a simple `ProviderIdentifier` there's nothing more we can do\n // as it is not an object which contains the `ProviderOptions` properties.\n if (isProviderIdentifier) return;\n\n const opts = provider as ProviderOptions<unknown>;\n\n if (opts.when) {\n binding.when(opts.when) as any;\n }\n }\n\n setBindingScope<T>(provider: ProviderToken<T>, binding: BindInWhenOnFluentSyntax<T>): BindWhenOnFluentSyntax<T> {\n const injectionScope = ProviderTokenHelpers.getInjectionScopeByPriority(\n provider,\n this.providerModule.options.defaultScope ?? InjectionScope.Singleton\n );\n\n switch (injectionScope) {\n case InjectionScope.Singleton:\n return binding.inSingletonScope();\n case InjectionScope.Transient:\n return binding.inTransientScope();\n case InjectionScope.Request:\n return binding.inRequestScope();\n }\n }\n\n dispose(): void {\n //@ts-expect-error Read-only property.\n this.providerModule = null;\n //@ts-expect-error Read-only property.\n this.container = null;\n }\n\n private getProvider<T>(provider: ProviderToken<T>, asList?: boolean): T | T[] | void {\n const providerIdentifier = ProviderTokenHelpers.toProviderIdentifier(provider);\n\n if (asList) {\n return this.container.getAll(providerIdentifier, { optional: true });\n }\n\n return this.container.get(providerIdentifier, { optional: true });\n }\n}\n","import { Container } from 'inversify';\n\nexport const AppModuleInversifyContainer = new Container({ defaultScope: 'Singleton' });\n","import { ContainerModule, type ContainerModuleLoadOptions } from 'inversify';\n\nimport { DefinitionEventType, MiddlewareType } from '../../enums';\nimport { ProviderModuleHelpers, ProviderTokenHelpers } from '../../helpers';\nimport type { ExportsDefinitionOptimized, ModuleDefinition, ProviderToken } from '../../types';\nimport { ProviderModule } from '../provider-module/provider-module';\n\nexport class ImportedModuleContainer {\n get moduleDef(): ModuleDefinition<true> {\n return this.providerModule.dynamicModuleDef.moduleDef;\n }\n\n /** The {@link ProviderModule} which imported {@link providerModule | this} module. */\n private readonly importedIntoModule: ProviderModule;\n private readonly providerModule: ProviderModule;\n private readonly proxyContainer: ContainerModule;\n private proxyContainerOptions!: ContainerModuleLoadOptions;\n\n constructor(importedIntoModule: ProviderModule, providerModule: ProviderModule) {\n this.importedIntoModule = importedIntoModule;\n this.providerModule = providerModule;\n\n this.proxyContainer = this.buildProxyContainer();\n }\n\n dispose(): void {\n this.importedIntoModule.moduleContainer.container.unloadSync(this.proxyContainer);\n\n //@ts-expect-error Read-only property.\n this.importedIntoModule = null;\n //@ts-expect-error Read-only property.\n this.providerModule = null;\n //@ts-expect-error Read-only property.\n this.proxyContainer = null;\n //@ts-expect-error Read-only property.\n this.proxyContainerOptions = null;\n }\n\n private buildProxyContainer(): ContainerModule {\n const proxyContainer = new ContainerModule((options) => {\n this.proxyContainerOptions = options;\n\n this.traverseExportGraph((providerToken, foundInModule) => {\n this.proxyProviderIdentifier(providerToken, foundInModule);\n }, this.moduleDef.exports);\n\n // Subscribe to export changes only on this imported module.\n this.providerModule.dynamicModuleDef.event$.subscribe(({ type, change }) => {\n if (type !== DefinitionEventType.Export && type !== DefinitionEventType.ExportRemoved) return;\n\n const changeIsProvider = !ProviderModuleHelpers.isModule(change);\n\n if (changeIsProvider) {\n if (type === DefinitionEventType.Export) {\n this.proxyProviderIdentifier(change, this.providerModule);\n } else if (type === DefinitionEventType.ExportRemoved) {\n this.unproxyProviderIdentifier(change);\n }\n\n return;\n }\n\n // change is a module added or removed from exports\n const changedModule = change as ProviderModule;\n\n if (type === DefinitionEventType.Export) {\n // New exported module added: bind its providers recursively\n this.traverseExportGraph((providerToken, foundInModule) => {\n this.proxyProviderIdentifier(providerToken, foundInModule);\n }, changedModule.dynamicModuleDef.moduleDef.exports);\n } else {\n // Exported module removed: unbind its providers recursively\n this.traverseExportGraph((providerToken) => {\n this.unproxyProviderIdentifier(providerToken);\n }, changedModule.dynamicModuleDef.moduleDef.exports);\n }\n });\n });\n\n this.importedIntoModule.moduleContainer.container.loadSync(proxyContainer);\n\n return proxyContainer;\n }\n\n private proxyProviderIdentifier(providerToken: ProviderToken, fromModule: ProviderModule): void {\n const providerIdentifier = ProviderTokenHelpers.toProviderIdentifier(providerToken);\n\n if (this.proxyContainerOptions.isBound(providerIdentifier)) return;\n\n const bind = this.proxyContainerOptions.bind(providerIdentifier).toDynamicValue(() => {\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares(\n MiddlewareType.OnExportAccess,\n this.importedIntoModule,\n providerIdentifier\n );\n\n if (middlewareResult === false) {\n this.proxyContainerOptions.unbind(providerIdentifier);\n return undefined;\n }\n\n return fromModule.moduleContainer.container.get(providerIdentifier);\n });\n\n this.providerModule.moduleContainer.setBindingScope(providerToken, bind);\n }\n\n private unproxyProviderIdentifier(providerToken: ProviderToken): void {\n const providerIdentifier = ProviderTokenHelpers.toProviderIdentifier(providerToken);\n\n /* istanbul ignore next */\n if (!this.proxyContainerOptions.isBound(providerIdentifier)) return;\n\n this.proxyContainerOptions.unbind(providerIdentifier);\n }\n\n private traverseExportGraph(\n cb: (providerToken: ProviderToken, foundInModule: ProviderModule) => void,\n currentExportsNode: ExportsDefinitionOptimized\n ): void {\n // As the `exports` array can be a mix of `Providers` and `Modules`\n // we want to tap into the `exports` of an imported module as the last resort\n // as that could mean recursively going into the `exports` of the imported module and so on.\n //\n // Therefore we first iterate over the entire array and cache any module we find\n // into the `discoveredExportedModules` temporary array, then skip over the iteration,\n // this allows us to make sure that we always 1st try to get the provider from the current `export`\n // and only as a last resort to tap into the `exports` of the imported modules by iterating over the `discoveredExportedModules` temp array.\n\n const discoveredExportedModules: ProviderModule[] = [];\n\n for (const exportedModuleOrProvider of currentExportsNode) {\n const isModule = exportedModuleOrProvider instanceof ProviderModule;\n if (isModule) {\n discoveredExportedModules.push(exportedModuleOrProvider);\n\n // Will get to it later in the eventuality we'll not find the\n // provider into the current `exports` of the imported module.\n continue;\n } else {\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares(\n MiddlewareType.OnExportAccess,\n this.importedIntoModule,\n exportedModuleOrProvider\n );\n\n if (middlewareResult === false) continue;\n\n // Found it into the `exports` of this imported module.\n cb(exportedModuleOrProvider as any, this.providerModule);\n }\n }\n\n // If we got here it means that the `provider` has not been found in the\n // `exports` of the current imported module, therefore we must recursively drill into\n // the exported modules of the imported module.\n for (const exportedModule of discoveredExportedModules) {\n this.traverseExportGraph(cb, exportedModule.dynamicModuleDef.moduleDef.exports);\n }\n }\n}\n","export class Signal<T> {\n private value: T;\n\n private readonly subscribers = new Set<SignalCallback<T>>();\n\n constructor(initialValue: T) {\n this.value = initialValue;\n }\n\n /** Can be used to `emit` a _new_ value and notify the _subscribers_. */\n emit(newValue: T): void {\n this.value = newValue;\n\n this.subscribers.forEach((cb) => cb(this.value));\n }\n\n /** Can be used to retrieve the _current_ value of the {@link Signal} imperatively. */\n get(): T {\n return this.value;\n }\n\n /**\n * Can be used to `subscribe` to the emitted values of this {@link Signal}.\n *\n * @param callback The `callback` which will be invoked when a _new_ value is emitted.\n * @param invokeImmediately When set to `true` it'll invoke the provided {@link callback} immediately with the latest value available. _(defaults to `false`)_\n */\n subscribe(callback: SignalCallback<T>, invokeImmediately?: boolean): () => void {\n this.subscribers.add(callback);\n\n if (invokeImmediately) callback(this.value);\n\n return () => this.subscribers.delete(callback);\n }\n\n /** Disposes of the internal references. */\n dispose(): void {\n //@ts-expect-error Read-only property.\n this.subscribers = null;\n this.value = null as any;\n }\n}\n\ntype SignalCallback<T> = (value: T) => void | Promise<void>;\n","import { DefinitionEventType, MiddlewareType } from '../../enums';\nimport { InjectionProviderModuleDisposedError, InjectionProviderModuleError } from '../../errors';\nimport { ProviderModuleHelpers, ProviderTokenHelpers } from '../../helpers';\nimport type {\n AsyncMethod,\n DependencyProvider,\n ExportDefinition,\n ModuleDefinition,\n ModuleOrBlueprint,\n} from '../../types';\nimport { Signal } from '../../utils';\nimport { ImportedModuleContainer, type ModuleContainer } from '../container';\nimport type { IProviderModule, ProviderModuleOptions } from '../provider-module';\nimport type { ProviderModule } from '../provider-module/provider-module';\nimport type { DefinitionEvent, IDynamicModuleDefinition } from './interfaces';\n\nexport class DynamicModuleDefinition implements IDynamicModuleDefinition {\n get moduleContainer(): ModuleContainer {\n return this.providerModule.moduleContainer;\n }\n\n get subscribe(): IDynamicModuleDefinition['subscribe'] {\n /* istanbul ignore next */\n if (this.event$ === null) {\n throw new InjectionProviderModuleDisposedError(this.providerModule);\n }\n\n return this.event$.subscribe.bind(this.event$);\n }\n\n readonly moduleDef: ModuleDefinition<true>;\n readonly event$ = new Signal<DefinitionEvent>({\n type: DefinitionEventType.Noop,\n change: null,\n });\n\n private readonly providerModule: ProviderModule;\n private emittingModules = new Set<ProviderModule>();\n\n // Track subscriptions to imported modules' events for bubbling\n private importedModuleSubscriptions = new Map<ProviderModule, () => void>();\n\n constructor(providerModule: ProviderModule) {\n this.providerModule = providerModule;\n this.moduleDef = {\n imports: new Set(),\n providers: new Set(),\n exports: new Set(),\n };\n\n this.buildInitialDefinition(providerModule.options);\n }\n\n addImport(moduleOrBlueprint: ModuleOrBlueprint, addToExports = false): void {\n let providerModule = ProviderModuleHelpers.tryBlueprintToModule(moduleOrBlueprint) as ProviderModule;\n\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares<ProviderModule | false>(\n MiddlewareType.BeforeAddImport,\n providerModule\n );\n\n if (middlewareResult === false) return;\n providerModule = middlewareResult;\n\n this.moduleDef.imports.add(providerModule);\n\n this.createImportedModuleContainer(providerModule);\n\n // Subscribe to imported module's export events to bubble them\n this.subscribeToImportedModuleEvents(providerModule);\n\n this.emitEventSafely({\n type: DefinitionEventType.Export,\n change: providerModule,\n });\n\n this.emitEventSafely({\n type: DefinitionEventType.Import,\n change: providerModule,\n });\n\n if (!addToExports) return;\n\n this.moduleDef.exports.add(providerModule);\n\n this.emitEventSafely({\n type: DefinitionEventType.ExportModule,\n change: providerModule,\n });\n }\n\n async addImportLazy(lazyCb: AsyncMethod<ProviderModule>, addToExports?: boolean): Promise<void> {\n const providerModule = await lazyCb();\n\n this.addImport(providerModule, addToExports);\n }\n\n addProvider<T>(provider: DependencyProvider<T>, addToExports = false): void {\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares<DependencyProvider<T> | false>(\n MiddlewareType.BeforeAddProvider,\n provider\n );\n\n if (middlewareResult === false) return;\n provider = middlewareResult;\n\n this.moduleDef.providers.add(provider);\n\n this.moduleContainer.bindToContainer(provider);\n\n this.emitEventSafely({\n type: DefinitionEventType.Provider,\n change: provider,\n });\n\n if (!addToExports) return;\n\n this.moduleDef.exports.add(provider);\n\n this.emitEventSafely({\n type: DefinitionEventType.Export,\n change: provider,\n });\n\n this.emitEventSafely({\n type: DefinitionEventType.ExportProvider,\n change: provider,\n });\n }\n\n async addProviderLazy<T>(lazyCb: AsyncMethod<DependencyProvider<T>>, addToExports?: boolean): Promise<void> {\n const provider = await lazyCb();\n\n this.addProvider(provider, addToExports);\n }\n\n removeImport(module: IProviderModule): boolean {\n /* istanbul ignore next */\n if (!this.moduleDef.imports.has(module)) return false;\n\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares(\n MiddlewareType.BeforeRemoveImport,\n module\n );\n\n if (middlewareResult === false) return false;\n\n this.unsubscribeFromImportedModuleEvents(module as ProviderModule);\n\n const importedModuleContainer = this.providerModule.importedModuleContainers.get(module)!;\n importedModuleContainer.dispose();\n this.providerModule.importedModuleContainers.delete(module);\n this.moduleDef.imports.delete(module);\n\n this.emitEventSafely({\n type: DefinitionEventType.ImportRemoved,\n change: module,\n });\n\n this.removeFromExports(module);\n\n return true;\n }\n\n removeProvider<T>(provider: DependencyProvider<T>): boolean {\n if (!this.moduleDef.providers.has(provider)) return false;\n\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares(\n MiddlewareType.BeforeRemoveProvider,\n provider\n );\n\n if (middlewareResult === false) return false;\n\n this.moduleDef.providers.delete(provider);\n this.moduleContainer.container.unbindSync(ProviderTokenHelpers.toProviderIdentifier(provider));\n\n this.emitEventSafely({\n type: DefinitionEventType.ProviderRemoved,\n change: provider,\n });\n\n this.removeFromExports(provider);\n\n return true;\n }\n\n removeFromExports(exportDefinition: ExportDefinition): boolean {\n if (!this.moduleDef.exports.has(exportDefinition)) return false;\n\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares(\n MiddlewareType.BeforeRemoveExport,\n exportDefinition\n );\n\n if (middlewareResult === false) return false;\n\n this.moduleDef.exports.delete(exportDefinition);\n\n this.emitEventSafely({\n type: DefinitionEventType.ExportRemoved,\n change: exportDefinition,\n });\n\n if (ProviderModuleHelpers.isModule(exportDefinition)) {\n this.emitEventSafely({\n type: DefinitionEventType.ExportModuleRemoved,\n change: exportDefinition,\n });\n } else {\n this.emitEventSafely({\n type: DefinitionEventType.ExportProviderRemoved,\n change: exportDefinition,\n });\n }\n\n return true;\n }\n\n emitEventSafely(event: DefinitionEvent): void {\n if (this.emittingModules.has(this.providerModule)) {\n // Already emitting for this module, skip to prevent cycle\n return;\n }\n\n try {\n this.emittingModules.add(this.providerModule);\n this.event$.emit(event);\n } finally {\n this.emittingModules.delete(this.providerModule);\n }\n }\n\n dispose(): void {\n //@ts-expect-error Null not assignable.\n this.importedModuleSubscriptions = null;\n //@ts-expect-error Null not assignable.\n this.emittingModules = null;\n\n this.event$.dispose();\n //@ts-expect-error Read-only property.\n this.event$ = null;\n //@ts-expect-error Read-only property.\n this.moduleDef = null;\n }\n\n private buildInitialDefinition({ imports = [], providers = [], exports = [] }: ProviderModuleOptions): void {\n //@ts-expect-error Read-only property.\n this.moduleDef.providers = new Set(providers);\n\n exports.forEach((x) => {\n // We do not want to add `modules` or `blueprint` at this stage in the `exports` definition,\n // as if it is a `blueprint` we must first \"convert\" it to a `module`.\n // (which will happen down here in the `imports.forEach` loop)\n\n if (ProviderModuleHelpers.isModuleOrBlueprint(x)) return;\n\n this.moduleDef.exports.add(x);\n });\n\n imports.forEach((imp) => {\n const isModule = ProviderModuleHelpers.isModule(imp);\n const isGlobal = isModule ? (imp as ProviderModule).options.isGlobal : imp.isGlobal;\n\n // Importing global modules is pointless as\n // each module has access to the `AppModule`.\n if (isGlobal) return;\n\n const importedModule = ProviderModuleHelpers.tryBlueprintToModule(imp) as ProviderModule;\n const isPartOfTheExportsList = exports.some(\n (x) => ProviderModuleHelpers.isModuleOrBlueprint(x) && x.id === importedModule.id\n );\n\n this.addImport(importedModule, isPartOfTheExportsList);\n });\n }\n\n private createImportedModuleContainer(importedModule: ProviderModule): void {\n if (importedModule.isAppModule) {\n throw new InjectionProviderModuleError(this.providerModule, `The 'AppModule' can't be imported!`);\n }\n\n this.providerModule.importedModuleContainers.set(\n importedModule,\n new ImportedModuleContainer(this.providerModule, importedModule)\n );\n }\n\n private subscribeToImportedModuleEvents(importedModule: ProviderModule): void {\n if (this.importedModuleSubscriptions.has(importedModule)) return;\n\n const subscription = importedModule.dynamicModuleDef.event$.subscribe(({ type, change }) => {\n // Bubble only export-related events up to this module's event$\n switch (type) {\n case DefinitionEventType.Export:\n case DefinitionEventType.ExportRemoved:\n case DefinitionEventType.ExportModule:\n case DefinitionEventType.ExportModuleRemoved:\n case DefinitionEventType.ExportProvider:\n case DefinitionEventType.ExportProviderRemoved:\n this.emitEventSafely({ type, change });\n break;\n }\n });\n\n this.importedModuleSubscriptions.set(importedModule, subscription);\n }\n\n private unsubscribeFromImportedModuleEvents(importedModule: ProviderModule): void {\n const unsubscribe = this.importedModuleSubscriptions.get(importedModule);\n /* istanbul ignore next */\n if (!unsubscribe) return;\n\n unsubscribe();\n this.importedModuleSubscriptions.delete(importedModule);\n }\n}\n","import { MiddlewareType } from '../../enums';\nimport { InjectionProviderModuleDisposedError } from '../../errors';\nimport type { ProviderModule } from '../provider-module';\nimport type { AddMiddlewareCallbackType, IMiddlewaresManager } from './middlewares-manager.interfaces';\n\nexport class MiddlewaresManager implements IMiddlewaresManager {\n private middlewaresMap: Map<MiddlewareType, Function[]> = new Map();\n private readonly providerModule: ProviderModule;\n\n constructor(providerModule: ProviderModule) {\n this.providerModule = providerModule;\n }\n\n add<T extends MiddlewareType>(type: MiddlewareType, cb: AddMiddlewareCallbackType<T>): void {\n const currentMiddlewares = this.middlewaresMap.get(type);\n\n if (currentMiddlewares) {\n currentMiddlewares.push(cb);\n\n return;\n }\n\n // First middleware\n this.middlewaresMap.set(type, [cb]);\n }\n\n applyMiddlewares<T>(type: MiddlewareType, ...args: any[]): T {\n if (this.middlewaresMap === null) throw new InjectionProviderModuleDisposedError(this.providerModule);\n\n const middlewares = this.middlewaresMap.get(type);\n\n switch (type) {\n case MiddlewareType.BeforeAddImport:\n case MiddlewareType.BeforeAddProvider:\n if (!middlewares) return args[0];\n\n let chainedArg = args[0];\n\n for (const middleware of middlewares) {\n const result = middleware(chainedArg);\n\n if (result === false) return false as T;\n if (result === true) continue;\n\n chainedArg = result;\n }\n\n return chainedArg;\n\n case MiddlewareType.BeforeGet:\n return !middlewares\n ? args[0]\n : middlewares.reduce((arg, middleware) => middleware(arg, args[1], args[2]), args[0]);\n\n case MiddlewareType.BeforeRemoveImport:\n case MiddlewareType.BeforeRemoveProvider:\n case MiddlewareType.BeforeRemoveExport:\n case MiddlewareType.OnExportAccess:\n return (!middlewares || !middlewares.some((middleware) => !middleware(args[0], args[1]))) as T;\n }\n }\n\n clear(): void {\n this.middlewaresMap.clear();\n }\n\n dispose(): void {\n //@ts-expect-error `null` not being assignable to Map.\n this.middlewaresMap = null;\n }\n}\n","import { deepClone } from '../../helpers';\nimport { ProviderModule, type ProviderModuleOptions } from '../provider-module';\nimport type { ModuleBlueprintOptions } from './interfaces';\n\nexport class ProviderModuleBlueprint {\n id!: ProviderModuleOptions['id'];\n imports?: ProviderModuleOptions['imports'];\n providers?: ProviderModuleOptions['providers'];\n exports?: ProviderModuleOptions['exports'];\n defaultScope?: ProviderModuleOptions['defaultScope'];\n isGlobal?: ProviderModuleOptions['isGlobal'];\n onReady?: ProviderModuleOptions['onReady'];\n onReset?: ProviderModuleOptions['onReset'];\n onDispose?: ProviderModuleOptions['onDispose'];\n\n private readonly blueprintOptions: ModuleBlueprintOptions;\n\n constructor(options: ProviderModuleOptions, blueprintOptions?: ModuleBlueprintOptions) {\n this.updateDefinition(options);\n\n this.blueprintOptions = {\n autoImportIntoAppModuleWhenGlobal: blueprintOptions?.autoImportIntoAppModuleWhenGlobal ?? true,\n };\n\n this.convertToModuleAndInjectIntoAppModuleIfGlobal();\n }\n\n /** Can be used to update the {@link ProviderModuleBlueprint | Blueprint} definition. */\n updateDefinition(options: ProviderModuleOptions): this {\n this.id = options.id;\n this.imports = options.imports;\n this.providers = options.providers;\n this.exports = options.exports;\n this.defaultScope = options.defaultScope;\n this.isGlobal = options.isGlobal;\n this.onReady = options.onReady;\n this.onReset = options.onReset;\n this.onDispose = options.onDispose;\n\n return this;\n }\n\n /** Returns the {@link ProviderModuleOptions} of this {@link ProviderModuleBlueprint | Blueprint}. */\n getDefinition(): ProviderModuleOptions {\n return {\n id: this.id,\n imports: this.imports,\n providers: this.providers,\n exports: this.exports,\n defaultScope: this.defaultScope,\n isGlobal: this.isGlobal,\n onReady: this.onReady,\n onReset: this.onReset,\n onDispose: this.onDispose,\n };\n }\n\n /**\n * Can be used to instantiate a _new_ `blueprint` with the same exact options as _this_ one.\n *\n * **Note:** _Everything is deep cloned, you can safely overwrite all the properties of the cloned instance._\n */\n clone(): ProviderModuleBlueprint {\n return new ProviderModuleBlueprint(deepClone(this.getDefinition()), { ...this.blueprintOptions });\n }\n\n private convertToModuleAndInjectIntoAppModuleIfGlobal(): void {\n if (!this.isGlobal || !this.blueprintOptions?.autoImportIntoAppModuleWhenGlobal) return;\n\n ProviderModule.APP_MODULE_REF.update.addImport(this);\n }\n}\n","import { DefinitionEventType } from '../../enums';\nimport {\n InjectionError,\n InjectionProviderModuleDisposedError,\n InjectionProviderModuleMissingIdentifierError,\n} from '../../errors';\nimport { ProviderModuleHelpers, ProviderTokenHelpers } from '../../helpers';\nimport type { ModuleDefinition, ModuleIdentifier, ProviderIdentifier, ProviderToken } from '../../types';\nimport { ModuleContainer } from '../container';\nimport { ImportedModuleContainer } from '../container/imported-module-container';\nimport { DynamicModuleDefinition, type IDynamicModuleDefinition } from '../dynamic-module-definition';\nimport { MiddlewaresManager, type IMiddlewaresManager } from '../middlewares-manager';\nimport { ProviderModuleBlueprint, type ModuleBlueprintOptions } from '../provider-module-blueprint';\nimport type {\n IProviderModule,\n OnCleanupOptions,\n ProviderModuleGetManyParam,\n ProviderModuleGetManyReturn,\n ProviderModuleGetReturn,\n ProviderModuleOptions,\n ProviderModuleOptionsInternal,\n} from './types';\n\nexport class ProviderModule implements IProviderModule {\n get id(): ModuleIdentifier {\n return this.options.id;\n }\n\n get definition(): ModuleDefinition<true> {\n this.throwIfDisposed();\n\n return this.dynamicModuleDef.moduleDef;\n }\n\n get update(): IDynamicModuleDefinition {\n this.throwIfDisposed();\n\n return this.dynamicModuleDef;\n }\n\n get middlewares(): IMiddlewaresManager {\n this.throwIfDisposed();\n\n return this.middlewaresManager;\n }\n\n get isDisposed(): boolean {\n return this.disposed;\n }\n\n get isAppModule(): boolean {\n return this.id === 'AppModule';\n }\n\n /**\n * Holds a reference to the `AppModule`.\n *\n * Static property needed in order to avoid introducing a _cirular dependency_ between\n * the `AppModule` instance and the `ProviderModule` class.\n */\n static readonly APP_MODULE_REF: IProviderModule;\n\n readonly appModuleRef: ProviderModule;\n readonly options: ProviderModuleOptions;\n readonly middlewaresManager: MiddlewaresManager;\n readonly dynamicModuleDef: DynamicModuleDefinition;\n readonly moduleContainer: ModuleContainer;\n readonly importedModuleContainers: Map<IProviderModule, ImportedModuleContainer> = new Map();\n\n private disposed = false;\n\n constructor({\n appModuleRef: appModule = ProviderModule.APP_MODULE_REF,\n inversify,\n ...publicOptions\n }: ProviderModuleOptionsInternal) {\n this.appModuleRef = appModule as ProviderModule;\n this.options = publicOptions;\n\n this.throwIfIdIsMissing();\n\n this.middlewaresManager = new MiddlewaresManager(this);\n this.moduleContainer = new ModuleContainer(this, inversify?.parentContainer);\n this.dynamicModuleDef = new DynamicModuleDefinition(this);\n\n if (!this.isAppModule && this.options.isGlobal) {\n this.appModuleRef.update.addImport(this, true);\n }\n\n this.options.onReady?.(this);\n }\n\n static create(optionsOrBlueprint: ProviderModuleOptions | ProviderModuleBlueprint): IProviderModule {\n const options = ProviderModuleHelpers.isBlueprint(optionsOrBlueprint)\n ? optionsOrBlueprint.getDefinition()\n : optionsOrBlueprint;\n\n if (options.id === 'AppModule') {\n throw new InjectionError(\n `The 'AppModule' id can't be used as it is already being used by the built-in 'AppModule'`\n );\n }\n\n return new ProviderModule(options as any);\n }\n\n static blueprint(\n moduleOptions: ProviderModuleOptions,\n blueprintOptions?: ModuleBlueprintOptions\n ): ProviderModuleBlueprint {\n return new ProviderModuleBlueprint(moduleOptions, blueprintOptions);\n }\n\n isImportingModule(idOrModule: ModuleIdentifier | IProviderModule): boolean {\n this.throwIfDisposed();\n\n if (ProviderModuleHelpers.isModule(idOrModule)) {\n return this.importedModuleContainers.has(idOrModule);\n }\n\n return this.importedModuleContainers.keys().some((m) => m.id === idOrModule);\n }\n\n hasProvider<T>(provider: ProviderToken<T>): boolean {\n this.throwIfDisposed();\n\n const providerIdentifier = ProviderTokenHelpers.toProviderIdentifier(provider);\n\n return this.moduleContainer.container.isBound(providerIdentifier);\n }\n\n get<T, IsOptional extends boolean | undefined = undefined, AsList extends boolean | undefined = undefined>(\n provider: ProviderToken<T>,\n isOptional?: IsOptional,\n asList?: AsList\n ): ProviderModuleGetReturn<T, IsOptional, AsList> {\n this.throwIfDisposed();\n\n const value = this.moduleContainer.get<T, IsOptional, AsList>(provider, isOptional, asList);\n\n this.dynamicModuleDef.emitEventSafely({\n type: DefinitionEventType.GetProvider,\n change: value,\n });\n\n return value;\n }\n\n getMany<D extends (ProviderModuleGetManyParam<any> | ProviderToken)[]>(\n ...deps: D | unknown[]\n ): ProviderModuleGetManyReturn<D> {\n this.throwIfDisposed();\n\n return this.moduleContainer.getMany<D>(...deps);\n }\n\n isExportingModule(idOrModule: ModuleIdentifier | IProviderModule): boolean {\n this.throwIfDisposed();\n\n if (!this.isImportingModule(idOrModule)) return false;\n\n if (ProviderModuleHelpers.isModule(idOrModule)) {\n return this.definition.exports.has(idOrModule);\n }\n\n // It means that we have to search by the `ModuleIdentifier` instead,\n // this may be slower, but most times should be negligible.\n\n return this.definition.exports.keys().some((x) => ProviderModuleHelpers.isModule(x) && x.id === idOrModule);\n }\n\n isExportingProvider(tokenOrIdentifier: ProviderToken | ProviderIdentifier): boolean {\n this.throwIfDisposed();\n\n let found = this.definition.exports.has(tokenOrIdentifier);\n\n if (!found && ProviderTokenHelpers.isProviderIdentifier(tokenOrIdentifier)) {\n // It means that we have to search by the `ProviderIdentifier` instead,\n // this may be slower, but most times should be negligible.\n\n found = this.definition.exports\n .keys()\n .some(\n (x) =>\n !ProviderModuleHelpers.isModuleOrBlueprint(x) &&\n ProviderTokenHelpers.toProviderIdentifier(x) === tokenOrIdentifier\n );\n }\n\n return found;\n }\n\n async reset(shouldInvokeCb = true): Promise<void> {\n this.throwIfDisposed();\n\n let before: OnCleanupOptions['before'];\n let after: OnCleanupOptions['after'];\n\n if (shouldInvokeCb) {\n const cbs = (this.options.onReset?.() ?? {}) as OnCleanupOptions;\n\n before = cbs.before;\n after = cbs.after;\n\n await before?.(this);\n }\n\n this.middlewaresManager.clear();\n this.moduleContainer.container.unbindAll();\n this.definition.imports.clear();\n this.definition.providers.clear();\n this.definition.exports.clear();\n this.importedModuleContainers.clear();\n\n if (shouldInvokeCb) {\n await after?.();\n }\n }\n\n async dispose(): Promise<void> {\n this.throwIfDisposed();\n\n const { before, after } = this.options.onDispose?.() ?? {};\n await before?.(this);\n\n await this.reset(false);\n\n this.middlewaresManager.dispose();\n this.dynamicModuleDef.dispose();\n /* istanbul ignore next */\n this.importedModuleContainers.forEach((x) => x.dispose());\n this.moduleContainer.dispose();\n\n //@ts-expect-error Read-only property.\n this.options = {\n // We leave only the `id` as it is needed\n // to correctly show it when the `InjectionProviderModuleDisposedError` is thrown.\n id: this.options.id,\n };\n //@ts-expect-error Read-only property.\n this.dynamicModuleDef = null;\n //@ts-expect-error Read-only property.\n this.importedModuleContainers = null;\n //@ts-expect-error Read-only property.\n this.moduleContainer = null;\n\n this.disposed = true;\n\n await after?.();\n }\n\n toString(): string {\n return this.id.toString();\n }\n\n private throwIfIdIsMissing(): void {\n if (!this.options.id || this.options.id.toString().trim().length === 0) {\n throw new InjectionProviderModuleMissingIdentifierError(this);\n }\n }\n\n private throwIfDisposed(): void {\n if (!this.isDisposed) return;\n\n throw new InjectionProviderModuleDisposedError(this);\n }\n}\n","import { ProviderModule, type IProviderModule } from '../core/provider-module';\r\nimport { ProviderModuleBlueprint } from '../core/provider-module-blueprint/provider-module-blueprint';\r\n\r\nexport namespace ProviderModuleHelpers {\r\n export function isModule(value: any): value is IProviderModule {\r\n return value instanceof ProviderModule;\r\n }\r\n\r\n export function isBlueprint(value: any): value is ProviderModuleBlueprint {\r\n return value instanceof ProviderModuleBlueprint;\r\n }\r\n\r\n export function isModuleOrBlueprint(value: any): value is IProviderModule | ProviderModuleBlueprint {\r\n return isModule(value) || isBlueprint(value);\r\n }\r\n\r\n export function tryBlueprintToModule(value: IProviderModule | ProviderModuleBlueprint): IProviderModule {\r\n if (!(value instanceof ProviderModuleBlueprint)) return value;\r\n\r\n return blueprintToModule(value);\r\n }\r\n\r\n export function blueprintToModule(moduleBlueprint: ProviderModuleBlueprint): IProviderModule {\r\n return ProviderModule.create(moduleBlueprint.getDefinition());\r\n }\r\n}\r\n","export function isFunction(v: any): boolean {\n if (typeof v !== 'function') return false;\n\n return !Function.prototype.toString.call(v).startsWith('class ');\n}\n","export function deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== 'object') return obj;\n\n if (typeof obj === 'function') {\n // Create a new function that calls the original function\n // This ensures the cloned function is a different reference\n return ((...args: any[]) => (obj as any)(...args)) as any;\n }\n\n if (Array.isArray(obj)) return obj.map((item) => deepClone(item)) as T;\n\n const clonedObj: any = {};\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n clonedObj[key] = deepClone((obj as any)[key]);\n }\n }\n\n return clonedObj;\n}\n","import { inject as _inject } from 'inversify';\n\nimport { ProviderTokenHelpers } from '../helpers';\nimport type { ProviderToken } from '../types';\n\n/** See {@link https://inversify.io/docs/api/decorator/#inject} for more details. */\nexport function Inject(provider: ProviderToken) {\n return _inject(ProviderTokenHelpers.toProviderIdentifier(provider));\n}\n","import { multiInject as _multiInject } from 'inversify';\n\nimport { ProviderTokenHelpers } from '../helpers';\nimport type { ProviderToken } from '../types';\n\n/** See {@link https://inversify.io/docs/api/decorator/#multiinject} for more details. */\nexport function MultiInject(provider: ProviderToken) {\n return _multiInject(ProviderTokenHelpers.toProviderIdentifier(provider));\n}\n","import { injectFromBase as _injectFromBase } from 'inversify';\n\n/** See {@link https://inversify.io/docs/api/decorator/#injectfrombase} for more details. */\nexport function InjectFromBase(options?: Parameters<typeof _injectFromBase>[0]) {\n return _injectFromBase(options);\n}\n","import { named as _named, type MetadataName } from 'inversify';\n\n/** See {@link https://inversify.io/docs/api/decorator/#named} for more details. */\nexport function Named(name: MetadataName) {\n return _named(name);\n}\n","import { optional as _optional } from 'inversify';\n\n/** See {@link https://inversify.io/docs/api/decorator/#optional} for more details. */\nexport function Optional() {\n return _optional();\n}\n","import { tagged as _tagged, type MetadataTag } from 'inversify';\n\n/** See {@link https://inversify.io/docs/api/decorator/#tagged} for more details. */\nexport function Tagged(key: MetadataTag, value: unknown) {\n return _tagged(key, value);\n}\n","import { unmanaged as _unmanaged } from 'inversify';\n\n/** See {@link https://inversify.io/docs/api/decorator/#unmanaged} for more details. */\nexport function Unmanaged() {\n return _unmanaged();\n}\n","import type { IProviderModule } from '../provider-module';\nimport { ProviderModule } from '../provider-module/provider-module';\n\n/**\n * The `root` {@link IProviderModule} of your application.\n *\n * All global modules are imported into the {@link AppModule} and all your custom\n * modules inherit from it.\n */\nexport const AppModule = new ProviderModule({\n id: 'AppModule',\n}) as IProviderModule;\n\n//@ts-expect-error Read-only property.\n// This is done to avoid a circular dependency between\n// the `ProviderModule` class and the `AppModule` instance.\nProviderModule.APP_MODULE_REF = AppModule;\n"],"mappings":";;;;AAAA,SAASA,cAAcC,mBAAmB;;;ACAnC,IAAKC,iBAAAA,yBAAAA,iBAAAA;AACqE,EAAAA,gBAAAA,gBAAA,WAAA,IAAA,CAAA,IAAA;AAGA,EAAAA,gBAAAA,gBAAA,WAAA,IAAA,CAAA,IAAA;AAG2B,EAAAA,gBAAAA,gBAAA,SAAA,IAAA,CAAA,IAAA;SAPhGA;;;;ACAL,IAAKC,iBAAAA,yBAAAA,iBAAAA;AAQT,EAAAA,gBAAAA,gBAAA,iBAAA,IAAA,CAAA,IAAA;AAUA,EAAAA,gBAAAA,gBAAA,mBAAA,IAAA,CAAA,IAAA;AAOA,EAAAA,gBAAAA,gBAAA,WAAA,IAAA,CAAA,IAAA;AAQA,EAAAA,gBAAAA,gBAAA,oBAAA,IAAA,CAAA,IAAA;AAQA,EAAAA,gBAAAA,gBAAA,sBAAA,IAAA,CAAA,IAAA;AAQA,EAAAA,gBAAAA,gBAAA,oBAAA,IAAA,CAAA,IAAA;AASA,EAAAA,gBAAAA,gBAAA,gBAAA,IAAA,CAAA,IAAA;SA1DSA;;;;ACAL,IAAKC,sBAAAA,yBAAAA,sBAAAA;AACa,EAAAA,qBAAAA,qBAAA,MAAA,IAAA,CAAA,IAAA;AAOtB,EAAAA,qBAA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C,qBAAqBC,qBAAqBH,QAAAA,CAAAA;AAChE;AAFgBD;;;ACNhB,SAASK,kBAAkBC,uBAAuB;AAG3C,SAASC,eAAeC,SAA+C;AAC5E,SAAOC,gBAAgBD,OAAAA;AACzB;AAFgBD;;;ACHhB,SAASG,SAASC,cAAiC;AAG5C,SAASC,MAAMC,MAAkB;AACtC,SAAOC,OAAOD,IAAAA;AAChB;AAFgBD;;;ACHhB,SAASG,YAAYC,iBAAiB;AAG/B,SAASC,WAAAA;AACd,SAAOC,UAAAA;AACT;AAFgBD;;;ACHhB,SAASE,UAAUC,eAAiC;AAG7C,SAASC,OAAOC,KAAkBC,OAAc;AACrD,SAAOC,QAAQF,KAAKC,KAAAA;AACtB;AAFgBF;;;ACHhB,SAASI,aAAaC,kBAAkB;AAGjC,SAASC,YAAAA;AACd,SAAOC,WAAAA;AACT;AAFgBD;;;ACMT,IAAME,YAAY,IAAIC,eAAe;EAC1CC,IAAI;AACN,CAAA;AAKAD,eAAeE,iBAAiBH;","names":["injectable","_injectable","InjectionScope","MiddlewareType","DefinitionEventType","injectionScopeToBindingScope","injectionScope","InjectionScope","Singleton","Transient","Request","bindingScopeToInjectionScope","bindingScope","getClassMetadata","isClass","v","Function","prototype","toString","call","startsWith","isClassOrFunction","value","isObject","o","Object","prototype","toString","call","isPlainObject","ctor","constructor","undefined","prot","hasOwnProperty","ProviderTokenHelpers","isClassToken","provider","hasProvideProperty","isValueToken","isFactoryToken","isProviderIdentifier","value","isClassOrFunction","toProviderIdentifier","provide","toProviderIdentifiers","providers","map","providerIdentifierToString","providerIdentifier","toString","name","providerTokenToString","providerToken","providerTokensAreEqual","p0","p1","id0","id1","useClass","useValue","useFactory","getInjectionScopeByPriority","moduleDefaultScope","tryGetScopeFromProvider","tryGetDecoratorScopeFromClass","tryGetProviderOptions","providerOptions","scope","providerClass","isClass","inversifyScope","getClassMetadata","bindingScopeToInjectionScope","isPlainObject","InjectionError","Error","name","InjectionProviderModuleError","Error","name","constructor","module","message","moduleId","toString","InjectionProviderModuleUnknownProviderError","InjectionProviderModuleError","name","constructor","module","providerToken","ProviderTokenHelpers","providerTokenToString","InjectionProviderModuleDisposedError","InjectionProviderModuleError","name","constructor","module","InjectionProviderModuleMissingIdentifierError","InjectionProviderModuleError","name","constructor","module","InjectionProviderModuleMissingProviderError","InjectionProviderModuleError","name","constructor","module","providerToken","ProviderTokenHelpers","providerTokenToString","Container","Container","AppModuleInversifyContainer","defaultScope","ModuleContainer","container","providerModule","constructor","inversifyParentContainer","defaultScope","InjectionScope","Singleton","options","id","AppModuleInversifyContainer","Container","parent","appModuleRef","moduleContainer","injectionScopeToBindingScope","providers","forEach","x","bindToContainer","get","provider","isOptional","asList","middlewareResult","middlewaresManager","applyMiddlewares","MiddlewareType","BeforeGet","getProvider","bind","undefined","InjectionProviderModuleMissingProviderError","getMany","deps","map","dep","withOptions","isPlainObject","providerIdentifier","ProviderTokenHelpers","toProviderIdentifier","binders","providerTypeMatches","isProviderIdentifier","toSelf","isClassToken","to","useClass","isValueToken","toConstantValue","useValue","isFactoryToken","toResolvedValue","p","dependencies","inject","useFactory","find","InjectionProviderModuleUnknownProviderError","binding","setBindingScope","opts","when","injectionScope","getInjectionScopeByPriority","inSingletonScope","Transient","inTransientScope","Request","inRequestScope","dispose","getAll","optional","ContainerModule","ImportedModuleContainer","moduleDef","providerModule","dynamicModuleDef","importedIntoModule","proxyContainer","proxyContainerOptions","constructor","buildProxyContainer","dispose","moduleContainer","container","unloadSync","ContainerModule","options","traverseExportGraph","providerToken","foundInModule","proxyProviderIdentifier","exports","event$","subscribe","type","change","DefinitionEventType","Export","ExportRemoved","changeIsProvider","ProviderModuleHelpers","isModule","unproxyProviderIdentifier","changedModule","loadSync","fromModule","providerIdentifier","ProviderTokenHelpers","toProviderIdentifier","isBound","bind","toDynamicValue","middlewareResult","middlewaresManager","applyMiddlewares","MiddlewareType","OnExportAccess","unbind","undefined","get","setBindingScope","cb","currentExportsNode","discoveredExportedModules","exportedModuleOrProvider","ProviderModule","push","exportedModule","Signal","value","subscribers","Set","constructor","initialValue","emit","newValue","forEach","cb","get","subscribe","callback","invokeImmediately","add","delete","dispose","DynamicModuleDefinition","moduleContainer","providerModule","subscribe","event$","InjectionProviderModuleDisposedError","bind","moduleDef","Signal","type","DefinitionEventType","Noop","change","emittingModules","Set","importedModuleSubscriptions","Map","constructor","imports","providers","exports","buildInitialDefinition","options","addImport","moduleOrBlueprint","addToExports","ProviderModuleHelpers","tryBlueprintToModule","middlewareResult","middlewaresManager","applyMiddlewares","MiddlewareType","BeforeAddImport","add","createImportedModuleContainer","subscribeToImportedModuleEvents","emitEventSafely","Export","Import","ExportModule","addImportLazy","lazyCb","addProvider","provider","BeforeAddProvider","bindToContainer","Provider","ExportProvider","addProviderLazy","removeImport","module","has","BeforeRemoveImport","unsubscribeFromImportedModuleEvents","importedModuleContainer","importedModuleContainers","get","dispose","delete","ImportRemoved","removeFromExports","removeProvider","BeforeRemoveProvider","container","unbindSync","ProviderTokenHelpers","toProviderIdentifier","ProviderRemoved","exportDefinition","BeforeRemoveExport","ExportRemoved","isModule","ExportModuleRemoved","ExportProviderRemoved","event","emit","forEach","x","isModuleOrBlueprint","imp","isGlobal","importedModule","isPartOfTheExportsList","some","id","isAppModule","InjectionProviderModuleError","set","ImportedModuleContainer","subscription","dynamicModuleDef","unsubscribe","MiddlewaresManager","middlewaresMap","Map","providerModule","constructor","add","type","cb","currentMiddlewares","get","push","set","applyMiddlewares","args","InjectionProviderModuleDisposedError","middlewares","MiddlewareType","BeforeAddImport","BeforeAddProvider","chainedArg","middleware","result","BeforeGet","reduce","arg","BeforeRemoveImport","BeforeRemoveProvider","BeforeRemoveExport","OnExportAccess","some","clear","dispose","ProviderModuleBlueprint","id","imports","providers","exports","defaultScope","isGlobal","onReady","onReset","onDispose","blueprintOptions","constructor","options","updateDefinition","autoImportIntoAppModuleWhenGlobal","convertToModuleAndInjectIntoAppModuleIfGlobal","getDefinition","clone","deepClone","ProviderModule","APP_MODULE_REF","update","addImport","ProviderModule","id","options","definition","throwIfDisposed","dynamicModuleDef","moduleDef","update","middlewares","middlewaresManager","isDisposed","disposed","isAppModule","APP_MODULE_REF","appModuleRef","moduleContainer","importedModuleContainers","Map","constructor","appModule","inversify","publicOptions","throwIfIdIsMissing","MiddlewaresManager","ModuleContainer","parentContainer","DynamicModuleDefinition","isGlobal","addImport","onReady","create","optionsOrBlueprint","ProviderModuleHelpers","isBlueprint","getDefinition","InjectionError","blueprint","moduleOptions","blueprintOptions","ProviderModuleBlueprint","isImportingModule","idOrModule","isModule","has","keys","some","m","hasProvider","provider","providerIdentifier","ProviderTokenHelpers","toProviderIdentifier","container","isBound","get","isOptional","asList","value","emitEventSafely","type","DefinitionEventType","GetProvider","change","getMany","deps","isExportingModule","exports","x","isExportingProvider","tokenOrIdentifier","found","isProviderIdentifier","isModuleOrBlueprint","reset","shouldInvokeCb","before","after","cbs","onReset","clear","unbindAll","imports","providers","dispose","onDispose","forEach","toString","trim","length","InjectionProviderModuleMissingIdentifierError","InjectionProviderModuleDisposedError","ProviderModuleHelpers","isModule","value","ProviderModule","isBlueprint","ProviderModuleBlueprint","isModuleOrBlueprint","tryBlueprintToModule","blueprintToModule","moduleBlueprint","create","getDefinition","isFunction","v","Function","prototype","toString","call","startsWith","deepClone","obj","args","Array","isArray","map","item","clonedObj","key","Object","prototype","hasOwnProperty","call","Injectable","scope","undefined","_injectable","injectionScopeToBindingScope","inject","_inject","Inject","provider","_inject","ProviderTokenHelpers","toProviderIdentifier","multiInject","_multiInject","MultiInject","provider","_multiInject","ProviderTokenHelpers","toProviderIdentifier","injectFromBase","_injectFromBase","InjectFromBase","options","_injectFromBase","named","_named","Named","name","_named","optional","_optional","Optional","_optional","tagged","_tagged","Tagged","key","value","_tagged","unmanaged","_unmanaged","Unmanaged","_unmanaged","AppModule","ProviderModule","id","APP_MODULE_REF"]}
1
+ {"version":3,"sources":["../src/decorators/injectable.ts","../src/enums/injection-scope.enum.ts","../src/enums/middleware-type.enum.ts","../src/enums/definition-event-type.enum.ts","../src/helpers/scope-converter.ts","../src/helpers/provider-token.ts","../src/helpers/is-class.ts","../src/helpers/is-class-or-function.ts","../src/helpers/is-plain-object.ts","../src/errors/base.error.ts","../src/errors/provider-module.error.ts","../src/errors/provider-module-unknown-provider.ts","../src/errors/provider-module-disposed.error.ts","../src/errors/provider-module-missing-identifier.ts","../src/errors/provider-module-missing-provider.ts","../src/core/container/module-container.ts","../src/core/app-module/container.ts","../src/core/container/imported-module-container.ts","../src/utils/signal.ts","../src/core/dynamic-module-definition/dynamic-module-definition.ts","../src/core/middlewares-manager/middlewares-manager.ts","../src/core/provider-module-blueprint/provider-module-blueprint.ts","../src/core/provider-module/provider-module.ts","../src/helpers/provider-module.ts","../src/helpers/is-function.ts","../src/helpers/deep-clone.ts","../src/decorators/inject.ts","../src/decorators/multi-inject.ts","../src/decorators/inject-from-base.ts","../src/decorators/named.ts","../src/decorators/optional.ts","../src/decorators/tagged.ts","../src/decorators/unmanaged.ts","../src/core/app-module/app.module.ts"],"sourcesContent":["import { injectable as _injectable } from 'inversify';\n\nimport { InjectionScope } from '../enums';\nimport { injectionScopeToBindingScope } from '../helpers';\n\n/** See {@link https://inversify.io/docs/api/decorator/#injectable} for more details. */\nexport function Injectable(scope?: InjectionScope) {\n if (scope === undefined) return _injectable();\n\n return _injectable(injectionScopeToBindingScope(scope));\n}\n","export enum InjectionScope {\n /** When the service is resolved, the same cached resolved value will be used. */\n Singleton,\n\n /** When the service is resolved, a new resolved value will be used each time. */\n Transient,\n\n /** When the service is resolved within the same container request, the same resolved value will be used. */\n Request,\n}\n","export enum MiddlewareType {\n /**\n * Can be used to register a `middleware` which will be invoked right before importing a `module` into _this_ module.\n *\n * The provided middleware `callback` can either return a `boolean` or a `ProviderModule` instance.\n *\n * **Note:** _Returning `true` can be used to pass through the middleware without modifying_\n * _the `ProviderModule` instance, while returning `false` will reject the request of importing that specific module._\n */\n BeforeAddImport,\n\n /**\n * Can be used to register a `middleware` which will be invoked right before adding a provider to _this_ module.\n *\n * The provided middleware `callback` can either return a `boolean` or a `ProviderToken` object type.\n *\n * **Note:** _Returning `true` can be used to pass through the middleware without modifying_\n * _the `ProviderToken` object, while returning `false` will reject the request of adding that specific provider._\n */\n BeforeAddProvider,\n\n /**\n * Can be used to register a `middleware` which will be invoked right before a provider is returned to the consumer from _this_ module container.\n *\n * The provided middleware `callback` can return `anything`.\n */\n BeforeGet,\n\n /**\n * Can be used to register a `middleware` which will be invoked right before removing an imported module from _this_ module.\n *\n * **Note:** _The provided middleware `callback` must return a `boolean` where `true` means that_\n * _the imported module can be removed and `false` means to keep it._\n */\n BeforeRemoveImport,\n\n /**\n * Can be used to register a `middleware` which will be invoked right before removing a provider from _this_ module.\n *\n * **Note:** _The provided middleware `callback` must return a `boolean` where `true` means that_\n * _the provider can be removed and `false` means to keep it._\n */\n BeforeRemoveProvider,\n\n /**\n * Can be used to register a `middleware` which will be invoked right before removing an `ExportDefinition` from _this_ module.\n *\n * **Note:** _The provided middleware `callback` must return a `boolean` where `true` means that_\n * _the `ExportDefinition` can be removed and `false` means to keep it._\n */\n BeforeRemoveExport,\n\n /**\n * Can be used to register a `middleware` which will be invoked each time\n * a _consumer_ `module` tries to access the `ExportDefinition` list of _this_ module to `get` a provider.\n *\n * **Note:** _The provided middleware `callback` will be invoked for each `ProviderToken` of the `ExportsDefinition` list_\n * _and must return a `boolean` where `true` means that the `ProviderToken` is authorized to be used by the importer module._\n */\n OnExportAccess,\n}\n","export enum DefinitionEventType {\n /** No-Operation, yet. */\n Noop,\n\n /**\n * A new `module` or `blueprint` has been added.\n *\n * **Note:** _The occurred change type is: `ModuleOrBlueprint`_\n */\n Import,\n\n /**\n * A new `provider` has been added.\n *\n * **Note:** _The occurred change type is: `DependencyProvider`_\n */\n Provider,\n\n /**\n * A `module` is retrieving from its container a `provider`.\n *\n * **Note:** _The occurred change type is: `any`_\n */\n GetProvider,\n\n /**\n * A new `module` or `provider` has been added to the `exports` definition.\n *\n * **Note:** _The occurred change type is: `ExportDefinition`_\n */\n Export,\n\n /**\n * A new `module` or `blueprint` has been added to the `exports` definition.\n *\n * **Note:** _The occurred change type is: `ModuleOrBlueprint`_\n */\n ExportModule,\n\n /**\n * A new `provider` has been added to the `exports` definition.\n *\n * **Note:** _The occurred change type is: `ProviderToken`_\n */\n ExportProvider,\n\n /**\n * A `module` has been removed.\n *\n * **Note:** _The occurred change type is: `IProviderModule`_\n */\n ImportRemoved,\n\n /**\n * A `provider` has been removed.\n *\n * **Note:** _The occurred change type is: `DependencyProvider`_\n */\n ProviderRemoved,\n\n /**\n * An `ExportDefinition` has been removed.\n *\n * **Note:** _The occurred change type is: `ExportDefinition`_\n */\n ExportRemoved,\n\n /**\n * A `module` has been removed from the `export` definition.\n *\n * **Note:** _The occurred change type is: `IProviderModule`_\n */\n ExportModuleRemoved,\n\n /**\n * A `provider` has been removed from the `export` definition.\n *\n * **Note:** _The occurred change type is: `ProviderToken`_\n */\n ExportProviderRemoved,\n}\n","import type { BindingScope } from 'inversify';\n\nimport { InjectionScope } from '../enums';\n\nexport function injectionScopeToBindingScope(injectionScope: InjectionScope): BindingScope {\n switch (injectionScope) {\n case InjectionScope.Singleton:\n return 'Singleton';\n case InjectionScope.Transient:\n return 'Transient';\n case InjectionScope.Request:\n return 'Request';\n }\n}\n\nexport function bindingScopeToInjectionScope(bindingScope: BindingScope): InjectionScope {\n switch (bindingScope) {\n case 'Singleton':\n return InjectionScope.Singleton;\n case 'Transient':\n return InjectionScope.Transient;\n case 'Request':\n return InjectionScope.Request;\n }\n}\n","import { getClassMetadata } from '@inversifyjs/core';\n\nimport { InjectionScope } from '../enums';\nimport type {\n ProviderClassToken,\n ProviderFactoryToken,\n ProviderIdentifier,\n ProviderOptions,\n ProviderScopeOption,\n ProviderToken,\n ProviderValueToken,\n} from '../types';\nimport { isClass } from './is-class';\nimport { isClassOrFunction } from './is-class-or-function';\nimport { isPlainObject } from './is-plain-object';\nimport { bindingScopeToInjectionScope } from './scope-converter';\n\nexport namespace ProviderTokenHelpers {\n export function isClassToken<T>(provider: ProviderToken<T>): provider is ProviderClassToken<T> {\n return hasProvideProperty(provider) && 'useClass' in provider;\n }\n\n export function isValueToken<T>(provider: ProviderToken<T>): provider is ProviderValueToken<T> {\n return hasProvideProperty(provider) && 'useValue' in provider;\n }\n\n export function isFactoryToken<T>(provider: ProviderToken<T>): provider is ProviderFactoryToken<T> {\n return hasProvideProperty(provider) && 'useFactory' in provider;\n }\n\n export function isProviderIdentifier<T = any>(value: any): value is ProviderIdentifier<T> {\n return typeof value === 'string' || typeof value === 'symbol' || isClassOrFunction(value);\n }\n\n export function toProviderIdentifier<T = any>(provider: ProviderToken<T>): ProviderIdentifier<T> {\n return isProviderIdentifier(provider) ? provider : provider.provide;\n }\n\n export function toProviderIdentifiers(providers: ProviderToken[]): ProviderIdentifier<unknown>[] {\n return providers.map((provider) => toProviderIdentifier(provider));\n }\n\n export function providerIdentifierToString(providerIdentifier: ProviderIdentifier): string {\n if (typeof providerIdentifier === 'symbol' || typeof providerIdentifier === 'string') {\n return providerIdentifier.toString();\n }\n\n return providerIdentifier.name;\n }\n\n export function providerTokenToString(providerToken: ProviderToken): string {\n const providerIdentifier = toProviderIdentifier(providerToken);\n\n return providerIdentifierToString(providerIdentifier);\n }\n\n export function providerTokensAreEqual(p0: ProviderToken, p1: ProviderToken): boolean {\n if (p0 === p1) return true;\n\n const id0 = toProviderIdentifier(p0);\n const id1 = toProviderIdentifier(p1);\n\n if (id0 !== id1) return false;\n\n if (isClassToken(p0) && isClassToken(p1)) {\n return p0.useClass === p1.useClass;\n }\n\n if (isValueToken(p0) && isValueToken(p1)) {\n return p0.useValue === p1.useValue;\n }\n\n if (isFactoryToken(p0) && isFactoryToken(p1)) {\n if (p0.useFactory !== p1.useFactory) return false;\n\n // const inject0 = p0.inject ?? [];\n // const inject1 = p1.inject ?? [];\n\n // if (inject0.length !== inject1.length) return false;\n\n // for (let i = 0; i < inject0.length; i++) {\n // if (inject0[i] !== inject1[i]) return false;\n // }\n\n return true;\n }\n\n // At this point, identifiers are equal but tokens are not class/value/factory tokens,\n // so consider them equal based on identifier alone.\n return true;\n }\n\n /**\n * The priority order is as follows:\n * 1. From the `ProviderToken.scope`\n * 2. From the class `@Injectable(scope)` decorator\n * 3. From the `ProviderModule` default scope.\n *\n * @param provider The {@link ProviderToken}.\n * @param moduleDefaultScope The module default scope.\n */\n export function getInjectionScopeByPriority(\n provider: ProviderToken,\n moduleDefaultScope: InjectionScope\n ): InjectionScope {\n return tryGetScopeFromProvider(provider) ?? tryGetDecoratorScopeFromClass(provider) ?? moduleDefaultScope;\n }\n\n export function tryGetProviderOptions<T>(\n provider: ProviderToken<T>\n ): (ProviderOptions<T> & ProviderScopeOption) | undefined {\n if (!hasProvideProperty(provider)) return;\n\n return provider as any;\n }\n\n export function tryGetScopeFromProvider(provider: ProviderToken): InjectionScope | undefined {\n const providerOptions = tryGetProviderOptions(provider);\n if (!providerOptions) return;\n\n return providerOptions.scope;\n }\n\n export function tryGetDecoratorScopeFromClass<T = any>(provider: ProviderToken<T>): InjectionScope | undefined {\n const providerClass = toProviderIdentifier(provider);\n if (!isClass(providerClass)) return;\n\n const inversifyScope = getClassMetadata(providerClass as any)?.scope;\n if (!inversifyScope) return;\n\n return bindingScopeToInjectionScope(inversifyScope);\n }\n\n function hasProvideProperty(provider: any): provider is object {\n return isPlainObject(provider) && typeof provider === 'object' && 'provide' in provider;\n }\n}\n","export function isClass(v: any): boolean {\n if (typeof v !== 'function') return false;\n\n return Function.prototype.toString.call(v).startsWith('class ');\n}\n","import type { Class } from 'type-fest';\n\nexport function isClassOrFunction(value: any): value is Function | Class<any> {\n return typeof value === 'function';\n}\n","/*\n * is-plain-object <https://github.com/jonschlinkert/is-plain-object>\n *\n * Copyright (c) 2014-2017, Jon Schlinkert.\n * Released under the MIT License.\n */\n\nfunction isObject(o: any): boolean {\n return Object.prototype.toString.call(o) === '[object Object]';\n}\n\nexport function isPlainObject(o: any): o is object {\n if (isObject(o) === false) return false;\n\n // If has modified constructor\n const ctor = o.constructor;\n if (ctor === undefined) return true;\n\n // If has modified prototype\n const prot = ctor.prototype;\n if (isObject(prot) === false) return false;\n\n // If constructor does not have an Object-specific method\n if (prot.hasOwnProperty('isPrototypeOf') === false) {\n return false;\n }\n\n // Most likely a plain Object\n return true;\n}\n","/** Exception which indicates that there is a generic error. */\nexport class InjectionError extends Error {\n override name = InjectionError.name;\n}\n","import type { IProviderModule } from '../core';\n\n/** Exception which indicates that there is a generic error with an instance of {@link IProviderModule}. */\nexport class InjectionProviderModuleError extends Error {\n override name = InjectionProviderModuleError.name;\n\n constructor(module: IProviderModule, message: string) {\n let moduleId = 'Unknown';\n\n try {\n moduleId = module.toString();\n } catch {}\n\n super(`{ProviderModule.${moduleId}} => ${message}`);\n }\n}\n","import type { IProviderModule } from '../core';\nimport { ProviderTokenHelpers } from '../helpers';\nimport type { ProviderToken } from '../types';\nimport { InjectionProviderModuleError } from './provider-module.error';\n\n/** Exception which indicates that an `unknown` type of {@link ProviderToken} has been supplied. */\nexport class InjectionProviderModuleUnknownProviderError extends InjectionProviderModuleError {\n override name = InjectionProviderModuleUnknownProviderError.name;\n\n constructor(module: IProviderModule, providerToken: ProviderToken) {\n super(module, `The [${ProviderTokenHelpers.providerTokenToString(providerToken)}] provider is of an unknown type!`);\n }\n}\n","import type { IProviderModule } from '../core';\nimport { InjectionProviderModuleError } from './provider-module.error';\n\n/** Exception which indicates an invokation of a disposed module. */\nexport class InjectionProviderModuleDisposedError extends InjectionProviderModuleError {\n override name = InjectionProviderModuleDisposedError.name;\n\n constructor(module: IProviderModule) {\n super(module, 'Has been disposed!');\n }\n}\n","import type { IProviderModule } from '../core';\nimport { InjectionProviderModuleError } from './provider-module.error';\n\n/** Exception which indicates that a module has been initialized without an `identifier`. */\nexport class InjectionProviderModuleMissingIdentifierError extends InjectionProviderModuleError {\n override name = InjectionProviderModuleMissingIdentifierError.name;\n\n constructor(module: IProviderModule) {\n super(module, 'An `identifier` must be supplied!');\n }\n}\n","import type { IProviderModule } from '../core';\nimport { ProviderTokenHelpers } from '../helpers';\nimport type { ProviderToken } from '../types';\nimport { InjectionProviderModuleError } from './provider-module.error';\n\n/** Exception which indicates that a module container does not contain the requested provider. */\nexport class InjectionProviderModuleMissingProviderError extends InjectionProviderModuleError {\n override name = InjectionProviderModuleMissingProviderError.name;\n\n constructor(module: IProviderModule, providerToken: ProviderToken) {\n super(\n module,\n `The [${ProviderTokenHelpers.providerTokenToString(providerToken)}] provider is not bound to this (or any imported) module container, and was not found either in the 'AppModule'!`\n );\n }\n}\n","import { Container, type BindInWhenOnFluentSyntax, type BindWhenOnFluentSyntax } from 'inversify';\n\nimport { InjectionScope, MiddlewareType } from '../../enums';\nimport { InjectionProviderModuleMissingProviderError, InjectionProviderModuleUnknownProviderError } from '../../errors';\nimport { injectionScopeToBindingScope, isPlainObject, ProviderTokenHelpers } from '../../helpers';\nimport type {\n DependencyProvider,\n ProviderClassToken,\n ProviderFactoryToken,\n ProviderOptions,\n ProviderToken,\n ProviderValueToken,\n} from '../../types';\nimport { AppModuleInversifyContainer } from '../app-module/container';\nimport type {\n ProviderModuleGetManyParam,\n ProviderModuleGetManyReturn,\n ProviderModuleGetReturn,\n} from '../provider-module';\nimport { ProviderModule } from '../provider-module/provider-module';\n\nexport class ModuleContainer {\n readonly container: Container;\n private readonly providerModule: ProviderModule;\n\n constructor(providerModule: ProviderModule, inversifyParentContainer?: Container) {\n this.providerModule = providerModule;\n\n const { defaultScope = InjectionScope.Singleton } = providerModule.options;\n\n this.container =\n providerModule.id === 'AppModule'\n ? AppModuleInversifyContainer\n : new Container({\n parent: inversifyParentContainer ?? this.providerModule.appModuleRef.moduleContainer.container,\n defaultScope: injectionScopeToBindingScope(defaultScope),\n });\n\n this.providerModule.options.providers?.forEach((x) => this.bindToContainer(x));\n }\n\n get<T, IsOptional extends boolean | undefined = undefined, AsList extends boolean | undefined = undefined>(\n provider: ProviderToken<T>,\n isOptional?: IsOptional,\n asList?: AsList\n ): ProviderModuleGetReturn<T, IsOptional, AsList> {\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares<any>(\n MiddlewareType.BeforeGet,\n this.getProvider(provider, asList),\n provider,\n this.getProvider.bind(this)\n );\n if (middlewareResult || middlewareResult === null) return middlewareResult;\n\n if (isOptional) return undefined as any;\n\n throw new InjectionProviderModuleMissingProviderError(this.providerModule, provider);\n }\n\n getMany<D extends (ProviderModuleGetManyParam<any> | ProviderToken)[]>(\n ...deps: D | unknown[]\n ): ProviderModuleGetManyReturn<D> {\n return (deps as D).map((dep) => {\n const withOptions = isPlainObject(dep) && 'provider' in dep;\n\n return this.get(\n withOptions ? dep.provider : dep,\n withOptions ? dep.isOptional : false,\n withOptions ? dep.asList : false\n );\n }) as any;\n }\n\n bindToContainer<T>(provider: DependencyProvider<T>): void {\n const providerIdentifier = ProviderTokenHelpers.toProviderIdentifier(provider);\n\n const binders: Array<{\n providerTypeMatches: (p: any) => boolean;\n bind: () => BindInWhenOnFluentSyntax<any> | BindWhenOnFluentSyntax<any>;\n }> = [\n {\n providerTypeMatches: ProviderTokenHelpers.isProviderIdentifier,\n bind: () => this.container.bind(providerIdentifier).toSelf(),\n },\n {\n providerTypeMatches: ProviderTokenHelpers.isClassToken,\n bind: () => this.container.bind(providerIdentifier).to((provider as ProviderClassToken<T>).useClass),\n },\n {\n providerTypeMatches: ProviderTokenHelpers.isValueToken,\n bind: () =>\n this.container.bind(providerIdentifier).toConstantValue((provider as ProviderValueToken<T>).useValue),\n },\n {\n providerTypeMatches: ProviderTokenHelpers.isFactoryToken,\n bind: () =>\n this.container.bind(providerIdentifier).toResolvedValue(() => {\n const p = provider as ProviderFactoryToken<T>;\n\n const dependencies = this.providerModule.getMany(...(p.inject ?? []));\n\n return p.useFactory(...dependencies);\n }),\n },\n ];\n\n const { bind } = binders.find(({ providerTypeMatches }) => providerTypeMatches(provider)) ?? {};\n if (!bind) {\n throw new InjectionProviderModuleUnknownProviderError(this.providerModule, provider);\n }\n\n const isProviderIdentifier = ProviderTokenHelpers.isProviderIdentifier(provider);\n\n // Create initial inversify binding fluent syntax object\n let binding = bind();\n\n // A `ValueToken` is always a constant, so there's no point in binding a specific scope.\n // And if the provider is a simple `ProviderIdentifier` then it means that it'll use the container default scope.\n if (!ProviderTokenHelpers.isValueToken(provider) && !isProviderIdentifier) {\n binding = this.setBindingScope(provider, binding as BindInWhenOnFluentSyntax<any>);\n }\n\n // If it is a simple `ProviderIdentifier` there's nothing more we can do\n // as it is not an object which contains the `ProviderOptions` properties.\n if (isProviderIdentifier) return;\n\n const opts = provider as ProviderOptions<unknown>;\n\n if (opts.when) {\n binding.when(opts.when) as any;\n }\n }\n\n setBindingScope<T>(provider: ProviderToken<T>, binding: BindInWhenOnFluentSyntax<T>): BindWhenOnFluentSyntax<T> {\n const injectionScope = ProviderTokenHelpers.getInjectionScopeByPriority(\n provider,\n this.providerModule.options.defaultScope ?? InjectionScope.Singleton\n );\n\n switch (injectionScope) {\n case InjectionScope.Singleton:\n return binding.inSingletonScope();\n case InjectionScope.Transient:\n return binding.inTransientScope();\n case InjectionScope.Request:\n return binding.inRequestScope();\n }\n }\n\n dispose(): void {\n //@ts-expect-error Read-only property.\n this.providerModule = null;\n //@ts-expect-error Read-only property.\n this.container = null;\n }\n\n private getProvider<T>(provider: ProviderToken<T>, asList?: boolean): T | T[] | void {\n const providerIdentifier = ProviderTokenHelpers.toProviderIdentifier(provider);\n\n if (asList) {\n return this.container.getAll(providerIdentifier, { optional: true });\n }\n\n return this.container.get(providerIdentifier, { optional: true });\n }\n}\n","import { Container } from 'inversify';\n\nexport const AppModuleInversifyContainer = new Container({ defaultScope: 'Singleton' });\n","import { ContainerModule, type ContainerModuleLoadOptions } from 'inversify';\n\nimport { DefinitionEventType, MiddlewareType } from '../../enums';\nimport { ProviderModuleHelpers, ProviderTokenHelpers } from '../../helpers';\nimport type { ExportsDefinitionOptimized, ModuleDefinition, ProviderToken } from '../../types';\nimport { ProviderModule } from '../provider-module/provider-module';\n\nexport class ImportedModuleContainer {\n get moduleDef(): ModuleDefinition<true> {\n return this.providerModule.dynamicModuleDef.moduleDef;\n }\n\n /** The {@link ProviderModule} which imported {@link providerModule | this} module. */\n private readonly importedIntoModule: ProviderModule;\n private readonly providerModule: ProviderModule;\n private readonly proxyContainer: ContainerModule;\n private proxyContainerOptions!: ContainerModuleLoadOptions;\n\n constructor(importedIntoModule: ProviderModule, providerModule: ProviderModule) {\n this.importedIntoModule = importedIntoModule;\n this.providerModule = providerModule;\n\n this.proxyContainer = this.buildProxyContainer();\n }\n\n dispose(): void {\n this.importedIntoModule.moduleContainer.container.unloadSync(this.proxyContainer);\n\n //@ts-expect-error Read-only property.\n this.importedIntoModule = null;\n //@ts-expect-error Read-only property.\n this.providerModule = null;\n //@ts-expect-error Read-only property.\n this.proxyContainer = null;\n //@ts-expect-error Read-only property.\n this.proxyContainerOptions = null;\n }\n\n private buildProxyContainer(): ContainerModule {\n const proxyContainer = new ContainerModule((options) => {\n this.proxyContainerOptions = options;\n\n this.traverseExportGraph((providerToken, foundInModule) => {\n this.proxyProviderIdentifier(providerToken, foundInModule);\n }, this.moduleDef.exports);\n\n // Subscribe to export changes only on this imported module.\n this.providerModule.dynamicModuleDef.event$.subscribe(({ type, change }) => {\n if (type !== DefinitionEventType.Export && type !== DefinitionEventType.ExportRemoved) return;\n\n const changeIsProvider = !ProviderModuleHelpers.isModule(change);\n\n if (changeIsProvider) {\n if (type === DefinitionEventType.Export) {\n this.proxyProviderIdentifier(change, this.providerModule);\n } else if (type === DefinitionEventType.ExportRemoved) {\n this.unproxyProviderIdentifier(change);\n }\n\n return;\n }\n\n // change is a module added or removed from exports\n const changedModule = change as ProviderModule;\n\n if (type === DefinitionEventType.Export) {\n // New exported module added: bind its providers recursively\n this.traverseExportGraph((providerToken, foundInModule) => {\n this.proxyProviderIdentifier(providerToken, foundInModule);\n }, changedModule.dynamicModuleDef.moduleDef.exports);\n } else {\n // Exported module removed: unbind its providers recursively\n this.traverseExportGraph((providerToken) => {\n this.unproxyProviderIdentifier(providerToken);\n }, changedModule.dynamicModuleDef.moduleDef.exports);\n }\n });\n });\n\n this.importedIntoModule.moduleContainer.container.loadSync(proxyContainer);\n\n return proxyContainer;\n }\n\n private proxyProviderIdentifier(providerToken: ProviderToken, fromModule: ProviderModule): void {\n const providerIdentifier = ProviderTokenHelpers.toProviderIdentifier(providerToken);\n\n if (this.proxyContainerOptions.isBound(providerIdentifier)) return;\n\n const bind = this.proxyContainerOptions.bind(providerIdentifier).toDynamicValue(() => {\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares(\n MiddlewareType.OnExportAccess,\n this.importedIntoModule,\n providerIdentifier\n );\n\n if (middlewareResult === false) {\n this.proxyContainerOptions.unbind(providerIdentifier);\n return undefined;\n }\n\n return fromModule.moduleContainer.container.get(providerIdentifier);\n });\n\n this.providerModule.moduleContainer.setBindingScope(providerToken, bind);\n }\n\n private unproxyProviderIdentifier(providerToken: ProviderToken): void {\n const providerIdentifier = ProviderTokenHelpers.toProviderIdentifier(providerToken);\n\n /* istanbul ignore next */\n if (!this.proxyContainerOptions.isBound(providerIdentifier)) return;\n\n this.proxyContainerOptions.unbind(providerIdentifier);\n }\n\n private traverseExportGraph(\n cb: (providerToken: ProviderToken, foundInModule: ProviderModule) => void,\n currentExportsNode: ExportsDefinitionOptimized\n ): void {\n // As the `exports` array can be a mix of `Providers` and `Modules`\n // we want to tap into the `exports` of an imported module as the last resort\n // as that could mean recursively going into the `exports` of the imported module and so on.\n //\n // Therefore we first iterate over the entire array and cache any module we find\n // into the `discoveredExportedModules` temporary array, then skip over the iteration,\n // this allows us to make sure that we always 1st try to get the provider from the current `export`\n // and only as a last resort to tap into the `exports` of the imported modules by iterating over the `discoveredExportedModules` temp array.\n\n const discoveredExportedModules: ProviderModule[] = [];\n\n for (const exportedModuleOrProvider of currentExportsNode) {\n const isModule = exportedModuleOrProvider instanceof ProviderModule;\n if (isModule) {\n discoveredExportedModules.push(exportedModuleOrProvider);\n\n // Will get to it later in the eventuality we'll not find the\n // provider into the current `exports` of the imported module.\n continue;\n } else {\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares(\n MiddlewareType.OnExportAccess,\n this.importedIntoModule,\n exportedModuleOrProvider\n );\n\n if (middlewareResult === false) continue;\n\n // Found it into the `exports` of this imported module.\n cb(exportedModuleOrProvider as any, this.providerModule);\n }\n }\n\n // If we got here it means that the `provider` has not been found in the\n // `exports` of the current imported module, therefore we must recursively drill into\n // the exported modules of the imported module.\n for (const exportedModule of discoveredExportedModules) {\n this.traverseExportGraph(cb, exportedModule.dynamicModuleDef.moduleDef.exports);\n }\n }\n}\n","export class Signal<T> {\n private value: T;\n\n private readonly subscribers = new Set<SignalCallback<T>>();\n\n constructor(initialValue: T) {\n this.value = initialValue;\n }\n\n /** Can be used to `emit` a _new_ value and notify the _subscribers_. */\n emit(newValue: T): void {\n this.value = newValue;\n\n this.subscribers.forEach((cb) => cb(this.value));\n }\n\n /** Can be used to retrieve the _current_ value of the {@link Signal} imperatively. */\n get(): T {\n return this.value;\n }\n\n /**\n * Can be used to `subscribe` to the emitted values of this {@link Signal}.\n *\n * @param callback The `callback` which will be invoked when a _new_ value is emitted.\n * @param invokeImmediately When set to `true` it'll invoke the provided {@link callback} immediately with the latest value available. _(defaults to `false`)_\n */\n subscribe(callback: SignalCallback<T>, invokeImmediately?: boolean): () => void {\n this.subscribers.add(callback);\n\n if (invokeImmediately) callback(this.value);\n\n return () => this.subscribers.delete(callback);\n }\n\n /** Disposes of the internal references. */\n dispose(): void {\n //@ts-expect-error Read-only property.\n this.subscribers = null;\n this.value = null as any;\n }\n}\n\ntype SignalCallback<T> = (value: T) => void | Promise<void>;\n","import { DefinitionEventType, MiddlewareType } from '../../enums';\nimport { InjectionProviderModuleDisposedError, InjectionProviderModuleError } from '../../errors';\nimport { ProviderModuleHelpers, ProviderTokenHelpers } from '../../helpers';\nimport type {\n AsyncMethod,\n DependencyProvider,\n ExportDefinition,\n ModuleDefinition,\n ModuleOrBlueprint,\n} from '../../types';\nimport { Signal } from '../../utils';\nimport { ImportedModuleContainer, type ModuleContainer } from '../container';\nimport type { IProviderModule, ProviderModuleOptions } from '../provider-module';\nimport type { ProviderModule } from '../provider-module/provider-module';\nimport type { DefinitionEvent, IDynamicModuleDefinition } from './interfaces';\n\nexport class DynamicModuleDefinition implements IDynamicModuleDefinition {\n get moduleContainer(): ModuleContainer {\n return this.providerModule.moduleContainer;\n }\n\n get subscribe(): IDynamicModuleDefinition['subscribe'] {\n /* istanbul ignore next */\n if (this.event$ === null) {\n throw new InjectionProviderModuleDisposedError(this.providerModule);\n }\n\n return this.event$.subscribe.bind(this.event$);\n }\n\n readonly moduleDef: ModuleDefinition<true>;\n readonly event$ = new Signal<DefinitionEvent>({\n type: DefinitionEventType.Noop,\n change: null,\n });\n\n private readonly providerModule: ProviderModule;\n private emittingModules = new Set<ProviderModule>();\n\n // Track subscriptions to imported modules' events for bubbling\n private importedModuleSubscriptions = new Map<ProviderModule, () => void>();\n\n constructor(providerModule: ProviderModule) {\n this.providerModule = providerModule;\n this.moduleDef = {\n imports: new Set(),\n providers: new Set(),\n exports: new Set(),\n };\n\n this.buildInitialDefinition(providerModule.options);\n }\n\n addImport(moduleOrBlueprint: ModuleOrBlueprint, addToExports = false): void {\n let providerModule = ProviderModuleHelpers.tryBlueprintToModule(moduleOrBlueprint) as ProviderModule;\n\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares<ProviderModule | false>(\n MiddlewareType.BeforeAddImport,\n providerModule\n );\n\n if (middlewareResult === false) return;\n providerModule = middlewareResult;\n\n this.moduleDef.imports.add(providerModule);\n\n this.createImportedModuleContainer(providerModule);\n\n // Subscribe to imported module's export events to bubble them\n this.subscribeToImportedModuleEvents(providerModule);\n\n this.emitEventSafely({\n type: DefinitionEventType.Export,\n change: providerModule,\n });\n\n this.emitEventSafely({\n type: DefinitionEventType.Import,\n change: providerModule,\n });\n\n if (!addToExports) return;\n\n this.moduleDef.exports.add(providerModule);\n\n this.emitEventSafely({\n type: DefinitionEventType.ExportModule,\n change: providerModule,\n });\n }\n\n async addImportLazy(lazyCb: AsyncMethod<ProviderModule>, addToExports?: boolean): Promise<void> {\n const providerModule = await lazyCb();\n\n this.addImport(providerModule, addToExports);\n }\n\n addProvider<T>(provider: DependencyProvider<T>, addToExports = false): void {\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares<DependencyProvider<T> | false>(\n MiddlewareType.BeforeAddProvider,\n provider\n );\n\n if (middlewareResult === false) return;\n provider = middlewareResult;\n\n this.moduleDef.providers.add(provider);\n\n this.moduleContainer.bindToContainer(provider);\n\n this.emitEventSafely({\n type: DefinitionEventType.Provider,\n change: provider,\n });\n\n if (!addToExports) return;\n\n this.moduleDef.exports.add(provider);\n\n this.emitEventSafely({\n type: DefinitionEventType.Export,\n change: provider,\n });\n\n this.emitEventSafely({\n type: DefinitionEventType.ExportProvider,\n change: provider,\n });\n }\n\n async addProviderLazy<T>(lazyCb: AsyncMethod<DependencyProvider<T>>, addToExports?: boolean): Promise<void> {\n const provider = await lazyCb();\n\n this.addProvider(provider, addToExports);\n }\n\n removeImport(module: IProviderModule): boolean {\n /* istanbul ignore next */\n if (!this.moduleDef.imports.has(module)) return false;\n\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares(\n MiddlewareType.BeforeRemoveImport,\n module\n );\n\n if (middlewareResult === false) return false;\n\n this.unsubscribeFromImportedModuleEvents(module as ProviderModule);\n\n const importedModuleContainer = this.providerModule.importedModuleContainers.get(module)!;\n importedModuleContainer.dispose();\n this.providerModule.importedModuleContainers.delete(module);\n this.moduleDef.imports.delete(module);\n\n this.emitEventSafely({\n type: DefinitionEventType.ImportRemoved,\n change: module,\n });\n\n this.removeFromExports(module);\n\n return true;\n }\n\n removeProvider<T>(provider: DependencyProvider<T>): boolean {\n if (!this.moduleDef.providers.has(provider)) return false;\n\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares(\n MiddlewareType.BeforeRemoveProvider,\n provider\n );\n\n if (middlewareResult === false) return false;\n\n this.moduleDef.providers.delete(provider);\n this.moduleContainer.container.unbindSync(ProviderTokenHelpers.toProviderIdentifier(provider));\n\n this.emitEventSafely({\n type: DefinitionEventType.ProviderRemoved,\n change: provider,\n });\n\n this.removeFromExports(provider);\n\n return true;\n }\n\n removeFromExports(exportDefinition: ExportDefinition): boolean {\n if (!this.moduleDef.exports.has(exportDefinition)) return false;\n\n const middlewareResult = this.providerModule.middlewaresManager.applyMiddlewares(\n MiddlewareType.BeforeRemoveExport,\n exportDefinition\n );\n\n if (middlewareResult === false) return false;\n\n this.moduleDef.exports.delete(exportDefinition);\n\n this.emitEventSafely({\n type: DefinitionEventType.ExportRemoved,\n change: exportDefinition,\n });\n\n if (ProviderModuleHelpers.isModule(exportDefinition)) {\n this.emitEventSafely({\n type: DefinitionEventType.ExportModuleRemoved,\n change: exportDefinition,\n });\n } else {\n this.emitEventSafely({\n type: DefinitionEventType.ExportProviderRemoved,\n change: exportDefinition,\n });\n }\n\n return true;\n }\n\n emitEventSafely(event: DefinitionEvent): void {\n if (this.emittingModules.has(this.providerModule)) {\n // Already emitting for this module, skip to prevent cycle\n return;\n }\n\n try {\n this.emittingModules.add(this.providerModule);\n this.event$.emit(event);\n } finally {\n this.emittingModules.delete(this.providerModule);\n }\n }\n\n dispose(): void {\n //@ts-expect-error Null not assignable.\n this.importedModuleSubscriptions = null;\n //@ts-expect-error Null not assignable.\n this.emittingModules = null;\n\n this.event$.dispose();\n //@ts-expect-error Read-only property.\n this.event$ = null;\n //@ts-expect-error Read-only property.\n this.moduleDef = null;\n }\n\n private buildInitialDefinition({ imports = [], providers = [], exports = [] }: ProviderModuleOptions): void {\n //@ts-expect-error Read-only property.\n this.moduleDef.providers = new Set(providers);\n\n exports.forEach((x) => {\n // We do not want to add `modules` or `blueprint` at this stage in the `exports` definition,\n // as if it is a `blueprint` we must first \"convert\" it to a `module`.\n // (which will happen down here in the `imports.forEach` loop)\n\n if (ProviderModuleHelpers.isModuleOrBlueprint(x)) return;\n\n this.moduleDef.exports.add(x);\n });\n\n imports.forEach((imp) => {\n const isModule = ProviderModuleHelpers.isModule(imp);\n const isGlobal = isModule ? (imp as ProviderModule).options.isGlobal : imp.isGlobal;\n\n // Importing global modules is pointless as\n // each module has access to the `AppModule`.\n if (isGlobal) return;\n\n const importedModule = ProviderModuleHelpers.tryBlueprintToModule(imp) as ProviderModule;\n const isPartOfTheExportsList = exports.some(\n (x) => ProviderModuleHelpers.isModuleOrBlueprint(x) && x.id === importedModule.id\n );\n\n this.addImport(importedModule, isPartOfTheExportsList);\n });\n }\n\n private createImportedModuleContainer(importedModule: ProviderModule): void {\n if (importedModule.isAppModule) {\n throw new InjectionProviderModuleError(this.providerModule, `The 'AppModule' can't be imported!`);\n }\n\n this.providerModule.importedModuleContainers.set(\n importedModule,\n new ImportedModuleContainer(this.providerModule, importedModule)\n );\n }\n\n private subscribeToImportedModuleEvents(importedModule: ProviderModule): void {\n if (this.importedModuleSubscriptions.has(importedModule)) return;\n\n const subscription = importedModule.dynamicModuleDef.event$.subscribe(({ type, change }) => {\n // Bubble only export-related events up to this module's event$\n switch (type) {\n case DefinitionEventType.Export:\n case DefinitionEventType.ExportRemoved:\n case DefinitionEventType.ExportModule:\n case DefinitionEventType.ExportModuleRemoved:\n case DefinitionEventType.ExportProvider:\n case DefinitionEventType.ExportProviderRemoved:\n this.emitEventSafely({ type, change });\n break;\n }\n });\n\n this.importedModuleSubscriptions.set(importedModule, subscription);\n }\n\n private unsubscribeFromImportedModuleEvents(importedModule: ProviderModule): void {\n const unsubscribe = this.importedModuleSubscriptions.get(importedModule);\n /* istanbul ignore next */\n if (!unsubscribe) return;\n\n unsubscribe();\n this.importedModuleSubscriptions.delete(importedModule);\n }\n}\n","import { MiddlewareType } from '../../enums';\nimport { InjectionProviderModuleDisposedError } from '../../errors';\nimport type { ProviderModule } from '../provider-module';\nimport type { AddMiddlewareCallbackType, IMiddlewaresManager } from './middlewares-manager.interfaces';\n\nexport class MiddlewaresManager implements IMiddlewaresManager {\n private middlewaresMap: Map<MiddlewareType, Function[]> = new Map();\n private readonly providerModule: ProviderModule;\n\n constructor(providerModule: ProviderModule) {\n this.providerModule = providerModule;\n }\n\n add<T extends MiddlewareType>(type: MiddlewareType, cb: AddMiddlewareCallbackType<T>): void {\n const currentMiddlewares = this.middlewaresMap.get(type);\n\n if (currentMiddlewares) {\n currentMiddlewares.push(cb);\n\n return;\n }\n\n // First middleware\n this.middlewaresMap.set(type, [cb]);\n }\n\n applyMiddlewares<T>(type: MiddlewareType, ...args: any[]): T {\n if (this.middlewaresMap === null) throw new InjectionProviderModuleDisposedError(this.providerModule);\n\n const middlewares = this.middlewaresMap.get(type);\n\n switch (type) {\n case MiddlewareType.BeforeAddImport:\n case MiddlewareType.BeforeAddProvider:\n if (!middlewares) return args[0];\n\n let chainedArg = args[0];\n\n for (const middleware of middlewares) {\n const result = middleware(chainedArg);\n\n if (result === false) return false as T;\n if (result === true) continue;\n\n chainedArg = result;\n }\n\n return chainedArg;\n\n case MiddlewareType.BeforeGet:\n return !middlewares\n ? args[0]\n : middlewares.reduce((arg, middleware) => middleware(arg, args[1], args[2]), args[0]);\n\n case MiddlewareType.BeforeRemoveImport:\n case MiddlewareType.BeforeRemoveProvider:\n case MiddlewareType.BeforeRemoveExport:\n case MiddlewareType.OnExportAccess:\n return (!middlewares || !middlewares.some((middleware) => !middleware(args[0], args[1]))) as T;\n }\n }\n\n clear(): void {\n this.middlewaresMap.clear();\n }\n\n dispose(): void {\n //@ts-expect-error `null` not being assignable to Map.\n this.middlewaresMap = null;\n }\n}\n","import { deepClone } from '../../helpers';\nimport { ProviderModule, type ProviderModuleOptions } from '../provider-module';\nimport type { ModuleBlueprintOptions } from './interfaces';\n\nexport class ProviderModuleBlueprint {\n id!: ProviderModuleOptions['id'];\n imports?: ProviderModuleOptions['imports'];\n providers?: ProviderModuleOptions['providers'];\n exports?: ProviderModuleOptions['exports'];\n defaultScope?: ProviderModuleOptions['defaultScope'];\n isGlobal?: ProviderModuleOptions['isGlobal'];\n onReady?: ProviderModuleOptions['onReady'];\n onReset?: ProviderModuleOptions['onReset'];\n onDispose?: ProviderModuleOptions['onDispose'];\n\n private readonly blueprintOptions: ModuleBlueprintOptions;\n\n constructor(options: ProviderModuleOptions, blueprintOptions?: ModuleBlueprintOptions) {\n this.updateDefinition(options);\n\n this.blueprintOptions = {\n autoImportIntoAppModuleWhenGlobal: blueprintOptions?.autoImportIntoAppModuleWhenGlobal ?? true,\n };\n\n this.convertToModuleAndInjectIntoAppModuleIfGlobal();\n }\n\n /** Can be used to update the {@link ProviderModuleBlueprint | Blueprint} definition. */\n updateDefinition(options: ProviderModuleOptions): this {\n this.id = options.id;\n this.imports = options.imports;\n this.providers = options.providers;\n this.exports = options.exports;\n this.defaultScope = options.defaultScope;\n this.isGlobal = options.isGlobal;\n this.onReady = options.onReady;\n this.onReset = options.onReset;\n this.onDispose = options.onDispose;\n\n return this;\n }\n\n /** Returns the {@link ProviderModuleOptions} of this {@link ProviderModuleBlueprint | Blueprint}. */\n getDefinition(): ProviderModuleOptions {\n return {\n id: this.id,\n imports: this.imports,\n providers: this.providers,\n exports: this.exports,\n defaultScope: this.defaultScope,\n isGlobal: this.isGlobal,\n onReady: this.onReady,\n onReset: this.onReset,\n onDispose: this.onDispose,\n };\n }\n\n /**\n * Can be used to instantiate a _new_ `blueprint` with the same exact options as _this_ one.\n *\n * **Note:** _Everything is deep cloned, you can safely overwrite all the properties of the cloned instance._\n */\n clone(): ProviderModuleBlueprint {\n return new ProviderModuleBlueprint(deepClone(this.getDefinition()), { ...this.blueprintOptions });\n }\n\n private convertToModuleAndInjectIntoAppModuleIfGlobal(): void {\n if (!this.isGlobal || !this.blueprintOptions?.autoImportIntoAppModuleWhenGlobal) return;\n\n ProviderModule.APP_MODULE_REF.update.addImport(this);\n }\n}\n","import { DefinitionEventType } from '../../enums';\nimport {\n InjectionError,\n InjectionProviderModuleDisposedError,\n InjectionProviderModuleMissingIdentifierError,\n} from '../../errors';\nimport { ProviderModuleHelpers, ProviderTokenHelpers } from '../../helpers';\nimport type { ModuleDefinition, ModuleIdentifier, ProviderIdentifier, ProviderToken } from '../../types';\nimport { ModuleContainer } from '../container';\nimport { ImportedModuleContainer } from '../container/imported-module-container';\nimport { DynamicModuleDefinition, type IDynamicModuleDefinition } from '../dynamic-module-definition';\nimport { MiddlewaresManager, type IMiddlewaresManager } from '../middlewares-manager';\nimport { ProviderModuleBlueprint, type ModuleBlueprintOptions } from '../provider-module-blueprint';\nimport type {\n IProviderModule,\n OnCleanupOptions,\n ProviderModuleGetManyParam,\n ProviderModuleGetManyReturn,\n ProviderModuleGetReturn,\n ProviderModuleOptions,\n ProviderModuleOptionsInternal,\n} from './types';\n\nexport class ProviderModule implements IProviderModule {\n get id(): ModuleIdentifier {\n return this.options.id;\n }\n\n get definition(): ModuleDefinition<true> {\n this.throwIfDisposed();\n\n return this.dynamicModuleDef.moduleDef;\n }\n\n get update(): IDynamicModuleDefinition {\n this.throwIfDisposed();\n\n return this.dynamicModuleDef;\n }\n\n get middlewares(): IMiddlewaresManager {\n this.throwIfDisposed();\n\n return this.middlewaresManager;\n }\n\n get isDisposed(): boolean {\n return this.disposed;\n }\n\n get isAppModule(): boolean {\n return this.id === 'AppModule';\n }\n\n /**\n * Holds a reference to the `AppModule`.\n *\n * Static property needed in order to avoid introducing a _cirular dependency_ between\n * the `AppModule` instance and the `ProviderModule` class.\n */\n static readonly APP_MODULE_REF: IProviderModule;\n\n readonly appModuleRef: ProviderModule;\n readonly options: ProviderModuleOptions;\n readonly middlewaresManager: MiddlewaresManager;\n readonly dynamicModuleDef: DynamicModuleDefinition;\n readonly moduleContainer: ModuleContainer;\n readonly importedModuleContainers: Map<IProviderModule, ImportedModuleContainer> = new Map();\n\n private disposed = false;\n\n constructor({\n appModuleRef: appModule = ProviderModule.APP_MODULE_REF,\n inversify,\n ...publicOptions\n }: ProviderModuleOptionsInternal) {\n this.appModuleRef = appModule as ProviderModule;\n this.options = publicOptions;\n\n this.throwIfIdIsMissing();\n\n this.middlewaresManager = new MiddlewaresManager(this);\n this.moduleContainer = new ModuleContainer(this, inversify?.parentContainer);\n this.dynamicModuleDef = new DynamicModuleDefinition(this);\n\n if (!this.isAppModule && this.options.isGlobal) {\n this.appModuleRef.update.addImport(this, true);\n }\n\n this.options.onReady?.(this);\n }\n\n static create(optionsOrBlueprint: ProviderModuleOptions | ProviderModuleBlueprint): IProviderModule {\n const options = ProviderModuleHelpers.isBlueprint(optionsOrBlueprint)\n ? optionsOrBlueprint.getDefinition()\n : optionsOrBlueprint;\n\n if (options.id === 'AppModule') {\n throw new InjectionError(\n `The 'AppModule' id can't be used as it is already being used by the built-in 'AppModule'`\n );\n }\n\n return new ProviderModule(options as any);\n }\n\n static blueprint(\n moduleOptions: ProviderModuleOptions,\n blueprintOptions?: ModuleBlueprintOptions\n ): ProviderModuleBlueprint {\n return new ProviderModuleBlueprint(moduleOptions, blueprintOptions);\n }\n\n isImportingModule(idOrModule: ModuleIdentifier | IProviderModule): boolean {\n this.throwIfDisposed();\n\n if (ProviderModuleHelpers.isModule(idOrModule)) {\n return this.importedModuleContainers.has(idOrModule);\n }\n\n return this.importedModuleContainers.keys().some((m) => m.id === idOrModule);\n }\n\n hasProvider<T>(provider: ProviderToken<T>): boolean {\n this.throwIfDisposed();\n\n const providerIdentifier = ProviderTokenHelpers.toProviderIdentifier(provider);\n\n return this.moduleContainer.container.isBound(providerIdentifier);\n }\n\n get<T, IsOptional extends boolean | undefined = undefined, AsList extends boolean | undefined = undefined>(\n provider: ProviderToken<T>,\n isOptional?: IsOptional,\n asList?: AsList\n ): ProviderModuleGetReturn<T, IsOptional, AsList> {\n this.throwIfDisposed();\n\n const value = this.moduleContainer.get<T, IsOptional, AsList>(provider, isOptional, asList);\n\n this.dynamicModuleDef.emitEventSafely({\n type: DefinitionEventType.GetProvider,\n change: value,\n });\n\n return value;\n }\n\n getMany<D extends (ProviderModuleGetManyParam<any> | ProviderToken)[]>(\n ...deps: D | unknown[]\n ): ProviderModuleGetManyReturn<D> {\n this.throwIfDisposed();\n\n return this.moduleContainer.getMany<D>(...deps);\n }\n\n isExportingModule(idOrModule: ModuleIdentifier | IProviderModule): boolean {\n this.throwIfDisposed();\n\n if (!this.isImportingModule(idOrModule)) return false;\n\n if (ProviderModuleHelpers.isModule(idOrModule)) {\n return this.definition.exports.has(idOrModule);\n }\n\n // It means that we have to search by the `ModuleIdentifier` instead,\n // this may be slower, but most times should be negligible.\n\n return this.definition.exports.keys().some((x) => ProviderModuleHelpers.isModule(x) && x.id === idOrModule);\n }\n\n isExportingProvider(tokenOrIdentifier: ProviderToken | ProviderIdentifier): boolean {\n this.throwIfDisposed();\n\n let found = this.definition.exports.has(tokenOrIdentifier);\n\n if (!found && ProviderTokenHelpers.isProviderIdentifier(tokenOrIdentifier)) {\n // It means that we have to search by the `ProviderIdentifier` instead,\n // this may be slower, but most times should be negligible.\n\n found = this.definition.exports\n .keys()\n .some(\n (x) =>\n !ProviderModuleHelpers.isModuleOrBlueprint(x) &&\n ProviderTokenHelpers.toProviderIdentifier(x) === tokenOrIdentifier\n );\n }\n\n return found;\n }\n\n async reset(shouldInvokeCb = true): Promise<void> {\n this.throwIfDisposed();\n\n let before: OnCleanupOptions['before'];\n let after: OnCleanupOptions['after'];\n\n if (shouldInvokeCb) {\n const cbs = (this.options.onReset?.() ?? {}) as OnCleanupOptions;\n\n before = cbs.before;\n after = cbs.after;\n\n await before?.(this);\n }\n\n this.middlewaresManager.clear();\n this.moduleContainer.container.unbindAll();\n this.definition.imports.clear();\n this.definition.providers.clear();\n this.definition.exports.clear();\n this.importedModuleContainers.clear();\n\n if (shouldInvokeCb) {\n await after?.();\n }\n }\n\n async dispose(): Promise<void> {\n this.throwIfDisposed();\n\n const { before, after } = this.options.onDispose?.() ?? {};\n await before?.(this);\n\n await this.reset(false);\n\n this.middlewaresManager.dispose();\n this.dynamicModuleDef.dispose();\n /* istanbul ignore next */\n this.importedModuleContainers.forEach((x) => x.dispose());\n this.moduleContainer.dispose();\n\n //@ts-expect-error Read-only property.\n this.options = {\n // We leave only the `id` as it is needed\n // to correctly show it when the `InjectionProviderModuleDisposedError` is thrown.\n id: this.options.id,\n };\n //@ts-expect-error Read-only property.\n this.dynamicModuleDef = null;\n //@ts-expect-error Read-only property.\n this.importedModuleContainers = null;\n //@ts-expect-error Read-only property.\n this.moduleContainer = null;\n\n this.disposed = true;\n\n await after?.();\n }\n\n toString(): string {\n return this.id.toString();\n }\n\n private throwIfIdIsMissing(): void {\n if (!this.options.id || this.options.id.toString().trim().length === 0) {\n throw new InjectionProviderModuleMissingIdentifierError(this);\n }\n }\n\n private throwIfDisposed(): void {\n if (!this.isDisposed) return;\n\n throw new InjectionProviderModuleDisposedError(this);\n }\n}\n","import { ProviderModule, type IProviderModule } from '../core/provider-module';\r\nimport { ProviderModuleBlueprint } from '../core/provider-module-blueprint/provider-module-blueprint';\r\n\r\nexport namespace ProviderModuleHelpers {\r\n export function isModule(value: any): value is IProviderModule {\r\n return value instanceof ProviderModule;\r\n }\r\n\r\n export function isBlueprint(value: any): value is ProviderModuleBlueprint {\r\n return value instanceof ProviderModuleBlueprint;\r\n }\r\n\r\n export function isModuleOrBlueprint(value: any): value is IProviderModule | ProviderModuleBlueprint {\r\n return isModule(value) || isBlueprint(value);\r\n }\r\n\r\n export function tryBlueprintToModule(value: IProviderModule | ProviderModuleBlueprint): IProviderModule {\r\n if (!(value instanceof ProviderModuleBlueprint)) return value;\r\n\r\n return blueprintToModule(value);\r\n }\r\n\r\n export function blueprintToModule(moduleBlueprint: ProviderModuleBlueprint): IProviderModule {\r\n return ProviderModule.create(moduleBlueprint.getDefinition());\r\n }\r\n}\r\n","export function isFunction(v: any): boolean {\n if (typeof v !== 'function') return false;\n\n return !Function.prototype.toString.call(v).startsWith('class ');\n}\n","export function deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== 'object') return obj;\n\n if (typeof obj === 'function') {\n // Create a new function that calls the original function\n // This ensures the cloned function is a different reference\n return ((...args: any[]) => (obj as any)(...args)) as any;\n }\n\n if (Array.isArray(obj)) return obj.map((item) => deepClone(item)) as T;\n\n const clonedObj: any = {};\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n clonedObj[key] = deepClone((obj as any)[key]);\n }\n }\n\n return clonedObj;\n}\n","import { inject as _inject } from 'inversify';\n\nimport { ProviderTokenHelpers } from '../helpers';\nimport type { ProviderToken } from '../types';\n\n/** See {@link https://inversify.io/docs/api/decorator/#inject} for more details. */\nexport function Inject(provider: ProviderToken) {\n return _inject(ProviderTokenHelpers.toProviderIdentifier(provider));\n}\n","import { multiInject as _multiInject } from 'inversify';\n\nimport { ProviderTokenHelpers } from '../helpers';\nimport type { ProviderToken } from '../types';\n\n/** See {@link https://inversify.io/docs/api/decorator/#multiinject} for more details. */\nexport function MultiInject(provider: ProviderToken) {\n return _multiInject(ProviderTokenHelpers.toProviderIdentifier(provider));\n}\n","import { injectFromBase as _injectFromBase } from 'inversify';\n\n/** See {@link https://inversify.io/docs/api/decorator/#injectfrombase} for more details. */\nexport function InjectFromBase(options?: Parameters<typeof _injectFromBase>[0]) {\n return _injectFromBase(options);\n}\n","import { named as _named, type MetadataName } from 'inversify';\n\n/** See {@link https://inversify.io/docs/api/decorator/#named} for more details. */\nexport function Named(name: MetadataName) {\n return _named(name);\n}\n","import { optional as _optional } from 'inversify';\n\n/** See {@link https://inversify.io/docs/api/decorator/#optional} for more details. */\nexport function Optional() {\n return _optional();\n}\n","import { tagged as _tagged, type MetadataTag } from 'inversify';\n\n/** See {@link https://inversify.io/docs/api/decorator/#tagged} for more details. */\nexport function Tagged(key: MetadataTag, value: unknown) {\n return _tagged(key, value);\n}\n","import { unmanaged as _unmanaged } from 'inversify';\n\n/** See {@link https://inversify.io/docs/api/decorator/#unmanaged} for more details. */\nexport function Unmanaged() {\n return _unmanaged();\n}\n","import type { IProviderModule } from '../provider-module';\nimport { ProviderModule } from '../provider-module/provider-module';\n\n/**\n * The `root` {@link IProviderModule} of your application.\n *\n * All global modules are imported into the {@link AppModule} and all your custom\n * modules inherit from it.\n */\nexport const AppModule = new ProviderModule({\n id: 'AppModule',\n}) as IProviderModule;\n\n//@ts-expect-error Read-only property.\n// This is done to avoid a circular dependency between\n// the `ProviderModule` class and the `AppModule` instance.\nProviderModule.APP_MODULE_REF = AppModule;\n"],"mappings":";;;;AAAA,SAASA,cAAcC,mBAAmB;;;ACAnC,IAAKC,iBAAAA,yBAAAA,iBAAAA;AACqE,EAAAA,gBAAAA,gBAAA,WAAA,IAAA,CAAA,IAAA;AAGA,EAAAA,gBAAAA,gBAAA,WAAA,IAAA,CAAA,IAAA;AAG2B,EAAAA,gBAAAA,gBAAA,SAAA,IAAA,CAAA,IAAA;SAPhGA;;;;ACAL,IAAKC,iBAAAA,yBAAAA,iBAAAA;AAQT,EAAAA,gBAAAA,gBAAA,iBAAA,IAAA,CAAA,IAAA;AAUA,EAAAA,gBAAAA,gBAAA,mBAAA,IAAA,CAAA,IAAA;AAOA,EAAAA,gBAAAA,gBAAA,WAAA,IAAA,CAAA,IAAA;AAQA,EAAAA,gBAAAA,gBAAA,oBAAA,IAAA,CAAA,IAAA;AAQA,EAAAA,gBAAAA,gBAAA,sBAAA,IAAA,CAAA,IAAA;AAQA,EAAAA,gBAAAA,gBAAA,oBAAA,IAAA,CAAA,IAAA;AASA,EAAAA,gBAAAA,gBAAA,gBAAA,IAAA,CAAA,IAAA;SA1DSA;;;;ACAL,IAAKC,sBAAAA,yBAAAA,sBAAAA;AACa,EAAAA,qBAAAA,qBAAA,MAAA,IAAA,CAAA,IAAA;AAOtB,EAAAA,qBAAAA,qBAAA,QAAA,IAAA,CAAA,IAAA;AAOA,EAAAA,qBAAAA,qBAAA,UAAA,IAAA,CAAA,IAAA;AAOA,EAAAA,qBAAAA,qBAAA,aAAA,IAAA,CAAA,IAAA;AAOA,EAAAA,qBAAAA,qBAAA,QAAA,IAAA,CAAA,IAA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AACtC,SAAOC,OAAOD,IAAAA;AAChB;AAFgBD;;;ACHhB,SAASG,YAAYC,iBAAiB;AAG/B,SAASC,WAAAA;AACd,SAAOC,UAAAA;AACT;AAFgBD;;;ACHhB,SAASE,UAAUC,eAAiC;AAG7C,SAASC,OAAOC,KAAkBC,OAAc;AACrD,SAAOC,QAAQF,KAAKC,KAAAA;AACtB;AAFgBF;;;ACHhB,SAASI,aAAaC,kBAAkB;AAGjC,SAASC,YAAAA;AACd,SAAOC,WAAAA;AACT;AAFgBD;;;ACMT,IAAME,YAAY,IAAIC,eAAe;EAC1CC,IAAI;AACN,CAAA;AAKAD,eAAeE,iBAAiBH;","names":["injectable","_injectable","InjectionScope","MiddlewareType","DefinitionEventType","injectionScopeToBindingScope","injectionScope","InjectionScope","Singleton","Transient","Request","bindingScopeToInjectionScope","bindingScope","getClassMetadata","isClass","v","Function","prototype","toString","call","startsWith","isClassOrFunction","value","isObject","o","Object","prototype","toString","call","isPlainObject","ctor","undefined","prot","hasOwnProperty","ProviderTokenHelpers","isClassToken","provider","hasProvideProperty","isValueToken","isFactoryToken","isProviderIdentifier","value","isClassOrFunction","toProviderIdentifier","provide","toProviderIdentifiers","providers","map","providerIdentifierToString","providerIdentifier","toString","name","providerTokenToString","providerToken","providerTokensAreEqual","p0","p1","id0","id1","useClass","useValue","useFactory","getInjectionScopeByPriority","moduleDefaultScope","tryGetScopeFromProvider","tryGetDecoratorScopeFromClass","tryGetProviderOptions","providerOptions","scope","providerClass","isClass","inversifyScope","getClassMetadata","bindingScopeToInjectionScope","isPlainObject","InjectionError","Error","name","InjectionProviderModuleError","Error","name","module","message","moduleId","toString","InjectionProviderModuleUnknownProviderError","InjectionProviderModuleError","name","module","providerToken","ProviderTokenHelpers","providerTokenToString","InjectionProviderModuleDisposedError","InjectionProviderModuleError","name","module","InjectionProviderModuleMissingIdentifierError","InjectionProviderModuleError","name","module","InjectionProviderModuleMissingProviderError","InjectionProviderModuleError","name","module","providerToken","ProviderTokenHelpers","providerTokenToString","Container","Container","AppModuleInversifyContainer","defaultScope","ModuleContainer","container","providerModule","inversifyParentContainer","defaultScope","InjectionScope","Singleton","options","id","AppModuleInversifyContainer","Container","parent","appModuleRef","moduleContainer","injectionScopeToBindingScope","providers","forEach","x","bindToContainer","get","provider","isOptional","asList","middlewareResult","middlewaresManager","applyMiddlewares","MiddlewareType","BeforeGet","getProvider","bind","undefined","InjectionProviderModuleMissingProviderError","getMany","deps","map","dep","withOptions","isPlainObject","providerIdentifier","ProviderTokenHelpers","toProviderIdentifier","binders","providerTypeMatches","isProviderIdentifier","toSelf","isClassToken","to","useClass","isValueToken","toConstantValue","useValue","isFactoryToken","toResolvedValue","p","dependencies","inject","useFactory","find","InjectionProviderModuleUnknownProviderError","binding","setBindingScope","opts","when","injectionScope","getInjectionScopeByPriority","inSingletonScope","Transient","inTransientScope","Request","inRequestScope","dispose","getAll","optional","ContainerModule","ImportedModuleContainer","moduleDef","providerModule","dynamicModuleDef","importedIntoModule","proxyContainer","proxyContainerOptions","buildProxyContainer","dispose","moduleContainer","container","unloadSync","ContainerModule","options","traverseExportGraph","providerToken","foundInModule","proxyProviderIdentifier","exports","event$","subscribe","type","change","DefinitionEventType","Export","ExportRemoved","changeIsProvider","ProviderModuleHelpers","isModule","unproxyProviderIdentifier","changedModule","loadSync","fromModule","providerIdentifier","ProviderTokenHelpers","toProviderIdentifier","isBound","bind","toDynamicValue","middlewareResult","middlewaresManager","applyMiddlewares","MiddlewareType","OnExportAccess","unbind","undefined","get","setBindingScope","cb","currentExportsNode","discoveredExportedModules","exportedModuleOrProvider","ProviderModule","push","exportedModule","Signal","value","subscribers","Set","initialValue","emit","newValue","forEach","cb","get","subscribe","callback","invokeImmediately","add","delete","dispose","DynamicModuleDefinition","moduleContainer","providerModule","subscribe","event$","InjectionProviderModuleDisposedError","bind","moduleDef","Signal","type","DefinitionEventType","Noop","change","emittingModules","Set","importedModuleSubscriptions","Map","imports","providers","exports","buildInitialDefinition","options","addImport","moduleOrBlueprint","addToExports","ProviderModuleHelpers","tryBlueprintToModule","middlewareResult","middlewaresManager","applyMiddlewares","MiddlewareType","BeforeAddImport","add","createImportedModuleContainer","subscribeToImportedModuleEvents","emitEventSafely","Export","Import","ExportModule","addImportLazy","lazyCb","addProvider","provider","BeforeAddProvider","bindToContainer","Provider","ExportProvider","addProviderLazy","removeImport","module","has","BeforeRemoveImport","unsubscribeFromImportedModuleEvents","importedModuleContainer","importedModuleContainers","get","dispose","delete","ImportRemoved","removeFromExports","removeProvider","BeforeRemoveProvider","container","unbindSync","ProviderTokenHelpers","toProviderIdentifier","ProviderRemoved","exportDefinition","BeforeRemoveExport","ExportRemoved","isModule","ExportModuleRemoved","ExportProviderRemoved","event","emit","forEach","x","isModuleOrBlueprint","imp","isGlobal","importedModule","isPartOfTheExportsList","some","id","isAppModule","InjectionProviderModuleError","set","ImportedModuleContainer","subscription","dynamicModuleDef","unsubscribe","MiddlewaresManager","middlewaresMap","Map","providerModule","add","type","cb","currentMiddlewares","get","push","set","applyMiddlewares","args","InjectionProviderModuleDisposedError","middlewares","MiddlewareType","BeforeAddImport","BeforeAddProvider","chainedArg","middleware","result","BeforeGet","reduce","arg","BeforeRemoveImport","BeforeRemoveProvider","BeforeRemoveExport","OnExportAccess","some","clear","dispose","ProviderModuleBlueprint","id","imports","providers","exports","defaultScope","isGlobal","onReady","onReset","onDispose","blueprintOptions","options","updateDefinition","autoImportIntoAppModuleWhenGlobal","convertToModuleAndInjectIntoAppModuleIfGlobal","getDefinition","clone","deepClone","ProviderModule","APP_MODULE_REF","update","addImport","ProviderModule","id","options","definition","throwIfDisposed","dynamicModuleDef","moduleDef","update","middlewares","middlewaresManager","isDisposed","disposed","isAppModule","APP_MODULE_REF","appModuleRef","moduleContainer","importedModuleContainers","Map","appModule","inversify","publicOptions","throwIfIdIsMissing","MiddlewaresManager","ModuleContainer","parentContainer","DynamicModuleDefinition","isGlobal","addImport","onReady","create","optionsOrBlueprint","ProviderModuleHelpers","isBlueprint","getDefinition","InjectionError","blueprint","moduleOptions","blueprintOptions","ProviderModuleBlueprint","isImportingModule","idOrModule","isModule","has","keys","some","m","hasProvider","provider","providerIdentifier","ProviderTokenHelpers","toProviderIdentifier","container","isBound","get","isOptional","asList","value","emitEventSafely","type","DefinitionEventType","GetProvider","change","getMany","deps","isExportingModule","exports","x","isExportingProvider","tokenOrIdentifier","found","isProviderIdentifier","isModuleOrBlueprint","reset","shouldInvokeCb","before","after","cbs","onReset","clear","unbindAll","imports","providers","dispose","onDispose","forEach","toString","trim","length","InjectionProviderModuleMissingIdentifierError","InjectionProviderModuleDisposedError","ProviderModuleHelpers","isModule","value","ProviderModule","isBlueprint","ProviderModuleBlueprint","isModuleOrBlueprint","tryBlueprintToModule","blueprintToModule","moduleBlueprint","create","getDefinition","isFunction","v","Function","prototype","toString","call","startsWith","deepClone","obj","args","Array","isArray","map","item","clonedObj","key","Object","prototype","hasOwnProperty","call","Injectable","scope","undefined","_injectable","injectionScopeToBindingScope","inject","_inject","Inject","provider","_inject","ProviderTokenHelpers","toProviderIdentifier","multiInject","_multiInject","MultiInject","provider","_multiInject","ProviderTokenHelpers","toProviderIdentifier","injectFromBase","_injectFromBase","InjectFromBase","options","_injectFromBase","named","_named","Named","name","_named","optional","_optional","Optional","_optional","tagged","_tagged","Tagged","key","value","_tagged","unmanaged","_unmanaged","Unmanaged","_unmanaged","AppModule","ProviderModule","id","APP_MODULE_REF"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adimm/x-injection",
3
3
  "description": "Powerful IoC library built on-top of InversifyJS inspired by NestJS's DI.",
4
- "version": "2.0.3",
4
+ "version": "2.0.4",
5
5
  "author": "Adi-Marian Mutu",
6
6
  "homepage": "https://github.com/AdiMarianMutu/x-injection#readme",
7
7
  "bugs": "https://github.com/AdiMarianMutu/x-injection/issues",
@@ -39,21 +39,21 @@
39
39
  "reflect-metadata": "^0.2.2"
40
40
  },
41
41
  "devDependencies": {
42
- "@ianvs/prettier-plugin-sort-imports": "^4.4.1",
42
+ "@ianvs/prettier-plugin-sort-imports": "^4.4.2",
43
43
  "@swc/core": "^1.11.24",
44
- "@tsconfig/node18": "^18.2.4",
45
- "@types/jest": "^29.5.14",
46
- "@typescript-eslint/eslint-plugin": "^6.21.0",
47
44
  "eslint": "^8.57.1",
48
- "eslint-config-prettier": "^9.1.0",
45
+ "@tsconfig/node22": "^22.0.2",
46
+ "@types/jest": "^30.0.0",
47
+ "@typescript-eslint/eslint-plugin": "^8.34.1",
48
+ "eslint-config-prettier": "^10.1.5",
49
49
  "eslint-plugin-import": "^2.31.0",
50
50
  "eslint-plugin-prettier": "^5.3.1",
51
51
  "http-server": "^14.1.1",
52
52
  "husky": "^9.1.7",
53
- "jest": "^29.7.0",
53
+ "jest": "^30.0.0",
54
54
  "node-notifier": "^10.0.1",
55
- "prettier": "3.2.4",
56
- "rimraf": "^5.0.10",
55
+ "prettier": "^3.5.3",
56
+ "rimraf": "^6.0.1",
57
57
  "terser": "^5.39.0",
58
58
  "ts-jest": "^29.3.2",
59
59
  "ts-node": "^10.9.2",