@shellicar/core-di 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +64 -2
- package/dist/index.d.mts +64 -2
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,6 +64,17 @@ using scope = provider.createScope();
|
|
|
64
64
|
using scope = provider.createScope();
|
|
65
65
|
scope.Services.register(IContext).to(Context);
|
|
66
66
|
```
|
|
67
|
+
* Override registrations (e.g.: for testing)
|
|
68
|
+
```ts
|
|
69
|
+
import { ok } from 'node:assert/strict';
|
|
70
|
+
const services = createServiceCollection({ registrationMode: ResolveMultipleMode.LastRegistered });
|
|
71
|
+
services.register(IOptions).to(Options);
|
|
72
|
+
// Later
|
|
73
|
+
services.register(IOptions).to(MockOptions);
|
|
74
|
+
const provider = services.buildProvider();
|
|
75
|
+
const options = provider.resolve(IOptions);
|
|
76
|
+
ok(options instanceof MockOptions);
|
|
77
|
+
```
|
|
67
78
|
|
|
68
79
|
## Usage
|
|
69
80
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Q=Object.defineProperty;var r=(s,e)=>Q(s,"name",{value:e,configurable:!0});require("@abraham/reflection");var U=Object.defineProperty,W=r((s,e,t)=>e in s?U(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"__defNormalProp$2"),X=r((s,e,t)=>W(s,e+"",t),"__publicField$2");const A=class A{constructor(){X(this,"debugging",!1)}enable(){this.debugging=!0}disable(){this.debugging=!1}log(e,...t){this.debugging&&console.log(e,...t)}};r(A,"DebugLogger");let R=A;const d=new R,y=d.log.bind(d),Y=d.enable.bind(d),Z=d.disable.bind(d);var l=(s=>(s.Resolve="RESOLVE",s.Transient="TRANSIENT",s.Scoped="SCOPED",s.Singleton="SINGLETON",s))(l||{});const B="design:dependencies",T=class T{};r(T,"IDisposable");let $=T;const _=class _{};r(_,"IServiceModule");let x=_;const F=class F{};r(F,"IServiceScope");let h=F;const I=class I extends h{};r(I,"IServiceProvider");let g=I;const C=class C{};r(C,"IServiceCollection");let D=C;const H=r((s,e)=>{if(Reflect.getMetadata===void 0)throw new Error('Please import "reflect-metadata"');const t=Reflect.getMetadata(s,e);if(t!==void 0)return t},"getMetadata"),L=r((s,e,t)=>{if(Reflect.defineMetadata===void 0)throw new Error('Please import "reflect-metadata"');Reflect.defineMetadata(s,e,t)},"defineMetadata"),N={Error:"ERROR",LastRegistered:"LAST_REGISTERED"},J={registrationMode:N.Error};var k=Object.defineProperty,ee=r((s,e,t)=>e in s?k(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"__defNormalProp$1"),v=r((s,e,t)=>ee(s,e+"",t),"__publicField$1");const j=class j extends Error{constructor(e){super(e)}};r(j,"ServiceError");let a=j;const G=class G extends a{constructor(e){super(`Resolving service that has not been registered: ${e}`),v(this,"name","UnregisteredServiceError"),Object.setPrototypeOf(this,new.target.prototype)}};r(G,"UnregisteredServiceError");let f=G;const q=class q extends a{constructor(e){super(`Multiple services have been registered: ${e}`),v(this,"name","MultipleRegistrationError"),Object.setPrototypeOf(this,new.target.prototype)}};r(q,"MultipleRegistrationError");let m=q;const V=class V extends a{constructor(e,t){super(`Error creating service: ${e}`),this.innerError=t,v(this,"name","ServiceCreationError"),Object.setPrototypeOf(this,new.target.prototype)}};r(V,"ServiceCreationError");let b=V;const z=class z extends a{constructor(){super("Service depending on itself"),v(this,"name","SelfDependencyError"),Object.setPrototypeOf(this,new.target.prototype)}};r(z,"SelfDependencyError");let w=z;var te=Object.defineProperty,se=r((s,e,t)=>e in s?te(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"__defNormalProp"),K=r((s,e,t)=>se(s,typeof e!="symbol"?e+"":e,t),"__publicField");const S=r(()=>new Map,"createResolveMap"),E=class E{constructor(e,t=S()){this.services=e,this.singletons=t,K(this,"scoped",S()),K(this,"created",[])}get Services(){return this.services}[Symbol.dispose](){this.created.forEach(e=>e[Symbol.dispose]())}resolveFrom(e,t,n,o){let i=n.get(e);i===void 0&&(i=new Map,n.set(e,i));let c=i.get(t.implementation);return c===void 0&&(c=this.createInstance(t,o),i.set(t.implementation,c),this.setDependencies(t.implementation,c,o)),c}resolveInternal(e,t,n){const i={[l.Singleton]:this.singletons,[l.Scoped]:this.scoped,[l.Resolve]:n}[t.lifetime];if(i===void 0){const c=this.createInstance(t,n);return this.setDependencies(t.implementation,c,n),c}return this.resolveFrom(e,t,i,n)}resolveAll(e,t=S()){return this.services.get(e).map(o=>this.resolveInternal(e,o,t))}resolve(e,t=S()){if(e.prototype===h.prototype||e.prototype===g.prototype)return this;const n=this.services.get(e);if(n.length===0)throw new f(e);if(n.length>1&&this.Services.options.registrationMode===N.Error)throw new m(e);const o=n[n.length-1];return this.resolveInternal(e,o,t)}createInstance(e,t){let n;if("factory"in e){const o=e.factory,i=r(u=>this.resolve(u,t),"resolve"),c=r(u=>this.resolveAll(u,t),"resolveAll"),p=this.createScope.bind(this);n=o({resolve:i,resolveAll:c,createScope:p,get Services(){return this.Services}})}else try{n=new e.implementation}catch(o){throw new b(e.implementation,o)}return e.lifetime!==l.Singleton&&Symbol.dispose in n&&this.created.push(n),n}createScope(){return new E(this.services.clone(),this.singletons)}setDependencies(e,t,n){var o;const i=(o=H(B,e))!=null?o:{};y("Dependencies",e.name,i);for(const[c,p]of Object.entries(i))if(p!==e){y("Resolving",p,"for",e.name);const u=this.resolve(p,n);t[c]=u}else throw new w;return t}};r(E,"ServiceProvider");let O=E;const P=class P{constructor(e,t=new Map){this.options=e,this.services=t}registerModules(e){e.forEach(t=>{new t().registerServices(this)})}get(e){var t;return(t=this.services.get(e))!=null?t:[]}register(e){return{to:r((t,n)=>{const o=n===void 0?{implementation:t,lifetime:l.Resolve}:{implementation:t,factory:n,lifetime:l.Resolve};this.addService(e,o);const i={singleton:r(()=>(o.lifetime=l.Singleton,i),"singleton"),scoped:r(()=>(o.lifetime=l.Scoped,i),"scoped"),transient:r(()=>(o.lifetime=l.Transient,i),"transient")};return i},"to")}}addService(e,t){y("Adding service",{identifier:e,descriptor:t});let n=this.services.get(e);n==null&&(n=[],this.services.set(e,n)),n.push(t)}clone(){const e=new Map;for(const[t,n]of this.services){const o=n.map(i=>({...i}));e.set(t,o)}return new P(this.options,e)}buildProvider(){const e=this.clone();return new O(e)}};r(P,"ServiceCollection");let M=P;const ne=r(s=>({...J,...s}),"mergeOptions"),re=r(s=>new M(ne(s)),"createServiceCollection"),oe=r((s,e,t,n)=>{let o=H(s,e);o===void 0&&(o={},L(s,o,e)),o[t]=n},"tagProperty"),ie=r(s=>(e,t)=>function(n){const o=this.constructor;return oe(B,o,t.name,s),n},"dependsOn");exports.DefaultServiceCollectionOptions=J,exports.IDisposable=$,exports.IServiceCollection=D,exports.IServiceModule=x,exports.IServiceProvider=g,exports.IServiceScope=h,exports.MultipleRegistrationError=m,exports.ResolveMultipleMode=N,exports.SelfDependencyError=w,exports.ServiceCollection=M,exports.ServiceCreationError=b,exports.ServiceError=a,exports.ServiceProvider=O,exports.UnregisteredServiceError=f,exports.createServiceCollection=re,exports.dependsOn=ie,exports.disable=Z,exports.enable=Y;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/debug.ts","../src/constants.ts","../src/interfaces.ts","../src/metadata.ts","../src/errors.ts","../src/ServiceProvider.ts","../src/ServiceCollection.ts","../src/createServiceCollection.ts","../src/dependsOn.ts"],"sourcesContent":["\nclass DebugLogger {\n private debugging = false;\n\n public enable() { this.debugging = true; }\n public disable() { this.debugging = false; }\n public log(message?: string, ...optionalParams: unknown[]) {\n if(this.debugging) {\n console.log(message, ...optionalParams);\n }\n }\n}\n\nconst logger = new DebugLogger();\n\nexport const log = logger.log.bind(logger);\nexport const enable = logger.enable.bind(logger);\nexport const disable = logger.disable.bind(logger);\n","export enum Lifetime {\n Resolve = 'RESOLVE',\n Transient = 'TRANSIENT',\n Scoped = 'SCOPED',\n Singleton = 'SINGLETON',\n}\n\nexport const DesignDependenciesKey = 'design:dependencies';\n","import type { SourceType, ServiceBuilder, ServiceDescriptor, ServiceIdentifier, ServiceModuleType } 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 IServiceScope {\n public abstract resolve<T extends SourceType>(identifier: ServiceIdentifier<T>): T;\n public abstract resolveAll<T extends SourceType>(identifier: ServiceIdentifier<T>): T[];\n}\n\nexport abstract class IServiceProvider extends IServiceScope {\n public abstract get Services(): IServiceCollection;\n public abstract createScope(): IServiceProvider & IDisposable;\n}\n\nexport abstract class IServiceCollection {\n public abstract get<T extends SourceType>(key: ServiceIdentifier<T>): ServiceDescriptor<T>[];\n public abstract register<T extends SourceType>(identifier: ServiceIdentifier<T>): ServiceBuilder<T>;\n public abstract registerModules(modules: ServiceModuleType[]): void;\n public abstract buildProvider(): IServiceProvider;\n public abstract clone(): IServiceCollection;\n}\n","import '@abraham/reflection';\nimport type { MetadataType, SourceType } from './types';\n\nexport const getMetadata = <T extends SourceType>(key: string, obj: object): MetadataType<T> | undefined => {\n if (Reflect.getMetadata === undefined) {\n throw new Error('Please import \"reflect-metadata\"');\n }\n const result = Reflect.getMetadata(key, obj);\n if (result === undefined) {\n return undefined;\n }\n return result as MetadataType<T>;\n};\n\nexport const defineMetadata = <T extends SourceType>(key: string, metadata: MetadataType<T>, obj: object) => {\n if (Reflect.defineMetadata === undefined) {\n throw new Error('Please import \"reflect-metadata\"');\n }\n Reflect.defineMetadata(key, metadata, obj);\n};\n","import type { ServiceIdentifier } from './types';\n\nexport class UnregisteredServiceError<T extends object> extends Error {\n name = 'UnregisteredServiceError';\n constructor(identifier: ServiceIdentifier<T>) {\n super(`Resolving service that has not been registered: ${identifier}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class MultipleRegistrationError<T extends object> extends Error {\n name = 'MultipleRegistrationError';\n constructor(identifier: ServiceIdentifier<T>) {\n super(`Multiple services have been registered: ${identifier}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class SelfDependencyError extends Error {\n name = 'SelfDependencyError';\n constructor() {\n super('Service depending on itself');\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n","import { log } from './debug';\nimport { DesignDependenciesKey, Lifetime } from './constants';\nimport type { IDisposable, IServiceCollection} from './interfaces';\nimport { IServiceScope, IServiceProvider} from './interfaces';\nimport { getMetadata } from './metadata';\nimport type { ServiceIdentifier, ServiceDescriptor, ServiceImplementation, SourceType } from './types';\nimport { SelfDependencyError, MultipleRegistrationError, UnregisteredServiceError } from './errors';\n\ntype Id<T extends SourceType> = ServiceIdentifier<T> | ServiceImplementation<T>;\n\ntype ResolveMap<T extends SourceType> = Map<ServiceIdentifier<T>, Map<Id<T>, T>>;\n\nconst createResolveMap = <T extends SourceType>(): ResolveMap<T> => new Map<ServiceIdentifier<T>, Map<ServiceImplementation<T>, T>>();\n\nexport class ServiceProvider implements IServiceProvider, IServiceScope {\n private scoped = createResolveMap();\n private created: IDisposable[] = [];\n\n constructor(\n private services: IServiceCollection,\n private singletons = createResolveMap(),\n ) {}\n \n public get Services(): IServiceCollection {\n return this.services;\n }\n\n [Symbol.dispose]() {\n this.created.forEach(x => x[Symbol.dispose]());\n }\n\n private resolveFrom<T extends SourceType>(\n identifier: ServiceIdentifier<T>,\n descriptor: ServiceDescriptor<T>,\n lifetimeMap: ResolveMap<T>,\n currentResolve: ResolveMap<T>\n ): T {\n let resolvedInstances = lifetimeMap.get(identifier);\n if (resolvedInstances === undefined) {\n resolvedInstances = new Map();\n lifetimeMap.set(identifier, resolvedInstances);\n }\n\n let instance = resolvedInstances.get(descriptor.implementation);\n if (instance === undefined) {\n instance = this.createInstance(descriptor, currentResolve);\n resolvedInstances.set(descriptor.implementation, instance);\n this.setDependencies<T>(descriptor.implementation, instance, currentResolve);\n }\n return instance;\n }\n\n private resolveInternal<T extends SourceType>(\n identifier: ServiceIdentifier<T>,\n descriptor: ServiceDescriptor<T>,\n currentResolve: ResolveMap<T>,\n ): T {\n const mapping: Partial<Record<Lifetime, ResolveMap<any>>> = {\n [Lifetime.Singleton]: this.singletons,\n [Lifetime.Scoped]: this.scoped,\n [Lifetime.Resolve]: currentResolve,\n };\n const sourceMap = mapping[descriptor.lifetime];\n if (sourceMap === undefined) {\n const instance = this.createInstance(descriptor, currentResolve);\n this.setDependencies<T>(descriptor.implementation, instance, currentResolve);\n return instance;\n }\n return this.resolveFrom(identifier, descriptor, sourceMap, currentResolve);\n }\n\n public resolveAll<T extends SourceType>(\n identifier: ServiceIdentifier<T>,\n currentResolve = createResolveMap<T>(),\n ): T[] {\n const descriptors = this.services.get(identifier);\n return descriptors.map(descriptor => this.resolveInternal<T>(identifier, descriptor, currentResolve));\n }\n\n public resolve<T extends SourceType>(\n identifier: ServiceIdentifier<T>,\n currentResolve = createResolveMap<T>(),\n ): T {\n if (identifier.prototype === IServiceScope.prototype || identifier.prototype === IServiceProvider.prototype) {\n return this as unknown as T;\n }\n\n const descriptors = this.services.get(identifier);\n if (descriptors.length === 0) {\n throw new UnregisteredServiceError(identifier);\n }\n if (descriptors.length > 1) {\n throw new MultipleRegistrationError(identifier);\n }\n\n const descriptor = descriptors[0];\n return this.resolveInternal(identifier, descriptor, currentResolve);\n }\n\n private createInstance<T extends SourceType>(descriptor: ServiceDescriptor<T>, currentResolve: ResolveMap<T>): T {\n let instance: T;\n if ('factory' in descriptor) {\n const factory = descriptor.factory;\n const resolve = (identifier: ServiceIdentifier<any>) => this.resolve(identifier, currentResolve);\n const resolveAll = (identifier: ServiceIdentifier<any>) => this.resolveAll(identifier, currentResolve);\n const createScope = this.createScope.bind(this);\n\n // proxy requests to keep current resolved types\n instance = factory({\n resolve,\n resolveAll,\n createScope,\n get Services() { return this.Services; },\n });\n }\n else {\n try {\n instance = new descriptor.implementation();\n }\n catch (err) {\n console.error(err, 'Error creating service', {\n descriptor,\n });\n throw err;\n }\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(): IServiceProvider & IDisposable {\n return new ServiceProvider(this.services.clone(), this.singletons);\n }\n\n private setDependencies<T extends SourceType>(\n type: Id<T>,\n instance: T,\n currentResolve: ResolveMap<T>,\n ): T {\n const dependencies = getMetadata<T>(DesignDependenciesKey, type) ?? {};\n log('Dependencies', type.name, dependencies);\n for (const [key, identifier] of Object.entries(dependencies)) {\n if (identifier !== type) {\n log('Resolving', identifier, 'for', type.name);\n const dep = this.resolve(identifier, currentResolve);\n (instance as Record<string, unknown>)[key] = dep;\n } else {\n throw new SelfDependencyError();\n }\n }\n return instance;\n }\n}\n","import { ServiceProvider } from './ServiceProvider';\nimport type { SourceType, InstanceFactory, ServiceBuilder, ServiceDescriptor, ServiceIdentifier, ServiceImplementation, Newable } from './types';\nimport type { IServiceCollection, IServiceModule, IServiceProvider } from './interfaces';\nimport { Lifetime } from './constants';\nimport { log } from './debug';\n\nexport class ServiceCollection implements IServiceCollection {\n constructor(private readonly services = new Map<ServiceIdentifier<any>, ServiceDescriptor<any>[]>()) {\n }\n \n public registerModules(modules: Newable<IServiceModule>[]): void {\n modules.forEach(x => {\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 register<T extends SourceType>(identifier: ServiceIdentifier<T>): ServiceBuilder<T> {\n return {\n // to: (implementation: ServiceImplementation<T>, func?: InstanceFactory<T>) => {\n to: (implementation: ServiceImplementation<T> | ServiceIdentifier<T>, factory?: InstanceFactory<T>) => {\n const descriptor: ServiceDescriptor<T>= (factory === undefined) ? { implementation: implementation as ServiceImplementation<T>, lifetime: Lifetime.Resolve } : { implementation, factory, lifetime: Lifetime.Resolve };\n this.addService(identifier, descriptor);\n const builder = {\n singleton: () => { descriptor.lifetime = Lifetime.Singleton; return builder; },\n scoped: () => { descriptor.lifetime = Lifetime.Scoped; return builder; },\n transient: () => { descriptor.lifetime = Lifetime.Transient; return builder; },\n };\n return builder;\n },\n };\n }\n\n private addService<T extends SourceType>(identifier: ServiceIdentifier<T>, descriptor: ServiceDescriptor<T>) {\n log('Adding service', { identifier, 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(): IServiceCollection {\n const clonedMap = new Map<ServiceIdentifier<any>, ServiceDescriptor<any>[]>();\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(clonedMap);\n }\n\n public buildProvider(): IServiceProvider {\n const cloned = this.clone(); \n return new ServiceProvider(cloned);\n }\n}\n","import type { IServiceCollection } from './interfaces';\nimport { ServiceCollection } from './ServiceCollection';\n\nexport const createServiceCollection = (): IServiceCollection => new ServiceCollection() as IServiceCollection;\n","import { DesignDependenciesKey } from './constants';\nimport type { ServiceIdentifier, SourceType } from './types';\nimport { defineMetadata, getMetadata } from './metadata';\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\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"],"names":["__defProp","__defNormalProp","__publicField"],"mappings":";;;;AACA,IAAIA,WAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAIC,iBAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAGD,WAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAIE,eAAa,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAKD,iBAAe,CAAC,GAAG,EAA4B,GAAG,GAAG,EAAE,CAAM,EAAE,KAAK,CAAC,CAAC;AAC/G,MAAM,WAAW,CAAC;AAClB,EAAE,WAAW,GAAG;AAChB,IAAIC,eAAa,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;AAC5C,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;AAC1B,GAAG;AACH,EAAE,OAAO,GAAG;AACZ,IAAI,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;AAC3B,GAAG;AACH,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,cAAc,EAAE;AAClC,IAAI,IAAI,IAAI,CAAC,SAAS,EAAE;AACxB,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,cAAc,CAAC,CAAC;AAC9C,KAAK;AACL,GAAG;AACH,CAAC;AACD,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;AAC1B,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC/B,MAAC,MAAM,GAAG,MAAM,CAAC,MAAM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,EAAE,CAAC;AAChC,IAAI,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;AACvC,GAAG;AACH;;AC7DY,MAAC,uBAAuB,GAAG,MAAM,IAAI,iBAAiB;;ACClE,MAAM,WAAW,GAAG,CAAC,WAAW,EAAE,gBAAgB,EAAE,IAAI,EAAE,UAAU,KAAK;AACzE,EAAE,IAAI,QAAQ,GAAG,WAAW,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;AAC5D,EAAE,IAAI,QAAQ,KAAK,KAAK,CAAC,EAAE;AAC3B,IAAI,QAAQ,GAAG,EAAE,CAAC;AAClB,IAAI,cAAc,CAAC,WAAW,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAC;AAC5D,GAAG;AACH,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC;AAC9B,CAAC,CAAC;AACU,MAAC,SAAS,GAAG,CAAC,UAAU,KAAK;AACzC,EAAE,OAAO,CAAC,KAAK,EAAE,GAAG,KAAK;AACzB,IAAI,OAAO,SAAS,YAAY,EAAE;AAClC,MAAM,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC;AACtC,MAAM,WAAW,CAAC,qBAAqB,EAAE,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;AACvE,MAAM,OAAO,YAAY,CAAC;AAC1B,KAAK,CAAC;AACN,GAAG,CAAC;AACJ;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/debug.ts","../src/constants.ts","../src/interfaces.ts","../src/metadata.ts","../src/types.ts","../src/errors.ts","../src/ServiceProvider.ts","../src/ServiceCollection.ts","../src/createServiceCollection.ts","../src/dependsOn.ts"],"sourcesContent":["// TODO: Allow configuration of logger in options\nclass DebugLogger {\n private debugging = false;\n\n public enable() { this.debugging = true; }\n public disable() { this.debugging = false; }\n public log(message?: string, ...optionalParams: unknown[]) {\n if(this.debugging) {\n console.log(message, ...optionalParams);\n }\n }\n}\n\nconst logger = new DebugLogger();\n\nexport const log = logger.log.bind(logger);\nexport const enable = logger.enable.bind(logger);\nexport const disable = logger.disable.bind(logger);\n","export enum Lifetime {\n Resolve = 'RESOLVE',\n Transient = 'TRANSIENT',\n Scoped = 'SCOPED',\n Singleton = 'SINGLETON',\n}\n\nexport const DesignDependenciesKey = 'design:dependencies';\n","import type { SourceType, ServiceBuilder, ServiceDescriptor, ServiceIdentifier, ServiceModuleType, ServiceCollectionOptions } 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 IServiceScope {\n public abstract resolve<T extends SourceType>(identifier: ServiceIdentifier<T>): T;\n public abstract resolveAll<T extends SourceType>(identifier: ServiceIdentifier<T>): T[];\n}\n\nexport abstract class IServiceProvider extends IServiceScope {\n public abstract get Services(): IServiceCollection;\n public abstract createScope(): IServiceProvider & IDisposable;\n}\n\nexport abstract class IServiceCollection {\n public abstract readonly options: ServiceCollectionOptions;\n public abstract get<T extends SourceType>(key: ServiceIdentifier<T>): ServiceDescriptor<T>[];\n public abstract register<T extends SourceType>(identifier: ServiceIdentifier<T>): ServiceBuilder<T>;\n public abstract registerModules(modules: ServiceModuleType[]): void;\n public abstract buildProvider(): IServiceProvider;\n public abstract clone(): IServiceCollection;\n}\n","import '@abraham/reflection';\nimport type { MetadataType, SourceType } from './types';\n\nexport const getMetadata = <T extends SourceType>(key: string, obj: object): MetadataType<T> | undefined => {\n if (Reflect.getMetadata === undefined) {\n throw new Error('Please import \"reflect-metadata\"');\n }\n const result = Reflect.getMetadata(key, obj);\n if (result === undefined) {\n return undefined;\n }\n return result as MetadataType<T>;\n};\n\nexport const defineMetadata = <T extends SourceType>(key: string, metadata: MetadataType<T>, obj: object) => {\n if (Reflect.defineMetadata === undefined) {\n throw new Error('Please import \"reflect-metadata\"');\n }\n Reflect.defineMetadata(key, metadata, obj);\n};\n","import type { Lifetime } from './constants';\nimport type { IServiceModule, IServiceProvider, IServiceScope } from './interfaces';\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>;\n\nexport type InstanceFactory<T extends SourceType> = (x: IServiceScope & IServiceProvider) => T;\n\nexport type ServiceModuleType = Newable<IServiceModule>;\n\nexport type ServiceDescriptorFactory<T extends SourceType> = {\n implementation: ServiceIdentifier<T>;\n factory: InstanceFactory<T>;\n lifetime: Lifetime;\n};\nexport type ServiceDescriptorConcrete<T extends SourceType> = {\n implementation: ServiceImplementation<T>;\n lifetime: Lifetime;\n};\n\nexport type ServiceDescriptor<T extends SourceType> = ServiceDescriptorConcrete<T> | ServiceDescriptorFactory<T>;\n// export type ServiceDescriptor<T extends SourceType> = {\n// implementation: ServiceImplementation<T>;\n// factory?: InstanceFactory<T>;\n// lifetime: Lifetime;\n// };\n\nexport type LifetimeBuilder = {\n singleton: () => LifetimeBuilder;\n scoped: () => LifetimeBuilder;\n transient: () => LifetimeBuilder;\n};\nexport type ServiceBuilder<T extends SourceType> = {\n to: {\n (implementation: ServiceImplementation<T>): LifetimeBuilder;\n (implementation: ServiceIdentifier<T>, factory: InstanceFactory<T>): LifetimeBuilder;\n };\n};\n\nexport type MetadataType<T extends SourceType> = Record<string | symbol, ServiceIdentifier<T>>;\n\nexport const ResolveMultipleMode = {\n Error: 'ERROR',\n LastRegistered: 'LAST_REGISTERED',\n} as const;\nexport type ResolveMultipleMode = (typeof ResolveMultipleMode)[keyof typeof ResolveMultipleMode];\n\nexport const DefaultServiceCollectionOptions: ServiceCollectionOptions = {\n registrationMode: ResolveMultipleMode.Error,\n};\n\nexport type ServiceCollectionOptions = {\n registrationMode: ResolveMultipleMode;\n};\n","import type { ServiceIdentifier } from './types';\n\nexport abstract class ServiceError extends Error {\n constructor(message: string) {\n super(message);\n }\n}\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}`);\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}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class ServiceCreationError<T extends object> extends ServiceError {\n name = 'ServiceCreationError';\n constructor(identifier: ServiceIdentifier<T>, public readonly innerError: any) {\n super(`Error creating service: ${identifier}`);\n Object.setPrototypeOf(this, new.target.prototype);\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","import { log } from './debug';\nimport { DesignDependenciesKey, Lifetime } from './constants';\nimport type { IDisposable, IServiceCollection} from './interfaces';\nimport { IServiceScope, IServiceProvider} from './interfaces';\nimport { getMetadata } from './metadata';\nimport type { ServiceIdentifier, ServiceDescriptor, ServiceImplementation, SourceType} from './types';\nimport { ResolveMultipleMode } from './types';\nimport { SelfDependencyError, MultipleRegistrationError, UnregisteredServiceError, ServiceCreationError } from './errors';\n\ntype Id<T extends SourceType> = ServiceIdentifier<T> | ServiceImplementation<T>;\n\ntype ResolveMap<T extends SourceType> = Map<ServiceIdentifier<T>, Map<Id<T>, T>>;\n\nconst createResolveMap = <T extends SourceType>(): ResolveMap<T> => new Map<ServiceIdentifier<T>, Map<ServiceImplementation<T>, T>>();\n\nexport class ServiceProvider implements IServiceProvider, IServiceScope {\n private scoped = createResolveMap();\n private created: IDisposable[] = [];\n\n constructor(\n private services: IServiceCollection,\n private singletons = createResolveMap(),\n ) {}\n \n public get Services(): IServiceCollection {\n return this.services;\n }\n\n [Symbol.dispose]() {\n this.created.forEach(x => x[Symbol.dispose]());\n }\n\n private resolveFrom<T extends SourceType>(\n identifier: ServiceIdentifier<T>,\n descriptor: ServiceDescriptor<T>,\n lifetimeMap: ResolveMap<T>,\n currentResolve: ResolveMap<T>\n ): T {\n let resolvedInstances = lifetimeMap.get(identifier);\n if (resolvedInstances === undefined) {\n resolvedInstances = new Map();\n lifetimeMap.set(identifier, resolvedInstances);\n }\n\n let instance = resolvedInstances.get(descriptor.implementation);\n if (instance === undefined) {\n instance = this.createInstance(descriptor, currentResolve);\n resolvedInstances.set(descriptor.implementation, instance);\n this.setDependencies<T>(descriptor.implementation, instance, currentResolve);\n }\n return instance;\n }\n\n private resolveInternal<T extends SourceType>(\n identifier: ServiceIdentifier<T>,\n descriptor: ServiceDescriptor<T>,\n currentResolve: ResolveMap<T>,\n ): T {\n const mapping: Partial<Record<Lifetime, ResolveMap<any>>> = {\n [Lifetime.Singleton]: this.singletons,\n [Lifetime.Scoped]: this.scoped,\n [Lifetime.Resolve]: currentResolve,\n };\n const sourceMap = mapping[descriptor.lifetime];\n if (sourceMap === undefined) {\n const instance = this.createInstance(descriptor, currentResolve);\n this.setDependencies<T>(descriptor.implementation, instance, currentResolve);\n return instance;\n }\n return this.resolveFrom(identifier, descriptor, sourceMap, currentResolve);\n }\n\n public resolveAll<T extends SourceType>(\n identifier: ServiceIdentifier<T>,\n currentResolve = createResolveMap<T>(),\n ): T[] {\n const descriptors = this.services.get(identifier);\n return descriptors.map(descriptor => this.resolveInternal<T>(identifier, descriptor, currentResolve));\n }\n\n public resolve<T extends SourceType>(\n identifier: ServiceIdentifier<T>,\n currentResolve = createResolveMap<T>(),\n ): T {\n if (identifier.prototype === IServiceScope.prototype || identifier.prototype === IServiceProvider.prototype) {\n return this as unknown as T;\n }\n\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 this.resolveInternal(identifier, descriptor, currentResolve);\n }\n\n private createInstance<T extends SourceType>(descriptor: ServiceDescriptor<T>, currentResolve: ResolveMap<T>): T {\n let instance: T;\n if ('factory' in descriptor) {\n const factory = descriptor.factory;\n const resolve = (identifier: ServiceIdentifier<any>) => this.resolve(identifier, currentResolve);\n const resolveAll = (identifier: ServiceIdentifier<any>) => this.resolveAll(identifier, currentResolve);\n const createScope = this.createScope.bind(this);\n\n // proxy requests to keep current resolved types\n instance = factory({\n resolve,\n resolveAll,\n createScope,\n get Services() { return this.Services; },\n });\n }\n else {\n try {\n instance = new descriptor.implementation();\n }\n catch (err) {\n throw new ServiceCreationError(descriptor.implementation, err);\n }\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(): IServiceProvider & IDisposable {\n return new ServiceProvider(this.services.clone(), this.singletons);\n }\n\n private setDependencies<T extends SourceType>(\n type: Id<T>,\n instance: T,\n currentResolve: ResolveMap<T>,\n ): T {\n const dependencies = getMetadata<T>(DesignDependenciesKey, type) ?? {};\n log('Dependencies', type.name, dependencies);\n for (const [key, identifier] of Object.entries(dependencies)) {\n if (identifier !== type) {\n log('Resolving', identifier, 'for', type.name);\n const dep = this.resolve(identifier, currentResolve);\n (instance as Record<string, unknown>)[key] = dep;\n } else {\n throw new SelfDependencyError();\n }\n }\n return instance;\n }\n}\n","import { ServiceProvider } from './ServiceProvider';\nimport type { SourceType, InstanceFactory, ServiceBuilder, ServiceDescriptor, ServiceIdentifier, ServiceImplementation, Newable, ServiceCollectionOptions } from './types';\nimport type { IServiceCollection, IServiceModule, IServiceProvider } from './interfaces';\nimport { Lifetime } from './constants';\nimport { log } from './debug';\n\nexport class ServiceCollection implements IServiceCollection {\n constructor(public readonly options: ServiceCollectionOptions, private readonly services = new Map<ServiceIdentifier<any>, ServiceDescriptor<any>[]>()) {\n }\n \n public registerModules(modules: Newable<IServiceModule>[]): void {\n modules.forEach(x => {\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 register<T extends SourceType>(identifier: ServiceIdentifier<T>): ServiceBuilder<T> {\n return {\n // to: (implementation: ServiceImplementation<T>, func?: InstanceFactory<T>) => {\n to: (implementation: ServiceImplementation<T> | ServiceIdentifier<T>, factory?: InstanceFactory<T>) => {\n const descriptor: ServiceDescriptor<T>= (factory === undefined) ? { implementation: implementation as ServiceImplementation<T>, lifetime: Lifetime.Resolve } : { implementation, factory, lifetime: Lifetime.Resolve };\n this.addService(identifier, descriptor);\n const builder = {\n singleton: () => { descriptor.lifetime = Lifetime.Singleton; return builder; },\n scoped: () => { descriptor.lifetime = Lifetime.Scoped; return builder; },\n transient: () => { descriptor.lifetime = Lifetime.Transient; return builder; },\n };\n return builder;\n },\n };\n }\n\n private addService<T extends SourceType>(identifier: ServiceIdentifier<T>, descriptor: ServiceDescriptor<T>) {\n log('Adding service', { identifier, 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(): IServiceCollection {\n const clonedMap = new Map<ServiceIdentifier<any>, ServiceDescriptor<any>[]>();\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.options, clonedMap);\n }\n\n public buildProvider(): IServiceProvider {\n const cloned = this.clone(); \n return new ServiceProvider(cloned);\n }\n}\n","import type { IServiceCollection } from './interfaces';\nimport { ServiceCollection } from './ServiceCollection';\nimport type { ServiceCollectionOptions } from './types';\nimport { DefaultServiceCollectionOptions } from './types';\n\nconst mergeOptions = (options: Partial<ServiceCollectionOptions> | undefined): ServiceCollectionOptions => ({\n ...DefaultServiceCollectionOptions,\n ...options,\n});\n\nexport const createServiceCollection = (options?: Partial<ServiceCollectionOptions>): IServiceCollection => new ServiceCollection(mergeOptions(options)) as IServiceCollection;\n","import { DesignDependenciesKey } from './constants';\nimport type { ServiceIdentifier, SourceType } from './types';\nimport { defineMetadata, getMetadata } from './metadata';\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\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"],"names":["__defProp","__defNormalProp","__publicField"],"mappings":";;;;AACA,IAAIA,WAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAIC,iBAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAGD,WAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAIE,eAAa,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAKD,iBAAe,CAAC,GAAG,EAA4B,GAAG,GAAG,EAAE,CAAM,EAAE,KAAK,CAAC,CAAC;AAC/G,MAAM,WAAW,CAAC;AAClB,EAAE,WAAW,GAAG;AAChB,IAAIC,eAAa,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;AAC5C,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAI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cts
CHANGED
|
@@ -37,6 +37,15 @@ type ServiceBuilder<T extends SourceType> = {
|
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
39
|
type MetadataType<T extends SourceType> = Record<string | symbol, ServiceIdentifier<T>>;
|
|
40
|
+
declare const ResolveMultipleMode: {
|
|
41
|
+
readonly Error: "ERROR";
|
|
42
|
+
readonly LastRegistered: "LAST_REGISTERED";
|
|
43
|
+
};
|
|
44
|
+
type ResolveMultipleMode = (typeof ResolveMultipleMode)[keyof typeof ResolveMultipleMode];
|
|
45
|
+
declare const DefaultServiceCollectionOptions: ServiceCollectionOptions;
|
|
46
|
+
type ServiceCollectionOptions = {
|
|
47
|
+
registrationMode: ResolveMultipleMode;
|
|
48
|
+
};
|
|
40
49
|
|
|
41
50
|
declare abstract class IDisposable {
|
|
42
51
|
abstract [Symbol.dispose]: () => void;
|
|
@@ -53,6 +62,7 @@ declare abstract class IServiceProvider extends IServiceScope {
|
|
|
53
62
|
abstract createScope(): IServiceProvider & IDisposable;
|
|
54
63
|
}
|
|
55
64
|
declare abstract class IServiceCollection {
|
|
65
|
+
abstract readonly options: ServiceCollectionOptions;
|
|
56
66
|
abstract get<T extends SourceType>(key: ServiceIdentifier<T>): ServiceDescriptor<T>[];
|
|
57
67
|
abstract register<T extends SourceType>(identifier: ServiceIdentifier<T>): ServiceBuilder<T>;
|
|
58
68
|
abstract registerModules(modules: ServiceModuleType[]): void;
|
|
@@ -60,11 +70,63 @@ declare abstract class IServiceCollection {
|
|
|
60
70
|
abstract clone(): IServiceCollection;
|
|
61
71
|
}
|
|
62
72
|
|
|
63
|
-
declare const createServiceCollection: () => IServiceCollection;
|
|
73
|
+
declare const createServiceCollection: (options?: Partial<ServiceCollectionOptions>) => IServiceCollection;
|
|
64
74
|
|
|
65
75
|
declare const dependsOn: <T extends SourceType>(identifier: ServiceIdentifier<T>) => (value: undefined, ctx: ClassFieldDecoratorContext) => (this: object, initialValue: any) => any;
|
|
66
76
|
|
|
67
77
|
declare const enable: () => void;
|
|
68
78
|
declare const disable: () => void;
|
|
69
79
|
|
|
70
|
-
|
|
80
|
+
declare abstract class ServiceError extends Error {
|
|
81
|
+
constructor(message: string);
|
|
82
|
+
}
|
|
83
|
+
declare class UnregisteredServiceError<T extends object> extends ServiceError {
|
|
84
|
+
name: string;
|
|
85
|
+
constructor(identifier: ServiceIdentifier<T>);
|
|
86
|
+
}
|
|
87
|
+
declare class MultipleRegistrationError<T extends object> extends ServiceError {
|
|
88
|
+
name: string;
|
|
89
|
+
constructor(identifier: ServiceIdentifier<T>);
|
|
90
|
+
}
|
|
91
|
+
declare class ServiceCreationError<T extends object> extends ServiceError {
|
|
92
|
+
readonly innerError: any;
|
|
93
|
+
name: string;
|
|
94
|
+
constructor(identifier: ServiceIdentifier<T>, innerError: any);
|
|
95
|
+
}
|
|
96
|
+
declare class SelfDependencyError extends ServiceError {
|
|
97
|
+
name: string;
|
|
98
|
+
constructor();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
declare class ServiceCollection implements IServiceCollection {
|
|
102
|
+
readonly options: ServiceCollectionOptions;
|
|
103
|
+
private readonly services;
|
|
104
|
+
constructor(options: ServiceCollectionOptions, services?: Map<ServiceIdentifier<any>, ServiceDescriptor<any>[]>);
|
|
105
|
+
registerModules(modules: Newable<IServiceModule>[]): void;
|
|
106
|
+
get<T extends SourceType>(key: ServiceIdentifier<T>): ServiceDescriptor<T>[];
|
|
107
|
+
register<T extends SourceType>(identifier: ServiceIdentifier<T>): ServiceBuilder<T>;
|
|
108
|
+
private addService;
|
|
109
|
+
clone(): IServiceCollection;
|
|
110
|
+
buildProvider(): IServiceProvider;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
type Id<T extends SourceType> = ServiceIdentifier<T> | ServiceImplementation<T>;
|
|
114
|
+
type ResolveMap<T extends SourceType> = Map<ServiceIdentifier<T>, Map<Id<T>, T>>;
|
|
115
|
+
declare class ServiceProvider implements IServiceProvider, IServiceScope {
|
|
116
|
+
private services;
|
|
117
|
+
private singletons;
|
|
118
|
+
private scoped;
|
|
119
|
+
private created;
|
|
120
|
+
constructor(services: IServiceCollection, singletons?: ResolveMap<object>);
|
|
121
|
+
get Services(): IServiceCollection;
|
|
122
|
+
[Symbol.dispose](): void;
|
|
123
|
+
private resolveFrom;
|
|
124
|
+
private resolveInternal;
|
|
125
|
+
resolveAll<T extends SourceType>(identifier: ServiceIdentifier<T>, currentResolve?: ResolveMap<T>): T[];
|
|
126
|
+
resolve<T extends SourceType>(identifier: ServiceIdentifier<T>, currentResolve?: ResolveMap<T>): T;
|
|
127
|
+
private createInstance;
|
|
128
|
+
createScope(): IServiceProvider & IDisposable;
|
|
129
|
+
private setDependencies;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export { type AbstractNewable, DefaultServiceCollectionOptions, IDisposable, IServiceCollection, IServiceModule, IServiceProvider, IServiceScope, type InstanceFactory, type LifetimeBuilder, type MetadataType, MultipleRegistrationError, type Newable, ResolveMultipleMode, SelfDependencyError, type ServiceBuilder, ServiceCollection, type ServiceCollectionOptions, ServiceCreationError, type ServiceDescriptor, type ServiceDescriptorConcrete, type ServiceDescriptorFactory, ServiceError, type ServiceIdentifier, type ServiceImplementation, type ServiceModuleType, ServiceProvider, type SourceType, UnregisteredServiceError, createServiceCollection, dependsOn, disable, enable };
|
package/dist/index.d.mts
CHANGED
|
@@ -37,6 +37,15 @@ type ServiceBuilder<T extends SourceType> = {
|
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
39
|
type MetadataType<T extends SourceType> = Record<string | symbol, ServiceIdentifier<T>>;
|
|
40
|
+
declare const ResolveMultipleMode: {
|
|
41
|
+
readonly Error: "ERROR";
|
|
42
|
+
readonly LastRegistered: "LAST_REGISTERED";
|
|
43
|
+
};
|
|
44
|
+
type ResolveMultipleMode = (typeof ResolveMultipleMode)[keyof typeof ResolveMultipleMode];
|
|
45
|
+
declare const DefaultServiceCollectionOptions: ServiceCollectionOptions;
|
|
46
|
+
type ServiceCollectionOptions = {
|
|
47
|
+
registrationMode: ResolveMultipleMode;
|
|
48
|
+
};
|
|
40
49
|
|
|
41
50
|
declare abstract class IDisposable {
|
|
42
51
|
abstract [Symbol.dispose]: () => void;
|
|
@@ -53,6 +62,7 @@ declare abstract class IServiceProvider extends IServiceScope {
|
|
|
53
62
|
abstract createScope(): IServiceProvider & IDisposable;
|
|
54
63
|
}
|
|
55
64
|
declare abstract class IServiceCollection {
|
|
65
|
+
abstract readonly options: ServiceCollectionOptions;
|
|
56
66
|
abstract get<T extends SourceType>(key: ServiceIdentifier<T>): ServiceDescriptor<T>[];
|
|
57
67
|
abstract register<T extends SourceType>(identifier: ServiceIdentifier<T>): ServiceBuilder<T>;
|
|
58
68
|
abstract registerModules(modules: ServiceModuleType[]): void;
|
|
@@ -60,11 +70,63 @@ declare abstract class IServiceCollection {
|
|
|
60
70
|
abstract clone(): IServiceCollection;
|
|
61
71
|
}
|
|
62
72
|
|
|
63
|
-
declare const createServiceCollection: () => IServiceCollection;
|
|
73
|
+
declare const createServiceCollection: (options?: Partial<ServiceCollectionOptions>) => IServiceCollection;
|
|
64
74
|
|
|
65
75
|
declare const dependsOn: <T extends SourceType>(identifier: ServiceIdentifier<T>) => (value: undefined, ctx: ClassFieldDecoratorContext) => (this: object, initialValue: any) => any;
|
|
66
76
|
|
|
67
77
|
declare const enable: () => void;
|
|
68
78
|
declare const disable: () => void;
|
|
69
79
|
|
|
70
|
-
|
|
80
|
+
declare abstract class ServiceError extends Error {
|
|
81
|
+
constructor(message: string);
|
|
82
|
+
}
|
|
83
|
+
declare class UnregisteredServiceError<T extends object> extends ServiceError {
|
|
84
|
+
name: string;
|
|
85
|
+
constructor(identifier: ServiceIdentifier<T>);
|
|
86
|
+
}
|
|
87
|
+
declare class MultipleRegistrationError<T extends object> extends ServiceError {
|
|
88
|
+
name: string;
|
|
89
|
+
constructor(identifier: ServiceIdentifier<T>);
|
|
90
|
+
}
|
|
91
|
+
declare class ServiceCreationError<T extends object> extends ServiceError {
|
|
92
|
+
readonly innerError: any;
|
|
93
|
+
name: string;
|
|
94
|
+
constructor(identifier: ServiceIdentifier<T>, innerError: any);
|
|
95
|
+
}
|
|
96
|
+
declare class SelfDependencyError extends ServiceError {
|
|
97
|
+
name: string;
|
|
98
|
+
constructor();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
declare class ServiceCollection implements IServiceCollection {
|
|
102
|
+
readonly options: ServiceCollectionOptions;
|
|
103
|
+
private readonly services;
|
|
104
|
+
constructor(options: ServiceCollectionOptions, services?: Map<ServiceIdentifier<any>, ServiceDescriptor<any>[]>);
|
|
105
|
+
registerModules(modules: Newable<IServiceModule>[]): void;
|
|
106
|
+
get<T extends SourceType>(key: ServiceIdentifier<T>): ServiceDescriptor<T>[];
|
|
107
|
+
register<T extends SourceType>(identifier: ServiceIdentifier<T>): ServiceBuilder<T>;
|
|
108
|
+
private addService;
|
|
109
|
+
clone(): IServiceCollection;
|
|
110
|
+
buildProvider(): IServiceProvider;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
type Id<T extends SourceType> = ServiceIdentifier<T> | ServiceImplementation<T>;
|
|
114
|
+
type ResolveMap<T extends SourceType> = Map<ServiceIdentifier<T>, Map<Id<T>, T>>;
|
|
115
|
+
declare class ServiceProvider implements IServiceProvider, IServiceScope {
|
|
116
|
+
private services;
|
|
117
|
+
private singletons;
|
|
118
|
+
private scoped;
|
|
119
|
+
private created;
|
|
120
|
+
constructor(services: IServiceCollection, singletons?: ResolveMap<object>);
|
|
121
|
+
get Services(): IServiceCollection;
|
|
122
|
+
[Symbol.dispose](): void;
|
|
123
|
+
private resolveFrom;
|
|
124
|
+
private resolveInternal;
|
|
125
|
+
resolveAll<T extends SourceType>(identifier: ServiceIdentifier<T>, currentResolve?: ResolveMap<T>): T[];
|
|
126
|
+
resolve<T extends SourceType>(identifier: ServiceIdentifier<T>, currentResolve?: ResolveMap<T>): T;
|
|
127
|
+
private createInstance;
|
|
128
|
+
createScope(): IServiceProvider & IDisposable;
|
|
129
|
+
private setDependencies;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export { type AbstractNewable, DefaultServiceCollectionOptions, IDisposable, IServiceCollection, IServiceModule, IServiceProvider, IServiceScope, type InstanceFactory, type LifetimeBuilder, type MetadataType, MultipleRegistrationError, type Newable, ResolveMultipleMode, SelfDependencyError, type ServiceBuilder, ServiceCollection, type ServiceCollectionOptions, ServiceCreationError, type ServiceDescriptor, type ServiceDescriptorConcrete, type ServiceDescriptorFactory, ServiceError, type ServiceIdentifier, type ServiceImplementation, type ServiceModuleType, ServiceProvider, type SourceType, UnregisteredServiceError, createServiceCollection, dependsOn, disable, enable };
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var W=Object.defineProperty;var r=(s,e)=>W(s,"name",{value:e,configurable:!0});import"@abraham/reflection";var X=Object.defineProperty,Y=r((s,e,t)=>e in s?X(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"__defNormalProp$2"),Z=r((s,e,t)=>Y(s,e+"",t),"__publicField$2");const T=class T{constructor(){Z(this,"debugging",!1)}enable(){this.debugging=!0}disable(){this.debugging=!1}log(e,...t){this.debugging&&console.log(e,...t)}};r(T,"DebugLogger");let E=T;const p=new E,S=p.log.bind(p),L=p.enable.bind(p),U=p.disable.bind(p);var a=(s=>(s.Resolve="RESOLVE",s.Transient="TRANSIENT",s.Scoped="SCOPED",s.Singleton="SINGLETON",s))(a||{});const I="design:dependencies",_=class _{};r(_,"IDisposable");let x=_;const D=class D{};r(D,"IServiceModule");let $=D;const F=class F{};r(F,"IServiceScope");let u=F;const j=class j extends u{};r(j,"IServiceProvider");let g=j;const G=class G{};r(G,"IServiceCollection");let N=G;const J=r((s,e)=>{if(Reflect.getMetadata===void 0)throw new Error('Please import "reflect-metadata"');const t=Reflect.getMetadata(s,e);if(t!==void 0)return t},"getMetadata"),C=r((s,e,t)=>{if(Reflect.defineMetadata===void 0)throw new Error('Please import "reflect-metadata"');Reflect.defineMetadata(s,e,t)},"defineMetadata"),A={Error:"ERROR",LastRegistered:"LAST_REGISTERED"},K={registrationMode:A.Error};var k=Object.defineProperty,ee=r((s,e,t)=>e in s?k(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"__defNormalProp$1"),f=r((s,e,t)=>ee(s,e+"",t),"__publicField$1");const V=class V extends Error{constructor(e){super(e)}};r(V,"ServiceError");let l=V;const q=class q extends l{constructor(e){super(`Resolving service that has not been registered: ${e}`),f(this,"name","UnregisteredServiceError"),Object.setPrototypeOf(this,new.target.prototype)}};r(q,"UnregisteredServiceError");let m=q;const z=class z extends l{constructor(e){super(`Multiple services have been registered: ${e}`),f(this,"name","MultipleRegistrationError"),Object.setPrototypeOf(this,new.target.prototype)}};r(z,"MultipleRegistrationError");let v=z;const B=class B extends l{constructor(e,t){super(`Error creating service: ${e}`),this.innerError=t,f(this,"name","ServiceCreationError"),Object.setPrototypeOf(this,new.target.prototype)}};r(B,"ServiceCreationError");let b=B;const H=class H extends l{constructor(){super("Service depending on itself"),f(this,"name","SelfDependencyError"),Object.setPrototypeOf(this,new.target.prototype)}};r(H,"SelfDependencyError");let w=H;var te=Object.defineProperty,se=r((s,e,t)=>e in s?te(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"__defNormalProp"),Q=r((s,e,t)=>se(s,typeof e!="symbol"?e+"":e,t),"__publicField");const O=r(()=>new Map,"createResolveMap"),P=class P{constructor(e,t=O()){this.services=e,this.singletons=t,Q(this,"scoped",O()),Q(this,"created",[])}get Services(){return this.services}[Symbol.dispose](){this.created.forEach(e=>e[Symbol.dispose]())}resolveFrom(e,t,n,o){let i=n.get(e);i===void 0&&(i=new Map,n.set(e,i));let c=i.get(t.implementation);return c===void 0&&(c=this.createInstance(t,o),i.set(t.implementation,c),this.setDependencies(t.implementation,c,o)),c}resolveInternal(e,t,n){const i={[a.Singleton]:this.singletons,[a.Scoped]:this.scoped,[a.Resolve]:n}[t.lifetime];if(i===void 0){const c=this.createInstance(t,n);return this.setDependencies(t.implementation,c,n),c}return this.resolveFrom(e,t,i,n)}resolveAll(e,t=O()){return this.services.get(e).map(o=>this.resolveInternal(e,o,t))}resolve(e,t=O()){if(e.prototype===u.prototype||e.prototype===g.prototype)return this;const n=this.services.get(e);if(n.length===0)throw new m(e);if(n.length>1&&this.Services.options.registrationMode===A.Error)throw new v(e);const o=n[n.length-1];return this.resolveInternal(e,o,t)}createInstance(e,t){let n;if("factory"in e){const o=e.factory,i=r(h=>this.resolve(h,t),"resolve"),c=r(h=>this.resolveAll(h,t),"resolveAll"),d=this.createScope.bind(this);n=o({resolve:i,resolveAll:c,createScope:d,get Services(){return this.Services}})}else try{n=new e.implementation}catch(o){throw new b(e.implementation,o)}return e.lifetime!==a.Singleton&&Symbol.dispose in n&&this.created.push(n),n}createScope(){return new P(this.services.clone(),this.singletons)}setDependencies(e,t,n){var o;const i=(o=J(I,e))!=null?o:{};S("Dependencies",e.name,i);for(const[c,d]of Object.entries(i))if(d!==e){S("Resolving",d,"for",e.name);const h=this.resolve(d,n);t[c]=h}else throw new w;return t}};r(P,"ServiceProvider");let M=P;const R=class R{constructor(e,t=new Map){this.options=e,this.services=t}registerModules(e){e.forEach(t=>{new t().registerServices(this)})}get(e){var t;return(t=this.services.get(e))!=null?t:[]}register(e){return{to:r((t,n)=>{const o=n===void 0?{implementation:t,lifetime:a.Resolve}:{implementation:t,factory:n,lifetime:a.Resolve};this.addService(e,o);const i={singleton:r(()=>(o.lifetime=a.Singleton,i),"singleton"),scoped:r(()=>(o.lifetime=a.Scoped,i),"scoped"),transient:r(()=>(o.lifetime=a.Transient,i),"transient")};return i},"to")}}addService(e,t){S("Adding service",{identifier:e,descriptor:t});let n=this.services.get(e);n==null&&(n=[],this.services.set(e,n)),n.push(t)}clone(){const e=new Map;for(const[t,n]of this.services){const o=n.map(i=>({...i}));e.set(t,o)}return new R(this.options,e)}buildProvider(){const e=this.clone();return new M(e)}};r(R,"ServiceCollection");let y=R;const ne=r(s=>({...K,...s}),"mergeOptions"),re=r(s=>new y(ne(s)),"createServiceCollection"),oe=r((s,e,t,n)=>{let o=J(s,e);o===void 0&&(o={},C(s,o,e)),o[t]=n},"tagProperty"),ie=r(s=>(e,t)=>function(n){const o=this.constructor;return oe(I,o,t.name,s),n},"dependsOn");export{K as DefaultServiceCollectionOptions,x as IDisposable,N as IServiceCollection,$ as IServiceModule,g as IServiceProvider,u as IServiceScope,v as MultipleRegistrationError,A as ResolveMultipleMode,w as SelfDependencyError,y as ServiceCollection,b as ServiceCreationError,l as ServiceError,M as ServiceProvider,m as UnregisteredServiceError,re as createServiceCollection,ie as dependsOn,U as disable,L as enable};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/debug.ts","../src/constants.ts","../src/interfaces.ts","../src/metadata.ts","../src/errors.ts","../src/ServiceProvider.ts","../src/ServiceCollection.ts","../src/createServiceCollection.ts","../src/dependsOn.ts"],"sourcesContent":["\nclass DebugLogger {\n private debugging = false;\n\n public enable() { this.debugging = true; }\n public disable() { this.debugging = false; }\n public log(message?: string, ...optionalParams: unknown[]) {\n if(this.debugging) {\n console.log(message, ...optionalParams);\n }\n }\n}\n\nconst logger = new DebugLogger();\n\nexport const log = logger.log.bind(logger);\nexport const enable = logger.enable.bind(logger);\nexport const disable = logger.disable.bind(logger);\n","export enum Lifetime {\n Resolve = 'RESOLVE',\n Transient = 'TRANSIENT',\n Scoped = 'SCOPED',\n Singleton = 'SINGLETON',\n}\n\nexport const DesignDependenciesKey = 'design:dependencies';\n","import type { SourceType, ServiceBuilder, ServiceDescriptor, ServiceIdentifier, ServiceModuleType } 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 IServiceScope {\n public abstract resolve<T extends SourceType>(identifier: ServiceIdentifier<T>): T;\n public abstract resolveAll<T extends SourceType>(identifier: ServiceIdentifier<T>): T[];\n}\n\nexport abstract class IServiceProvider extends IServiceScope {\n public abstract get Services(): IServiceCollection;\n public abstract createScope(): IServiceProvider & IDisposable;\n}\n\nexport abstract class IServiceCollection {\n public abstract get<T extends SourceType>(key: ServiceIdentifier<T>): ServiceDescriptor<T>[];\n public abstract register<T extends SourceType>(identifier: ServiceIdentifier<T>): ServiceBuilder<T>;\n public abstract registerModules(modules: ServiceModuleType[]): void;\n public abstract buildProvider(): IServiceProvider;\n public abstract clone(): IServiceCollection;\n}\n","import '@abraham/reflection';\nimport type { MetadataType, SourceType } from './types';\n\nexport const getMetadata = <T extends SourceType>(key: string, obj: object): MetadataType<T> | undefined => {\n if (Reflect.getMetadata === undefined) {\n throw new Error('Please import \"reflect-metadata\"');\n }\n const result = Reflect.getMetadata(key, obj);\n if (result === undefined) {\n return undefined;\n }\n return result as MetadataType<T>;\n};\n\nexport const defineMetadata = <T extends SourceType>(key: string, metadata: MetadataType<T>, obj: object) => {\n if (Reflect.defineMetadata === undefined) {\n throw new Error('Please import \"reflect-metadata\"');\n }\n Reflect.defineMetadata(key, metadata, obj);\n};\n","import type { ServiceIdentifier } from './types';\n\nexport class UnregisteredServiceError<T extends object> extends Error {\n name = 'UnregisteredServiceError';\n constructor(identifier: ServiceIdentifier<T>) {\n super(`Resolving service that has not been registered: ${identifier}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class MultipleRegistrationError<T extends object> extends Error {\n name = 'MultipleRegistrationError';\n constructor(identifier: ServiceIdentifier<T>) {\n super(`Multiple services have been registered: ${identifier}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class SelfDependencyError extends Error {\n name = 'SelfDependencyError';\n constructor() {\n super('Service depending on itself');\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n","import { log } from './debug';\nimport { DesignDependenciesKey, Lifetime } from './constants';\nimport type { IDisposable, IServiceCollection} from './interfaces';\nimport { IServiceScope, IServiceProvider} from './interfaces';\nimport { getMetadata } from './metadata';\nimport type { ServiceIdentifier, ServiceDescriptor, ServiceImplementation, SourceType } from './types';\nimport { SelfDependencyError, MultipleRegistrationError, UnregisteredServiceError } from './errors';\n\ntype Id<T extends SourceType> = ServiceIdentifier<T> | ServiceImplementation<T>;\n\ntype ResolveMap<T extends SourceType> = Map<ServiceIdentifier<T>, Map<Id<T>, T>>;\n\nconst createResolveMap = <T extends SourceType>(): ResolveMap<T> => new Map<ServiceIdentifier<T>, Map<ServiceImplementation<T>, T>>();\n\nexport class ServiceProvider implements IServiceProvider, IServiceScope {\n private scoped = createResolveMap();\n private created: IDisposable[] = [];\n\n constructor(\n private services: IServiceCollection,\n private singletons = createResolveMap(),\n ) {}\n \n public get Services(): IServiceCollection {\n return this.services;\n }\n\n [Symbol.dispose]() {\n this.created.forEach(x => x[Symbol.dispose]());\n }\n\n private resolveFrom<T extends SourceType>(\n identifier: ServiceIdentifier<T>,\n descriptor: ServiceDescriptor<T>,\n lifetimeMap: ResolveMap<T>,\n currentResolve: ResolveMap<T>\n ): T {\n let resolvedInstances = lifetimeMap.get(identifier);\n if (resolvedInstances === undefined) {\n resolvedInstances = new Map();\n lifetimeMap.set(identifier, resolvedInstances);\n }\n\n let instance = resolvedInstances.get(descriptor.implementation);\n if (instance === undefined) {\n instance = this.createInstance(descriptor, currentResolve);\n resolvedInstances.set(descriptor.implementation, instance);\n this.setDependencies<T>(descriptor.implementation, instance, currentResolve);\n }\n return instance;\n }\n\n private resolveInternal<T extends SourceType>(\n identifier: ServiceIdentifier<T>,\n descriptor: ServiceDescriptor<T>,\n currentResolve: ResolveMap<T>,\n ): T {\n const mapping: Partial<Record<Lifetime, ResolveMap<any>>> = {\n [Lifetime.Singleton]: this.singletons,\n [Lifetime.Scoped]: this.scoped,\n [Lifetime.Resolve]: currentResolve,\n };\n const sourceMap = mapping[descriptor.lifetime];\n if (sourceMap === undefined) {\n const instance = this.createInstance(descriptor, currentResolve);\n this.setDependencies<T>(descriptor.implementation, instance, currentResolve);\n return instance;\n }\n return this.resolveFrom(identifier, descriptor, sourceMap, currentResolve);\n }\n\n public resolveAll<T extends SourceType>(\n identifier: ServiceIdentifier<T>,\n currentResolve = createResolveMap<T>(),\n ): T[] {\n const descriptors = this.services.get(identifier);\n return descriptors.map(descriptor => this.resolveInternal<T>(identifier, descriptor, currentResolve));\n }\n\n public resolve<T extends SourceType>(\n identifier: ServiceIdentifier<T>,\n currentResolve = createResolveMap<T>(),\n ): T {\n if (identifier.prototype === IServiceScope.prototype || identifier.prototype === IServiceProvider.prototype) {\n return this as unknown as T;\n }\n\n const descriptors = this.services.get(identifier);\n if (descriptors.length === 0) {\n throw new UnregisteredServiceError(identifier);\n }\n if (descriptors.length > 1) {\n throw new MultipleRegistrationError(identifier);\n }\n\n const descriptor = descriptors[0];\n return this.resolveInternal(identifier, descriptor, currentResolve);\n }\n\n private createInstance<T extends SourceType>(descriptor: ServiceDescriptor<T>, currentResolve: ResolveMap<T>): T {\n let instance: T;\n if ('factory' in descriptor) {\n const factory = descriptor.factory;\n const resolve = (identifier: ServiceIdentifier<any>) => this.resolve(identifier, currentResolve);\n const resolveAll = (identifier: ServiceIdentifier<any>) => this.resolveAll(identifier, currentResolve);\n const createScope = this.createScope.bind(this);\n\n // proxy requests to keep current resolved types\n instance = factory({\n resolve,\n resolveAll,\n createScope,\n get Services() { return this.Services; },\n });\n }\n else {\n try {\n instance = new descriptor.implementation();\n }\n catch (err) {\n console.error(err, 'Error creating service', {\n descriptor,\n });\n throw err;\n }\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(): IServiceProvider & IDisposable {\n return new ServiceProvider(this.services.clone(), this.singletons);\n }\n\n private setDependencies<T extends SourceType>(\n type: Id<T>,\n instance: T,\n currentResolve: ResolveMap<T>,\n ): T {\n const dependencies = getMetadata<T>(DesignDependenciesKey, type) ?? {};\n log('Dependencies', type.name, dependencies);\n for (const [key, identifier] of Object.entries(dependencies)) {\n if (identifier !== type) {\n log('Resolving', identifier, 'for', type.name);\n const dep = this.resolve(identifier, currentResolve);\n (instance as Record<string, unknown>)[key] = dep;\n } else {\n throw new SelfDependencyError();\n }\n }\n return instance;\n }\n}\n","import { ServiceProvider } from './ServiceProvider';\nimport type { SourceType, InstanceFactory, ServiceBuilder, ServiceDescriptor, ServiceIdentifier, ServiceImplementation, Newable } from './types';\nimport type { IServiceCollection, IServiceModule, IServiceProvider } from './interfaces';\nimport { Lifetime } from './constants';\nimport { log } from './debug';\n\nexport class ServiceCollection implements IServiceCollection {\n constructor(private readonly services = new Map<ServiceIdentifier<any>, ServiceDescriptor<any>[]>()) {\n }\n \n public registerModules(modules: Newable<IServiceModule>[]): void {\n modules.forEach(x => {\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 register<T extends SourceType>(identifier: ServiceIdentifier<T>): ServiceBuilder<T> {\n return {\n // to: (implementation: ServiceImplementation<T>, func?: InstanceFactory<T>) => {\n to: (implementation: ServiceImplementation<T> | ServiceIdentifier<T>, factory?: InstanceFactory<T>) => {\n const descriptor: ServiceDescriptor<T>= (factory === undefined) ? { implementation: implementation as ServiceImplementation<T>, lifetime: Lifetime.Resolve } : { implementation, factory, lifetime: Lifetime.Resolve };\n this.addService(identifier, descriptor);\n const builder = {\n singleton: () => { descriptor.lifetime = Lifetime.Singleton; return builder; },\n scoped: () => { descriptor.lifetime = Lifetime.Scoped; return builder; },\n transient: () => { descriptor.lifetime = Lifetime.Transient; return builder; },\n };\n return builder;\n },\n };\n }\n\n private addService<T extends SourceType>(identifier: ServiceIdentifier<T>, descriptor: ServiceDescriptor<T>) {\n log('Adding service', { identifier, 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(): IServiceCollection {\n const clonedMap = new Map<ServiceIdentifier<any>, ServiceDescriptor<any>[]>();\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(clonedMap);\n }\n\n public buildProvider(): IServiceProvider {\n const cloned = this.clone(); \n return new ServiceProvider(cloned);\n }\n}\n","import type { IServiceCollection } from './interfaces';\nimport { ServiceCollection } from './ServiceCollection';\n\nexport const createServiceCollection = (): IServiceCollection => new ServiceCollection() as IServiceCollection;\n","import { DesignDependenciesKey } from './constants';\nimport type { ServiceIdentifier, SourceType } from './types';\nimport { defineMetadata, getMetadata } from './metadata';\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\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"],"names":["__defProp","__defNormalProp","__publicField"],"mappings":";;AACA,IAAIA,WAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAIC,iBAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAGD,WAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;A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,EAAE,gBAAgB,CAAC,CAAC;AAC5D,GAAG;AACH,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC;AAC9B,CAAC,CAAC;AACU,MAAC,SAAS,GAAG,CAAC,UAAU,KAAK;AACzC,EAAE,OAAO,CAAC,KAAK,EAAE,GAAG,KAAK;AACzB,IAAI,OAAO,SAAS,YAAY,EAAE;AAClC,MAAM,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC;AACtC,MAAM,WAAW,CAAC,qBAAqB,EAAE,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;AACvE,MAAM,OAAO,YAAY,CAAC;AAC1B,KAAK,CAAC;AACN,GAAG,CAAC;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/debug.ts","../src/constants.ts","../src/interfaces.ts","../src/metadata.ts","../src/types.ts","../src/errors.ts","../src/ServiceProvider.ts","../src/ServiceCollection.ts","../src/createServiceCollection.ts","../src/dependsOn.ts"],"sourcesContent":["// TODO: Allow configuration of logger in options\nclass DebugLogger {\n private debugging = false;\n\n public enable() { this.debugging = true; }\n public disable() { this.debugging = false; }\n public log(message?: string, ...optionalParams: unknown[]) {\n if(this.debugging) {\n console.log(message, ...optionalParams);\n }\n }\n}\n\nconst logger = new DebugLogger();\n\nexport const log = logger.log.bind(logger);\nexport const enable = logger.enable.bind(logger);\nexport const disable = logger.disable.bind(logger);\n","export enum Lifetime {\n Resolve = 'RESOLVE',\n Transient = 'TRANSIENT',\n Scoped = 'SCOPED',\n Singleton = 'SINGLETON',\n}\n\nexport const DesignDependenciesKey = 'design:dependencies';\n","import type { SourceType, ServiceBuilder, ServiceDescriptor, ServiceIdentifier, ServiceModuleType, ServiceCollectionOptions } 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 IServiceScope {\n public abstract resolve<T extends SourceType>(identifier: ServiceIdentifier<T>): T;\n public abstract resolveAll<T extends SourceType>(identifier: ServiceIdentifier<T>): T[];\n}\n\nexport abstract class IServiceProvider extends IServiceScope {\n public abstract get Services(): IServiceCollection;\n public abstract createScope(): IServiceProvider & IDisposable;\n}\n\nexport abstract class IServiceCollection {\n public abstract readonly options: ServiceCollectionOptions;\n public abstract get<T extends SourceType>(key: ServiceIdentifier<T>): ServiceDescriptor<T>[];\n public abstract register<T extends SourceType>(identifier: ServiceIdentifier<T>): ServiceBuilder<T>;\n public abstract registerModules(modules: ServiceModuleType[]): void;\n public abstract buildProvider(): IServiceProvider;\n public abstract clone(): IServiceCollection;\n}\n","import '@abraham/reflection';\nimport type { MetadataType, SourceType } from './types';\n\nexport const getMetadata = <T extends SourceType>(key: string, obj: object): MetadataType<T> | undefined => {\n if (Reflect.getMetadata === undefined) {\n throw new Error('Please import \"reflect-metadata\"');\n }\n const result = Reflect.getMetadata(key, obj);\n if (result === undefined) {\n return undefined;\n }\n return result as MetadataType<T>;\n};\n\nexport const defineMetadata = <T extends SourceType>(key: string, metadata: MetadataType<T>, obj: object) => {\n if (Reflect.defineMetadata === undefined) {\n throw new Error('Please import \"reflect-metadata\"');\n }\n Reflect.defineMetadata(key, metadata, obj);\n};\n","import type { Lifetime } from './constants';\nimport type { IServiceModule, IServiceProvider, IServiceScope } from './interfaces';\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>;\n\nexport type InstanceFactory<T extends SourceType> = (x: IServiceScope & IServiceProvider) => T;\n\nexport type ServiceModuleType = Newable<IServiceModule>;\n\nexport type ServiceDescriptorFactory<T extends SourceType> = {\n implementation: ServiceIdentifier<T>;\n factory: InstanceFactory<T>;\n lifetime: Lifetime;\n};\nexport type ServiceDescriptorConcrete<T extends SourceType> = {\n implementation: ServiceImplementation<T>;\n lifetime: Lifetime;\n};\n\nexport type ServiceDescriptor<T extends SourceType> = ServiceDescriptorConcrete<T> | ServiceDescriptorFactory<T>;\n// export type ServiceDescriptor<T extends SourceType> = {\n// implementation: ServiceImplementation<T>;\n// factory?: InstanceFactory<T>;\n// lifetime: Lifetime;\n// };\n\nexport type LifetimeBuilder = {\n singleton: () => LifetimeBuilder;\n scoped: () => LifetimeBuilder;\n transient: () => LifetimeBuilder;\n};\nexport type ServiceBuilder<T extends SourceType> = {\n to: {\n (implementation: ServiceImplementation<T>): LifetimeBuilder;\n (implementation: ServiceIdentifier<T>, factory: InstanceFactory<T>): LifetimeBuilder;\n };\n};\n\nexport type MetadataType<T extends SourceType> = Record<string | symbol, ServiceIdentifier<T>>;\n\nexport const ResolveMultipleMode = {\n Error: 'ERROR',\n LastRegistered: 'LAST_REGISTERED',\n} as const;\nexport type ResolveMultipleMode = (typeof ResolveMultipleMode)[keyof typeof ResolveMultipleMode];\n\nexport const DefaultServiceCollectionOptions: ServiceCollectionOptions = {\n registrationMode: ResolveMultipleMode.Error,\n};\n\nexport type ServiceCollectionOptions = {\n registrationMode: ResolveMultipleMode;\n};\n","import type { ServiceIdentifier } from './types';\n\nexport abstract class ServiceError extends Error {\n constructor(message: string) {\n super(message);\n }\n}\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}`);\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}`);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class ServiceCreationError<T extends object> extends ServiceError {\n name = 'ServiceCreationError';\n constructor(identifier: ServiceIdentifier<T>, public readonly innerError: any) {\n super(`Error creating service: ${identifier}`);\n Object.setPrototypeOf(this, new.target.prototype);\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","import { log } from './debug';\nimport { DesignDependenciesKey, Lifetime } from './constants';\nimport type { IDisposable, IServiceCollection} from './interfaces';\nimport { IServiceScope, IServiceProvider} from './interfaces';\nimport { getMetadata } from './metadata';\nimport type { ServiceIdentifier, ServiceDescriptor, ServiceImplementation, SourceType} from './types';\nimport { ResolveMultipleMode } from './types';\nimport { SelfDependencyError, MultipleRegistrationError, UnregisteredServiceError, ServiceCreationError } from './errors';\n\ntype Id<T extends SourceType> = ServiceIdentifier<T> | ServiceImplementation<T>;\n\ntype ResolveMap<T extends SourceType> = Map<ServiceIdentifier<T>, Map<Id<T>, T>>;\n\nconst createResolveMap = <T extends SourceType>(): ResolveMap<T> => new Map<ServiceIdentifier<T>, Map<ServiceImplementation<T>, T>>();\n\nexport class ServiceProvider implements IServiceProvider, IServiceScope {\n private scoped = createResolveMap();\n private created: IDisposable[] = [];\n\n constructor(\n private services: IServiceCollection,\n private singletons = createResolveMap(),\n ) {}\n \n public get Services(): IServiceCollection {\n return this.services;\n }\n\n [Symbol.dispose]() {\n this.created.forEach(x => x[Symbol.dispose]());\n }\n\n private resolveFrom<T extends SourceType>(\n identifier: ServiceIdentifier<T>,\n descriptor: ServiceDescriptor<T>,\n lifetimeMap: ResolveMap<T>,\n currentResolve: ResolveMap<T>\n ): T {\n let resolvedInstances = lifetimeMap.get(identifier);\n if (resolvedInstances === undefined) {\n resolvedInstances = new Map();\n lifetimeMap.set(identifier, resolvedInstances);\n }\n\n let instance = resolvedInstances.get(descriptor.implementation);\n if (instance === undefined) {\n instance = this.createInstance(descriptor, currentResolve);\n resolvedInstances.set(descriptor.implementation, instance);\n this.setDependencies<T>(descriptor.implementation, instance, currentResolve);\n }\n return instance;\n }\n\n private resolveInternal<T extends SourceType>(\n identifier: ServiceIdentifier<T>,\n descriptor: ServiceDescriptor<T>,\n currentResolve: ResolveMap<T>,\n ): T {\n const mapping: Partial<Record<Lifetime, ResolveMap<any>>> = {\n [Lifetime.Singleton]: this.singletons,\n [Lifetime.Scoped]: this.scoped,\n [Lifetime.Resolve]: currentResolve,\n };\n const sourceMap = mapping[descriptor.lifetime];\n if (sourceMap === undefined) {\n const instance = this.createInstance(descriptor, currentResolve);\n this.setDependencies<T>(descriptor.implementation, instance, currentResolve);\n return instance;\n }\n return this.resolveFrom(identifier, descriptor, sourceMap, currentResolve);\n }\n\n public resolveAll<T extends SourceType>(\n identifier: ServiceIdentifier<T>,\n currentResolve = createResolveMap<T>(),\n ): T[] {\n const descriptors = this.services.get(identifier);\n return descriptors.map(descriptor => this.resolveInternal<T>(identifier, descriptor, currentResolve));\n }\n\n public resolve<T extends SourceType>(\n identifier: ServiceIdentifier<T>,\n currentResolve = createResolveMap<T>(),\n ): T {\n if (identifier.prototype === IServiceScope.prototype || identifier.prototype === IServiceProvider.prototype) {\n return this as unknown as T;\n }\n\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 this.resolveInternal(identifier, descriptor, currentResolve);\n }\n\n private createInstance<T extends SourceType>(descriptor: ServiceDescriptor<T>, currentResolve: ResolveMap<T>): T {\n let instance: T;\n if ('factory' in descriptor) {\n const factory = descriptor.factory;\n const resolve = (identifier: ServiceIdentifier<any>) => this.resolve(identifier, currentResolve);\n const resolveAll = (identifier: ServiceIdentifier<any>) => this.resolveAll(identifier, currentResolve);\n const createScope = this.createScope.bind(this);\n\n // proxy requests to keep current resolved types\n instance = factory({\n resolve,\n resolveAll,\n createScope,\n get Services() { return this.Services; },\n });\n }\n else {\n try {\n instance = new descriptor.implementation();\n }\n catch (err) {\n throw new ServiceCreationError(descriptor.implementation, err);\n }\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(): IServiceProvider & IDisposable {\n return new ServiceProvider(this.services.clone(), this.singletons);\n }\n\n private setDependencies<T extends SourceType>(\n type: Id<T>,\n instance: T,\n currentResolve: ResolveMap<T>,\n ): T {\n const dependencies = getMetadata<T>(DesignDependenciesKey, type) ?? {};\n log('Dependencies', type.name, dependencies);\n for (const [key, identifier] of Object.entries(dependencies)) {\n if (identifier !== type) {\n log('Resolving', identifier, 'for', type.name);\n const dep = this.resolve(identifier, currentResolve);\n (instance as Record<string, unknown>)[key] = dep;\n } else {\n throw new SelfDependencyError();\n }\n }\n return instance;\n }\n}\n","import { ServiceProvider } from './ServiceProvider';\nimport type { SourceType, InstanceFactory, ServiceBuilder, ServiceDescriptor, ServiceIdentifier, ServiceImplementation, Newable, ServiceCollectionOptions } from './types';\nimport type { IServiceCollection, IServiceModule, IServiceProvider } from './interfaces';\nimport { Lifetime } from './constants';\nimport { log } from './debug';\n\nexport class ServiceCollection implements IServiceCollection {\n constructor(public readonly options: ServiceCollectionOptions, private readonly services = new Map<ServiceIdentifier<any>, ServiceDescriptor<any>[]>()) {\n }\n \n public registerModules(modules: Newable<IServiceModule>[]): void {\n modules.forEach(x => {\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 register<T extends SourceType>(identifier: ServiceIdentifier<T>): ServiceBuilder<T> {\n return {\n // to: (implementation: ServiceImplementation<T>, func?: InstanceFactory<T>) => {\n to: (implementation: ServiceImplementation<T> | ServiceIdentifier<T>, factory?: InstanceFactory<T>) => {\n const descriptor: ServiceDescriptor<T>= (factory === undefined) ? { implementation: implementation as ServiceImplementation<T>, lifetime: Lifetime.Resolve } : { implementation, factory, lifetime: Lifetime.Resolve };\n this.addService(identifier, descriptor);\n const builder = {\n singleton: () => { descriptor.lifetime = Lifetime.Singleton; return builder; },\n scoped: () => { descriptor.lifetime = Lifetime.Scoped; return builder; },\n transient: () => { descriptor.lifetime = Lifetime.Transient; return builder; },\n };\n return builder;\n },\n };\n }\n\n private addService<T extends SourceType>(identifier: ServiceIdentifier<T>, descriptor: ServiceDescriptor<T>) {\n log('Adding service', { identifier, 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(): IServiceCollection {\n const clonedMap = new Map<ServiceIdentifier<any>, ServiceDescriptor<any>[]>();\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.options, clonedMap);\n }\n\n public buildProvider(): IServiceProvider {\n const cloned = this.clone(); \n return new ServiceProvider(cloned);\n }\n}\n","import type { IServiceCollection } from './interfaces';\nimport { ServiceCollection } from './ServiceCollection';\nimport type { ServiceCollectionOptions } from './types';\nimport { DefaultServiceCollectionOptions } from './types';\n\nconst mergeOptions = (options: Partial<ServiceCollectionOptions> | undefined): ServiceCollectionOptions => ({\n ...DefaultServiceCollectionOptions,\n ...options,\n});\n\nexport const createServiceCollection = (options?: Partial<ServiceCollectionOptions>): IServiceCollection => new ServiceCollection(mergeOptions(options)) as IServiceCollection;\n","import { DesignDependenciesKey } from './constants';\nimport type { ServiceIdentifier, SourceType } from './types';\nimport { defineMetadata, getMetadata } from './metadata';\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\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"],"names":["__defProp","__defNormalProp","__publicField"],"mappings":";;AACA,IAAIA,WAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAIC,iBAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAGD,WAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAIE,eAAa,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAKD,iBAAe,CAAC,GAAG,EAA4B,GAAG,GAAG,EAAE,CAAM,EAAE,KAAK,CAAC,CAAC;AAC/G,MAAM,WAAW,CAAC;AAClB,EAAE,WAAW,GAAG;AAChB,IAAIC,eAAa,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;AAC5C,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;AAC1B,GAAG;AACH,EAAE,OAAO,GAAG;AACZ,IAAI,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;AAC3B,GAAG;AACH,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,cAAc,EAAE;AAClC,IAAI,IAAI,IAAI,CAAC,SAAS,EAAE;AACxB,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,cAAc,CAAC,CAAC;AAC9C,KAAK;AACL,GAAG;AACH,CAAC;AACD,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;AAC1B,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,I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