akanjs 2.3.8-rc.4 → 2.3.8-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { INJECT_META } from "akanjs/base";
|
|
2
|
-
import type
|
|
2
|
+
import { type AdaptorCls, CacheAdaptorRole, type InjectInfo } from "akanjs/service";
|
|
3
3
|
import { type DependencyNode, topologicalStages } from "./resolveHierarchy";
|
|
4
4
|
|
|
5
5
|
interface AdaptorNode extends DependencyNode {
|
|
@@ -54,6 +54,9 @@ export function resolveAdaptorHierarchy(
|
|
|
54
54
|
for (const [key, adaptor] of adaptorMap) {
|
|
55
55
|
const injectMap: Record<string, InjectInfo> = adaptor[INJECT_META] ?? {};
|
|
56
56
|
const dependencies: string[] = [];
|
|
57
|
+
const addDependency = (depKey: string) => {
|
|
58
|
+
if (depKey !== key && !dependencies.includes(depKey)) dependencies.push(depKey);
|
|
59
|
+
};
|
|
57
60
|
|
|
58
61
|
for (const [propKey, injectInfo] of Object.entries(injectMap)) {
|
|
59
62
|
if (injectInfo.type === "plug") {
|
|
@@ -65,11 +68,17 @@ export function resolveAdaptorHierarchy(
|
|
|
65
68
|
`on adaptor "${injectInfo.adaptor.refName}" which is not registered.`,
|
|
66
69
|
);
|
|
67
70
|
}
|
|
68
|
-
|
|
71
|
+
addDependency(depKey);
|
|
69
72
|
} else if (injectInfo.type === "use") {
|
|
70
73
|
if (adaptorMap.has(propKey) && propKey !== key) {
|
|
71
|
-
|
|
74
|
+
addDependency(propKey);
|
|
72
75
|
}
|
|
76
|
+
} else if (injectInfo.type === "memory") {
|
|
77
|
+
const depKey = classToKey.get(CacheAdaptorRole);
|
|
78
|
+
if (!depKey) {
|
|
79
|
+
throw new Error(`Adaptor "${key}" has a memory dependency but cache adaptor role is not registered.`);
|
|
80
|
+
}
|
|
81
|
+
addDependency(depKey);
|
|
73
82
|
}
|
|
74
83
|
}
|
|
75
84
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { INJECT_META } from "akanjs/base";
|
|
2
|
-
import type
|
|
2
|
+
import { type AdaptorCls, type InjectInfo } from "akanjs/service";
|
|
3
3
|
import { type DependencyNode } from "./resolveHierarchy.d.ts";
|
|
4
4
|
interface AdaptorNode extends DependencyNode {
|
|
5
5
|
adaptor: AdaptorCls;
|