@tsed/di 8.9.3 → 8.9.5
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/lib/browser/di.umd.min.js.map +1 -1
- package/lib/esm/common/decorators/controller.js +3 -1
- package/lib/esm/common/decorators/controller.js.map +1 -1
- package/package.json +10 -10
- package/readme.md +261 -80
- package/src/common/decorators/controller.ts +1 -0
- package/src/common/decorators/lazyInject.spec.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"di.umd.min.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,cAAeA,QAAQ,eAAgBA,QAAQ,iBACvD,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,aAAc,cAAe,gBAAiBJ,GAC5B,iBAAZC,QACdA,QAAQ,YAAcD,EAAQG,QAAQ,cAAeA,QAAQ,eAAgBA,QAAQ,iBAErFJ,EAAK,YAAcC,EAAQD,EAAK,cAAeA,EAAK,eAAgBA,EAAK,gBAC1E,CATD,CASGO,MAAM,CAACC,EAAkCC,EAAkCC,I,kCCT9EP,EAAOD,QAAUM,C,UCAjBL,EAAOD,QAAUO,C,UCAjBN,EAAOD,QAAUQ,C,GCCbC,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaZ,QAGrB,IAAIC,EAASQ,EAAyBE,GAAY,CAGjDX,QAAS,CAAC,GAOX,OAHAc,EAAoBH,GAAUV,EAAQA,EAAOD,QAASU,GAG/CT,EAAOD,OACf,CCrBAU,EAAoBK,EAAI,CAACf,EAASgB,KACjC,IAAI,IAAIC,KAAOD,EACXN,EAAoBQ,EAAEF,EAAYC,KAASP,EAAoBQ,EAAElB,EAASiB,IAC5EE,OAAOC,eAAepB,EAASiB,EAAK,CAAEI,YAAY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oU,GAAUlR,EAAQlD,EAAaiR,EAAYjP,EAEtD,CCpCO,SAASsS,GAAerD,EAAoBjP,GACjD,OAAO/D,OAAOkT,OAAO,CACnB,SAAItS,GACF,OAAO8N,IAAWxI,SAAS/F,IAAI6S,EAAYjP,EAC7C,EACA,SAAInD,CAAMA,GACR8N,IAAWxI,SAAS3C,IAAIyP,EAAYpS,EACtC,GAEJ,EdhCA,SAAYwS,GACV,kBACA,sBACA,sBACA,gBACA,2BACD,CAND,CAAYA,KAAAA,GAAsB,KeI3B,MAAMkD,GAAS5V,OAAO8I,IAAI,UCF1B,SAAS+M,GAAWC,EAAU,CAAC,EAAGC,EAAU,CAAC,GAClD,OAAOzW,OAAOiJ,QAAQwN,GAAI3U,QAAO,CAAC4U,GAAQ5W,EAAK6W,MACtC,IACFD,EACH,CAAC5W,IAAO4W,EAAM5W,IAAQ,IAAI2G,OAAOkQ,MAElCH,EACL,CAEO,SAASI,GAAiB9X,EAAmB6E,EAAqB,CAAC,GACxE,MAAMN,EAAQ,EAAAR,MAAMC,KAAKhE,GAAQqB,IAAI,kBAAoB,CAAC,EAE1D,MAAO,IACFkD,KACAM,EACH+S,MAAOH,GAAWlT,EAAMqT,MAAO/S,EAAc+S,OAEjD,C,ODZA3G,EAAWuG,IAAQ1X,SAAQ,IAAM8P,IAAW5E,S","sources":["webpack://@tsed/di/webpack/universalModuleDefinition","webpack://@tsed/di/external umd \"@tsed/core\"","webpack://@tsed/di/external umd \"@tsed/hooks\"","webpack://@tsed/di/external umd \"@tsed/schema\"","webpack://@tsed/di/webpack/bootstrap","webpack://@tsed/di/webpack/runtime/define property getters","webpack://@tsed/di/webpack/runtime/hasOwnProperty shorthand","webpack://@tsed/di/webpack/runtime/make namespace object","webpack://@tsed/di/./src/common/constants/constants.ts","webpack://@tsed/di/./src/common/domain/ProviderScope.ts","webpack://@tsed/di/./src/common/domain/ProviderType.ts","webpack://@tsed/di/./src/common/domain/LocalsContainer.ts","webpack://@tsed/di/./src/common/utils/discoverHooks.ts","webpack://@tsed/di/./src/common/domain/Provider.ts","webpack://@tsed/di/./src/common/registries/GlobalProviders.ts","webpack://@tsed/di/./src/common/domain/Container.ts","webpack://@tsed/di/./src/common/utils/colors.ts","webpack://@tsed/di/./src/common/errors/InjectionError.ts","webpack://@tsed/di/./src/common/utils/createContainer.ts","webpack://@tsed/di/./src/common/utils/getConstructorDependencies.ts","webpack://@tsed/di/./src/common/services/DIConfiguration.ts","webpack://@tsed/di/./src/common/services/InjectorService.ts","webpack://@tsed/di/./src/common/fn/injector.ts","webpack://@tsed/di/./src/common/decorators/autoInjectable.ts","webpack://@tsed/di/./src/common/fn/configuration.ts","webpack://@tsed/di/./src/common/domain/ControllerProvider.ts","webpack://@tsed/di/./src/common/registries/ProviderRegistry.ts","webpack://@tsed/di/./src/common/utils/providerBuilder.ts","webpack://@tsed/di/./src/common/fn/injectable.ts","webpack://@tsed/di/./src/common/errors/InvalidPropertyTokenError.ts","webpack://@tsed/di/./src/common/fn/localsContainer.ts","webpack://@tsed/di/./src/common/fn/inject.ts","webpack://@tsed/di/./src/common/fn/injectMany.ts","webpack://@tsed/di/./src/common/decorators/inject.ts","webpack://@tsed/di/./src/common/decorators/configuration.ts","webpack://@tsed/di/./src/common/fn/constant.ts","webpack://@tsed/di/./src/common/decorators/constant.ts","webpack://@tsed/di/./src/common/domain/InjectablePropertyType.ts","webpack://@tsed/di/./src/common/decorators/controller.ts","webpack://@tsed/di/./src/common/decorators/injectable.ts","webpack://@tsed/di/./src/common/decorators/intercept.ts","webpack://@tsed/di/./src/common/decorators/interceptor.ts","webpack://@tsed/di/./src/common/fn/lazyInject.ts","webpack://@tsed/di/./src/common/decorators/lazyInject.ts","webpack://@tsed/di/./src/common/decorators/module.ts","webpack://@tsed/di/./src/common/decorators/scope.ts","webpack://@tsed/di/./src/common/decorators/opts.ts","webpack://@tsed/di/./src/common/decorators/overrideProvider.ts","webpack://@tsed/di/./src/common/decorators/service.ts","webpack://@tsed/di/./src/common/decorators/useOpts.ts","webpack://@tsed/di/./src/common/decorators/value.ts","webpack://@tsed/di/./src/common/fn/refValue.ts","webpack://@tsed/di/./src/common/services/DILogger.ts","webpack://@tsed/di/./src/common/utils/getConfiguration.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@tsed/core\"), require(\"@tsed/hooks\"), require(\"@tsed/schema\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"@tsed/core\", \"@tsed/hooks\", \"@tsed/schema\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@tsed/di\"] = factory(require(\"@tsed/core\"), require(\"@tsed/hooks\"), require(\"@tsed/schema\"));\n\telse\n\t\troot[\"@tsed/di\"] = factory(root[\"@tsed/core\"], root[\"@tsed/hooks\"], root[\"@tsed/schema\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__414__, __WEBPACK_EXTERNAL_MODULE__171__, __WEBPACK_EXTERNAL_MODULE__538__) => {\nreturn ","module.exports = __WEBPACK_EXTERNAL_MODULE__414__;","module.exports = __WEBPACK_EXTERNAL_MODULE__171__;","module.exports = __WEBPACK_EXTERNAL_MODULE__538__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export const DI_INVOKE_OPTIONS = Symbol(\"DI_INVOKE_OPTIONS\");\nexport const DI_INJECTABLE_PROPS = Symbol(\"DI_INJECTABLE_PROPS\");\nexport const DI_USE_OPTIONS = \"DI_USE_OPTIONS\";\nexport const DI_USE_PARAM_OPTIONS = \"DI_USE_PARAM_OPTIONS\";\nexport const DI_INTERCEPTOR_OPTIONS = \"DI_INTERCEPTOR_OPTIONS\";\n","export enum ProviderScope {\n SINGLETON = \"singleton\",\n REQUEST = \"request\",\n INSTANCE = \"instance\"\n}\n","export enum ProviderType {\n VALUE = \"value\",\n PROVIDER = \"provider\",\n MODULE = \"module\",\n CONTROLLER = \"controller\",\n INTERCEPTOR = \"interceptor\",\n MIDDLEWARE = \"middleware\"\n}\n","import {Hooks} from \"@tsed/hooks\";\n\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\n\nexport class LocalsContainer extends Map<TokenProvider, any> {\n readonly hooks = new Hooks();\n\n async destroy() {\n await this.hooks.asyncEmit(\"$onDestroy\");\n }\n}\n","import {type AbstractType, methodsOf, type Type} from \"@tsed/core\";\n\nexport function discoverHooks(token: Type | AbstractType<any>) {\n return methodsOf(token).reduce((hooks, {propertyKey}) => {\n if (String(propertyKey).startsWith(\"$\")) {\n const listener = (instance: any, ...args: any[]) => instance?.[propertyKey](...args);\n\n return {\n ...hooks,\n [propertyKey]: listener\n };\n }\n return hooks;\n }, {} as any);\n}\n","import {type AbstractType, classOf, getClassOrSymbol, isClass, nameOf, Store, Type} from \"@tsed/core\";\n\nimport {DI_USE_PARAM_OPTIONS} from \"../constants/constants.js\";\nimport type {ProviderOpts} from \"../interfaces/ProviderOpts.js\";\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {discoverHooks} from \"../utils/discoverHooks.js\";\nimport {ProviderScope} from \"./ProviderScope.js\";\nimport {ProviderType} from \"./ProviderType.js\";\n\nexport type ProviderHookCallback<T = any> = (instance: T, ...args: unknown[]) => Promise<void> | void;\n\nexport class Provider<T = any> implements ProviderOpts<T> {\n /**\n * Token group provider to retrieve all provider from the same type\n */\n public type: ProviderType | TokenProvider = ProviderType.PROVIDER;\n public deps: TokenProvider[];\n public imports: (TokenProvider | [TokenProvider])[];\n public alias: string;\n public priority: number;\n public useFactory?: Function;\n public useAsyncFactory?: Function;\n public useValue?: unknown;\n public hooks: Record<string, ProviderHookCallback<T>> = {};\n #useClass: Type<T>;\n #token: TokenProvider;\n #store: Store;\n #tokenStore: Store;\n\n [key: string]: any;\n\n constructor(token: TokenProvider<T>, options: Partial<Provider> = {}) {\n this.token = token;\n this.useClass = token as Type<T>;\n\n Object.assign(this, options);\n\n if (options instanceof Provider) {\n this.#useClass = options.#useClass;\n this.#store = options.#store;\n this.#tokenStore = options.#tokenStore;\n }\n }\n\n get token() {\n return this.#token;\n }\n\n set token(value: TokenProvider) {\n if (value) {\n this.#token = getClassOrSymbol(value);\n this.#tokenStore = this.#store = Store.from(value);\n }\n }\n\n /**\n * @deprecated\n */\n get provide(): TokenProvider {\n return this.token;\n }\n\n /**\n * @deprecated\n * @param value\n */\n set provide(value: TokenProvider) {\n this.token = value;\n }\n\n get useClass(): Type<T> {\n return this.#useClass;\n }\n\n /**\n * Create a new store if the given value is a class. Otherwise, the value is ignored.\n * @param value\n */\n set useClass(value: Type<T> | AbstractType<T>) {\n if (isClass(value)) {\n this.#useClass = classOf(value);\n this.#store = Store.from(value);\n this.hooks = discoverHooks(this.#useClass);\n }\n }\n\n get className() {\n return this.name;\n }\n\n get name() {\n return nameOf(this.token);\n }\n\n get store(): Store {\n return this.#store;\n }\n\n get path() {\n return this.store.get(\"path\", \"/\");\n }\n\n set path(path: string) {\n this.store.set(\"path\", path);\n }\n\n /**\n * Get the scope of the provider.\n *\n * ::: tip Note\n * Async provider is always a SINGLETON\n * :::\n *\n * @returns {boolean}\n */\n get scope(): ProviderScope {\n if (this.isAsync()) {\n return ProviderScope.SINGLETON;\n }\n\n return this.get<ProviderScope>(\"scope\", ProviderScope.SINGLETON);\n }\n\n /**\n * Change the scope value of the provider.\n * @param scope\n */\n set scope(scope: ProviderScope) {\n this.store.set(\"scope\", scope);\n }\n\n get configuration(): Partial<TsED.Configuration> {\n return this.get(\"configuration\")!;\n }\n\n set configuration(configuration: Partial<TsED.Configuration>) {\n this.store.set(\"configuration\", configuration);\n }\n\n get children(): TokenProvider[] {\n return this.store.get(\"childrenControllers\", []);\n }\n\n set children(children: TokenProvider[]) {\n this.store.set(\"childrenControllers\", children);\n }\n\n getArgOpts(index: number) {\n return this.store.get(`${DI_USE_PARAM_OPTIONS}:${index}`);\n }\n\n /**\n * Retrieves a value from the provider's store.\n * @param key The key to look up\n * @returns The value if found, undefined otherwise\n */\n get<Type = unknown>(key: string): Type | undefined;\n /**\n * Retrieves a value from the provider's store with a default fallback.\n * @param key The key to look up\n * @param defaultValue The value to return if key is not found\n * @returns The found value or defaultValue\n */\n get<Type = unknown>(key: string, defaultValue: Type): Type;\n get<Type = unknown>(key: string, defaultValue?: Type): Type | undefined {\n return this.store.get(key) || this.#tokenStore.get(key) || defaultValue;\n }\n\n isAsync(): boolean {\n return !!this.useAsyncFactory;\n }\n\n clone(): Provider {\n return new (classOf(this))(this.token, this);\n }\n\n /**\n *\n * @returns {boolean}\n */\n public hasChildren(): boolean {\n return !!this.children.length;\n }\n\n /**\n *\n * @returns {boolean}\n */\n public hasParent(): boolean {\n return !!this.store.get(\"parentController\");\n }\n\n toString() {\n return [\n \"Token\",\n this.name,\n this.useClass && nameOf(this.useClass),\n this.useFactory && \"Factory\",\n this.useValue && \"Value\",\n this.useAsyncFactory && \"AsyncFactory\"\n ]\n .filter(Boolean)\n .join(\":\");\n }\n\n reset() {\n this.useValue = undefined;\n this.useFactory = undefined;\n this.useAsyncFactory = undefined;\n\n return this;\n }\n}\n","import {getClassOrSymbol, Type} from \"@tsed/core\";\n\nimport {Provider} from \"../domain/Provider.js\";\nimport {ProviderType} from \"../domain/ProviderType.js\";\nimport {ProviderOpts} from \"../interfaces/ProviderOpts.js\";\nimport {RegistrySettings} from \"../interfaces/RegistrySettings.js\";\nimport {TokenProvider} from \"../interfaces/TokenProvider.js\";\n\nexport class GlobalProviderRegistry extends Map<TokenProvider, Provider> {\n #settings: Map<TokenProvider, RegistrySettings> = new Map();\n\n /**\n * The get() method returns a specified element from a Map object.\n * @param key Required. The key of the element to return from the Map object.\n * @returns {T} Returns the element associated with the specified key or undefined if the key can't be found in the Map object.\n */\n get(key: TokenProvider): Provider | undefined {\n return super.get(getClassOrSymbol(key));\n }\n\n /**\n * The has() method returns a boolean indicating whether an element with the specified key exists or not.\n * @param key\n * @returns {boolean}\n */\n has(key: TokenProvider): boolean {\n return super.has(getClassOrSymbol(key));\n }\n\n /**\n * The set() method adds or updates an element with a specified key and value to a Map object.\n * @param key Required. The key of the element to add to the Map object.\n * @param metadata Required. The value of the element to add to the Map object.\n */\n set(key: TokenProvider, metadata: Provider): this {\n super.set(getClassOrSymbol(key), metadata);\n\n return this;\n }\n\n /**\n *\n * @param target\n * @param options\n */\n merge(target: TokenProvider, options: Partial<ProviderOpts>) {\n if (options.global === false) {\n return GlobalProviders.createProvider(target, options);\n }\n\n const meta = this.createIfNotExists(target, options);\n\n Object.keys(options).forEach((key) => {\n meta[key] = (options as never)[key];\n });\n\n this.set(target, meta);\n\n return meta;\n }\n\n /**\n * The delete() method removes the specified element from a Map object.\n * @param key Required. The key of the element to remove from the Map object.\n * @returns {boolean} Returns true if an element in the Map object existed and has been removed, or false if the element does not exist.\n */\n delete(key: TokenProvider): boolean {\n return super.delete(getClassOrSymbol(key));\n }\n\n createRegistry(type: string | symbol, model: Type<Provider>, options: Partial<RegistrySettings> = {}) {\n const defaultOptions = this.getRegistrySettings(type);\n\n options = Object.assign(defaultOptions, {\n ...options,\n model\n });\n\n this.#settings.set(type, options);\n\n return this;\n }\n\n getRegistrySettings(target: TokenProvider): RegistrySettings {\n let type: TokenProvider | ProviderType = ProviderType.PROVIDER;\n\n if (typeof target === \"string\") {\n type = target;\n } else {\n const provider = this.get(target);\n if (provider) {\n type = provider.type;\n }\n }\n\n return (\n this.#settings.get(type) || {\n model: Provider\n }\n );\n }\n\n protected createProvider(key: TokenProvider, options: Partial<ProviderOpts<any>>) {\n const type = options.type || ProviderType.PROVIDER;\n const {model = Provider} = this.#settings.get(type) || {};\n\n return new model(key, options);\n }\n\n /**\n *\n * @param key\n * @param options\n */\n protected createIfNotExists(key: TokenProvider, options: Partial<ProviderOpts>): Provider {\n if (!this.has(key)) {\n const item = this.createProvider(key, options);\n\n this.set(key, item);\n }\n\n return this.get(key)!;\n }\n}\n\n/**\n *\n * @type {GlobalProviders}\n */\n// tslint:disable-next-line: variable-name\nexport const GlobalProviders = new GlobalProviderRegistry();\n","import type {ProviderOpts} from \"../interfaces/ProviderOpts.js\";\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {GlobalProviders} from \"../registries/GlobalProviders.js\";\nimport {Provider} from \"./Provider.js\";\nimport type {ProviderType} from \"./ProviderType.js\";\n\nexport class Container extends Map<TokenProvider, Provider> {\n /**\n *\n * @param token\n * @param settings\n */\n public add(token: TokenProvider, settings: Partial<ProviderOpts> = {}): this {\n const provider = GlobalProviders.get(token)?.clone() || new Provider(token);\n\n Object.assign(provider, settings);\n\n return super.set(token, provider);\n }\n\n /**\n * Add a provider to the\n * @param token\n * @param settings\n */\n public addProvider(token: TokenProvider, settings: Partial<ProviderOpts> = {}): this {\n return this.add(token, settings);\n }\n\n /**\n *\n * @param token\n */\n public hasProvider(token: TokenProvider) {\n return super.has(token);\n }\n\n /**\n * Add a provider to the\n * @param token\n * @param provider\n */\n public setProvider(token: TokenProvider, provider: Provider) {\n return super.set(token, provider);\n }\n\n /**\n * The getProvider() method returns a specified element from a Map object.\n * @returns {T} Returns the element associated with the specified key or undefined if the key can't be found in the Map object.\n * @param token\n */\n public getProvider<T extends Provider = Provider>(token: TokenProvider | undefined): T | undefined {\n return super.get(token!) as T;\n }\n\n /**\n * Get all providers registered in the injector container.\n *\n * @param type Filter the list by the given ProviderType.\n * @returns {[TokenProvider , Provider<any>][]}\n */\n public getProviders(type?: TokenProvider | ProviderType | string | string[]): Provider[] {\n const types = ([] as (string | ProviderType)[]).concat(type as never).map(String);\n\n return [...this].reduce((providers, [_, provider]) => {\n if (types.includes(String(provider.type)) || !type) {\n return [...providers, provider];\n }\n return providers;\n }, []);\n }\n\n public addProviders(container: Map<TokenProvider, Provider>) {\n container.forEach((provider) => {\n if (!this.hasProvider(provider.token)) {\n this.setProvider(provider.token, provider.clone());\n }\n });\n }\n}\n","type ColorTextFn = (text: string) => string;\n\n// istanbul ignore next\nconst colorIfAllowed = (colorFn: ColorTextFn) => (text: string) =>\n !process.env.NO_COLOR && process.env.NODE_ENV !== \"production\" ? colorFn(text) : text;\n\nconst red = colorIfAllowed((text: string) => `\\x1B[31m${text}\\x1B[39m`);\nconst yellow = colorIfAllowed((text: string) => `\\x1B[33m${text}\\x1B[39m`);\nconst green = colorIfAllowed((text: string) => `\\x1B[32m${text}\\x1B[39m`);\n\nexport const colors = {red, yellow, green};\n","import {getConstructorArgNames, isClass, isString, nameOf} from \"@tsed/core\";\n\nimport {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {colors} from \"../utils/colors.js\";\n\nexport class InjectionError extends Error {\n name = \"INJECTION_ERROR\";\n\n public tokens: TokenProvider[] = [];\n public origin: any;\n\n constructor(token: TokenProvider, origin?: any) {\n super(isString(origin) ? origin : \"\");\n\n this.tokens = [token];\n\n if (origin) {\n if (isString(origin)) {\n this.origin = {\n message: origin,\n stack: this.stack\n };\n } else {\n if (origin.tokens) {\n this.tokens = this.tokens.concat(origin.tokens);\n this.origin = origin.origin;\n } else {\n this.origin = origin;\n this.stack = origin.stack;\n }\n }\n }\n\n const originMessage = this.origin ? \"\\nOrigin: \" + this.origin.message : \"\";\n const tokensMessage = this.tokens.map((token) => nameOf(token)).join(\" > \");\n\n this.message = `Injection failed on ${tokensMessage}${originMessage}`;\n }\n\n static throwInjectorError(token: any, currentDependency: any, error: any) {\n if (currentDependency && isClass(token)) {\n error.message = printDependencyInjectionError(token, {...currentDependency, message: error.message});\n }\n\n throw new InjectionError(token, error);\n }\n}\n\nfunction printDependencyInjectionError(token: any, options: {token: any; index: number; deps: any[]; message: string}) {\n let erroredArg = \"\";\n\n const args = getConstructorArgNames(token)\n .map((arg, index) => {\n if (options.index === index) {\n erroredArg = arg;\n arg = colors.red(arg);\n }\n\n return `${arg}: ${nameOf(options.deps[index])}`;\n })\n .join(\", \");\n\n const signature = nameOf(token) + \"->constructor(\" + args + \")\";\n const indexOf = signature.indexOf(erroredArg) - 5;\n const drawline = (indexOf: number) => \" \".repeat(indexOf) + colors.red(\"^\" + \"‾\".repeat(erroredArg.length - 1));\n\n return \"Unable to inject dependency. \" + options.message + \"\\n\\n\" + signature + \"\\n\" + (indexOf > -1 ? drawline(indexOf) : \"\");\n}\n","import {Type} from \"@tsed/core\";\n\nimport {Container} from \"../domain/Container.js\";\nimport {GlobalProviders} from \"../registries/GlobalProviders.js\";\n\nexport function createContainer(rootModule?: Type<any>) {\n const container = new Container(GlobalProviders.entries());\n\n if (rootModule) {\n container.delete(rootModule);\n }\n\n return container;\n}\n","import {Metadata} from \"@tsed/core\";\n\nexport function getConstructorDependencies(target: any, propertyKey?: string | symbol | undefined) {\n return Metadata.getOwn(\"override:ctor:design:paramtypes\", target, propertyKey) || [...Metadata.getParamTypes(target, propertyKey)] || [];\n}\n\nexport function setConstructorDependencies(target: any, deps: any[]) {\n Metadata.set(\"override:ctor:design:paramtypes\", deps, target);\n}\n","import {Env, getValue, setValue} from \"@tsed/core\";\n\nimport type {DILoggerOptions} from \"../interfaces/DILoggerOptions.js\";\nimport type {ImportTokenProviderOpts} from \"../interfaces/ImportTokenProviderOpts.js\";\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport type {TokenRoute} from \"../interfaces/TokenRoute.js\";\n\nexport const CONFIGURATION = Symbol.for(\"CONFIGURATION\");\n\nexport class DIConfiguration {\n readonly default: Map<string, any> = new Map();\n protected map: Map<string, any> = new Map();\n\n constructor(initialProps = {}) {\n Object.entries({\n imports: [],\n routes: [],\n logger: {},\n ...initialProps\n }).forEach(([key, value]) => {\n this.default.set(key, value);\n });\n }\n\n get version() {\n return this.get(\"version\")!;\n }\n\n set version(v: string) {\n this.map.set(\"version\", v);\n }\n\n get rootDir() {\n return this.get(\"rootDir\")!;\n }\n\n set rootDir(value: string) {\n this.map.set(\"rootDir\", value);\n }\n\n get env(): Env {\n return this.map.get(\"env\");\n }\n\n set env(value: Env) {\n this.map.set(\"env\", value);\n }\n\n get imports(): (TokenProvider | ImportTokenProviderOpts)[] {\n return this.get(\"imports\")!;\n }\n\n set imports(imports: (TokenProvider | ImportTokenProviderOpts)[]) {\n this.map.set(\"imports\", imports);\n }\n\n get routes(): TokenRoute[] {\n return this.get(\"routes\")!;\n }\n\n set routes(routes: TokenRoute[]) {\n this.map.set(\"routes\", routes);\n }\n\n get logger(): Partial<DILoggerOptions> {\n return this.get(\"logger\")!;\n }\n\n set logger(value: Partial<DILoggerOptions>) {\n const logger = {...this.logger, ...value};\n this.map.set(\"logger\", logger);\n }\n\n get debug(): boolean {\n return this.logger.level === \"debug\";\n }\n\n set debug(debug: boolean) {\n this.logger = {...this.logger, level: debug ? \"debug\" : \"info\"};\n }\n\n /**\n *\n * @param callbackfn\n * @param thisArg\n */\n forEach(callbackfn: (value: any, index: string, map: Map<string, any>) => void, thisArg?: any) {\n return new Set([...Array.from(this.default.keys()), ...Array.from(this.map.keys())]).forEach((key) => {\n callbackfn(this.getRaw(key), key, this.map);\n }, thisArg);\n }\n\n /**\n *\n * @param propertyKey\n * @param value\n */\n set(propertyKey: string | Partial<TsED.Configuration>, value?: any): this {\n if (typeof propertyKey === \"string\") {\n if (Reflect.has(this, propertyKey)) {\n // @ts-ignore\n this[propertyKey] = value;\n } else {\n this.setRaw(propertyKey, value);\n }\n } else {\n Object.entries(propertyKey).forEach(([key, value]) => {\n this.set(key, value);\n });\n }\n\n return this;\n }\n\n setRaw(propertyKey: string, value: any) {\n setValue(this.map, propertyKey, value);\n\n return this;\n }\n\n /**\n *\n * @param propertyKey\n * @param defaultValue\n * @returns {undefined|any}\n */\n get<T = any>(propertyKey: string, defaultValue?: T): T {\n return this.getRaw(propertyKey, defaultValue);\n }\n\n protected getRaw(propertyKey: string, defaultValue?: any): any {\n const value = getValue(this.map, propertyKey);\n\n if (value !== undefined) {\n return value;\n }\n\n return getValue(this.default, propertyKey, defaultValue);\n }\n}\n","import {classOf, deepClone, deepMerge, isArray, isClass, isFunction, isInheritedFrom, isObject, isPromise, nameOf} from \"@tsed/core\";\nimport {$alter, $asyncAlter, $asyncEmit, $emit, $off, $on} from \"@tsed/hooks\";\n\nimport {DI_INVOKE_OPTIONS, DI_USE_PARAM_OPTIONS} from \"../constants/constants.js\";\nimport {Container} from \"../domain/Container.js\";\nimport {LocalsContainer} from \"../domain/LocalsContainer.js\";\nimport {Provider} from \"../domain/Provider.js\";\nimport {ProviderScope} from \"../domain/ProviderScope.js\";\nimport {InjectionError} from \"../errors/InjectionError.js\";\nimport type {DILogger} from \"../interfaces/DILogger.js\";\nimport type {ImportTokenProviderOpts} from \"../interfaces/ImportTokenProviderOpts.js\";\nimport type {InvokeOptions} from \"../interfaces/InvokeOptions.js\";\nimport type {ResolvedInvokeOptions} from \"../interfaces/ResolvedInvokeOptions.js\";\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {GlobalProviders} from \"../registries/GlobalProviders.js\";\nimport {createContainer} from \"../utils/createContainer.js\";\nimport {getConstructorDependencies} from \"../utils/getConstructorDependencies.js\";\nimport {DIConfiguration} from \"./DIConfiguration.js\";\n\nconst EXCLUDED_CONFIGURATION_KEYS = [\"mount\", \"imports\"];\n\n/**\n * This service contain all services collected by `@Service` or services declared manually with `InjectorService.factory()` or `InjectorService.service()`.\n *\n * ### Example:\n *\n * ```typescript\n * import {InjectorService} from \"@tsed/di\";\n *\n * // Import the services (all services are decorated with @Service()\";\n * import MyService1 from \"./services/service1.js\";\n * import MyService2 from \"./services/service2.js\";\n * import MyService3 from \"./services/service3.js\";\n *\n * // When all services are imported, you can load InjectorService.\n *\n * await injector().load();\n *\n * const myService1 = injector.get<MyService1>(MyService1);\n * ```\n */\nexport class InjectorService extends Container {\n public logger: DILogger = console;\n private resolvedConfiguration: boolean = false;\n #cache = new LocalsContainer();\n #loaded: boolean = false;\n\n constructor() {\n super();\n this.#cache.set(InjectorService, this);\n this.#cache.set(DIConfiguration, new DIConfiguration());\n }\n\n get settings(): DIConfiguration {\n return this.#cache.get(DIConfiguration);\n }\n\n set settings(settings: DIConfiguration) {\n this.#cache.set(DIConfiguration, settings);\n }\n\n isLoaded() {\n return this.#loaded;\n }\n\n /**\n * Return a list of instance build by the injector.\n */\n public toArray(): any[] {\n return [...this.#cache.values()];\n }\n\n /**\n * Get a service or factory already constructed from his symbol or class.\n *\n * #### Example\n *\n * ```typescript\n * import {InjectorService} from \"@tsed/di\";\n * import MyService from \"./services.js\";\n *\n * class OtherService {\n * constructor(injectorService: InjectorService) {\n * const myService = injectorService.get<MyService>(MyService);\n * }\n * }\n * ```\n *\n * @param token The class or symbol registered in InjectorService.\n * @param options\n */\n get<T = any>(token: TokenProvider<T>, options?: Partial<InvokeOptions>): T {\n if (!this.has(token)) {\n return this.resolve(token, options);\n }\n\n return this.#cache.get(token);\n }\n\n /**\n * Return all instance of the same provider type\n */\n getMany<Type = any>(type: any, options?: Partial<InvokeOptions>): Type[] {\n return this.getProviders(type).map((provider) => {\n return this.resolve<Type>(provider.token, options);\n });\n }\n\n /**\n * The has() method returns a boolean indicating whether an element with the specified key exists or not.\n */\n has(token: TokenProvider): boolean {\n return this.#cache.get(token) !== undefined;\n }\n\n /**\n * Declare an alias for a given token.\n */\n alias(token: TokenProvider, alias: TokenProvider) {\n this.#cache.set(alias, this.#cache.get(token));\n\n return this;\n }\n\n /**\n * Resolve the token depending on his provider configuration.\n *\n * If the token isn't cached, the injector will invoke the provider and cache the result.\n *\n * #### Example\n *\n * ```typescript\n * import {InjectorService} from \"@tsed/di\";\n * import MyService from \"./services.js\";\n *\n * class OtherService {\n * constructor(injectorService: InjectorService) {\n * const myService = injectorService.invoke<MyService>(MyService);\n * }\n * }\n * ```\n *\n * @param token The injectable class to invoke. Class parameters are injected according constructor signature.\n * @param options {InvokeOptions} Optional options to invoke the class.\n * @returns {Type} The class constructed.\n */\n public resolve<Type = any>(token: TokenProvider<Type>, options: Partial<InvokeOptions> = {}): Type {\n let instance: any = options.locals ? options.locals.get(token) : undefined;\n\n if (instance !== undefined) {\n return instance;\n }\n\n if (token === DI_USE_PARAM_OPTIONS) {\n return options.useOpts as Type;\n }\n\n instance = !options.rebuild ? this.#cache.get(token) : undefined;\n\n if (instance != undefined) {\n return instance;\n }\n\n const provider = this.ensureProvider(token);\n\n // maybe not necessary\n if (!provider || options.rebuild) {\n instance = this.invokeToken(token, options);\n\n if (provider) {\n return this.setToCache(provider!, instance);\n }\n\n return instance;\n }\n\n instance = this.invokeToken(token, options);\n\n switch (provider.scope) {\n case ProviderScope.SINGLETON:\n if (!options.rebuild) {\n this.registerHooks(provider, options);\n }\n\n return this.setToCache(provider, instance);\n case ProviderScope.REQUEST:\n if (options.locals) {\n options.locals.set(provider.token, instance);\n\n this.registerHooks(provider, options);\n }\n\n return instance;\n }\n\n return instance;\n }\n\n /**\n * Resolve the token depending on his provider configuration.\n *\n * If the token isn't cached, the injector will invoke the provider and cache the result.\n *\n * #### Example\n *\n * ```typescript\n * import {InjectorService} from \"@tsed/di\";\n * import MyService from \"./services.js\";\n *\n * class OtherService {\n * constructor(injectorService: InjectorService) {\n * const myService = injectorService.invoke<MyService>(MyService);\n * }\n * }\n * ```\n *\n * @param token The injectable class to invoke. Class parameters are injected according constructor signature.\n * @param options {InvokeOptions} Optional options to invoke the class.\n * @returns {Type} The class constructed.\n * @alias InjectorService.resolve\n */\n public invoke<Type = any>(token: TokenProvider<Type>, options: Partial<InvokeOptions> = {}): Type {\n return this.resolve(token, options);\n }\n\n /**\n * Build only providers which are asynchronous.\n */\n async loadAsync() {\n for (const [, provider] of this) {\n if (!this.has(provider.token) && provider.isAsync()) {\n await this.resolve(provider.token);\n }\n }\n }\n\n /**\n * Build only providers which are synchronous.\n */\n loadSync() {\n for (const [, provider] of this) {\n // TODO try to lazy provider instead initiate all providers (&& provider.hasRegisteredHooks())\n if (!this.has(provider.token) && provider.scope === ProviderScope.SINGLETON) {\n this.resolve(provider.token);\n }\n }\n }\n\n /**\n * Build all providers from given container (or GlobalProviders) and emit `$onInit` event.\n *\n * @param container\n */\n async load(container: Container = createContainer()) {\n // avoid provider registration in the GlobalContainer during the loading phase\n // using injectable() or providerBuilder()\n this.#loaded = true;\n\n await $asyncEmit(\"$beforeInit\");\n\n await this.bootstrap(container);\n\n // build async and sync provider\n await this.loadAsync();\n\n // load sync provider\n this.loadSync();\n\n await $asyncEmit(\"$onInit\");\n }\n\n /**\n * Load all configurations registered on providers via @Configuration decorator.\n * It inspects for each provider some fields like imports, mount, etc. to resolve the configuration.\n */\n async resolveConfiguration() {\n if (this.resolvedConfiguration) {\n return;\n }\n const mergedConfiguration = new Map();\n\n super.forEach((provider) => {\n if (provider.configuration && provider.type !== \"server:module\") {\n Object.entries(provider.configuration).forEach(([key, value]) => {\n if (!EXCLUDED_CONFIGURATION_KEYS.includes(key)) {\n value = mergedConfiguration.has(key) ? deepMerge(mergedConfiguration.get(key), value) : deepClone(value);\n mergedConfiguration.set(key, value);\n }\n });\n }\n });\n\n mergedConfiguration.forEach((value, key) => {\n this.settings.set(key, deepMerge(value, this.settings.get(key)));\n });\n\n await $asyncEmit(\"$afterResolveConfiguration\", this.settings);\n\n this.resolvedConfiguration = true;\n }\n\n /**\n * Emit an event to all service. See service [lifecycle hooks](/docs/hooks.md#lifecycle-hooks).\n * @param eventName The event name to emit at all services.\n * @param args List of the parameters to give to each service.\n * @returns A list of promises.\n * @deprecated use $asyncEmit instead\n */\n public emit(eventName: string, ...args: unknown[]) {\n return $asyncEmit(eventName, args);\n }\n\n /**\n * Alter value attached to an event.\n * @param eventName\n * @param value\n * @param args\n * @deprecated use $alter instead\n */\n public alter<T = any>(eventName: string, value: any, ...args: any[]): T {\n return $alter(eventName, value, args);\n }\n\n /**\n * Alter value attached to an event asynchronously.\n * @param eventName\n * @param value\n * @param args\n * @deprecated use $asyncAlter instead\n */\n public alterAsync<T = any>(eventName: string, value: any, ...args: any[]): Promise<T> {\n return $asyncAlter(eventName, value, args);\n }\n\n /**\n * Destroy the injector and all services.\n */\n async destroy() {\n await $asyncEmit(\"$onDestroy\");\n this.#cache.forEach((_, token) => {\n $off(token);\n });\n }\n\n /**\n * Bootstrap injector from container, resolve configuration and providers.\n *\n * @param container\n */\n protected async bootstrap(container: Container = createContainer()) {\n // Clone all providers in the container\n this.addProviders(container);\n\n // Resolve all configuration\n await this.resolveConfiguration();\n\n // allow mocking or changing provider instance before loading injector\n this.resolveImportsProviders();\n\n return this;\n }\n\n /**\n * Ensure that a provider is added to the container.\n * @protected\n */\n protected ensureProvider(token: TokenProvider, force: true): Provider;\n protected ensureProvider(token: TokenProvider, force: false): Provider | undefined;\n protected ensureProvider(token: TokenProvider): Provider | undefined;\n protected ensureProvider(token: TokenProvider, force = false): Provider | undefined {\n if (!this.hasProvider(token) && (GlobalProviders.has(token) || force)) {\n this.addProvider(token);\n }\n\n return this.getProvider(token)!;\n }\n\n /**\n * Invoke a class method and inject service.\n *\n * #### IInjectableMethod options\n *\n * * **target**: Optional. The class instance.\n * * **methodName**: `string` Optional. The method name.\n * * **designParamTypes**: `any[]` Optional. List of injectable types.\n * * **locals**: `Map<Function, any>` Optional. If preset then any argument Class are read from this object first, before the `InjectorService` is consulted.\n *\n * #### Example\n *\n * @param target\n * @param options\n * @private\n */\n protected invokeToken<T>(target: TokenProvider, options: Partial<InvokeOptions> = {}): T | Promise<T> {\n const resolvedOpts = this.mapInvokeOptions(target, options);\n\n if (!resolvedOpts) {\n return undefined as T;\n }\n\n const {token, deps, construct, imports, provider} = resolvedOpts;\n\n $emit(\"$beforeInvoke\", token, [resolvedOpts]);\n $emit(`$beforeInvoke:${String(provider.type)}`, [resolvedOpts]);\n\n let instance: any;\n let currentDependency: any = false;\n\n try {\n const invokeDependency =\n (parent?: any) =>\n (token: TokenProvider | [TokenProvider], index: number): any => {\n currentDependency = {token, index, deps};\n\n if (isArray(token)) {\n return this.getMany(token[0], options);\n }\n\n return isInheritedFrom(token, Provider, 1)\n ? provider\n : this.resolve(token, {\n parent,\n locals: options.locals,\n useOpts: provider?.getArgOpts(index) || options.useOpts\n });\n };\n\n // Invoke manually imported providers\n imports.forEach(invokeDependency());\n\n // Inject dependencies\n const services = deps.map(invokeDependency(token));\n\n currentDependency = false;\n\n instance = construct(services);\n } catch (error) {\n InjectionError.throwInjectorError(token, currentDependency, error);\n }\n\n if (instance === undefined) {\n throw new InjectionError(\n token,\n `Unable to create new instance from undefined value. Check your provider declaration for ${nameOf(token)}`\n );\n }\n\n if (instance && isClass(classOf(instance))) {\n Reflect.defineProperty(instance, DI_INVOKE_OPTIONS, {\n get: () => ({rebuild: options.rebuild, locals: options.locals})\n });\n }\n\n $emit(\"$afterInvoke\", token, [instance, resolvedOpts]);\n\n return instance;\n }\n\n private resolveImportsProviders() {\n this.settings.imports = this.settings.imports\n ?.filter((meta) => isObject(meta) && \"token\" in meta && meta.token !== InjectorService)\n .map((meta) => {\n if (isObject(meta) && \"token\" in meta) {\n const {token, ...props} = meta;\n\n const provider = this.ensureProvider(token, true);\n\n if (provider) {\n provider.useValue = undefined;\n provider.useAsyncFactory = undefined;\n provider.useFactory = undefined;\n\n if (\"useClass\" in props) {\n provider.useClass = props.useClass as TokenProvider;\n return;\n }\n\n if (\"useFactory\" in props) {\n provider.useFactory = props.useFactory as never;\n return;\n }\n\n if (\"useAsyncFactory\" in props) {\n provider.useAsyncFactory = props.useAsyncFactory as never;\n return;\n }\n\n if (\"use\" in props) {\n provider.useValue = props.use as unknown;\n return;\n }\n }\n }\n\n return meta;\n })\n .filter(Boolean) as unknown as (TokenProvider | ImportTokenProviderOpts)[];\n }\n\n /**\n * Create options to invoke a provider or class.\n * @param token\n * @param options\n */\n private mapInvokeOptions(token: TokenProvider, options: Partial<InvokeOptions>): ResolvedInvokeOptions | false {\n const locals = options.locals || new LocalsContainer();\n\n options.locals = locals;\n\n let imports: (TokenProvider | [TokenProvider])[] | undefined = options.imports;\n let deps: TokenProvider[] | undefined = options.deps;\n let construct;\n\n if (!token || token === Object) {\n throw new Error(\"Given token is undefined. Could mean a circular dependency problem. Try to use @Inject(() => Token) to solve it.\");\n }\n\n let provider: Provider;\n\n if (!this.hasProvider(token)) {\n provider = new Provider(token);\n } else {\n provider = this.getProvider(token)!;\n }\n\n deps = deps || provider.deps;\n imports = imports || provider.imports;\n\n if (provider.useValue !== undefined) {\n construct = () => (isFunction(provider.useValue) ? provider.useValue() : provider.useValue);\n } else if (provider.useFactory) {\n construct = (deps: any[]) => provider.useFactory!(...deps);\n } else if (provider.useAsyncFactory) {\n construct = async (deps: any[]) => {\n deps = await Promise.all(deps);\n return provider.useAsyncFactory!(...deps);\n };\n } else if (provider.useClass) {\n // useClass\n deps = deps || getConstructorDependencies(provider.useClass);\n construct = (deps: TokenProvider[]) => new provider.useClass(...deps);\n } else {\n return false;\n }\n\n return {\n token,\n deps: deps! || [],\n imports: imports || [],\n construct,\n provider,\n locals\n };\n }\n\n private registerHooks(provider: Provider, options: Partial<InvokeOptions>) {\n if (provider.hooks) {\n if (provider.scope === ProviderScope.REQUEST) {\n if (options.locals && provider.hooks?.$onDestroy) {\n const {locals} = options;\n\n options.locals.hooks.on(\"$onDestroy\", (...args: unknown[]) => {\n return provider.hooks?.$onDestroy?.(locals.get(provider.token), ...args);\n });\n }\n\n return;\n }\n\n Object.entries(provider.hooks).forEach(([event, cb]) => {\n const callback = (...args: any[]) => {\n return cb(this.#cache.get(provider.token), ...args);\n };\n\n $on(event, provider.token, callback);\n });\n }\n }\n\n private setToCache(provider: Provider, instance: any) {\n const set = (instance: any) => {\n this.#cache.set(provider.token, instance);\n provider?.alias && this.alias(provider.token, provider.alias);\n };\n\n if (\"isAsync\" in provider && !provider.isAsync() && !isPromise(instance)) {\n set(instance);\n\n return instance;\n }\n\n // store promise to lock token in cache\n set(instance);\n\n instance = instance.then((instance: any) => {\n set(instance);\n\n return instance;\n });\n\n return instance;\n }\n}\n","import {InjectorService} from \"../services/InjectorService.js\";\n\nlet globalInjector: InjectorService = new InjectorService();\n\n/**\n * Return the existing injector service.\n *\n * Example:\n *\n * ```typescript\n * import {injector, Injectable} from \"@tsed/di\";\n *\n * @Injectable()\n * class MyService {\n * injector = injector();\n * }\n * ```\n */\nexport function injector(): InjectorService {\n return globalInjector;\n}\n\nexport async function destroyInjector() {\n await globalInjector.destroy();\n globalInjector = new InjectorService();\n}\n","import {isArray, type Type} from \"@tsed/core\";\n\nimport {LocalsContainer} from \"../domain/LocalsContainer.js\";\nimport {injector} from \"../fn/injector.js\";\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {getConstructorDependencies} from \"../utils/getConstructorDependencies.js\";\n\nfunction resolveAutoInjectableArgs(token: Type, args: unknown[]) {\n const inj = injector();\n const locals = new LocalsContainer();\n const deps: TokenProvider[] = getConstructorDependencies(token);\n const list: any[] = [];\n const length = Math.max(deps.length, args.length);\n\n for (let i = 0; i < length; i++) {\n if (args[i] !== undefined) {\n list.push(args[i]);\n } else {\n const value = deps[i];\n const instance = isArray(value) ? inj.getMany(value[0], {locals, parent: token}) : inj.invoke(value, {locals, parent: token});\n\n list.push(instance);\n }\n }\n\n return list;\n}\n\n/**\n * AutoInjectable decorator is used to automatically inject dependencies in the constructor.\n *\n * @example\n * ```typescript\n * @AutoInjectable()\n * class UserService {\n * constructor(\n * private database: Database, // automatically injected\n * customConfig?: Config // can be passed manually\n * ) {}\n * }\n * ```\n *\n * @description\n * When applied to a class, this decorator:\n * - Automatically resolves and injects dependencies based on constructor parameter types\n * - Preserves the ability to manually pass arguments which override automatic injection\n *\n * @decorator\n * @returns {ClassDecorator} A class decorator that enables automatic dependency injection\n */\nexport function AutoInjectable() {\n return <T extends {new (...args: any[]): NonNullable<unknown>}>(constr: T): T => {\n return class AutoInjectable extends constr {\n constructor(...args: any[]) {\n super(...resolveAutoInjectableArgs(constr, args));\n }\n } as unknown as T;\n };\n}\n","import {Store} from \"@tsed/core\";\n\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {DIConfiguration} from \"../services/DIConfiguration.js\";\nimport {injector} from \"./injector.js\";\n\nexport function configuration(): TsED.DIConfiguration & DIConfiguration;\nexport function configuration(token: TokenProvider): Partial<TsED.Configuration>;\nexport function configuration(token: TokenProvider, configuration: Partial<TsED.Configuration>): Partial<TsED.Configuration>;\nexport function configuration(token?: TokenProvider, configuration?: Partial<TsED.Configuration>) {\n if (token) {\n const store = Store.from(token);\n\n if (configuration) {\n store.set(\"configuration\", configuration);\n }\n\n return store.get(\"configuration\", configuration);\n }\n\n return injector().settings as TsED.DIConfiguration & DIConfiguration;\n}\n","import {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {Provider} from \"./Provider.js\";\nimport {ProviderType} from \"./ProviderType.js\";\n\nexport interface ControllerMiddlewares {\n useBefore: TokenProvider[];\n use: TokenProvider[];\n useAfter: TokenProvider[];\n}\n\nexport class ControllerProvider<T = any> extends Provider<T> {\n public tokenRouter: string;\n\n constructor(token: TokenProvider, options: Partial<Provider> = {}) {\n super(token, options);\n this.type = ProviderType.CONTROLLER;\n }\n\n /**\n *\n * @returns {any[]}\n */\n get middlewares(): Partial<ControllerMiddlewares> {\n return Object.assign(\n {\n use: [],\n useAfter: [],\n useBefore: []\n },\n this.store.get(\"middlewares\", {})\n );\n }\n\n /**\n *\n * @param middlewares\n */\n set middlewares(middlewares: Partial<ControllerMiddlewares>) {\n const mdlwrs = this.middlewares;\n const concat = (key: string, a: any, b: any) => (a[key] = a[key].concat(b[key]));\n\n Object.keys(middlewares).forEach((key: string) => {\n concat(key, mdlwrs, middlewares);\n });\n\n this.store.set(\"middlewares\", mdlwrs);\n }\n}\n","import {ControllerProvider} from \"../domain/ControllerProvider.js\";\nimport {ProviderType} from \"../domain/ProviderType.js\";\nimport {injectable} from \"../fn/injectable.js\";\nimport type {ProviderOpts} from \"../interfaces/ProviderOpts.js\";\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {GlobalProviders} from \"./GlobalProviders.js\";\n\nGlobalProviders.createRegistry(ProviderType.CONTROLLER, ControllerProvider);\n\ntype Opts<Type = any> = Partial<ProviderOpts<Type>> &\n (\n | {\n token: TokenProvider<Type>;\n }\n | {\n /**\n * @deprecated use token prop instead\n */\n provide: TokenProvider<Type>;\n }\n );\n\n/**\n * Register a provider configuration.\n * @deprecated Since v8. Use injectable() function instead.\n */\nexport function registerProvider<Type = any>({token, provide, ...opts}: Opts<Type>) {\n return injectable(token || provide, {\n ...opts,\n token: token || provide\n } as unknown as Partial<ProviderOpts>).inspect();\n}\n","import \"../registries/ProviderRegistry.js\";\n\nimport {Store, type Type} from \"@tsed/core\";\n\nimport {ProviderType} from \"../domain/ProviderType.js\";\nimport {injector} from \"../fn/injector.js\";\nimport type {ProviderOpts} from \"../interfaces/ProviderOpts.js\";\nimport type {FactoryTokenProvider, TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {GlobalProviders} from \"../registries/GlobalProviders.js\";\n\ntype BaseMethodsProvider<TypeOf, BaseProvider, T extends object> = {\n [K in keyof T as T[K] extends (...args: any[]) => any ? never : K]: (value: T[K]) => ProviderBuilder<TypeOf, BaseProvider, T>;\n};\n\ntype ProviderBuilder<TypeOf, BaseProvider, T extends object> = BaseMethodsProvider<TypeOf, BaseProvider, T> & {\n inspect(): BaseProvider;\n store(): Store;\n token(): TypeOf;\n factory<FactoryReturn>(f: (...args: unknown[]) => FactoryReturn): ProviderBuilder<FactoryTokenProvider<FactoryReturn>, BaseProvider, T>;\n asyncFactory<FactoryReturn>(\n f: (...args: unknown[]) => Promise<FactoryReturn>\n ): ProviderBuilder<FactoryTokenProvider<FactoryReturn>, BaseProvider, T>;\n value<Value>(v: Value): ProviderBuilder<FactoryTokenProvider<Value>, BaseProvider, T>;\n class<TokenKlass>(c: Type<TokenKlass>): ProviderBuilder<TokenKlass, BaseProvider, T>;\n};\n\nexport type ProviderBuilderFn<Provider, Picked extends keyof Provider> = <TypeOf extends TokenProvider>(\n token: TypeOf,\n options?: Partial<ProviderOpts<Type>>\n) => ProviderBuilder<TypeOf, Provider, Pick<Provider, Picked>>;\n\nexport function providerBuilder<Provider, Picked extends keyof Provider>(\n props: string[],\n baseOpts: Partial<ProviderOpts<Provider>> = {}\n): ProviderBuilderFn<Provider, Picked> {\n return <TypeOf extends TokenProvider>(token: TypeOf, options: Partial<ProviderOpts<Type>> = {}) => {\n const merged = {\n global: !injector().isLoaded(),\n ...options,\n ...baseOpts,\n token\n };\n\n const provider = GlobalProviders.merge(token, merged);\n\n if (!merged.global) {\n injector().setProvider(token, provider);\n }\n\n return props.reduce(\n (acc, prop) => {\n return {\n ...acc,\n [prop]: function (value: any) {\n (provider as any)[prop] = value;\n return this;\n }\n };\n },\n {\n factory(factory: Function) {\n provider.reset();\n provider.useFactory = factory;\n return this;\n },\n asyncFactory(asyncFactory: Function) {\n provider.reset();\n provider.useAsyncFactory = asyncFactory;\n return this;\n },\n value(value: any) {\n provider.reset();\n provider.useValue = value;\n provider.type = ProviderType.VALUE;\n return this;\n },\n class(k: any) {\n provider.reset();\n provider.useClass = k;\n return this;\n },\n store() {\n return provider.store;\n },\n inspect() {\n return provider;\n },\n token() {\n return provider.token as TypeOf;\n }\n } as ProviderBuilder<TypeOf, Provider, Pick<Provider, Picked>>\n );\n };\n}\n","import {ControllerProvider} from \"../domain/ControllerProvider.js\";\nimport type {Provider} from \"../domain/Provider.js\";\nimport {ProviderType} from \"../domain/ProviderType.js\";\nimport {providerBuilder} from \"../utils/providerBuilder.js\";\n\ntype PickedProps = \"scope\" | \"path\" | \"alias\" | \"hooks\" | \"deps\" | \"imports\" | \"configuration\" | \"priority\";\n\nconst Props = [\"type\", \"scope\", \"path\", \"alias\", \"hooks\", \"deps\", \"imports\", \"configuration\", \"priority\"];\nexport const injectable = providerBuilder<Provider, PickedProps | \"type\">(Props);\nexport const interceptor = providerBuilder<Provider, PickedProps | \"type\">(Props, {\n type: ProviderType.INTERCEPTOR\n});\nexport const controller = providerBuilder<ControllerProvider, PickedProps | \"children\" | \"middlewares\">([...Props, \"middlewares\"], {\n type: ProviderType.CONTROLLER\n});\n","import {classOf, nameOf} from \"@tsed/core\";\n\nexport class InvalidPropertyTokenError extends Error {\n name = \"INVALID_TOKEN_ERROR\";\n\n constructor(target: any, propertyKey: string) {\n super(\n `Object isn't a valid token. Please check the token set on ${nameOf(\n classOf(target)\n )}.${propertyKey}.\\n- Check that it is not a circular reference.\\n- Check that the token (class or symbol) exists`\n );\n }\n}\n","import {LocalsContainer} from \"../domain/LocalsContainer.js\";\nimport type {UseImportTokenProviderOpts} from \"../interfaces/ImportTokenProviderOpts.js\";\nimport {InjectorService} from \"../services/InjectorService.js\";\nimport {injector} from \"./injector.js\";\n\nlet globalLocals: LocalsContainer | undefined;\nlet globalInvOpts: any = {};\nconst stagedLocals: LocalsContainer[] = [];\n\n/**\n * Get the locals container initiated by DITest or .bootstrap() method.\n */\nexport function localsContainer({\n providers,\n rebuild\n}: {\n providers?: UseImportTokenProviderOpts[];\n rebuild?: boolean;\n} = {}) {\n if (!globalLocals || providers) {\n globalLocals = new LocalsContainer();\n\n if (providers) {\n providers.forEach((p) => {\n globalLocals!.set(p.token, p.use);\n });\n\n globalLocals.set(InjectorService, injector());\n }\n\n if (rebuild) {\n globalInvOpts.rebuild = rebuild;\n }\n }\n\n return globalLocals;\n}\n\nexport function invokeOptions() {\n return {...globalInvOpts};\n}\n\n/**\n * Reset the locals container.\n */\nexport function detachLocalsContainer() {\n globalLocals && stagedLocals.push(globalLocals);\n globalLocals = undefined;\n globalInvOpts = {};\n}\n\nexport function cleanAllLocalsContainer() {\n detachLocalsContainer();\n stagedLocals.map((item) => item.clear());\n}\n","import type {InvokeOptions} from \"../interfaces/InvokeOptions.js\";\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {injector} from \"./injector.js\";\nimport {invokeOptions, localsContainer} from \"./localsContainer.js\";\n\n/**\n * Inject a provider to another provider.\n *\n * Use this function to inject a custom provider on constructor parameter or property.\n *\n * ```typescript\n * @Injectable()\n * export class MyService {\n * connection = inject(CONNECTION);\n * }\n * ```\n *\n * @param token A token provider or token provider group\n * @param opts\n * @returns {Function}\n * @decorator\n */\nexport function inject<TokenType>(\n token: TokenProvider<TokenType>,\n opts?: Partial<Pick<InvokeOptions, \"useOpts\" | \"rebuild\" | \"locals\">>\n): TokenType {\n return injector().resolve(token, {\n ...opts,\n ...invokeOptions(),\n locals: opts?.locals || localsContainer()\n });\n}\n","import type {InvokeOptions} from \"../interfaces/InvokeOptions.js\";\nimport {injector} from \"./injector.js\";\nimport {localsContainer} from \"./localsContainer.js\";\n\n/**\n * Injects multiple instances of a given token using the injector service.\n * @param token - The injection token to resolve\n * @param opts - Optional configuration for the injection\n * @param opts.useOpts - Options for instance creation\n * @param opts.rebuild - Whether to rebuild the instance\n * @param opts.locals - Local container overrides\n * @returns Array of resolved instances\n */\nexport function injectMany<T>(token: string | symbol, opts?: Partial<Pick<InvokeOptions, \"useOpts\" | \"rebuild\" | \"locals\">>): T[] {\n return injector().getMany<T>(token, {...opts, locals: opts?.locals || localsContainer()} as InvokeOptions);\n}\n","import {catchError, decoratorTypeOf, DecoratorTypes, isPromise, Metadata, Store, type Type} from \"@tsed/core\";\n\nimport {DI_INJECTABLE_PROPS, DI_INVOKE_OPTIONS, DI_USE_OPTIONS} from \"../constants/constants.js\";\nimport {InvalidPropertyTokenError} from \"../errors/InvalidPropertyTokenError.js\";\nimport {inject} from \"../fn/inject.js\";\nimport {injectMany} from \"../fn/injectMany.js\";\nimport type {InvokeOptions} from \"../interfaces/InvokeOptions.js\";\nimport {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {getConstructorDependencies, setConstructorDependencies} from \"../utils/getConstructorDependencies.js\";\n\nfunction setToken(\n token: TokenProvider,\n {\n target,\n propertyKey,\n parameterIndex\n }: {\n target: any;\n propertyKey: string | symbol | undefined;\n parameterIndex: number;\n }\n) {\n const paramTypes = getConstructorDependencies(target, propertyKey);\n const type = paramTypes[parameterIndex];\n\n paramTypes[parameterIndex] = type === Array ? [token] : token;\n\n Metadata.setParamTypes(target, propertyKey!, paramTypes);\n setConstructorDependencies(target, paramTypes);\n}\n\nfunction getTokenType(token: TokenProvider | (() => TokenProvider) | undefined, target: any, propertyKey: string | symbol) {\n const useType = token || Metadata.getType(target, propertyKey);\n\n if (useType === Object) {\n throw new InvalidPropertyTokenError(target, String(propertyKey));\n }\n\n return useType;\n}\n\nexport type TransformInjectedProviderCB<T, Klass = any> = (\n instance: T,\n {target, propertyKey}: {self: Klass; target: Type<Klass>; propertyKey: symbol | string}\n) => unknown;\n\nexport interface BindInjectablePropertyOpts<T = any> {\n token?: TokenProvider;\n useOpts?: Record<string, unknown>;\n transform?: TransformInjectedProviderCB<T>;\n}\n\nfunction bindInjectableProperty<T = any>(\n target: any,\n propertyKey: string | symbol,\n {token, transform = (o) => o, useOpts}: BindInjectablePropertyOpts<T>\n) {\n const symbol = Symbol();\n\n if (!target[DI_INJECTABLE_PROPS]) {\n Reflect.defineProperty(target, DI_INJECTABLE_PROPS, {\n value: new Set(),\n enumerable: false,\n configurable: false\n });\n }\n\n target[DI_INJECTABLE_PROPS].add(propertyKey);\n\n catchError(() => Reflect.deleteProperty(target, propertyKey));\n Reflect.defineProperty(target, propertyKey, {\n get() {\n const useType = getTokenType(token, target, propertyKey!);\n const originalType = Metadata.getType(target, propertyKey);\n\n const invokeOpts: Partial<InvokeOptions> = {\n rebuild: !!this[DI_INVOKE_OPTIONS]?.rebuild,\n locals: this[DI_INVOKE_OPTIONS]?.locals,\n useOpts: useOpts || Store.from(target, propertyKey).get(DI_USE_OPTIONS)\n };\n\n if (this[symbol] === undefined) {\n this[symbol] = originalType === Array ? injectMany(token as string, invokeOpts) : inject(useType, invokeOpts);\n }\n\n [].concat(this[symbol]).forEach((instance: any, index) => {\n if (isPromise(this[symbol])) {\n instance.then((result: any) => {\n this[symbol]![index] = result;\n if (originalType !== Array) {\n this[symbol] = result;\n }\n });\n }\n });\n\n return transform(this[symbol], {self: this, target, propertyKey});\n }\n });\n}\n\n/**\n * Inject a provider to another provider.\n *\n * Use this decorator to inject a custom provider on constructor parameter or property.\n *\n * ```typescript\n * @Injectable()\n * export class MyService {\n * @Inject(CONNECTION)\n * connection: CONNECTION;\n * }\n * ```\n *\n * @param token A token provider or token provider group\n * @param transform\n * @returns {Function}\n * @decorator\n */\nexport function Inject<T = any>(token?: TokenProvider<T> | (() => TokenProvider<T>), transform?: TransformInjectedProviderCB<T>): any;\nexport function Inject<T = any>(\n token?: TokenProvider<T> | (() => TokenProvider<T>),\n opts?: Partial<Omit<BindInjectablePropertyOpts<T>, \"token\">>\n): any;\nexport function Inject<T = any>(\n token?: TokenProvider<T> | (() => TokenProvider<T>),\n opts: TransformInjectedProviderCB<T> | Partial<Omit<BindInjectablePropertyOpts<T>, \"token\">> = {}\n) {\n opts = typeof opts === \"function\" ? {transform: opts} : opts;\n\n return (target: any, propertyKey: string | symbol | undefined, index?: number) => {\n const bindingType = decoratorTypeOf([target, propertyKey, index]);\n\n switch (bindingType) {\n case DecoratorTypes.PARAM_CTOR:\n if (token) {\n setToken(token, {target, propertyKey, parameterIndex: index!});\n }\n break;\n case DecoratorTypes.PROP:\n bindInjectableProperty(target, propertyKey!, {...opts, token});\n }\n };\n}\n","import {DecoratorParameters, decoratorTypeOf, DecoratorTypes} from \"@tsed/core\";\n\nimport {configuration} from \"../fn/configuration.js\";\nimport {injectable} from \"../fn/injectable.js\";\nimport {injector} from \"../fn/injector.js\";\nimport {CONFIGURATION, DIConfiguration} from \"../services/DIConfiguration.js\";\nimport {Inject} from \"./inject.js\";\n\n/**\n * Get or set Configuration on a class.\n *\n * @decorator\n */\nexport function Configuration(): any;\nexport function Configuration(settings: Partial<TsED.Configuration>): ClassDecorator;\nexport function Configuration(settings: Partial<TsED.Configuration> = {}): Function {\n return (...args: DecoratorParameters) => {\n switch (decoratorTypeOf(args)) {\n case DecoratorTypes.CLASS:\n configuration(args[0], settings);\n\n break;\n default:\n case DecoratorTypes.PARAM_CTOR:\n return Inject(DIConfiguration)(args[0], args[1], args[2] as number);\n }\n };\n}\n\nexport type Configuration = TsED.DIConfiguration & DIConfiguration;\n\n// To maintain compatibility with the previous implementation, we need to declare Configuration as\n// injectable token.\ninjectable(Configuration).factory(() => injector().settings);\n","import {injector} from \"./injector.js\";\n\nexport function constant<Type>(expression: string): Type | undefined;\nexport function constant<Type>(expression: string, defaultValue: Type | undefined): Type;\nexport function constant<Type>(expression: string, defaultValue?: Type | undefined): Type | undefined {\n return injector().settings.get(expression, defaultValue);\n}\n","import {catchError, deepClone} from \"@tsed/core\";\n\nimport {constant} from \"../fn/constant.js\";\n\nexport function bindConstant(target: any, propertyKey: string | symbol, expression: string, defaultValue?: any) {\n const symbol = Symbol();\n\n catchError(() => Reflect.deleteProperty(target, propertyKey));\n Reflect.defineProperty(target, propertyKey, {\n get() {\n if (this[symbol] !== undefined) {\n return this[symbol];\n }\n\n const value = constant(expression, defaultValue);\n\n this[symbol] = Object.freeze(deepClone(value));\n\n return this[symbol];\n },\n set(value: unknown) {\n const bean = constant(expression, defaultValue) || this[symbol];\n\n if (bean === undefined && value !== undefined) {\n this[symbol] = value;\n }\n },\n enumerable: true,\n configurable: true\n });\n}\n\n/**\n * Return value from Configuration.\n *\n * ## Example\n *\n * ```typescript\n * import {Env} from \"@tsed/core\";\n * import {Constant, Value} from \"@tsed/di\";\n *\n * export class MyClass {\n *\n * @Constant(\"env\")\n * env: Env;\n *\n * @Value(\"swagger.path\")\n * swaggerPath: string;\n *\n * @Value(\"swagger.path\", \"defaultValue\")\n * swaggerPath: string;\n *\n * constructor() {\n * console.log(this.swaggerPath) // undefined. Not available on constructor\n * }\n *\n * $onInit() {\n * console.log(this.swaggerPath) // something\n * }\n * }\n * ```\n *\n * @param {string} expression\n * @param defaultValue\n * @returns {(targetClass: any, attributeName: string) => any}\n * @decorator\n */\nexport function Constant<Type = unknown>(expression: string, defaultValue?: Type): PropertyDecorator {\n return (target, propertyKey) => {\n return bindConstant(target, propertyKey, expression, defaultValue);\n };\n}\n","export enum InjectablePropertyType {\n METHOD = \"method\",\n PROPERTY = \"property\",\n CONSTANT = \"constant\",\n VALUE = \"value\",\n INTERCEPTOR = \"interceptor\"\n}\n","import {isArrayOrArrayClass, Type, useDecorators} from \"@tsed/core\";\nimport {Children, Path} from \"@tsed/schema\";\n\nimport type {ControllerMiddlewares} from \"../domain/ControllerProvider.js\";\nimport {controller} from \"../fn/injectable.js\";\nimport {ProviderOpts} from \"../interfaces/ProviderOpts.js\";\n\nexport type PathType = string | RegExp | (string | RegExp)[];\n\nexport interface ControllerOptions extends Partial<ProviderOpts<any>> {\n path?: PathType;\n children?: Type<any>[];\n middlewares?: Partial<ControllerMiddlewares>;\n}\n\nfunction mapOptions(options: any): ControllerOptions {\n if (typeof options === \"string\" || options instanceof RegExp || isArrayOrArrayClass(options)) {\n return {\n path: options\n };\n }\n\n return options;\n}\n\n/**\n * Declare a new controller with his Rest path. His methods annotated will be collected to build the routing list.\n * This routing listing will be built with the `express.Router` object.\n *\n * ::: tip\n * See [Controllers](/docs/controllers.md) section for more details\n * :::\n *\n * ```typescript\n * @Controller(\"/calendars\")\n * export class CalendarCtrl {\n *\n * @Get(\"/:id\")\n * public get(\n * @Req() request: Req,\n * @Res() response: Res,\n * @Next() next: Next\n * ): void {\n *\n * }\n * }\n * ```\n *\n * @param options\n * @controller\n * @decorator\n * @classDecorator\n */\nexport function Controller(options: PathType | ControllerOptions): ClassDecorator {\n const {children = [], path, ...opts} = mapOptions(options);\n\n return useDecorators(\n (target: Type) => {\n controller(target, opts);\n },\n path && Path(path as any),\n Children(...children)\n );\n}\n","import {injectable} from \"../fn/injectable.js\";\nimport type {ProviderOpts} from \"../interfaces/ProviderOpts.js\";\n\n/**\n * The decorators `@Injectable()` declare a new service can be injected in other service, controller, interceptor, etc.. on there `constructor`.\n * All classes annotated with `@Injectable()` are built one time, excepted if you change the default provider configuration.\n *\n * ::: tip\n * `@Injectable()` use the `reflect-metadata` to collect and inject the built provided to other services.\n * :::\n *\n * ### Options\n *\n * - type (@@ProviderType@@ or `string`): Kind of provider. (Default: `ProviderType.PROVIDER`)\n * - scope (@@ProviderScope@@): Kind of provider. (Default: `ProviderScope.SINGLETON`)\n * - token (@@TokenProvider@@): An injection token (Note: This option override default metadata generated by Typescript).\n * - deps (`Type<any>`): List of class or provider which will be injected to the constructor (Note: This options override default metadata generated by Typescript).\n *\n * @returns {Function}\n * @decorator\n */\nexport function Injectable(options: Partial<ProviderOpts> = {}): ClassDecorator {\n return (target: any) => {\n const opts = {\n ...options,\n ...(options.token ? {useClass: target} : {token: target})\n };\n injectable(opts.token, opts);\n };\n}\n","import {classOf, decorateMethodsOf, DecoratorParameters, decoratorTypeOf, DecoratorTypes, nameOf, Store, Type} from \"@tsed/core\";\n\nimport {DI_INTERCEPTOR_OPTIONS, DI_INVOKE_OPTIONS} from \"../constants/constants.js\";\nimport {inject} from \"../fn/inject.js\";\nimport type {InterceptorContext} from \"../interfaces/InterceptorContext.js\";\nimport type {InterceptorMethods} from \"../interfaces/InterceptorMethods.js\";\nimport type {InvokeOptions} from \"../interfaces/InvokeOptions.js\";\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\n\nexport function getInterceptorOptions<T>(target: Type<any>, propertyKey: string | symbol) {\n return Store.fromMethod(target, propertyKey).get(DI_INTERCEPTOR_OPTIONS) as T;\n}\n\nexport function bindIntercept(target: any, propertyKey: string | symbol, token: TokenProvider, options: Record<string, unknown>) {\n const klass = classOf(target);\n const descriptor = Reflect.getOwnPropertyDescriptor(klass.prototype, propertyKey);\n const originalMethod = descriptor!.value;\n const symbol = Symbol();\n\n Store.fromMethod(klass, propertyKey).set(DI_INTERCEPTOR_OPTIONS, options);\n\n function newMethod(...args: any[]) {\n const next = (err?: Error) => {\n if (!err) {\n return originalMethod.apply(this, args);\n }\n\n throw err;\n };\n\n const context: InterceptorContext<any> = {\n target: klass,\n propertyKey,\n args,\n options,\n next\n };\n\n const invokeOpts: Partial<InvokeOptions> = {\n rebuild: !!this[DI_INVOKE_OPTIONS]?.rebuild,\n locals: this[DI_INVOKE_OPTIONS]?.locals\n };\n\n this[symbol] = this[symbol] || inject(token, invokeOpts)!;\n\n return this[symbol].intercept!(\n {\n ...context,\n options\n },\n next\n );\n }\n\n descriptor!.value = newMethod;\n\n Reflect.deleteProperty(klass.prototype, propertyKey);\n Reflect.defineProperty(klass.prototype, propertyKey, descriptor!);\n\n return descriptor;\n}\n\n/**\n * Attaches interceptor to method call and executes the before and after methods\n *\n * @param interceptor\n * @param options\n * @decorator\n */\nexport function Intercept<T extends InterceptorMethods>(interceptor: Type<T>, options?: any): any {\n return (...args: DecoratorParameters) => {\n const [target, propertyKey] = args;\n const type = decoratorTypeOf(args);\n switch (type) {\n case DecoratorTypes.CLASS:\n decorateMethodsOf(target, Intercept(interceptor, options));\n break;\n case DecoratorTypes.METHOD:\n return bindIntercept(target, propertyKey, interceptor, options);\n }\n };\n}\n","import {ProviderType} from \"../domain/ProviderType.js\";\nimport {Injectable} from \"./injectable.js\";\n\n/**\n * The decorators `@Interceptor()` declare a new service can be injected in other service or controller on there `constructor`.\n * All services annotated with `@Interceptor()` are constructed one time.\n *\n * > `@Service()` use the `reflect-metadata` to collect and inject service on controllers or other services.\n *\n * @returns {Function}\n * @decorator\n */\nexport function Interceptor(): Function {\n return Injectable({\n type: ProviderType.INTERCEPTOR\n });\n}\n","import {isFunction} from \"@tsed/core\";\n\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {inject} from \"./inject.js\";\nimport {injector} from \"./injector.js\";\n\n/**\n * Lazy load a provider from his package and invoke only when the provider is used.\n */\nexport async function lazyInject<Token>(factory: () => Promise<{default: TokenProvider<Token>}>): Promise<Token> {\n const {default: token} = await factory();\n\n if (!injector().has(token)) {\n const instance = await inject(token);\n\n const instanceWithHook = instance as unknown as {$onInit?: () => Promise<void>};\n\n if (\"$onInit\" in instanceWithHook && isFunction(instanceWithHook.$onInit)) {\n await instanceWithHook.$onInit();\n }\n }\n\n return injector().get(token) as unknown as Promise<Token>;\n}\n\nexport async function optionalLazyInject<Token>(\n factory: () => Promise<{\n default: TokenProvider;\n }>\n): Promise<Token | undefined> {\n try {\n return await lazyInject(factory);\n } catch (er) {\n return undefined;\n }\n}\n","import {catchError, isFunction} from \"@tsed/core\";\n\nimport {lazyInject, optionalLazyInject} from \"../fn/lazyInject.js\";\n\nfunction mapOptions(args: any[], optional = false) {\n function wrap(key: string, resolver: any) {\n return async () => {\n try {\n const {[key]: token} = await resolver();\n\n return {default: token};\n } catch (er) {\n if (!optional) {\n throw er;\n }\n\n return;\n }\n };\n }\n\n if (isFunction(args[0])) {\n return wrap(\"default\", args[0]);\n }\n\n return wrap(args[0], args[1]);\n}\n\n/**\n * Lazy load a provider from his package and invoke only when the provider is used\n *\n * ```typescript\n * import type {PlatformException} from \"@tsed/platform-exceptions\";\n *\n * @Injectable()\n * export class MyService {\n * @LazyInject(() => import(\"@tsed/platform-exceptions\"))\n * exceptions: Promise<PlatformException>;\n * }\n * ```\n *\n * @param key - The named export to import from the module.\n * @param resolver - A function that returns a promise resolving to the module.\n * @returns {Function}\n * @decorator\n */\nexport function LazyInject(resolver: () => Promise<{default: unknown}>): PropertyDecorator;\nexport function LazyInject(key: string, resolver: () => Promise<{default: unknown}>): PropertyDecorator;\nexport function LazyInject(...args: any[]): PropertyDecorator {\n let resolver = mapOptions(args);\n\n return (target: any, propertyKey: string | symbol): any | void => {\n catchError(() => Reflect.deleteProperty(target, propertyKey));\n Reflect.defineProperty(target, propertyKey, {\n async get() {\n return lazyInject<any>(resolver as any);\n }\n });\n };\n}\n\n/**\n * Optionally Lazy load a provider from his package and invoke only when the provider is used\n *\n * ```typescript\n * import type {PlatformException} from \"@tsed/platform-exceptions\";\n *\n * @Injectable()\n * export class MyService {\n * @OptionalLazyInject(() => import(\"@tsed/platform-exceptions\"))\n * exceptions: Promise<PlatformException>;\n * }\n * ```\n * @param key - The named export to import from the module.\n * @param resolver - A function that returns a promise resolving to the module.\n * @decorator\n */\nexport function OptionalLazyInject(resolver: () => Promise<{default: unknown}>): PropertyDecorator;\nexport function OptionalLazyInject(key: string, resolver: () => Promise<{default: unknown}>): PropertyDecorator;\nexport function OptionalLazyInject(...args: any[]): PropertyDecorator {\n const resolver = mapOptions(args, true);\n\n return (target: any, propertyKey: string | symbol): any | void => {\n catchError(() => Reflect.deleteProperty(target, propertyKey));\n Reflect.defineProperty(target, propertyKey, {\n async get() {\n return optionalLazyInject(resolver as any);\n }\n });\n };\n}\n","import {useDecorators} from \"@tsed/core\";\n\nimport {ProviderScope} from \"../domain/ProviderScope.js\";\nimport {ProviderType} from \"../domain/ProviderType.js\";\nimport {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {Configuration} from \"./configuration.js\";\nimport {Injectable} from \"./injectable.js\";\n\nexport interface ModuleOptions extends Omit<TsED.Configuration, \"scopes\"> {\n /**\n * Provider scope\n */\n scope?: ProviderScope;\n /**\n * Providers must be initialized before building this module\n */\n imports?: TokenProvider[];\n /**\n * Explicit token must be injected in the constructor\n */\n deps?: TokenProvider[];\n\n /**\n * Additional properties are stored as provider configuration.\n */\n [key: string]: any;\n}\n\n/**\n * Declare a new Ts.ED module\n *\n * ## Options\n * - imports: List of Provider which must be built by injector before invoking the module\n * - deps: List of provider must be injected to the module constructor (explicit declaration)\n *\n * @param options\n * @decorator\n */\nexport function Module(options: Partial<ModuleOptions> = {}) {\n const {scopes, imports, deps, scope, ...configuration} = options;\n\n return useDecorators(\n Configuration(configuration),\n Injectable({\n type: ProviderType.MODULE,\n scope: ProviderScope.SINGLETON,\n imports,\n deps,\n injectable: false\n })\n );\n}\n","import {StoreSet} from \"@tsed/core\";\n\nimport {ProviderScope} from \"../domain/ProviderScope.js\";\n\n/**\n *\n * @param {\"request\" | \"singleton\" | ProviderScope} scope\n * @returns {Function}\n * @constructor\n */\nexport function Scope(scope: \"request\" | \"singleton\" | ProviderScope = ProviderScope.REQUEST) {\n return StoreSet(\"scope\", scope);\n}\n","import {classOf} from \"@tsed/core\";\n\nimport {DI_USE_PARAM_OPTIONS} from \"../constants/constants.js\";\nimport {ProviderScope} from \"../domain/ProviderScope.js\";\nimport {Inject} from \"./inject.js\";\nimport {Scope} from \"./scope.js\";\n\n/**\n * Get instance options. This options depending on his invocation context.\n *\n * ```typescript\n * import {Injectable, Opts, UseOpts} from \"@tsed/di\";\n *\n * @Injectable()\n * class MyConfigurableService {\n * source: string;\n * constructor(@Opts options: any = {}) {\n * console.log(\"Hello \", options.source); // log: Hello Service1 then Hello Service2\n *\n * this.source = options.source;\n * }\n * }\n *\n * @Injectable()\n * class MyService1 {\n * constructor(@UseOpts({source: 'Service1'}) service: MyConfigurableService) {\n * console.log(service.source) // log: Service1\n * }\n * }\n *\n * @Injectable()\n * class MyService2 {\n * constructor(@UseOpts({source: 'Service2'}) service: MyConfigurableService) {\n * console.log(service.source) // log: Service2\n * }\n * }\n * ```\n *\n * ::: warning\n * Using @@Opts@@ decorator on a constructor parameter change the Scope of the provider to `ProviderScope.INSTANCE`.\n * :::\n *\n * @param target\n * @param propertyKey\n * @param index\n * @decorator\n */\nexport function Opts(target: any, propertyKey: string | symbol | undefined, index: number) {\n Scope(ProviderScope.INSTANCE)(classOf(target));\n Inject(DI_USE_PARAM_OPTIONS)(target, propertyKey, index);\n}\n","import {Type} from \"@tsed/core\";\n\nimport {GlobalProviders} from \"../registries/GlobalProviders.js\";\n\n/**\n * Override a provider which is already registered in ProviderRegistry.\n * @returns {Function}\n * @decorators\n * @param originalProvider\n */\nexport function OverrideProvider(originalProvider: Type<any>): Function {\n return (target: Type<any>): void => {\n GlobalProviders.get(originalProvider)!.useClass = target;\n };\n}\n","import {Injectable} from \"./injectable.js\";\n\n/**\n * The decorators `@Service()` declare a new service can be injected in other service or controller on there `constructor`.\n * All services annotated with `@Service()` are constructed one time.\n *\n * > `@Service()` use the `reflect-metadata` to collect and inject service on controllers or other services.\n *\n * @returns {Function}\n * @decorator\n */\nexport function Service(): Function {\n return Injectable();\n}\n","import {decoratorTypeOf, DecoratorTypes, Store, UnsupportedDecoratorType} from \"@tsed/core\";\n\nimport {DI_USE_OPTIONS, DI_USE_PARAM_OPTIONS} from \"../constants/constants.js\";\n\n/**\n * Add options to invoke the Service.\n *\n * ```typescript\n * import {Injectable, Opts, UseOpts} from \"@tsed/di\";\n *\n * @Injectable()\n * class MyConfigurableService {\n * source: string;\n * constructor(@Opts options: any = {}) {\n * console.log(\"Hello \", options.source); // log: Hello Service1 then Hello Service2\n *\n * this.source = options.source;\n * }\n * }\n *\n * @Injectable()\n * class MyService1 {\n * constructor(@UseOpts({source: 'Service1'}) service: MyConfigurableService) {\n * console.log(service.source) // log: Service1\n * }\n * }\n *\n * @Injectable()\n * class MyService2 {\n * constructor(@UseOpts({source: 'Service2'}) service: MyConfigurableService) {\n * console.log(service.source) // log: Service2\n * }\n * }\n * ```\n *\n * ::: warning\n * Using @@Opts@@ decorator on a constructor parameter change the Scope of the provider to `ProviderScope.INSTANCE`.\n * :::\n *\n * @returns {Function}\n * @decorator\n * @param options\n */\nexport function UseOpts(options: {[key: string]: any}): Function {\n return (target: Object, propertyKey: string | symbol, index?: number): any => {\n const bindingType = decoratorTypeOf([target, propertyKey, index]);\n\n switch (bindingType) {\n case DecoratorTypes.PARAM_CTOR:\n Store.from(target).merge(`${DI_USE_PARAM_OPTIONS}:${index}`, options);\n break;\n\n case DecoratorTypes.PROP:\n Store.from(target, propertyKey).set(DI_USE_OPTIONS, options);\n break;\n\n default:\n throw new UnsupportedDecoratorType(UseOpts, [target, propertyKey, index]);\n }\n };\n}\n","import {catchError} from \"@tsed/core\";\n\nimport {injector} from \"../fn/injector.js\";\n\nexport function bindValue(target: any, propertyKey: string | symbol, expression: string, defaultValue?: any) {\n const descriptor = {\n get() {\n return injector().settings.get(expression, defaultValue);\n },\n set(value: unknown) {\n injector().settings.set(expression, value);\n },\n enumerable: true,\n configurable: true\n };\n\n catchError(() => Reflect.deleteProperty(target, propertyKey));\n catchError(() => Reflect.defineProperty(target, propertyKey, descriptor));\n}\n\n/**\n * Return value from Configuration.\n *\n * ## Example\n *\n * ```typescript\n * import {Env} from \"@tsed/core\";\n * import {Constant, Value} from \"@tsed/di\";\n *\n * export class MyClass {\n *\n * @Constant(\"env\")\n * env: Env;\n *\n * @Value(\"swagger.path\")\n * swaggerPath: string;\n *\n * @Value(\"swagger.path\", \"defaultValue\")\n * swaggerPath: string;\n *\n * constructor() {\n * console.log(this.swaggerPath) // undefined. Not available on constructor\n * }\n *\n * $onInit() {\n * console.log(this.swaggerPath) // something\n * }\n * }\n * ```\n *\n * @param expression\n * @param defaultValue\n * @returns {(targetClass: any, attributeName: string) => any}\n * @decorator\n */\nexport function Value(expression: string, defaultValue?: unknown): PropertyDecorator {\n return (target, propertyKey) => {\n return bindValue(target, propertyKey, expression, defaultValue);\n };\n}\n","import {injector} from \"./injector.js\";\n\n/**\n * Get a value from the `injector.settings`.\n *\n * ## Example\n *\n * ```ts\n * import {refValue, Injectable} from \"@tsed/di\";\n *\n * @Injectable()\n * class Test {\n * test = refValue(\"logger.level\", \"default value\");\n *\n * constructor() {\n * console.log(this.test.value); // \"off\"\n * }\n * }\n *\n * @param expression The expression to get the value from the `injector.settings`.\n */\nexport function refValue<Type>(expression: string): {value: Type | undefined};\nexport function refValue<Type>(expression: string, defaultValue: Type | undefined): {value: Type};\nexport function refValue<Type>(expression: string, defaultValue?: Type | undefined): {value: Type | undefined} {\n return Object.freeze({\n get value() {\n return injector().settings.get(expression, defaultValue);\n },\n set value(value: Type) {\n injector().settings.set(expression, value);\n }\n });\n}\n","import {injectable} from \"../fn/injectable.js\";\nimport {injector} from \"../fn/injector.js\";\nimport {DILogger} from \"../interfaces/DILogger.js\";\n\nexport const LOGGER = Symbol.for(\"LOGGER\");\nexport type LOGGER = DILogger;\n\ninjectable(LOGGER).factory(() => injector().logger);\n","import {Store, Type} from \"@tsed/core\";\n\nexport function mergeMount(m1: any = {}, m2: any = {}) {\n return Object.entries(m2).reduce((mount, [key, controllers]) => {\n return {\n ...mount,\n [key]: (mount[key] || []).concat(controllers)\n };\n }, m1);\n}\n\nexport function getConfiguration(module: Type<any>, configuration: any = {}) {\n const store = Store.from(module).get(\"configuration\") || {};\n\n return {\n ...store,\n ...configuration,\n mount: mergeMount(store.mount, configuration.mount)\n };\n}\n"],"names":["root","factory","exports","module","require","define","amd","self","__WEBPACK_EXTERNAL_MODULE__414__","__WEBPACK_EXTERNAL_MODULE__171__","__WEBPACK_EXTERNAL_MODULE__538__","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","DI_INVOKE_OPTIONS","DI_INJECTABLE_PROPS","DI_USE_OPTIONS","DI_USE_PARAM_OPTIONS","DI_INTERCEPTOR_OPTIONS","ProviderScope","ProviderType","LocalsContainer","Map","hooks","Hooks","destroy","this","asyncEmit","discoverHooks","token","methodsOf","reduce","propertyKey","String","startsWith","listener","instance","args","Provider","constructor","options","type","PROVIDER","useClass","assign","getClassOrSymbol","Store","from","provide","isClass","classOf","className","name","nameOf","store","path","set","scope","isAsync","SINGLETON","configuration","children","getArgOpts","index","defaultValue","useAsyncFactory","clone","hasChildren","length","hasParent","toString","useFactory","useValue","filter","Boolean","join","reset","GlobalProviderRegistry","super","has","metadata","merge","target","global","GlobalProviders","createProvider","meta","createIfNotExists","keys","forEach","delete","createRegistry","model","defaultOptions","getRegistrySettings","provider","item","Container","add","settings","addProvider","hasProvider","setProvider","getProvider","getProviders","types","concat","map","providers","_","includes","addProviders","container","colorIfAllowed","colorFn","text","process","env","NO_COLOR","colors","red","yellow","green","InjectionError","Error","origin","isString","tokens","message","stack","originMessage","tokensMessage","throwInjectorError","currentDependency","error","erroredArg","getConstructorArgNames","arg","deps","signature","indexOf","repeat","drawline","printDependencyInjectionError","createContainer","rootModule","entries","getConstructorDependencies","Metadata","getOwn","getParamTypes","setConstructorDependencies","CONFIGURATION","for","DIConfiguration","initialProps","default","imports","routes","logger","version","v","rootDir","debug","level","callbackfn","thisArg","Set","Array","getRaw","Reflect","setRaw","setValue","getValue","EXCLUDED_CONFIGURATION_KEYS","InjectorService","console","resolvedConfiguration","isLoaded","toArray","values","resolve","getMany","alias","locals","useOpts","rebuild","ensureProvider","invokeToken","setToCache","registerHooks","REQUEST","invoke","loadAsync","loadSync","load","$asyncEmit","bootstrap","resolveConfiguration","mergedConfiguration","deepMerge","deepClone","emit","eventName","alter","$alter","alterAsync","$asyncAlter","$off","resolveImportsProviders","force","resolvedOpts","mapInvokeOptions","construct","$emit","invokeDependency","parent","isArray","isInheritedFrom","services","isObject","props","use","isFunction","async","Promise","all","$onDestroy","on","event","cb","$on","isPromise","then","globalInjector","injector","destroyInjector","AutoInjectable","constr","inj","list","Math","max","i","push","resolveAutoInjectableArgs","ControllerProvider","CONTROLLER","middlewares","useAfter","useBefore","mdlwrs","a","b","registerProvider","opts","injectable","inspect","providerBuilder","baseOpts","merged","acc","asyncFactory","VALUE","k","Props","interceptor","INTERCEPTOR","controller","InvalidPropertyTokenError","globalLocals","globalInvOpts","stagedLocals","localsContainer","p","invokeOptions","detachLocalsContainer","cleanAllLocalsContainer","clear","inject","injectMany","Inject","transform","decoratorTypeOf","DecoratorTypes","PARAM_CTOR","parameterIndex","paramTypes","setParamTypes","setToken","PROP","symbol","configurable","catchError","deleteProperty","useType","getType","getTokenType","originalType","invokeOpts","result","bindInjectableProperty","Configuration","CLASS","constant","expression","bindConstant","freeze","Constant","InjectablePropertyType","Controller","RegExp","isArrayOrArrayClass","mapOptions","useDecorators","Path","Children","Injectable","getInterceptorOptions","fromMethod","bindIntercept","klass","descriptor","getOwnPropertyDescriptor","originalMethod","next","err","apply","context","intercept","Intercept","decorateMethodsOf","METHOD","Interceptor","lazyInject","instanceWithHook","$onInit","optionalLazyInject","er","optional","wrap","resolver","LazyInject","OptionalLazyInject","Module","scopes","MODULE","Scope","StoreSet","Opts","INSTANCE","OverrideProvider","originalProvider","Service","UseOpts","UnsupportedDecoratorType","bindValue","Value","refValue","LOGGER","mergeMount","m1","m2","mount","controllers","getConfiguration"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"di.umd.min.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,cAAeA,QAAQ,eAAgBA,QAAQ,iBACvD,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,aAAc,cAAe,gBAAiBJ,GAC5B,iBAAZC,QACdA,QAAQ,YAAcD,EAAQG,QAAQ,cAAeA,QAAQ,eAAgBA,QAAQ,iBAErFJ,EAAK,YAAcC,EAAQD,EAAK,cAAeA,EAAK,eAAgBA,EAAK,gBAC1E,CATD,CASGO,MAAM,CAACC,EAAkCC,EAAkCC,I,kCCT9EP,EAAOD,QAAUM,C,UCAjBL,EAAOD,QAAUO,C,UCAjBN,EAAOD,QAAUQ,C,GCCbC,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaZ,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AAI6S,EAAYjP,GAE7C,GAAAR,CAAI3C,GACF8N,IAAWxI,SAAS3C,IAAIyP,EAAYpS,EACtC,EACAV,YAAY,EACZiS,cAAc,IAGhB,IAAAC,aAAW,IAAM3H,QAAQ4H,eAAepN,EAAQlD,MAChD,IAAAqQ,aAAW,IAAM3H,QAAQxK,eAAegF,EAAQlD,EAAakS,IAC/D,CAqCO,SAASmC,GAAMpD,EAAoBjP,GACxC,MAAO,CAACkB,EAAQlD,IACPoU,GAAUlR,EAAQlD,EAAaiR,EAAYjP,EAEtD,CCpCO,SAASsS,GAAerD,EAAoBjP,GACjD,OAAO/D,OAAOkT,OAAO,CACnB,SAAItS,GACF,OAAO8N,IAAWxI,SAAS/F,IAAI6S,EAAYjP,EAC7C,EACA,SAAInD,CAAMA,GACR8N,IAAWxI,SAAS3C,IAAIyP,EAAYpS,EACtC,GAEJ,EdhCA,SAAYwS,GACV,kBACA,sBACA,sBACA,gBACA,2BACD,CAND,CAAYA,KAAAA,GAAsB,KeI3B,MAAMkD,GAAS5V,OAAO8I,IAAI,UCF1B,SAAS+M,GAAWC,EAAU,CAAC,EAAGC,EAAU,CAAC,GAClD,OAAOzW,OAAOiJ,QAAQwN,GAAI3U,QAAO,CAAC4U,GAAQ5W,EAAK6W,MACtC,IACFD,EACH,CAAC5W,IAAO4W,EAAM5W,IAAQ,IAAI2G,OAAOkQ,MAElCH,EACL,CAEO,SAASI,GAAiB9X,EAAmB6E,EAAqB,CAAC,GACxE,MAAMN,EAAQ,EAAAR,MAAMC,KAAKhE,GAAQqB,IAAI,kBAAoB,CAAC,EAE1D,MAAO,IACFkD,KACAM,EACH+S,MAAOH,GAAWlT,EAAMqT,MAAO/S,EAAc+S,OAEjD,C,ODZA3G,EAAWuG,IAAQ1X,SAAQ,IAAM8P,IAAW5E,S","sources":["webpack://@tsed/di/webpack/universalModuleDefinition","webpack://@tsed/di/external umd \"@tsed/core\"","webpack://@tsed/di/external umd \"@tsed/hooks\"","webpack://@tsed/di/external umd \"@tsed/schema\"","webpack://@tsed/di/webpack/bootstrap","webpack://@tsed/di/webpack/runtime/define property getters","webpack://@tsed/di/webpack/runtime/hasOwnProperty shorthand","webpack://@tsed/di/webpack/runtime/make namespace object","webpack://@tsed/di/./src/common/constants/constants.ts","webpack://@tsed/di/./src/common/domain/ProviderScope.ts","webpack://@tsed/di/./src/common/domain/ProviderType.ts","webpack://@tsed/di/./src/common/domain/LocalsContainer.ts","webpack://@tsed/di/./src/common/utils/discoverHooks.ts","webpack://@tsed/di/./src/common/domain/Provider.ts","webpack://@tsed/di/./src/common/registries/GlobalProviders.ts","webpack://@tsed/di/./src/common/domain/Container.ts","webpack://@tsed/di/./src/common/utils/colors.ts","webpack://@tsed/di/./src/common/errors/InjectionError.ts","webpack://@tsed/di/./src/common/utils/createContainer.ts","webpack://@tsed/di/./src/common/utils/getConstructorDependencies.ts","webpack://@tsed/di/./src/common/services/DIConfiguration.ts","webpack://@tsed/di/./src/common/services/InjectorService.ts","webpack://@tsed/di/./src/common/fn/injector.ts","webpack://@tsed/di/./src/common/decorators/autoInjectable.ts","webpack://@tsed/di/./src/common/fn/configuration.ts","webpack://@tsed/di/./src/common/domain/ControllerProvider.ts","webpack://@tsed/di/./src/common/registries/ProviderRegistry.ts","webpack://@tsed/di/./src/common/utils/providerBuilder.ts","webpack://@tsed/di/./src/common/fn/injectable.ts","webpack://@tsed/di/./src/common/errors/InvalidPropertyTokenError.ts","webpack://@tsed/di/./src/common/fn/localsContainer.ts","webpack://@tsed/di/./src/common/fn/inject.ts","webpack://@tsed/di/./src/common/fn/injectMany.ts","webpack://@tsed/di/./src/common/decorators/inject.ts","webpack://@tsed/di/./src/common/decorators/configuration.ts","webpack://@tsed/di/./src/common/fn/constant.ts","webpack://@tsed/di/./src/common/decorators/constant.ts","webpack://@tsed/di/./src/common/domain/InjectablePropertyType.ts","webpack://@tsed/di/./src/common/decorators/controller.ts","webpack://@tsed/di/./src/common/decorators/injectable.ts","webpack://@tsed/di/./src/common/decorators/intercept.ts","webpack://@tsed/di/./src/common/decorators/interceptor.ts","webpack://@tsed/di/./src/common/fn/lazyInject.ts","webpack://@tsed/di/./src/common/decorators/lazyInject.ts","webpack://@tsed/di/./src/common/decorators/module.ts","webpack://@tsed/di/./src/common/decorators/scope.ts","webpack://@tsed/di/./src/common/decorators/opts.ts","webpack://@tsed/di/./src/common/decorators/overrideProvider.ts","webpack://@tsed/di/./src/common/decorators/service.ts","webpack://@tsed/di/./src/common/decorators/useOpts.ts","webpack://@tsed/di/./src/common/decorators/value.ts","webpack://@tsed/di/./src/common/fn/refValue.ts","webpack://@tsed/di/./src/common/services/DILogger.ts","webpack://@tsed/di/./src/common/utils/getConfiguration.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@tsed/core\"), require(\"@tsed/hooks\"), require(\"@tsed/schema\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"@tsed/core\", \"@tsed/hooks\", \"@tsed/schema\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@tsed/di\"] = factory(require(\"@tsed/core\"), require(\"@tsed/hooks\"), require(\"@tsed/schema\"));\n\telse\n\t\troot[\"@tsed/di\"] = factory(root[\"@tsed/core\"], root[\"@tsed/hooks\"], root[\"@tsed/schema\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__414__, __WEBPACK_EXTERNAL_MODULE__171__, __WEBPACK_EXTERNAL_MODULE__538__) => {\nreturn ","module.exports = __WEBPACK_EXTERNAL_MODULE__414__;","module.exports = __WEBPACK_EXTERNAL_MODULE__171__;","module.exports = __WEBPACK_EXTERNAL_MODULE__538__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export const DI_INVOKE_OPTIONS = Symbol(\"DI_INVOKE_OPTIONS\");\nexport const DI_INJECTABLE_PROPS = Symbol(\"DI_INJECTABLE_PROPS\");\nexport const DI_USE_OPTIONS = \"DI_USE_OPTIONS\";\nexport const DI_USE_PARAM_OPTIONS = \"DI_USE_PARAM_OPTIONS\";\nexport const DI_INTERCEPTOR_OPTIONS = \"DI_INTERCEPTOR_OPTIONS\";\n","export enum ProviderScope {\n SINGLETON = \"singleton\",\n REQUEST = \"request\",\n INSTANCE = \"instance\"\n}\n","export enum ProviderType {\n VALUE = \"value\",\n PROVIDER = \"provider\",\n MODULE = \"module\",\n CONTROLLER = \"controller\",\n INTERCEPTOR = \"interceptor\",\n MIDDLEWARE = \"middleware\"\n}\n","import {Hooks} from \"@tsed/hooks\";\n\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\n\nexport class LocalsContainer extends Map<TokenProvider, any> {\n readonly hooks = new Hooks();\n\n async destroy() {\n await this.hooks.asyncEmit(\"$onDestroy\");\n }\n}\n","import {type AbstractType, methodsOf, type Type} from \"@tsed/core\";\n\nexport function discoverHooks(token: Type | AbstractType<any>) {\n return methodsOf(token).reduce((hooks, {propertyKey}) => {\n if (String(propertyKey).startsWith(\"$\")) {\n const listener = (instance: any, ...args: any[]) => instance?.[propertyKey](...args);\n\n return {\n ...hooks,\n [propertyKey]: listener\n };\n }\n return hooks;\n }, {} as any);\n}\n","import {type AbstractType, classOf, getClassOrSymbol, isClass, nameOf, Store, Type} from \"@tsed/core\";\n\nimport {DI_USE_PARAM_OPTIONS} from \"../constants/constants.js\";\nimport type {ProviderOpts} from \"../interfaces/ProviderOpts.js\";\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {discoverHooks} from \"../utils/discoverHooks.js\";\nimport {ProviderScope} from \"./ProviderScope.js\";\nimport {ProviderType} from \"./ProviderType.js\";\n\nexport type ProviderHookCallback<T = any> = (instance: T, ...args: unknown[]) => Promise<void> | void;\n\nexport class Provider<T = any> implements ProviderOpts<T> {\n /**\n * Token group provider to retrieve all provider from the same type\n */\n public type: ProviderType | TokenProvider = ProviderType.PROVIDER;\n public deps: TokenProvider[];\n public imports: (TokenProvider | [TokenProvider])[];\n public alias: string;\n public priority: number;\n public useFactory?: Function;\n public useAsyncFactory?: Function;\n public useValue?: unknown;\n public hooks: Record<string, ProviderHookCallback<T>> = {};\n #useClass: Type<T>;\n #token: TokenProvider;\n #store: Store;\n #tokenStore: Store;\n\n [key: string]: any;\n\n constructor(token: TokenProvider<T>, options: Partial<Provider> = {}) {\n this.token = token;\n this.useClass = token as Type<T>;\n\n Object.assign(this, options);\n\n if (options instanceof Provider) {\n this.#useClass = options.#useClass;\n this.#store = options.#store;\n this.#tokenStore = options.#tokenStore;\n }\n }\n\n get token() {\n return this.#token;\n }\n\n set token(value: TokenProvider) {\n if (value) {\n this.#token = getClassOrSymbol(value);\n this.#tokenStore = this.#store = Store.from(value);\n }\n }\n\n /**\n * @deprecated\n */\n get provide(): TokenProvider {\n return this.token;\n }\n\n /**\n * @deprecated\n * @param value\n */\n set provide(value: TokenProvider) {\n this.token = value;\n }\n\n get useClass(): Type<T> {\n return this.#useClass;\n }\n\n /**\n * Create a new store if the given value is a class. Otherwise, the value is ignored.\n * @param value\n */\n set useClass(value: Type<T> | AbstractType<T>) {\n if (isClass(value)) {\n this.#useClass = classOf(value);\n this.#store = Store.from(value);\n this.hooks = discoverHooks(this.#useClass);\n }\n }\n\n get className() {\n return this.name;\n }\n\n get name() {\n return nameOf(this.token);\n }\n\n get store(): Store {\n return this.#store;\n }\n\n get path() {\n return this.store.get(\"path\", \"/\");\n }\n\n set path(path: string) {\n this.store.set(\"path\", path);\n }\n\n /**\n * Get the scope of the provider.\n *\n * ::: tip Note\n * Async provider is always a SINGLETON\n * :::\n *\n * @returns {boolean}\n */\n get scope(): ProviderScope {\n if (this.isAsync()) {\n return ProviderScope.SINGLETON;\n }\n\n return this.get<ProviderScope>(\"scope\", ProviderScope.SINGLETON);\n }\n\n /**\n * Change the scope value of the provider.\n * @param scope\n */\n set scope(scope: ProviderScope) {\n this.store.set(\"scope\", scope);\n }\n\n get configuration(): Partial<TsED.Configuration> {\n return this.get(\"configuration\")!;\n }\n\n set configuration(configuration: Partial<TsED.Configuration>) {\n this.store.set(\"configuration\", configuration);\n }\n\n get children(): TokenProvider[] {\n return this.store.get(\"childrenControllers\", []);\n }\n\n set children(children: TokenProvider[]) {\n this.store.set(\"childrenControllers\", children);\n }\n\n getArgOpts(index: number) {\n return this.store.get(`${DI_USE_PARAM_OPTIONS}:${index}`);\n }\n\n /**\n * Retrieves a value from the provider's store.\n * @param key The key to look up\n * @returns The value if found, undefined otherwise\n */\n get<Type = unknown>(key: string): Type | undefined;\n /**\n * Retrieves a value from the provider's store with a default fallback.\n * @param key The key to look up\n * @param defaultValue The value to return if key is not found\n * @returns The found value or defaultValue\n */\n get<Type = unknown>(key: string, defaultValue: Type): Type;\n get<Type = unknown>(key: string, defaultValue?: Type): Type | undefined {\n return this.store.get(key) || this.#tokenStore.get(key) || defaultValue;\n }\n\n isAsync(): boolean {\n return !!this.useAsyncFactory;\n }\n\n clone(): Provider {\n return new (classOf(this))(this.token, this);\n }\n\n /**\n *\n * @returns {boolean}\n */\n public hasChildren(): boolean {\n return !!this.children.length;\n }\n\n /**\n *\n * @returns {boolean}\n */\n public hasParent(): boolean {\n return !!this.store.get(\"parentController\");\n }\n\n toString() {\n return [\n \"Token\",\n this.name,\n this.useClass && nameOf(this.useClass),\n this.useFactory && \"Factory\",\n this.useValue && \"Value\",\n this.useAsyncFactory && \"AsyncFactory\"\n ]\n .filter(Boolean)\n .join(\":\");\n }\n\n reset() {\n this.useValue = undefined;\n this.useFactory = undefined;\n this.useAsyncFactory = undefined;\n\n return this;\n }\n}\n","import {getClassOrSymbol, Type} from \"@tsed/core\";\n\nimport {Provider} from \"../domain/Provider.js\";\nimport {ProviderType} from \"../domain/ProviderType.js\";\nimport {ProviderOpts} from \"../interfaces/ProviderOpts.js\";\nimport {RegistrySettings} from \"../interfaces/RegistrySettings.js\";\nimport {TokenProvider} from \"../interfaces/TokenProvider.js\";\n\nexport class GlobalProviderRegistry extends Map<TokenProvider, Provider> {\n #settings: Map<TokenProvider, RegistrySettings> = new Map();\n\n /**\n * The get() method returns a specified element from a Map object.\n * @param key Required. The key of the element to return from the Map object.\n * @returns {T} Returns the element associated with the specified key or undefined if the key can't be found in the Map object.\n */\n get(key: TokenProvider): Provider | undefined {\n return super.get(getClassOrSymbol(key));\n }\n\n /**\n * The has() method returns a boolean indicating whether an element with the specified key exists or not.\n * @param key\n * @returns {boolean}\n */\n has(key: TokenProvider): boolean {\n return super.has(getClassOrSymbol(key));\n }\n\n /**\n * The set() method adds or updates an element with a specified key and value to a Map object.\n * @param key Required. The key of the element to add to the Map object.\n * @param metadata Required. The value of the element to add to the Map object.\n */\n set(key: TokenProvider, metadata: Provider): this {\n super.set(getClassOrSymbol(key), metadata);\n\n return this;\n }\n\n /**\n *\n * @param target\n * @param options\n */\n merge(target: TokenProvider, options: Partial<ProviderOpts>) {\n if (options.global === false) {\n return GlobalProviders.createProvider(target, options);\n }\n\n const meta = this.createIfNotExists(target, options);\n\n Object.keys(options).forEach((key) => {\n meta[key] = (options as never)[key];\n });\n\n this.set(target, meta);\n\n return meta;\n }\n\n /**\n * The delete() method removes the specified element from a Map object.\n * @param key Required. The key of the element to remove from the Map object.\n * @returns {boolean} Returns true if an element in the Map object existed and has been removed, or false if the element does not exist.\n */\n delete(key: TokenProvider): boolean {\n return super.delete(getClassOrSymbol(key));\n }\n\n createRegistry(type: string | symbol, model: Type<Provider>, options: Partial<RegistrySettings> = {}) {\n const defaultOptions = this.getRegistrySettings(type);\n\n options = Object.assign(defaultOptions, {\n ...options,\n model\n });\n\n this.#settings.set(type, options);\n\n return this;\n }\n\n getRegistrySettings(target: TokenProvider): RegistrySettings {\n let type: TokenProvider | ProviderType = ProviderType.PROVIDER;\n\n if (typeof target === \"string\") {\n type = target;\n } else {\n const provider = this.get(target);\n if (provider) {\n type = provider.type;\n }\n }\n\n return (\n this.#settings.get(type) || {\n model: Provider\n }\n );\n }\n\n protected createProvider(key: TokenProvider, options: Partial<ProviderOpts<any>>) {\n const type = options.type || ProviderType.PROVIDER;\n const {model = Provider} = this.#settings.get(type) || {};\n\n return new model(key, options);\n }\n\n /**\n *\n * @param key\n * @param options\n */\n protected createIfNotExists(key: TokenProvider, options: Partial<ProviderOpts>): Provider {\n if (!this.has(key)) {\n const item = this.createProvider(key, options);\n\n this.set(key, item);\n }\n\n return this.get(key)!;\n }\n}\n\n/**\n *\n * @type {GlobalProviders}\n */\n// tslint:disable-next-line: variable-name\nexport const GlobalProviders = new GlobalProviderRegistry();\n","import type {ProviderOpts} from \"../interfaces/ProviderOpts.js\";\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {GlobalProviders} from \"../registries/GlobalProviders.js\";\nimport {Provider} from \"./Provider.js\";\nimport type {ProviderType} from \"./ProviderType.js\";\n\nexport class Container extends Map<TokenProvider, Provider> {\n /**\n *\n * @param token\n * @param settings\n */\n public add(token: TokenProvider, settings: Partial<ProviderOpts> = {}): this {\n const provider = GlobalProviders.get(token)?.clone() || new Provider(token);\n\n Object.assign(provider, settings);\n\n return super.set(token, provider);\n }\n\n /**\n * Add a provider to the\n * @param token\n * @param settings\n */\n public addProvider(token: TokenProvider, settings: Partial<ProviderOpts> = {}): this {\n return this.add(token, settings);\n }\n\n /**\n *\n * @param token\n */\n public hasProvider(token: TokenProvider) {\n return super.has(token);\n }\n\n /**\n * Add a provider to the\n * @param token\n * @param provider\n */\n public setProvider(token: TokenProvider, provider: Provider) {\n return super.set(token, provider);\n }\n\n /**\n * The getProvider() method returns a specified element from a Map object.\n * @returns {T} Returns the element associated with the specified key or undefined if the key can't be found in the Map object.\n * @param token\n */\n public getProvider<T extends Provider = Provider>(token: TokenProvider | undefined): T | undefined {\n return super.get(token!) as T;\n }\n\n /**\n * Get all providers registered in the injector container.\n *\n * @param type Filter the list by the given ProviderType.\n * @returns {[TokenProvider , Provider<any>][]}\n */\n public getProviders(type?: TokenProvider | ProviderType | string | string[]): Provider[] {\n const types = ([] as (string | ProviderType)[]).concat(type as never).map(String);\n\n return [...this].reduce((providers, [_, provider]) => {\n if (types.includes(String(provider.type)) || !type) {\n return [...providers, provider];\n }\n return providers;\n }, []);\n }\n\n public addProviders(container: Map<TokenProvider, Provider>) {\n container.forEach((provider) => {\n if (!this.hasProvider(provider.token)) {\n this.setProvider(provider.token, provider.clone());\n }\n });\n }\n}\n","type ColorTextFn = (text: string) => string;\n\n// istanbul ignore next\nconst colorIfAllowed = (colorFn: ColorTextFn) => (text: string) =>\n !process.env.NO_COLOR && process.env.NODE_ENV !== \"production\" ? colorFn(text) : text;\n\nconst red = colorIfAllowed((text: string) => `\\x1B[31m${text}\\x1B[39m`);\nconst yellow = colorIfAllowed((text: string) => `\\x1B[33m${text}\\x1B[39m`);\nconst green = colorIfAllowed((text: string) => `\\x1B[32m${text}\\x1B[39m`);\n\nexport const colors = {red, yellow, green};\n","import {getConstructorArgNames, isClass, isString, nameOf} from \"@tsed/core\";\n\nimport {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {colors} from \"../utils/colors.js\";\n\nexport class InjectionError extends Error {\n name = \"INJECTION_ERROR\";\n\n public tokens: TokenProvider[] = [];\n public origin: any;\n\n constructor(token: TokenProvider, origin?: any) {\n super(isString(origin) ? origin : \"\");\n\n this.tokens = [token];\n\n if (origin) {\n if (isString(origin)) {\n this.origin = {\n message: origin,\n stack: this.stack\n };\n } else {\n if (origin.tokens) {\n this.tokens = this.tokens.concat(origin.tokens);\n this.origin = origin.origin;\n } else {\n this.origin = origin;\n this.stack = origin.stack;\n }\n }\n }\n\n const originMessage = this.origin ? \"\\nOrigin: \" + this.origin.message : \"\";\n const tokensMessage = this.tokens.map((token) => nameOf(token)).join(\" > \");\n\n this.message = `Injection failed on ${tokensMessage}${originMessage}`;\n }\n\n static throwInjectorError(token: any, currentDependency: any, error: any) {\n if (currentDependency && isClass(token)) {\n error.message = printDependencyInjectionError(token, {...currentDependency, message: error.message});\n }\n\n throw new InjectionError(token, error);\n }\n}\n\nfunction printDependencyInjectionError(token: any, options: {token: any; index: number; deps: any[]; message: string}) {\n let erroredArg = \"\";\n\n const args = getConstructorArgNames(token)\n .map((arg, index) => {\n if (options.index === index) {\n erroredArg = arg;\n arg = colors.red(arg);\n }\n\n return `${arg}: ${nameOf(options.deps[index])}`;\n })\n .join(\", \");\n\n const signature = nameOf(token) + \"->constructor(\" + args + \")\";\n const indexOf = signature.indexOf(erroredArg) - 5;\n const drawline = (indexOf: number) => \" \".repeat(indexOf) + colors.red(\"^\" + \"‾\".repeat(erroredArg.length - 1));\n\n return \"Unable to inject dependency. \" + options.message + \"\\n\\n\" + signature + \"\\n\" + (indexOf > -1 ? drawline(indexOf) : \"\");\n}\n","import {Type} from \"@tsed/core\";\n\nimport {Container} from \"../domain/Container.js\";\nimport {GlobalProviders} from \"../registries/GlobalProviders.js\";\n\nexport function createContainer(rootModule?: Type<any>) {\n const container = new Container(GlobalProviders.entries());\n\n if (rootModule) {\n container.delete(rootModule);\n }\n\n return container;\n}\n","import {Metadata} from \"@tsed/core\";\n\nexport function getConstructorDependencies(target: any, propertyKey?: string | symbol | undefined) {\n return Metadata.getOwn(\"override:ctor:design:paramtypes\", target, propertyKey) || [...Metadata.getParamTypes(target, propertyKey)] || [];\n}\n\nexport function setConstructorDependencies(target: any, deps: any[]) {\n Metadata.set(\"override:ctor:design:paramtypes\", deps, target);\n}\n","import {Env, getValue, setValue} from \"@tsed/core\";\n\nimport type {DILoggerOptions} from \"../interfaces/DILoggerOptions.js\";\nimport type {ImportTokenProviderOpts} from \"../interfaces/ImportTokenProviderOpts.js\";\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport type {TokenRoute} from \"../interfaces/TokenRoute.js\";\n\nexport const CONFIGURATION = Symbol.for(\"CONFIGURATION\");\n\nexport class DIConfiguration {\n readonly default: Map<string, any> = new Map();\n protected map: Map<string, any> = new Map();\n\n constructor(initialProps = {}) {\n Object.entries({\n imports: [],\n routes: [],\n logger: {},\n ...initialProps\n }).forEach(([key, value]) => {\n this.default.set(key, value);\n });\n }\n\n get version() {\n return this.get(\"version\")!;\n }\n\n set version(v: string) {\n this.map.set(\"version\", v);\n }\n\n get rootDir() {\n return this.get(\"rootDir\")!;\n }\n\n set rootDir(value: string) {\n this.map.set(\"rootDir\", value);\n }\n\n get env(): Env {\n return this.map.get(\"env\");\n }\n\n set env(value: Env) {\n this.map.set(\"env\", value);\n }\n\n get imports(): (TokenProvider | ImportTokenProviderOpts)[] {\n return this.get(\"imports\")!;\n }\n\n set imports(imports: (TokenProvider | ImportTokenProviderOpts)[]) {\n this.map.set(\"imports\", imports);\n }\n\n get routes(): TokenRoute[] {\n return this.get(\"routes\")!;\n }\n\n set routes(routes: TokenRoute[]) {\n this.map.set(\"routes\", routes);\n }\n\n get logger(): Partial<DILoggerOptions> {\n return this.get(\"logger\")!;\n }\n\n set logger(value: Partial<DILoggerOptions>) {\n const logger = {...this.logger, ...value};\n this.map.set(\"logger\", logger);\n }\n\n get debug(): boolean {\n return this.logger.level === \"debug\";\n }\n\n set debug(debug: boolean) {\n this.logger = {...this.logger, level: debug ? \"debug\" : \"info\"};\n }\n\n /**\n *\n * @param callbackfn\n * @param thisArg\n */\n forEach(callbackfn: (value: any, index: string, map: Map<string, any>) => void, thisArg?: any) {\n return new Set([...Array.from(this.default.keys()), ...Array.from(this.map.keys())]).forEach((key) => {\n callbackfn(this.getRaw(key), key, this.map);\n }, thisArg);\n }\n\n /**\n *\n * @param propertyKey\n * @param value\n */\n set(propertyKey: string | Partial<TsED.Configuration>, value?: any): this {\n if (typeof propertyKey === \"string\") {\n if (Reflect.has(this, propertyKey)) {\n // @ts-ignore\n this[propertyKey] = value;\n } else {\n this.setRaw(propertyKey, value);\n }\n } else {\n Object.entries(propertyKey).forEach(([key, value]) => {\n this.set(key, value);\n });\n }\n\n return this;\n }\n\n setRaw(propertyKey: string, value: any) {\n setValue(this.map, propertyKey, value);\n\n return this;\n }\n\n /**\n *\n * @param propertyKey\n * @param defaultValue\n * @returns {undefined|any}\n */\n get<T = any>(propertyKey: string, defaultValue?: T): T {\n return this.getRaw(propertyKey, defaultValue);\n }\n\n protected getRaw(propertyKey: string, defaultValue?: any): any {\n const value = getValue(this.map, propertyKey);\n\n if (value !== undefined) {\n return value;\n }\n\n return getValue(this.default, propertyKey, defaultValue);\n }\n}\n","import {classOf, deepClone, deepMerge, isArray, isClass, isFunction, isInheritedFrom, isObject, isPromise, nameOf} from \"@tsed/core\";\nimport {$alter, $asyncAlter, $asyncEmit, $emit, $off, $on} from \"@tsed/hooks\";\n\nimport {DI_INVOKE_OPTIONS, DI_USE_PARAM_OPTIONS} from \"../constants/constants.js\";\nimport {Container} from \"../domain/Container.js\";\nimport {LocalsContainer} from \"../domain/LocalsContainer.js\";\nimport {Provider} from \"../domain/Provider.js\";\nimport {ProviderScope} from \"../domain/ProviderScope.js\";\nimport {InjectionError} from \"../errors/InjectionError.js\";\nimport type {DILogger} from \"../interfaces/DILogger.js\";\nimport type {ImportTokenProviderOpts} from \"../interfaces/ImportTokenProviderOpts.js\";\nimport type {InvokeOptions} from \"../interfaces/InvokeOptions.js\";\nimport type {ResolvedInvokeOptions} from \"../interfaces/ResolvedInvokeOptions.js\";\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {GlobalProviders} from \"../registries/GlobalProviders.js\";\nimport {createContainer} from \"../utils/createContainer.js\";\nimport {getConstructorDependencies} from \"../utils/getConstructorDependencies.js\";\nimport {DIConfiguration} from \"./DIConfiguration.js\";\n\nconst EXCLUDED_CONFIGURATION_KEYS = [\"mount\", \"imports\"];\n\n/**\n * This service contain all services collected by `@Service` or services declared manually with `InjectorService.factory()` or `InjectorService.service()`.\n *\n * ### Example:\n *\n * ```typescript\n * import {InjectorService} from \"@tsed/di\";\n *\n * // Import the services (all services are decorated with @Service()\";\n * import MyService1 from \"./services/service1.js\";\n * import MyService2 from \"./services/service2.js\";\n * import MyService3 from \"./services/service3.js\";\n *\n * // When all services are imported, you can load InjectorService.\n *\n * await injector().load();\n *\n * const myService1 = injector.get<MyService1>(MyService1);\n * ```\n */\nexport class InjectorService extends Container {\n public logger: DILogger = console;\n private resolvedConfiguration: boolean = false;\n #cache = new LocalsContainer();\n #loaded: boolean = false;\n\n constructor() {\n super();\n this.#cache.set(InjectorService, this);\n this.#cache.set(DIConfiguration, new DIConfiguration());\n }\n\n get settings(): DIConfiguration {\n return this.#cache.get(DIConfiguration);\n }\n\n set settings(settings: DIConfiguration) {\n this.#cache.set(DIConfiguration, settings);\n }\n\n isLoaded() {\n return this.#loaded;\n }\n\n /**\n * Return a list of instance build by the injector.\n */\n public toArray(): any[] {\n return [...this.#cache.values()];\n }\n\n /**\n * Get a service or factory already constructed from his symbol or class.\n *\n * #### Example\n *\n * ```typescript\n * import {InjectorService} from \"@tsed/di\";\n * import MyService from \"./services.js\";\n *\n * class OtherService {\n * constructor(injectorService: InjectorService) {\n * const myService = injectorService.get<MyService>(MyService);\n * }\n * }\n * ```\n *\n * @param token The class or symbol registered in InjectorService.\n * @param options\n */\n get<T = any>(token: TokenProvider<T>, options?: Partial<InvokeOptions>): T {\n if (!this.has(token)) {\n return this.resolve(token, options);\n }\n\n return this.#cache.get(token);\n }\n\n /**\n * Return all instance of the same provider type\n */\n getMany<Type = any>(type: any, options?: Partial<InvokeOptions>): Type[] {\n return this.getProviders(type).map((provider) => {\n return this.resolve<Type>(provider.token, options);\n });\n }\n\n /**\n * The has() method returns a boolean indicating whether an element with the specified key exists or not.\n */\n has(token: TokenProvider): boolean {\n return this.#cache.get(token) !== undefined;\n }\n\n /**\n * Declare an alias for a given token.\n */\n alias(token: TokenProvider, alias: TokenProvider) {\n this.#cache.set(alias, this.#cache.get(token));\n\n return this;\n }\n\n /**\n * Resolve the token depending on his provider configuration.\n *\n * If the token isn't cached, the injector will invoke the provider and cache the result.\n *\n * #### Example\n *\n * ```typescript\n * import {InjectorService} from \"@tsed/di\";\n * import MyService from \"./services.js\";\n *\n * class OtherService {\n * constructor(injectorService: InjectorService) {\n * const myService = injectorService.invoke<MyService>(MyService);\n * }\n * }\n * ```\n *\n * @param token The injectable class to invoke. Class parameters are injected according constructor signature.\n * @param options {InvokeOptions} Optional options to invoke the class.\n * @returns {Type} The class constructed.\n */\n public resolve<Type = any>(token: TokenProvider<Type>, options: Partial<InvokeOptions> = {}): Type {\n let instance: any = options.locals ? options.locals.get(token) : undefined;\n\n if (instance !== undefined) {\n return instance;\n }\n\n if (token === DI_USE_PARAM_OPTIONS) {\n return options.useOpts as Type;\n }\n\n instance = !options.rebuild ? this.#cache.get(token) : undefined;\n\n if (instance != undefined) {\n return instance;\n }\n\n const provider = this.ensureProvider(token);\n\n // maybe not necessary\n if (!provider || options.rebuild) {\n instance = this.invokeToken(token, options);\n\n if (provider) {\n return this.setToCache(provider!, instance);\n }\n\n return instance;\n }\n\n instance = this.invokeToken(token, options);\n\n switch (provider.scope) {\n case ProviderScope.SINGLETON:\n if (!options.rebuild) {\n this.registerHooks(provider, options);\n }\n\n return this.setToCache(provider, instance);\n case ProviderScope.REQUEST:\n if (options.locals) {\n options.locals.set(provider.token, instance);\n\n this.registerHooks(provider, options);\n }\n\n return instance;\n }\n\n return instance;\n }\n\n /**\n * Resolve the token depending on his provider configuration.\n *\n * If the token isn't cached, the injector will invoke the provider and cache the result.\n *\n * #### Example\n *\n * ```typescript\n * import {InjectorService} from \"@tsed/di\";\n * import MyService from \"./services.js\";\n *\n * class OtherService {\n * constructor(injectorService: InjectorService) {\n * const myService = injectorService.invoke<MyService>(MyService);\n * }\n * }\n * ```\n *\n * @param token The injectable class to invoke. Class parameters are injected according constructor signature.\n * @param options {InvokeOptions} Optional options to invoke the class.\n * @returns {Type} The class constructed.\n * @alias InjectorService.resolve\n */\n public invoke<Type = any>(token: TokenProvider<Type>, options: Partial<InvokeOptions> = {}): Type {\n return this.resolve(token, options);\n }\n\n /**\n * Build only providers which are asynchronous.\n */\n async loadAsync() {\n for (const [, provider] of this) {\n if (!this.has(provider.token) && provider.isAsync()) {\n await this.resolve(provider.token);\n }\n }\n }\n\n /**\n * Build only providers which are synchronous.\n */\n loadSync() {\n for (const [, provider] of this) {\n // TODO try to lazy provider instead initiate all providers (&& provider.hasRegisteredHooks())\n if (!this.has(provider.token) && provider.scope === ProviderScope.SINGLETON) {\n this.resolve(provider.token);\n }\n }\n }\n\n /**\n * Build all providers from given container (or GlobalProviders) and emit `$onInit` event.\n *\n * @param container\n */\n async load(container: Container = createContainer()) {\n // avoid provider registration in the GlobalContainer during the loading phase\n // using injectable() or providerBuilder()\n this.#loaded = true;\n\n await $asyncEmit(\"$beforeInit\");\n\n await this.bootstrap(container);\n\n // build async and sync provider\n await this.loadAsync();\n\n // load sync provider\n this.loadSync();\n\n await $asyncEmit(\"$onInit\");\n }\n\n /**\n * Load all configurations registered on providers via @Configuration decorator.\n * It inspects for each provider some fields like imports, mount, etc. to resolve the configuration.\n */\n async resolveConfiguration() {\n if (this.resolvedConfiguration) {\n return;\n }\n const mergedConfiguration = new Map();\n\n super.forEach((provider) => {\n if (provider.configuration && provider.type !== \"server:module\") {\n Object.entries(provider.configuration).forEach(([key, value]) => {\n if (!EXCLUDED_CONFIGURATION_KEYS.includes(key)) {\n value = mergedConfiguration.has(key) ? deepMerge(mergedConfiguration.get(key), value) : deepClone(value);\n mergedConfiguration.set(key, value);\n }\n });\n }\n });\n\n mergedConfiguration.forEach((value, key) => {\n this.settings.set(key, deepMerge(value, this.settings.get(key)));\n });\n\n await $asyncEmit(\"$afterResolveConfiguration\", this.settings);\n\n this.resolvedConfiguration = true;\n }\n\n /**\n * Emit an event to all service. See service [lifecycle hooks](/docs/hooks.md#lifecycle-hooks).\n * @param eventName The event name to emit at all services.\n * @param args List of the parameters to give to each service.\n * @returns A list of promises.\n * @deprecated use $asyncEmit instead\n */\n public emit(eventName: string, ...args: unknown[]) {\n return $asyncEmit(eventName, args);\n }\n\n /**\n * Alter value attached to an event.\n * @param eventName\n * @param value\n * @param args\n * @deprecated use $alter instead\n */\n public alter<T = any>(eventName: string, value: any, ...args: any[]): T {\n return $alter(eventName, value, args);\n }\n\n /**\n * Alter value attached to an event asynchronously.\n * @param eventName\n * @param value\n * @param args\n * @deprecated use $asyncAlter instead\n */\n public alterAsync<T = any>(eventName: string, value: any, ...args: any[]): Promise<T> {\n return $asyncAlter(eventName, value, args);\n }\n\n /**\n * Destroy the injector and all services.\n */\n async destroy() {\n await $asyncEmit(\"$onDestroy\");\n this.#cache.forEach((_, token) => {\n $off(token);\n });\n }\n\n /**\n * Bootstrap injector from container, resolve configuration and providers.\n *\n * @param container\n */\n protected async bootstrap(container: Container = createContainer()) {\n // Clone all providers in the container\n this.addProviders(container);\n\n // Resolve all configuration\n await this.resolveConfiguration();\n\n // allow mocking or changing provider instance before loading injector\n this.resolveImportsProviders();\n\n return this;\n }\n\n /**\n * Ensure that a provider is added to the container.\n * @protected\n */\n protected ensureProvider(token: TokenProvider, force: true): Provider;\n protected ensureProvider(token: TokenProvider, force: false): Provider | undefined;\n protected ensureProvider(token: TokenProvider): Provider | undefined;\n protected ensureProvider(token: TokenProvider, force = false): Provider | undefined {\n if (!this.hasProvider(token) && (GlobalProviders.has(token) || force)) {\n this.addProvider(token);\n }\n\n return this.getProvider(token)!;\n }\n\n /**\n * Invoke a class method and inject service.\n *\n * #### IInjectableMethod options\n *\n * * **target**: Optional. The class instance.\n * * **methodName**: `string` Optional. The method name.\n * * **designParamTypes**: `any[]` Optional. List of injectable types.\n * * **locals**: `Map<Function, any>` Optional. If preset then any argument Class are read from this object first, before the `InjectorService` is consulted.\n *\n * #### Example\n *\n * @param target\n * @param options\n * @private\n */\n protected invokeToken<T>(target: TokenProvider, options: Partial<InvokeOptions> = {}): T | Promise<T> {\n const resolvedOpts = this.mapInvokeOptions(target, options);\n\n if (!resolvedOpts) {\n return undefined as T;\n }\n\n const {token, deps, construct, imports, provider} = resolvedOpts;\n\n $emit(\"$beforeInvoke\", token, [resolvedOpts]);\n $emit(`$beforeInvoke:${String(provider.type)}`, [resolvedOpts]);\n\n let instance: any;\n let currentDependency: any = false;\n\n try {\n const invokeDependency =\n (parent?: any) =>\n (token: TokenProvider | [TokenProvider], index: number): any => {\n currentDependency = {token, index, deps};\n\n if (isArray(token)) {\n return this.getMany(token[0], options);\n }\n\n return isInheritedFrom(token, Provider, 1)\n ? provider\n : this.resolve(token, {\n parent,\n locals: options.locals,\n useOpts: provider?.getArgOpts(index) || options.useOpts\n });\n };\n\n // Invoke manually imported providers\n imports.forEach(invokeDependency());\n\n // Inject dependencies\n const services = deps.map(invokeDependency(token));\n\n currentDependency = false;\n\n instance = construct(services);\n } catch (error) {\n InjectionError.throwInjectorError(token, currentDependency, error);\n }\n\n if (instance === undefined) {\n throw new InjectionError(\n token,\n `Unable to create new instance from undefined value. Check your provider declaration for ${nameOf(token)}`\n );\n }\n\n if (instance && isClass(classOf(instance))) {\n Reflect.defineProperty(instance, DI_INVOKE_OPTIONS, {\n get: () => ({rebuild: options.rebuild, locals: options.locals})\n });\n }\n\n $emit(\"$afterInvoke\", token, [instance, resolvedOpts]);\n\n return instance;\n }\n\n private resolveImportsProviders() {\n this.settings.imports = this.settings.imports\n ?.filter((meta) => isObject(meta) && \"token\" in meta && meta.token !== InjectorService)\n .map((meta) => {\n if (isObject(meta) && \"token\" in meta) {\n const {token, ...props} = meta;\n\n const provider = this.ensureProvider(token, true);\n\n if (provider) {\n provider.useValue = undefined;\n provider.useAsyncFactory = undefined;\n provider.useFactory = undefined;\n\n if (\"useClass\" in props) {\n provider.useClass = props.useClass as TokenProvider;\n return;\n }\n\n if (\"useFactory\" in props) {\n provider.useFactory = props.useFactory as never;\n return;\n }\n\n if (\"useAsyncFactory\" in props) {\n provider.useAsyncFactory = props.useAsyncFactory as never;\n return;\n }\n\n if (\"use\" in props) {\n provider.useValue = props.use as unknown;\n return;\n }\n }\n }\n\n return meta;\n })\n .filter(Boolean) as unknown as (TokenProvider | ImportTokenProviderOpts)[];\n }\n\n /**\n * Create options to invoke a provider or class.\n * @param token\n * @param options\n */\n private mapInvokeOptions(token: TokenProvider, options: Partial<InvokeOptions>): ResolvedInvokeOptions | false {\n const locals = options.locals || new LocalsContainer();\n\n options.locals = locals;\n\n let imports: (TokenProvider | [TokenProvider])[] | undefined = options.imports;\n let deps: TokenProvider[] | undefined = options.deps;\n let construct;\n\n if (!token || token === Object) {\n throw new Error(\"Given token is undefined. Could mean a circular dependency problem. Try to use @Inject(() => Token) to solve it.\");\n }\n\n let provider: Provider;\n\n if (!this.hasProvider(token)) {\n provider = new Provider(token);\n } else {\n provider = this.getProvider(token)!;\n }\n\n deps = deps || provider.deps;\n imports = imports || provider.imports;\n\n if (provider.useValue !== undefined) {\n construct = () => (isFunction(provider.useValue) ? provider.useValue() : provider.useValue);\n } else if (provider.useFactory) {\n construct = (deps: any[]) => provider.useFactory!(...deps);\n } else if (provider.useAsyncFactory) {\n construct = async (deps: any[]) => {\n deps = await Promise.all(deps);\n return provider.useAsyncFactory!(...deps);\n };\n } else if (provider.useClass) {\n // useClass\n deps = deps || getConstructorDependencies(provider.useClass);\n construct = (deps: TokenProvider[]) => new provider.useClass(...deps);\n } else {\n return false;\n }\n\n return {\n token,\n deps: deps! || [],\n imports: imports || [],\n construct,\n provider,\n locals\n };\n }\n\n private registerHooks(provider: Provider, options: Partial<InvokeOptions>) {\n if (provider.hooks) {\n if (provider.scope === ProviderScope.REQUEST) {\n if (options.locals && provider.hooks?.$onDestroy) {\n const {locals} = options;\n\n options.locals.hooks.on(\"$onDestroy\", (...args: unknown[]) => {\n return provider.hooks?.$onDestroy?.(locals.get(provider.token), ...args);\n });\n }\n\n return;\n }\n\n Object.entries(provider.hooks).forEach(([event, cb]) => {\n const callback = (...args: any[]) => {\n return cb(this.#cache.get(provider.token), ...args);\n };\n\n $on(event, provider.token, callback);\n });\n }\n }\n\n private setToCache(provider: Provider, instance: any) {\n const set = (instance: any) => {\n this.#cache.set(provider.token, instance);\n provider?.alias && this.alias(provider.token, provider.alias);\n };\n\n if (\"isAsync\" in provider && !provider.isAsync() && !isPromise(instance)) {\n set(instance);\n\n return instance;\n }\n\n // store promise to lock token in cache\n set(instance);\n\n instance = instance.then((instance: any) => {\n set(instance);\n\n return instance;\n });\n\n return instance;\n }\n}\n","import {InjectorService} from \"../services/InjectorService.js\";\n\nlet globalInjector: InjectorService = new InjectorService();\n\n/**\n * Return the existing injector service.\n *\n * Example:\n *\n * ```typescript\n * import {injector, Injectable} from \"@tsed/di\";\n *\n * @Injectable()\n * class MyService {\n * injector = injector();\n * }\n * ```\n */\nexport function injector(): InjectorService {\n return globalInjector;\n}\n\nexport async function destroyInjector() {\n await globalInjector.destroy();\n globalInjector = new InjectorService();\n}\n","import {isArray, type Type} from \"@tsed/core\";\n\nimport {LocalsContainer} from \"../domain/LocalsContainer.js\";\nimport {injector} from \"../fn/injector.js\";\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {getConstructorDependencies} from \"../utils/getConstructorDependencies.js\";\n\nfunction resolveAutoInjectableArgs(token: Type, args: unknown[]) {\n const inj = injector();\n const locals = new LocalsContainer();\n const deps: TokenProvider[] = getConstructorDependencies(token);\n const list: any[] = [];\n const length = Math.max(deps.length, args.length);\n\n for (let i = 0; i < length; i++) {\n if (args[i] !== undefined) {\n list.push(args[i]);\n } else {\n const value = deps[i];\n const instance = isArray(value) ? inj.getMany(value[0], {locals, parent: token}) : inj.invoke(value, {locals, parent: token});\n\n list.push(instance);\n }\n }\n\n return list;\n}\n\n/**\n * AutoInjectable decorator is used to automatically inject dependencies in the constructor.\n *\n * @example\n * ```typescript\n * @AutoInjectable()\n * class UserService {\n * constructor(\n * private database: Database, // automatically injected\n * customConfig?: Config // can be passed manually\n * ) {}\n * }\n * ```\n *\n * @description\n * When applied to a class, this decorator:\n * - Automatically resolves and injects dependencies based on constructor parameter types\n * - Preserves the ability to manually pass arguments which override automatic injection\n *\n * @decorator\n * @returns {ClassDecorator} A class decorator that enables automatic dependency injection\n */\nexport function AutoInjectable() {\n return <T extends {new (...args: any[]): NonNullable<unknown>}>(constr: T): T => {\n return class AutoInjectable extends constr {\n constructor(...args: any[]) {\n super(...resolveAutoInjectableArgs(constr, args));\n }\n } as unknown as T;\n };\n}\n","import {Store} from \"@tsed/core\";\n\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {DIConfiguration} from \"../services/DIConfiguration.js\";\nimport {injector} from \"./injector.js\";\n\nexport function configuration(): TsED.DIConfiguration & DIConfiguration;\nexport function configuration(token: TokenProvider): Partial<TsED.Configuration>;\nexport function configuration(token: TokenProvider, configuration: Partial<TsED.Configuration>): Partial<TsED.Configuration>;\nexport function configuration(token?: TokenProvider, configuration?: Partial<TsED.Configuration>) {\n if (token) {\n const store = Store.from(token);\n\n if (configuration) {\n store.set(\"configuration\", configuration);\n }\n\n return store.get(\"configuration\", configuration);\n }\n\n return injector().settings as TsED.DIConfiguration & DIConfiguration;\n}\n","import {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {Provider} from \"./Provider.js\";\nimport {ProviderType} from \"./ProviderType.js\";\n\nexport interface ControllerMiddlewares {\n useBefore: TokenProvider[];\n use: TokenProvider[];\n useAfter: TokenProvider[];\n}\n\nexport class ControllerProvider<T = any> extends Provider<T> {\n public tokenRouter: string;\n\n constructor(token: TokenProvider, options: Partial<Provider> = {}) {\n super(token, options);\n this.type = ProviderType.CONTROLLER;\n }\n\n /**\n *\n * @returns {any[]}\n */\n get middlewares(): Partial<ControllerMiddlewares> {\n return Object.assign(\n {\n use: [],\n useAfter: [],\n useBefore: []\n },\n this.store.get(\"middlewares\", {})\n );\n }\n\n /**\n *\n * @param middlewares\n */\n set middlewares(middlewares: Partial<ControllerMiddlewares>) {\n const mdlwrs = this.middlewares;\n const concat = (key: string, a: any, b: any) => (a[key] = a[key].concat(b[key]));\n\n Object.keys(middlewares).forEach((key: string) => {\n concat(key, mdlwrs, middlewares);\n });\n\n this.store.set(\"middlewares\", mdlwrs);\n }\n}\n","import {ControllerProvider} from \"../domain/ControllerProvider.js\";\nimport {ProviderType} from \"../domain/ProviderType.js\";\nimport {injectable} from \"../fn/injectable.js\";\nimport type {ProviderOpts} from \"../interfaces/ProviderOpts.js\";\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {GlobalProviders} from \"./GlobalProviders.js\";\n\nGlobalProviders.createRegistry(ProviderType.CONTROLLER, ControllerProvider);\n\ntype Opts<Type = any> = Partial<ProviderOpts<Type>> &\n (\n | {\n token: TokenProvider<Type>;\n }\n | {\n /**\n * @deprecated use token prop instead\n */\n provide: TokenProvider<Type>;\n }\n );\n\n/**\n * Register a provider configuration.\n * @deprecated Since v8. Use injectable() function instead.\n */\nexport function registerProvider<Type = any>({token, provide, ...opts}: Opts<Type>) {\n return injectable(token || provide, {\n ...opts,\n token: token || provide\n } as unknown as Partial<ProviderOpts>).inspect();\n}\n","import \"../registries/ProviderRegistry.js\";\n\nimport {Store, type Type} from \"@tsed/core\";\n\nimport {ProviderType} from \"../domain/ProviderType.js\";\nimport {injector} from \"../fn/injector.js\";\nimport type {ProviderOpts} from \"../interfaces/ProviderOpts.js\";\nimport type {FactoryTokenProvider, TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {GlobalProviders} from \"../registries/GlobalProviders.js\";\n\ntype BaseMethodsProvider<TypeOf, BaseProvider, T extends object> = {\n [K in keyof T as T[K] extends (...args: any[]) => any ? never : K]: (value: T[K]) => ProviderBuilder<TypeOf, BaseProvider, T>;\n};\n\ntype ProviderBuilder<TypeOf, BaseProvider, T extends object> = BaseMethodsProvider<TypeOf, BaseProvider, T> & {\n inspect(): BaseProvider;\n store(): Store;\n token(): TypeOf;\n factory<FactoryReturn>(f: (...args: unknown[]) => FactoryReturn): ProviderBuilder<FactoryTokenProvider<FactoryReturn>, BaseProvider, T>;\n asyncFactory<FactoryReturn>(\n f: (...args: unknown[]) => Promise<FactoryReturn>\n ): ProviderBuilder<FactoryTokenProvider<FactoryReturn>, BaseProvider, T>;\n value<Value>(v: Value): ProviderBuilder<FactoryTokenProvider<Value>, BaseProvider, T>;\n class<TokenKlass>(c: Type<TokenKlass>): ProviderBuilder<TokenKlass, BaseProvider, T>;\n};\n\nexport type ProviderBuilderFn<Provider, Picked extends keyof Provider> = <TypeOf extends TokenProvider>(\n token: TypeOf,\n options?: Partial<ProviderOpts<Type>>\n) => ProviderBuilder<TypeOf, Provider, Pick<Provider, Picked>>;\n\nexport function providerBuilder<Provider, Picked extends keyof Provider>(\n props: string[],\n baseOpts: Partial<ProviderOpts<Provider>> = {}\n): ProviderBuilderFn<Provider, Picked> {\n return <TypeOf extends TokenProvider>(token: TypeOf, options: Partial<ProviderOpts<Type>> = {}) => {\n const merged = {\n global: !injector().isLoaded(),\n ...options,\n ...baseOpts,\n token\n };\n\n const provider = GlobalProviders.merge(token, merged);\n\n if (!merged.global) {\n injector().setProvider(token, provider);\n }\n\n return props.reduce(\n (acc, prop) => {\n return {\n ...acc,\n [prop]: function (value: any) {\n (provider as any)[prop] = value;\n return this;\n }\n };\n },\n {\n factory(factory: Function) {\n provider.reset();\n provider.useFactory = factory;\n return this;\n },\n asyncFactory(asyncFactory: Function) {\n provider.reset();\n provider.useAsyncFactory = asyncFactory;\n return this;\n },\n value(value: any) {\n provider.reset();\n provider.useValue = value;\n provider.type = ProviderType.VALUE;\n return this;\n },\n class(k: any) {\n provider.reset();\n provider.useClass = k;\n return this;\n },\n store() {\n return provider.store;\n },\n inspect() {\n return provider;\n },\n token() {\n return provider.token as TypeOf;\n }\n } as ProviderBuilder<TypeOf, Provider, Pick<Provider, Picked>>\n );\n };\n}\n","import {ControllerProvider} from \"../domain/ControllerProvider.js\";\nimport type {Provider} from \"../domain/Provider.js\";\nimport {ProviderType} from \"../domain/ProviderType.js\";\nimport {providerBuilder} from \"../utils/providerBuilder.js\";\n\ntype PickedProps = \"scope\" | \"path\" | \"alias\" | \"hooks\" | \"deps\" | \"imports\" | \"configuration\" | \"priority\";\n\nconst Props = [\"type\", \"scope\", \"path\", \"alias\", \"hooks\", \"deps\", \"imports\", \"configuration\", \"priority\"];\nexport const injectable = providerBuilder<Provider, PickedProps | \"type\">(Props);\nexport const interceptor = providerBuilder<Provider, PickedProps | \"type\">(Props, {\n type: ProviderType.INTERCEPTOR\n});\nexport const controller = providerBuilder<ControllerProvider, PickedProps | \"children\" | \"middlewares\">([...Props, \"middlewares\"], {\n type: ProviderType.CONTROLLER\n});\n","import {classOf, nameOf} from \"@tsed/core\";\n\nexport class InvalidPropertyTokenError extends Error {\n name = \"INVALID_TOKEN_ERROR\";\n\n constructor(target: any, propertyKey: string) {\n super(\n `Object isn't a valid token. Please check the token set on ${nameOf(\n classOf(target)\n )}.${propertyKey}.\\n- Check that it is not a circular reference.\\n- Check that the token (class or symbol) exists`\n );\n }\n}\n","import {LocalsContainer} from \"../domain/LocalsContainer.js\";\nimport type {UseImportTokenProviderOpts} from \"../interfaces/ImportTokenProviderOpts.js\";\nimport {InjectorService} from \"../services/InjectorService.js\";\nimport {injector} from \"./injector.js\";\n\nlet globalLocals: LocalsContainer | undefined;\nlet globalInvOpts: any = {};\nconst stagedLocals: LocalsContainer[] = [];\n\n/**\n * Get the locals container initiated by DITest or .bootstrap() method.\n */\nexport function localsContainer({\n providers,\n rebuild\n}: {\n providers?: UseImportTokenProviderOpts[];\n rebuild?: boolean;\n} = {}) {\n if (!globalLocals || providers) {\n globalLocals = new LocalsContainer();\n\n if (providers) {\n providers.forEach((p) => {\n globalLocals!.set(p.token, p.use);\n });\n\n globalLocals.set(InjectorService, injector());\n }\n\n if (rebuild) {\n globalInvOpts.rebuild = rebuild;\n }\n }\n\n return globalLocals;\n}\n\nexport function invokeOptions() {\n return {...globalInvOpts};\n}\n\n/**\n * Reset the locals container.\n */\nexport function detachLocalsContainer() {\n globalLocals && stagedLocals.push(globalLocals);\n globalLocals = undefined;\n globalInvOpts = {};\n}\n\nexport function cleanAllLocalsContainer() {\n detachLocalsContainer();\n stagedLocals.map((item) => item.clear());\n}\n","import type {InvokeOptions} from \"../interfaces/InvokeOptions.js\";\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {injector} from \"./injector.js\";\nimport {invokeOptions, localsContainer} from \"./localsContainer.js\";\n\n/**\n * Inject a provider to another provider.\n *\n * Use this function to inject a custom provider on constructor parameter or property.\n *\n * ```typescript\n * @Injectable()\n * export class MyService {\n * connection = inject(CONNECTION);\n * }\n * ```\n *\n * @param token A token provider or token provider group\n * @param opts\n * @returns {Function}\n * @decorator\n */\nexport function inject<TokenType>(\n token: TokenProvider<TokenType>,\n opts?: Partial<Pick<InvokeOptions, \"useOpts\" | \"rebuild\" | \"locals\">>\n): TokenType {\n return injector().resolve(token, {\n ...opts,\n ...invokeOptions(),\n locals: opts?.locals || localsContainer()\n });\n}\n","import type {InvokeOptions} from \"../interfaces/InvokeOptions.js\";\nimport {injector} from \"./injector.js\";\nimport {localsContainer} from \"./localsContainer.js\";\n\n/**\n * Injects multiple instances of a given token using the injector service.\n * @param token - The injection token to resolve\n * @param opts - Optional configuration for the injection\n * @param opts.useOpts - Options for instance creation\n * @param opts.rebuild - Whether to rebuild the instance\n * @param opts.locals - Local container overrides\n * @returns Array of resolved instances\n */\nexport function injectMany<T>(token: string | symbol, opts?: Partial<Pick<InvokeOptions, \"useOpts\" | \"rebuild\" | \"locals\">>): T[] {\n return injector().getMany<T>(token, {...opts, locals: opts?.locals || localsContainer()} as InvokeOptions);\n}\n","import {catchError, decoratorTypeOf, DecoratorTypes, isPromise, Metadata, Store, type Type} from \"@tsed/core\";\n\nimport {DI_INJECTABLE_PROPS, DI_INVOKE_OPTIONS, DI_USE_OPTIONS} from \"../constants/constants.js\";\nimport {InvalidPropertyTokenError} from \"../errors/InvalidPropertyTokenError.js\";\nimport {inject} from \"../fn/inject.js\";\nimport {injectMany} from \"../fn/injectMany.js\";\nimport type {InvokeOptions} from \"../interfaces/InvokeOptions.js\";\nimport {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {getConstructorDependencies, setConstructorDependencies} from \"../utils/getConstructorDependencies.js\";\n\nfunction setToken(\n token: TokenProvider,\n {\n target,\n propertyKey,\n parameterIndex\n }: {\n target: any;\n propertyKey: string | symbol | undefined;\n parameterIndex: number;\n }\n) {\n const paramTypes = getConstructorDependencies(target, propertyKey);\n const type = paramTypes[parameterIndex];\n\n paramTypes[parameterIndex] = type === Array ? [token] : token;\n\n Metadata.setParamTypes(target, propertyKey!, paramTypes);\n setConstructorDependencies(target, paramTypes);\n}\n\nfunction getTokenType(token: TokenProvider | (() => TokenProvider) | undefined, target: any, propertyKey: string | symbol) {\n const useType = token || Metadata.getType(target, propertyKey);\n\n if (useType === Object) {\n throw new InvalidPropertyTokenError(target, String(propertyKey));\n }\n\n return useType;\n}\n\nexport type TransformInjectedProviderCB<T, Klass = any> = (\n instance: T,\n {target, propertyKey}: {self: Klass; target: Type<Klass>; propertyKey: symbol | string}\n) => unknown;\n\nexport interface BindInjectablePropertyOpts<T = any> {\n token?: TokenProvider;\n useOpts?: Record<string, unknown>;\n transform?: TransformInjectedProviderCB<T>;\n}\n\nfunction bindInjectableProperty<T = any>(\n target: any,\n propertyKey: string | symbol,\n {token, transform = (o) => o, useOpts}: BindInjectablePropertyOpts<T>\n) {\n const symbol = Symbol();\n\n if (!target[DI_INJECTABLE_PROPS]) {\n Reflect.defineProperty(target, DI_INJECTABLE_PROPS, {\n value: new Set(),\n enumerable: false,\n configurable: false\n });\n }\n\n target[DI_INJECTABLE_PROPS].add(propertyKey);\n\n catchError(() => Reflect.deleteProperty(target, propertyKey));\n Reflect.defineProperty(target, propertyKey, {\n get() {\n const useType = getTokenType(token, target, propertyKey!);\n const originalType = Metadata.getType(target, propertyKey);\n\n const invokeOpts: Partial<InvokeOptions> = {\n rebuild: !!this[DI_INVOKE_OPTIONS]?.rebuild,\n locals: this[DI_INVOKE_OPTIONS]?.locals,\n useOpts: useOpts || Store.from(target, propertyKey).get(DI_USE_OPTIONS)\n };\n\n if (this[symbol] === undefined) {\n this[symbol] = originalType === Array ? injectMany(token as string, invokeOpts) : inject(useType, invokeOpts);\n }\n\n [].concat(this[symbol]).forEach((instance: any, index) => {\n if (isPromise(this[symbol])) {\n instance.then((result: any) => {\n this[symbol]![index] = result;\n if (originalType !== Array) {\n this[symbol] = result;\n }\n });\n }\n });\n\n return transform(this[symbol], {self: this, target, propertyKey});\n }\n });\n}\n\n/**\n * Inject a provider to another provider.\n *\n * Use this decorator to inject a custom provider on constructor parameter or property.\n *\n * ```typescript\n * @Injectable()\n * export class MyService {\n * @Inject(CONNECTION)\n * connection: CONNECTION;\n * }\n * ```\n *\n * @param token A token provider or token provider group\n * @param transform\n * @returns {Function}\n * @decorator\n */\nexport function Inject<T = any>(token?: TokenProvider<T> | (() => TokenProvider<T>), transform?: TransformInjectedProviderCB<T>): any;\nexport function Inject<T = any>(\n token?: TokenProvider<T> | (() => TokenProvider<T>),\n opts?: Partial<Omit<BindInjectablePropertyOpts<T>, \"token\">>\n): any;\nexport function Inject<T = any>(\n token?: TokenProvider<T> | (() => TokenProvider<T>),\n opts: TransformInjectedProviderCB<T> | Partial<Omit<BindInjectablePropertyOpts<T>, \"token\">> = {}\n) {\n opts = typeof opts === \"function\" ? {transform: opts} : opts;\n\n return (target: any, propertyKey: string | symbol | undefined, index?: number) => {\n const bindingType = decoratorTypeOf([target, propertyKey, index]);\n\n switch (bindingType) {\n case DecoratorTypes.PARAM_CTOR:\n if (token) {\n setToken(token, {target, propertyKey, parameterIndex: index!});\n }\n break;\n case DecoratorTypes.PROP:\n bindInjectableProperty(target, propertyKey!, {...opts, token});\n }\n };\n}\n","import {DecoratorParameters, decoratorTypeOf, DecoratorTypes} from \"@tsed/core\";\n\nimport {configuration} from \"../fn/configuration.js\";\nimport {injectable} from \"../fn/injectable.js\";\nimport {injector} from \"../fn/injector.js\";\nimport {CONFIGURATION, DIConfiguration} from \"../services/DIConfiguration.js\";\nimport {Inject} from \"./inject.js\";\n\n/**\n * Get or set Configuration on a class.\n *\n * @decorator\n */\nexport function Configuration(): any;\nexport function Configuration(settings: Partial<TsED.Configuration>): ClassDecorator;\nexport function Configuration(settings: Partial<TsED.Configuration> = {}): Function {\n return (...args: DecoratorParameters) => {\n switch (decoratorTypeOf(args)) {\n case DecoratorTypes.CLASS:\n configuration(args[0], settings);\n\n break;\n default:\n case DecoratorTypes.PARAM_CTOR:\n return Inject(DIConfiguration)(args[0], args[1], args[2] as number);\n }\n };\n}\n\nexport type Configuration = TsED.DIConfiguration & DIConfiguration;\n\n// To maintain compatibility with the previous implementation, we need to declare Configuration as\n// injectable token.\ninjectable(Configuration).factory(() => injector().settings);\n","import {injector} from \"./injector.js\";\n\nexport function constant<Type>(expression: string): Type | undefined;\nexport function constant<Type>(expression: string, defaultValue: Type | undefined): Type;\nexport function constant<Type>(expression: string, defaultValue?: Type | undefined): Type | undefined {\n return injector().settings.get(expression, defaultValue);\n}\n","import {catchError, deepClone} from \"@tsed/core\";\n\nimport {constant} from \"../fn/constant.js\";\n\nexport function bindConstant(target: any, propertyKey: string | symbol, expression: string, defaultValue?: any) {\n const symbol = Symbol();\n\n catchError(() => Reflect.deleteProperty(target, propertyKey));\n Reflect.defineProperty(target, propertyKey, {\n get() {\n if (this[symbol] !== undefined) {\n return this[symbol];\n }\n\n const value = constant(expression, defaultValue);\n\n this[symbol] = Object.freeze(deepClone(value));\n\n return this[symbol];\n },\n set(value: unknown) {\n const bean = constant(expression, defaultValue) || this[symbol];\n\n if (bean === undefined && value !== undefined) {\n this[symbol] = value;\n }\n },\n enumerable: true,\n configurable: true\n });\n}\n\n/**\n * Return value from Configuration.\n *\n * ## Example\n *\n * ```typescript\n * import {Env} from \"@tsed/core\";\n * import {Constant, Value} from \"@tsed/di\";\n *\n * export class MyClass {\n *\n * @Constant(\"env\")\n * env: Env;\n *\n * @Value(\"swagger.path\")\n * swaggerPath: string;\n *\n * @Value(\"swagger.path\", \"defaultValue\")\n * swaggerPath: string;\n *\n * constructor() {\n * console.log(this.swaggerPath) // undefined. Not available on constructor\n * }\n *\n * $onInit() {\n * console.log(this.swaggerPath) // something\n * }\n * }\n * ```\n *\n * @param {string} expression\n * @param defaultValue\n * @returns {(targetClass: any, attributeName: string) => any}\n * @decorator\n */\nexport function Constant<Type = unknown>(expression: string, defaultValue?: Type): PropertyDecorator {\n return (target, propertyKey) => {\n return bindConstant(target, propertyKey, expression, defaultValue);\n };\n}\n","export enum InjectablePropertyType {\n METHOD = \"method\",\n PROPERTY = \"property\",\n CONSTANT = \"constant\",\n VALUE = \"value\",\n INTERCEPTOR = \"interceptor\"\n}\n","import {isArrayOrArrayClass, Type, useDecorators} from \"@tsed/core\";\nimport {Children, Path} from \"@tsed/schema\";\n\nimport type {ControllerMiddlewares} from \"../domain/ControllerProvider.js\";\nimport {controller} from \"../fn/injectable.js\";\nimport {ProviderOpts} from \"../interfaces/ProviderOpts.js\";\n\nexport type PathType = string | RegExp | (string | RegExp)[];\n\nexport interface ControllerOptions extends Partial<ProviderOpts<any>> {\n path?: PathType;\n children?: Type<any>[];\n middlewares?: Partial<ControllerMiddlewares>;\n}\n\nfunction mapOptions(options: any): ControllerOptions {\n if (typeof options === \"string\" || options instanceof RegExp || isArrayOrArrayClass(options)) {\n return {\n path: options\n };\n }\n\n return options;\n}\n\n/**\n * Declare a new controller with his Rest path. His methods annotated will be collected to build the routing list.\n * This routing listing will be built with the `express.Router` object.\n *\n * ::: tip\n * See [Controllers](/docs/controllers.md) section for more details\n * :::\n *\n * ```typescript\n * @Controller(\"/calendars\")\n * export class CalendarCtrl {\n *\n * @Get(\"/:id\")\n * public get(\n * @Req() request: Req,\n * @Res() response: Res,\n * @Next() next: Next\n * ): void {\n *\n * }\n * }\n * ```\n *\n * @param options\n * @controller\n * @decorator\n * @classDecorator\n */\nexport function Controller(options: PathType | ControllerOptions): ClassDecorator {\n const {children = [], path, ...opts} = mapOptions(options);\n\n return useDecorators(\n (target: Type) => {\n controller(target, opts);\n },\n // TODO @tsed/schema: remove this when we have a better solution\n path && Path(path as any),\n Children(...children)\n );\n}\n","import {injectable} from \"../fn/injectable.js\";\nimport type {ProviderOpts} from \"../interfaces/ProviderOpts.js\";\n\n/**\n * The decorators `@Injectable()` declare a new service can be injected in other service, controller, interceptor, etc.. on there `constructor`.\n * All classes annotated with `@Injectable()` are built one time, excepted if you change the default provider configuration.\n *\n * ::: tip\n * `@Injectable()` use the `reflect-metadata` to collect and inject the built provided to other services.\n * :::\n *\n * ### Options\n *\n * - type (@@ProviderType@@ or `string`): Kind of provider. (Default: `ProviderType.PROVIDER`)\n * - scope (@@ProviderScope@@): Kind of provider. (Default: `ProviderScope.SINGLETON`)\n * - token (@@TokenProvider@@): An injection token (Note: This option override default metadata generated by Typescript).\n * - deps (`Type<any>`): List of class or provider which will be injected to the constructor (Note: This options override default metadata generated by Typescript).\n *\n * @returns {Function}\n * @decorator\n */\nexport function Injectable(options: Partial<ProviderOpts> = {}): ClassDecorator {\n return (target: any) => {\n const opts = {\n ...options,\n ...(options.token ? {useClass: target} : {token: target})\n };\n injectable(opts.token, opts);\n };\n}\n","import {classOf, decorateMethodsOf, DecoratorParameters, decoratorTypeOf, DecoratorTypes, nameOf, Store, Type} from \"@tsed/core\";\n\nimport {DI_INTERCEPTOR_OPTIONS, DI_INVOKE_OPTIONS} from \"../constants/constants.js\";\nimport {inject} from \"../fn/inject.js\";\nimport type {InterceptorContext} from \"../interfaces/InterceptorContext.js\";\nimport type {InterceptorMethods} from \"../interfaces/InterceptorMethods.js\";\nimport type {InvokeOptions} from \"../interfaces/InvokeOptions.js\";\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\n\nexport function getInterceptorOptions<T>(target: Type<any>, propertyKey: string | symbol) {\n return Store.fromMethod(target, propertyKey).get(DI_INTERCEPTOR_OPTIONS) as T;\n}\n\nexport function bindIntercept(target: any, propertyKey: string | symbol, token: TokenProvider, options: Record<string, unknown>) {\n const klass = classOf(target);\n const descriptor = Reflect.getOwnPropertyDescriptor(klass.prototype, propertyKey);\n const originalMethod = descriptor!.value;\n const symbol = Symbol();\n\n Store.fromMethod(klass, propertyKey).set(DI_INTERCEPTOR_OPTIONS, options);\n\n function newMethod(...args: any[]) {\n const next = (err?: Error) => {\n if (!err) {\n return originalMethod.apply(this, args);\n }\n\n throw err;\n };\n\n const context: InterceptorContext<any> = {\n target: klass,\n propertyKey,\n args,\n options,\n next\n };\n\n const invokeOpts: Partial<InvokeOptions> = {\n rebuild: !!this[DI_INVOKE_OPTIONS]?.rebuild,\n locals: this[DI_INVOKE_OPTIONS]?.locals\n };\n\n this[symbol] = this[symbol] || inject(token, invokeOpts)!;\n\n return this[symbol].intercept!(\n {\n ...context,\n options\n },\n next\n );\n }\n\n descriptor!.value = newMethod;\n\n Reflect.deleteProperty(klass.prototype, propertyKey);\n Reflect.defineProperty(klass.prototype, propertyKey, descriptor!);\n\n return descriptor;\n}\n\n/**\n * Attaches interceptor to method call and executes the before and after methods\n *\n * @param interceptor\n * @param options\n * @decorator\n */\nexport function Intercept<T extends InterceptorMethods>(interceptor: Type<T>, options?: any): any {\n return (...args: DecoratorParameters) => {\n const [target, propertyKey] = args;\n const type = decoratorTypeOf(args);\n switch (type) {\n case DecoratorTypes.CLASS:\n decorateMethodsOf(target, Intercept(interceptor, options));\n break;\n case DecoratorTypes.METHOD:\n return bindIntercept(target, propertyKey, interceptor, options);\n }\n };\n}\n","import {ProviderType} from \"../domain/ProviderType.js\";\nimport {Injectable} from \"./injectable.js\";\n\n/**\n * The decorators `@Interceptor()` declare a new service can be injected in other service or controller on there `constructor`.\n * All services annotated with `@Interceptor()` are constructed one time.\n *\n * > `@Service()` use the `reflect-metadata` to collect and inject service on controllers or other services.\n *\n * @returns {Function}\n * @decorator\n */\nexport function Interceptor(): Function {\n return Injectable({\n type: ProviderType.INTERCEPTOR\n });\n}\n","import {isFunction} from \"@tsed/core\";\n\nimport type {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {inject} from \"./inject.js\";\nimport {injector} from \"./injector.js\";\n\n/**\n * Lazy load a provider from his package and invoke only when the provider is used.\n */\nexport async function lazyInject<Token>(factory: () => Promise<{default: TokenProvider<Token>}>): Promise<Token> {\n const {default: token} = await factory();\n\n if (!injector().has(token)) {\n const instance = await inject(token);\n\n const instanceWithHook = instance as unknown as {$onInit?: () => Promise<void>};\n\n if (\"$onInit\" in instanceWithHook && isFunction(instanceWithHook.$onInit)) {\n await instanceWithHook.$onInit();\n }\n }\n\n return injector().get(token) as unknown as Promise<Token>;\n}\n\nexport async function optionalLazyInject<Token>(\n factory: () => Promise<{\n default: TokenProvider;\n }>\n): Promise<Token | undefined> {\n try {\n return await lazyInject(factory);\n } catch (er) {\n return undefined;\n }\n}\n","import {catchError, isFunction} from \"@tsed/core\";\n\nimport {lazyInject, optionalLazyInject} from \"../fn/lazyInject.js\";\n\nfunction mapOptions(args: any[], optional = false) {\n function wrap(key: string, resolver: any) {\n return async () => {\n try {\n const {[key]: token} = await resolver();\n\n return {default: token};\n } catch (er) {\n if (!optional) {\n throw er;\n }\n\n return;\n }\n };\n }\n\n if (isFunction(args[0])) {\n return wrap(\"default\", args[0]);\n }\n\n return wrap(args[0], args[1]);\n}\n\n/**\n * Lazy load a provider from his package and invoke only when the provider is used\n *\n * ```typescript\n * import type {PlatformException} from \"@tsed/platform-exceptions\";\n *\n * @Injectable()\n * export class MyService {\n * @LazyInject(() => import(\"@tsed/platform-exceptions\"))\n * exceptions: Promise<PlatformException>;\n * }\n * ```\n *\n * @param key - The named export to import from the module.\n * @param resolver - A function that returns a promise resolving to the module.\n * @returns {Function}\n * @decorator\n */\nexport function LazyInject(resolver: () => Promise<{default: unknown}>): PropertyDecorator;\nexport function LazyInject(key: string, resolver: () => Promise<{default: unknown}>): PropertyDecorator;\nexport function LazyInject(...args: any[]): PropertyDecorator {\n let resolver = mapOptions(args);\n\n return (target: any, propertyKey: string | symbol): any | void => {\n catchError(() => Reflect.deleteProperty(target, propertyKey));\n Reflect.defineProperty(target, propertyKey, {\n async get() {\n return lazyInject<any>(resolver as any);\n }\n });\n };\n}\n\n/**\n * Optionally Lazy load a provider from his package and invoke only when the provider is used\n *\n * ```typescript\n * import type {PlatformException} from \"@tsed/platform-exceptions\";\n *\n * @Injectable()\n * export class MyService {\n * @OptionalLazyInject(() => import(\"@tsed/platform-exceptions\"))\n * exceptions: Promise<PlatformException>;\n * }\n * ```\n * @param key - The named export to import from the module.\n * @param resolver - A function that returns a promise resolving to the module.\n * @decorator\n */\nexport function OptionalLazyInject(resolver: () => Promise<{default: unknown}>): PropertyDecorator;\nexport function OptionalLazyInject(key: string, resolver: () => Promise<{default: unknown}>): PropertyDecorator;\nexport function OptionalLazyInject(...args: any[]): PropertyDecorator {\n const resolver = mapOptions(args, true);\n\n return (target: any, propertyKey: string | symbol): any | void => {\n catchError(() => Reflect.deleteProperty(target, propertyKey));\n Reflect.defineProperty(target, propertyKey, {\n async get() {\n return optionalLazyInject(resolver as any);\n }\n });\n };\n}\n","import {useDecorators} from \"@tsed/core\";\n\nimport {ProviderScope} from \"../domain/ProviderScope.js\";\nimport {ProviderType} from \"../domain/ProviderType.js\";\nimport {TokenProvider} from \"../interfaces/TokenProvider.js\";\nimport {Configuration} from \"./configuration.js\";\nimport {Injectable} from \"./injectable.js\";\n\nexport interface ModuleOptions extends Omit<TsED.Configuration, \"scopes\"> {\n /**\n * Provider scope\n */\n scope?: ProviderScope;\n /**\n * Providers must be initialized before building this module\n */\n imports?: TokenProvider[];\n /**\n * Explicit token must be injected in the constructor\n */\n deps?: TokenProvider[];\n\n /**\n * Additional properties are stored as provider configuration.\n */\n [key: string]: any;\n}\n\n/**\n * Declare a new Ts.ED module\n *\n * ## Options\n * - imports: List of Provider which must be built by injector before invoking the module\n * - deps: List of provider must be injected to the module constructor (explicit declaration)\n *\n * @param options\n * @decorator\n */\nexport function Module(options: Partial<ModuleOptions> = {}) {\n const {scopes, imports, deps, scope, ...configuration} = options;\n\n return useDecorators(\n Configuration(configuration),\n Injectable({\n type: ProviderType.MODULE,\n scope: ProviderScope.SINGLETON,\n imports,\n deps,\n injectable: false\n })\n );\n}\n","import {StoreSet} from \"@tsed/core\";\n\nimport {ProviderScope} from \"../domain/ProviderScope.js\";\n\n/**\n *\n * @param {\"request\" | \"singleton\" | ProviderScope} scope\n * @returns {Function}\n * @constructor\n */\nexport function Scope(scope: \"request\" | \"singleton\" | ProviderScope = ProviderScope.REQUEST) {\n return StoreSet(\"scope\", scope);\n}\n","import {classOf} from \"@tsed/core\";\n\nimport {DI_USE_PARAM_OPTIONS} from \"../constants/constants.js\";\nimport {ProviderScope} from \"../domain/ProviderScope.js\";\nimport {Inject} from \"./inject.js\";\nimport {Scope} from \"./scope.js\";\n\n/**\n * Get instance options. This options depending on his invocation context.\n *\n * ```typescript\n * import {Injectable, Opts, UseOpts} from \"@tsed/di\";\n *\n * @Injectable()\n * class MyConfigurableService {\n * source: string;\n * constructor(@Opts options: any = {}) {\n * console.log(\"Hello \", options.source); // log: Hello Service1 then Hello Service2\n *\n * this.source = options.source;\n * }\n * }\n *\n * @Injectable()\n * class MyService1 {\n * constructor(@UseOpts({source: 'Service1'}) service: MyConfigurableService) {\n * console.log(service.source) // log: Service1\n * }\n * }\n *\n * @Injectable()\n * class MyService2 {\n * constructor(@UseOpts({source: 'Service2'}) service: MyConfigurableService) {\n * console.log(service.source) // log: Service2\n * }\n * }\n * ```\n *\n * ::: warning\n * Using @@Opts@@ decorator on a constructor parameter change the Scope of the provider to `ProviderScope.INSTANCE`.\n * :::\n *\n * @param target\n * @param propertyKey\n * @param index\n * @decorator\n */\nexport function Opts(target: any, propertyKey: string | symbol | undefined, index: number) {\n Scope(ProviderScope.INSTANCE)(classOf(target));\n Inject(DI_USE_PARAM_OPTIONS)(target, propertyKey, index);\n}\n","import {Type} from \"@tsed/core\";\n\nimport {GlobalProviders} from \"../registries/GlobalProviders.js\";\n\n/**\n * Override a provider which is already registered in ProviderRegistry.\n * @returns {Function}\n * @decorators\n * @param originalProvider\n */\nexport function OverrideProvider(originalProvider: Type<any>): Function {\n return (target: Type<any>): void => {\n GlobalProviders.get(originalProvider)!.useClass = target;\n };\n}\n","import {Injectable} from \"./injectable.js\";\n\n/**\n * The decorators `@Service()` declare a new service can be injected in other service or controller on there `constructor`.\n * All services annotated with `@Service()` are constructed one time.\n *\n * > `@Service()` use the `reflect-metadata` to collect and inject service on controllers or other services.\n *\n * @returns {Function}\n * @decorator\n */\nexport function Service(): Function {\n return Injectable();\n}\n","import {decoratorTypeOf, DecoratorTypes, Store, UnsupportedDecoratorType} from \"@tsed/core\";\n\nimport {DI_USE_OPTIONS, DI_USE_PARAM_OPTIONS} from \"../constants/constants.js\";\n\n/**\n * Add options to invoke the Service.\n *\n * ```typescript\n * import {Injectable, Opts, UseOpts} from \"@tsed/di\";\n *\n * @Injectable()\n * class MyConfigurableService {\n * source: string;\n * constructor(@Opts options: any = {}) {\n * console.log(\"Hello \", options.source); // log: Hello Service1 then Hello Service2\n *\n * this.source = options.source;\n * }\n * }\n *\n * @Injectable()\n * class MyService1 {\n * constructor(@UseOpts({source: 'Service1'}) service: MyConfigurableService) {\n * console.log(service.source) // log: Service1\n * }\n * }\n *\n * @Injectable()\n * class MyService2 {\n * constructor(@UseOpts({source: 'Service2'}) service: MyConfigurableService) {\n * console.log(service.source) // log: Service2\n * }\n * }\n * ```\n *\n * ::: warning\n * Using @@Opts@@ decorator on a constructor parameter change the Scope of the provider to `ProviderScope.INSTANCE`.\n * :::\n *\n * @returns {Function}\n * @decorator\n * @param options\n */\nexport function UseOpts(options: {[key: string]: any}): Function {\n return (target: Object, propertyKey: string | symbol, index?: number): any => {\n const bindingType = decoratorTypeOf([target, propertyKey, index]);\n\n switch (bindingType) {\n case DecoratorTypes.PARAM_CTOR:\n Store.from(target).merge(`${DI_USE_PARAM_OPTIONS}:${index}`, options);\n break;\n\n case DecoratorTypes.PROP:\n Store.from(target, propertyKey).set(DI_USE_OPTIONS, options);\n break;\n\n default:\n throw new UnsupportedDecoratorType(UseOpts, [target, propertyKey, index]);\n }\n };\n}\n","import {catchError} from \"@tsed/core\";\n\nimport {injector} from \"../fn/injector.js\";\n\nexport function bindValue(target: any, propertyKey: string | symbol, expression: string, defaultValue?: any) {\n const descriptor = {\n get() {\n return injector().settings.get(expression, defaultValue);\n },\n set(value: unknown) {\n injector().settings.set(expression, value);\n },\n enumerable: true,\n configurable: true\n };\n\n catchError(() => Reflect.deleteProperty(target, propertyKey));\n catchError(() => Reflect.defineProperty(target, propertyKey, descriptor));\n}\n\n/**\n * Return value from Configuration.\n *\n * ## Example\n *\n * ```typescript\n * import {Env} from \"@tsed/core\";\n * import {Constant, Value} from \"@tsed/di\";\n *\n * export class MyClass {\n *\n * @Constant(\"env\")\n * env: Env;\n *\n * @Value(\"swagger.path\")\n * swaggerPath: string;\n *\n * @Value(\"swagger.path\", \"defaultValue\")\n * swaggerPath: string;\n *\n * constructor() {\n * console.log(this.swaggerPath) // undefined. Not available on constructor\n * }\n *\n * $onInit() {\n * console.log(this.swaggerPath) // something\n * }\n * }\n * ```\n *\n * @param expression\n * @param defaultValue\n * @returns {(targetClass: any, attributeName: string) => any}\n * @decorator\n */\nexport function Value(expression: string, defaultValue?: unknown): PropertyDecorator {\n return (target, propertyKey) => {\n return bindValue(target, propertyKey, expression, defaultValue);\n };\n}\n","import {injector} from \"./injector.js\";\n\n/**\n * Get a value from the `injector.settings`.\n *\n * ## Example\n *\n * ```ts\n * import {refValue, Injectable} from \"@tsed/di\";\n *\n * @Injectable()\n * class Test {\n * test = refValue(\"logger.level\", \"default value\");\n *\n * constructor() {\n * console.log(this.test.value); // \"off\"\n * }\n * }\n *\n * @param expression The expression to get the value from the `injector.settings`.\n */\nexport function refValue<Type>(expression: string): {value: Type | undefined};\nexport function refValue<Type>(expression: string, defaultValue: Type | undefined): {value: Type};\nexport function refValue<Type>(expression: string, defaultValue?: Type | undefined): {value: Type | undefined} {\n return Object.freeze({\n get value() {\n return injector().settings.get(expression, defaultValue);\n },\n set value(value: Type) {\n injector().settings.set(expression, value);\n }\n });\n}\n","import {injectable} from \"../fn/injectable.js\";\nimport {injector} from \"../fn/injector.js\";\nimport {DILogger} from \"../interfaces/DILogger.js\";\n\nexport const LOGGER = Symbol.for(\"LOGGER\");\nexport type LOGGER = DILogger;\n\ninjectable(LOGGER).factory(() => injector().logger);\n","import {Store, Type} from \"@tsed/core\";\n\nexport function mergeMount(m1: any = {}, m2: any = {}) {\n return Object.entries(m2).reduce((mount, [key, controllers]) => {\n return {\n ...mount,\n [key]: (mount[key] || []).concat(controllers)\n };\n }, m1);\n}\n\nexport function getConfiguration(module: Type<any>, configuration: any = {}) {\n const store = Store.from(module).get(\"configuration\") || {};\n\n return {\n ...store,\n ...configuration,\n mount: mergeMount(store.mount, configuration.mount)\n };\n}\n"],"names":["root","factory","exports","module","require","define","amd","self","__WEBPACK_EXTERNAL_MODULE__414__","__WEBPACK_EXTERNAL_MODULE__171__","__WEBPACK_EXTERNAL_MODULE__538__","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","DI_INVOKE_OPTIONS","DI_INJECTABLE_PROPS","DI_USE_OPTIONS","DI_USE_PARAM_OPTIONS","DI_INTERCEPTOR_OPTIONS","ProviderScope","ProviderType","LocalsContainer","Map","hooks","Hooks","destroy","this","asyncEmit","discoverHooks","token","methodsOf","reduce","propertyKey","String","startsWith","listener","instance","args","Provider","constructor","options","type","PROVIDER","useClass","assign","getClassOrSymbol","Store","from","provide","isClass","classOf","className","name","nameOf","store","path","set","scope","isAsync","SINGLETON","configuration","children","getArgOpts","index","defaultValue","useAsyncFactory","clone","hasChildren","length","hasParent","toString","useFactory","useValue","filter","Boolean","join","reset","GlobalProviderRegistry","super","has","metadata","merge","target","global","GlobalProviders","createProvider","meta","createIfNotExists","keys","forEach","delete","createRegistry","model","defaultOptions","getRegistrySettings","provider","item","Container","add","settings","addProvider","hasProvider","setProvider","getProvider","getProviders","types","concat","map","providers","_","includes","addProviders","container","colorIfAllowed","colorFn","text","process","env","NO_COLOR","colors","red","yellow","green","InjectionError","Error","origin","isString","tokens","message","stack","originMessage","tokensMessage","throwInjectorError","currentDependency","error","erroredArg","getConstructorArgNames","arg","deps","signature","indexOf","repeat","drawline","printDependencyInjectionError","createContainer","rootModule","entries","getConstructorDependencies","Metadata","getOwn","getParamTypes","setConstructorDependencies","CONFIGURATION","for","DIConfiguration","initialProps","default","imports","routes","logger","version","v","rootDir","debug","level","callbackfn","thisArg","Set","Array","getRaw","Reflect","setRaw","setValue","getValue","EXCLUDED_CONFIGURATION_KEYS","InjectorService","console","resolvedConfiguration","isLoaded","toArray","values","resolve","getMany","alias","locals","useOpts","rebuild","ensureProvider","invokeToken","setToCache","registerHooks","REQUEST","invoke","loadAsync","loadSync","load","$asyncEmit","bootstrap","resolveConfiguration","mergedConfiguration","deepMerge","deepClone","emit","eventName","alter","$alter","alterAsync","$asyncAlter","$off","resolveImportsProviders","force","resolvedOpts","mapInvokeOptions","construct","$emit","invokeDependency","parent","isArray","isInheritedFrom","services","isObject","props","use","isFunction","async","Promise","all","$onDestroy","on","event","cb","$on","isPromise","then","globalInjector","injector","destroyInjector","AutoInjectable","constr","inj","list","Math","max","i","push","resolveAutoInjectableArgs","ControllerProvider","CONTROLLER","middlewares","useAfter","useBefore","mdlwrs","a","b","registerProvider","opts","injectable","inspect","providerBuilder","baseOpts","merged","acc","asyncFactory","VALUE","k","Props","interceptor","INTERCEPTOR","controller","InvalidPropertyTokenError","globalLocals","globalInvOpts","stagedLocals","localsContainer","p","invokeOptions","detachLocalsContainer","cleanAllLocalsContainer","clear","inject","injectMany","Inject","transform","decoratorTypeOf","DecoratorTypes","PARAM_CTOR","parameterIndex","paramTypes","setParamTypes","setToken","PROP","symbol","configurable","catchError","deleteProperty","useType","getType","getTokenType","originalType","invokeOpts","result","bindInjectableProperty","Configuration","CLASS","constant","expression","bindConstant","freeze","Constant","InjectablePropertyType","Controller","RegExp","isArrayOrArrayClass","mapOptions","useDecorators","Path","Children","Injectable","getInterceptorOptions","fromMethod","bindIntercept","klass","descriptor","getOwnPropertyDescriptor","originalMethod","next","err","apply","context","intercept","Intercept","decorateMethodsOf","METHOD","Interceptor","lazyInject","instanceWithHook","$onInit","optionalLazyInject","er","optional","wrap","resolver","LazyInject","OptionalLazyInject","Module","scopes","MODULE","Scope","StoreSet","Opts","INSTANCE","OverrideProvider","originalProvider","Service","UseOpts","UnsupportedDecoratorType","bindValue","Value","refValue","LOGGER","mergeMount","m1","m2","mount","controllers","getConfiguration"],"sourceRoot":""}
|
|
@@ -41,6 +41,8 @@ export function Controller(options) {
|
|
|
41
41
|
const { children = [], path, ...opts } = mapOptions(options);
|
|
42
42
|
return useDecorators((target) => {
|
|
43
43
|
controller(target, opts);
|
|
44
|
-
},
|
|
44
|
+
},
|
|
45
|
+
// TODO @tsed/schema: remove this when we have a better solution
|
|
46
|
+
path && Path(path), Children(...children));
|
|
45
47
|
}
|
|
46
48
|
//# sourceMappingURL=controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../../src/common/decorators/controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAQ,aAAa,EAAC,MAAM,YAAY,CAAC;AACpE,OAAO,EAAC,QAAQ,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAG5C,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAW/C,SAAS,UAAU,CAAC,OAAY;IAC9B,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,YAAY,MAAM,IAAI,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7F,OAAO;YACL,IAAI,EAAE,OAAO;SACd,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,UAAU,CAAC,OAAqC;IAC9D,MAAM,EAAC,QAAQ,GAAG,EAAE,EAAE,IAAI,EAAE,GAAG,IAAI,EAAC,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAE3D,OAAO,aAAa,CAClB,CAAC,MAAY,EAAE,EAAE;QACf,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC3B,CAAC,
|
|
1
|
+
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../../src/common/decorators/controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAQ,aAAa,EAAC,MAAM,YAAY,CAAC;AACpE,OAAO,EAAC,QAAQ,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAG5C,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAW/C,SAAS,UAAU,CAAC,OAAY;IAC9B,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,YAAY,MAAM,IAAI,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7F,OAAO;YACL,IAAI,EAAE,OAAO;SACd,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,UAAU,CAAC,OAAqC;IAC9D,MAAM,EAAC,QAAQ,GAAG,EAAE,EAAE,IAAI,EAAE,GAAG,IAAI,EAAC,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAE3D,OAAO,aAAa,CAClB,CAAC,MAAY,EAAE,EAAE;QACf,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC3B,CAAC;IACD,gEAAgE;IAChE,IAAI,IAAI,IAAI,CAAC,IAAW,CAAC,EACzB,QAAQ,CAAC,GAAG,QAAQ,CAAC,CACtB,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tsed/di",
|
|
3
3
|
"description": "DI module for Ts.ED Framework",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "8.9.
|
|
5
|
+
"version": "8.9.5",
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
7
|
"main": "./lib/esm/index.js",
|
|
8
8
|
"module": "./lib/esm/index.js",
|
|
@@ -30,23 +30,23 @@
|
|
|
30
30
|
"uuid": "^10.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@tsed/barrels": "8.9.
|
|
34
|
-
"@tsed/core": "8.9.
|
|
35
|
-
"@tsed/hooks": "8.9.
|
|
33
|
+
"@tsed/barrels": "8.9.5",
|
|
34
|
+
"@tsed/core": "8.9.5",
|
|
35
|
+
"@tsed/hooks": "8.9.5",
|
|
36
36
|
"@tsed/logger": "^7.0.1",
|
|
37
|
-
"@tsed/schema": "8.9.
|
|
38
|
-
"@tsed/typescript": "8.9.
|
|
37
|
+
"@tsed/schema": "8.9.5",
|
|
38
|
+
"@tsed/typescript": "8.9.5",
|
|
39
39
|
"cross-env": "7.0.3",
|
|
40
40
|
"eslint": "9.12.0",
|
|
41
41
|
"typescript": "5.4.5",
|
|
42
|
-
"vitest": "3.1.
|
|
42
|
+
"vitest": "3.1.4",
|
|
43
43
|
"webpack": "^5.75.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@tsed/core": ">=8.9.
|
|
47
|
-
"@tsed/hooks": ">=8.9.
|
|
46
|
+
"@tsed/core": ">=8.9.5",
|
|
47
|
+
"@tsed/hooks": ">=8.9.5",
|
|
48
48
|
"@tsed/logger": ">=7.0.1",
|
|
49
|
-
"@tsed/schema": ">=8.9.
|
|
49
|
+
"@tsed/schema": ">=8.9.5"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
|
52
52
|
"@tsed/core": {
|
package/readme.md
CHANGED
|
@@ -27,130 +27,311 @@
|
|
|
27
27
|
|
|
28
28
|
<hr />
|
|
29
29
|
|
|
30
|
-
A
|
|
30
|
+
A powerful and flexible Dependency Injection (DI) toolkit inspired by Angular, designed for both TypeScript and pure JavaScript applications. Use it standalone or as the foundation of Ts.ED. Supports both decorator-based and functional (decorator-less) APIs for maximum compatibility, even in non-TypeScript or pure JS projects.
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
---
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
Install the latest release and required peer dependencies:
|
|
35
37
|
|
|
36
38
|
```bash
|
|
37
|
-
npm install --save @tsed/di
|
|
39
|
+
npm install --save @tsed/di @tsed/core @tsed/hooks @tsed/logger
|
|
38
40
|
```
|
|
39
41
|
|
|
40
|
-
> **Important!**
|
|
41
|
-
>
|
|
42
|
-
>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"compilerOptions": {
|
|
47
|
-
"target": "es2016",
|
|
48
|
-
"lib": ["es2016"],
|
|
49
|
-
"typeRoots": ["./node_modules/@types"],
|
|
50
|
-
"module": "commonjs",
|
|
51
|
-
"moduleResolution": "node",
|
|
52
|
-
"experimentalDecorators": true,
|
|
53
|
-
"emitDecoratorMetadata": true,
|
|
54
|
-
"allowSyntheticDefaultImports": true
|
|
55
|
-
},
|
|
56
|
-
"exclude": ["node_modules"]
|
|
57
|
-
}
|
|
58
|
-
```
|
|
42
|
+
> **Important!**
|
|
43
|
+
>
|
|
44
|
+
> - @tsed/di v8+ supports **only ESM** (ECMAScript Modules).
|
|
45
|
+
> - Requires Node >= 20,
|
|
46
|
+
> - TypeScript >= 5.0 if you use decorators.
|
|
47
|
+
> - For TypeScript, enable `emitDecoratorMetadata` and `experimentalDecorators` in your `tsconfig.json`.
|
|
59
48
|
|
|
60
|
-
|
|
49
|
+
---
|
|
61
50
|
|
|
62
|
-
|
|
63
|
-
All of them can inject dependencies, meaning, they can create various relationships with each other.
|
|
64
|
-
But in fact, a provider is nothing else than just a simple class annotated with an `@Injectable()` decorator.
|
|
51
|
+
## Features
|
|
65
52
|
|
|
66
|
-
|
|
53
|
+
- **[Providers](https://tsed.dev/docs/providers.html):** Register and manage services, factories, values, interceptors, and more.
|
|
54
|
+
- **[Functional API](https://tsed.dev/docs/providers.html#injectable):** Register providers and factories without decorators (for pure JS or decorator-less code).
|
|
55
|
+
- **[Async Factories](https://tsed.dev/docs/custom-providers.html#register-async-factory):** Create providers that resolve asynchronously (e.g., database connections).
|
|
56
|
+
- **[Constants Injection](https://tsed.dev/docs/providers.html#constant):** Use `@Constant()` or `constant()` to inject configuration or static values.
|
|
57
|
+
- **[Value Injection](https://tsed.dev/docs/providers.html#value-refvalue):** Use `@Value()` or `refValue()` to inject resolved provider values.
|
|
58
|
+
- **[InjectContext](https://tsed.dev/docs/providers.html#inject-context):** Access the injection context and advanced DI features.
|
|
59
|
+
- **[Config Sources](https://tsed.dev/docs/configuration/configuration-sources.html):** Load and merge configuration from multiple sources (files, env, remote, etc.).
|
|
60
|
+
- **[Lifecycle hooks](https://tsed.dev/docs/hooks.html):** Manage provider lifecycle with hooks like `$onInit`, `$onDestroy`.
|
|
61
|
+
- **[Lazy loading](https://tsed.dev/docs/providers.html#lazy-load-provider):** Lazily load Node.js ESM modules. The lazy loading feature allows you to declare a provider that is only instantiated when it is first injected. The DI system will dynamically import the ESM module, discover injectable services within it, and instantiate them on demand—enabling efficient code splitting and reducing startup time.
|
|
62
|
+
- **Full TypeScript support:** Type inference with `inject()` and advanced tooling for type-safe DI.
|
|
67
63
|
|
|
68
|
-
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Basic Usage (Decorator API)
|
|
67
|
+
|
|
68
|
+
Declare injectable services:
|
|
69
69
|
|
|
70
70
|
```typescript
|
|
71
71
|
import {Injectable} from "@tsed/di";
|
|
72
|
-
import {Calendar} from "./models/calendar.js";
|
|
73
72
|
|
|
74
73
|
@Injectable()
|
|
75
|
-
export class
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
create(calendar: Calendar) {
|
|
79
|
-
this.calendars.push(calendar);
|
|
74
|
+
export class UserRepository {
|
|
75
|
+
getUsers() {
|
|
76
|
+
return [{id: 1, name: "Alice"}];
|
|
80
77
|
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@Injectable()
|
|
81
|
+
export class UserService {
|
|
82
|
+
constructor(private repo: UserRepository) {}
|
|
81
83
|
|
|
82
|
-
|
|
83
|
-
return this.
|
|
84
|
+
listUsers() {
|
|
85
|
+
return this.repo.getUsers();
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
88
|
```
|
|
87
89
|
|
|
88
|
-
|
|
89
|
-
The `@Injectable()` attaches the metadata, thereby Ts.ED knows that this class is a provider.
|
|
90
|
+
Use the dependency injector:
|
|
90
91
|
|
|
91
|
-
|
|
92
|
+
```typescript
|
|
93
|
+
import {inject} from "@tsed/di";
|
|
94
|
+
import {UserService} from "./UserService.js";
|
|
95
|
+
|
|
96
|
+
const userService = inject(UserService);
|
|
97
|
+
|
|
98
|
+
console.log(userService.listUsers());
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Usage Outside Ts.ED
|
|
104
|
+
|
|
105
|
+
`@tsed/di` is completely standalone.
|
|
106
|
+
You can use it in any JS/TS project (web, CLI, backend, etc) without Ts.ED.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Stable & Recommended Initialization Example
|
|
111
|
+
|
|
112
|
+
This is the recommended and most stable way to initialize and use the injector, especially when working with advanced scenarios (settings, async providers, custom loggers, etc):
|
|
92
113
|
|
|
93
114
|
```typescript
|
|
94
|
-
import {
|
|
95
|
-
import {
|
|
96
|
-
import {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
export class CalendarCtrl {
|
|
101
|
-
constructor(private readonly calendarsService: CalendarsService) {}
|
|
102
|
-
|
|
103
|
-
@Post()
|
|
104
|
-
async create(@Body() calendar: Calendar) {
|
|
105
|
-
this.calendarsService.create(calendar);
|
|
106
|
-
}
|
|
115
|
+
import {injector, attachLogger, inject} from "@tsed/di";
|
|
116
|
+
import {$log} from "@tsed/logger";
|
|
117
|
+
import {CalendarCtrl} from "./CalendarCtrl.js";
|
|
118
|
+
|
|
119
|
+
// Create a new InjectorService instance
|
|
120
|
+
const inj = injector();
|
|
107
121
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
122
|
+
// Register your configuration provider
|
|
123
|
+
inj.addProvider(PlatformConfiguration);
|
|
124
|
+
|
|
125
|
+
// Optionally invoke and set configuration
|
|
126
|
+
inj.settings = inj.invoke(PlatformConfiguration);
|
|
127
|
+
inj.settings.set(settings);
|
|
128
|
+
|
|
129
|
+
// Attach a custom logger (optional)
|
|
130
|
+
attachLogger($log); // Overriding the default logger is not recommended
|
|
131
|
+
// You can use @tsed/logger-connect to bind Ts.ED logger with any other logger
|
|
132
|
+
|
|
133
|
+
// If you have async providers or use the ConfigSource feature, ensure to await load()
|
|
134
|
+
await inj.load();
|
|
135
|
+
|
|
136
|
+
// Retrieve your controller (or any provider)
|
|
137
|
+
const calendarCtrl = inject(CalendarCtrl);
|
|
138
|
+
|
|
139
|
+
// Use your controller/service as needed
|
|
140
|
+
calendarCtrl.create({name: "My calendar"});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Functional API (Decorator-less / Pure JS, v8+)
|
|
146
|
+
|
|
147
|
+
If you can't or don't want to use decorators (e.g. in pure JavaScript), use the **Functional API** introduced in v8+.
|
|
148
|
+
|
|
149
|
+
For exemple, we can register a provider like this:
|
|
150
|
+
|
|
151
|
+
```js
|
|
152
|
+
import {injectable, inject} from "@tsed/di";
|
|
153
|
+
|
|
154
|
+
// Define a class as injectable
|
|
155
|
+
export class UserRepository {
|
|
156
|
+
getUsers() {
|
|
157
|
+
return [{id: 1, name: "Alice"}];
|
|
111
158
|
}
|
|
112
159
|
}
|
|
160
|
+
|
|
161
|
+
injectable(UserRepository);
|
|
113
162
|
```
|
|
114
163
|
|
|
115
|
-
|
|
164
|
+
Then, you can use the `inject()` function to retrieve the instance of the class or any other provider:
|
|
116
165
|
|
|
117
|
-
```
|
|
118
|
-
import {
|
|
166
|
+
```js
|
|
167
|
+
import {injectable, inject} from "@tsed/di";
|
|
168
|
+
|
|
169
|
+
// Define a factory function
|
|
170
|
+
export const GET_ALLOWED_USERS = injectable(Symbol.for("GET_ALLOWED_USERS"))
|
|
171
|
+
.factory(() => {
|
|
172
|
+
const userRepository = inject(UserRepository);
|
|
173
|
+
/// do something with userRepository
|
|
174
|
+
const users = userRepository.getAll();
|
|
175
|
+
const allowedRoles = constant("allowedRoles");
|
|
176
|
+
|
|
177
|
+
return userRepository.getUsers().filter((user) => allowedRoles.includes(user.role));
|
|
178
|
+
})
|
|
179
|
+
.token();
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
After that, we have to initialize the injector and load all providers:
|
|
183
|
+
|
|
184
|
+
```js
|
|
185
|
+
import {injector, attachLogger, inject} from "@tsed/di";
|
|
119
186
|
import {$log} from "@tsed/logger";
|
|
120
|
-
import
|
|
187
|
+
import "./services/GetAllowerUsers.js"; // just add import is enough to discover the providers
|
|
188
|
+
|
|
189
|
+
// Create a new InjectorService instance
|
|
190
|
+
const inj = injector();
|
|
191
|
+
|
|
192
|
+
// Register your configuration provider
|
|
193
|
+
inj.addProvider(PlatformConfiguration);
|
|
121
194
|
|
|
122
|
-
|
|
123
|
-
|
|
195
|
+
// Optionally invoke and set configuration
|
|
196
|
+
inj.settings = inj.invoke(PlatformConfiguration);
|
|
197
|
+
inj.settings.set(settings);
|
|
124
198
|
|
|
125
|
-
|
|
126
|
-
|
|
199
|
+
// Attach a custom logger (optional)
|
|
200
|
+
attachLogger($log); // Overriding the default logger is not recommended
|
|
201
|
+
// You can use @tsed/logger-connect to bind Ts.ED logger with any other logger
|
|
127
202
|
|
|
128
|
-
|
|
129
|
-
|
|
203
|
+
// If you have async providers or use the ConfigSource feature, ensure to await load()
|
|
204
|
+
await inj.load();
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
The example above is the main point to start the DI system. It should be placed in the main entry file of your application.
|
|
208
|
+
|
|
209
|
+
Now, you can use the `inject()` function to retrieve the instance of the class, injectable provider, or pure JavaScript function.
|
|
210
|
+
|
|
211
|
+
For example, if you want to use the `GET_ALLOWED_USERS` factory in your application, you can do it like this:
|
|
212
|
+
|
|
213
|
+
```js
|
|
214
|
+
import {injectable, inject} from "@tsed/di";
|
|
215
|
+
import {GET_ALLOWED_USERS} from "./services/GetAllowerUsers.js";
|
|
216
|
+
|
|
217
|
+
// use any framework you want like express.js, hapi.js, etc.
|
|
218
|
+
app.get("/", async (req, res) => {
|
|
219
|
+
const getAllowedUser = inject(GET_ALLOWED_USERS);
|
|
220
|
+
const users = await getAllowedUser();
|
|
221
|
+
|
|
222
|
+
res.json(users);
|
|
223
|
+
});
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Here we use the `inject()` function in a pure JavaScript function to retrieve the `GET_ALLOWED_USERS` factory.
|
|
227
|
+
This factory will be executed when the route is called, and it will return the allowed users.
|
|
228
|
+
|
|
229
|
+
In summary:
|
|
230
|
+
|
|
231
|
+
- **No decorators required.**
|
|
232
|
+
- Use `injectable()` to register functions or classes as providers.
|
|
233
|
+
- Use `factory()` or `asyncFactory()` to register (async) factories for advanced usage or for custom tokens.
|
|
234
|
+
- Prefer this approach over `registerProvider` in v8+.
|
|
235
|
+
|
|
236
|
+
---
|
|
130
237
|
|
|
131
|
-
|
|
132
|
-
await calendarController.create(new Calendar());
|
|
238
|
+
## Async Factories
|
|
133
239
|
|
|
134
|
-
|
|
135
|
-
|
|
240
|
+
You can register **async factories** to provide values/services that require asynchronous initialization (e.g., database connections):
|
|
241
|
+
|
|
242
|
+
```typescript
|
|
243
|
+
import {injectable, inject} from "@tsed/di";
|
|
244
|
+
|
|
245
|
+
const DATABASE = injectable(Symbol.for("DATABASE"))
|
|
246
|
+
.asyncFactory(async () => {
|
|
247
|
+
const db = await connectToDatabase(); // your async init logic
|
|
248
|
+
return db;
|
|
249
|
+
})
|
|
250
|
+
.token();
|
|
251
|
+
|
|
252
|
+
const db = await inject(DATABASE); // Await the async factory
|
|
253
|
+
db.query("SELECT * FROM users");
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
- Use `.asyncFactory()` for asynchronous initialization.
|
|
257
|
+
- When injecting, **await** the result if the provider is async.
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## Injecting Constants with `@Constant()` and `@Value()`
|
|
262
|
+
|
|
263
|
+
You can inject constant values or configuration using the `@Constant()` decorator (or `constant()` function in the Functional API):
|
|
264
|
+
|
|
265
|
+
```typescript
|
|
266
|
+
import {Injectable, Constant} from "@tsed/di";
|
|
136
267
|
|
|
137
|
-
|
|
138
|
-
|
|
268
|
+
@Injectable()
|
|
269
|
+
export class MyService {
|
|
270
|
+
@Constant("app.token") private token: string;
|
|
271
|
+
|
|
272
|
+
printToken() {
|
|
273
|
+
console.log(this.token); // Value from config
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
You can also use `@Value()` to inject the resolved value of a provider (by token), or `refValue()` for the functional API:
|
|
279
|
+
|
|
280
|
+
```typescript
|
|
281
|
+
import {Injectable, Value} from "@tsed/di";
|
|
282
|
+
|
|
283
|
+
@Injectable()
|
|
284
|
+
export class MyService {
|
|
285
|
+
@Value("MY_TOKEN") private value: string;
|
|
286
|
+
|
|
287
|
+
printValue() {
|
|
288
|
+
console.log(this.value); // Value from MY_TOKEN provider
|
|
289
|
+
}
|
|
139
290
|
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
**Functional API for constants and values:**
|
|
140
294
|
|
|
141
|
-
|
|
295
|
+
```js
|
|
296
|
+
import {constant, refValue, inject} from "@tsed/di";
|
|
297
|
+
|
|
298
|
+
const appToken = constant("app.token", "my-api-token"); // frozen value
|
|
299
|
+
const refAppToken = refValue(); // reference to the app.token value. not frozen
|
|
142
300
|
```
|
|
143
301
|
|
|
144
|
-
|
|
302
|
+
- Use `@Constant()`/`constant()` for static configuration values.
|
|
303
|
+
- Use `@Value()`/`refValue()` for dynamic values.
|
|
304
|
+
|
|
305
|
+
Learn more: [Constants and Value Injection](https://tsed.dev/docs/providers.html#constant)
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## Providers
|
|
310
|
+
|
|
311
|
+
`@tsed/di` supports multiple provider types:
|
|
312
|
+
|
|
313
|
+
- **@Injectable:** Basic class providers.
|
|
314
|
+
- **@Service:** Same as `@Injectable`, for semantic clarity.
|
|
315
|
+
- **@Interceptor:** For registering interceptors.
|
|
316
|
+
- **Functional API:** Use `injectable()`, `.factory()`, `.asyncFactory()`, `.value()` for manual/advanced registration.
|
|
317
|
+
- **Constants:** With `@Constant()`/`constant()`.
|
|
318
|
+
- **Values:** With `@Value()`/`refValue()`.
|
|
319
|
+
- **Scoped providers:** Support for singleton, request, and custom scopes.
|
|
320
|
+
|
|
321
|
+
See [Providers documentation](https://tsed.dev/docs/providers.html).
|
|
322
|
+
|
|
323
|
+
---
|
|
145
324
|
|
|
146
|
-
|
|
325
|
+
## Documentation & Resources
|
|
147
326
|
|
|
148
|
-
-
|
|
149
|
-
-
|
|
150
|
-
-
|
|
151
|
-
-
|
|
327
|
+
- **[Providers](https://tsed.dev/docs/providers.html)**
|
|
328
|
+
- **[Custom Providers](https://tsed.dev/docs/custom-providers.html)**
|
|
329
|
+
- **[Constants & Value Injection](https://tsed.dev/docs/providers.html#c)**
|
|
330
|
+
- **[Config Sources](https://tsed.dev/docs/configuration/configuration-sources.html)**
|
|
331
|
+
- **[Functional API](https://tsed.dev/docs/di-functional-api.html)**
|
|
332
|
+
- **[InjectContext](https://tsed.dev/docs/di-injectcontext.html)**
|
|
152
333
|
|
|
153
|
-
|
|
334
|
+
---
|
|
154
335
|
|
|
155
336
|
## Contributors
|
|
156
337
|
|
|
@@ -58,6 +58,7 @@ export function Controller(options: PathType | ControllerOptions): ClassDecorato
|
|
|
58
58
|
(target: Type) => {
|
|
59
59
|
controller(target, opts);
|
|
60
60
|
},
|
|
61
|
+
// TODO @tsed/schema: remove this when we have a better solution
|
|
61
62
|
path && Path(path as any),
|
|
62
63
|
Children(...children)
|
|
63
64
|
);
|
|
@@ -34,7 +34,7 @@ describe("LazyInject", () => {
|
|
|
34
34
|
const service = inject<MyInjectable>(MyInjectable);
|
|
35
35
|
const error = await catchAsyncError(() => service.lazy);
|
|
36
36
|
|
|
37
|
-
expect(error?.message).toContain("
|
|
37
|
+
expect(error?.message).toContain("'lazy-module' imported from");
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
it("should lazy load optionally a module", async () => {
|