moost 0.2.3 → 0.2.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/dist/index.cjs +10 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +10 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -660,6 +660,15 @@ class Moost {
|
|
|
660
660
|
init() {
|
|
661
661
|
return __awaiter(this, void 0, void 0, function* () {
|
|
662
662
|
this.setProvideRegistry(infact.createProvideRegistry([Moost, () => this]));
|
|
663
|
+
for (const a of this.adapters) {
|
|
664
|
+
const constructor = mate.getConstructor(a);
|
|
665
|
+
if (constructor) {
|
|
666
|
+
this.setProvideRegistry(infact.createProvideRegistry([constructor, () => a]));
|
|
667
|
+
}
|
|
668
|
+
if (typeof a.getProvideRegistry === 'function') {
|
|
669
|
+
this.setProvideRegistry(a.getProvideRegistry());
|
|
670
|
+
}
|
|
671
|
+
}
|
|
663
672
|
this.unregisteredControllers.unshift(this);
|
|
664
673
|
yield this.bindControllers();
|
|
665
674
|
for (const a of this.adapters) {
|
|
@@ -687,7 +696,7 @@ class Moost {
|
|
|
687
696
|
const infact = getMoostInfact();
|
|
688
697
|
const isControllerConsructor = mate.isConstructor(controller);
|
|
689
698
|
let instance;
|
|
690
|
-
if (isControllerConsructor && (classMeta === null || classMeta === void 0 ? void 0 : classMeta.injectable) === 'SINGLETON') {
|
|
699
|
+
if (isControllerConsructor && ((classMeta === null || classMeta === void 0 ? void 0 : classMeta.injectable) === 'SINGLETON' || (classMeta === null || classMeta === void 0 ? void 0 : classMeta.injectable) === true)) {
|
|
691
700
|
instance = (yield infact.get(controller, provide));
|
|
692
701
|
}
|
|
693
702
|
else if (!isControllerConsructor) {
|
package/dist/index.d.ts
CHANGED
|
@@ -215,6 +215,7 @@ export declare enum TInterceptorPriority {
|
|
|
215
215
|
export declare interface TMoostAdapter<H extends object> {
|
|
216
216
|
bindHandler<T extends TObject = TObject>(options: TMoostAdapterOptions<H, T>): void | Promise<void>;
|
|
217
217
|
onInit?: () => void | Promise<void>;
|
|
218
|
+
getProvideRegistry?: () => TProvideRegistry;
|
|
218
219
|
}
|
|
219
220
|
|
|
220
221
|
export declare interface TMoostAdapterOptions<H extends object, T extends object> {
|
package/dist/index.mjs
CHANGED
|
@@ -658,6 +658,15 @@ class Moost {
|
|
|
658
658
|
init() {
|
|
659
659
|
return __awaiter(this, void 0, void 0, function* () {
|
|
660
660
|
this.setProvideRegistry(createProvideRegistry([Moost, () => this]));
|
|
661
|
+
for (const a of this.adapters) {
|
|
662
|
+
const constructor = getConstructor(a);
|
|
663
|
+
if (constructor) {
|
|
664
|
+
this.setProvideRegistry(createProvideRegistry([constructor, () => a]));
|
|
665
|
+
}
|
|
666
|
+
if (typeof a.getProvideRegistry === 'function') {
|
|
667
|
+
this.setProvideRegistry(a.getProvideRegistry());
|
|
668
|
+
}
|
|
669
|
+
}
|
|
661
670
|
this.unregisteredControllers.unshift(this);
|
|
662
671
|
yield this.bindControllers();
|
|
663
672
|
for (const a of this.adapters) {
|
|
@@ -685,7 +694,7 @@ class Moost {
|
|
|
685
694
|
const infact = getMoostInfact();
|
|
686
695
|
const isControllerConsructor = isConstructor(controller);
|
|
687
696
|
let instance;
|
|
688
|
-
if (isControllerConsructor && (classMeta === null || classMeta === void 0 ? void 0 : classMeta.injectable) === 'SINGLETON') {
|
|
697
|
+
if (isControllerConsructor && ((classMeta === null || classMeta === void 0 ? void 0 : classMeta.injectable) === 'SINGLETON' || (classMeta === null || classMeta === void 0 ? void 0 : classMeta.injectable) === true)) {
|
|
689
698
|
instance = (yield infact.get(controller, provide));
|
|
690
699
|
}
|
|
691
700
|
else if (!isControllerConsructor) {
|