@chromahq/core 0.1.10 → 0.1.11

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,28 +1,9 @@
1
- 'use strict';
1
+ import { Container } from '@inversifyjs/container';
2
+ import { J as JobState, T as TOKENS } from './IJob-aWBqI3FC.js';
2
3
 
3
- function e(e){return ("object"==typeof e&&null!==e||"function"==typeof e)&&"function"==typeof e.then}function t$2(e){switch(typeof e){case "string":case "symbol":return e.toString();case "function":return e.name;default:throw new Error(`Unexpected ${typeof e} service id type`)}}const n$1=Symbol.for("@inversifyjs/common/islazyServiceIdentifier");class r{[n$1];#e;constructor(e){this.#e=e,this[n$1]=true;}static is(e){return "object"==typeof e&&null!==e&&true===e[n$1]}unwrap(){return this.#e()}}
4
-
5
- function t$1(t,e){return Reflect.getOwnMetadata(e,t)}function n(t,e,n){Reflect.defineMetadata(e,n,t);}function a(e,n,a,f){const c=f(t$1(e,n)??a());Reflect.defineMetadata(n,c,e);}
6
-
7
- const s="@inversifyjs/container/bindingId";function c(){const i=t$1(Object,s)??0;return i===Number.MAX_SAFE_INTEGER?n(Object,s,Number.MIN_SAFE_INTEGER):a(Object,s,(()=>i),(e=>e+1)),i}const u={Request:"Request",Singleton:"Singleton",Transient:"Transient"},d={ConstantValue:"ConstantValue",DynamicValue:"DynamicValue",Factory:"Factory",Instance:"Instance",Provider:"Provider",ResolvedValue:"ResolvedValue",ServiceRedirection:"ServiceRedirection"};function*l(...e){for(const t of e)yield*t;}class p{#e;#t;#n;constructor(e){this.#e=new Map,this.#t={};for(const t of Reflect.ownKeys(e))this.#t[t]=new Map;this.#n=e;}add(e,t){this.#i(e).push(t);for(const n of Reflect.ownKeys(t))this.#o(n,t[n]).push(e);}clone(){const e=this.#r(),t=this.#a(),n=Reflect.ownKeys(this.#n),i=this._buildNewInstance(this.#n);this.#s(this.#e,i.#e,e,t);for(const t of n)this.#c(this.#t[t],i.#t[t],e);return i}get(e,t){return this.#t[e].get(t)}getAllKeys(e){return this.#t[e].keys()}removeByRelation(e,t){const n=this.get(e,t);if(void 0===n)return;const i=new Set(n);for(const n of i){const i=this.#e.get(n);if(void 0===i)throw new Error("Expecting model relation, none found");for(const o of i)o[e]===t&&this.#u(n,o);this.#e.delete(n);}}_buildNewInstance(e){return new p(e)}_cloneModel(e){return e}_cloneRelation(e){return e}#r(){const e=new Map;for(const t of this.#e.keys()){const n=this._cloneModel(t);e.set(t,n);}return e}#a(){const e=new Map;for(const t of this.#e.values())for(const n of t){const t=this._cloneRelation(n);e.set(n,t);}return e}#i(e){let t=this.#e.get(e);return void 0===t&&(t=[],this.#e.set(e,t)),t}#o(e,t){let n=this.#t[e].get(t);return void 0===n&&(n=[],this.#t[e].set(t,n)),n}#d(e,t){const n=t.get(e);if(void 0===n)throw new Error("Expecting model to be cloned, none found");return n}#l(e,t){const n=t.get(e);if(void 0===n)throw new Error("Expecting relation to be cloned, none found");return n}#c(e,t,n){for(const[i,o]of e){const e=new Array;for(const t of o)e.push(this.#d(t,n));t.set(i,e);}}#s(e,t,n,i){for(const[o,r]of e){const e=new Array;for(const t of r)e.push(this.#l(t,i));t.set(this.#d(o,n),e);}}#u(e,t){for(const n of Reflect.ownKeys(t))this.#p(e,n,t[n]);}#p(e,t,n){const i=this.#t[t].get(n);if(void 0!==i){const o=i.indexOf(e);-1!==o&&i.splice(o,1),0===i.length&&this.#t[t].delete(n);}}}var f,g,h;!function(e){e.moduleId="moduleId",e.serviceId="serviceId";}(f||(f={}));let m$1 = class m{#f;#g;constructor(e,t){this.#f=t??new p({moduleId:{isOptional:true},serviceId:{isOptional:false}}),this.#g=e;}static build(e){return new m(e)}add(e,t){this.#f.add(e,t);}clone(){return new m(this.#g,this.#f.clone())}get(e){const t=[],n=this.#f.get(f.serviceId,e);void 0!==n&&t.push(n);const i=this.#g?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return l(...t)}removeAllByModuleId(e){this.#f.removeByRelation(f.moduleId,e);}removeAllByServiceId(e){this.#f.removeByRelation(f.serviceId,e);}};function v(e){return e.isRight?{isRight:true,value:e.value}:e}function y(e){switch(e.type){case d.ConstantValue:case d.DynamicValue:return function(e){return {cache:v(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type,value:e.value}}(e);case d.Factory:return function(e){return {cache:v(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case d.Instance:return function(e){return {cache:v(e.cache),id:e.id,implementationType:e.implementationType,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case d.Provider:return function(e){return {cache:v(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,provider:e.provider,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case d.ResolvedValue:return function(e){return {cache:v(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,metadata:e.metadata,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case d.ServiceRedirection:return function(e){return {id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,serviceIdentifier:e.serviceIdentifier,targetServiceIdentifier:e.targetServiceIdentifier,type:e.type}}(e)}}!function(e){e.id="id",e.moduleId="moduleId",e.serviceId="serviceId";}(g||(g={}));class M extends p{_buildNewInstance(e){return new M(e)}_cloneModel(e){return y(e)}}let I$1 = class I{#h;#g;constructor(e,t){this.#h=t??new M({id:{isOptional:false},moduleId:{isOptional:true},serviceId:{isOptional:false}}),this.#g=e;}static build(e){return new I(e)}clone(){return new I(this.#g,this.#h.clone())}get(e){return this.getNonParentBindings(e)??this.#g?.get(e)}getBoundServices(){const e=new Set(this.#h.getAllKeys(g.serviceId));if(void 0!==this.#g)for(const t of this.#g.getBoundServices())e.add(t);return e}getById(e){return this.#h.get(g.id,e)??this.#g?.getById(e)}getByModuleId(e){return this.#h.get(g.moduleId,e)??this.#g?.getByModuleId(e)}getNonParentBindings(e){return this.#h.get(g.serviceId,e)}getNonParentBoundServices(){return this.#h.getAllKeys(g.serviceId)}removeById(e){this.#h.removeByRelation(g.id,e);}removeAllByModuleId(e){this.#h.removeByRelation(g.moduleId,e);}removeAllByServiceId(e){this.#h.removeByRelation(g.serviceId,e);}set(e){const t={[g.id]:e.id,[g.serviceId]:e.serviceIdentifier};void 0!==e.moduleId&&(t[g.moduleId]=e.moduleId),this.#h.add(e,t);}};!function(e){e.moduleId="moduleId",e.serviceId="serviceId";}(h||(h={}));class w{#m;#g;constructor(e,t){this.#m=t??new p({moduleId:{isOptional:true},serviceId:{isOptional:false}}),this.#g=e;}static build(e){return new w(e)}add(e,t){this.#m.add(e,t);}clone(){return new w(this.#g,this.#m.clone())}get(e){const t=[],n=this.#m.get(h.serviceId,e);void 0!==n&&t.push(n);const i=this.#g?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return l(...t)}removeAllByModuleId(e){this.#m.removeByRelation(h.moduleId,e);}removeAllByServiceId(e){this.#m.removeByRelation(h.serviceId,e);}}function b(e,t,n){const i=Array.isArray(e)?e:[e];if(void 0!==n)if("number"!=typeof n)Reflect.decorate(i,t.prototype,n);else for(const e of i)e(t,void 0,n);else Reflect.decorate(i,t);}const S="@inversifyjs/core/classMetadataReflectKey";function j$1(){return {constructorArguments:[],lifecycle:{postConstructMethodName:void 0,preDestroyMethodName:void 0},properties:new Map,scope:void 0}}const R="@inversifyjs/core/pendingClassMetadataCountReflectKey";const T$1=Symbol.for("@inversifyjs/core/InversifyCoreError");let A$1 = class A extends Error{[T$1];kind;constructor(e,t,n){super(t,n),this[T$1]=true,this.kind=e;}static is(e){return "object"==typeof e&&null!==e&&true===e[T$1]}static isErrorOfKind(e,t){return A.is(e)&&e.kind===t}};var C$1,B$1,$$1;function x$1(t){const n=t$1(t,S)??j$1();if(!function(t){const n=t$1(t,R);return void 0!==n&&0!==n}(t))return function(e,t){const n=[];if(t.length<e.length)throw new A$1(C$1.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}". "${e.name}" constructor requires at least ${e.length.toString()} arguments, found ${t.length.toString()} instead.\nAre you using @inject, @multiInject or @unmanaged decorators in every non optional constructor argument?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`);for(let e=0;e<t.length;++e) void 0===t[e]&&n.push(e);if(n.length>0)throw new A$1(C$1.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}" at constructor indexes "${n.join('", "')}".\n\nAre you using @inject, @multiInject or @unmanaged decorators at those indexes?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`)}(t,n.constructorArguments),n;!function(e,t){const n=[];for(let i=0;i<t.constructorArguments.length;++i){const o=t.constructorArguments[i];void 0!==o&&o.kind!==B$1.unknown||n.push(` - Missing or incomplete metadata for type "${e.name}" at constructor argument with index ${i.toString()}.\nEvery constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`);}for(const[i,o]of t.properties)o.kind===B$1.unknown&&n.push(` - Missing or incomplete metadata for type "${e.name}" at property "${i.toString()}".\nThis property must be decorated either with @inject or @multiInject decorator.`);if(0===n.length)throw new A$1(C$1.unknown,`Unexpected class metadata for type "${e.name}" with uncompletion traces.\nThis might be caused by one of the following reasons:\n\n1. A third party library is targeting inversify reflection metadata.\n2. A bug is causing the issue. Consider submiting an issue to fix it.`);throw new A$1(C$1.missingInjectionDecorator,`Invalid class metadata at type ${e.name}:\n\n${n.join("\n\n")}`)}(t,n);}function D$1(){return 0}function k$1(e){return t=>{ void 0!==t&&t.kind===B$1.unknown&&a(e,R,D$1,(e=>e-1));}}function P$1(e,t){return (...n)=>i=>{if(void 0===i)return e(...n);if(i.kind===$$1.unmanaged)throw new A$1(C$1.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");return t(i,...n)}}function O$1(e){if(e.kind!==B$1.unknown&&true!==e.isFromTypescriptParamType)throw new A$1(C$1.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found")}!function(e){e[e.injectionDecoratorConflict=0]="injectionDecoratorConflict",e[e.missingInjectionDecorator=1]="missingInjectionDecorator",e[e.planning=2]="planning",e[e.resolution=3]="resolution",e[e.unknown=4]="unknown";}(C$1||(C$1={})),function(e){e[e.unknown=32]="unknown";}(B$1||(B$1={})),function(e){e[e.multipleInjection=0]="multipleInjection",e[e.singleInjection=1]="singleInjection",e[e.unmanaged=2]="unmanaged";}($$1||($$1={}));const V$1=P$1((function(e,t){return {kind:e,name:void 0,optional:false,tags:new Map,value:t}}),(function(e,t,n){return O$1(e),{...e,kind:t,value:n}}));function F$1(e,t){return n=>{const i=n.properties.get(t);return n.properties.set(t,e(i)),n}}var E$1;function N$1(e,t,n,i){if(A$1.isErrorOfKind(i,C$1.injectionDecoratorConflict)){const o=function(e,t,n){if(void 0===n){if(void 0===t)throw new A$1(C$1.unknown,"Unexpected undefined property and index values");return {kind:E$1.property,property:t,targetClass:e.constructor}}return "number"==typeof n?{index:n,kind:E$1.parameter,targetClass:e}:{kind:E$1.method,method:t,targetClass:e}}(e,t,n);throw new A$1(C$1.injectionDecoratorConflict,`Unexpected injection error.\n\nCause:\n\n${i.message}\n\nDetails\n\n${function(e){switch(e.kind){case E$1.method:return `[class: "${e.targetClass.name}", method: "${e.method.toString()}"]`;case E$1.parameter:return `[class: "${e.targetClass.name}", index: "${e.index.toString()}"]`;case E$1.property:return `[class: "${e.targetClass.name}", property: "${e.property.toString()}"]`}}(o)}`,{cause:i})}throw i}function U$1(e,t){return (i,o,r)=>{try{void 0===r?function(e,t){const i=K$1(e,t);return (e,t)=>{a(e.constructor,S,j$1,F$1(i(e),t));}}(e,t)(i,o):"number"==typeof r?function(e,t){const i=K$1(e,t);return (e,t,o)=>{if(!function(e,t){return "function"==typeof e&&void 0===t}(e,t))throw new A$1(C$1.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.\nFound @inject decorator at method "${t?.toString()??""}" at class "${e.constructor.name}"`);a(e,S,j$1,function(e,t){return n=>{const i=n.constructorArguments[t];return n.constructorArguments[t]=e(i),n}}(i(e),o));}}(e,t)(i,o,r):function(e,t){const i=K$1(e,t);return (e,t,o)=>{if(!function(e){return void 0!==e.set}(o))throw new A$1(C$1.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.\nFound @inject decorator at method "${t.toString()}" at class "${e.constructor.name}"`);a(e.constructor,S,j$1,F$1(i(e),t));}}(e,t)(i,o,r);}catch(e){N$1(i,o,r,e);}}}function K$1(e,t){return n=>{const i=t(n);return t=>(i(t),e(t))}}function _$1(e){return U$1(V$1($$1.singleInjection,e),k$1)}!function(e){e[e.method=0]="method",e[e.parameter=1]="parameter",e[e.property=2]="property";}(E$1||(E$1={}));const q$1="@inversifyjs/core/classIsInjectableFlagReflectKey";const z$1=[Array,BigInt,Boolean,Function,Number,Object,String];function G$1(t){const i=t$1(t,"design:paramtypes");void 0!==i&&a(t,S,j$1,function(e){return t=>(e.forEach(((e,n)=>{var i;void 0!==t.constructorArguments[n]||(i=e,z$1.includes(i))||(t.constructorArguments[n]=function(e){return {isFromTypescriptParamType:true,kind:$$1.singleInjection,name:void 0,optional:false,tags:new Map,value:e}}(e));})),t)}(i));}function L$1(i){return o=>{!function(n$1){if(void 0!==t$1(n$1,q$1))throw new A$1(C$1.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class "${n$1.name}"`);n(n$1,q$1,true);}(o),G$1(o);}}var ue;!function(e){e[e.multipleInjection=0]="multipleInjection",e[e.singleInjection=1]="singleInjection";}(ue||(ue={}));class de{#v;constructor(e){this.#v=e;}get name(){return this.#v.elem.name}get serviceIdentifier(){return this.#v.elem.serviceIdentifier}get tags(){return this.#v.elem.tags}getAncestor(){if(void 0!==this.#v.previous)return new de(this.#v.previous)}}class le{last;constructor(e){this.last=e;}concat(e){return new le({elem:e,previous:this.last})}[Symbol.iterator](){let e=this.last;return {next:()=>{if(void 0===e)return {done:true,value:void 0};const t=e.elem;return e=e.previous,{done:false,value:t}}}}}function pe(e,t,n){const i=n?.customServiceIdentifier??t.serviceIdentifier,o=[...e.getBindings(i)??[]].filter((e=>e.isSatisfiedBy(t)));if(0===o.length&&void 0!==e.autobindOptions&&"function"==typeof i){const t=function(e,t){const n=x$1(t),i=n.scope??e.scope;return {cache:{isRight:false,value:void 0},id:c(),implementationType:t,isSatisfiedBy:()=>true,moduleId:void 0,onActivation:void 0,onDeactivation:void 0,scope:i,serviceIdentifier:t,type:d.Instance}}(e.autobindOptions,i);e.setBinding(t),o.push(t);}return o}function fe(e){return void 0!==e.redirections}function ge(e,t,n,i){let r,a;fe(n)?(r=n.binding.targetServiceIdentifier,a=n.binding.serviceIdentifier):(r=n.serviceIdentifier,a=n.parent?.binding.serviceIdentifier),Array.isArray(e)?function(e,t,n,i,r){if(0!==e.length){const t=`Ambiguous bindings found for service: "${t$2(n)}".\n\nRegistered bindings:\n\n${e.map((e=>function(e){switch(e.type){case d.Instance:return `[ type: "${e.type}", serviceIdentifier: "${t$2(e.serviceIdentifier)}", scope: "${e.scope}", implementationType: "${e.implementationType.name}" ]`;case d.ServiceRedirection:return `[ type: "${e.type}", serviceIdentifier: "${t$2(e.serviceIdentifier)}", redirection: "${t$2(e.targetServiceIdentifier)}" ]`;default:return `[ type: "${e.type}", serviceIdentifier: "${t$2(e.serviceIdentifier)}", scope: "${e.scope}" ]`}}(e.binding))).join("\n")}\n\nTrying to resolve bindings for "${me(n,i)}".\n\n${ve(r)}`;throw new A$1(C$1.planning,t)}t||he(n,i,r);}(e,t,r,a,i):function(e,t,n,i,o){if(void 0!==e||t)return;he(n,i,o);}(e,t,r,a,i);}function he(e,t,n){const i=`No bindings found for service: "${t$2(e)}".\n\nTrying to resolve bindings for "${me(e,t)}".\n\n${ve(n)}`;throw new A$1(C$1.planning,i)}function me(e,t){return void 0===t?`${t$2(e)} (Root service)`:t$2(t)}function ve(e){const t=0===e.tags.size?"":`\n- tags:\n - ${[...e.tags.keys()].map((e=>e.toString())).join("\n - ")}`;return `Binding constraints:\n- service identifier: ${t$2(e.serviceIdentifier)}\n- name: ${e.name?.toString()??"-"}${t}`}function ye(e,t,n){if(1!==e.redirections.length)ge(e.redirections,t,e,n);else {const[i]=e.redirections;fe(i)&&ye(i,t,n);}}function Me(e,t,n){if(Array.isArray(e.bindings)&&1===e.bindings.length){const[i]=e.bindings;fe(i)&&ye(i,t,n);}else ge(e.bindings,t,e,n);}function Ie(e,t){if(function(e){return e instanceof Error&&(e instanceof RangeError&&/stack space|call stack|too much recursion/i.test(e.message)||"InternalError"===e.name&&/too much recursion/.test(e.message))}(t)){const n=function(e){const t=[...e];if(0===t.length)return "(No dependency trace)";return t.map(t$2).join(" -> ")}(function(e){const t=new Set;for(const n of e.servicesBranch){if(t.has(n))return [...t,n];t.add(n);}return [...t]}(e));throw new A$1(C$1.planning,`Circular dependency found: ${n}`,{cause:t})}throw t}function we(e){try{const t=new Map;void 0!==e.rootConstraints.tag&&t.set(e.rootConstraints.tag.key,e.rootConstraints.tag.value);const n=new le({elem:{name:e.rootConstraints.name,serviceIdentifier:e.rootConstraints.serviceIdentifier,tags:t},previous:void 0}),i=new de(n.last),o=pe(e,i),r=[],a={bindings:r,parent:void 0,serviceIdentifier:e.rootConstraints.serviceIdentifier};if(r.push(...Te(e,n,o,a)),!e.rootConstraints.isMultiple){Me(a,e.rootConstraints.isOptional??!1,i);const[t]=r;a.bindings=t;}return {tree:{root:a}}}catch(t){Ie(e,t);}}function be(e,t,n,i){const o={binding:t,classMetadata:e.getClassMetadata(t.implementationType),constructorParams:[],parent:i,propertyParams:new Map};return Ce({autobindOptions:e.autobindOptions,getBindings:e.getBindings,getClassMetadata:e.getClassMetadata,node:o,servicesBranch:e.servicesBranch,setBinding:e.setBinding},n)}function Se(e,t,n){if(n.kind===$$1.unmanaged)return;const i=r.is(n.value)?n.value.unwrap():n.value,o=t.concat({name:n.name,serviceIdentifier:i,tags:n.tags}),a=new de(o.last),s=pe(e,a),c=[],u={bindings:c,parent:e.node,serviceIdentifier:i};if(c.push(...Te(e,o,s,u)),n.kind===$$1.singleInjection){Me(u,n.optional,a);const[e]=c;u.bindings=e;}return u}function je(e,t,n){const i=r.is(n.value)?n.value.unwrap():n.value,o=t.concat({name:n.name,serviceIdentifier:i,tags:n.tags}),a=new de(o.last),s=pe(e,a),c=[],u={bindings:c,parent:e.node,serviceIdentifier:i};if(c.push(...Te(e,o,s,u)),n.kind===ue.singleInjection){Me(u,n.optional,a);const[e]=c;u.bindings=e;}return u}function Re(e,t,n,i){const o={binding:t,params:[],parent:i};return Ce({autobindOptions:e.autobindOptions,getBindings:e.getBindings,getClassMetadata:e.getClassMetadata,node:o,servicesBranch:e.servicesBranch,setBinding:e.setBinding},n)}function Te(e,t,n,i){const o=fe(i)?i.binding.targetServiceIdentifier:i.serviceIdentifier;e.servicesBranch.push(o);const r=[];for(const o of n)switch(o.type){case d.Instance:r.push(be(e,o,t,i));break;case d.ResolvedValue:r.push(Re(e,o,t,i));break;case d.ServiceRedirection:{const n=Ae(e,t,o,i);r.push(n);break}default:r.push({binding:o,parent:i});}return e.servicesBranch.pop(),r}function Ae(e,t,n,i){const o={binding:n,parent:i,redirections:[]},r=pe(e,new de(t.last),{customServiceIdentifier:n.targetServiceIdentifier});return o.redirections.push(...Te(e,t,r,o)),o}function Ce(e,t){return e.node.binding.type===d.Instance?function(e,t,n){const i=t.classMetadata;for(const[o,r]of i.constructorArguments.entries())t.constructorParams[o]=Se(e,n,r);for(const[o,r]of i.properties){const i=Se(e,n,r);void 0!==i&&t.propertyParams.set(o,i);}return e.node}(e,e.node,t):function(e,t,n){const i=t.binding.metadata;for(const[o,r]of i.arguments.entries())t.params[o]=je(e,n,r);return e.node}(e,e.node,t)}class Be{#y;#M;#I;constructor(){this.#y=[],this.#M=8,this.#I=1024;}*[Symbol.iterator](){let e=0;for(const t of this.#y){const n=t.deref();void 0===n?++e:yield n;}this.#y.length>=this.#M&&this.#w(e)&&this.#b(e);}push(e){const t=new WeakRef(e);if(this.#y.push(t),this.#y.length>=this.#M&&this.#y.length%this.#I===0){let e=0;for(const t of this.#y) void 0===t.deref()&&++e;this.#w(e)&&this.#b(e);}}#b(e){const t=new Array(this.#y.length-e);let n=0;for(const e of this.#y)e.deref()&&(t[n++]=e);this.#y=t;}#w(e){return e>=.5*this.#y.length}}var $e;!function(e){e[e.singleMandatory=0]="singleMandatory",e[e.singleOptional=1]="singleOptional",e[e.multipleMandatory=2]="multipleMandatory",e[e.multipleOptional=3]="multipleOptional",e[e.length=4]="length";}($e||($e={}));class xe{#S;#j;#R;#T;#A;constructor(){this.#S=this.#C(),this.#j=this.#C(),this.#R=this.#C(),this.#T=this.#C(),this.#A=new Be;}clearCache(){for(const e of this.#B())e.clear();for(const e of this.#A)e.clearCache();}get(e){return void 0===e.name?void 0===e.tag?this.#$(this.#S,e).get(e.serviceIdentifier):this.#$(this.#T,e).get(e.serviceIdentifier)?.get(e.tag.key)?.get(e.tag.value):void 0===e.tag?this.#$(this.#j,e).get(e.serviceIdentifier)?.get(e.name):this.#$(this.#R,e).get(e.serviceIdentifier)?.get(e.name)?.get(e.tag.key)?.get(e.tag.value)}set(e,t){ void 0===e.name?void 0===e.tag?this.#$(this.#S,e).set(e.serviceIdentifier,t):this.#x(this.#x(this.#$(this.#T,e),e.serviceIdentifier),e.tag.key).set(e.tag.value,t):void 0===e.tag?this.#x(this.#$(this.#j,e),e.serviceIdentifier).set(e.name,t):this.#x(this.#x(this.#x(this.#$(this.#R,e),e.serviceIdentifier),e.name),e.tag.key).set(e.tag.value,t);}subscribe(e){this.#A.push(e);}#C(){const e=new Array($e.length);for(let t=0;t<e.length;++t)e[t]=new Map;return e}#x(e,t){let n=e.get(t);return void 0===n&&(n=new Map,e.set(t,n)),n}#$(e,t){return e[this.#D(t)]}#B(){return [...this.#S,...this.#j,...this.#R,...this.#T]}#D(e){return e.isMultiple?true===e.optional?$e.multipleOptional:$e.multipleMandatory:true===e.optional?$e.singleOptional:$e.singleMandatory}}function De(e$1,t){return e(t)?(e$1.cache={isRight:true,value:t},t.then((t=>ke(e$1,t)))):ke(e$1,t)}function ke(e,t){return e.cache={isRight:true,value:t},t}function Pe(e$1,t,n){const i=e$1.getActivations(t);return void 0===i?n:e(n)?Oe(e$1,n,i[Symbol.iterator]()):function(e$1,t,n){let i=t,o=n.next();for(;true!==o.done;){const t=o.value(e$1.context,i);if(e(t))return Oe(e$1,t,n);i=t,o=n.next();}return i}(e$1,n,i[Symbol.iterator]())}async function Oe(e,t,n){let i=await t,o=n.next();for(;true!==o.done;)i=await o.value(e.context,i),o=n.next();return i}function Ve(e$1,t,n){let i=n;if(void 0!==t.onActivation){const n=t.onActivation;i=e(i)?i.then((t=>n(e$1.context,t))):n(e$1.context,i);}return Pe(e$1,t.serviceIdentifier,i)}function Fe(e){return (t,n)=>{if(n.cache.isRight)return n.cache.value;return De(n,Ve(t,n,e(t,n)))}}const Ee=Fe((function(e,t){return t.value}));function Ne(e){return e}function Ue(e,t){return (n,i)=>{const o=e(i);switch(o.scope){case u.Singleton:if(o.cache.isRight)return o.cache.value;return De(o,Ve(n,o,t(n,i)));case u.Request:{if(n.requestScopeCache.has(o.id))return n.requestScopeCache.get(o.id);const e=Ve(n,o,t(n,i));return n.requestScopeCache.set(o.id,e),e}case u.Transient:return Ve(n,o,t(n,i))}}}const Ke=(e=>Ue(Ne,e))((function(e,t){return t.value(e.context)}));const _e=Fe((function(e,t){return t.factory(e.context)}));function qe(e$1,t,n){const i=function(e$1,t,n){if(void 0===n)return;if(!(n in e$1))throw new A$1(C$1.resolution,`Expecting a "${n.toString()}" property when resolving "${t.implementationType.name}" class @postConstruct decorated method, none found.`);if("function"!=typeof e$1[n])throw new A$1(C$1.resolution,`Expecting a "${n.toString()}" method when resolving "${t.implementationType.name}" class @postConstruct decorated method, a non function property was found instead.`);{let i;try{i=e$1[n]();}catch(e){throw new A$1(C$1.resolution,`Unexpected error found when calling "${n.toString()}" @postConstruct decorated method on class "${t.implementationType.name}"`,{cause:e})}if(e(i))return async function(e,t,n){try{await n;}catch(n){throw new A$1(C$1.resolution,`Unexpected error found when calling "${t.toString()}" @postConstruct decorated method on class "${e.implementationType.name}"`,{cause:n})}}(t,n,i)}}(e$1,t,n);return e(i)?i.then((()=>e$1)):e$1}function ze(e$1){return (t,n,i)=>{const o=new i.binding.implementationType(...t),r=e$1(n,o,i);return e(r)?r.then((()=>qe(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName))):qe(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName)}}const Ge=Fe((function(e,t){return t.provider(e.context)}));function Le(e){return e.binding}function We(e){return e.binding}const Xe=function(e$1){return (t,n,i)=>{const o=[];for(const[r,s]of i.propertyParams){const c=i.classMetadata.properties.get(r);if(void 0===c)throw new A$1(C$1.resolution,`Expecting metadata at property "${r.toString()}", none found`);c.kind!==$$1.unmanaged&&void 0!==s.bindings&&(n[r]=e$1(t,s),e(n[r])&&o.push((async()=>{n[r]=await n[r];})()));}if(o.length>0)return Promise.all(o).then((()=>{}))}}(nt),He=function(e){return function t(n,i){const o=[];for(const r of i.redirections)fe(r)?o.push(...t(n,r)):o.push(e(n,r));return o}}(tt),Je=function(e$1,t,n){return (i,o)=>{const r=e$1(i,o);return e(r)?t(r,i,o):n(r,i,o)}}(function(e$1){return (t,n)=>{const i=[];for(const o of n.constructorParams) void 0===o?i.push(void 0):i.push(e$1(t,o));return i.some(e)?Promise.all(i):i}}(nt),function(e){return async(t,n,i)=>{const o=await t;return e(o,n,i)}}(ze(Xe)),ze(Xe)),Qe=function(e$1){return (t,n)=>{const i=e$1(t,n);return e(i)?i.then((e=>n.binding.factory(...e))):n.binding.factory(...i)}}(function(e$1){return (t,n)=>{const i=[];for(const o of n.params)i.push(e$1(t,o));return i.some(e)?Promise.all(i):i}}(nt)),Ye=(e=>Ue(Le,e))(Je),Ze=(e=>Ue(We,e))(Qe);function et(e){return nt(e,e.planResult.tree.root)}function tt(e,t){switch(t.binding.type){case d.ConstantValue:return Ee(e,t.binding);case d.DynamicValue:return Ke(e,t.binding);case d.Factory:return _e(e,t.binding);case d.Instance:return Ye(e,t);case d.Provider:return Ge(e,t.binding);case d.ResolvedValue:return Ze(e,t)}}function nt(e$1,t){if(void 0!==t.bindings)return Array.isArray(t.bindings)?function(e$1,t){const n=[];for(const i of t)fe(i)?n.push(...He(e$1,i)):n.push(tt(e$1,i));if(n.some(e))return Promise.all(n);return n}(e$1,t.bindings):function(e,t){if(fe(t)){const n=He(e,t);if(1===n.length)return n[0];throw new A$1(C$1.resolution,"Unexpected multiple resolved values on single injection")}return tt(e,t)}(e$1,t.bindings)}function it(e){return void 0!==e.scope}function ot(e,t){if(void 0!==e.lifecycle.preDestroyMethodName&&"function"==typeof t[e.lifecycle.preDestroyMethodName])return t[e.lifecycle.preDestroyMethodName]()}function rt(e$1,t,n){const i=e$1.getDeactivations(t);if(void 0!==i)return e(n)?at(n,i[Symbol.iterator]()):function(e$1,t){let n=t.next();for(;true!==n.done;){const i=n.value(e$1);if(e(i))return at(e$1,t);n=t.next();}}(n,i[Symbol.iterator]())}async function at(e,t){const n=await e;let i=t.next();for(;true!==i.done;)await i.value(n),i=t.next();}function st(e$1,t){const n=function(e$1,t){if(t.type===d.Instance){const n=e$1.getClassMetadata(t.implementationType),i=t.cache.value;return e(i)?i.then((e=>ot(n,e))):ot(n,i)}}(e$1,t);return void 0===n?ct(e$1,t):n.then((()=>ct(e$1,t)))}function ct(e$1,t){const n=t.cache;return e(n.value)?n.value.then((n=>ut(e$1,t,n))):ut(e$1,t,n.value)}function ut(e,t,n){let i;if(void 0!==t.onDeactivation){i=(0, t.onDeactivation)(n);}return void 0===i?rt(e,t.serviceIdentifier,n):i.then((()=>rt(e,t.serviceIdentifier,n)))}function dt(e,t){if(void 0===t)return;const n=function(e){const t=[];for(const n of e)it(n)&&n.scope===u.Singleton&&n.cache.isRight&&t.push(n);return t}(t),i=[];for(const t of n){const n=st(e,t);void 0!==n&&i.push(n);}return i.length>0?Promise.all(i).then((()=>{})):void 0}function lt(e,t){const n=e.getBindingsFromModule(t);return dt(e,n)}function pt(e,t){const n=e.getBindings(t);return dt(e,n)}
8
-
9
- const t=Symbol.for("@inversifyjs/plugin/isPlugin");
10
-
11
- const m=Symbol.for("@inversifyjs/container/bindingIdentifier");function I(e){return "object"==typeof e&&null!==e&&true===e[m]}class A{static always=e=>true}function P(e){return {[m]:true,id:e.id}}function C(e){return n=>{for(let i=n.getAncestor();void 0!==i;i=i.getAncestor())if(e(i))return true;return false}}function B(e){return n=>n.name===e}function x(e){return n=>n.serviceIdentifier===e}function O(e,n){return i=>i.tags.has(e)&&i.tags.get(e)===n}function N(e){return void 0===e.name&&0===e.tags.size}function U(e){const n=C(e);return e=>!n(e)}function F(e){return n=>{const i=n.getAncestor();return void 0===i||!e(i)}}function k(e){return n=>{const i=n.getAncestor();return void 0!==i&&e(i)}}class j{#i;constructor(e){this.#i=e;}getIdentifier(){return P(this.#i)}inRequestScope(){return this.#i.scope=u.Request,new E(this.#i)}inSingletonScope(){return this.#i.scope=u.Singleton,new E(this.#i)}inTransientScope(){return this.#i.scope=u.Transient,new E(this.#i)}}class D{#t;#r;#a;#s;constructor(e,n,i,t){this.#t=e,this.#r=n,this.#a=i,this.#s=t;}to(e){const n=x$1(e),i={cache:{isRight:false,value:void 0},id:c(),implementationType:e,isSatisfiedBy:A.always,moduleId:this.#r,onActivation:void 0,onDeactivation:void 0,scope:n.scope??this.#a,serviceIdentifier:this.#s,type:d.Instance};return this.#t(i),new L(i)}toSelf(){if("function"!=typeof this.#s)throw new Error('"toSelf" function can only be applied when a newable function is used as service identifier');return this.to(this.#s)}toConstantValue(e){const n={cache:{isRight:false,value:void 0},id:c(),isSatisfiedBy:A.always,moduleId:this.#r,onActivation:void 0,onDeactivation:void 0,scope:u.Singleton,serviceIdentifier:this.#s,type:d.ConstantValue,value:e};return this.#t(n),new E(n)}toDynamicValue(e){const n={cache:{isRight:false,value:void 0},id:c(),isSatisfiedBy:A.always,moduleId:this.#r,onActivation:void 0,onDeactivation:void 0,scope:this.#a,serviceIdentifier:this.#s,type:d.DynamicValue,value:e};return this.#t(n),new L(n)}toResolvedValue(e,n){const i={cache:{isRight:false,value:void 0},factory:e,id:c(),isSatisfiedBy:A.always,metadata:this.#o(n),moduleId:this.#r,onActivation:void 0,onDeactivation:void 0,scope:this.#a,serviceIdentifier:this.#s,type:d.ResolvedValue};return this.#t(i),new L(i)}toFactory(e){const n={cache:{isRight:false,value:void 0},factory:e,id:c(),isSatisfiedBy:A.always,moduleId:this.#r,onActivation:void 0,onDeactivation:void 0,scope:u.Singleton,serviceIdentifier:this.#s,type:d.Factory};return this.#t(n),new E(n)}toProvider(e){const n={cache:{isRight:false,value:void 0},id:c(),isSatisfiedBy:A.always,moduleId:this.#r,onActivation:void 0,onDeactivation:void 0,provider:e,scope:u.Singleton,serviceIdentifier:this.#s,type:d.Provider};return this.#t(n),new E(n)}toService(e){const n={id:c(),isSatisfiedBy:A.always,moduleId:this.#r,serviceIdentifier:this.#s,targetServiceIdentifier:e,type:d.ServiceRedirection};this.#t(n);}#o(e){return {arguments:(e??[]).map((e=>function(e){return "object"==typeof e&&!r.is(e)}(e)?{kind:true===e.isMultiple?ue.multipleInjection:ue.singleInjection,name:e.name,optional:e.optional??false,tags:new Map((e.tags??[]).map((e=>[e.key,e.value]))),value:e.serviceIdentifier}:{kind:ue.singleInjection,name:void 0,optional:false,tags:new Map,value:e}))}}}class T{#i;constructor(e){this.#i=e;}getIdentifier(){return P(this.#i)}onActivation(e){return this.#i.onActivation=e,new V(this.#i)}onDeactivation(e){return this.#i.onDeactivation=e,new V(this.#i)}}class V{#i;constructor(e){this.#i=e;}getIdentifier(){return P(this.#i)}when(e){return this.#i.isSatisfiedBy=e,new T(this.#i)}whenAnyAncestor(e){return this.when(C(e))}whenAnyAncestorIs(e){return this.when(C(x(e)))}whenAnyAncestorNamed(e){return this.when(function(e){return C(B(e))}(e))}whenAnyAncestorTagged(e,n){return this.when(function(e,n){return C(O(e,n))}(e,n))}whenDefault(){return this.when(N)}whenNamed(e){return this.when(B(e))}whenNoParent(e){return this.when(F(e))}whenNoParentIs(e){return this.when(F(x(e)))}whenNoParentNamed(e){return this.when(function(e){return F(B(e))}(e))}whenNoParentTagged(e,n){return this.when(function(e,n){return F(O(e,n))}(e,n))}whenParent(e){return this.when(k(e))}whenParentIs(e){return this.when(k(x(e)))}whenParentNamed(e){return this.when(function(e){return k(B(e))}(e))}whenParentTagged(e,n){return this.when(function(e,n){return k(O(e,n))}(e,n))}whenTagged(e,n){return this.when(O(e,n))}whenNoAncestor(e){return this.when(U(e))}whenNoAncestorIs(e){return this.when(U(x(e)))}whenNoAncestorNamed(e){return this.when(function(e){return U(B(e))}(e))}whenNoAncestorTagged(e,n){return this.when(function(e,n){return U(O(e,n))}(e,n))}}class E extends V{#c;constructor(e){super(e),this.#c=new T(e);}onActivation(e){return this.#c.onActivation(e)}onDeactivation(e){return this.#c.onDeactivation(e)}}class L extends E{#d;constructor(e){super(e),this.#d=new j(e);}inRequestScope(){return this.#d.inRequestScope()}inSingletonScope(){return this.#d.inSingletonScope()}inTransientScope(){return this.#d.inTransientScope()}}const q=Symbol.for("@inversifyjs/container/InversifyContainerError");class $ extends Error{[q];kind;constructor(e,n,i){super(n,i),this[q]=true,this.kind=e;}static is(e){return "object"==typeof e&&null!==e&&true===e[q]}static isErrorOfKind(e,n){return $.is(e)&&e.kind===n}}var G;!function(e){e[e.invalidOperation=0]="invalidOperation";}(G||(G={}));class H{#l;#a;#u;constructor(e,n,i){this.#l=e,this.#a=n,this.#u=i;}bind(e){return new D((e=>{this.#h(e);}),void 0,this.#a,e)}isBound(e,n){const i=this.#u.bindingService.get(e);return this.#v(e,i,n)}isCurrentBound(e,n){const i=this.#u.bindingService.getNonParentBindings(e);return this.#v(e,i,n)}async rebind(e){return await this.unbind(e),this.bind(e)}rebindSync(e){return this.unbindSync(e),this.bind(e)}async unbind(e){await this.#g(e);}async unbindAll(){const e=[...this.#u.bindingService.getNonParentBoundServices()];await Promise.all(e.map((async e=>pt(this.#l,e))));for(const n of e)this.#u.activationService.removeAllByServiceId(n),this.#u.bindingService.removeAllByServiceId(n),this.#u.deactivationService.removeAllByServiceId(n);this.#u.planResultCacheService.clearCache();}unbindSync(e){ void 0!==this.#g(e)&&this.#f(e);}#h(e){this.#u.bindingService.set(e),this.#u.planResultCacheService.clearCache();}#f(e){let n;if(I(e)){const t=this.#u.bindingService.getById(e.id),r=(i=t,function(e){if(void 0===e)return;const n=e.next();return true!==n.done?n.value:void 0}(i?.[Symbol.iterator]()))?.serviceIdentifier;n=void 0===r?"Unexpected asynchronous deactivation when unbinding binding identifier. Consider using Container.unbind() instead.":`Unexpected asynchronous deactivation when unbinding "${t$2(r)}" binding. Consider using Container.unbind() instead.`;}else n=`Unexpected asynchronous deactivation when unbinding "${t$2(e)}" service. Consider using Container.unbind() instead.`;var i;throw new $(G.invalidOperation,n)}#g(e){return I(e)?this.#b(e):this.#p(e)}#b(e){const n=this.#u.bindingService.getById(e.id),i=dt(this.#l,n);if(void 0!==i)return i.then((()=>{this.#S(e);}));this.#S(e);}#S(e){this.#u.bindingService.removeById(e.id),this.#u.planResultCacheService.clearCache();}#p(e){const n=pt(this.#l,e);if(void 0!==n)return n.then((()=>{this.#M(e);}));this.#M(e);}#M(e){this.#u.activationService.removeAllByServiceId(e),this.#u.bindingService.removeAllByServiceId(e),this.#u.deactivationService.removeAllByServiceId(e),this.#u.planResultCacheService.clearCache();}#v(e,n,i){if(void 0===n)return false;const t={getAncestor:()=>{},name:i?.name,serviceIdentifier:e,tags:new Map};void 0!==i?.tag&&t.tags.set(i.tag.key,i.tag.value);for(const e of n)if(e.isSatisfiedBy(t))return true;return false}}class _{#y;#l;#a;#u;constructor(e,n,i,t){this.#y=e,this.#l=n,this.#a=i,this.#u=t;}async load(...e){await Promise.all(this.#n(...e));}loadSync(...e){const n=this.#n(...e);for(const e of n)if(void 0!==e)throw new $(G.invalidOperation,"Unexpected asynchronous module load. Consider using Container.load() instead.")}async unload(...e){await Promise.all(this.#R(...e)),this.#w(e);}unloadSync(...e){const n=this.#R(...e);for(const e of n)if(void 0!==e)throw new $(G.invalidOperation,"Unexpected asynchronous module unload. Consider using Container.unload() instead.");this.#w(e);}#m(e){return {bind:n=>new D((e=>{this.#h(e);}),e,this.#a,n),isBound:this.#y.isBound.bind(this.#y),onActivation:(n,i)=>{this.#u.activationService.add(i,{moduleId:e,serviceId:n});},onDeactivation:(n,i)=>{this.#u.deactivationService.add(i,{moduleId:e,serviceId:n});},rebind:this.#y.rebind.bind(this.#y),rebindSync:this.#y.rebindSync.bind(this.#y),unbind:this.#y.unbind.bind(this.#y),unbindSync:this.#y.unbindSync.bind(this.#y)}}#w(e){for(const n of e)this.#u.activationService.removeAllByModuleId(n.id),this.#u.bindingService.removeAllByModuleId(n.id),this.#u.deactivationService.removeAllByModuleId(n.id);this.#u.planResultCacheService.clearCache();}#n(...e){return e.map((e=>e.load(this.#m(e.id))))}#h(e){this.#u.bindingService.set(e),this.#u.planResultCacheService.clearCache();}#R(...e){return e.map((e=>lt(this.#l,e.id)))}}class z{#I;#A;#P;#u;constructor(e,n,i){this.#u=n,this.#P=i,this.#I=this.#C(e),this.#A=this.#B();}register(e,n){const i=new n(e,this.#A);if(true!==i[t])throw new $(G.invalidOperation,"Invalid plugin. The plugin must extend the Plugin class");i.load(this.#I);}#C(e){return {define:(n,i)=>{if(Object.prototype.hasOwnProperty.call(e,n))throw new $(G.invalidOperation,`Container already has a method named "${String(n)}"`);e[n]=i;},onPlan:this.#P.onPlan.bind(this.#P)}}#B(){const e=this.#u;return {get activationService(){return e.activationService},get bindingService(){return e.bindingService},get deactivationService(){return e.deactivationService},get planResultCacheService(){return e.planResultCacheService}}}}class K{activationService;bindingService;deactivationService;planResultCacheService;#x;constructor(e,n,i,t){this.activationService=e,this.bindingService=n,this.deactivationService=i,this.planResultCacheService=t,this.#x=[];}reset(e,n,i){this.activationService=e,this.bindingService=n,this.deactivationService=i,this.planResultCacheService.clearCache();for(const e of this.#x)e();}onReset(e){this.#x.push(e);}}class X{#O;#a;#N;#U;#F;#k;#u;#j;constructor(e,n,i){this.#u=e,this.#F=this.#D(),this.#O=n,this.#a=i,this.#N=e=>this.#u.activationService.get(e),this.#U=this.#u.bindingService.get.bind(this.#u.bindingService),this.#k=[],this.#j=this.#h.bind(this),this.#u.onReset((()=>{this.#T();}));}get(e$1,n){const i=this.#V(false,e$1,n),t=this.#E(i);if(e(t))throw new $(G.invalidOperation,`Unexpected asynchronous service when resolving service "${t$2(e$1)}"`);return t}getAll(e$1,n){const i=this.#V(true,e$1,n),t=this.#E(i);if(e(t))throw new $(G.invalidOperation,`Unexpected asynchronous service when resolving service "${t$2(e$1)}"`);return t}async getAllAsync(e,n){const i=this.#V(true,e,n);return this.#E(i)}async getAsync(e,n){const i=this.#V(false,e,n);return this.#E(i)}onPlan(e){this.#k.push(e);}#T(){this.#U=this.#u.bindingService.get.bind(this.#u.bindingService),this.#j=this.#h.bind(this),this.#F=this.#D();}#L(e,n,i){return {isMultiple:e,name:i?.name,optional:i?.optional,serviceIdentifier:n,tag:i?.tag}}#q(e,n,i){const r={autobindOptions:i?.autobind??this.#O?{scope:this.#a}:void 0,getBindings:this.#U,getClassMetadata:x$1,rootConstraints:{isMultiple:n,serviceIdentifier:e},servicesBranch:[],setBinding:this.#j};return this.#$(r,i),r}#V(e,n,i){const t=this.#L(e,n,i),r=this.#u.planResultCacheService.get(t);if(void 0!==r)return r;const a=we(this.#q(n,e,i));this.#u.planResultCacheService.set(t,a);for(const e of this.#k)e(t,a);return a}#D(){return {get:this.get.bind(this),getAll:this.getAll.bind(this),getAllAsync:this.getAllAsync.bind(this),getAsync:this.getAsync.bind(this)}}#E(e){return et({context:this.#F,getActivations:this.#N,planResult:e,requestScopeCache:new Map})}#$(e,n){ void 0!==n&&(void 0!==n.name&&(e.rootConstraints.name=n.name),true===n.optional&&(e.rootConstraints.isOptional=true),void 0!==n.tag&&(e.rootConstraints.tag={key:n.tag.key,value:n.tag.value}));}#h(e){this.#u.bindingService.set(e),this.#u.planResultCacheService.clearCache();}}class J{#u;#G;constructor(e){this.#u=e,this.#G=[];}restore(){const e=this.#G.pop();if(void 0===e)throw new $(G.invalidOperation,"No snapshot available to restore");this.#u.reset(e.activationService,e.bindingService,e.deactivationService);}snapshot(){this.#G.push({activationService:this.#u.activationService.clone(),bindingService:this.#u.bindingService.clone(),deactivationService:this.#u.deactivationService.clone()});}}const Q=u.Transient;class W{#y;#H;#_;#u;#P;#z;constructor(e){this.#u=this.#K(e);const n=e?.autobind??false,i=e?.defaultScope??Q,r={getBindings:(a=this.#u).bindingService.get.bind(a.bindingService),getBindingsFromModule:a.bindingService.getByModuleId.bind(a.bindingService),getClassMetadata:x$1,getDeactivations:a.deactivationService.get.bind(a.deactivationService)};var a;this.#y=new H(r,i,this.#u),this.#H=new _(this.#y,r,i,this.#u),this.#P=new X(this.#u,n,i),this.#_=new z(this,this.#u,this.#P),this.#z=new J(this.#u);}bind(e){return this.#y.bind(e)}get(e,n){return this.#P.get(e,n)}getAll(e,n){return this.#P.getAll(e,n)}async getAllAsync(e,n){return this.#P.getAllAsync(e,n)}async getAsync(e,n){return this.#P.getAsync(e,n)}isBound(e,n){return this.#y.isBound(e,n)}isCurrentBound(e,n){return this.#y.isCurrentBound(e,n)}async load(...e){return this.#H.load(...e)}loadSync(...e){this.#H.loadSync(...e);}onActivation(e,n){this.#u.activationService.add(n,{serviceId:e});}onDeactivation(e,n){this.#u.deactivationService.add(n,{serviceId:e});}register(e){this.#_.register(this,e);}restore(){this.#z.restore();}async rebind(e){return this.#y.rebind(e)}rebindSync(e){return this.#y.rebindSync(e)}snapshot(){this.#z.snapshot();}async unbind(e){await this.#y.unbind(e);}async unbindAll(){return this.#y.unbindAll()}unbindSync(e){this.#y.unbindSync(e);}async unload(...e){return this.#H.unload(...e)}unloadSync(...e){this.#H.unloadSync(...e);}#K(e){if(void 0===e?.parent)return new K(m$1.build(void 0),I$1.build(void 0),w.build(void 0),new xe);const n=new xe;return e.parent.#u.planResultCacheService.subscribe(n),new K(m$1.build(e.parent.#u.activationService),I$1.build(e.parent.#u.bindingService),w.build(e.parent.#u.deactivationService),n)}}
12
-
13
- const METADATA_KEY = {
14
- PARAM_TYPES: "design:paramtypes",
15
- TYPE: "design:type",
16
- RETURN_TYPE: "design:returntype"
17
- };
18
- const container = new W({
4
+ const container = new Container({
19
5
  defaultScope: "Singleton"
20
6
  });
21
- const bind = (id, cls) => container.bind(id).to(cls).inSingletonScope();
22
- const resolve = (id) => container.get(id);
23
- function isInjectable(target) {
24
- return !!Reflect.getMetadata(METADATA_KEY.PARAM_TYPES, target);
25
- }
26
7
 
27
8
  class MiddlewareRegistryClass {
28
9
  constructor() {
@@ -369,16 +350,6 @@ class TimeoutAdapter {
369
350
  }
370
351
  }
371
352
 
372
- var JobState = /* @__PURE__ */ ((JobState2) => {
373
- JobState2["SCHEDULED"] = "scheduled";
374
- JobState2["RUNNING"] = "running";
375
- JobState2["PAUSED"] = "paused";
376
- JobState2["STOPPED"] = "stopped";
377
- JobState2["COMPLETED"] = "completed";
378
- JobState2["FAILED"] = "failed";
379
- return JobState2;
380
- })(JobState || {});
381
-
382
353
  const _JobRegistry = class _JobRegistry {
383
354
  constructor() {
384
355
  this.jobs = /* @__PURE__ */ new Map();
@@ -1072,21 +1043,7 @@ function getNextCronDate(expr) {
1072
1043
  }
1073
1044
  }
1074
1045
 
1075
- function Injectable() {
1076
- return function(constructor) {
1077
- L$1()(constructor);
1078
- };
1079
- }
1080
-
1081
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
1082
- var __decorateClass = (decorators, target, key, kind) => {
1083
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
1084
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
1085
- if (decorator = decorators[i])
1086
- result = (decorator(result)) || result;
1087
- return result;
1088
- };
1089
- let Scheduler = class {
1046
+ class Scheduler {
1090
1047
  constructor() {
1091
1048
  this.registry = JobRegistry.instance;
1092
1049
  this.alarm = new AlarmAdapter();
@@ -1174,10 +1131,7 @@ let Scheduler = class {
1174
1131
  const jobs = [];
1175
1132
  return jobs;
1176
1133
  }
1177
- };
1178
- Scheduler = __decorateClass([
1179
- Injectable()
1180
- ], Scheduler);
1134
+ }
1181
1135
 
1182
1136
  class ApplicationBootstrap {
1183
1137
  constructor() {
@@ -1252,18 +1206,23 @@ class ApplicationBootstrap {
1252
1206
  */
1253
1207
  async discoverServices() {
1254
1208
  this.logger.info("\u{1F50D} Discovering services...");
1255
- const serviceModules = undefined(
1209
+ const serviceModules = import.meta.glob(
1256
1210
  "/src/app/services/**/*.service.{ts,js}",
1257
1211
  { eager: true }
1258
1212
  );
1259
1213
  for (const module of Object.values(serviceModules)) {
1260
1214
  const ServiceClass = module?.default;
1261
- if (!ServiceClass) continue;
1215
+ if (!ServiceClass || typeof ServiceClass !== "function") {
1216
+ this.logger.warn(
1217
+ `\u26A0\uFE0F Skipping invalid service module - no default export or not a constructor`
1218
+ );
1219
+ continue;
1220
+ }
1262
1221
  this.serviceRegistry.set(ServiceClass.name, ServiceClass);
1263
1222
  }
1264
1223
  for (const module of Object.values(serviceModules)) {
1265
1224
  const ServiceClass = module?.default;
1266
- if (!ServiceClass) continue;
1225
+ if (!ServiceClass || typeof ServiceClass !== "function") continue;
1267
1226
  const dependencies = this.resolveDependencies(ServiceClass);
1268
1227
  this.serviceDependencies.set(ServiceClass.name, {
1269
1228
  service: ServiceClass,
@@ -1294,7 +1253,7 @@ class ApplicationBootstrap {
1294
1253
  const diKey = `CentralStore:${store.name}`;
1295
1254
  container.bind(diKey).toConstantValue(storeInstance);
1296
1255
  if (isFirstStore) {
1297
- container.bind("appStore").toConstantValue(storeInstance);
1256
+ container.bind(TOKENS.Store).toConstantValue(storeInstance);
1298
1257
  isFirstStore = false;
1299
1258
  }
1300
1259
  this.registerMessageClass(classes.GetStoreStateMessage, `store:${store.name}:getState`);
@@ -1317,7 +1276,12 @@ class ApplicationBootstrap {
1317
1276
  resolveDependencies(ServiceClass) {
1318
1277
  const paramTypes = Reflect.getMetadata("design:paramtypes", ServiceClass) || [];
1319
1278
  if (paramTypes.length > 0) {
1320
- return paramTypes.filter((type) => type && type !== Object);
1279
+ const validDependencies = paramTypes.filter((type) => {
1280
+ return type && type !== Object && typeof type === "function";
1281
+ });
1282
+ if (validDependencies.length > 0) {
1283
+ return validDependencies;
1284
+ }
1321
1285
  }
1322
1286
  if (ServiceClass.length > 0) {
1323
1287
  return this.parseConstructorDependencies(ServiceClass);
@@ -1336,22 +1300,10 @@ class ApplicationBootstrap {
1336
1300
  for (const param of parameters) {
1337
1301
  const paramName = param.toLowerCase();
1338
1302
  if (paramName === "appstore") {
1339
- let storeInstance;
1340
- storeInstance = container.get("appStore");
1341
- if (!storeInstance) {
1342
- throw new Error(`No store found for parameter "${param}" in ${ServiceClass.name}`);
1343
- }
1344
1303
  dependencies.push("appStore");
1345
1304
  continue;
1346
- }
1347
- const matchingService = Array.from(this.serviceRegistry.entries()).find(
1348
- ([name]) => name.toLowerCase() === paramName
1349
- );
1350
- if (matchingService) {
1351
- dependencies.push(matchingService[1]);
1352
1305
  } else {
1353
- this.logger.warn(`\u26A0\uFE0F No service found for parameter "${param}" in ${ServiceClass.name}`);
1354
- dependencies.push(void 0);
1306
+ continue;
1355
1307
  }
1356
1308
  }
1357
1309
  return dependencies;
@@ -1433,8 +1385,6 @@ class ApplicationBootstrap {
1433
1385
  for (const serviceName of this.serviceDependencies.keys()) {
1434
1386
  await this.registerService(serviceName);
1435
1387
  }
1436
- const results = this.getRegistrationResults();
1437
- this.reportRegistrationResults(results);
1438
1388
  }
1439
1389
  /**
1440
1390
  * Register a single service with dependency resolution
@@ -1447,24 +1397,13 @@ class ApplicationBootstrap {
1447
1397
  if (serviceMetadata.registered) {
1448
1398
  return { success: true, message: `Service ${serviceName} already registered` };
1449
1399
  }
1450
- if (visitedServices.has(serviceName)) {
1451
- const cycle = [...registrationPath, serviceName];
1452
- this.logger.warn(`\u{1F504} Circular dependency in registration: ${cycle.join(" \u2192 ")}`);
1453
- return { success: false, message: "Circular dependency detected" };
1454
- }
1455
- const newVisited = new Set(visitedServices).add(serviceName);
1456
- const newPath = [...registrationPath, serviceName];
1457
- for (const dependency of serviceMetadata.dependencies) {
1458
- if (this.serviceDependencies.has(dependency.name)) {
1459
- await this.registerService(dependency.name, newVisited, newPath);
1460
- }
1461
- }
1462
1400
  try {
1463
1401
  const ServiceClass = serviceMetadata.service;
1464
- b(L$1(), ServiceClass);
1465
- serviceMetadata.dependencies.forEach((dependency, index) => {
1466
- b(_$1(dependency), ServiceClass, index);
1467
- });
1402
+ if (!ServiceClass || typeof ServiceClass !== "function") {
1403
+ const errorMessage = `Invalid service class for ${serviceName}`;
1404
+ this.logger.error(`\u274C ${errorMessage}`);
1405
+ return { success: false, message: errorMessage };
1406
+ }
1468
1407
  container.bind(ServiceClass).toSelf().inSingletonScope();
1469
1408
  serviceMetadata.registered = true;
1470
1409
  this.logger.success(`\u2705 Registered service: ${ServiceClass.name}`);
@@ -1475,45 +1414,12 @@ class ApplicationBootstrap {
1475
1414
  return { success: false, message: errorMessage, error };
1476
1415
  }
1477
1416
  }
1478
- /**
1479
- * Get registration results summary
1480
- */
1481
- getRegistrationResults() {
1482
- const successful = [];
1483
- const failed = [];
1484
- for (const [name, metadata] of this.serviceDependencies.entries()) {
1485
- if (metadata.registered) {
1486
- successful.push(name);
1487
- } else {
1488
- failed.push(name);
1489
- }
1490
- }
1491
- return { successful, failed };
1492
- }
1493
- /**
1494
- * Report service registration results
1495
- */
1496
- reportRegistrationResults({
1497
- successful,
1498
- failed
1499
- }) {
1500
- if (failed.length > 0) {
1501
- this.logger.error("\u26A0\uFE0F Some services could not be registered:");
1502
- failed.forEach((serviceName) => {
1503
- const metadata = this.serviceDependencies.get(serviceName);
1504
- const deps = metadata?.dependencies.map((d) => d.name).join(", ") || "none";
1505
- this.logger.error(` \u2022 ${serviceName} (dependencies: ${deps})`);
1506
- });
1507
- } else {
1508
- this.logger.success(`\u2705 All ${successful.length} services registered successfully`);
1509
- }
1510
- }
1511
1417
  /**
1512
1418
  * Register message handlers
1513
1419
  */
1514
1420
  async registerMessages() {
1515
1421
  this.logger.info("\u{1F4E8} Registering messages...");
1516
- const messageModules = undefined(
1422
+ const messageModules = import.meta.glob(
1517
1423
  "/src/app/messages/**/*.message.{ts,js}",
1518
1424
  { eager: true }
1519
1425
  );
@@ -1521,11 +1427,6 @@ class ApplicationBootstrap {
1521
1427
  const MessageClass = module?.default;
1522
1428
  if (!MessageClass) continue;
1523
1429
  try {
1524
- const dependencies = this.resolveDependencies(MessageClass);
1525
- b(L$1(), MessageClass);
1526
- dependencies.forEach((dependency, index) => {
1527
- b(_$1(dependency), MessageClass, index);
1528
- });
1529
1430
  const messageMetadata = Reflect.getMetadata("name", MessageClass);
1530
1431
  const messageName = messageMetadata || MessageClass.name;
1531
1432
  container.bind(messageName).to(MessageClass).inSingletonScope();
@@ -1536,11 +1437,6 @@ class ApplicationBootstrap {
1536
1437
  }
1537
1438
  }
1538
1439
  async registerMessageClass(MessageClass, name) {
1539
- const dependencies = this.resolveDependencies(MessageClass);
1540
- b(L$1(), MessageClass);
1541
- dependencies.forEach((dependency, index) => {
1542
- b(_$1(dependency), MessageClass, index);
1543
- });
1544
1440
  container.bind(name).to(MessageClass).inSingletonScope();
1545
1441
  this.logger.success(`\u2705 Registered message: ${name}`);
1546
1442
  }
@@ -1549,7 +1445,7 @@ class ApplicationBootstrap {
1549
1445
  */
1550
1446
  async bootMessages() {
1551
1447
  this.logger.info("\u{1F680} Booting messages...");
1552
- const messageModules = undefined(
1448
+ const messageModules = import.meta.glob(
1553
1449
  "/src/app/messages/**/*.message.{ts,js}",
1554
1450
  { eager: true }
1555
1451
  );
@@ -1572,20 +1468,18 @@ class ApplicationBootstrap {
1572
1468
  */
1573
1469
  async registerJobs() {
1574
1470
  this.logger.info("\u{1F552} Registering jobs...");
1575
- const jobModules = undefined(
1471
+ const jobModules = import.meta.glob(
1576
1472
  "/src/app/jobs/**/*.job.{ts,js}",
1577
1473
  { eager: true }
1578
1474
  );
1579
- this.scheduler = new Scheduler();
1475
+ if (!container.isBound(Scheduler)) {
1476
+ container.bind(Scheduler).toSelf().inSingletonScope();
1477
+ }
1478
+ this.scheduler = container.get(Scheduler);
1580
1479
  for (const module of Object.values(jobModules)) {
1581
1480
  const JobClass = module?.default;
1582
1481
  if (!JobClass) continue;
1583
1482
  try {
1584
- const dependencies = this.resolveDependencies(JobClass);
1585
- b(L$1(), JobClass);
1586
- dependencies.forEach((dependency, index) => {
1587
- b(_$1(dependency), JobClass, index);
1588
- });
1589
1483
  const jobMetadata = Reflect.getMetadata("name", JobClass);
1590
1484
  const jobName = jobMetadata || JobClass.name;
1591
1485
  container.bind(JobClass).toSelf().inSingletonScope();
@@ -1625,16 +1519,6 @@ class BootstrapLogger {
1625
1519
  console.log("=".repeat(50));
1626
1520
  }
1627
1521
  }
1628
- async function create({
1629
- keepPortAlive = false,
1630
- portName
1631
- } = {}) {
1632
- const bootstrap2 = new ApplicationBootstrap();
1633
- await bootstrap2.create({
1634
- keepPortAlive,
1635
- portName
1636
- });
1637
- }
1638
1522
  function bootstrap() {
1639
1523
  return new BootstrapBuilder();
1640
1524
  }
@@ -1667,79 +1551,5 @@ class BootstrapBuilder {
1667
1551
  }
1668
1552
  }
1669
1553
 
1670
- class IMessage {
1671
- handle(...args) {
1672
- throw new Error("Method not implemented.");
1673
- }
1674
- }
1675
- function Message(name) {
1676
- return function(constructor) {
1677
- Reflect.defineMetadata("name", name, constructor);
1678
- return constructor;
1679
- };
1680
- }
1681
-
1682
- class Booteable {
1683
- /**
1684
- * Optional destroy method to be called when the service is being destroyed.
1685
- * This can be used to clean up resources or perform any necessary teardown logic.
1686
- */
1687
- destroy() {
1688
- }
1689
- }
1690
- function isBooteable(obj) {
1691
- return typeof obj.boot === "function";
1692
- }
1693
- function isDestroyable(obj) {
1694
- return typeof obj.destroy === "function";
1695
- }
1696
-
1697
- class Job {
1698
- constructor(data) {
1699
- this.data = data;
1700
- }
1701
- pause() {
1702
- console.log(`Job ${this.constructor.name} paused`);
1703
- }
1704
- resume() {
1705
- console.log(`Job ${this.constructor.name} resumed`);
1706
- }
1707
- stop() {
1708
- console.log(`Job ${this.constructor.name} stopped`);
1709
- }
1710
- }
1711
-
1712
- function JobConfig(options = {}) {
1713
- return function(constructor) {
1714
- Reflect.defineMetadata("job:options", { options }, constructor);
1715
- return constructor;
1716
- };
1717
- }
1718
-
1719
- const Delay = (ms) => JobConfig({ delay: ms });
1720
-
1721
- function Every(cron) {
1722
- return function(constructor) {
1723
- Reflect.defineMetadata("job:options", { cron }, constructor);
1724
- return constructor;
1725
- };
1726
- }
1727
-
1728
- exports.Booteable = Booteable;
1729
- exports.Delay = Delay;
1730
- exports.Every = Every;
1731
- exports.IMessage = IMessage;
1732
- exports.Inject = _$1;
1733
- exports.Injectable = Injectable;
1734
- exports.Job = Job;
1735
- exports.JobState = JobState;
1736
- exports.METADATA_KEY = METADATA_KEY;
1737
- exports.Message = Message;
1738
- exports.bind = bind;
1739
- exports.bootstrap = bootstrap;
1740
- exports.container = container;
1741
- exports.create = create;
1742
- exports.isBooteable = isBooteable;
1743
- exports.isDestroyable = isDestroyable;
1744
- exports.isInjectable = isInjectable;
1745
- exports.resolve = resolve;
1554
+ export { bootstrap };
1555
+ //# sourceMappingURL=boot.es.js.map