@shellicar/core-di 3.1.4 → 3.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";var e=Object.defineProperty,t=(t,r)=>e(t,"name",{value:r,configurable:!0}),r=new WeakMap;function i(e,t,r,i){return e.reverse().forEach(e=>{i=e(t,r,i)||i}),i}function s(e,t){return e.reverse().forEach(e=>{const r=e(t);r&&(t=r)}),t}function o(e,t,r,o){if(!Array.isArray(e)||0===e.length)throw new TypeError;return void 0!==r?i(e,t,r,o):"function"==typeof t?s(e,t):void 0}function n(e,t){return r.get(e)&&r.get(e).get(t)}function c(e,t,r){if(void 0===t)throw new TypeError;const i=n(t,r);return i&&i.get(e)}function a(e,t){const i=r.get(e)||new Map;r.set(e,i);const s=i.get(t)||new Map;return i.set(t,s),s}function l(e,t,r,i){if(i&&!["string","symbol"].includes(typeof i))throw new TypeError;(n(r,i)||a(r,i)).set(e,t)}function p(e,t,r){return c(e,t,r)?c(e,t,r):Object.getPrototypeOf(t)?p(e,Object.getPrototypeOf(t),r):void 0}function d(e,r){return t(function(t,i){l(e,r,t,i)},"decorator")}function h(e,t,r){return p(e,t,r)}function g(e,t,r){return c(e,t,r)}function u(e,t,r){return!!c(e,t,r)}function f(e,t,r){return!!p(e,t,r)}function v(e,t,r,i){l(e,t,r,i)}t(i,"decorateProperty"),t(s,"decorateConstructor"),t(o,"decorate"),t(n,"getMetadataMap"),t(c,"ordinaryGetOwnMetadata"),t(a,"createMetadataMap"),t(l,"ordinaryDefineOwnMetadata"),t(p,"ordinaryGetMetadata"),t(d,"metadata"),t(h,"getMetadata"),t(g,"getOwnMetadata"),t(u,"hasOwnMetadata"),t(f,"hasMetadata"),t(v,"defineMetadata");var m={decorate:o,defineMetadata:v,getMetadata:h,getOwnMetadata:g,hasMetadata:f,hasOwnMetadata:u,metadata:d};Object.assign(Reflect,m);var S=(e=>(e.Resolve="RESOLVE",e.Transient="TRANSIENT",e.Scoped="SCOPED",e.Singleton="SINGLETON",e))(S||{}),w=(e=>(e[e.Debug=0]="Debug",e[e.Info=1]="Info",e[e.Warn=2]="Warn",e[e.Error=3]="Error",e[e.None=4]="None",e))(w||{}),E=(e=>(e.Error="ERROR",e.LastRegistered="LAST_REGISTERED",e))(E||{}),y={registrationMode:"ERROR",logLevel:2},I=class{static{t(this,"ILogger")}debug(e,...t){}info(e,...t){}error(e,...t){}warn(e,...t){}},O=class extends I{constructor(e){super(),this.options=e}static{t(this,"ConsoleLogger")}debug(e,...t){this.options.logLevel<=0&&console.debug(e,...t)}info(e,...t){this.options.logLevel<=1&&console.info(e,...t)}warn(e,...t){this.options.logLevel<=2&&console.warn(e,...t)}error(e,...t){this.options.logLevel<=3&&console.error(e,...t)}},M=class extends Error{static{t(this,"ServiceError")}},R=class extends M{static{t(this,"UnregisteredServiceError")}name="UnregisteredServiceError";constructor(e){super(`Resolving service that has not been registered: ${e.name}`),Object.setPrototypeOf(this,new.target.prototype)}},x=class extends M{static{t(this,"MultipleRegistrationError")}name="MultipleRegistrationError";constructor(e){super(`Multiple services have been registered: ${e.name}`),Object.setPrototypeOf(this,new.target.prototype)}},b=class e extends M{constructor(t,r,i){super(e.getErrorMessage(t.name,i?.name,r)),this.identifier=t,this.innerError=r,this.implementation=i,Object.setPrototypeOf(this,new.target.prototype)}static{t(this,"ServiceCreationError")}name="ServiceCreationError";static getErrorMessage(e,t,r){const i=t?`${e} (${t})`:e;return null==r?`Error creating service: ${i}`:`Error creating service: ${i}\n${r.message}`}},D=class extends M{static{t(this,"SelfDependencyError")}name="SelfDependencyError";constructor(){super("Service depending on itself"),Object.setPrototypeOf(this,new.target.prototype)}},L=class extends M{static{t(this,"CircularDependencyError")}name="CircularDependencyError";constructor(e){super(`Circular dependency detected while resolving: ${e.name}`),Object.setPrototypeOf(this,new.target.prototype)}},C=class extends M{static{t(this,"ScopedSingletonRegistrationError")}name="ScopedSingletonRegistrationError";constructor(){super("Cannot register a singleton in a scoped service collection"),Object.setPrototypeOf(this,new.target.prototype)}},P=class extends M{static{t(this,"InvalidServiceIdentifierError")}name="InvalidServiceIdentifierError";constructor(){super("Cannot register null or undefined service identifier"),Object.setPrototypeOf(this,new.target.prototype)}},N=class extends M{static{t(this,"InvalidImplementationError")}name="InvalidImplementationError";constructor(e){super(`Invalid implementation provided for service: ${e?.name??"undefined"}`),Object.setPrototypeOf(this,new.target.prototype)}},T=t(()=>new Map,"createRegistrationMap"),j=t(()=>new Map,"createDescriptorMap"),A=class{constructor(e,t,r){this.identifiers=e,this.isScoped=t,this.addService=r}static{t(this,"ServiceBuilder")}descriptor;to(e,t){if(null==e)throw new N(this.identifiers[0]);this.descriptor=this.createDescriptor(t,e);for(const e of this.identifiers)this.addService(e,this.descriptor);return this}createDescriptor(e,t){return{implementation:t,lifetime:"RESOLVE",createInstance:e??(()=>new t)}}singleton(){if(this.isScoped)throw new C;return this.ensureDescriptor().lifetime="SINGLETON",this}scoped(){return this.ensureDescriptor().lifetime="SCOPED",this}transient(){return this.ensureDescriptor().lifetime="TRANSIENT",this}ensureDescriptor(){if(!this.descriptor)throw new Error("Must call to() before setting lifetime");return this.descriptor}},$=class{static{t(this,"IDisposable")}},F=class{static{t(this,"IServiceModule")}},G=class{static{t(this,"IResolutionScope")}},k=class extends G{static{t(this,"IScopedProvider")}},B=class extends G{static{t(this,"IServiceProvider")}},U=class{static{t(this,"IServiceCollection")}},V=class{static{t(this,"ILifetimeBuilder")}},W=class{static{t(this,"IServiceBuilder")}},_="design:dependencies",q=t((e,t)=>Reflect.getMetadata(e,t),"getMetadata"),z=t((e,t,r)=>Reflect.defineMetadata(e,t,r),"defineMetadata"),H=class{constructor(e,t,r){this.singletons=e,this.scoped=t,this.targetIdentifier=r}static{t(this,"ResolutionContext")}transient=T();resolving=new Set;markResolving(e){return!this.resolving.has(e)&&(this.resolving.add(e),!0)}unmarkResolving(e){this.resolving.delete(e)}getFromLifetime(e,t){const r=this.getMapForLifetime(t);return r?.get(e)}setForLifetime(e,t,r){const i=this.getMapForLifetime(r);i?.set(e,t)}getMapForLifetime(e){return{SINGLETON:this.singletons,SCOPED:this.scoped,RESOLVE:this.transient}[e]}},J=class e{constructor(e,t,r=T()){this.logger=e,this.Services=t,this.singletons=r}static{t(this,"ServiceProvider")}scoped=T();created=[];[Symbol.dispose](){for(const e of this.created)e[Symbol.dispose]()}resolveInternal(e,t,r){const i=t.getFromLifetime(e.implementation,e.lifetime);if(null!=i)return i;const s=r||e.implementation;if(!t.markResolving(e.implementation))throw new L(s);try{return this.createInstance(e,t,r)}finally{t.unmarkResolving(e.implementation)}}resolveAll(e,t){const r=this.Services.get(e),i=t??new H(this.singletons,this.scoped,e);return r.map(t=>this.resolveInternal(t,i,e))}resolve(e,t){if(e.prototype===G.prototype||e.prototype===k.prototype||e.prototype===B.prototype)return this;const r=this.getSingleDescriptor(e),i=t??new H(this.singletons,this.scoped,e);try{return this.resolveInternal(r,i,e)}catch(t){throw this.wrapDependencyResolutionError(t,e,r,i)}}wrapDependencyResolutionError(e,t,r,i){if(e instanceof b&&e.identifier!==t)throw new b(t,e,r.implementation);throw e}getSingleDescriptor(e){const t=this.Services.get(e);if(0===t.length)throw new R(e);if(t.length>1&&"ERROR"===this.Services.options.registrationMode)throw new x(e);return t[t.length-1]}createInstance(e,t,r){const i=this.createInstanceInternal(e,t,r);return this.setDependencies(e.implementation,i,t,r),t.setForLifetime(e.implementation,i,e.lifetime),i}wrapContext(e){return{resolve:t(t=>this.resolve(t,e),"resolve"),resolveAll:t(t=>this.resolveAll(t,e),"resolveAll")}}createInstanceInternal(e,t,r){let i;try{i=e.createInstance(this.wrapContext(t))}catch(t){this.logger.error(t);const i=r||e.implementation;if(t instanceof Error)throw new b(i,t,e.implementation);throw new b(i,void 0,e.implementation)}return"SINGLETON"!==e.lifetime&&Symbol.dispose in i&&this.created.push(i),i}createScope(){return new e(this.logger,this.Services.clone(!0),this.singletons)}setDependencies(e,t,r,i){const s=q(_,e)??{};this.logger.debug("Dependencies",e.name,s);for(const[o,n]of Object.entries(s)){if(n===i)throw new D;this.logger.debug("Resolving",n.name,"for",e.name);const s=this.resolve(n,r);t[o]=s}return t}},K=class e{constructor(e,t,r,i=j()){this.logger=e,this.options=t,this.isScoped=r,this.services=i}static{t(this,"ServiceCollection")}registerModules(...e){for(const t of e){(new t).registerServices(this)}}get(e){return this.services.get(e)??[]}overrideLifetime(e,t){for(const r of this.get(e))r.lifetime=t}register(...e){if(0===e.length||e.some(e=>null==e))throw new P;return new A(e,this.isScoped,(e,t)=>this.addService(e,t))}addService(e,t){this.logger.info("Adding service",{identifier:e.name,descriptor:t});let r=this.services.get(e);null==r&&(r=[],this.services.set(e,r)),r.push(t)}clone(t){const r=j();for(const[e,t]of this.services){const i=t.map(e=>({...e}));r.set(e,i)}return new e(this.logger,this.options,!0===t,r)}buildProvider(){return new J(this.logger,this.clone())}},Q=t(e=>({...y,...e}),"mergeOptions"),X=t(e=>{const t=Q(e),r=t.logger??new O(t);return new K(r,t,!1)},"createServiceCollection"),Y=t((e,t,r,i)=>{let s=q(e,t);void 0===s&&(s={},z(e,s,t)),s[r]=i},"tagProperty"),Z=t(e=>(t,r)=>function(t){const i=this.constructor;return Y(_,i,r.name,e),t},"dependsOn");exports.CircularDependencyError=L,exports.DefaultServiceCollectionOptions=y,exports.IDisposable=$,exports.ILifetimeBuilder=V,exports.ILogger=I,exports.IResolutionScope=G,exports.IScopedProvider=k,exports.IServiceBuilder=W,exports.IServiceCollection=U,exports.IServiceModule=F,exports.IServiceProvider=B,exports.InvalidImplementationError=N,exports.InvalidServiceIdentifierError=P,exports.Lifetime=S,exports.LogLevel=w,exports.MultipleRegistrationError=x,exports.ResolveMultipleMode=E,exports.ScopedSingletonRegistrationError=C,exports.SelfDependencyError=D,exports.ServiceCreationError=b,exports.ServiceError=M,exports.UnregisteredServiceError=R,exports.createServiceCollection=X,exports.dependsOn=Z;//# sourceMappingURL=index.cjs.map
1
+ "use strict";var e=Object.defineProperty,t=(t,r)=>e(t,"name",{value:r,configurable:!0}),r=new WeakMap;function i(e,t,r,i){return e.reverse().forEach(e=>{i=e(t,r,i)||i}),i}function s(e,t){return e.reverse().forEach(e=>{const r=e(t);r&&(t=r)}),t}function o(e,t,r,o){if(!Array.isArray(e)||0===e.length)throw new TypeError;return void 0!==r?i(e,t,r,o):"function"==typeof t?s(e,t):void 0}function n(e,t){return r.get(e)&&r.get(e).get(t)}function c(e,t,r){if(void 0===t)throw new TypeError;const i=n(t,r);return i&&i.get(e)}function a(e,t){const i=r.get(e)||new Map;r.set(e,i);const s=i.get(t)||new Map;return i.set(t,s),s}function l(e,t,r,i){if(i&&!["string","symbol"].includes(typeof i))throw new TypeError;(n(r,i)||a(r,i)).set(e,t)}function p(e,t,r){return c(e,t,r)?c(e,t,r):Object.getPrototypeOf(t)?p(e,Object.getPrototypeOf(t),r):void 0}function d(e,r){return t(function(t,i){l(e,r,t,i)},"decorator")}function h(e,t,r){return p(e,t,r)}function g(e,t,r){return c(e,t,r)}function u(e,t,r){return!!c(e,t,r)}function f(e,t,r){return!!p(e,t,r)}function v(e,t,r,i){l(e,t,r,i)}t(i,"decorateProperty"),t(s,"decorateConstructor"),t(o,"decorate"),t(n,"getMetadataMap"),t(c,"ordinaryGetOwnMetadata"),t(a,"createMetadataMap"),t(l,"ordinaryDefineOwnMetadata"),t(p,"ordinaryGetMetadata"),t(d,"metadata"),t(h,"getMetadata"),t(g,"getOwnMetadata"),t(u,"hasOwnMetadata"),t(f,"hasMetadata"),t(v,"defineMetadata");var m={decorate:o,defineMetadata:v,getMetadata:h,getOwnMetadata:g,hasMetadata:f,hasOwnMetadata:u,metadata:d};Object.assign(Reflect,m);var S=(e=>(e.Resolve="RESOLVE",e.Transient="TRANSIENT",e.Scoped="SCOPED",e.Singleton="SINGLETON",e))(S||{}),w=(e=>(e[e.Debug=0]="Debug",e[e.Info=1]="Info",e[e.Warn=2]="Warn",e[e.Error=3]="Error",e[e.None=4]="None",e))(w||{}),E=(e=>(e.Error="ERROR",e.LastRegistered="LAST_REGISTERED",e))(E||{}),y={registrationMode:"ERROR",logLevel:2},I=class{static{t(this,"ILogger")}debug(e,...t){}info(e,...t){}error(e,...t){}warn(e,...t){}},O=class extends I{constructor(e){super(),this.options=e}static{t(this,"ConsoleLogger")}debug(e,...t){this.options.logLevel<=0&&console.debug(e,...t)}info(e,...t){this.options.logLevel<=1&&console.info(e,...t)}warn(e,...t){this.options.logLevel<=2&&console.warn(e,...t)}error(e,...t){this.options.logLevel<=3&&console.error(e,...t)}},M=class extends Error{static{t(this,"ServiceError")}},R=class extends M{static{t(this,"UnregisteredServiceError")}name="UnregisteredServiceError";constructor(e){super(`Resolving service that has not been registered: ${e.name}`),Object.setPrototypeOf(this,new.target.prototype)}},x=class extends M{static{t(this,"MultipleRegistrationError")}name="MultipleRegistrationError";constructor(e){super(`Multiple services have been registered: ${e.name}`),Object.setPrototypeOf(this,new.target.prototype)}},b=class e extends M{constructor(t,r,i){super(e.getErrorMessage(t.name,i?.name,r)),this.identifier=t,this.innerError=r,this.implementation=i,Object.setPrototypeOf(this,new.target.prototype)}static{t(this,"ServiceCreationError")}name="ServiceCreationError";static getErrorMessage(e,t,r){const i=t?`${e} (${t})`:e;return null==r?`Error creating service: ${i}`:`Error creating service: ${i}\n${r.message}`}},D=class extends M{static{t(this,"SelfDependencyError")}name="SelfDependencyError";constructor(){super("Service depending on itself"),Object.setPrototypeOf(this,new.target.prototype)}},L=class extends M{static{t(this,"CircularDependencyError")}name="CircularDependencyError";constructor(e){super(`Circular dependency detected while resolving: ${e.name}`),Object.setPrototypeOf(this,new.target.prototype)}},C=class extends M{static{t(this,"ScopedSingletonRegistrationError")}name="ScopedSingletonRegistrationError";constructor(){super("Cannot register a singleton in a scoped service collection"),Object.setPrototypeOf(this,new.target.prototype)}},P=class extends M{static{t(this,"InvalidServiceIdentifierError")}name="InvalidServiceIdentifierError";constructor(){super("Cannot register null or undefined service identifier"),Object.setPrototypeOf(this,new.target.prototype)}},N=class extends M{static{t(this,"InvalidImplementationError")}name="InvalidImplementationError";constructor(e){super(`Invalid implementation provided for service: ${e?.name??"undefined"}`),Object.setPrototypeOf(this,new.target.prototype)}},T=t(()=>new Map,"createRegistrationMap"),j=t(()=>new Map,"createDescriptorMap"),A=class{constructor(e,t,r){this.identifiers=e,this.isScoped=t,this.addService=r}static{t(this,"ServiceBuilder")}descriptor;to(e,t){if(null==e)throw new N(this.identifiers[0]);this.descriptor=this.createDescriptor(t,e);for(const e of this.identifiers)this.addService(e,this.descriptor);return this}createDescriptor(e,t){return{implementation:t,lifetime:"RESOLVE",createInstance:e??(()=>new t)}}singleton(){if(this.isScoped)throw new C;return this.ensureDescriptor().lifetime="SINGLETON",this}scoped(){return this.ensureDescriptor().lifetime="SCOPED",this}transient(){return this.ensureDescriptor().lifetime="TRANSIENT",this}ensureDescriptor(){if(!this.descriptor)throw new Error("Must call to() before setting lifetime");return this.descriptor}},$=class{static{t(this,"IDisposable")}},F=class{static{t(this,"IServiceModule")}},G=class{static{t(this,"IResolutionScope")}},k=class extends G{static{t(this,"IScopedProvider")}},B=class extends G{static{t(this,"IServiceProvider")}},U=class{static{t(this,"IServiceCollection")}},V=class{static{t(this,"ILifetimeBuilder")}},W=class{static{t(this,"IServiceBuilder")}},_="design:dependencies",q=t((e,t)=>Reflect.getMetadata(e,t),"getMetadata"),z=t((e,t,r)=>Reflect.defineMetadata(e,t,r),"defineMetadata"),H=class{constructor(e,t,r){this.singletons=e,this.scoped=t,this.targetIdentifier=r}static{t(this,"ResolutionContext")}transient=T();resolving=new Set;markResolving(e){return!this.resolving.has(e)&&(this.resolving.add(e),!0)}unmarkResolving(e){this.resolving.delete(e)}getFromLifetime(e,t){const r=this.getMapForLifetime(t);return r?.get(e)}setForLifetime(e,t,r){const i=this.getMapForLifetime(r);i?.set(e,t)}getMapForLifetime(e){return{SINGLETON:this.singletons,SCOPED:this.scoped,RESOLVE:this.transient}[e]}},J=class e{constructor(e,t,r,i,s){this.logger=e,this.Services=t,this.singletons=r,this.singletonDisposables=i,this.isRoot=s}static{t(this,"ServiceProvider")}scoped=T();created=[];static createRoot(t,r){return new e(t,r,T(),[],!0)}[Symbol.dispose](){for(const e of this.created)e[Symbol.dispose]();if(this.isRoot)for(const e of this.singletonDisposables)e[Symbol.dispose]()}resolveInternal(e,t,r){const i=t.getFromLifetime(e.implementation,e.lifetime);if(null!=i)return i;const s=r||e.implementation;if(!t.markResolving(e.implementation))throw new L(s);try{return this.createInstance(e,t,r)}finally{t.unmarkResolving(e.implementation)}}resolveAll(e,t){const r=this.Services.get(e),i=t??new H(this.singletons,this.scoped,e);return r.map(t=>this.resolveInternal(t,i,e))}resolve(e,t){if(e.prototype===G.prototype||e.prototype===k.prototype||e.prototype===B.prototype)return this;const r=this.getSingleDescriptor(e),i=t??new H(this.singletons,this.scoped,e);try{return this.resolveInternal(r,i,e)}catch(t){throw this.wrapDependencyResolutionError(t,e,r,i)}}wrapDependencyResolutionError(e,t,r,i){if(e instanceof b&&e.identifier!==t)throw new b(t,e,r.implementation);throw e}getSingleDescriptor(e){const t=this.Services.get(e);if(0===t.length)throw new R(e);if(t.length>1&&"ERROR"===this.Services.options.registrationMode)throw new x(e);return t[t.length-1]}createInstance(e,t,r){const i=this.createInstanceInternal(e,t,r);return this.setDependencies(e.implementation,i,t,r),t.setForLifetime(e.implementation,i,e.lifetime),i}wrapContext(e){return{resolve:t(t=>this.resolve(t,e),"resolve"),resolveAll:t(t=>this.resolveAll(t,e),"resolveAll")}}createInstanceInternal(e,t,r){let i;try{i=e.createInstance(this.wrapContext(t))}catch(t){this.logger.error(t);const i=r||e.implementation;if(t instanceof Error)throw new b(i,t,e.implementation);throw new b(i,void 0,e.implementation)}return Symbol.dispose in i&&("SINGLETON"===e.lifetime?this.singletonDisposables.push(i):this.created.push(i)),i}createScope(){return new e(this.logger,this.Services.clone(!0),this.singletons,this.singletonDisposables,!1)}setDependencies(e,t,r,i){const s=q(_,e)??{};this.logger.debug("Dependencies",e.name,s);for(const[o,n]of Object.entries(s)){if(n===i)throw new D;this.logger.debug("Resolving",n.name,"for",e.name);const s=this.resolve(n,r);t[o]=s}return t}},K=class e{constructor(e,t,r,i=j()){this.logger=e,this.options=t,this.isScoped=r,this.services=i}static{t(this,"ServiceCollection")}registerModules(...e){for(const t of e){(new t).registerServices(this)}}get(e){return this.services.get(e)??[]}overrideLifetime(e,t){for(const r of this.get(e))r.lifetime=t}register(...e){if(0===e.length||e.some(e=>null==e))throw new P;return new A(e,this.isScoped,(e,t)=>this.addService(e,t))}addService(e,t){this.logger.info("Adding service",{identifier:e.name,descriptor:t});let r=this.services.get(e);null==r&&(r=[],this.services.set(e,r)),r.push(t)}clone(t){const r=j();for(const[e,t]of this.services){const i=t.map(e=>({...e}));r.set(e,i)}return new e(this.logger,this.options,!0===t,r)}buildProvider(){return J.createRoot(this.logger,this.clone())}},Q=t(e=>({...y,...e}),"mergeOptions"),X=t(e=>{const t=Q(e),r=t.logger??new O(t);return new K(r,t,!1)},"createServiceCollection"),Y=t((e,t,r,i)=>{let s=q(e,t);void 0===s&&(s={},z(e,s,t)),s[r]=i},"tagProperty"),Z=t(e=>(t,r)=>function(t){const i=this.constructor;return Y(_,i,r.name,e),t},"dependsOn");exports.CircularDependencyError=L,exports.DefaultServiceCollectionOptions=y,exports.IDisposable=$,exports.ILifetimeBuilder=V,exports.ILogger=I,exports.IResolutionScope=G,exports.IScopedProvider=k,exports.IServiceBuilder=W,exports.IServiceCollection=U,exports.IServiceModule=F,exports.IServiceProvider=B,exports.InvalidImplementationError=N,exports.InvalidServiceIdentifierError=P,exports.Lifetime=S,exports.LogLevel=w,exports.MultipleRegistrationError=x,exports.ResolveMultipleMode=E,exports.ScopedSingletonRegistrationError=C,exports.SelfDependencyError=D,exports.ServiceCreationError=b,exports.ServiceError=M,exports.UnregisteredServiceError=R,exports.createServiceCollection=X,exports.dependsOn=Z;//# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../node_modules/.pnpm/@abraham+reflection@0.13.0/node_modules/@abraham/reflection/src/index.ts","../../src/enums.ts","../../src/defaults.ts","../../src/logger.ts","../../src/private/consoleLogger.ts","../../src/errors.ts","../../src/types.ts","../../src/private/ServiceBuilder.ts","../../src/interfaces.ts","../../src/private/constants.ts","../../src/private/metadata.ts","../../src/private/ResolutionContext.ts","../../src/private/ServiceProvider.ts","../../src/private/ServiceCollection.ts","../../src/createServiceCollection.ts","../../src/dependsOn.ts"],"names":["Lifetime","LogLevel","ResolveMultipleMode","getMetadata","defineMetadata","metadata"],"mappings":";;;;AAUA,IAAM,QAAA,uBAAe,OAAA,EAAO;AAE5B,SAAS,gBAAA,CACP,UAAA,EACA,MAAA,EACA,WAAA,EACA,UAAA,EAA+B;AAE/B,EAAA,UAAA,CAAW,OAAA,EAAO,CAAG,OAAA,CAAQ,CAAC,SAAA,KAA8B;AAC1D,IAAA,UAAA,GAAa,SAAA,CAAU,MAAA,EAAQ,WAAA,EAAa,UAAU,CAAA,IAAK,UAAA;EAC7D,CAAC,CAAA;AACD,EAAA,OAAO,UAAA;AACT;AAVS,MAAA,CAAA,gBAAA,EAAA,kBAAA,CAAA;AAYT,SAAS,mBAAA,CACP,YACA,MAAA,EAAgB;AAEhB,EAAA,UAAA,CAAW,OAAA,EAAO,CAAG,OAAA,CAAQ,CAAC,SAAA,KAA6B;AACzD,IAAA,MAAM,SAAA,GAAY,UAAU,MAAM,CAAA;AAClC,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,MAAA,GAAS,SAAA;AACX,IAAA;EACF,CAAC,CAAA;AACD,EAAA,OAAO,MAAA;AACT;AAXS,MAAA,CAAA,mBAAA,EAAA,qBAAA,CAAA;AAuBH,SAAU,QAAA,CACd,UAAA,EACA,MAAA,EACA,WAAA,EACA,UAAA,EAA+B;AAE/B,EAAA,IAAI,CAAC,KAAA,CAAM,OAAA,CAAQ,UAAU,CAAA,IAAK,UAAA,CAAW,WAAW,CAAA,EAAG;AACzD,IAAA,MAAM,IAAI,SA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MAAA,WAAA,CAAY,qBAAA,EAAuB,MAAA,EAAQ,GAAA,CAAI,IAAA,EAAM,UAAU,CAAA;AAC/D,MAAA,OAAO,YAAA;AAAA,IACT,CAAA;AAAA,EACF,CAAA;AACF,CAAA,EARyB,WAAA","file":"index.cjs","sourcesContent":["export type Decorator = ClassDecorator | MemberDecorator;\nexport type MemberDecorator = <T>(\n target: Target,\n propertyKey: PropertyKey,\n descriptor?: TypedPropertyDescriptor<T>,\n) => TypedPropertyDescriptor<T> | void;\nexport type MetadataKey = string | symbol;\nexport type PropertyKey = string | symbol;\nexport type Target = object | Function;\n\nconst Metadata = new WeakMap();\n\nfunction decorateProperty(\n decorators: MemberDecorator[],\n target: Target,\n propertyKey: PropertyKey,\n descriptor?: PropertyDescriptor,\n): PropertyDescriptor | undefined {\n decorators.reverse().forEach((decorator: MemberDecorator) => {\n descriptor = decorator(target, propertyKey, descriptor) || descriptor;\n });\n return descriptor;\n}\n\nfunction decorateConstructor(\n decorators: ClassDecorator[],\n target: Function,\n): Function {\n decorators.reverse().forEach((decorator: ClassDecorator) => {\n const decorated = decorator(target);\n if (decorated) {\n target = decorated;\n }\n });\n return target;\n}\n\nexport function decorate(\n decorators: ClassDecorator[],\n target: Function,\n): Function;\nexport function decorate(\n decorators: MemberDecorator[],\n target: object,\n propertyKey?: PropertyKey,\n attributes?: PropertyDescriptor,\n): PropertyDescriptor | undefined;\nexport function decorate(\n decorators: Decorator[],\n target: Target,\n propertyKey?: PropertyKey,\n attributes?: PropertyDescriptor,\n): Function | PropertyDescriptor | undefined {\n if (!Array.isArray(decorators) || decorators.length === 0) {\n throw new TypeError();\n }\n\n if (propertyKey !== undefined) {\n return decorateProperty(\n decorators as MemberDecorator[],\n target,\n propertyKey,\n attributes,\n );\n }\n\n if (typeof target === 'function') {\n return decorateConstructor(decorators as ClassDecorator[], target);\n }\n\n return;\n}\n\nfunction getMetadataMap<MetadataValue>(\n target: Target,\n propertyKey?: PropertyKey,\n): Map<MetadataKey, MetadataValue> | undefined {\n return Metadata.get(target) && Metadata.get(target).get(propertyKey);\n}\n\nfunction ordinaryGetOwnMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): MetadataValue | undefined {\n if (target === undefined) {\n throw new TypeError();\n }\n const metadataMap = getMetadataMap<MetadataValue>(target, propertyKey);\n return metadataMap && metadataMap.get(metadataKey);\n}\n\nfunction createMetadataMap<MetadataValue>(\n target: Target,\n propertyKey?: PropertyKey,\n): Map<MetadataKey, MetadataValue> {\n const targetMetadata =\n Metadata.get(target) ||\n new Map<PropertyKey | undefined, Map<MetadataKey, MetadataValue>>();\n Metadata.set(target, targetMetadata);\n const metadataMap =\n targetMetadata.get(propertyKey) || new Map<MetadataKey, MetadataValue>();\n targetMetadata.set(propertyKey, metadataMap);\n return metadataMap;\n}\n\nfunction ordinaryDefineOwnMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n metadataValue: MetadataValue,\n target: Target,\n propertyKey?: PropertyKey,\n): void {\n if (propertyKey && !['string', 'symbol'].includes(typeof propertyKey)) {\n throw new TypeError();\n }\n\n (\n getMetadataMap<MetadataValue>(target, propertyKey) ||\n createMetadataMap<MetadataValue>(target, propertyKey)\n ).set(metadataKey, metadataValue);\n}\n\nfunction ordinaryGetMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): MetadataValue | undefined {\n return ordinaryGetOwnMetadata<MetadataValue>(metadataKey, target, propertyKey)\n ? ordinaryGetOwnMetadata<MetadataValue>(metadataKey, target, propertyKey)\n : Object.getPrototypeOf(target)\n ? ordinaryGetMetadata(\n metadataKey,\n Object.getPrototypeOf(target),\n propertyKey,\n )\n : undefined;\n}\n\nexport function metadata<MetadataValue>(\n metadataKey: MetadataKey,\n metadataValue: MetadataValue,\n) {\n return function decorator(target: Target, propertyKey?: PropertyKey): void {\n ordinaryDefineOwnMetadata<MetadataValue>(\n metadataKey,\n metadataValue,\n target,\n propertyKey,\n );\n };\n}\n\nexport function getMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): MetadataValue | undefined {\n return ordinaryGetMetadata<MetadataValue>(metadataKey, target, propertyKey);\n}\n\nexport function getOwnMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): MetadataValue | undefined {\n return ordinaryGetOwnMetadata<MetadataValue>(\n metadataKey,\n target,\n propertyKey,\n );\n}\n\nexport function hasOwnMetadata(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): boolean {\n return !!ordinaryGetOwnMetadata(metadataKey, target, propertyKey);\n}\n\nexport function hasMetadata(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): boolean {\n return !!ordinaryGetMetadata(metadataKey, target, propertyKey);\n}\n\nexport function defineMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n metadataValue: MetadataValue,\n target: Target,\n propertyKey?: PropertyKey,\n): void {\n ordinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);\n}\n\nexport const Reflection = {\n decorate,\n defineMetadata,\n getMetadata,\n getOwnMetadata,\n hasMetadata,\n hasOwnMetadata,\n metadata,\n};\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace Reflect {\n let decorate: typeof Reflection.decorate;\n let defineMetadata: typeof Reflection.defineMetadata;\n let getMetadata: typeof Reflection.getMetadata;\n let getOwnMetadata: typeof Reflection.getOwnMetadata;\n let hasOwnMetadata: typeof Reflection.hasOwnMetadata;\n let hasMetadata: typeof Reflection.hasMetadata;\n let metadata: typeof Reflection.metadata;\n }\n}\n\nObject.assign(Reflect, Reflection);\n","export enum Lifetime {\n Resolve = 'RESOLVE',\n Transient = 'TRANSIENT',\n Scoped = 'SCOPED',\n Singleton = 'SINGLETON',\n}\n\nexport enum LogLevel {\n Debug = 0,\n Info = 1,\n Warn = 2,\n Error = 3,\n None = 4,\n}\n\nexport enum ResolveMultipleMode {\n Error = 'ERROR',\n LastRegistered = 'LAST_REGISTERED',\n}\n","import { LogLevel, ResolveMultipleMode } from './enums';\nimport type { ServiceCollectionOptions } from './types';\n\nexport const DefaultServiceCollectionOptions: ServiceCollectionOptions = {\n registrationMode: ResolveMultipleMode.Error,\n logLevel: LogLevel.Warn,\n};\n","export abstract class ILogger {\n public debug(_message?: any, ..._optionalParams: any[]) {}\n public info(_message?: any, ..._optionalParams: any[]) {}\n public error(_message?: any, ..._optionalParams: any[]) {}\n public warn(_message?: any, ..._optionalParams: any[]) {}\n}\n","import { LogLevel } from '../enums';\nimport { ILogger } from '../logger';\nimport type { ServiceCollectionOptions } from '../types';\n\nexport class ConsoleLogger extends ILogger {\n constructor(private readonly options: ServiceCollectionOptions) {\n super();\n }\n\n public override debug(message?: any, ...optionalParams: any[]): void {\n if (this.options.logLevel <= LogLevel.Debug) {\n console.debug(message, ...optionalParams);\n }\n }\n\n public override info(message?: any, ...optionalParams: any[]): void {\n if (this.options.logLevel <= LogLevel.Info) {\n console.info(message, ...optionalParams);\n }\n }\n\n public override warn(message?: any, ...optionalParams: any[]): void {\n if (this.options.logLevel <= LogLevel.Warn) {\n console.warn(message, ...optionalParams);\n }\n }\n\n public override error(message?: any, ...optionalParams: any[]): void {\n if (this.options.logLevel <= LogLevel.Error) {\n console.error(message, ...optionalParams);\n }\n }\n}\n","import type { ServiceIdentifier, ServiceImplementation, ServiceRegistration } from './types';\n\nexport abstract class ServiceError extends Error {}\n\nexport class UnregisteredServiceError<T extends object> extends ServiceError {\n name = 'UnregisteredServiceError';\n constructor(identifier: ServiceIdentifier<T>) {\n super(`Resolving service that has not been registered: ${identifier.name}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class MultipleRegistrationError<T extends object> extends ServiceError {\n name = 'MultipleRegistrationError';\n constructor(identifier: ServiceIdentifier<T>) {\n super(`Multiple services have been registered: ${identifier.name}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class ServiceCreationError<T extends object> extends ServiceError {\n name = 'ServiceCreationError';\n constructor(\n public readonly identifier: ServiceIdentifier<T>,\n public readonly innerError?: Error,\n public readonly implementation?: ServiceRegistration<T>,\n ) {\n super(ServiceCreationError.getErrorMessage(identifier.name, implementation?.name, innerError));\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static getErrorMessage(identifierName: string, implementationName: string | undefined, innerError: Error | undefined): string {\n const serviceName = implementationName ? `${identifierName} (${implementationName})` : identifierName;\n if (innerError == null) {\n return `Error creating service: ${serviceName}`;\n }\n return `Error creating service: ${serviceName}\\n${innerError.message}`;\n }\n}\n\nexport class SelfDependencyError extends ServiceError {\n name = 'SelfDependencyError';\n constructor() {\n super('Service depending on itself');\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class CircularDependencyError extends ServiceError {\n name = 'CircularDependencyError';\n constructor(identifier: ServiceIdentifier<object>) {\n super(`Circular dependency detected while resolving: ${identifier.name}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class ScopedSingletonRegistrationError extends ServiceError {\n name = 'ScopedSingletonRegistrationError';\n constructor() {\n super('Cannot register a singleton in a scoped service collection');\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class InvalidServiceIdentifierError extends ServiceError {\n name = 'InvalidServiceIdentifierError';\n constructor() {\n super('Cannot register null or undefined service identifier');\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class InvalidImplementationError<T extends object> extends ServiceError {\n name = 'InvalidImplementationError';\n constructor(identifier: ServiceIdentifier<T> | undefined) {\n super(`Invalid implementation provided for service: ${identifier?.name ?? 'undefined'}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n","import type { Lifetime, LogLevel, ResolveMultipleMode } from './enums';\nimport type { ILifetimeBuilder, IResolutionScope, IServiceModule } from './interfaces';\nimport type { ILogger } from './logger';\nimport type { ConsoleLogger } from './private/consoleLogger';\n\nexport type SourceType = object;\n\nexport type AbstractNewable<T> = abstract new (...args: any[]) => T;\nexport type Newable<T> = new (...args: any[]) => T;\n\nexport type ServiceIdentifier<T extends SourceType> = { prototype: T; name: string }; //AbstractNewable<T>;\nexport type ServiceImplementation<T extends SourceType> = Newable<T>;\nexport type ServiceRegistration<T extends SourceType> = ServiceIdentifier<T> | ServiceImplementation<T>;\n\nexport type InstanceFactory<T extends SourceType> = (x: IResolutionScope) => T;\n\nexport type ServiceModuleType = Newable<IServiceModule>;\n\nexport type ServiceDescriptor<T extends SourceType> = {\n readonly implementation: ServiceRegistration<T>;\n lifetime: Lifetime;\n createInstance(context: IResolutionScope): T;\n};\n\nexport type MetadataType<T extends SourceType> = Record<string | symbol, ServiceIdentifier<T>>;\n\nexport type ServiceCollectionOptions = {\n /**\n * Whether calling `resolve` when there are multiple registrations\n * will result in an error or resolve the last registered service.\n * @default ResolveMultipleMode.Error\n */\n registrationMode: ResolveMultipleMode;\n /**\n * The default log level for the console logger.\n * @defaultValue {@link LogLevel.Warn}\n */\n logLevel: LogLevel;\n /**\n * Custom implementation for logger. Ignores log level.\n * @defaultValue {@link ConsoleLogger}\n */\n logger?: ILogger;\n};\n\nexport type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;\n\nexport type EnsureObject<T> = T extends object ? T : never;\n\nexport type ServiceBuilderOptions<T extends SourceType> = {\n (implementation: ServiceImplementation<T>): ILifetimeBuilder;\n (implementation: ServiceIdentifier<T>, factory: InstanceFactory<T>): ILifetimeBuilder;\n};\n\nexport type RegistrationMap<T extends SourceType = any> = Map<ServiceRegistration<T>, T>;\nexport type DescriptorMap<T extends SourceType = any> = Map<ServiceIdentifier<T>, ServiceDescriptor<T>[]>;\n\nexport const createRegistrationMap = <T extends SourceType = any>() => {\n return new Map<ServiceRegistration<T>, T>();\n};\n\nexport const createDescriptorMap = <T extends SourceType = any>() => {\n return new Map<ServiceIdentifier<T>, ServiceDescriptor<T>[]>();\n};\n","import { Lifetime } from '../enums';\nimport { InvalidImplementationError, ScopedSingletonRegistrationError } from '../errors';\nimport type { ILifetimeBuilder, IServiceBuilder } from '../interfaces';\nimport type { InstanceFactory, ServiceDescriptor, ServiceIdentifier, ServiceImplementation, ServiceRegistration, SourceType } from '../types';\n\nexport class ServiceBuilder<T extends SourceType> implements IServiceBuilder<T> {\n private descriptor: ServiceDescriptor<T> | undefined;\n\n constructor(\n private readonly identifiers: ServiceIdentifier<T>[],\n private readonly isScoped: boolean,\n private readonly addService: (identifier: ServiceIdentifier<T>, descriptor: ServiceDescriptor<T>) => void,\n ) {}\n\n public to(implementation: ServiceImplementation<T>): ILifetimeBuilder;\n public to(implementation: ServiceIdentifier<T>, factory?: InstanceFactory<T>): ILifetimeBuilder;\n public to(implementation: ServiceRegistration<T>, factory?: InstanceFactory<T> | undefined): ILifetimeBuilder {\n if (implementation == null) {\n throw new InvalidImplementationError<T>(this.identifiers[0]);\n }\n\n this.descriptor = this.createDescriptor(factory, implementation);\n\n for (const identifier of this.identifiers) {\n this.addService(identifier, this.descriptor);\n }\n return this;\n }\n\n private createDescriptor(factory: InstanceFactory<T> | undefined, implementation: ServiceRegistration<T>): ServiceDescriptor<T> {\n return {\n implementation,\n lifetime: Lifetime.Resolve,\n createInstance: factory ?? (() => new (implementation as ServiceImplementation<T>)()),\n };\n }\n\n public singleton(): this {\n if (this.isScoped) {\n throw new ScopedSingletonRegistrationError();\n }\n this.ensureDescriptor().lifetime = Lifetime.Singleton;\n return this;\n }\n\n public scoped(): this {\n this.ensureDescriptor().lifetime = Lifetime.Scoped;\n return this;\n }\n\n public transient(): this {\n this.ensureDescriptor().lifetime = Lifetime.Transient;\n return this;\n }\n\n private ensureDescriptor(): ServiceDescriptor<T> {\n if (!this.descriptor) {\n throw new Error('Must call to() before setting lifetime');\n }\n return this.descriptor;\n }\n}\n","import type { Lifetime } from './enums';\nimport { ResolveMultipleMode } from './enums';\nimport type { EnsureObject, ServiceBuilderOptions, ServiceCollectionOptions, ServiceDescriptor, ServiceIdentifier, ServiceModuleType, SourceType, UnionToIntersection } from './types';\n\nexport abstract class IDisposable {\n public abstract [Symbol.dispose](): void;\n}\n\nexport abstract class IServiceModule {\n public abstract registerServices(services: IServiceCollection): void;\n}\n\nexport abstract class IResolutionScope {\n /**\n * Resolves a single implementation for the given identifier.\n * @template T The type of service to resolve\n * @param identifier The service identifier\n * @returns The resolved instance\n * @throws {MultipleRegistrationError} When multiple implementations exist (unless {@link ServiceCollectionOptions.registrationMode} is set to {@link ResolveMultipleMode.LastRegistered}).\n * @throws {UnregisteredServiceError} When no implementation exists\n */\n public abstract resolve<T extends SourceType>(identifier: ServiceIdentifier<T>): T;\n\n /**\n * Resolves all implementations for the given identifier.\n * @template T The type of service to resolve\n * @param identifier The service identifier\n * @returns Array of resolved instances\n */\n public abstract resolveAll<T extends SourceType>(identifier: ServiceIdentifier<T>): T[];\n}\n\nexport abstract class IScopedProvider extends IResolutionScope implements IDisposable {\n public abstract readonly Services: IServiceCollection;\n public abstract [Symbol.dispose](): void;\n}\n\nexport abstract class IServiceProvider extends IResolutionScope {\n public abstract readonly Services: IServiceCollection;\n public abstract createScope(): IScopedProvider;\n}\n\nexport abstract class IServiceCollection {\n public abstract readonly options: ServiceCollectionOptions;\n public abstract get<T extends SourceType>(identifier: ServiceIdentifier<T>): ServiceDescriptor<T>[];\n /**\n * Registers one or more service identifiers with the service collection.\n * @param identifiers One or more service identifiers to register\n * @returns A service builder to configure the implementation and lifetime\n * @throws {InvalidServiceIdentifierError} When any identifier is null or undefined\n */\n public abstract register<Types extends [SourceType, ...SourceType[]]>(...identifiers: { [K in keyof Types]: ServiceIdentifier<Types[K]> }): IServiceBuilder<EnsureObject<UnionToIntersection<Types[number]>>>;\n public abstract registerModules(...modules: ServiceModuleType[]): void;\n public abstract overrideLifetime<T extends SourceType>(identifier: ServiceIdentifier<T>, lifetime: Lifetime): void;\n public abstract buildProvider(): IServiceProvider;\n public abstract clone(): IServiceCollection;\n public abstract clone(scoped: true): IServiceCollection;\n}\n\nexport abstract class ILifetimeBuilder {\n public abstract singleton(): ILifetimeBuilder;\n public abstract scoped(): ILifetimeBuilder;\n public abstract transient(): ILifetimeBuilder;\n}\n\nexport abstract class IServiceBuilder<T extends SourceType> {\n public abstract to: ServiceBuilderOptions<T>;\n}\n","export const DesignDependenciesKey = 'design:dependencies';\n","import '@abraham/reflection';\nimport type { MetadataType, SourceType } from '../types';\n\nexport const getMetadata = <T extends SourceType>(key: string, obj: object): MetadataType<T> | undefined => Reflect.getMetadata(key, obj);\nexport const defineMetadata = <T extends SourceType>(key: string, metadata: MetadataType<T>, obj: object) => Reflect.defineMetadata(key, metadata, obj);\n","import { Lifetime } from '../enums';\nimport { createRegistrationMap, type RegistrationMap, type ServiceIdentifier, type ServiceRegistration, type SourceType } from '../types';\n\nexport class ResolutionContext {\n constructor(\n private readonly singletons: RegistrationMap,\n private readonly scoped: RegistrationMap,\n public readonly targetIdentifier?: ServiceIdentifier<any>,\n ) {}\n\n private readonly transient: RegistrationMap = createRegistrationMap();\n private readonly resolving = new Set<ServiceRegistration<SourceType>>();\n\n public markResolving<T extends SourceType>(implementation: ServiceRegistration<T>): boolean {\n if (this.resolving.has(implementation)) {\n return false;\n }\n this.resolving.add(implementation);\n return true;\n }\n\n public unmarkResolving<T extends SourceType>(implementation: ServiceRegistration<T>): void {\n this.resolving.delete(implementation);\n }\n\n public getFromLifetime<T extends SourceType>(implementation: ServiceRegistration<T>, lifetime: Lifetime): T | null {\n const map = this.getMapForLifetime(lifetime);\n return map?.get(implementation);\n }\n\n public setForLifetime<T extends SourceType>(implementation: ServiceRegistration<T>, instance: T, lifetime: Lifetime): void {\n const map = this.getMapForLifetime(lifetime);\n map?.set(implementation, instance);\n }\n\n private getMapForLifetime(lifetime: Lifetime) {\n const map: Partial<Record<Lifetime, RegistrationMap>> = {\n [Lifetime.Singleton]: this.singletons,\n [Lifetime.Scoped]: this.scoped,\n [Lifetime.Resolve]: this.transient,\n };\n return map[lifetime];\n }\n}\n","import { Lifetime, ResolveMultipleMode } from '../enums';\nimport { CircularDependencyError, MultipleRegistrationError, SelfDependencyError, ServiceCreationError, UnregisteredServiceError } from '../errors';\nimport { type IDisposable, IResolutionScope, IScopedProvider, type IServiceCollection, IServiceProvider } from '../interfaces';\nimport type { ILogger } from '../logger';\nimport { createRegistrationMap, type ServiceDescriptor, type ServiceIdentifier, type ServiceImplementation, type ServiceRegistration, type SourceType } from '../types';\nimport { DesignDependenciesKey } from './constants';\nimport { getMetadata } from './metadata';\nimport { ResolutionContext } from './ResolutionContext';\n\nexport class ServiceProvider implements IServiceProvider, IScopedProvider {\n private scoped = createRegistrationMap();\n private created: IDisposable[] = [];\n\n constructor(\n private readonly logger: ILogger,\n public readonly Services: IServiceCollection,\n private readonly singletons = createRegistrationMap(),\n ) {}\n\n [Symbol.dispose]() {\n for (const x of this.created) {\n x[Symbol.dispose]();\n }\n }\n\n private resolveInternal<T extends SourceType>(descriptor: ServiceDescriptor<T>, context: ResolutionContext, serviceIdentifier?: ServiceIdentifier<T>): T {\n const existing = context.getFromLifetime(descriptor.implementation, descriptor.lifetime);\n if (existing != null) {\n return existing;\n }\n const identifier = serviceIdentifier || descriptor.implementation;\n if (!context.markResolving(descriptor.implementation)) {\n throw new CircularDependencyError(identifier);\n }\n try {\n return this.createInstance(descriptor, context, serviceIdentifier);\n } finally {\n context.unmarkResolving(descriptor.implementation);\n }\n }\n\n public resolveAll<T extends SourceType>(identifier: ServiceIdentifier<T>, context?: ResolutionContext): T[] {\n const descriptors = this.Services.get(identifier);\n const resolveContext = context ?? new ResolutionContext(this.singletons, this.scoped, identifier);\n return descriptors.map((descriptor) => this.resolveInternal<T>(descriptor, resolveContext, identifier));\n }\n\n public resolve<T extends SourceType>(identifier: ServiceIdentifier<T>, context?: ResolutionContext): T {\n if (identifier.prototype === IResolutionScope.prototype || identifier.prototype === IScopedProvider.prototype || identifier.prototype === IServiceProvider.prototype) {\n return this as IResolutionScope & IScopedProvider & IServiceProvider as T;\n }\n\n const descriptor = this.getSingleDescriptor(identifier);\n const resolveContext = context ?? new ResolutionContext(this.singletons, this.scoped, identifier);\n try {\n return this.resolveInternal(descriptor, resolveContext, identifier);\n } catch (err) {\n throw this.wrapDependencyResolutionError(err, identifier, descriptor, resolveContext);\n }\n }\n\n private wrapDependencyResolutionError<T extends SourceType>(err: unknown, requestedIdentifier: ServiceIdentifier<T>, descriptor: ServiceDescriptor<T>, context: ResolutionContext): never {\n if (err instanceof ServiceCreationError && err.identifier !== requestedIdentifier) {\n throw new ServiceCreationError(requestedIdentifier, err, descriptor.implementation);\n }\n throw err;\n }\n\n private getSingleDescriptor<T extends SourceType>(identifier: ServiceIdentifier<T>) {\n const descriptors = this.Services.get(identifier);\n if (descriptors.length === 0) {\n throw new UnregisteredServiceError(identifier);\n }\n\n if (descriptors.length > 1) {\n if (this.Services.options.registrationMode === ResolveMultipleMode.Error) {\n throw new MultipleRegistrationError(identifier);\n }\n }\n const descriptor = descriptors[descriptors.length - 1];\n return descriptor;\n }\n\n private createInstance<T extends SourceType>(descriptor: ServiceDescriptor<T>, context: ResolutionContext, serviceIdentifier?: ServiceIdentifier<T>): T {\n const instance = this.createInstanceInternal(descriptor, context, serviceIdentifier);\n this.setDependencies(descriptor.implementation, instance, context, serviceIdentifier);\n context.setForLifetime(descriptor.implementation, instance, descriptor.lifetime);\n return instance;\n }\n\n private wrapContext(context: ResolutionContext): IResolutionScope {\n const resolve = (identifier: ServiceIdentifier<any>) => this.resolve(identifier, context);\n const resolveAll = (identifier: ServiceIdentifier<any>) => this.resolveAll(identifier, context);\n\n return {\n resolve,\n resolveAll,\n };\n }\n\n private createInstanceInternal<T extends SourceType>(descriptor: ServiceDescriptor<T>, context: ResolutionContext, serviceIdentifier?: ServiceIdentifier<T>) {\n let instance: T | undefined;\n try {\n instance = descriptor.createInstance(this.wrapContext(context));\n } catch (err) {\n this.logger.error(err);\n const identifier = serviceIdentifier || descriptor.implementation;\n if (err instanceof Error) {\n throw new ServiceCreationError(identifier, err, descriptor.implementation);\n }\n throw new ServiceCreationError(identifier, undefined, descriptor.implementation);\n }\n if (descriptor.lifetime !== Lifetime.Singleton && Symbol.dispose in instance) {\n this.created.push(instance as IDisposable);\n }\n return instance;\n }\n\n public createScope(): IScopedProvider {\n return new ServiceProvider(this.logger, this.Services.clone(true), this.singletons);\n }\n\n private setDependencies<T extends SourceType>(implementation: ServiceRegistration<T>, instance: T, context: ResolutionContext, serviceIdentifier?: ServiceIdentifier<T>): T {\n const dependencies = getMetadata<T>(DesignDependenciesKey, implementation) ?? {};\n this.logger.debug('Dependencies', implementation.name, dependencies);\n for (const [key, identifier] of Object.entries(dependencies)) {\n if (identifier === serviceIdentifier) {\n throw new SelfDependencyError();\n }\n this.logger.debug('Resolving', identifier.name, 'for', implementation.name);\n const dep = this.resolve(identifier, context);\n (instance as Record<string, T>)[key] = dep;\n }\n return instance;\n }\n}\n","import type { Lifetime } from '../enums';\nimport { InvalidServiceIdentifierError } from '../errors';\nimport type { IServiceBuilder, IServiceCollection, IServiceProvider } from '../interfaces';\nimport type { ILogger } from '../logger';\nimport { createDescriptorMap, type DescriptorMap, type EnsureObject, type ServiceCollectionOptions, type ServiceDescriptor, type ServiceIdentifier, type ServiceModuleType, type SourceType, type UnionToIntersection } from '../types';\nimport { ServiceBuilder } from './ServiceBuilder';\nimport { ServiceProvider } from './ServiceProvider';\n\nexport class ServiceCollection implements IServiceCollection {\n constructor(\n private readonly logger: ILogger,\n public readonly options: ServiceCollectionOptions,\n private readonly isScoped: boolean,\n private readonly services = createDescriptorMap(),\n ) {}\n\n public registerModules(...modules: ServiceModuleType[]): void {\n for (const x of modules) {\n const module = new x();\n module.registerServices(this);\n }\n }\n\n get<T extends SourceType>(key: ServiceIdentifier<T>): ServiceDescriptor<T>[] {\n return this.services.get(key) ?? [];\n }\n\n public overrideLifetime<T extends SourceType>(identifier: ServiceIdentifier<T>, lifetime: Lifetime): void {\n for (const descriptor of this.get(identifier)) {\n descriptor.lifetime = lifetime;\n }\n }\n\n register<Types extends [SourceType, ...SourceType[]]>(...identifiers: { [K in keyof Types]: ServiceIdentifier<Types[K]> }): IServiceBuilder<EnsureObject<UnionToIntersection<Types[number]>>> {\n if (identifiers.length === 0 || identifiers.some((id) => id == null)) {\n throw new InvalidServiceIdentifierError();\n }\n\n return new ServiceBuilder(identifiers, this.isScoped, (identifier, descriptor) => this.addService(identifier, descriptor));\n }\n\n private addService<T extends SourceType>(identifier: ServiceIdentifier<T>, descriptor: ServiceDescriptor<T>) {\n this.logger.info('Adding service', { identifier: identifier.name, descriptor });\n let existing = this.services.get(identifier);\n if (existing == null) {\n existing = [];\n this.services.set(identifier, existing);\n }\n existing.push(descriptor);\n }\n\n public clone(scoped?: unknown): IServiceCollection {\n const clonedMap: DescriptorMap = createDescriptorMap();\n for (const [key, descriptors] of this.services) {\n const clonedDescriptors = descriptors.map((descriptor) => ({ ...descriptor }));\n clonedMap.set(key, clonedDescriptors);\n }\n\n return new ServiceCollection(this.logger, this.options, scoped === true, clonedMap);\n }\n\n public buildProvider(): IServiceProvider {\n return new ServiceProvider(this.logger, this.clone());\n }\n}\n","import { DefaultServiceCollectionOptions } from './defaults';\nimport type { IServiceCollection } from './interfaces';\nimport { ConsoleLogger } from './private/consoleLogger';\nimport { ServiceCollection } from './private/ServiceCollection';\nimport type { ServiceCollectionOptions } from './types';\n\nconst mergeOptions = (options: Partial<ServiceCollectionOptions> | undefined): ServiceCollectionOptions => ({\n ...DefaultServiceCollectionOptions,\n ...options,\n});\n\n/**\n * Creates a service collection with the (optionally) provided options\n * @param options - Optional configuration for the service collection.\n * @defaultValue Default options are taken from {@link DefaultServiceCollectionOptions}.\n */\nexport const createServiceCollection = (options?: Partial<ServiceCollectionOptions>): IServiceCollection => {\n const mergedOptions = mergeOptions(options);\n const logger = mergedOptions.logger ?? new ConsoleLogger(mergedOptions);\n return new ServiceCollection(logger, mergedOptions, false);\n};\n","import { IResolutionScope, IScopedProvider, IServiceProvider } from './interfaces';\nimport { DesignDependenciesKey } from './private/constants';\nimport { defineMetadata, getMetadata } from './private/metadata';\nimport type { ServiceIdentifier, SourceType } from './types';\n\nconst tagProperty = <T extends SourceType>(metadataKey: string, annotationTarget: object, name: string | symbol, identifier: ServiceIdentifier<T>) => {\n let existing = getMetadata<T>(metadataKey, annotationTarget);\n if (existing === undefined) {\n existing = {};\n defineMetadata(metadataKey, existing, annotationTarget);\n }\n existing[name] = identifier;\n};\n\n/**\n * declares a dependency, use on a class field.\n * Can also depend on {@link IServiceProvider}, {@link IResolutionScope}, or {@link IScopedProvider}.\n * @param identifier the identifier to depend on, i.e. the interface\n */\nexport const dependsOn = <T extends SourceType>(identifier: ServiceIdentifier<T>) => {\n return (value: undefined, ctx: ClassFieldDecoratorContext) => {\n return function (this: object, initialValue: any) {\n const target = this.constructor;\n tagProperty(DesignDependenciesKey, target, ctx.name, identifier);\n return initialValue;\n };\n };\n};\n"]}
1
+ {"version":3,"sources":["../../../../node_modules/.pnpm/@abraham+reflection@0.13.0/node_modules/@abraham/reflection/src/index.ts","../../src/enums.ts","../../src/defaults.ts","../../src/logger.ts","../../src/private/consoleLogger.ts","../../src/errors.ts","../../src/types.ts","../../src/private/ServiceBuilder.ts","../../src/interfaces.ts","../../src/private/constants.ts","../../src/private/metadata.ts","../../src/private/ResolutionContext.ts","../../src/private/ServiceProvider.ts","../../src/private/ServiceCollection.ts","../../src/createServiceCollection.ts","../../src/dependsOn.ts"],"names":["Lifetime","LogLevel","ResolveMultipleMode","getMetadata","defineMetadata","metadata"],"mappings":";;;;AAUA,IAAM,QAAA,uBAAe,OAAA,EAAO;AAE5B,SAAS,gBAAA,CACP,UAAA,EACA,MAAA,EACA,WAAA,EACA,UAAA,EAA+B;AAE/B,EAAA,UAAA,CAAW,OAAA,EAAO,CAAG,OAAA,CAAQ,CAAC,SAAA,KAA8B;AAC1D,IAAA,UAAA,GAAa,SAAA,CAAU,MAAA,EAAQ,WAAA,EAAa,UAAU,CAAA,IAAK,UAAA;EAC7D,CAAC,CAAA;AACD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AA,OAAO,YAAA;AAAA,IACT,CAAA;AAAA,EACF,CAAA;AACF,CAAA,EARyB,WAAA","file":"index.cjs","sourcesContent":["export type Decorator = ClassDecorator | MemberDecorator;\nexport type MemberDecorator = <T>(\n target: Target,\n propertyKey: PropertyKey,\n descriptor?: TypedPropertyDescriptor<T>,\n) => TypedPropertyDescriptor<T> | void;\nexport type MetadataKey = string | symbol;\nexport type PropertyKey = string | symbol;\nexport type Target = object | Function;\n\nconst Metadata = new WeakMap();\n\nfunction decorateProperty(\n decorators: MemberDecorator[],\n target: Target,\n propertyKey: PropertyKey,\n descriptor?: PropertyDescriptor,\n): PropertyDescriptor | undefined {\n decorators.reverse().forEach((decorator: MemberDecorator) => {\n descriptor = decorator(target, propertyKey, descriptor) || descriptor;\n });\n return descriptor;\n}\n\nfunction decorateConstructor(\n decorators: ClassDecorator[],\n target: Function,\n): Function {\n decorators.reverse().forEach((decorator: ClassDecorator) => {\n const decorated = decorator(target);\n if (decorated) {\n target = decorated;\n }\n });\n return target;\n}\n\nexport function decorate(\n decorators: ClassDecorator[],\n target: Function,\n): Function;\nexport function decorate(\n decorators: MemberDecorator[],\n target: object,\n propertyKey?: PropertyKey,\n attributes?: PropertyDescriptor,\n): PropertyDescriptor | undefined;\nexport function decorate(\n decorators: Decorator[],\n target: Target,\n propertyKey?: PropertyKey,\n attributes?: PropertyDescriptor,\n): Function | PropertyDescriptor | undefined {\n if (!Array.isArray(decorators) || decorators.length === 0) {\n throw new TypeError();\n }\n\n if (propertyKey !== undefined) {\n return decorateProperty(\n decorators as MemberDecorator[],\n target,\n propertyKey,\n attributes,\n );\n }\n\n if (typeof target === 'function') {\n return decorateConstructor(decorators as ClassDecorator[], target);\n }\n\n return;\n}\n\nfunction getMetadataMap<MetadataValue>(\n target: Target,\n propertyKey?: PropertyKey,\n): Map<MetadataKey, MetadataValue> | undefined {\n return Metadata.get(target) && Metadata.get(target).get(propertyKey);\n}\n\nfunction ordinaryGetOwnMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): MetadataValue | undefined {\n if (target === undefined) {\n throw new TypeError();\n }\n const metadataMap = getMetadataMap<MetadataValue>(target, propertyKey);\n return metadataMap && metadataMap.get(metadataKey);\n}\n\nfunction createMetadataMap<MetadataValue>(\n target: Target,\n propertyKey?: PropertyKey,\n): Map<MetadataKey, MetadataValue> {\n const targetMetadata =\n Metadata.get(target) ||\n new Map<PropertyKey | undefined, Map<MetadataKey, MetadataValue>>();\n Metadata.set(target, targetMetadata);\n const metadataMap =\n targetMetadata.get(propertyKey) || new Map<MetadataKey, MetadataValue>();\n targetMetadata.set(propertyKey, metadataMap);\n return metadataMap;\n}\n\nfunction ordinaryDefineOwnMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n metadataValue: MetadataValue,\n target: Target,\n propertyKey?: PropertyKey,\n): void {\n if (propertyKey && !['string', 'symbol'].includes(typeof propertyKey)) {\n throw new TypeError();\n }\n\n (\n getMetadataMap<MetadataValue>(target, propertyKey) ||\n createMetadataMap<MetadataValue>(target, propertyKey)\n ).set(metadataKey, metadataValue);\n}\n\nfunction ordinaryGetMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): MetadataValue | undefined {\n return ordinaryGetOwnMetadata<MetadataValue>(metadataKey, target, propertyKey)\n ? ordinaryGetOwnMetadata<MetadataValue>(metadataKey, target, propertyKey)\n : Object.getPrototypeOf(target)\n ? ordinaryGetMetadata(\n metadataKey,\n Object.getPrototypeOf(target),\n propertyKey,\n )\n : undefined;\n}\n\nexport function metadata<MetadataValue>(\n metadataKey: MetadataKey,\n metadataValue: MetadataValue,\n) {\n return function decorator(target: Target, propertyKey?: PropertyKey): void {\n ordinaryDefineOwnMetadata<MetadataValue>(\n metadataKey,\n metadataValue,\n target,\n propertyKey,\n );\n };\n}\n\nexport function getMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): MetadataValue | undefined {\n return ordinaryGetMetadata<MetadataValue>(metadataKey, target, propertyKey);\n}\n\nexport function getOwnMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): MetadataValue | undefined {\n return ordinaryGetOwnMetadata<MetadataValue>(\n metadataKey,\n target,\n propertyKey,\n );\n}\n\nexport function hasOwnMetadata(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): boolean {\n return !!ordinaryGetOwnMetadata(metadataKey, target, propertyKey);\n}\n\nexport function hasMetadata(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): boolean {\n return !!ordinaryGetMetadata(metadataKey, target, propertyKey);\n}\n\nexport function defineMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n metadataValue: MetadataValue,\n target: Target,\n propertyKey?: PropertyKey,\n): void {\n ordinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);\n}\n\nexport const Reflection = {\n decorate,\n defineMetadata,\n getMetadata,\n getOwnMetadata,\n hasMetadata,\n hasOwnMetadata,\n metadata,\n};\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace Reflect {\n let decorate: typeof Reflection.decorate;\n let defineMetadata: typeof Reflection.defineMetadata;\n let getMetadata: typeof Reflection.getMetadata;\n let getOwnMetadata: typeof Reflection.getOwnMetadata;\n let hasOwnMetadata: typeof Reflection.hasOwnMetadata;\n let hasMetadata: typeof Reflection.hasMetadata;\n let metadata: typeof Reflection.metadata;\n }\n}\n\nObject.assign(Reflect, Reflection);\n","export enum Lifetime {\n Resolve = 'RESOLVE',\n Transient = 'TRANSIENT',\n Scoped = 'SCOPED',\n Singleton = 'SINGLETON',\n}\n\nexport enum LogLevel {\n Debug = 0,\n Info = 1,\n Warn = 2,\n Error = 3,\n None = 4,\n}\n\nexport enum ResolveMultipleMode {\n Error = 'ERROR',\n LastRegistered = 'LAST_REGISTERED',\n}\n","import { LogLevel, ResolveMultipleMode } from './enums';\nimport type { ServiceCollectionOptions } from './types';\n\nexport const DefaultServiceCollectionOptions: ServiceCollectionOptions = {\n registrationMode: ResolveMultipleMode.Error,\n logLevel: LogLevel.Warn,\n};\n","export abstract class ILogger {\n public debug(_message?: any, ..._optionalParams: any[]) {}\n public info(_message?: any, ..._optionalParams: any[]) {}\n public error(_message?: any, ..._optionalParams: any[]) {}\n public warn(_message?: any, ..._optionalParams: any[]) {}\n}\n","import { LogLevel } from '../enums';\nimport { ILogger } from '../logger';\nimport type { ServiceCollectionOptions } from '../types';\n\nexport class ConsoleLogger extends ILogger {\n constructor(private readonly options: ServiceCollectionOptions) {\n super();\n }\n\n public override debug(message?: any, ...optionalParams: any[]): void {\n if (this.options.logLevel <= LogLevel.Debug) {\n console.debug(message, ...optionalParams);\n }\n }\n\n public override info(message?: any, ...optionalParams: any[]): void {\n if (this.options.logLevel <= LogLevel.Info) {\n console.info(message, ...optionalParams);\n }\n }\n\n public override warn(message?: any, ...optionalParams: any[]): void {\n if (this.options.logLevel <= LogLevel.Warn) {\n console.warn(message, ...optionalParams);\n }\n }\n\n public override error(message?: any, ...optionalParams: any[]): void {\n if (this.options.logLevel <= LogLevel.Error) {\n console.error(message, ...optionalParams);\n }\n }\n}\n","import type { ServiceIdentifier, ServiceImplementation, ServiceRegistration } from './types';\n\nexport abstract class ServiceError extends Error {}\n\nexport class UnregisteredServiceError<T extends object> extends ServiceError {\n name = 'UnregisteredServiceError';\n constructor(identifier: ServiceIdentifier<T>) {\n super(`Resolving service that has not been registered: ${identifier.name}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class MultipleRegistrationError<T extends object> extends ServiceError {\n name = 'MultipleRegistrationError';\n constructor(identifier: ServiceIdentifier<T>) {\n super(`Multiple services have been registered: ${identifier.name}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class ServiceCreationError<T extends object> extends ServiceError {\n name = 'ServiceCreationError';\n constructor(\n public readonly identifier: ServiceIdentifier<T>,\n public readonly innerError?: Error,\n public readonly implementation?: ServiceRegistration<T>,\n ) {\n super(ServiceCreationError.getErrorMessage(identifier.name, implementation?.name, innerError));\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static getErrorMessage(identifierName: string, implementationName: string | undefined, innerError: Error | undefined): string {\n const serviceName = implementationName ? `${identifierName} (${implementationName})` : identifierName;\n if (innerError == null) {\n return `Error creating service: ${serviceName}`;\n }\n return `Error creating service: ${serviceName}\\n${innerError.message}`;\n }\n}\n\nexport class SelfDependencyError extends ServiceError {\n name = 'SelfDependencyError';\n constructor() {\n super('Service depending on itself');\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class CircularDependencyError extends ServiceError {\n name = 'CircularDependencyError';\n constructor(identifier: ServiceIdentifier<object>) {\n super(`Circular dependency detected while resolving: ${identifier.name}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class ScopedSingletonRegistrationError extends ServiceError {\n name = 'ScopedSingletonRegistrationError';\n constructor() {\n super('Cannot register a singleton in a scoped service collection');\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class InvalidServiceIdentifierError extends ServiceError {\n name = 'InvalidServiceIdentifierError';\n constructor() {\n super('Cannot register null or undefined service identifier');\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class InvalidImplementationError<T extends object> extends ServiceError {\n name = 'InvalidImplementationError';\n constructor(identifier: ServiceIdentifier<T> | undefined) {\n super(`Invalid implementation provided for service: ${identifier?.name ?? 'undefined'}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n","import type { Lifetime, LogLevel, ResolveMultipleMode } from './enums';\nimport type { ILifetimeBuilder, IResolutionScope, IServiceModule } from './interfaces';\nimport type { ILogger } from './logger';\nimport type { ConsoleLogger } from './private/consoleLogger';\n\nexport type SourceType = object;\n\nexport type AbstractNewable<T> = abstract new (...args: any[]) => T;\nexport type Newable<T> = new (...args: any[]) => T;\n\nexport type ServiceIdentifier<T extends SourceType> = { prototype: T; name: string }; //AbstractNewable<T>;\nexport type ServiceImplementation<T extends SourceType> = Newable<T>;\nexport type ServiceRegistration<T extends SourceType> = ServiceIdentifier<T> | ServiceImplementation<T>;\n\nexport type InstanceFactory<T extends SourceType> = (x: IResolutionScope) => T;\n\nexport type ServiceModuleType = Newable<IServiceModule>;\n\nexport type ServiceDescriptor<T extends SourceType> = {\n readonly implementation: ServiceRegistration<T>;\n lifetime: Lifetime;\n createInstance(context: IResolutionScope): T;\n};\n\nexport type MetadataType<T extends SourceType> = Record<string | symbol, ServiceIdentifier<T>>;\n\nexport type ServiceCollectionOptions = {\n /**\n * Whether calling `resolve` when there are multiple registrations\n * will result in an error or resolve the last registered service.\n * @default ResolveMultipleMode.Error\n */\n registrationMode: ResolveMultipleMode;\n /**\n * The default log level for the console logger.\n * @defaultValue {@link LogLevel.Warn}\n */\n logLevel: LogLevel;\n /**\n * Custom implementation for logger. Ignores log level.\n * @defaultValue {@link ConsoleLogger}\n */\n logger?: ILogger;\n};\n\nexport type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;\n\nexport type EnsureObject<T> = T extends object ? T : never;\n\nexport type ServiceBuilderOptions<T extends SourceType> = {\n (implementation: ServiceImplementation<T>): ILifetimeBuilder;\n (implementation: ServiceIdentifier<T>, factory: InstanceFactory<T>): ILifetimeBuilder;\n};\n\nexport type RegistrationMap<T extends SourceType = any> = Map<ServiceRegistration<T>, T>;\nexport type DescriptorMap<T extends SourceType = any> = Map<ServiceIdentifier<T>, ServiceDescriptor<T>[]>;\n\nexport const createRegistrationMap = <T extends SourceType = any>(): RegistrationMap<T> => {\n return new Map<ServiceRegistration<T>, T>();\n};\n\nexport const createDescriptorMap = <T extends SourceType = any>(): DescriptorMap<T> => {\n return new Map<ServiceIdentifier<T>, ServiceDescriptor<T>[]>();\n};\n","import { Lifetime } from '../enums';\nimport { InvalidImplementationError, ScopedSingletonRegistrationError } from '../errors';\nimport type { ILifetimeBuilder, IServiceBuilder } from '../interfaces';\nimport type { InstanceFactory, ServiceDescriptor, ServiceIdentifier, ServiceImplementation, ServiceRegistration, SourceType } from '../types';\n\nexport class ServiceBuilder<T extends SourceType> implements IServiceBuilder<T> {\n private descriptor: ServiceDescriptor<T> | undefined;\n\n constructor(\n private readonly identifiers: ServiceIdentifier<T>[],\n private readonly isScoped: boolean,\n private readonly addService: (identifier: ServiceIdentifier<T>, descriptor: ServiceDescriptor<T>) => void,\n ) {}\n\n public to(implementation: ServiceImplementation<T>): ILifetimeBuilder;\n public to(implementation: ServiceIdentifier<T>, factory?: InstanceFactory<T>): ILifetimeBuilder;\n public to(implementation: ServiceRegistration<T>, factory?: InstanceFactory<T> | undefined): ILifetimeBuilder {\n if (implementation == null) {\n throw new InvalidImplementationError<T>(this.identifiers[0]);\n }\n\n this.descriptor = this.createDescriptor(factory, implementation);\n\n for (const identifier of this.identifiers) {\n this.addService(identifier, this.descriptor);\n }\n return this;\n }\n\n private createDescriptor(factory: InstanceFactory<T> | undefined, implementation: ServiceRegistration<T>): ServiceDescriptor<T> {\n return {\n implementation,\n lifetime: Lifetime.Resolve,\n createInstance: factory ?? (() => new (implementation as ServiceImplementation<T>)()),\n };\n }\n\n public singleton(): this {\n if (this.isScoped) {\n throw new ScopedSingletonRegistrationError();\n }\n this.ensureDescriptor().lifetime = Lifetime.Singleton;\n return this;\n }\n\n public scoped(): this {\n this.ensureDescriptor().lifetime = Lifetime.Scoped;\n return this;\n }\n\n public transient(): this {\n this.ensureDescriptor().lifetime = Lifetime.Transient;\n return this;\n }\n\n private ensureDescriptor(): ServiceDescriptor<T> {\n if (!this.descriptor) {\n throw new Error('Must call to() before setting lifetime');\n }\n return this.descriptor;\n }\n}\n","import type { Lifetime } from './enums';\nimport { ResolveMultipleMode } from './enums';\nimport type { EnsureObject, ServiceBuilderOptions, ServiceCollectionOptions, ServiceDescriptor, ServiceIdentifier, ServiceModuleType, SourceType, UnionToIntersection } from './types';\n\nexport abstract class IDisposable {\n public abstract [Symbol.dispose](): void;\n}\n\nexport abstract class IServiceModule {\n public abstract registerServices(services: IServiceCollection): void;\n}\n\nexport abstract class IResolutionScope {\n /**\n * Resolves a single implementation for the given identifier.\n * @template T The type of service to resolve\n * @param identifier The service identifier\n * @returns The resolved instance\n * @throws {MultipleRegistrationError} When multiple implementations exist (unless {@link ServiceCollectionOptions.registrationMode} is set to {@link ResolveMultipleMode.LastRegistered}).\n * @throws {UnregisteredServiceError} When no implementation exists\n */\n public abstract resolve<T extends SourceType>(identifier: ServiceIdentifier<T>): T;\n\n /**\n * Resolves all implementations for the given identifier.\n * @template T The type of service to resolve\n * @param identifier The service identifier\n * @returns Array of resolved instances\n */\n public abstract resolveAll<T extends SourceType>(identifier: ServiceIdentifier<T>): T[];\n}\n\nexport abstract class IScopedProvider extends IResolutionScope implements IDisposable {\n public abstract readonly Services: IServiceCollection;\n public abstract [Symbol.dispose](): void;\n}\n\nexport abstract class IServiceProvider extends IResolutionScope implements IDisposable {\n public abstract readonly Services: IServiceCollection;\n public abstract createScope(): IScopedProvider;\n public abstract [Symbol.dispose](): void;\n}\n\nexport abstract class IServiceCollection {\n public abstract readonly options: ServiceCollectionOptions;\n public abstract get<T extends SourceType>(identifier: ServiceIdentifier<T>): ServiceDescriptor<T>[];\n /**\n * Registers one or more service identifiers with the service collection.\n * @param identifiers One or more service identifiers to register\n * @returns A service builder to configure the implementation and lifetime\n * @throws {InvalidServiceIdentifierError} When any identifier is null or undefined\n */\n public abstract register<Types extends [SourceType, ...SourceType[]]>(...identifiers: { [K in keyof Types]: ServiceIdentifier<Types[K]> }): IServiceBuilder<EnsureObject<UnionToIntersection<Types[number]>>>;\n public abstract registerModules(...modules: ServiceModuleType[]): void;\n public abstract overrideLifetime<T extends SourceType>(identifier: ServiceIdentifier<T>, lifetime: Lifetime): void;\n public abstract buildProvider(): IServiceProvider;\n public abstract clone(): IServiceCollection;\n public abstract clone(scoped: true): IServiceCollection;\n}\n\nexport abstract class ILifetimeBuilder {\n public abstract singleton(): ILifetimeBuilder;\n public abstract scoped(): ILifetimeBuilder;\n public abstract transient(): ILifetimeBuilder;\n}\n\nexport abstract class IServiceBuilder<T extends SourceType> {\n public abstract to: ServiceBuilderOptions<T>;\n}\n","export const DesignDependenciesKey = 'design:dependencies';\n","import '@abraham/reflection';\nimport type { MetadataType, SourceType } from '../types';\n\nexport const getMetadata = <T extends SourceType>(key: string, obj: object): MetadataType<T> | undefined => Reflect.getMetadata(key, obj);\nexport const defineMetadata = <T extends SourceType>(key: string, metadata: MetadataType<T>, obj: object) => Reflect.defineMetadata(key, metadata, obj);\n","import { Lifetime } from '../enums';\nimport { createRegistrationMap, type RegistrationMap, type ServiceIdentifier, type ServiceRegistration, type SourceType } from '../types';\n\nexport class ResolutionContext {\n constructor(\n private readonly singletons: RegistrationMap,\n private readonly scoped: RegistrationMap,\n public readonly targetIdentifier?: ServiceIdentifier<any>,\n ) {}\n\n private readonly transient: RegistrationMap = createRegistrationMap();\n private readonly resolving = new Set<ServiceRegistration<SourceType>>();\n\n public markResolving<T extends SourceType>(implementation: ServiceRegistration<T>): boolean {\n if (this.resolving.has(implementation)) {\n return false;\n }\n this.resolving.add(implementation);\n return true;\n }\n\n public unmarkResolving<T extends SourceType>(implementation: ServiceRegistration<T>): void {\n this.resolving.delete(implementation);\n }\n\n public getFromLifetime<T extends SourceType>(implementation: ServiceRegistration<T>, lifetime: Lifetime): T | null {\n const map = this.getMapForLifetime(lifetime);\n return map?.get(implementation);\n }\n\n public setForLifetime<T extends SourceType>(implementation: ServiceRegistration<T>, instance: T, lifetime: Lifetime): void {\n const map = this.getMapForLifetime(lifetime);\n map?.set(implementation, instance);\n }\n\n private getMapForLifetime(lifetime: Lifetime) {\n const map: Partial<Record<Lifetime, RegistrationMap>> = {\n [Lifetime.Singleton]: this.singletons,\n [Lifetime.Scoped]: this.scoped,\n [Lifetime.Resolve]: this.transient,\n };\n return map[lifetime];\n }\n}\n","import { Lifetime, ResolveMultipleMode } from '../enums';\nimport { CircularDependencyError, MultipleRegistrationError, SelfDependencyError, ServiceCreationError, UnregisteredServiceError } from '../errors';\nimport { type IDisposable, IResolutionScope, IScopedProvider, type IServiceCollection, IServiceProvider } from '../interfaces';\nimport type { ILogger } from '../logger';\nimport { createRegistrationMap, type RegistrationMap, type ServiceDescriptor, type ServiceIdentifier, type ServiceImplementation, type ServiceRegistration, type SourceType } from '../types';\nimport { DesignDependenciesKey } from './constants';\nimport { getMetadata } from './metadata';\nimport { ResolutionContext } from './ResolutionContext';\n\nexport class ServiceProvider implements IServiceProvider, IScopedProvider {\n private scoped = createRegistrationMap();\n private created: IDisposable[] = [];\n\n private constructor(\n private readonly logger: ILogger,\n public readonly Services: IServiceCollection,\n private readonly singletons: RegistrationMap<any>,\n private readonly singletonDisposables: IDisposable[],\n private readonly isRoot: boolean,\n ) {}\n\n public static createRoot(logger: ILogger, services: IServiceCollection): IServiceProvider {\n return new ServiceProvider(logger, services, createRegistrationMap(), [], true);\n }\n\n [Symbol.dispose]() {\n for (const x of this.created) {\n x[Symbol.dispose]();\n }\n if (this.isRoot) {\n for (const x of this.singletonDisposables) {\n x[Symbol.dispose]();\n }\n }\n }\n\n private resolveInternal<T extends SourceType>(descriptor: ServiceDescriptor<T>, context: ResolutionContext, serviceIdentifier?: ServiceIdentifier<T>): T {\n const existing = context.getFromLifetime(descriptor.implementation, descriptor.lifetime);\n if (existing != null) {\n return existing;\n }\n const identifier = serviceIdentifier || descriptor.implementation;\n if (!context.markResolving(descriptor.implementation)) {\n throw new CircularDependencyError(identifier);\n }\n try {\n return this.createInstance(descriptor, context, serviceIdentifier);\n } finally {\n context.unmarkResolving(descriptor.implementation);\n }\n }\n\n public resolveAll<T extends SourceType>(identifier: ServiceIdentifier<T>, context?: ResolutionContext): T[] {\n const descriptors = this.Services.get(identifier);\n const resolveContext = context ?? new ResolutionContext(this.singletons, this.scoped, identifier);\n return descriptors.map((descriptor) => this.resolveInternal<T>(descriptor, resolveContext, identifier));\n }\n\n public resolve<T extends SourceType>(identifier: ServiceIdentifier<T>, context?: ResolutionContext): T {\n if (identifier.prototype === IResolutionScope.prototype || identifier.prototype === IScopedProvider.prototype || identifier.prototype === IServiceProvider.prototype) {\n return this as IResolutionScope & IScopedProvider & IServiceProvider as T;\n }\n\n const descriptor = this.getSingleDescriptor(identifier);\n const resolveContext = context ?? new ResolutionContext(this.singletons, this.scoped, identifier);\n try {\n return this.resolveInternal(descriptor, resolveContext, identifier);\n } catch (err) {\n throw this.wrapDependencyResolutionError(err, identifier, descriptor, resolveContext);\n }\n }\n\n private wrapDependencyResolutionError<T extends SourceType>(err: unknown, requestedIdentifier: ServiceIdentifier<T>, descriptor: ServiceDescriptor<T>, context: ResolutionContext): never {\n if (err instanceof ServiceCreationError && err.identifier !== requestedIdentifier) {\n throw new ServiceCreationError(requestedIdentifier, err, descriptor.implementation);\n }\n throw err;\n }\n\n private getSingleDescriptor<T extends SourceType>(identifier: ServiceIdentifier<T>) {\n const descriptors = this.Services.get(identifier);\n if (descriptors.length === 0) {\n throw new UnregisteredServiceError(identifier);\n }\n\n if (descriptors.length > 1) {\n if (this.Services.options.registrationMode === ResolveMultipleMode.Error) {\n throw new MultipleRegistrationError(identifier);\n }\n }\n const descriptor = descriptors[descriptors.length - 1];\n return descriptor;\n }\n\n private createInstance<T extends SourceType>(descriptor: ServiceDescriptor<T>, context: ResolutionContext, serviceIdentifier?: ServiceIdentifier<T>): T {\n const instance = this.createInstanceInternal(descriptor, context, serviceIdentifier);\n this.setDependencies(descriptor.implementation, instance, context, serviceIdentifier);\n context.setForLifetime(descriptor.implementation, instance, descriptor.lifetime);\n return instance;\n }\n\n private wrapContext(context: ResolutionContext): IResolutionScope {\n const resolve = (identifier: ServiceIdentifier<any>) => this.resolve(identifier, context);\n const resolveAll = (identifier: ServiceIdentifier<any>) => this.resolveAll(identifier, context);\n\n return {\n resolve,\n resolveAll,\n };\n }\n\n private createInstanceInternal<T extends SourceType>(descriptor: ServiceDescriptor<T>, context: ResolutionContext, serviceIdentifier?: ServiceIdentifier<T>) {\n let instance: T | undefined;\n try {\n instance = descriptor.createInstance(this.wrapContext(context));\n } catch (err) {\n this.logger.error(err);\n const identifier = serviceIdentifier || descriptor.implementation;\n if (err instanceof Error) {\n throw new ServiceCreationError(identifier, err, descriptor.implementation);\n }\n throw new ServiceCreationError(identifier, undefined, descriptor.implementation);\n }\n if (Symbol.dispose in instance) {\n if (descriptor.lifetime === Lifetime.Singleton) {\n this.singletonDisposables.push(instance as IDisposable);\n } else {\n this.created.push(instance as IDisposable);\n }\n }\n return instance;\n }\n\n public createScope(): IScopedProvider {\n return new ServiceProvider(this.logger, this.Services.clone(true), this.singletons, this.singletonDisposables, false);\n }\n\n private setDependencies<T extends SourceType>(implementation: ServiceRegistration<T>, instance: T, context: ResolutionContext, serviceIdentifier?: ServiceIdentifier<T>): T {\n const dependencies = getMetadata<T>(DesignDependenciesKey, implementation) ?? {};\n this.logger.debug('Dependencies', implementation.name, dependencies);\n for (const [key, identifier] of Object.entries(dependencies)) {\n if (identifier === serviceIdentifier) {\n throw new SelfDependencyError();\n }\n this.logger.debug('Resolving', identifier.name, 'for', implementation.name);\n const dep = this.resolve(identifier, context);\n (instance as Record<string, T>)[key] = dep;\n }\n return instance;\n }\n}\n","import type { Lifetime } from '../enums';\nimport { InvalidServiceIdentifierError } from '../errors';\nimport type { IServiceBuilder, IServiceCollection, IServiceProvider } from '../interfaces';\nimport type { ILogger } from '../logger';\nimport { createDescriptorMap, type DescriptorMap, type EnsureObject, type ServiceCollectionOptions, type ServiceDescriptor, type ServiceIdentifier, type ServiceModuleType, type SourceType, type UnionToIntersection } from '../types';\nimport { ServiceBuilder } from './ServiceBuilder';\nimport { ServiceProvider } from './ServiceProvider';\n\nexport class ServiceCollection implements IServiceCollection {\n constructor(\n private readonly logger: ILogger,\n public readonly options: ServiceCollectionOptions,\n private readonly isScoped: boolean,\n private readonly services = createDescriptorMap(),\n ) {}\n\n public registerModules(...modules: ServiceModuleType[]): void {\n for (const x of modules) {\n const module = new x();\n module.registerServices(this);\n }\n }\n\n get<T extends SourceType>(key: ServiceIdentifier<T>): ServiceDescriptor<T>[] {\n return this.services.get(key) ?? [];\n }\n\n public overrideLifetime<T extends SourceType>(identifier: ServiceIdentifier<T>, lifetime: Lifetime): void {\n for (const descriptor of this.get(identifier)) {\n descriptor.lifetime = lifetime;\n }\n }\n\n register<Types extends [SourceType, ...SourceType[]]>(...identifiers: { [K in keyof Types]: ServiceIdentifier<Types[K]> }): IServiceBuilder<EnsureObject<UnionToIntersection<Types[number]>>> {\n if (identifiers.length === 0 || identifiers.some((id) => id == null)) {\n throw new InvalidServiceIdentifierError();\n }\n\n return new ServiceBuilder(identifiers, this.isScoped, (identifier, descriptor) => this.addService(identifier, descriptor));\n }\n\n private addService<T extends SourceType>(identifier: ServiceIdentifier<T>, descriptor: ServiceDescriptor<T>) {\n this.logger.info('Adding service', { identifier: identifier.name, descriptor });\n let existing = this.services.get(identifier);\n if (existing == null) {\n existing = [];\n this.services.set(identifier, existing);\n }\n existing.push(descriptor);\n }\n\n public clone(scoped?: unknown): IServiceCollection {\n const clonedMap: DescriptorMap = createDescriptorMap();\n for (const [key, descriptors] of this.services) {\n const clonedDescriptors = descriptors.map((descriptor) => ({ ...descriptor }));\n clonedMap.set(key, clonedDescriptors);\n }\n\n return new ServiceCollection(this.logger, this.options, scoped === true, clonedMap);\n }\n\n public buildProvider(): IServiceProvider {\n return ServiceProvider.createRoot(this.logger, this.clone());\n }\n}\n","import { DefaultServiceCollectionOptions } from './defaults';\nimport type { IServiceCollection } from './interfaces';\nimport { ConsoleLogger } from './private/consoleLogger';\nimport { ServiceCollection } from './private/ServiceCollection';\nimport type { ServiceCollectionOptions } from './types';\n\nconst mergeOptions = (options: Partial<ServiceCollectionOptions> | undefined): ServiceCollectionOptions => ({\n ...DefaultServiceCollectionOptions,\n ...options,\n});\n\n/**\n * Creates a service collection with the (optionally) provided options\n * @param options - Optional configuration for the service collection.\n * @defaultValue Default options are taken from {@link DefaultServiceCollectionOptions}.\n */\nexport const createServiceCollection = (options?: Partial<ServiceCollectionOptions>): IServiceCollection => {\n const mergedOptions = mergeOptions(options);\n const logger = mergedOptions.logger ?? new ConsoleLogger(mergedOptions);\n return new ServiceCollection(logger, mergedOptions, false);\n};\n","import { IResolutionScope, IScopedProvider, IServiceProvider } from './interfaces';\nimport { DesignDependenciesKey } from './private/constants';\nimport { defineMetadata, getMetadata } from './private/metadata';\nimport type { ServiceIdentifier, SourceType } from './types';\n\nconst tagProperty = <T extends SourceType>(metadataKey: string, annotationTarget: object, name: string | symbol, identifier: ServiceIdentifier<T>) => {\n let existing = getMetadata<T>(metadataKey, annotationTarget);\n if (existing === undefined) {\n existing = {};\n defineMetadata(metadataKey, existing, annotationTarget);\n }\n existing[name] = identifier;\n};\n\n/**\n * declares a dependency, use on a class field.\n * Can also depend on {@link IServiceProvider}, {@link IResolutionScope}, or {@link IScopedProvider}.\n * @param identifier the identifier to depend on, i.e. the interface\n */\nexport const dependsOn = <T extends SourceType>(identifier: ServiceIdentifier<T>) => {\n return (value: undefined, ctx: ClassFieldDecoratorContext) => {\n return function (this: object, initialValue: any) {\n const target = this.constructor;\n tagProperty(DesignDependenciesKey, target, ctx.name, identifier);\n return initialValue;\n };\n };\n};\n"]}
@@ -93,9 +93,10 @@ declare abstract class IScopedProvider extends IResolutionScope implements IDisp
93
93
  abstract readonly Services: IServiceCollection;
94
94
  abstract [Symbol.dispose](): void;
95
95
  }
96
- declare abstract class IServiceProvider extends IResolutionScope {
96
+ declare abstract class IServiceProvider extends IResolutionScope implements IDisposable {
97
97
  abstract readonly Services: IServiceCollection;
98
98
  abstract createScope(): IScopedProvider;
99
+ abstract [Symbol.dispose](): void;
99
100
  }
100
101
  declare abstract class IServiceCollection {
101
102
  abstract readonly options: ServiceCollectionOptions;
@@ -93,9 +93,10 @@ declare abstract class IScopedProvider extends IResolutionScope implements IDisp
93
93
  abstract readonly Services: IServiceCollection;
94
94
  abstract [Symbol.dispose](): void;
95
95
  }
96
- declare abstract class IServiceProvider extends IResolutionScope {
96
+ declare abstract class IServiceProvider extends IResolutionScope implements IDisposable {
97
97
  abstract readonly Services: IServiceCollection;
98
98
  abstract createScope(): IScopedProvider;
99
+ abstract [Symbol.dispose](): void;
99
100
  }
100
101
  declare abstract class IServiceCollection {
101
102
  abstract readonly options: ServiceCollectionOptions;
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,r)=>e(t,"name",{value:r,configurable:!0}),r=new WeakMap;function i(e,t,r,i){return e.reverse().forEach(e=>{i=e(t,r,i)||i}),i}function s(e,t){return e.reverse().forEach(e=>{const r=e(t);r&&(t=r)}),t}function n(e,t,r,n){if(!Array.isArray(e)||0===e.length)throw new TypeError;return void 0!==r?i(e,t,r,n):"function"==typeof t?s(e,t):void 0}function o(e,t){return r.get(e)&&r.get(e).get(t)}function a(e,t,r){if(void 0===t)throw new TypeError;const i=o(t,r);return i&&i.get(e)}function c(e,t){const i=r.get(e)||new Map;r.set(e,i);const s=i.get(t)||new Map;return i.set(t,s),s}function l(e,t,r,i){if(i&&!["string","symbol"].includes(typeof i))throw new TypeError;(o(r,i)||c(r,i)).set(e,t)}function d(e,t,r){return a(e,t,r)?a(e,t,r):Object.getPrototypeOf(t)?d(e,Object.getPrototypeOf(t),r):void 0}function h(e,r){return t(function(t,i){l(e,r,t,i)},"decorator")}function p(e,t,r){return d(e,t,r)}function g(e,t,r){return a(e,t,r)}function u(e,t,r){return!!a(e,t,r)}function f(e,t,r){return!!d(e,t,r)}function v(e,t,r,i){l(e,t,r,i)}t(i,"decorateProperty"),t(s,"decorateConstructor"),t(n,"decorate"),t(o,"getMetadataMap"),t(a,"ordinaryGetOwnMetadata"),t(c,"createMetadataMap"),t(l,"ordinaryDefineOwnMetadata"),t(d,"ordinaryGetMetadata"),t(h,"metadata"),t(p,"getMetadata"),t(g,"getOwnMetadata"),t(u,"hasOwnMetadata"),t(f,"hasMetadata"),t(v,"defineMetadata");var m={decorate:n,defineMetadata:v,getMetadata:p,getOwnMetadata:g,hasMetadata:f,hasOwnMetadata:u,metadata:h};Object.assign(Reflect,m);var w=(e=>(e.Resolve="RESOLVE",e.Transient="TRANSIENT",e.Scoped="SCOPED",e.Singleton="SINGLETON",e))(w||{}),S=(e=>(e[e.Debug=0]="Debug",e[e.Info=1]="Info",e[e.Warn=2]="Warn",e[e.Error=3]="Error",e[e.None=4]="None",e))(S||{}),E=(e=>(e.Error="ERROR",e.LastRegistered="LAST_REGISTERED",e))(E||{}),y={registrationMode:"ERROR",logLevel:2},O=class{static{t(this,"ILogger")}debug(e,...t){}info(e,...t){}error(e,...t){}warn(e,...t){}},M=class extends O{constructor(e){super(),this.options=e}static{t(this,"ConsoleLogger")}debug(e,...t){this.options.logLevel<=0&&console.debug(e,...t)}info(e,...t){this.options.logLevel<=1&&console.info(e,...t)}warn(e,...t){this.options.logLevel<=2&&console.warn(e,...t)}error(e,...t){this.options.logLevel<=3&&console.error(e,...t)}},I=class extends Error{static{t(this,"ServiceError")}},R=class extends I{static{t(this,"UnregisteredServiceError")}name="UnregisteredServiceError";constructor(e){super(`Resolving service that has not been registered: ${e.name}`),Object.setPrototypeOf(this,new.target.prototype)}},b=class extends I{static{t(this,"MultipleRegistrationError")}name="MultipleRegistrationError";constructor(e){super(`Multiple services have been registered: ${e.name}`),Object.setPrototypeOf(this,new.target.prototype)}},D=class e extends I{constructor(t,r,i){super(e.getErrorMessage(t.name,i?.name,r)),this.identifier=t,this.innerError=r,this.implementation=i,Object.setPrototypeOf(this,new.target.prototype)}static{t(this,"ServiceCreationError")}name="ServiceCreationError";static getErrorMessage(e,t,r){const i=t?`${e} (${t})`:e;return null==r?`Error creating service: ${i}`:`Error creating service: ${i}\n${r.message}`}},L=class extends I{static{t(this,"SelfDependencyError")}name="SelfDependencyError";constructor(){super("Service depending on itself"),Object.setPrototypeOf(this,new.target.prototype)}},P=class extends I{static{t(this,"CircularDependencyError")}name="CircularDependencyError";constructor(e){super(`Circular dependency detected while resolving: ${e.name}`),Object.setPrototypeOf(this,new.target.prototype)}},C=class extends I{static{t(this,"ScopedSingletonRegistrationError")}name="ScopedSingletonRegistrationError";constructor(){super("Cannot register a singleton in a scoped service collection"),Object.setPrototypeOf(this,new.target.prototype)}},x=class extends I{static{t(this,"InvalidServiceIdentifierError")}name="InvalidServiceIdentifierError";constructor(){super("Cannot register null or undefined service identifier"),Object.setPrototypeOf(this,new.target.prototype)}},N=class extends I{static{t(this,"InvalidImplementationError")}name="InvalidImplementationError";constructor(e){super(`Invalid implementation provided for service: ${e?.name??"undefined"}`),Object.setPrototypeOf(this,new.target.prototype)}},T=t(()=>new Map,"createRegistrationMap"),j=t(()=>new Map,"createDescriptorMap"),A=class{constructor(e,t,r){this.identifiers=e,this.isScoped=t,this.addService=r}static{t(this,"ServiceBuilder")}descriptor;to(e,t){if(null==e)throw new N(this.identifiers[0]);this.descriptor=this.createDescriptor(t,e);for(const e of this.identifiers)this.addService(e,this.descriptor);return this}createDescriptor(e,t){return{implementation:t,lifetime:"RESOLVE",createInstance:e??(()=>new t)}}singleton(){if(this.isScoped)throw new C;return this.ensureDescriptor().lifetime="SINGLETON",this}scoped(){return this.ensureDescriptor().lifetime="SCOPED",this}transient(){return this.ensureDescriptor().lifetime="TRANSIENT",this}ensureDescriptor(){if(!this.descriptor)throw new Error("Must call to() before setting lifetime");return this.descriptor}},$=class{static{t(this,"IDisposable")}},F=class{static{t(this,"IServiceModule")}},G=class{static{t(this,"IResolutionScope")}},k=class extends G{static{t(this,"IScopedProvider")}},B=class extends G{static{t(this,"IServiceProvider")}},V=class{static{t(this,"IServiceCollection")}},W=class{static{t(this,"ILifetimeBuilder")}},U=class{static{t(this,"IServiceBuilder")}},_="design:dependencies",q=t((e,t)=>Reflect.getMetadata(e,t),"getMetadata"),z=t((e,t,r)=>Reflect.defineMetadata(e,t,r),"defineMetadata"),H=class{constructor(e,t,r){this.singletons=e,this.scoped=t,this.targetIdentifier=r}static{t(this,"ResolutionContext")}transient=T();resolving=new Set;markResolving(e){return!this.resolving.has(e)&&(this.resolving.add(e),!0)}unmarkResolving(e){this.resolving.delete(e)}getFromLifetime(e,t){const r=this.getMapForLifetime(t);return r?.get(e)}setForLifetime(e,t,r){const i=this.getMapForLifetime(r);i?.set(e,t)}getMapForLifetime(e){return{SINGLETON:this.singletons,SCOPED:this.scoped,RESOLVE:this.transient}[e]}},J=class e{constructor(e,t,r=T()){this.logger=e,this.Services=t,this.singletons=r}static{t(this,"ServiceProvider")}scoped=T();created=[];[Symbol.dispose](){for(const e of this.created)e[Symbol.dispose]()}resolveInternal(e,t,r){const i=t.getFromLifetime(e.implementation,e.lifetime);if(null!=i)return i;const s=r||e.implementation;if(!t.markResolving(e.implementation))throw new P(s);try{return this.createInstance(e,t,r)}finally{t.unmarkResolving(e.implementation)}}resolveAll(e,t){const r=this.Services.get(e),i=t??new H(this.singletons,this.scoped,e);return r.map(t=>this.resolveInternal(t,i,e))}resolve(e,t){if(e.prototype===G.prototype||e.prototype===k.prototype||e.prototype===B.prototype)return this;const r=this.getSingleDescriptor(e),i=t??new H(this.singletons,this.scoped,e);try{return this.resolveInternal(r,i,e)}catch(t){throw this.wrapDependencyResolutionError(t,e,r,i)}}wrapDependencyResolutionError(e,t,r,i){if(e instanceof D&&e.identifier!==t)throw new D(t,e,r.implementation);throw e}getSingleDescriptor(e){const t=this.Services.get(e);if(0===t.length)throw new R(e);if(t.length>1&&"ERROR"===this.Services.options.registrationMode)throw new b(e);return t[t.length-1]}createInstance(e,t,r){const i=this.createInstanceInternal(e,t,r);return this.setDependencies(e.implementation,i,t,r),t.setForLifetime(e.implementation,i,e.lifetime),i}wrapContext(e){return{resolve:t(t=>this.resolve(t,e),"resolve"),resolveAll:t(t=>this.resolveAll(t,e),"resolveAll")}}createInstanceInternal(e,t,r){let i;try{i=e.createInstance(this.wrapContext(t))}catch(t){this.logger.error(t);const i=r||e.implementation;if(t instanceof Error)throw new D(i,t,e.implementation);throw new D(i,void 0,e.implementation)}return"SINGLETON"!==e.lifetime&&Symbol.dispose in i&&this.created.push(i),i}createScope(){return new e(this.logger,this.Services.clone(!0),this.singletons)}setDependencies(e,t,r,i){const s=q(_,e)??{};this.logger.debug("Dependencies",e.name,s);for(const[n,o]of Object.entries(s)){if(o===i)throw new L;this.logger.debug("Resolving",o.name,"for",e.name);const s=this.resolve(o,r);t[n]=s}return t}},K=class e{constructor(e,t,r,i=j()){this.logger=e,this.options=t,this.isScoped=r,this.services=i}static{t(this,"ServiceCollection")}registerModules(...e){for(const t of e){(new t).registerServices(this)}}get(e){return this.services.get(e)??[]}overrideLifetime(e,t){for(const r of this.get(e))r.lifetime=t}register(...e){if(0===e.length||e.some(e=>null==e))throw new x;return new A(e,this.isScoped,(e,t)=>this.addService(e,t))}addService(e,t){this.logger.info("Adding service",{identifier:e.name,descriptor:t});let r=this.services.get(e);null==r&&(r=[],this.services.set(e,r)),r.push(t)}clone(t){const r=j();for(const[e,t]of this.services){const i=t.map(e=>({...e}));r.set(e,i)}return new e(this.logger,this.options,!0===t,r)}buildProvider(){return new J(this.logger,this.clone())}},Q=t(e=>({...y,...e}),"mergeOptions"),X=t(e=>{const t=Q(e),r=t.logger??new M(t);return new K(r,t,!1)},"createServiceCollection"),Y=t((e,t,r,i)=>{let s=q(e,t);void 0===s&&(s={},z(e,s,t)),s[r]=i},"tagProperty"),Z=t(e=>(t,r)=>function(t){const i=this.constructor;return Y(_,i,r.name,e),t},"dependsOn");export{P as CircularDependencyError,y as DefaultServiceCollectionOptions,$ as IDisposable,W as ILifetimeBuilder,O as ILogger,G as IResolutionScope,k as IScopedProvider,U as IServiceBuilder,V as IServiceCollection,F as IServiceModule,B as IServiceProvider,N as InvalidImplementationError,x as InvalidServiceIdentifierError,w as Lifetime,S as LogLevel,b as MultipleRegistrationError,E as ResolveMultipleMode,C as ScopedSingletonRegistrationError,L as SelfDependencyError,D as ServiceCreationError,I as ServiceError,R as UnregisteredServiceError,X as createServiceCollection,Z as dependsOn};//# sourceMappingURL=index.js.map
1
+ var e=Object.defineProperty,t=(t,r)=>e(t,"name",{value:r,configurable:!0}),r=new WeakMap;function i(e,t,r,i){return e.reverse().forEach(e=>{i=e(t,r,i)||i}),i}function s(e,t){return e.reverse().forEach(e=>{const r=e(t);r&&(t=r)}),t}function n(e,t,r,n){if(!Array.isArray(e)||0===e.length)throw new TypeError;return void 0!==r?i(e,t,r,n):"function"==typeof t?s(e,t):void 0}function o(e,t){return r.get(e)&&r.get(e).get(t)}function a(e,t,r){if(void 0===t)throw new TypeError;const i=o(t,r);return i&&i.get(e)}function c(e,t){const i=r.get(e)||new Map;r.set(e,i);const s=i.get(t)||new Map;return i.set(t,s),s}function l(e,t,r,i){if(i&&!["string","symbol"].includes(typeof i))throw new TypeError;(o(r,i)||c(r,i)).set(e,t)}function h(e,t,r){return a(e,t,r)?a(e,t,r):Object.getPrototypeOf(t)?h(e,Object.getPrototypeOf(t),r):void 0}function p(e,r){return t(function(t,i){l(e,r,t,i)},"decorator")}function d(e,t,r){return h(e,t,r)}function g(e,t,r){return a(e,t,r)}function u(e,t,r){return!!a(e,t,r)}function f(e,t,r){return!!h(e,t,r)}function v(e,t,r,i){l(e,t,r,i)}t(i,"decorateProperty"),t(s,"decorateConstructor"),t(n,"decorate"),t(o,"getMetadataMap"),t(a,"ordinaryGetOwnMetadata"),t(c,"createMetadataMap"),t(l,"ordinaryDefineOwnMetadata"),t(h,"ordinaryGetMetadata"),t(p,"metadata"),t(d,"getMetadata"),t(g,"getOwnMetadata"),t(u,"hasOwnMetadata"),t(f,"hasMetadata"),t(v,"defineMetadata");var m={decorate:n,defineMetadata:v,getMetadata:d,getOwnMetadata:g,hasMetadata:f,hasOwnMetadata:u,metadata:p};Object.assign(Reflect,m);var w=(e=>(e.Resolve="RESOLVE",e.Transient="TRANSIENT",e.Scoped="SCOPED",e.Singleton="SINGLETON",e))(w||{}),S=(e=>(e[e.Debug=0]="Debug",e[e.Info=1]="Info",e[e.Warn=2]="Warn",e[e.Error=3]="Error",e[e.None=4]="None",e))(S||{}),E=(e=>(e.Error="ERROR",e.LastRegistered="LAST_REGISTERED",e))(E||{}),y={registrationMode:"ERROR",logLevel:2},O=class{static{t(this,"ILogger")}debug(e,...t){}info(e,...t){}error(e,...t){}warn(e,...t){}},M=class extends O{constructor(e){super(),this.options=e}static{t(this,"ConsoleLogger")}debug(e,...t){this.options.logLevel<=0&&console.debug(e,...t)}info(e,...t){this.options.logLevel<=1&&console.info(e,...t)}warn(e,...t){this.options.logLevel<=2&&console.warn(e,...t)}error(e,...t){this.options.logLevel<=3&&console.error(e,...t)}},R=class extends Error{static{t(this,"ServiceError")}},I=class extends R{static{t(this,"UnregisteredServiceError")}name="UnregisteredServiceError";constructor(e){super(`Resolving service that has not been registered: ${e.name}`),Object.setPrototypeOf(this,new.target.prototype)}},b=class extends R{static{t(this,"MultipleRegistrationError")}name="MultipleRegistrationError";constructor(e){super(`Multiple services have been registered: ${e.name}`),Object.setPrototypeOf(this,new.target.prototype)}},D=class e extends R{constructor(t,r,i){super(e.getErrorMessage(t.name,i?.name,r)),this.identifier=t,this.innerError=r,this.implementation=i,Object.setPrototypeOf(this,new.target.prototype)}static{t(this,"ServiceCreationError")}name="ServiceCreationError";static getErrorMessage(e,t,r){const i=t?`${e} (${t})`:e;return null==r?`Error creating service: ${i}`:`Error creating service: ${i}\n${r.message}`}},L=class extends R{static{t(this,"SelfDependencyError")}name="SelfDependencyError";constructor(){super("Service depending on itself"),Object.setPrototypeOf(this,new.target.prototype)}},P=class extends R{static{t(this,"CircularDependencyError")}name="CircularDependencyError";constructor(e){super(`Circular dependency detected while resolving: ${e.name}`),Object.setPrototypeOf(this,new.target.prototype)}},C=class extends R{static{t(this,"ScopedSingletonRegistrationError")}name="ScopedSingletonRegistrationError";constructor(){super("Cannot register a singleton in a scoped service collection"),Object.setPrototypeOf(this,new.target.prototype)}},x=class extends R{static{t(this,"InvalidServiceIdentifierError")}name="InvalidServiceIdentifierError";constructor(){super("Cannot register null or undefined service identifier"),Object.setPrototypeOf(this,new.target.prototype)}},N=class extends R{static{t(this,"InvalidImplementationError")}name="InvalidImplementationError";constructor(e){super(`Invalid implementation provided for service: ${e?.name??"undefined"}`),Object.setPrototypeOf(this,new.target.prototype)}},T=t(()=>new Map,"createRegistrationMap"),j=t(()=>new Map,"createDescriptorMap"),A=class{constructor(e,t,r){this.identifiers=e,this.isScoped=t,this.addService=r}static{t(this,"ServiceBuilder")}descriptor;to(e,t){if(null==e)throw new N(this.identifiers[0]);this.descriptor=this.createDescriptor(t,e);for(const e of this.identifiers)this.addService(e,this.descriptor);return this}createDescriptor(e,t){return{implementation:t,lifetime:"RESOLVE",createInstance:e??(()=>new t)}}singleton(){if(this.isScoped)throw new C;return this.ensureDescriptor().lifetime="SINGLETON",this}scoped(){return this.ensureDescriptor().lifetime="SCOPED",this}transient(){return this.ensureDescriptor().lifetime="TRANSIENT",this}ensureDescriptor(){if(!this.descriptor)throw new Error("Must call to() before setting lifetime");return this.descriptor}},$=class{static{t(this,"IDisposable")}},F=class{static{t(this,"IServiceModule")}},G=class{static{t(this,"IResolutionScope")}},k=class extends G{static{t(this,"IScopedProvider")}},B=class extends G{static{t(this,"IServiceProvider")}},V=class{static{t(this,"IServiceCollection")}},W=class{static{t(this,"ILifetimeBuilder")}},U=class{static{t(this,"IServiceBuilder")}},_="design:dependencies",q=t((e,t)=>Reflect.getMetadata(e,t),"getMetadata"),z=t((e,t,r)=>Reflect.defineMetadata(e,t,r),"defineMetadata"),H=class{constructor(e,t,r){this.singletons=e,this.scoped=t,this.targetIdentifier=r}static{t(this,"ResolutionContext")}transient=T();resolving=new Set;markResolving(e){return!this.resolving.has(e)&&(this.resolving.add(e),!0)}unmarkResolving(e){this.resolving.delete(e)}getFromLifetime(e,t){const r=this.getMapForLifetime(t);return r?.get(e)}setForLifetime(e,t,r){const i=this.getMapForLifetime(r);i?.set(e,t)}getMapForLifetime(e){return{SINGLETON:this.singletons,SCOPED:this.scoped,RESOLVE:this.transient}[e]}},J=class e{constructor(e,t,r,i,s){this.logger=e,this.Services=t,this.singletons=r,this.singletonDisposables=i,this.isRoot=s}static{t(this,"ServiceProvider")}scoped=T();created=[];static createRoot(t,r){return new e(t,r,T(),[],!0)}[Symbol.dispose](){for(const e of this.created)e[Symbol.dispose]();if(this.isRoot)for(const e of this.singletonDisposables)e[Symbol.dispose]()}resolveInternal(e,t,r){const i=t.getFromLifetime(e.implementation,e.lifetime);if(null!=i)return i;const s=r||e.implementation;if(!t.markResolving(e.implementation))throw new P(s);try{return this.createInstance(e,t,r)}finally{t.unmarkResolving(e.implementation)}}resolveAll(e,t){const r=this.Services.get(e),i=t??new H(this.singletons,this.scoped,e);return r.map(t=>this.resolveInternal(t,i,e))}resolve(e,t){if(e.prototype===G.prototype||e.prototype===k.prototype||e.prototype===B.prototype)return this;const r=this.getSingleDescriptor(e),i=t??new H(this.singletons,this.scoped,e);try{return this.resolveInternal(r,i,e)}catch(t){throw this.wrapDependencyResolutionError(t,e,r,i)}}wrapDependencyResolutionError(e,t,r,i){if(e instanceof D&&e.identifier!==t)throw new D(t,e,r.implementation);throw e}getSingleDescriptor(e){const t=this.Services.get(e);if(0===t.length)throw new I(e);if(t.length>1&&"ERROR"===this.Services.options.registrationMode)throw new b(e);return t[t.length-1]}createInstance(e,t,r){const i=this.createInstanceInternal(e,t,r);return this.setDependencies(e.implementation,i,t,r),t.setForLifetime(e.implementation,i,e.lifetime),i}wrapContext(e){return{resolve:t(t=>this.resolve(t,e),"resolve"),resolveAll:t(t=>this.resolveAll(t,e),"resolveAll")}}createInstanceInternal(e,t,r){let i;try{i=e.createInstance(this.wrapContext(t))}catch(t){this.logger.error(t);const i=r||e.implementation;if(t instanceof Error)throw new D(i,t,e.implementation);throw new D(i,void 0,e.implementation)}return Symbol.dispose in i&&("SINGLETON"===e.lifetime?this.singletonDisposables.push(i):this.created.push(i)),i}createScope(){return new e(this.logger,this.Services.clone(!0),this.singletons,this.singletonDisposables,!1)}setDependencies(e,t,r,i){const s=q(_,e)??{};this.logger.debug("Dependencies",e.name,s);for(const[n,o]of Object.entries(s)){if(o===i)throw new L;this.logger.debug("Resolving",o.name,"for",e.name);const s=this.resolve(o,r);t[n]=s}return t}},K=class e{constructor(e,t,r,i=j()){this.logger=e,this.options=t,this.isScoped=r,this.services=i}static{t(this,"ServiceCollection")}registerModules(...e){for(const t of e){(new t).registerServices(this)}}get(e){return this.services.get(e)??[]}overrideLifetime(e,t){for(const r of this.get(e))r.lifetime=t}register(...e){if(0===e.length||e.some(e=>null==e))throw new x;return new A(e,this.isScoped,(e,t)=>this.addService(e,t))}addService(e,t){this.logger.info("Adding service",{identifier:e.name,descriptor:t});let r=this.services.get(e);null==r&&(r=[],this.services.set(e,r)),r.push(t)}clone(t){const r=j();for(const[e,t]of this.services){const i=t.map(e=>({...e}));r.set(e,i)}return new e(this.logger,this.options,!0===t,r)}buildProvider(){return J.createRoot(this.logger,this.clone())}},Q=t(e=>({...y,...e}),"mergeOptions"),X=t(e=>{const t=Q(e),r=t.logger??new M(t);return new K(r,t,!1)},"createServiceCollection"),Y=t((e,t,r,i)=>{let s=q(e,t);void 0===s&&(s={},z(e,s,t)),s[r]=i},"tagProperty"),Z=t(e=>(t,r)=>function(t){const i=this.constructor;return Y(_,i,r.name,e),t},"dependsOn");export{P as CircularDependencyError,y as DefaultServiceCollectionOptions,$ as IDisposable,W as ILifetimeBuilder,O as ILogger,G as IResolutionScope,k as IScopedProvider,U as IServiceBuilder,V as IServiceCollection,F as IServiceModule,B as IServiceProvider,N as InvalidImplementationError,x as InvalidServiceIdentifierError,w as Lifetime,S as LogLevel,b as MultipleRegistrationError,E as ResolveMultipleMode,C as ScopedSingletonRegistrationError,L as SelfDependencyError,D as ServiceCreationError,R as ServiceError,I as UnregisteredServiceError,X as createServiceCollection,Z as dependsOn};//# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../node_modules/.pnpm/@abraham+reflection@0.13.0/node_modules/@abraham/reflection/src/index.ts","../../src/enums.ts","../../src/defaults.ts","../../src/logger.ts","../../src/private/consoleLogger.ts","../../src/errors.ts","../../src/types.ts","../../src/private/ServiceBuilder.ts","../../src/interfaces.ts","../../src/private/constants.ts","../../src/private/metadata.ts","../../src/private/ResolutionContext.ts","../../src/private/ServiceProvider.ts","../../src/private/ServiceCollection.ts","../../src/createServiceCollection.ts","../../src/dependsOn.ts"],"names":["Lifetime","LogLevel","ResolveMultipleMode","getMetadata","defineMetadata","metadata"],"mappings":";;;;AAUA,IAAM,QAAA,uBAAe,OAAA,EAAO;AAE5B,SAAS,gBAAA,CACP,UAAA,EACA,MAAA,EACA,WAAA,EACA,UAAA,EAA+B;AAE/B,EAAA,UAAA,CAAW,OAAA,EAAO,CAAG,OAAA,CAAQ,CAAC,SAAA,KAA8B;AAC1D,IAAA,UAAA,GAAa,SAAA,CAAU,MAAA,EAAQ,WAAA,EAAa,UAAU,CAAA,IAAK,UAAA;EAC7D,CAAC,CAAA;AACD,EAAA,OAAO,UAAA;AACT;AAVS,MAAA,CAAA,gBAAA,EAAA,kBAAA,CAAA;AAYT,SAAS,mBAAA,CACP,YACA,MAAA,EAAgB;AAEhB,EAAA,UAAA,CAAW,OAAA,EAAO,CAAG,OAAA,CAAQ,CAAC,SAAA,KAA6B;AACzD,IAAA,MAAM,SAAA,GAAY,UAAU,MAAM,CAAA;AAClC,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,MAAA,GAAS,SAAA;AACX,IAAA;EACF,CAAC,CAAA;AACD,EAAA,OAAO,MAAA;AACT;AAXS,MAAA,CAAA,mBAAA,EAAA,qBAAA,CAAA;AAuBH,SAAU,QAAA,CACd,UAAA,EACA,MAAA,EACA,WAAA,EACA,UAAA,EAA+B;AAE/B,EAAA,IAAI,CAAC,KAAA,CAAM,OAAA,CAAQ,UAAU,CAAA,IAAK,UAAA,CAAW,WAAW,CAAA,EAAG;AACzD,IAAA,MAAM,IAAI,SAAA,EAAS;AACrB,EAAA;AAEA,EAAA,IAAI,gBAAgB,MAAA,E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I,IAAA,EAAM,UAAU,CAAA;AAC/D,MAAA,OAAO,YAAA;AAAA,IACT,CAAA;AAAA,EACF,CAAA;AACF,CAAA,EARyB,WAAA","file":"index.js","sourcesContent":["export type Decorator = ClassDecorator | MemberDecorator;\nexport type MemberDecorator = <T>(\n target: Target,\n propertyKey: PropertyKey,\n descriptor?: TypedPropertyDescriptor<T>,\n) => TypedPropertyDescriptor<T> | void;\nexport type MetadataKey = string | symbol;\nexport type PropertyKey = string | symbol;\nexport type Target = object | Function;\n\nconst Metadata = new WeakMap();\n\nfunction decorateProperty(\n decorators: MemberDecorator[],\n target: Target,\n propertyKey: PropertyKey,\n descriptor?: PropertyDescriptor,\n): PropertyDescriptor | undefined {\n decorators.reverse().forEach((decorator: MemberDecorator) => {\n descriptor = decorator(target, propertyKey, descriptor) || descriptor;\n });\n return descriptor;\n}\n\nfunction decorateConstructor(\n decorators: ClassDecorator[],\n target: Function,\n): Function {\n decorators.reverse().forEach((decorator: ClassDecorator) => {\n const decorated = decorator(target);\n if (decorated) {\n target = decorated;\n }\n });\n return target;\n}\n\nexport function decorate(\n decorators: ClassDecorator[],\n target: Function,\n): Function;\nexport function decorate(\n decorators: MemberDecorator[],\n target: object,\n propertyKey?: PropertyKey,\n attributes?: PropertyDescriptor,\n): PropertyDescriptor | undefined;\nexport function decorate(\n decorators: Decorator[],\n target: Target,\n propertyKey?: PropertyKey,\n attributes?: PropertyDescriptor,\n): Function | PropertyDescriptor | undefined {\n if (!Array.isArray(decorators) || decorators.length === 0) {\n throw new TypeError();\n }\n\n if (propertyKey !== undefined) {\n return decorateProperty(\n decorators as MemberDecorator[],\n target,\n propertyKey,\n attributes,\n );\n }\n\n if (typeof target === 'function') {\n return decorateConstructor(decorators as ClassDecorator[], target);\n }\n\n return;\n}\n\nfunction getMetadataMap<MetadataValue>(\n target: Target,\n propertyKey?: PropertyKey,\n): Map<MetadataKey, MetadataValue> | undefined {\n return Metadata.get(target) && Metadata.get(target).get(propertyKey);\n}\n\nfunction ordinaryGetOwnMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): MetadataValue | undefined {\n if (target === undefined) {\n throw new TypeError();\n }\n const metadataMap = getMetadataMap<MetadataValue>(target, propertyKey);\n return metadataMap && metadataMap.get(metadataKey);\n}\n\nfunction createMetadataMap<MetadataValue>(\n target: Target,\n propertyKey?: PropertyKey,\n): Map<MetadataKey, MetadataValue> {\n const targetMetadata =\n Metadata.get(target) ||\n new Map<PropertyKey | undefined, Map<MetadataKey, MetadataValue>>();\n Metadata.set(target, targetMetadata);\n const metadataMap =\n targetMetadata.get(propertyKey) || new Map<MetadataKey, MetadataValue>();\n targetMetadata.set(propertyKey, metadataMap);\n return metadataMap;\n}\n\nfunction ordinaryDefineOwnMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n metadataValue: MetadataValue,\n target: Target,\n propertyKey?: PropertyKey,\n): void {\n if (propertyKey && !['string', 'symbol'].includes(typeof propertyKey)) {\n throw new TypeError();\n }\n\n (\n getMetadataMap<MetadataValue>(target, propertyKey) ||\n createMetadataMap<MetadataValue>(target, propertyKey)\n ).set(metadataKey, metadataValue);\n}\n\nfunction ordinaryGetMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): MetadataValue | undefined {\n return ordinaryGetOwnMetadata<MetadataValue>(metadataKey, target, propertyKey)\n ? ordinaryGetOwnMetadata<MetadataValue>(metadataKey, target, propertyKey)\n : Object.getPrototypeOf(target)\n ? ordinaryGetMetadata(\n metadataKey,\n Object.getPrototypeOf(target),\n propertyKey,\n )\n : undefined;\n}\n\nexport function metadata<MetadataValue>(\n metadataKey: MetadataKey,\n metadataValue: MetadataValue,\n) {\n return function decorator(target: Target, propertyKey?: PropertyKey): void {\n ordinaryDefineOwnMetadata<MetadataValue>(\n metadataKey,\n metadataValue,\n target,\n propertyKey,\n );\n };\n}\n\nexport function getMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): MetadataValue | undefined {\n return ordinaryGetMetadata<MetadataValue>(metadataKey, target, propertyKey);\n}\n\nexport function getOwnMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): MetadataValue | undefined {\n return ordinaryGetOwnMetadata<MetadataValue>(\n metadataKey,\n target,\n propertyKey,\n );\n}\n\nexport function hasOwnMetadata(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): boolean {\n return !!ordinaryGetOwnMetadata(metadataKey, target, propertyKey);\n}\n\nexport function hasMetadata(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): boolean {\n return !!ordinaryGetMetadata(metadataKey, target, propertyKey);\n}\n\nexport function defineMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n metadataValue: MetadataValue,\n target: Target,\n propertyKey?: PropertyKey,\n): void {\n ordinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);\n}\n\nexport const Reflection = {\n decorate,\n defineMetadata,\n getMetadata,\n getOwnMetadata,\n hasMetadata,\n hasOwnMetadata,\n metadata,\n};\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace Reflect {\n let decorate: typeof Reflection.decorate;\n let defineMetadata: typeof Reflection.defineMetadata;\n let getMetadata: typeof Reflection.getMetadata;\n let getOwnMetadata: typeof Reflection.getOwnMetadata;\n let hasOwnMetadata: typeof Reflection.hasOwnMetadata;\n let hasMetadata: typeof Reflection.hasMetadata;\n let metadata: typeof Reflection.metadata;\n }\n}\n\nObject.assign(Reflect, Reflection);\n","export enum Lifetime {\n Resolve = 'RESOLVE',\n Transient = 'TRANSIENT',\n Scoped = 'SCOPED',\n Singleton = 'SINGLETON',\n}\n\nexport enum LogLevel {\n Debug = 0,\n Info = 1,\n Warn = 2,\n Error = 3,\n None = 4,\n}\n\nexport enum ResolveMultipleMode {\n Error = 'ERROR',\n LastRegistered = 'LAST_REGISTERED',\n}\n","import { LogLevel, ResolveMultipleMode } from './enums';\nimport type { ServiceCollectionOptions } from './types';\n\nexport const DefaultServiceCollectionOptions: ServiceCollectionOptions = {\n registrationMode: ResolveMultipleMode.Error,\n logLevel: LogLevel.Warn,\n};\n","export abstract class ILogger {\n public debug(_message?: any, ..._optionalParams: any[]) {}\n public info(_message?: any, ..._optionalParams: any[]) {}\n public error(_message?: any, ..._optionalParams: any[]) {}\n public warn(_message?: any, ..._optionalParams: any[]) {}\n}\n","import { LogLevel } from '../enums';\nimport { ILogger } from '../logger';\nimport type { ServiceCollectionOptions } from '../types';\n\nexport class ConsoleLogger extends ILogger {\n constructor(private readonly options: ServiceCollectionOptions) {\n super();\n }\n\n public override debug(message?: any, ...optionalParams: any[]): void {\n if (this.options.logLevel <= LogLevel.Debug) {\n console.debug(message, ...optionalParams);\n }\n }\n\n public override info(message?: any, ...optionalParams: any[]): void {\n if (this.options.logLevel <= LogLevel.Info) {\n console.info(message, ...optionalParams);\n }\n }\n\n public override warn(message?: any, ...optionalParams: any[]): void {\n if (this.options.logLevel <= LogLevel.Warn) {\n console.warn(message, ...optionalParams);\n }\n }\n\n public override error(message?: any, ...optionalParams: any[]): void {\n if (this.options.logLevel <= LogLevel.Error) {\n console.error(message, ...optionalParams);\n }\n }\n}\n","import type { ServiceIdentifier, ServiceImplementation, ServiceRegistration } from './types';\n\nexport abstract class ServiceError extends Error {}\n\nexport class UnregisteredServiceError<T extends object> extends ServiceError {\n name = 'UnregisteredServiceError';\n constructor(identifier: ServiceIdentifier<T>) {\n super(`Resolving service that has not been registered: ${identifier.name}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class MultipleRegistrationError<T extends object> extends ServiceError {\n name = 'MultipleRegistrationError';\n constructor(identifier: ServiceIdentifier<T>) {\n super(`Multiple services have been registered: ${identifier.name}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class ServiceCreationError<T extends object> extends ServiceError {\n name = 'ServiceCreationError';\n constructor(\n public readonly identifier: ServiceIdentifier<T>,\n public readonly innerError?: Error,\n public readonly implementation?: ServiceRegistration<T>,\n ) {\n super(ServiceCreationError.getErrorMessage(identifier.name, implementation?.name, innerError));\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static getErrorMessage(identifierName: string, implementationName: string | undefined, innerError: Error | undefined): string {\n const serviceName = implementationName ? `${identifierName} (${implementationName})` : identifierName;\n if (innerError == null) {\n return `Error creating service: ${serviceName}`;\n }\n return `Error creating service: ${serviceName}\\n${innerError.message}`;\n }\n}\n\nexport class SelfDependencyError extends ServiceError {\n name = 'SelfDependencyError';\n constructor() {\n super('Service depending on itself');\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class CircularDependencyError extends ServiceError {\n name = 'CircularDependencyError';\n constructor(identifier: ServiceIdentifier<object>) {\n super(`Circular dependency detected while resolving: ${identifier.name}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class ScopedSingletonRegistrationError extends ServiceError {\n name = 'ScopedSingletonRegistrationError';\n constructor() {\n super('Cannot register a singleton in a scoped service collection');\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class InvalidServiceIdentifierError extends ServiceError {\n name = 'InvalidServiceIdentifierError';\n constructor() {\n super('Cannot register null or undefined service identifier');\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class InvalidImplementationError<T extends object> extends ServiceError {\n name = 'InvalidImplementationError';\n constructor(identifier: ServiceIdentifier<T> | undefined) {\n super(`Invalid implementation provided for service: ${identifier?.name ?? 'undefined'}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n","import type { Lifetime, LogLevel, ResolveMultipleMode } from './enums';\nimport type { ILifetimeBuilder, IResolutionScope, IServiceModule } from './interfaces';\nimport type { ILogger } from './logger';\nimport type { ConsoleLogger } from './private/consoleLogger';\n\nexport type SourceType = object;\n\nexport type AbstractNewable<T> = abstract new (...args: any[]) => T;\nexport type Newable<T> = new (...args: any[]) => T;\n\nexport type ServiceIdentifier<T extends SourceType> = { prototype: T; name: string }; //AbstractNewable<T>;\nexport type ServiceImplementation<T extends SourceType> = Newable<T>;\nexport type ServiceRegistration<T extends SourceType> = ServiceIdentifier<T> | ServiceImplementation<T>;\n\nexport type InstanceFactory<T extends SourceType> = (x: IResolutionScope) => T;\n\nexport type ServiceModuleType = Newable<IServiceModule>;\n\nexport type ServiceDescriptor<T extends SourceType> = {\n readonly implementation: ServiceRegistration<T>;\n lifetime: Lifetime;\n createInstance(context: IResolutionScope): T;\n};\n\nexport type MetadataType<T extends SourceType> = Record<string | symbol, ServiceIdentifier<T>>;\n\nexport type ServiceCollectionOptions = {\n /**\n * Whether calling `resolve` when there are multiple registrations\n * will result in an error or resolve the last registered service.\n * @default ResolveMultipleMode.Error\n */\n registrationMode: ResolveMultipleMode;\n /**\n * The default log level for the console logger.\n * @defaultValue {@link LogLevel.Warn}\n */\n logLevel: LogLevel;\n /**\n * Custom implementation for logger. Ignores log level.\n * @defaultValue {@link ConsoleLogger}\n */\n logger?: ILogger;\n};\n\nexport type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;\n\nexport type EnsureObject<T> = T extends object ? T : never;\n\nexport type ServiceBuilderOptions<T extends SourceType> = {\n (implementation: ServiceImplementation<T>): ILifetimeBuilder;\n (implementation: ServiceIdentifier<T>, factory: InstanceFactory<T>): ILifetimeBuilder;\n};\n\nexport type RegistrationMap<T extends SourceType = any> = Map<ServiceRegistration<T>, T>;\nexport type DescriptorMap<T extends SourceType = any> = Map<ServiceIdentifier<T>, ServiceDescriptor<T>[]>;\n\nexport const createRegistrationMap = <T extends SourceType = any>() => {\n return new Map<ServiceRegistration<T>, T>();\n};\n\nexport const createDescriptorMap = <T extends SourceType = any>() => {\n return new Map<ServiceIdentifier<T>, ServiceDescriptor<T>[]>();\n};\n","import { Lifetime } from '../enums';\nimport { InvalidImplementationError, ScopedSingletonRegistrationError } from '../errors';\nimport type { ILifetimeBuilder, IServiceBuilder } from '../interfaces';\nimport type { InstanceFactory, ServiceDescriptor, ServiceIdentifier, ServiceImplementation, ServiceRegistration, SourceType } from '../types';\n\nexport class ServiceBuilder<T extends SourceType> implements IServiceBuilder<T> {\n private descriptor: ServiceDescriptor<T> | undefined;\n\n constructor(\n private readonly identifiers: ServiceIdentifier<T>[],\n private readonly isScoped: boolean,\n private readonly addService: (identifier: ServiceIdentifier<T>, descriptor: ServiceDescriptor<T>) => void,\n ) {}\n\n public to(implementation: ServiceImplementation<T>): ILifetimeBuilder;\n public to(implementation: ServiceIdentifier<T>, factory?: InstanceFactory<T>): ILifetimeBuilder;\n public to(implementation: ServiceRegistration<T>, factory?: InstanceFactory<T> | undefined): ILifetimeBuilder {\n if (implementation == null) {\n throw new InvalidImplementationError<T>(this.identifiers[0]);\n }\n\n this.descriptor = this.createDescriptor(factory, implementation);\n\n for (const identifier of this.identifiers) {\n this.addService(identifier, this.descriptor);\n }\n return this;\n }\n\n private createDescriptor(factory: InstanceFactory<T> | undefined, implementation: ServiceRegistration<T>): ServiceDescriptor<T> {\n return {\n implementation,\n lifetime: Lifetime.Resolve,\n createInstance: factory ?? (() => new (implementation as ServiceImplementation<T>)()),\n };\n }\n\n public singleton(): this {\n if (this.isScoped) {\n throw new ScopedSingletonRegistrationError();\n }\n this.ensureDescriptor().lifetime = Lifetime.Singleton;\n return this;\n }\n\n public scoped(): this {\n this.ensureDescriptor().lifetime = Lifetime.Scoped;\n return this;\n }\n\n public transient(): this {\n this.ensureDescriptor().lifetime = Lifetime.Transient;\n return this;\n }\n\n private ensureDescriptor(): ServiceDescriptor<T> {\n if (!this.descriptor) {\n throw new Error('Must call to() before setting lifetime');\n }\n return this.descriptor;\n }\n}\n","import type { Lifetime } from './enums';\nimport { ResolveMultipleMode } from './enums';\nimport type { EnsureObject, ServiceBuilderOptions, ServiceCollectionOptions, ServiceDescriptor, ServiceIdentifier, ServiceModuleType, SourceType, UnionToIntersection } from './types';\n\nexport abstract class IDisposable {\n public abstract [Symbol.dispose](): void;\n}\n\nexport abstract class IServiceModule {\n public abstract registerServices(services: IServiceCollection): void;\n}\n\nexport abstract class IResolutionScope {\n /**\n * Resolves a single implementation for the given identifier.\n * @template T The type of service to resolve\n * @param identifier The service identifier\n * @returns The resolved instance\n * @throws {MultipleRegistrationError} When multiple implementations exist (unless {@link ServiceCollectionOptions.registrationMode} is set to {@link ResolveMultipleMode.LastRegistered}).\n * @throws {UnregisteredServiceError} When no implementation exists\n */\n public abstract resolve<T extends SourceType>(identifier: ServiceIdentifier<T>): T;\n\n /**\n * Resolves all implementations for the given identifier.\n * @template T The type of service to resolve\n * @param identifier The service identifier\n * @returns Array of resolved instances\n */\n public abstract resolveAll<T extends SourceType>(identifier: ServiceIdentifier<T>): T[];\n}\n\nexport abstract class IScopedProvider extends IResolutionScope implements IDisposable {\n public abstract readonly Services: IServiceCollection;\n public abstract [Symbol.dispose](): void;\n}\n\nexport abstract class IServiceProvider extends IResolutionScope {\n public abstract readonly Services: IServiceCollection;\n public abstract createScope(): IScopedProvider;\n}\n\nexport abstract class IServiceCollection {\n public abstract readonly options: ServiceCollectionOptions;\n public abstract get<T extends SourceType>(identifier: ServiceIdentifier<T>): ServiceDescriptor<T>[];\n /**\n * Registers one or more service identifiers with the service collection.\n * @param identifiers One or more service identifiers to register\n * @returns A service builder to configure the implementation and lifetime\n * @throws {InvalidServiceIdentifierError} When any identifier is null or undefined\n */\n public abstract register<Types extends [SourceType, ...SourceType[]]>(...identifiers: { [K in keyof Types]: ServiceIdentifier<Types[K]> }): IServiceBuilder<EnsureObject<UnionToIntersection<Types[number]>>>;\n public abstract registerModules(...modules: ServiceModuleType[]): void;\n public abstract overrideLifetime<T extends SourceType>(identifier: ServiceIdentifier<T>, lifetime: Lifetime): void;\n public abstract buildProvider(): IServiceProvider;\n public abstract clone(): IServiceCollection;\n public abstract clone(scoped: true): IServiceCollection;\n}\n\nexport abstract class ILifetimeBuilder {\n public abstract singleton(): ILifetimeBuilder;\n public abstract scoped(): ILifetimeBuilder;\n public abstract transient(): ILifetimeBuilder;\n}\n\nexport abstract class IServiceBuilder<T extends SourceType> {\n public abstract to: ServiceBuilderOptions<T>;\n}\n","export const DesignDependenciesKey = 'design:dependencies';\n","import '@abraham/reflection';\nimport type { MetadataType, SourceType } from '../types';\n\nexport const getMetadata = <T extends SourceType>(key: string, obj: object): MetadataType<T> | undefined => Reflect.getMetadata(key, obj);\nexport const defineMetadata = <T extends SourceType>(key: string, metadata: MetadataType<T>, obj: object) => Reflect.defineMetadata(key, metadata, obj);\n","import { Lifetime } from '../enums';\nimport { createRegistrationMap, type RegistrationMap, type ServiceIdentifier, type ServiceRegistration, type SourceType } from '../types';\n\nexport class ResolutionContext {\n constructor(\n private readonly singletons: RegistrationMap,\n private readonly scoped: RegistrationMap,\n public readonly targetIdentifier?: ServiceIdentifier<any>,\n ) {}\n\n private readonly transient: RegistrationMap = createRegistrationMap();\n private readonly resolving = new Set<ServiceRegistration<SourceType>>();\n\n public markResolving<T extends SourceType>(implementation: ServiceRegistration<T>): boolean {\n if (this.resolving.has(implementation)) {\n return false;\n }\n this.resolving.add(implementation);\n return true;\n }\n\n public unmarkResolving<T extends SourceType>(implementation: ServiceRegistration<T>): void {\n this.resolving.delete(implementation);\n }\n\n public getFromLifetime<T extends SourceType>(implementation: ServiceRegistration<T>, lifetime: Lifetime): T | null {\n const map = this.getMapForLifetime(lifetime);\n return map?.get(implementation);\n }\n\n public setForLifetime<T extends SourceType>(implementation: ServiceRegistration<T>, instance: T, lifetime: Lifetime): void {\n const map = this.getMapForLifetime(lifetime);\n map?.set(implementation, instance);\n }\n\n private getMapForLifetime(lifetime: Lifetime) {\n const map: Partial<Record<Lifetime, RegistrationMap>> = {\n [Lifetime.Singleton]: this.singletons,\n [Lifetime.Scoped]: this.scoped,\n [Lifetime.Resolve]: this.transient,\n };\n return map[lifetime];\n }\n}\n","import { Lifetime, ResolveMultipleMode } from '../enums';\nimport { CircularDependencyError, MultipleRegistrationError, SelfDependencyError, ServiceCreationError, UnregisteredServiceError } from '../errors';\nimport { type IDisposable, IResolutionScope, IScopedProvider, type IServiceCollection, IServiceProvider } from '../interfaces';\nimport type { ILogger } from '../logger';\nimport { createRegistrationMap, type ServiceDescriptor, type ServiceIdentifier, type ServiceImplementation, type ServiceRegistration, type SourceType } from '../types';\nimport { DesignDependenciesKey } from './constants';\nimport { getMetadata } from './metadata';\nimport { ResolutionContext } from './ResolutionContext';\n\nexport class ServiceProvider implements IServiceProvider, IScopedProvider {\n private scoped = createRegistrationMap();\n private created: IDisposable[] = [];\n\n constructor(\n private readonly logger: ILogger,\n public readonly Services: IServiceCollection,\n private readonly singletons = createRegistrationMap(),\n ) {}\n\n [Symbol.dispose]() {\n for (const x of this.created) {\n x[Symbol.dispose]();\n }\n }\n\n private resolveInternal<T extends SourceType>(descriptor: ServiceDescriptor<T>, context: ResolutionContext, serviceIdentifier?: ServiceIdentifier<T>): T {\n const existing = context.getFromLifetime(descriptor.implementation, descriptor.lifetime);\n if (existing != null) {\n return existing;\n }\n const identifier = serviceIdentifier || descriptor.implementation;\n if (!context.markResolving(descriptor.implementation)) {\n throw new CircularDependencyError(identifier);\n }\n try {\n return this.createInstance(descriptor, context, serviceIdentifier);\n } finally {\n context.unmarkResolving(descriptor.implementation);\n }\n }\n\n public resolveAll<T extends SourceType>(identifier: ServiceIdentifier<T>, context?: ResolutionContext): T[] {\n const descriptors = this.Services.get(identifier);\n const resolveContext = context ?? new ResolutionContext(this.singletons, this.scoped, identifier);\n return descriptors.map((descriptor) => this.resolveInternal<T>(descriptor, resolveContext, identifier));\n }\n\n public resolve<T extends SourceType>(identifier: ServiceIdentifier<T>, context?: ResolutionContext): T {\n if (identifier.prototype === IResolutionScope.prototype || identifier.prototype === IScopedProvider.prototype || identifier.prototype === IServiceProvider.prototype) {\n return this as IResolutionScope & IScopedProvider & IServiceProvider as T;\n }\n\n const descriptor = this.getSingleDescriptor(identifier);\n const resolveContext = context ?? new ResolutionContext(this.singletons, this.scoped, identifier);\n try {\n return this.resolveInternal(descriptor, resolveContext, identifier);\n } catch (err) {\n throw this.wrapDependencyResolutionError(err, identifier, descriptor, resolveContext);\n }\n }\n\n private wrapDependencyResolutionError<T extends SourceType>(err: unknown, requestedIdentifier: ServiceIdentifier<T>, descriptor: ServiceDescriptor<T>, context: ResolutionContext): never {\n if (err instanceof ServiceCreationError && err.identifier !== requestedIdentifier) {\n throw new ServiceCreationError(requestedIdentifier, err, descriptor.implementation);\n }\n throw err;\n }\n\n private getSingleDescriptor<T extends SourceType>(identifier: ServiceIdentifier<T>) {\n const descriptors = this.Services.get(identifier);\n if (descriptors.length === 0) {\n throw new UnregisteredServiceError(identifier);\n }\n\n if (descriptors.length > 1) {\n if (this.Services.options.registrationMode === ResolveMultipleMode.Error) {\n throw new MultipleRegistrationError(identifier);\n }\n }\n const descriptor = descriptors[descriptors.length - 1];\n return descriptor;\n }\n\n private createInstance<T extends SourceType>(descriptor: ServiceDescriptor<T>, context: ResolutionContext, serviceIdentifier?: ServiceIdentifier<T>): T {\n const instance = this.createInstanceInternal(descriptor, context, serviceIdentifier);\n this.setDependencies(descriptor.implementation, instance, context, serviceIdentifier);\n context.setForLifetime(descriptor.implementation, instance, descriptor.lifetime);\n return instance;\n }\n\n private wrapContext(context: ResolutionContext): IResolutionScope {\n const resolve = (identifier: ServiceIdentifier<any>) => this.resolve(identifier, context);\n const resolveAll = (identifier: ServiceIdentifier<any>) => this.resolveAll(identifier, context);\n\n return {\n resolve,\n resolveAll,\n };\n }\n\n private createInstanceInternal<T extends SourceType>(descriptor: ServiceDescriptor<T>, context: ResolutionContext, serviceIdentifier?: ServiceIdentifier<T>) {\n let instance: T | undefined;\n try {\n instance = descriptor.createInstance(this.wrapContext(context));\n } catch (err) {\n this.logger.error(err);\n const identifier = serviceIdentifier || descriptor.implementation;\n if (err instanceof Error) {\n throw new ServiceCreationError(identifier, err, descriptor.implementation);\n }\n throw new ServiceCreationError(identifier, undefined, descriptor.implementation);\n }\n if (descriptor.lifetime !== Lifetime.Singleton && Symbol.dispose in instance) {\n this.created.push(instance as IDisposable);\n }\n return instance;\n }\n\n public createScope(): IScopedProvider {\n return new ServiceProvider(this.logger, this.Services.clone(true), this.singletons);\n }\n\n private setDependencies<T extends SourceType>(implementation: ServiceRegistration<T>, instance: T, context: ResolutionContext, serviceIdentifier?: ServiceIdentifier<T>): T {\n const dependencies = getMetadata<T>(DesignDependenciesKey, implementation) ?? {};\n this.logger.debug('Dependencies', implementation.name, dependencies);\n for (const [key, identifier] of Object.entries(dependencies)) {\n if (identifier === serviceIdentifier) {\n throw new SelfDependencyError();\n }\n this.logger.debug('Resolving', identifier.name, 'for', implementation.name);\n const dep = this.resolve(identifier, context);\n (instance as Record<string, T>)[key] = dep;\n }\n return instance;\n }\n}\n","import type { Lifetime } from '../enums';\nimport { InvalidServiceIdentifierError } from '../errors';\nimport type { IServiceBuilder, IServiceCollection, IServiceProvider } from '../interfaces';\nimport type { ILogger } from '../logger';\nimport { createDescriptorMap, type DescriptorMap, type EnsureObject, type ServiceCollectionOptions, type ServiceDescriptor, type ServiceIdentifier, type ServiceModuleType, type SourceType, type UnionToIntersection } from '../types';\nimport { ServiceBuilder } from './ServiceBuilder';\nimport { ServiceProvider } from './ServiceProvider';\n\nexport class ServiceCollection implements IServiceCollection {\n constructor(\n private readonly logger: ILogger,\n public readonly options: ServiceCollectionOptions,\n private readonly isScoped: boolean,\n private readonly services = createDescriptorMap(),\n ) {}\n\n public registerModules(...modules: ServiceModuleType[]): void {\n for (const x of modules) {\n const module = new x();\n module.registerServices(this);\n }\n }\n\n get<T extends SourceType>(key: ServiceIdentifier<T>): ServiceDescriptor<T>[] {\n return this.services.get(key) ?? [];\n }\n\n public overrideLifetime<T extends SourceType>(identifier: ServiceIdentifier<T>, lifetime: Lifetime): void {\n for (const descriptor of this.get(identifier)) {\n descriptor.lifetime = lifetime;\n }\n }\n\n register<Types extends [SourceType, ...SourceType[]]>(...identifiers: { [K in keyof Types]: ServiceIdentifier<Types[K]> }): IServiceBuilder<EnsureObject<UnionToIntersection<Types[number]>>> {\n if (identifiers.length === 0 || identifiers.some((id) => id == null)) {\n throw new InvalidServiceIdentifierError();\n }\n\n return new ServiceBuilder(identifiers, this.isScoped, (identifier, descriptor) => this.addService(identifier, descriptor));\n }\n\n private addService<T extends SourceType>(identifier: ServiceIdentifier<T>, descriptor: ServiceDescriptor<T>) {\n this.logger.info('Adding service', { identifier: identifier.name, descriptor });\n let existing = this.services.get(identifier);\n if (existing == null) {\n existing = [];\n this.services.set(identifier, existing);\n }\n existing.push(descriptor);\n }\n\n public clone(scoped?: unknown): IServiceCollection {\n const clonedMap: DescriptorMap = createDescriptorMap();\n for (const [key, descriptors] of this.services) {\n const clonedDescriptors = descriptors.map((descriptor) => ({ ...descriptor }));\n clonedMap.set(key, clonedDescriptors);\n }\n\n return new ServiceCollection(this.logger, this.options, scoped === true, clonedMap);\n }\n\n public buildProvider(): IServiceProvider {\n return new ServiceProvider(this.logger, this.clone());\n }\n}\n","import { DefaultServiceCollectionOptions } from './defaults';\nimport type { IServiceCollection } from './interfaces';\nimport { ConsoleLogger } from './private/consoleLogger';\nimport { ServiceCollection } from './private/ServiceCollection';\nimport type { ServiceCollectionOptions } from './types';\n\nconst mergeOptions = (options: Partial<ServiceCollectionOptions> | undefined): ServiceCollectionOptions => ({\n ...DefaultServiceCollectionOptions,\n ...options,\n});\n\n/**\n * Creates a service collection with the (optionally) provided options\n * @param options - Optional configuration for the service collection.\n * @defaultValue Default options are taken from {@link DefaultServiceCollectionOptions}.\n */\nexport const createServiceCollection = (options?: Partial<ServiceCollectionOptions>): IServiceCollection => {\n const mergedOptions = mergeOptions(options);\n const logger = mergedOptions.logger ?? new ConsoleLogger(mergedOptions);\n return new ServiceCollection(logger, mergedOptions, false);\n};\n","import { IResolutionScope, IScopedProvider, IServiceProvider } from './interfaces';\nimport { DesignDependenciesKey } from './private/constants';\nimport { defineMetadata, getMetadata } from './private/metadata';\nimport type { ServiceIdentifier, SourceType } from './types';\n\nconst tagProperty = <T extends SourceType>(metadataKey: string, annotationTarget: object, name: string | symbol, identifier: ServiceIdentifier<T>) => {\n let existing = getMetadata<T>(metadataKey, annotationTarget);\n if (existing === undefined) {\n existing = {};\n defineMetadata(metadataKey, existing, annotationTarget);\n }\n existing[name] = identifier;\n};\n\n/**\n * declares a dependency, use on a class field.\n * Can also depend on {@link IServiceProvider}, {@link IResolutionScope}, or {@link IScopedProvider}.\n * @param identifier the identifier to depend on, i.e. the interface\n */\nexport const dependsOn = <T extends SourceType>(identifier: ServiceIdentifier<T>) => {\n return (value: undefined, ctx: ClassFieldDecoratorContext) => {\n return function (this: object, initialValue: any) {\n const target = this.constructor;\n tagProperty(DesignDependenciesKey, target, ctx.name, identifier);\n return initialValue;\n };\n };\n};\n"]}
1
+ {"version":3,"sources":["../../../../node_modules/.pnpm/@abraham+reflection@0.13.0/node_modules/@abraham/reflection/src/index.ts","../../src/enums.ts","../../src/defaults.ts","../../src/logger.ts","../../src/private/consoleLogger.ts","../../src/errors.ts","../../src/types.ts","../../src/private/ServiceBuilder.ts","../../src/interfaces.ts","../../src/private/constants.ts","../../src/private/metadata.ts","../../src/private/ResolutionContext.ts","../../src/private/ServiceProvider.ts","../../src/private/ServiceCollection.ts","../../src/createServiceCollection.ts","../../src/dependsOn.ts"],"names":["Lifetime","LogLevel","ResolveMultipleMode","getMetadata","defineMetadata","metadata"],"mappings":";;;;AAUA,IAAM,QAAA,uBAAe,OAAA,EAAO;AAE5B,SAAS,gBAAA,CACP,UAAA,EACA,MAAA,EACA,WAAA,EACA,UAAA,EAA+B;AAE/B,EAAA,UAAA,CAAW,OAAA,EAAO,CAAG,OAAA,CAAQ,CAAC,SAAA,KAA8B;AAC1D,IAAA,UAAA,GAAa,SAAA,CAAU,MAAA,EAAQ,WAAA,EAAa,UAAU,CAAA,IAAK,UAAA;EAC7D,CAAC,CAAA;AACD,EAAA,OAAO,UAAA;AACT;AAVS,MAAA,CAAA,gBAAA,EAAA,kB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A,EARyB,WAAA","file":"index.js","sourcesContent":["export type Decorator = ClassDecorator | MemberDecorator;\nexport type MemberDecorator = <T>(\n target: Target,\n propertyKey: PropertyKey,\n descriptor?: TypedPropertyDescriptor<T>,\n) => TypedPropertyDescriptor<T> | void;\nexport type MetadataKey = string | symbol;\nexport type PropertyKey = string | symbol;\nexport type Target = object | Function;\n\nconst Metadata = new WeakMap();\n\nfunction decorateProperty(\n decorators: MemberDecorator[],\n target: Target,\n propertyKey: PropertyKey,\n descriptor?: PropertyDescriptor,\n): PropertyDescriptor | undefined {\n decorators.reverse().forEach((decorator: MemberDecorator) => {\n descriptor = decorator(target, propertyKey, descriptor) || descriptor;\n });\n return descriptor;\n}\n\nfunction decorateConstructor(\n decorators: ClassDecorator[],\n target: Function,\n): Function {\n decorators.reverse().forEach((decorator: ClassDecorator) => {\n const decorated = decorator(target);\n if (decorated) {\n target = decorated;\n }\n });\n return target;\n}\n\nexport function decorate(\n decorators: ClassDecorator[],\n target: Function,\n): Function;\nexport function decorate(\n decorators: MemberDecorator[],\n target: object,\n propertyKey?: PropertyKey,\n attributes?: PropertyDescriptor,\n): PropertyDescriptor | undefined;\nexport function decorate(\n decorators: Decorator[],\n target: Target,\n propertyKey?: PropertyKey,\n attributes?: PropertyDescriptor,\n): Function | PropertyDescriptor | undefined {\n if (!Array.isArray(decorators) || decorators.length === 0) {\n throw new TypeError();\n }\n\n if (propertyKey !== undefined) {\n return decorateProperty(\n decorators as MemberDecorator[],\n target,\n propertyKey,\n attributes,\n );\n }\n\n if (typeof target === 'function') {\n return decorateConstructor(decorators as ClassDecorator[], target);\n }\n\n return;\n}\n\nfunction getMetadataMap<MetadataValue>(\n target: Target,\n propertyKey?: PropertyKey,\n): Map<MetadataKey, MetadataValue> | undefined {\n return Metadata.get(target) && Metadata.get(target).get(propertyKey);\n}\n\nfunction ordinaryGetOwnMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): MetadataValue | undefined {\n if (target === undefined) {\n throw new TypeError();\n }\n const metadataMap = getMetadataMap<MetadataValue>(target, propertyKey);\n return metadataMap && metadataMap.get(metadataKey);\n}\n\nfunction createMetadataMap<MetadataValue>(\n target: Target,\n propertyKey?: PropertyKey,\n): Map<MetadataKey, MetadataValue> {\n const targetMetadata =\n Metadata.get(target) ||\n new Map<PropertyKey | undefined, Map<MetadataKey, MetadataValue>>();\n Metadata.set(target, targetMetadata);\n const metadataMap =\n targetMetadata.get(propertyKey) || new Map<MetadataKey, MetadataValue>();\n targetMetadata.set(propertyKey, metadataMap);\n return metadataMap;\n}\n\nfunction ordinaryDefineOwnMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n metadataValue: MetadataValue,\n target: Target,\n propertyKey?: PropertyKey,\n): void {\n if (propertyKey && !['string', 'symbol'].includes(typeof propertyKey)) {\n throw new TypeError();\n }\n\n (\n getMetadataMap<MetadataValue>(target, propertyKey) ||\n createMetadataMap<MetadataValue>(target, propertyKey)\n ).set(metadataKey, metadataValue);\n}\n\nfunction ordinaryGetMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): MetadataValue | undefined {\n return ordinaryGetOwnMetadata<MetadataValue>(metadataKey, target, propertyKey)\n ? ordinaryGetOwnMetadata<MetadataValue>(metadataKey, target, propertyKey)\n : Object.getPrototypeOf(target)\n ? ordinaryGetMetadata(\n metadataKey,\n Object.getPrototypeOf(target),\n propertyKey,\n )\n : undefined;\n}\n\nexport function metadata<MetadataValue>(\n metadataKey: MetadataKey,\n metadataValue: MetadataValue,\n) {\n return function decorator(target: Target, propertyKey?: PropertyKey): void {\n ordinaryDefineOwnMetadata<MetadataValue>(\n metadataKey,\n metadataValue,\n target,\n propertyKey,\n );\n };\n}\n\nexport function getMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): MetadataValue | undefined {\n return ordinaryGetMetadata<MetadataValue>(metadataKey, target, propertyKey);\n}\n\nexport function getOwnMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): MetadataValue | undefined {\n return ordinaryGetOwnMetadata<MetadataValue>(\n metadataKey,\n target,\n propertyKey,\n );\n}\n\nexport function hasOwnMetadata(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): boolean {\n return !!ordinaryGetOwnMetadata(metadataKey, target, propertyKey);\n}\n\nexport function hasMetadata(\n metadataKey: MetadataKey,\n target: Target,\n propertyKey?: PropertyKey,\n): boolean {\n return !!ordinaryGetMetadata(metadataKey, target, propertyKey);\n}\n\nexport function defineMetadata<MetadataValue>(\n metadataKey: MetadataKey,\n metadataValue: MetadataValue,\n target: Target,\n propertyKey?: PropertyKey,\n): void {\n ordinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);\n}\n\nexport const Reflection = {\n decorate,\n defineMetadata,\n getMetadata,\n getOwnMetadata,\n hasMetadata,\n hasOwnMetadata,\n metadata,\n};\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace Reflect {\n let decorate: typeof Reflection.decorate;\n let defineMetadata: typeof Reflection.defineMetadata;\n let getMetadata: typeof Reflection.getMetadata;\n let getOwnMetadata: typeof Reflection.getOwnMetadata;\n let hasOwnMetadata: typeof Reflection.hasOwnMetadata;\n let hasMetadata: typeof Reflection.hasMetadata;\n let metadata: typeof Reflection.metadata;\n }\n}\n\nObject.assign(Reflect, Reflection);\n","export enum Lifetime {\n Resolve = 'RESOLVE',\n Transient = 'TRANSIENT',\n Scoped = 'SCOPED',\n Singleton = 'SINGLETON',\n}\n\nexport enum LogLevel {\n Debug = 0,\n Info = 1,\n Warn = 2,\n Error = 3,\n None = 4,\n}\n\nexport enum ResolveMultipleMode {\n Error = 'ERROR',\n LastRegistered = 'LAST_REGISTERED',\n}\n","import { LogLevel, ResolveMultipleMode } from './enums';\nimport type { ServiceCollectionOptions } from './types';\n\nexport const DefaultServiceCollectionOptions: ServiceCollectionOptions = {\n registrationMode: ResolveMultipleMode.Error,\n logLevel: LogLevel.Warn,\n};\n","export abstract class ILogger {\n public debug(_message?: any, ..._optionalParams: any[]) {}\n public info(_message?: any, ..._optionalParams: any[]) {}\n public error(_message?: any, ..._optionalParams: any[]) {}\n public warn(_message?: any, ..._optionalParams: any[]) {}\n}\n","import { LogLevel } from '../enums';\nimport { ILogger } from '../logger';\nimport type { ServiceCollectionOptions } from '../types';\n\nexport class ConsoleLogger extends ILogger {\n constructor(private readonly options: ServiceCollectionOptions) {\n super();\n }\n\n public override debug(message?: any, ...optionalParams: any[]): void {\n if (this.options.logLevel <= LogLevel.Debug) {\n console.debug(message, ...optionalParams);\n }\n }\n\n public override info(message?: any, ...optionalParams: any[]): void {\n if (this.options.logLevel <= LogLevel.Info) {\n console.info(message, ...optionalParams);\n }\n }\n\n public override warn(message?: any, ...optionalParams: any[]): void {\n if (this.options.logLevel <= LogLevel.Warn) {\n console.warn(message, ...optionalParams);\n }\n }\n\n public override error(message?: any, ...optionalParams: any[]): void {\n if (this.options.logLevel <= LogLevel.Error) {\n console.error(message, ...optionalParams);\n }\n }\n}\n","import type { ServiceIdentifier, ServiceImplementation, ServiceRegistration } from './types';\n\nexport abstract class ServiceError extends Error {}\n\nexport class UnregisteredServiceError<T extends object> extends ServiceError {\n name = 'UnregisteredServiceError';\n constructor(identifier: ServiceIdentifier<T>) {\n super(`Resolving service that has not been registered: ${identifier.name}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class MultipleRegistrationError<T extends object> extends ServiceError {\n name = 'MultipleRegistrationError';\n constructor(identifier: ServiceIdentifier<T>) {\n super(`Multiple services have been registered: ${identifier.name}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class ServiceCreationError<T extends object> extends ServiceError {\n name = 'ServiceCreationError';\n constructor(\n public readonly identifier: ServiceIdentifier<T>,\n public readonly innerError?: Error,\n public readonly implementation?: ServiceRegistration<T>,\n ) {\n super(ServiceCreationError.getErrorMessage(identifier.name, implementation?.name, innerError));\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static getErrorMessage(identifierName: string, implementationName: string | undefined, innerError: Error | undefined): string {\n const serviceName = implementationName ? `${identifierName} (${implementationName})` : identifierName;\n if (innerError == null) {\n return `Error creating service: ${serviceName}`;\n }\n return `Error creating service: ${serviceName}\\n${innerError.message}`;\n }\n}\n\nexport class SelfDependencyError extends ServiceError {\n name = 'SelfDependencyError';\n constructor() {\n super('Service depending on itself');\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class CircularDependencyError extends ServiceError {\n name = 'CircularDependencyError';\n constructor(identifier: ServiceIdentifier<object>) {\n super(`Circular dependency detected while resolving: ${identifier.name}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class ScopedSingletonRegistrationError extends ServiceError {\n name = 'ScopedSingletonRegistrationError';\n constructor() {\n super('Cannot register a singleton in a scoped service collection');\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class InvalidServiceIdentifierError extends ServiceError {\n name = 'InvalidServiceIdentifierError';\n constructor() {\n super('Cannot register null or undefined service identifier');\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class InvalidImplementationError<T extends object> extends ServiceError {\n name = 'InvalidImplementationError';\n constructor(identifier: ServiceIdentifier<T> | undefined) {\n super(`Invalid implementation provided for service: ${identifier?.name ?? 'undefined'}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n","import type { Lifetime, LogLevel, ResolveMultipleMode } from './enums';\nimport type { ILifetimeBuilder, IResolutionScope, IServiceModule } from './interfaces';\nimport type { ILogger } from './logger';\nimport type { ConsoleLogger } from './private/consoleLogger';\n\nexport type SourceType = object;\n\nexport type AbstractNewable<T> = abstract new (...args: any[]) => T;\nexport type Newable<T> = new (...args: any[]) => T;\n\nexport type ServiceIdentifier<T extends SourceType> = { prototype: T; name: string }; //AbstractNewable<T>;\nexport type ServiceImplementation<T extends SourceType> = Newable<T>;\nexport type ServiceRegistration<T extends SourceType> = ServiceIdentifier<T> | ServiceImplementation<T>;\n\nexport type InstanceFactory<T extends SourceType> = (x: IResolutionScope) => T;\n\nexport type ServiceModuleType = Newable<IServiceModule>;\n\nexport type ServiceDescriptor<T extends SourceType> = {\n readonly implementation: ServiceRegistration<T>;\n lifetime: Lifetime;\n createInstance(context: IResolutionScope): T;\n};\n\nexport type MetadataType<T extends SourceType> = Record<string | symbol, ServiceIdentifier<T>>;\n\nexport type ServiceCollectionOptions = {\n /**\n * Whether calling `resolve` when there are multiple registrations\n * will result in an error or resolve the last registered service.\n * @default ResolveMultipleMode.Error\n */\n registrationMode: ResolveMultipleMode;\n /**\n * The default log level for the console logger.\n * @defaultValue {@link LogLevel.Warn}\n */\n logLevel: LogLevel;\n /**\n * Custom implementation for logger. Ignores log level.\n * @defaultValue {@link ConsoleLogger}\n */\n logger?: ILogger;\n};\n\nexport type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;\n\nexport type EnsureObject<T> = T extends object ? T : never;\n\nexport type ServiceBuilderOptions<T extends SourceType> = {\n (implementation: ServiceImplementation<T>): ILifetimeBuilder;\n (implementation: ServiceIdentifier<T>, factory: InstanceFactory<T>): ILifetimeBuilder;\n};\n\nexport type RegistrationMap<T extends SourceType = any> = Map<ServiceRegistration<T>, T>;\nexport type DescriptorMap<T extends SourceType = any> = Map<ServiceIdentifier<T>, ServiceDescriptor<T>[]>;\n\nexport const createRegistrationMap = <T extends SourceType = any>(): RegistrationMap<T> => {\n return new Map<ServiceRegistration<T>, T>();\n};\n\nexport const createDescriptorMap = <T extends SourceType = any>(): DescriptorMap<T> => {\n return new Map<ServiceIdentifier<T>, ServiceDescriptor<T>[]>();\n};\n","import { Lifetime } from '../enums';\nimport { InvalidImplementationError, ScopedSingletonRegistrationError } from '../errors';\nimport type { ILifetimeBuilder, IServiceBuilder } from '../interfaces';\nimport type { InstanceFactory, ServiceDescriptor, ServiceIdentifier, ServiceImplementation, ServiceRegistration, SourceType } from '../types';\n\nexport class ServiceBuilder<T extends SourceType> implements IServiceBuilder<T> {\n private descriptor: ServiceDescriptor<T> | undefined;\n\n constructor(\n private readonly identifiers: ServiceIdentifier<T>[],\n private readonly isScoped: boolean,\n private readonly addService: (identifier: ServiceIdentifier<T>, descriptor: ServiceDescriptor<T>) => void,\n ) {}\n\n public to(implementation: ServiceImplementation<T>): ILifetimeBuilder;\n public to(implementation: ServiceIdentifier<T>, factory?: InstanceFactory<T>): ILifetimeBuilder;\n public to(implementation: ServiceRegistration<T>, factory?: InstanceFactory<T> | undefined): ILifetimeBuilder {\n if (implementation == null) {\n throw new InvalidImplementationError<T>(this.identifiers[0]);\n }\n\n this.descriptor = this.createDescriptor(factory, implementation);\n\n for (const identifier of this.identifiers) {\n this.addService(identifier, this.descriptor);\n }\n return this;\n }\n\n private createDescriptor(factory: InstanceFactory<T> | undefined, implementation: ServiceRegistration<T>): ServiceDescriptor<T> {\n return {\n implementation,\n lifetime: Lifetime.Resolve,\n createInstance: factory ?? (() => new (implementation as ServiceImplementation<T>)()),\n };\n }\n\n public singleton(): this {\n if (this.isScoped) {\n throw new ScopedSingletonRegistrationError();\n }\n this.ensureDescriptor().lifetime = Lifetime.Singleton;\n return this;\n }\n\n public scoped(): this {\n this.ensureDescriptor().lifetime = Lifetime.Scoped;\n return this;\n }\n\n public transient(): this {\n this.ensureDescriptor().lifetime = Lifetime.Transient;\n return this;\n }\n\n private ensureDescriptor(): ServiceDescriptor<T> {\n if (!this.descriptor) {\n throw new Error('Must call to() before setting lifetime');\n }\n return this.descriptor;\n }\n}\n","import type { Lifetime } from './enums';\nimport { ResolveMultipleMode } from './enums';\nimport type { EnsureObject, ServiceBuilderOptions, ServiceCollectionOptions, ServiceDescriptor, ServiceIdentifier, ServiceModuleType, SourceType, UnionToIntersection } from './types';\n\nexport abstract class IDisposable {\n public abstract [Symbol.dispose](): void;\n}\n\nexport abstract class IServiceModule {\n public abstract registerServices(services: IServiceCollection): void;\n}\n\nexport abstract class IResolutionScope {\n /**\n * Resolves a single implementation for the given identifier.\n * @template T The type of service to resolve\n * @param identifier The service identifier\n * @returns The resolved instance\n * @throws {MultipleRegistrationError} When multiple implementations exist (unless {@link ServiceCollectionOptions.registrationMode} is set to {@link ResolveMultipleMode.LastRegistered}).\n * @throws {UnregisteredServiceError} When no implementation exists\n */\n public abstract resolve<T extends SourceType>(identifier: ServiceIdentifier<T>): T;\n\n /**\n * Resolves all implementations for the given identifier.\n * @template T The type of service to resolve\n * @param identifier The service identifier\n * @returns Array of resolved instances\n */\n public abstract resolveAll<T extends SourceType>(identifier: ServiceIdentifier<T>): T[];\n}\n\nexport abstract class IScopedProvider extends IResolutionScope implements IDisposable {\n public abstract readonly Services: IServiceCollection;\n public abstract [Symbol.dispose](): void;\n}\n\nexport abstract class IServiceProvider extends IResolutionScope implements IDisposable {\n public abstract readonly Services: IServiceCollection;\n public abstract createScope(): IScopedProvider;\n public abstract [Symbol.dispose](): void;\n}\n\nexport abstract class IServiceCollection {\n public abstract readonly options: ServiceCollectionOptions;\n public abstract get<T extends SourceType>(identifier: ServiceIdentifier<T>): ServiceDescriptor<T>[];\n /**\n * Registers one or more service identifiers with the service collection.\n * @param identifiers One or more service identifiers to register\n * @returns A service builder to configure the implementation and lifetime\n * @throws {InvalidServiceIdentifierError} When any identifier is null or undefined\n */\n public abstract register<Types extends [SourceType, ...SourceType[]]>(...identifiers: { [K in keyof Types]: ServiceIdentifier<Types[K]> }): IServiceBuilder<EnsureObject<UnionToIntersection<Types[number]>>>;\n public abstract registerModules(...modules: ServiceModuleType[]): void;\n public abstract overrideLifetime<T extends SourceType>(identifier: ServiceIdentifier<T>, lifetime: Lifetime): void;\n public abstract buildProvider(): IServiceProvider;\n public abstract clone(): IServiceCollection;\n public abstract clone(scoped: true): IServiceCollection;\n}\n\nexport abstract class ILifetimeBuilder {\n public abstract singleton(): ILifetimeBuilder;\n public abstract scoped(): ILifetimeBuilder;\n public abstract transient(): ILifetimeBuilder;\n}\n\nexport abstract class IServiceBuilder<T extends SourceType> {\n public abstract to: ServiceBuilderOptions<T>;\n}\n","export const DesignDependenciesKey = 'design:dependencies';\n","import '@abraham/reflection';\nimport type { MetadataType, SourceType } from '../types';\n\nexport const getMetadata = <T extends SourceType>(key: string, obj: object): MetadataType<T> | undefined => Reflect.getMetadata(key, obj);\nexport const defineMetadata = <T extends SourceType>(key: string, metadata: MetadataType<T>, obj: object) => Reflect.defineMetadata(key, metadata, obj);\n","import { Lifetime } from '../enums';\nimport { createRegistrationMap, type RegistrationMap, type ServiceIdentifier, type ServiceRegistration, type SourceType } from '../types';\n\nexport class ResolutionContext {\n constructor(\n private readonly singletons: RegistrationMap,\n private readonly scoped: RegistrationMap,\n public readonly targetIdentifier?: ServiceIdentifier<any>,\n ) {}\n\n private readonly transient: RegistrationMap = createRegistrationMap();\n private readonly resolving = new Set<ServiceRegistration<SourceType>>();\n\n public markResolving<T extends SourceType>(implementation: ServiceRegistration<T>): boolean {\n if (this.resolving.has(implementation)) {\n return false;\n }\n this.resolving.add(implementation);\n return true;\n }\n\n public unmarkResolving<T extends SourceType>(implementation: ServiceRegistration<T>): void {\n this.resolving.delete(implementation);\n }\n\n public getFromLifetime<T extends SourceType>(implementation: ServiceRegistration<T>, lifetime: Lifetime): T | null {\n const map = this.getMapForLifetime(lifetime);\n return map?.get(implementation);\n }\n\n public setForLifetime<T extends SourceType>(implementation: ServiceRegistration<T>, instance: T, lifetime: Lifetime): void {\n const map = this.getMapForLifetime(lifetime);\n map?.set(implementation, instance);\n }\n\n private getMapForLifetime(lifetime: Lifetime) {\n const map: Partial<Record<Lifetime, RegistrationMap>> = {\n [Lifetime.Singleton]: this.singletons,\n [Lifetime.Scoped]: this.scoped,\n [Lifetime.Resolve]: this.transient,\n };\n return map[lifetime];\n }\n}\n","import { Lifetime, ResolveMultipleMode } from '../enums';\nimport { CircularDependencyError, MultipleRegistrationError, SelfDependencyError, ServiceCreationError, UnregisteredServiceError } from '../errors';\nimport { type IDisposable, IResolutionScope, IScopedProvider, type IServiceCollection, IServiceProvider } from '../interfaces';\nimport type { ILogger } from '../logger';\nimport { createRegistrationMap, type RegistrationMap, type ServiceDescriptor, type ServiceIdentifier, type ServiceImplementation, type ServiceRegistration, type SourceType } from '../types';\nimport { DesignDependenciesKey } from './constants';\nimport { getMetadata } from './metadata';\nimport { ResolutionContext } from './ResolutionContext';\n\nexport class ServiceProvider implements IServiceProvider, IScopedProvider {\n private scoped = createRegistrationMap();\n private created: IDisposable[] = [];\n\n private constructor(\n private readonly logger: ILogger,\n public readonly Services: IServiceCollection,\n private readonly singletons: RegistrationMap<any>,\n private readonly singletonDisposables: IDisposable[],\n private readonly isRoot: boolean,\n ) {}\n\n public static createRoot(logger: ILogger, services: IServiceCollection): IServiceProvider {\n return new ServiceProvider(logger, services, createRegistrationMap(), [], true);\n }\n\n [Symbol.dispose]() {\n for (const x of this.created) {\n x[Symbol.dispose]();\n }\n if (this.isRoot) {\n for (const x of this.singletonDisposables) {\n x[Symbol.dispose]();\n }\n }\n }\n\n private resolveInternal<T extends SourceType>(descriptor: ServiceDescriptor<T>, context: ResolutionContext, serviceIdentifier?: ServiceIdentifier<T>): T {\n const existing = context.getFromLifetime(descriptor.implementation, descriptor.lifetime);\n if (existing != null) {\n return existing;\n }\n const identifier = serviceIdentifier || descriptor.implementation;\n if (!context.markResolving(descriptor.implementation)) {\n throw new CircularDependencyError(identifier);\n }\n try {\n return this.createInstance(descriptor, context, serviceIdentifier);\n } finally {\n context.unmarkResolving(descriptor.implementation);\n }\n }\n\n public resolveAll<T extends SourceType>(identifier: ServiceIdentifier<T>, context?: ResolutionContext): T[] {\n const descriptors = this.Services.get(identifier);\n const resolveContext = context ?? new ResolutionContext(this.singletons, this.scoped, identifier);\n return descriptors.map((descriptor) => this.resolveInternal<T>(descriptor, resolveContext, identifier));\n }\n\n public resolve<T extends SourceType>(identifier: ServiceIdentifier<T>, context?: ResolutionContext): T {\n if (identifier.prototype === IResolutionScope.prototype || identifier.prototype === IScopedProvider.prototype || identifier.prototype === IServiceProvider.prototype) {\n return this as IResolutionScope & IScopedProvider & IServiceProvider as T;\n }\n\n const descriptor = this.getSingleDescriptor(identifier);\n const resolveContext = context ?? new ResolutionContext(this.singletons, this.scoped, identifier);\n try {\n return this.resolveInternal(descriptor, resolveContext, identifier);\n } catch (err) {\n throw this.wrapDependencyResolutionError(err, identifier, descriptor, resolveContext);\n }\n }\n\n private wrapDependencyResolutionError<T extends SourceType>(err: unknown, requestedIdentifier: ServiceIdentifier<T>, descriptor: ServiceDescriptor<T>, context: ResolutionContext): never {\n if (err instanceof ServiceCreationError && err.identifier !== requestedIdentifier) {\n throw new ServiceCreationError(requestedIdentifier, err, descriptor.implementation);\n }\n throw err;\n }\n\n private getSingleDescriptor<T extends SourceType>(identifier: ServiceIdentifier<T>) {\n const descriptors = this.Services.get(identifier);\n if (descriptors.length === 0) {\n throw new UnregisteredServiceError(identifier);\n }\n\n if (descriptors.length > 1) {\n if (this.Services.options.registrationMode === ResolveMultipleMode.Error) {\n throw new MultipleRegistrationError(identifier);\n }\n }\n const descriptor = descriptors[descriptors.length - 1];\n return descriptor;\n }\n\n private createInstance<T extends SourceType>(descriptor: ServiceDescriptor<T>, context: ResolutionContext, serviceIdentifier?: ServiceIdentifier<T>): T {\n const instance = this.createInstanceInternal(descriptor, context, serviceIdentifier);\n this.setDependencies(descriptor.implementation, instance, context, serviceIdentifier);\n context.setForLifetime(descriptor.implementation, instance, descriptor.lifetime);\n return instance;\n }\n\n private wrapContext(context: ResolutionContext): IResolutionScope {\n const resolve = (identifier: ServiceIdentifier<any>) => this.resolve(identifier, context);\n const resolveAll = (identifier: ServiceIdentifier<any>) => this.resolveAll(identifier, context);\n\n return {\n resolve,\n resolveAll,\n };\n }\n\n private createInstanceInternal<T extends SourceType>(descriptor: ServiceDescriptor<T>, context: ResolutionContext, serviceIdentifier?: ServiceIdentifier<T>) {\n let instance: T | undefined;\n try {\n instance = descriptor.createInstance(this.wrapContext(context));\n } catch (err) {\n this.logger.error(err);\n const identifier = serviceIdentifier || descriptor.implementation;\n if (err instanceof Error) {\n throw new ServiceCreationError(identifier, err, descriptor.implementation);\n }\n throw new ServiceCreationError(identifier, undefined, descriptor.implementation);\n }\n if (Symbol.dispose in instance) {\n if (descriptor.lifetime === Lifetime.Singleton) {\n this.singletonDisposables.push(instance as IDisposable);\n } else {\n this.created.push(instance as IDisposable);\n }\n }\n return instance;\n }\n\n public createScope(): IScopedProvider {\n return new ServiceProvider(this.logger, this.Services.clone(true), this.singletons, this.singletonDisposables, false);\n }\n\n private setDependencies<T extends SourceType>(implementation: ServiceRegistration<T>, instance: T, context: ResolutionContext, serviceIdentifier?: ServiceIdentifier<T>): T {\n const dependencies = getMetadata<T>(DesignDependenciesKey, implementation) ?? {};\n this.logger.debug('Dependencies', implementation.name, dependencies);\n for (const [key, identifier] of Object.entries(dependencies)) {\n if (identifier === serviceIdentifier) {\n throw new SelfDependencyError();\n }\n this.logger.debug('Resolving', identifier.name, 'for', implementation.name);\n const dep = this.resolve(identifier, context);\n (instance as Record<string, T>)[key] = dep;\n }\n return instance;\n }\n}\n","import type { Lifetime } from '../enums';\nimport { InvalidServiceIdentifierError } from '../errors';\nimport type { IServiceBuilder, IServiceCollection, IServiceProvider } from '../interfaces';\nimport type { ILogger } from '../logger';\nimport { createDescriptorMap, type DescriptorMap, type EnsureObject, type ServiceCollectionOptions, type ServiceDescriptor, type ServiceIdentifier, type ServiceModuleType, type SourceType, type UnionToIntersection } from '../types';\nimport { ServiceBuilder } from './ServiceBuilder';\nimport { ServiceProvider } from './ServiceProvider';\n\nexport class ServiceCollection implements IServiceCollection {\n constructor(\n private readonly logger: ILogger,\n public readonly options: ServiceCollectionOptions,\n private readonly isScoped: boolean,\n private readonly services = createDescriptorMap(),\n ) {}\n\n public registerModules(...modules: ServiceModuleType[]): void {\n for (const x of modules) {\n const module = new x();\n module.registerServices(this);\n }\n }\n\n get<T extends SourceType>(key: ServiceIdentifier<T>): ServiceDescriptor<T>[] {\n return this.services.get(key) ?? [];\n }\n\n public overrideLifetime<T extends SourceType>(identifier: ServiceIdentifier<T>, lifetime: Lifetime): void {\n for (const descriptor of this.get(identifier)) {\n descriptor.lifetime = lifetime;\n }\n }\n\n register<Types extends [SourceType, ...SourceType[]]>(...identifiers: { [K in keyof Types]: ServiceIdentifier<Types[K]> }): IServiceBuilder<EnsureObject<UnionToIntersection<Types[number]>>> {\n if (identifiers.length === 0 || identifiers.some((id) => id == null)) {\n throw new InvalidServiceIdentifierError();\n }\n\n return new ServiceBuilder(identifiers, this.isScoped, (identifier, descriptor) => this.addService(identifier, descriptor));\n }\n\n private addService<T extends SourceType>(identifier: ServiceIdentifier<T>, descriptor: ServiceDescriptor<T>) {\n this.logger.info('Adding service', { identifier: identifier.name, descriptor });\n let existing = this.services.get(identifier);\n if (existing == null) {\n existing = [];\n this.services.set(identifier, existing);\n }\n existing.push(descriptor);\n }\n\n public clone(scoped?: unknown): IServiceCollection {\n const clonedMap: DescriptorMap = createDescriptorMap();\n for (const [key, descriptors] of this.services) {\n const clonedDescriptors = descriptors.map((descriptor) => ({ ...descriptor }));\n clonedMap.set(key, clonedDescriptors);\n }\n\n return new ServiceCollection(this.logger, this.options, scoped === true, clonedMap);\n }\n\n public buildProvider(): IServiceProvider {\n return ServiceProvider.createRoot(this.logger, this.clone());\n }\n}\n","import { DefaultServiceCollectionOptions } from './defaults';\nimport type { IServiceCollection } from './interfaces';\nimport { ConsoleLogger } from './private/consoleLogger';\nimport { ServiceCollection } from './private/ServiceCollection';\nimport type { ServiceCollectionOptions } from './types';\n\nconst mergeOptions = (options: Partial<ServiceCollectionOptions> | undefined): ServiceCollectionOptions => ({\n ...DefaultServiceCollectionOptions,\n ...options,\n});\n\n/**\n * Creates a service collection with the (optionally) provided options\n * @param options - Optional configuration for the service collection.\n * @defaultValue Default options are taken from {@link DefaultServiceCollectionOptions}.\n */\nexport const createServiceCollection = (options?: Partial<ServiceCollectionOptions>): IServiceCollection => {\n const mergedOptions = mergeOptions(options);\n const logger = mergedOptions.logger ?? new ConsoleLogger(mergedOptions);\n return new ServiceCollection(logger, mergedOptions, false);\n};\n","import { IResolutionScope, IScopedProvider, IServiceProvider } from './interfaces';\nimport { DesignDependenciesKey } from './private/constants';\nimport { defineMetadata, getMetadata } from './private/metadata';\nimport type { ServiceIdentifier, SourceType } from './types';\n\nconst tagProperty = <T extends SourceType>(metadataKey: string, annotationTarget: object, name: string | symbol, identifier: ServiceIdentifier<T>) => {\n let existing = getMetadata<T>(metadataKey, annotationTarget);\n if (existing === undefined) {\n existing = {};\n defineMetadata(metadataKey, existing, annotationTarget);\n }\n existing[name] = identifier;\n};\n\n/**\n * declares a dependency, use on a class field.\n * Can also depend on {@link IServiceProvider}, {@link IResolutionScope}, or {@link IScopedProvider}.\n * @param identifier the identifier to depend on, i.e. the interface\n */\nexport const dependsOn = <T extends SourceType>(identifier: ServiceIdentifier<T>) => {\n return (value: undefined, ctx: ClassFieldDecoratorContext) => {\n return function (this: object, initialValue: any) {\n const target = this.constructor;\n tagProperty(DesignDependenciesKey, target, ctx.name, identifier);\n return initialValue;\n };\n };\n};\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shellicar/core-di",
3
3
  "private": false,
4
- "version": "3.1.4",
4
+ "version": "3.1.6",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": "Stephen Hellicar",
@@ -44,9 +44,9 @@
44
44
  "devDependencies": {
45
45
  "@abraham/reflection": "^0.13.0",
46
46
  "@js-joda/core": "^5.7.0",
47
- "@shellicar/build-clean": "^1.2.2",
47
+ "@shellicar/build-clean": "^1.2.3",
48
48
  "@tsconfig/node20": "^20.1.9",
49
- "@types/node": "^25.2.2",
49
+ "@types/node": "^25.3.2",
50
50
  "@vitest/coverage-v8": "^4.0.18",
51
51
  "terser": "^5.46.0",
52
52
  "tsup": "^8.5.1",