@nestjs/core 9.3.9 → 9.3.10
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/errors/exceptions/unknown-dependencies.exception.d.ts +10 -2
- package/errors/exceptions/unknown-dependencies.exception.js +6 -2
- package/helpers/index.d.ts +1 -0
- package/helpers/index.js +1 -0
- package/injector/injector.js +2 -2
- package/injector/instance-loader.js +8 -1
- package/inspector/graph-inspector.d.ts +1 -0
- package/inspector/graph-inspector.js +25 -0
- package/inspector/index.d.ts +2 -0
- package/inspector/index.js +2 -0
- package/inspector/interfaces/serialized-graph-json.interface.d.ts +14 -0
- package/inspector/interfaces/serialized-graph-json.interface.js +2 -0
- package/inspector/interfaces/serialized-graph-metadata.interface.d.ts +10 -0
- package/inspector/interfaces/serialized-graph-metadata.interface.js +2 -0
- package/inspector/partial-graph.host.d.ts +7 -0
- package/inspector/partial-graph.host.js +17 -0
- package/inspector/serialized-graph.d.ts +9 -13
- package/inspector/serialized-graph.js +15 -1
- package/metadata-scanner.d.ts +6 -2
- package/metadata-scanner.js +6 -2
- package/package.json +2 -2
- package/inspector/on-preview-allowlist.registry.d.ts +0 -0
- package/inspector/on-preview-allowlist.registry.js +0 -1
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { InjectorDependencyContext } from '../../injector/injector';
|
|
2
|
-
import { RuntimeException } from './runtime.exception';
|
|
3
2
|
import { Module } from '../../injector/module';
|
|
3
|
+
import { RuntimeException } from './runtime.exception';
|
|
4
4
|
export declare class UnknownDependenciesException extends RuntimeException {
|
|
5
|
-
|
|
5
|
+
readonly type: string | symbol;
|
|
6
|
+
readonly context: InjectorDependencyContext;
|
|
7
|
+
readonly moduleRef?: Module;
|
|
8
|
+
readonly metadata?: {
|
|
9
|
+
id: string;
|
|
10
|
+
};
|
|
11
|
+
constructor(type: string | symbol, context: InjectorDependencyContext, moduleRef?: Module, metadata?: {
|
|
12
|
+
id: string;
|
|
13
|
+
});
|
|
6
14
|
}
|
|
@@ -4,8 +4,12 @@ exports.UnknownDependenciesException = void 0;
|
|
|
4
4
|
const messages_1 = require("../messages");
|
|
5
5
|
const runtime_exception_1 = require("./runtime.exception");
|
|
6
6
|
class UnknownDependenciesException extends runtime_exception_1.RuntimeException {
|
|
7
|
-
constructor(type,
|
|
8
|
-
super((0, messages_1.UNKNOWN_DEPENDENCIES_MESSAGE)(type,
|
|
7
|
+
constructor(type, context, moduleRef, metadata) {
|
|
8
|
+
super((0, messages_1.UNKNOWN_DEPENDENCIES_MESSAGE)(type, context, moduleRef));
|
|
9
|
+
this.type = type;
|
|
10
|
+
this.context = context;
|
|
11
|
+
this.moduleRef = moduleRef;
|
|
12
|
+
this.metadata = metadata;
|
|
9
13
|
}
|
|
10
14
|
}
|
|
11
15
|
exports.UnknownDependenciesException = UnknownDependenciesException;
|
package/helpers/index.d.ts
CHANGED
package/helpers/index.js
CHANGED
|
@@ -2,4 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./context-id-factory"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./external-context-creator"), exports);
|
|
5
6
|
tslib_1.__exportStar(require("./http-adapter-host"), exports);
|
package/injector/injector.js
CHANGED
|
@@ -231,7 +231,7 @@ class Injector {
|
|
|
231
231
|
const token = wrapper.token || wrapper.name;
|
|
232
232
|
const { name } = dependencyContext;
|
|
233
233
|
if (wrapper && token === name) {
|
|
234
|
-
throw new unknown_dependencies_exception_1.UnknownDependenciesException(wrapper.name, dependencyContext, moduleRef);
|
|
234
|
+
throw new unknown_dependencies_exception_1.UnknownDependenciesException(wrapper.name, dependencyContext, moduleRef, { id: wrapper.id });
|
|
235
235
|
}
|
|
236
236
|
if (providers.has(name)) {
|
|
237
237
|
const instanceWrapper = providers.get(name);
|
|
@@ -244,7 +244,7 @@ class Injector {
|
|
|
244
244
|
async lookupComponentInParentModules(dependencyContext, moduleRef, wrapper, contextId = constants_2.STATIC_CONTEXT, inquirer, keyOrIndex) {
|
|
245
245
|
const instanceWrapper = await this.lookupComponentInImports(moduleRef, dependencyContext.name, wrapper, [], contextId, inquirer, keyOrIndex);
|
|
246
246
|
if ((0, shared_utils_1.isNil)(instanceWrapper)) {
|
|
247
|
-
throw new unknown_dependencies_exception_1.UnknownDependenciesException(wrapper.name, dependencyContext, moduleRef);
|
|
247
|
+
throw new unknown_dependencies_exception_1.UnknownDependenciesException(wrapper.name, dependencyContext, moduleRef, { id: wrapper.id });
|
|
248
248
|
}
|
|
249
249
|
return instanceWrapper;
|
|
250
250
|
}
|
|
@@ -18,7 +18,14 @@ class InstanceLoader {
|
|
|
18
18
|
}
|
|
19
19
|
async createInstancesOfDependencies(modules = this.container.getModules()) {
|
|
20
20
|
this.createPrototypes(modules);
|
|
21
|
-
|
|
21
|
+
try {
|
|
22
|
+
await this.createInstances(modules);
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
this.graphInspector.inspectModules(modules);
|
|
26
|
+
this.graphInspector.registerPartial(err);
|
|
27
|
+
throw err;
|
|
28
|
+
}
|
|
22
29
|
this.graphInspector.inspectModules(modules);
|
|
23
30
|
}
|
|
24
31
|
createPrototypes(modules) {
|
|
@@ -11,6 +11,7 @@ export declare class GraphInspector {
|
|
|
11
11
|
private readonly enhancersMetadataCache;
|
|
12
12
|
constructor(container: NestContainer);
|
|
13
13
|
inspectModules(modules?: Map<string, Module>): void;
|
|
14
|
+
registerPartial(error: unknown): void;
|
|
14
15
|
inspectInstanceWrapper<T = any>(source: InstanceWrapper<T>, moduleRef: Module): void;
|
|
15
16
|
insertEnhancerMetadataCache(entry: EnhancerMetadataCacheEntry): void;
|
|
16
17
|
insertOrphanedEnhancer(entry: OrphanedEnhancerDefinition): void;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GraphInspector = void 0;
|
|
4
|
+
const unknown_dependencies_exception_1 = require("../errors/exceptions/unknown-dependencies.exception");
|
|
4
5
|
const deterministic_uuid_registry_1 = require("./deterministic-uuid-registry");
|
|
6
|
+
const partial_graph_host_1 = require("./partial-graph.host");
|
|
5
7
|
class GraphInspector {
|
|
6
8
|
constructor(container) {
|
|
7
9
|
this.container = container;
|
|
@@ -17,6 +19,29 @@ class GraphInspector {
|
|
|
17
19
|
this.enhancersMetadataCache.forEach(entry => this.insertEnhancerEdge(entry));
|
|
18
20
|
deterministic_uuid_registry_1.DeterministicUuidRegistry.clear();
|
|
19
21
|
}
|
|
22
|
+
registerPartial(error) {
|
|
23
|
+
var _a, _b;
|
|
24
|
+
this.graph.status = 'partial';
|
|
25
|
+
if (error instanceof unknown_dependencies_exception_1.UnknownDependenciesException) {
|
|
26
|
+
this.graph.metadata = {
|
|
27
|
+
cause: {
|
|
28
|
+
type: 'unknown-dependencies',
|
|
29
|
+
context: error.context,
|
|
30
|
+
moduleId: (_a = error.moduleRef) === null || _a === void 0 ? void 0 : _a.id,
|
|
31
|
+
nodeId: (_b = error.metadata) === null || _b === void 0 ? void 0 : _b.id,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.graph.metadata = {
|
|
37
|
+
cause: {
|
|
38
|
+
type: 'unknown',
|
|
39
|
+
error,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
partial_graph_host_1.PartialGraphHost.register(this.graph);
|
|
44
|
+
}
|
|
20
45
|
inspectInstanceWrapper(source, moduleRef) {
|
|
21
46
|
const ctorMetadata = source.getCtorMetadata();
|
|
22
47
|
ctorMetadata === null || ctorMetadata === void 0 ? void 0 : ctorMetadata.forEach((target, index) => this.insertClassToClassEdge(source, target, moduleRef, index, 'constructor'));
|
package/inspector/index.d.ts
CHANGED
package/inspector/index.js
CHANGED
|
@@ -3,3 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./graph-inspector"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./initialize-on-preview.allowlist"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./partial-graph.host"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./serialized-graph"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SerializedGraphStatus } from '../serialized-graph';
|
|
2
|
+
import { Edge } from './edge.interface';
|
|
3
|
+
import { Entrypoint } from './entrypoint.interface';
|
|
4
|
+
import { Extras } from './extras.interface';
|
|
5
|
+
import { Node } from './node.interface';
|
|
6
|
+
import { SerializedGraphMetadata } from './serialized-graph-metadata.interface';
|
|
7
|
+
export interface SerializedGraphJson {
|
|
8
|
+
nodes: Record<string, Node>;
|
|
9
|
+
edges: Record<string, Edge>;
|
|
10
|
+
entrypoints: Record<string, Entrypoint<unknown>[]>;
|
|
11
|
+
extras: Extras;
|
|
12
|
+
status?: SerializedGraphStatus;
|
|
13
|
+
metadata?: SerializedGraphMetadata;
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { InjectorDependencyContext } from '../../injector/injector';
|
|
2
|
+
export interface SerializedGraphMetadata {
|
|
3
|
+
cause: {
|
|
4
|
+
type: 'unknown-dependencies' | 'unknown';
|
|
5
|
+
context?: InjectorDependencyContext;
|
|
6
|
+
moduleId?: string;
|
|
7
|
+
nodeId?: string;
|
|
8
|
+
error?: any;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SerializedGraph } from './serialized-graph';
|
|
2
|
+
export declare class PartialGraphHost {
|
|
3
|
+
private static partialGraph;
|
|
4
|
+
static toJSON(): import("./interfaces/serialized-graph-json.interface").SerializedGraphJson;
|
|
5
|
+
static toString(): string;
|
|
6
|
+
static register(partialGraph: SerializedGraph): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PartialGraphHost = void 0;
|
|
4
|
+
class PartialGraphHost {
|
|
5
|
+
static toJSON() {
|
|
6
|
+
var _a;
|
|
7
|
+
return (_a = this.partialGraph) === null || _a === void 0 ? void 0 : _a.toJSON();
|
|
8
|
+
}
|
|
9
|
+
static toString() {
|
|
10
|
+
var _a;
|
|
11
|
+
return (_a = this.partialGraph) === null || _a === void 0 ? void 0 : _a.toString();
|
|
12
|
+
}
|
|
13
|
+
static register(partialGraph) {
|
|
14
|
+
this.partialGraph = partialGraph;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.PartialGraphHost = PartialGraphHost;
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import { InjectionToken } from '@nestjs/common';
|
|
2
2
|
import { Edge } from './interfaces/edge.interface';
|
|
3
3
|
import { Entrypoint } from './interfaces/entrypoint.interface';
|
|
4
|
-
import {
|
|
4
|
+
import { OrphanedEnhancerDefinition } from './interfaces/extras.interface';
|
|
5
5
|
import { Node } from './interfaces/node.interface';
|
|
6
|
+
import { SerializedGraphJson } from './interfaces/serialized-graph-json.interface';
|
|
7
|
+
import { SerializedGraphMetadata } from './interfaces/serialized-graph-metadata.interface';
|
|
8
|
+
export type SerializedGraphStatus = 'partial' | 'complete';
|
|
6
9
|
type WithOptionalId<T extends Record<'id', string>> = Omit<T, 'id'> & Partial<Pick<T, 'id'>>;
|
|
7
10
|
export declare class SerializedGraph {
|
|
8
11
|
private readonly nodes;
|
|
9
12
|
private readonly edges;
|
|
10
13
|
private readonly entrypoints;
|
|
11
14
|
private readonly extras;
|
|
15
|
+
private _status;
|
|
16
|
+
private _metadata?;
|
|
12
17
|
private static readonly INTERNAL_PROVIDERS;
|
|
18
|
+
set status(status: SerializedGraphStatus);
|
|
19
|
+
set metadata(metadata: SerializedGraphMetadata);
|
|
13
20
|
insertNode(nodeDefinition: Node): Node;
|
|
14
21
|
insertEdge(edgeDefinition: WithOptionalId<Edge>): {
|
|
15
22
|
id: string;
|
|
@@ -38,18 +45,7 @@ export declare class SerializedGraph {
|
|
|
38
45
|
insertOrphanedEnhancer(entry: OrphanedEnhancerDefinition): void;
|
|
39
46
|
insertAttachedEnhancer(nodeId: string): void;
|
|
40
47
|
getNodeById(id: string): Node;
|
|
41
|
-
toJSON():
|
|
42
|
-
nodes: {
|
|
43
|
-
[k: string]: Node;
|
|
44
|
-
};
|
|
45
|
-
edges: {
|
|
46
|
-
[k: string]: Edge;
|
|
47
|
-
};
|
|
48
|
-
entrypoints: {
|
|
49
|
-
[k: string]: Entrypoint<unknown>[];
|
|
50
|
-
};
|
|
51
|
-
extras: Extras;
|
|
52
|
-
};
|
|
48
|
+
toJSON(): SerializedGraphJson;
|
|
53
49
|
toString(): string;
|
|
54
50
|
private generateUuidByEdgeDefinition;
|
|
55
51
|
}
|
|
@@ -20,6 +20,13 @@ class SerializedGraph {
|
|
|
20
20
|
orphanedEnhancers: [],
|
|
21
21
|
attachedEnhancers: [],
|
|
22
22
|
};
|
|
23
|
+
this._status = 'complete';
|
|
24
|
+
}
|
|
25
|
+
set status(status) {
|
|
26
|
+
this._status = status;
|
|
27
|
+
}
|
|
28
|
+
set metadata(metadata) {
|
|
29
|
+
this._metadata = metadata;
|
|
23
30
|
}
|
|
24
31
|
insertNode(nodeDefinition) {
|
|
25
32
|
if (nodeDefinition.metadata.type === 'provider' &&
|
|
@@ -65,12 +72,19 @@ class SerializedGraph {
|
|
|
65
72
|
return this.nodes.get(id);
|
|
66
73
|
}
|
|
67
74
|
toJSON() {
|
|
68
|
-
|
|
75
|
+
const json = {
|
|
69
76
|
nodes: Object.fromEntries(this.nodes),
|
|
70
77
|
edges: Object.fromEntries(this.edges),
|
|
71
78
|
entrypoints: Object.fromEntries(this.entrypoints),
|
|
72
79
|
extras: this.extras,
|
|
73
80
|
};
|
|
81
|
+
if (this._status) {
|
|
82
|
+
json['status'] = this._status;
|
|
83
|
+
}
|
|
84
|
+
if (this._metadata) {
|
|
85
|
+
json['metadata'] = this._metadata;
|
|
86
|
+
}
|
|
87
|
+
return json;
|
|
74
88
|
}
|
|
75
89
|
toString() {
|
|
76
90
|
const replacer = (key, value) => {
|
package/metadata-scanner.d.ts
CHANGED
|
@@ -2,11 +2,15 @@ import { Injectable } from '@nestjs/common/interfaces/injectable.interface';
|
|
|
2
2
|
export declare class MetadataScanner {
|
|
3
3
|
private readonly cachedScannedPrototypes;
|
|
4
4
|
/**
|
|
5
|
-
* @deprecated
|
|
5
|
+
* @deprecated
|
|
6
|
+
* @see {@link getAllMethodNames}
|
|
7
|
+
* @see getAllMethodNames
|
|
6
8
|
*/
|
|
7
9
|
scanFromPrototype<T extends Injectable, R = any>(instance: T, prototype: object, callback: (name: string) => R): R[];
|
|
8
10
|
/**
|
|
9
|
-
* @deprecated
|
|
11
|
+
* @deprecated
|
|
12
|
+
* @see {@link getAllMethodNames}
|
|
13
|
+
* @see getAllMethodNames
|
|
10
14
|
*/
|
|
11
15
|
getAllFilteredMethodNames(prototype: object): IterableIterator<string>;
|
|
12
16
|
getAllMethodNames(prototype: object | null): string[];
|
package/metadata-scanner.js
CHANGED
|
@@ -7,7 +7,9 @@ class MetadataScanner {
|
|
|
7
7
|
this.cachedScannedPrototypes = new Map();
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* @deprecated
|
|
10
|
+
* @deprecated
|
|
11
|
+
* @see {@link getAllMethodNames}
|
|
12
|
+
* @see getAllMethodNames
|
|
11
13
|
*/
|
|
12
14
|
scanFromPrototype(instance, prototype, callback) {
|
|
13
15
|
if (!prototype) {
|
|
@@ -40,7 +42,9 @@ class MetadataScanner {
|
|
|
40
42
|
return result;
|
|
41
43
|
}
|
|
42
44
|
/**
|
|
43
|
-
* @deprecated
|
|
45
|
+
* @deprecated
|
|
46
|
+
* @see {@link getAllMethodNames}
|
|
47
|
+
* @see getAllMethodNames
|
|
44
48
|
*/
|
|
45
49
|
*getAllFilteredMethodNames(prototype) {
|
|
46
50
|
yield* this.getAllMethodNames(prototype);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/core",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.10",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@core)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"uid": "2.0.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@nestjs/common": "9.3.
|
|
38
|
+
"@nestjs/common": "9.3.10"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@nestjs/common": "^9.0.0",
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|