@codefast/di 0.3.16-canary.0 → 0.3.16-canary.1
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/CHANGELOG.md +2 -0
- package/README.md +4 -1
- package/dist/binding-select.d.mts +2 -2
- package/dist/binding.d.mts +6 -6
- package/dist/constraints.d.mts +25 -9
- package/dist/constraints.mjs +47 -19
- package/dist/constructor-type.d.mts +2 -2
- package/dist/container.d.mts +6 -6
- package/dist/container.mjs +136 -55
- package/dist/decorators/inject.d.mts +3 -3
- package/dist/decorators/inject.mjs +13 -11
- package/dist/decorators/injectable.d.mts +1 -1
- package/dist/decorators/injectable.mjs +18 -14
- package/dist/decorators/lifecycle-decorators.mjs +3 -0
- package/dist/dependency-graph.d.mts +2 -2
- package/dist/environment.d.mts +12 -12
- package/dist/errors.d.mts +18 -8
- package/dist/errors.mjs +17 -1
- package/dist/graph-adapters/reactflow.d.mts +2 -2
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +4 -3
- package/dist/inspector.d.mts +2 -3
- package/dist/inspector.mjs +5 -3
- package/dist/lifecycle.d.mts +5 -6
- package/dist/lifecycle.mjs +45 -52
- package/dist/metadata/metadata-keys.d.mts +24 -1
- package/dist/metadata/metadata-keys.mjs +14 -1
- package/dist/metadata/metadata-types.d.mts +5 -5
- package/dist/metadata/symbol-metadata-reader.mjs +31 -24
- package/dist/module.d.mts +1 -1
- package/dist/registry.d.mts +5 -5
- package/dist/registry.mjs +35 -42
- package/dist/resolver.d.mts +20 -8
- package/dist/resolver.mjs +64 -43
- package/dist/types.d.mts +9 -5
- package/package.json +11 -5
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { ConstructorMetadata, MutableLifecycleMetadata } from "./metadata-types.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/metadata/metadata-keys.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Accessor injection entries mirrored from `Symbol.metadata` for toolchains where
|
|
6
|
+
* resolver reads stable metadata via the same object identity as `context.metadata`.
|
|
7
|
+
*
|
|
8
|
+
* @since 0.3.16-canary.0
|
|
9
|
+
*/
|
|
10
|
+
type AccessorInjectionEntryList = Array<{
|
|
11
|
+
key: string | symbol;
|
|
12
|
+
descriptor: unknown;
|
|
13
|
+
}>;
|
|
4
14
|
/**
|
|
5
15
|
* @since 0.3.16-canary.0
|
|
6
16
|
*/
|
|
@@ -25,5 +35,18 @@ declare const lifecycleMetadataMap: WeakMap<object, MutableLifecycleMetadata>;
|
|
|
25
35
|
* @since 0.3.16-canary.0
|
|
26
36
|
*/
|
|
27
37
|
declare const lifecycleByConstructorMetadataMap: WeakMap<object, MutableLifecycleMetadata>;
|
|
38
|
+
/**
|
|
39
|
+
* Fallback keyed by the class metadata object (`context.metadata` / `ctor[Symbol.metadata]`).
|
|
40
|
+
*
|
|
41
|
+
* @since 0.3.16-canary.0
|
|
42
|
+
*/
|
|
43
|
+
declare const accessorMetadataByMetadataObjectMap: WeakMap<object, AccessorInjectionEntryList>;
|
|
44
|
+
/**
|
|
45
|
+
* Populated from `@injectable()` after field decorators have written `INJECT_ACCESSOR_KEY`
|
|
46
|
+
* onto `context.metadata` — same timing as {@link constructorMetadataMap}.
|
|
47
|
+
*
|
|
48
|
+
* @since 0.3.16-canary.0
|
|
49
|
+
*/
|
|
50
|
+
declare const accessorMetadataByConstructorMap: WeakMap<object, AccessorInjectionEntryList>;
|
|
28
51
|
//#endregion
|
|
29
|
-
export { INJECTABLE_KEY, INJECT_ACCESSOR_KEY, LIFECYCLE_KEY, constructorMetadataMap, lifecycleByConstructorMetadataMap, lifecycleMetadataMap };
|
|
52
|
+
export { AccessorInjectionEntryList, INJECTABLE_KEY, INJECT_ACCESSOR_KEY, LIFECYCLE_KEY, accessorMetadataByConstructorMap, accessorMetadataByMetadataObjectMap, constructorMetadataMap, lifecycleByConstructorMetadataMap, lifecycleMetadataMap };
|
|
@@ -23,5 +23,18 @@ const lifecycleMetadataMap = /* @__PURE__ */ new WeakMap();
|
|
|
23
23
|
* @since 0.3.16-canary.0
|
|
24
24
|
*/
|
|
25
25
|
const lifecycleByConstructorMetadataMap = /* @__PURE__ */ new WeakMap();
|
|
26
|
+
/**
|
|
27
|
+
* Fallback keyed by the class metadata object (`context.metadata` / `ctor[Symbol.metadata]`).
|
|
28
|
+
*
|
|
29
|
+
* @since 0.3.16-canary.0
|
|
30
|
+
*/
|
|
31
|
+
const accessorMetadataByMetadataObjectMap = /* @__PURE__ */ new WeakMap();
|
|
32
|
+
/**
|
|
33
|
+
* Populated from `@injectable()` after field decorators have written `INJECT_ACCESSOR_KEY`
|
|
34
|
+
* onto `context.metadata` — same timing as {@link constructorMetadataMap}.
|
|
35
|
+
*
|
|
36
|
+
* @since 0.3.16-canary.0
|
|
37
|
+
*/
|
|
38
|
+
const accessorMetadataByConstructorMap = /* @__PURE__ */ new WeakMap();
|
|
26
39
|
//#endregion
|
|
27
|
-
export { INJECTABLE_KEY, INJECT_ACCESSOR_KEY, LIFECYCLE_KEY, constructorMetadataMap, lifecycleByConstructorMetadataMap, lifecycleMetadataMap };
|
|
40
|
+
export { INJECTABLE_KEY, INJECT_ACCESSOR_KEY, LIFECYCLE_KEY, accessorMetadataByConstructorMap, accessorMetadataByMetadataObjectMap, constructorMetadataMap, lifecycleByConstructorMetadataMap, lifecycleMetadataMap };
|
|
@@ -17,14 +17,14 @@ interface ParamMetadata {
|
|
|
17
17
|
* @since 0.3.16-canary.0
|
|
18
18
|
*/
|
|
19
19
|
interface ConstructorMetadata {
|
|
20
|
-
readonly params:
|
|
20
|
+
readonly params: ReadonlyArray<ParamMetadata>;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* @since 0.3.16-canary.0
|
|
24
24
|
*/
|
|
25
25
|
interface LifecycleMetadata {
|
|
26
|
-
readonly postConstruct:
|
|
27
|
-
readonly preDestroy:
|
|
26
|
+
readonly postConstruct: ReadonlyArray<string>;
|
|
27
|
+
readonly preDestroy: ReadonlyArray<string>;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Mutable buckets used while aggregating decorator metadata (same keys as {@link LifecycleMetadata}).
|
|
@@ -32,8 +32,8 @@ interface LifecycleMetadata {
|
|
|
32
32
|
* @since 0.3.16-canary.0
|
|
33
33
|
*/
|
|
34
34
|
interface MutableLifecycleMetadata {
|
|
35
|
-
postConstruct: string
|
|
36
|
-
preDestroy: string
|
|
35
|
+
postConstruct: Array<string>;
|
|
36
|
+
preDestroy: Array<string>;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* @since 0.3.16-canary.0
|
|
@@ -1,39 +1,46 @@
|
|
|
1
|
-
import { INJECTABLE_KEY, INJECT_ACCESSOR_KEY, LIFECYCLE_KEY, constructorMetadataMap, lifecycleByConstructorMetadataMap, lifecycleMetadataMap } from "./metadata-keys.mjs";
|
|
1
|
+
import { INJECTABLE_KEY, INJECT_ACCESSOR_KEY, LIFECYCLE_KEY, accessorMetadataByConstructorMap, accessorMetadataByMetadataObjectMap, constructorMetadataMap, lifecycleByConstructorMetadataMap, lifecycleMetadataMap } from "./metadata-keys.mjs";
|
|
2
2
|
//#region src/metadata/symbol-metadata-reader.ts
|
|
3
3
|
/**
|
|
4
4
|
* @since 0.3.16-canary.0
|
|
5
5
|
*/
|
|
6
6
|
var SymbolMetadataReader = class {
|
|
7
7
|
getConstructorMetadata(target) {
|
|
8
|
-
const
|
|
9
|
-
if (
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
14
|
-
return
|
|
8
|
+
const weakMapMetadata = constructorMetadataMap.get(target);
|
|
9
|
+
if (weakMapMetadata !== void 0) return weakMapMetadata;
|
|
10
|
+
const metadataDescriptor = Object.getOwnPropertyDescriptor(target, Symbol.metadata);
|
|
11
|
+
if (metadataDescriptor === void 0) return;
|
|
12
|
+
const metadataRecord = metadataDescriptor.value;
|
|
13
|
+
if (!metadataRecord || typeof metadataRecord !== "object" || !Object.hasOwn(metadataRecord, INJECTABLE_KEY)) return;
|
|
14
|
+
return metadataRecord[INJECTABLE_KEY];
|
|
15
15
|
}
|
|
16
16
|
getLifecycleMetadata(target) {
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
const
|
|
20
|
-
if (
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
17
|
+
const lifecycleMetadataByConstructor = lifecycleByConstructorMetadataMap.get(target);
|
|
18
|
+
if (lifecycleMetadataByConstructor !== void 0) return lifecycleMetadataByConstructor;
|
|
19
|
+
const metadataDescriptor = Object.getOwnPropertyDescriptor(target, Symbol.metadata);
|
|
20
|
+
if (metadataDescriptor !== void 0) {
|
|
21
|
+
const metadataRecord = metadataDescriptor.value;
|
|
22
|
+
if (metadataRecord && typeof metadataRecord === "object" && Object.hasOwn(metadataRecord, LIFECYCLE_KEY)) return metadataRecord[LIFECYCLE_KEY];
|
|
23
23
|
}
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
24
|
+
const classMetadataObject = target[Symbol.metadata];
|
|
25
|
+
if (classMetadataObject !== void 0) {
|
|
26
|
+
const weakMapMetadata = lifecycleMetadataMap.get(classMetadataObject);
|
|
27
|
+
if (weakMapMetadata !== void 0) return weakMapMetadata;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
getAccessorMetadata(target) {
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
const byConstructor = accessorMetadataByConstructorMap.get(target);
|
|
32
|
+
if (byConstructor !== void 0) return byConstructor;
|
|
33
|
+
const metadataObject = target[Symbol.metadata];
|
|
34
|
+
if (metadataObject !== void 0) {
|
|
35
|
+
const fromWeakMap = accessorMetadataByMetadataObjectMap.get(metadataObject);
|
|
36
|
+
if (fromWeakMap !== void 0) return fromWeakMap;
|
|
37
|
+
}
|
|
38
|
+
const metadataDescriptor = Object.getOwnPropertyDescriptor(target, Symbol.metadata);
|
|
39
|
+
if (metadataDescriptor === void 0) return;
|
|
40
|
+
const metadataRecord = metadataDescriptor.value;
|
|
41
|
+
if (!metadataRecord || typeof metadataRecord !== "object") return;
|
|
42
|
+
if (!Object.hasOwn(metadataRecord, INJECT_ACCESSOR_KEY)) return;
|
|
43
|
+
return metadataRecord[INJECT_ACCESSOR_KEY];
|
|
37
44
|
}
|
|
38
45
|
};
|
|
39
46
|
/**
|
package/dist/module.d.mts
CHANGED
|
@@ -26,7 +26,7 @@ interface AsyncModule {
|
|
|
26
26
|
*/
|
|
27
27
|
interface ModuleBuilder {
|
|
28
28
|
bind<const Value>(token: Token<Value> | Constructor<Value>): BindToBuilder<Value>;
|
|
29
|
-
import(...modules: SyncModule
|
|
29
|
+
import(...modules: Array<SyncModule>): void;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* @since 0.3.16-canary.0
|
package/dist/registry.d.mts
CHANGED
|
@@ -16,24 +16,24 @@ declare class BindingRegistry {
|
|
|
16
16
|
/** Add or replace binding using slot-aware last-wins. */
|
|
17
17
|
add(binding: Binding): void;
|
|
18
18
|
/** Remove all bindings for a token. Returns removed bindings. */
|
|
19
|
-
removeByToken(t: Token<unknown> | Constructor): Binding
|
|
19
|
+
removeByToken(t: Token<unknown> | Constructor): Array<Binding>;
|
|
20
20
|
/** Remove a specific binding by ID. Returns the removed binding or undefined. */
|
|
21
21
|
removeById(id: BindingIdentifier): Binding | undefined;
|
|
22
22
|
/** Get all bindings for a token. */
|
|
23
|
-
getAll(t: Token<unknown> | Constructor):
|
|
23
|
+
getAll(t: Token<unknown> | Constructor): ReadonlyArray<Binding>;
|
|
24
24
|
/** Get binding by ID. */
|
|
25
25
|
getById(id: BindingIdentifier): Binding | undefined;
|
|
26
26
|
/** Check if any binding exists for token. */
|
|
27
27
|
has(t: Token<unknown> | Constructor): boolean;
|
|
28
28
|
/** All bindings in the registry. */
|
|
29
|
-
allBindings():
|
|
29
|
+
allBindings(): ReadonlyArray<Binding>;
|
|
30
30
|
/** Remove all bindings. Returns all removed. */
|
|
31
|
-
clear():
|
|
31
|
+
clear(): ReadonlyArray<Binding>;
|
|
32
32
|
getSimpleNamed(token: Token<unknown> | Constructor, name: string): Binding | undefined;
|
|
33
33
|
getSimpleTagged(token: Token<unknown> | Constructor, tagKey: string, tagValue: unknown): Binding | undefined;
|
|
34
34
|
getFastDefault(token: Token<unknown> | Constructor): Binding | undefined;
|
|
35
35
|
/** Summarize available slot strings for a token (for error messages). */
|
|
36
|
-
availableSlotStrings(t: Token<unknown> | Constructor): string
|
|
36
|
+
availableSlotStrings(t: Token<unknown> | Constructor): Array<string>;
|
|
37
37
|
private _indexSimpleTaggedBinding;
|
|
38
38
|
private _deindexSimpleTaggedBinding;
|
|
39
39
|
private _isPurePredicateBinding;
|
package/dist/registry.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { slotKeyEquals } from "./binding.mjs";
|
|
1
|
+
import { slotKeyEquals, slotKeyToString } from "./binding.mjs";
|
|
2
2
|
//#region src/registry.ts
|
|
3
3
|
/**
|
|
4
4
|
* @since 0.3.16-canary.0
|
|
@@ -12,20 +12,20 @@ var BindingRegistry = class {
|
|
|
12
12
|
/** Add or replace binding using slot-aware last-wins. */
|
|
13
13
|
add(binding) {
|
|
14
14
|
const key = binding.token;
|
|
15
|
-
let
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
this._bindings.set(key,
|
|
15
|
+
let bindingsForToken = this._bindings.get(key);
|
|
16
|
+
if (bindingsForToken === void 0) {
|
|
17
|
+
bindingsForToken = [];
|
|
18
|
+
this._bindings.set(key, bindingsForToken);
|
|
19
19
|
}
|
|
20
20
|
if (!this._isPurePredicateBinding(binding)) {
|
|
21
|
-
const existingIndex =
|
|
21
|
+
const existingIndex = bindingsForToken.findIndex((b) => !this._isPurePredicateBinding(b) && slotKeyEquals(b.slot, binding.slot));
|
|
22
22
|
if (existingIndex !== -1) {
|
|
23
|
-
const
|
|
24
|
-
this._byId.delete(
|
|
25
|
-
|
|
23
|
+
const replacedBinding = bindingsForToken[existingIndex];
|
|
24
|
+
this._byId.delete(replacedBinding.id);
|
|
25
|
+
bindingsForToken.splice(existingIndex, 1);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
bindingsForToken.push(binding);
|
|
29
29
|
this._byId.set(binding.id, binding);
|
|
30
30
|
this._indexSimpleNamedBinding(key, binding);
|
|
31
31
|
this._indexSimpleTaggedBinding(key, binding);
|
|
@@ -34,13 +34,13 @@ var BindingRegistry = class {
|
|
|
34
34
|
/** Remove all bindings for a token. Returns removed bindings. */
|
|
35
35
|
removeByToken(t) {
|
|
36
36
|
const key = t;
|
|
37
|
-
const
|
|
37
|
+
const bindingsForToken = this._bindings.get(key) ?? [];
|
|
38
38
|
this._bindings.delete(key);
|
|
39
39
|
this._simpleNamed.delete(key);
|
|
40
40
|
this._simpleTagged.delete(key);
|
|
41
41
|
this._fastDefault.delete(key);
|
|
42
|
-
for (const
|
|
43
|
-
return
|
|
42
|
+
for (const binding of bindingsForToken) this._byId.delete(binding.id);
|
|
43
|
+
return bindingsForToken;
|
|
44
44
|
}
|
|
45
45
|
/** Remove a specific binding by ID. Returns the removed binding or undefined. */
|
|
46
46
|
removeById(id) {
|
|
@@ -48,13 +48,13 @@ var BindingRegistry = class {
|
|
|
48
48
|
if (binding === void 0) return;
|
|
49
49
|
this._byId.delete(id);
|
|
50
50
|
const key = binding.token;
|
|
51
|
-
const
|
|
52
|
-
if (
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
51
|
+
const bindingsForToken = this._bindings.get(key);
|
|
52
|
+
if (bindingsForToken !== void 0) {
|
|
53
|
+
const bindingIndex = bindingsForToken.findIndex((candidate) => candidate.id === id);
|
|
54
|
+
if (bindingIndex !== -1) bindingsForToken.splice(bindingIndex, 1);
|
|
55
55
|
this._deindexSimpleNamedBinding(key, binding);
|
|
56
56
|
this._deindexSimpleTaggedBinding(key, binding);
|
|
57
|
-
if (
|
|
57
|
+
if (bindingsForToken.length === 0) {
|
|
58
58
|
this._bindings.delete(key);
|
|
59
59
|
this._simpleNamed.delete(key);
|
|
60
60
|
this._simpleTagged.delete(key);
|
|
@@ -79,9 +79,9 @@ var BindingRegistry = class {
|
|
|
79
79
|
}
|
|
80
80
|
/** All bindings in the registry. */
|
|
81
81
|
allBindings() {
|
|
82
|
-
const
|
|
83
|
-
for (const
|
|
84
|
-
return
|
|
82
|
+
const allBindings = [];
|
|
83
|
+
for (const bindingsForToken of this._bindings.values()) allBindings.push(...bindingsForToken);
|
|
84
|
+
return allBindings;
|
|
85
85
|
}
|
|
86
86
|
/** Remove all bindings. Returns all removed. */
|
|
87
87
|
clear() {
|
|
@@ -104,14 +104,7 @@ var BindingRegistry = class {
|
|
|
104
104
|
}
|
|
105
105
|
/** Summarize available slot strings for a token (for error messages). */
|
|
106
106
|
availableSlotStrings(t) {
|
|
107
|
-
return (this._bindings.get(t) ?? []).map((
|
|
108
|
-
const s = b.slot;
|
|
109
|
-
if (s.name === void 0 && s.tags.length === 0) return "default";
|
|
110
|
-
const parts = [];
|
|
111
|
-
if (s.name !== void 0) parts.push(`name:${s.name}`);
|
|
112
|
-
for (const [k, v] of s.tags) parts.push(`tag:${k}=${String(v)}`);
|
|
113
|
-
return parts.join(",");
|
|
114
|
-
});
|
|
107
|
+
return (this._bindings.get(t) ?? []).map((binding) => slotKeyToString(binding.slot));
|
|
115
108
|
}
|
|
116
109
|
_indexSimpleTaggedBinding(tokenKeyValue, binding) {
|
|
117
110
|
const slot = binding.slot;
|
|
@@ -154,30 +147,30 @@ var BindingRegistry = class {
|
|
|
154
147
|
_indexSimpleNamedBinding(tokenKeyValue, binding) {
|
|
155
148
|
const slot = binding.slot;
|
|
156
149
|
if (slot.name === void 0 || slot.tags.length > 0) return;
|
|
157
|
-
let
|
|
158
|
-
if (
|
|
159
|
-
|
|
160
|
-
this._simpleNamed.set(tokenKeyValue,
|
|
150
|
+
let bindingsByName = this._simpleNamed.get(tokenKeyValue);
|
|
151
|
+
if (bindingsByName === void 0) {
|
|
152
|
+
bindingsByName = /* @__PURE__ */ new Map();
|
|
153
|
+
this._simpleNamed.set(tokenKeyValue, bindingsByName);
|
|
161
154
|
}
|
|
162
|
-
|
|
155
|
+
bindingsByName.set(slot.name, binding);
|
|
163
156
|
}
|
|
164
157
|
_deindexSimpleNamedBinding(tokenKeyValue, binding) {
|
|
165
158
|
const slot = binding.slot;
|
|
166
159
|
if (slot.name === void 0 || slot.tags.length > 0) return;
|
|
167
|
-
const
|
|
168
|
-
if (
|
|
169
|
-
if (
|
|
170
|
-
|
|
171
|
-
if (
|
|
160
|
+
const bindingsByName = this._simpleNamed.get(tokenKeyValue);
|
|
161
|
+
if (bindingsByName === void 0) return;
|
|
162
|
+
if (bindingsByName.get(slot.name)?.id === binding.id) {
|
|
163
|
+
bindingsByName.delete(slot.name);
|
|
164
|
+
if (bindingsByName.size === 0) this._simpleNamed.delete(tokenKeyValue);
|
|
172
165
|
}
|
|
173
166
|
}
|
|
174
167
|
_refreshFastDefaultForToken(tokenKeyValue) {
|
|
175
|
-
const
|
|
176
|
-
if (
|
|
168
|
+
const bindingsForToken = this._bindings.get(tokenKeyValue);
|
|
169
|
+
if (bindingsForToken === void 0 || bindingsForToken.length !== 1) {
|
|
177
170
|
this._fastDefault.delete(tokenKeyValue);
|
|
178
171
|
return;
|
|
179
172
|
}
|
|
180
|
-
const onlyBinding =
|
|
173
|
+
const onlyBinding = bindingsForToken[0];
|
|
181
174
|
if (!(onlyBinding.slot.name === void 0 && onlyBinding.slot.tags.length === 0) || onlyBinding.predicate !== void 0) {
|
|
182
175
|
this._fastDefault.delete(tokenKeyValue);
|
|
183
176
|
return;
|
package/dist/resolver.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Constructor } from "./constructor-type.mjs";
|
|
2
2
|
import { Token } from "./token.mjs";
|
|
3
3
|
import { MaterializationFrame, ResolveOptions } from "./types.mjs";
|
|
4
|
+
import { Binding } from "./binding.mjs";
|
|
4
5
|
import { BindingRegistry } from "./registry.mjs";
|
|
5
6
|
import { ScopeManager } from "./scope.mjs";
|
|
6
7
|
import { MetadataReader } from "./metadata/metadata-types.mjs";
|
|
@@ -35,22 +36,33 @@ declare class DependencyResolver {
|
|
|
35
36
|
private _activationCacheVersion;
|
|
36
37
|
constructor(_registry: BindingRegistry, _scope: ScopeManager, _lifecycle: LifecycleManager, _metadataReader: MetadataReader, _container: Container, _parent: DependencyResolver | undefined);
|
|
37
38
|
private _findBinding;
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Binding lookup aligned with `resolve` — used by `Container.validate` without instantiating.
|
|
41
|
+
*/
|
|
42
|
+
peekBindingForValidate(token: Token<unknown> | Constructor, hint: ResolveOptions | undefined): {
|
|
43
|
+
binding: Binding;
|
|
44
|
+
owner: DependencyResolver;
|
|
45
|
+
} | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Mirrors {@link DependencyResolver.resolveAll} candidate selection only (no instantiation).
|
|
48
|
+
*/
|
|
49
|
+
peekCandidateBindingsForValidate(token: Token<unknown> | Constructor, hint: ResolveOptions | undefined): Array<Binding>;
|
|
50
|
+
resolveFromContext<const Value>(token: Token<Value> | Constructor<Value>, resolutionPath: Array<string>, materializationStack: Array<MaterializationFrame>): Value;
|
|
51
|
+
resolve<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: Array<string>, materializationStack: Array<MaterializationFrame>): Value;
|
|
40
52
|
private _resolveBinding;
|
|
41
53
|
private _instantiateSync;
|
|
42
54
|
private _resolveClassDeps;
|
|
43
55
|
private _resolveDescriptorDeps;
|
|
44
|
-
resolveOptional<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: string
|
|
45
|
-
resolveAll<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: string
|
|
46
|
-
resolveAsyncFromContext<const Value>(token: Token<Value> | Constructor<Value>, resolutionPath: string
|
|
47
|
-
resolveAsync<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: string
|
|
56
|
+
resolveOptional<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: Array<string>, materializationStack: Array<MaterializationFrame>): Value | undefined;
|
|
57
|
+
resolveAll<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: Array<string>, materializationStack: Array<MaterializationFrame>): Array<Value>;
|
|
58
|
+
resolveAsyncFromContext<const Value>(token: Token<Value> | Constructor<Value>, resolutionPath: Array<string>, materializationStack: Array<MaterializationFrame>): Promise<Value>;
|
|
59
|
+
resolveAsync<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: Array<string>, materializationStack: Array<MaterializationFrame>): Promise<Value>;
|
|
48
60
|
private _resolveBindingAsync;
|
|
49
61
|
private _instantiateAsync;
|
|
50
62
|
private _resolveClassDepsAsync;
|
|
51
63
|
private _resolveDescriptorDepsAsync;
|
|
52
|
-
resolveOptionalAsync<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: string
|
|
53
|
-
resolveAllAsync<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: string
|
|
64
|
+
resolveOptionalAsync<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: Array<string>, materializationStack: Array<MaterializationFrame>): Promise<Value | undefined>;
|
|
65
|
+
resolveAllAsync<const Value>(token: Token<Value> | Constructor<Value>, hint: ResolveOptions | undefined, resolutionPath: Array<string>, materializationStack: Array<MaterializationFrame>): Promise<Array<Value>>;
|
|
54
66
|
private _getAllBindingsFromChain;
|
|
55
67
|
private _getSimpleNamedBindingsFromChain;
|
|
56
68
|
private _getAvailableSlots;
|