@adimm/x-injection 2.1.0 → 2.1.2

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
@@ -1,8 +1,8 @@
1
- <h1 align="center">
2
- xInjection&nbsp;<a href="https://www.npmjs.com/package/@adimm/x-injection" target="__blank"><img src="https://badgen.net/npm/v/@adimm/x-injection"></a>
1
+ <p align="center">
2
+ <img width="260px" height="auto" alt="xInjection Logo" src="https://raw.githubusercontent.com/AdiMarianMutu/x-injection/main/assets/logo.png"><br /><a href="https://www.npmjs.com/package/@adimm/x-injection" target="__blank"><img src="https://badgen.net/npm/v/@adimm/x-injection"></a>
3
3
  <a href="https://app.codecov.io/gh/AdiMarianMutu/x-injection" target="__blank"><img src="https://badgen.net/codecov/c/github/AdiMarianMutu/x-injection"></a>
4
4
  <img src="https://badgen.net/npm/license/@adimm/x-injection">
5
- </h1>
5
+ </p>
6
6
 
7
7
  <p align="center">
8
8
  <a href="https://github.com/AdiMarianMutu/x-injection/actions/workflows/ci.yml?query=branch%3Amain" target="__blank"><img src="https://github.com/AdiMarianMutu/x-injection/actions/workflows/ci.yml/badge.svg?branch=main"></a>
@@ -10,6 +10,7 @@ xInjection&nbsp;<a href="https://www.npmjs.com/package/@adimm/x-injection" targe
10
10
  <br>
11
11
  <img src="https://badgen.net/bundlephobia/minzip/@adimm/x-injection">
12
12
  <a href="https://www.npmjs.com/package/@adimm/x-injection" target="__blank"><img src="https://badgen.net/npm/dm/@adimm/x-injection"></a>
13
+
13
14
  </p>
14
15
 
15
16
  ## Table of Contents
@@ -850,6 +851,7 @@ Please ensure your contributions adhere to the project's code style. See the rep
850
851
 
851
852
  - [Adi-Marian Mutu](https://www.linkedin.com/in/mutu-adi-marian/) - Author of `xInjection`
852
853
  - [InversifyJS](https://github.com/inversify/monorepo) - Base lib
854
+ - [Alexandru Turica](https://www.linkedin.com/in/alexandru-turica-82215522b/) - Official Logo
853
855
 
854
856
  ---
855
857
 
package/dist/index.cjs CHANGED
@@ -819,4 +819,4 @@ var Z = new G({
819
819
  id: "AppModule"
820
820
  });
821
821
 
822
- G.APP_MODULE_REF = Z;//# sourceMappingURL=index.cjs.map
822
+ G.APP_MODULE_REF = Z;
package/dist/index.js CHANGED
@@ -786,4 +786,4 @@ var K = new B({
786
786
 
787
787
  B.APP_MODULE_REF = K;
788
788
 
789
- export { K as AppModule, s as DefinitionEventType, F as Inject, q as InjectFromBase, j as Injectable, f as InjectionError, M as InjectionProviderModuleDisposedError, m as InjectionProviderModuleError, y as InjectionProviderModuleMissingIdentifierError, g as InjectionProviderModuleMissingProviderError, v as InjectionProviderModuleUnknownProviderError, r as InjectionScope, n as MiddlewareType, $ as MultiInject, L as Named, W as Optional, B as ProviderModule, T as ProviderModuleBlueprint, E as ProviderModuleHelpers, o as ProviderTokenHelpers, z as Tagged, J as Unmanaged, p as bindingScopeToInjectionScope, O as deepClone, d as injectionScopeToBindingScope, a as isClass, l as isClassOrFunction, A as isFunction, h as isPlainObject };//# sourceMappingURL=index.js.map
789
+ export { K as AppModule, s as DefinitionEventType, F as Inject, q as InjectFromBase, j as Injectable, f as InjectionError, M as InjectionProviderModuleDisposedError, m as InjectionProviderModuleError, y as InjectionProviderModuleMissingIdentifierError, g as InjectionProviderModuleMissingProviderError, v as InjectionProviderModuleUnknownProviderError, r as InjectionScope, n as MiddlewareType, $ as MultiInject, L as Named, W as Optional, B as ProviderModule, T as ProviderModuleBlueprint, E as ProviderModuleHelpers, o as ProviderTokenHelpers, z as Tagged, J as Unmanaged, p as bindingScopeToInjectionScope, O as deepClone, d as injectionScopeToBindingScope, a as isClass, l as isClassOrFunction, A as isFunction, h as isPlainObject };
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.1.0",
4
+ "version": "2.1.2",
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",
@@ -1 +0,0 @@
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 ModuleOrBlueprint,\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 /* istanbul ignore else */\n // Ignoring the `else if` branch because it is actually covered by the `changeIsProvider && DefinitionEventType.ExportRemoved` which\n // would basically translate to `DefinitionEventType.ExportProviderRemoved`\n // but istanbul can't see that.\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 ModuleIdentifier,\n ModuleOrBlueprint,\n ProviderIdentifier,\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(moduleOrId: IProviderModule | ModuleIdentifier): boolean {\n const module = (\n ProviderModuleHelpers.isModule(moduleOrId) ? moduleOrId : this.getImportedModuleById(moduleOrId)\n ) as ProviderModule | undefined;\n if (!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);\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>(providerOrIdentifier: DependencyProvider<T> | ProviderIdentifier<T>): boolean {\n const provider = !ProviderTokenHelpers.isProviderIdentifier(providerOrIdentifier)\n ? providerOrIdentifier\n : this.getProviderByIdentifier(providerOrIdentifier);\n if (!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 getImportedModuleById(id: ModuleIdentifier): ProviderModule | undefined {\n return this.moduleDef.imports.values().find((x) => x.id === id) as ProviderModule;\n }\n\n getProviderByIdentifier<T>(identifier: ProviderIdentifier<T>): DependencyProvider<T> | undefined {\n return this.moduleDef.providers.values().find((x) => ProviderTokenHelpers.toProviderIdentifier(x) === identifier);\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,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,IAAA;AAOA,EAAAA,qBAAAA,qBAAA,cAAA,IAAA,CAAA,IAA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AQC,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","moduleOrId","module","isModule","getImportedModuleById","BeforeRemoveImport","unsubscribeFromImportedModuleEvents","importedModuleContainer","importedModuleContainers","get","dispose","delete","ImportRemoved","removeFromExports","removeProvider","providerOrIdentifier","ProviderTokenHelpers","isProviderIdentifier","getProviderByIdentifier","BeforeRemoveProvider","container","unbindSync","toProviderIdentifier","ProviderRemoved","exportDefinition","has","BeforeRemoveExport","ExportRemoved","ExportModuleRemoved","ExportProviderRemoved","id","values","find","x","identifier","event","emit","forEach","isModuleOrBlueprint","imp","isGlobal","importedModule","isPartOfTheExportsList","some","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 DELETED
@@ -1 +0,0 @@
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 /* istanbul ignore else */\n // Ignoring the `else if` branch because it is actually covered by the `changeIsProvider && DefinitionEventType.ExportRemoved` which\n // would basically translate to `DefinitionEventType.ExportProviderRemoved`\n // but istanbul can't see that.\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 ModuleIdentifier,\n ModuleOrBlueprint,\n ProviderIdentifier,\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(moduleOrId: IProviderModule | ModuleIdentifier): boolean {\n const module = (\n ProviderModuleHelpers.isModule(moduleOrId) ? moduleOrId : this.getImportedModuleById(moduleOrId)\n ) as ProviderModule | undefined;\n if (!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);\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>(providerOrIdentifier: DependencyProvider<T> | ProviderIdentifier<T>): boolean {\n const provider = !ProviderTokenHelpers.isProviderIdentifier(providerOrIdentifier)\n ? providerOrIdentifier\n : this.getProviderByIdentifier(providerOrIdentifier);\n if (!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 getImportedModuleById(id: ModuleIdentifier): ProviderModule | undefined {\n return this.moduleDef.imports.values().find((x) => x.id === id) as ProviderModule;\n }\n\n getProviderByIdentifier<T>(identifier: ProviderIdentifier<T>): DependencyProvider<T> | undefined {\n return this.moduleDef.providers.values().find((x) => ProviderTokenHelpers.toProviderIdentifier(x) === identifier);\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,EA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,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","moduleOrId","module","isModule","getImportedModuleById","BeforeRemoveImport","unsubscribeFromImportedModuleEvents","importedModuleContainer","importedModuleContainers","get","dispose","delete","ImportRemoved","removeFromExports","removeProvider","providerOrIdentifier","ProviderTokenHelpers","isProviderIdentifier","getProviderByIdentifier","BeforeRemoveProvider","container","unbindSync","toProviderIdentifier","ProviderRemoved","exportDefinition","has","BeforeRemoveExport","ExportRemoved","ExportModuleRemoved","ExportProviderRemoved","id","values","find","x","identifier","event","emit","forEach","isModuleOrBlueprint","imp","isGlobal","importedModule","isPartOfTheExportsList","some","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"]}