@nestjs/core 9.3.10 → 9.3.12
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 +3 -1
- package/errors/exceptions/unknown-dependencies.exception.js +1 -1
- package/exceptions/base-exception-filter-context.js +1 -1
- package/guards/guards-context-creator.js +2 -2
- package/helpers/context-creator.d.ts +2 -1
- package/helpers/context-creator.js +8 -0
- package/injector/module.js +2 -1
- package/interceptors/interceptors-context-creator.js +2 -2
- package/package.json +2 -2
- package/pipes/pipes-context-creator.js +2 -2
|
@@ -4,10 +4,12 @@ import { RuntimeException } from './runtime.exception';
|
|
|
4
4
|
export declare class UnknownDependenciesException extends RuntimeException {
|
|
5
5
|
readonly type: string | symbol;
|
|
6
6
|
readonly context: InjectorDependencyContext;
|
|
7
|
-
readonly moduleRef?: Module;
|
|
8
7
|
readonly metadata?: {
|
|
9
8
|
id: string;
|
|
10
9
|
};
|
|
10
|
+
readonly moduleRef: {
|
|
11
|
+
id: string;
|
|
12
|
+
} | undefined;
|
|
11
13
|
constructor(type: string | symbol, context: InjectorDependencyContext, moduleRef?: Module, metadata?: {
|
|
12
14
|
id: string;
|
|
13
15
|
});
|
|
@@ -8,8 +8,8 @@ class UnknownDependenciesException extends runtime_exception_1.RuntimeException
|
|
|
8
8
|
super((0, messages_1.UNKNOWN_DEPENDENCIES_MESSAGE)(type, context, moduleRef));
|
|
9
9
|
this.type = type;
|
|
10
10
|
this.context = context;
|
|
11
|
-
this.moduleRef = moduleRef;
|
|
12
11
|
this.metadata = metadata;
|
|
12
|
+
this.moduleRef = moduleRef && { id: moduleRef.id };
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
exports.UnknownDependenciesException = UnknownDependenciesException;
|
|
@@ -34,7 +34,7 @@ class BaseExceptionFilterContext extends context_creator_1.ContextCreator {
|
|
|
34
34
|
if (!instanceWrapper) {
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
|
-
const instanceHost = instanceWrapper.getInstanceByContextId(contextId, inquirerId);
|
|
37
|
+
const instanceHost = instanceWrapper.getInstanceByContextId(this.getContextId(contextId, instanceWrapper), inquirerId);
|
|
38
38
|
return instanceHost && instanceHost.instance;
|
|
39
39
|
}
|
|
40
40
|
getInstanceByMetatype(metatype) {
|
|
@@ -35,7 +35,7 @@ class GuardsContextCreator extends context_creator_1.ContextCreator {
|
|
|
35
35
|
if (!instanceWrapper) {
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
38
|
-
const instanceHost = instanceWrapper.getInstanceByContextId(contextId, inquirerId);
|
|
38
|
+
const instanceHost = instanceWrapper.getInstanceByContextId(this.getContextId(contextId, instanceWrapper), inquirerId);
|
|
39
39
|
return instanceHost && instanceHost.instance;
|
|
40
40
|
}
|
|
41
41
|
getInstanceByMetatype(metatype) {
|
|
@@ -60,7 +60,7 @@ class GuardsContextCreator extends context_creator_1.ContextCreator {
|
|
|
60
60
|
}
|
|
61
61
|
const scopedGuardWrappers = this.config.getGlobalRequestGuards();
|
|
62
62
|
const scopedGuards = (0, iterare_1.iterate)(scopedGuardWrappers)
|
|
63
|
-
.map(wrapper => wrapper.getInstanceByContextId(contextId, inquirerId))
|
|
63
|
+
.map(wrapper => wrapper.getInstanceByContextId(this.getContextId(contextId, wrapper), inquirerId))
|
|
64
64
|
.filter(host => !!host)
|
|
65
65
|
.map(host => host.instance)
|
|
66
66
|
.toArray();
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Controller } from '@nestjs/common/interfaces';
|
|
2
|
-
import { ContextId } from '../injector/instance-wrapper';
|
|
2
|
+
import { ContextId, InstanceWrapper } from '../injector/instance-wrapper';
|
|
3
3
|
export declare abstract class ContextCreator {
|
|
4
4
|
abstract createConcreteContext<T extends any[], R extends any[]>(metadata: T, contextId?: ContextId, inquirerId?: string): R;
|
|
5
5
|
getGlobalMetadata?<T extends any[]>(contextId?: ContextId, inquirerId?: string): T;
|
|
6
6
|
createContext<T extends unknown[] = any, R extends unknown[] = any>(instance: Controller, callback: (...args: any[]) => void, metadataKey: string, contextId?: ContextId, inquirerId?: string): R;
|
|
7
7
|
reflectClassMetadata<T>(instance: Controller, metadataKey: string): T;
|
|
8
8
|
reflectMethodMetadata<T>(callback: (...args: unknown[]) => unknown, metadataKey: string): T;
|
|
9
|
+
protected getContextId(contextId: ContextId, instanceWrapper: InstanceWrapper): ContextId;
|
|
9
10
|
}
|
|
@@ -21,5 +21,13 @@ class ContextCreator {
|
|
|
21
21
|
reflectMethodMetadata(callback, metadataKey) {
|
|
22
22
|
return Reflect.getMetadata(metadataKey, callback);
|
|
23
23
|
}
|
|
24
|
+
getContextId(contextId, instanceWrapper) {
|
|
25
|
+
return contextId.getParent
|
|
26
|
+
? contextId.getParent({
|
|
27
|
+
token: instanceWrapper.token,
|
|
28
|
+
isTreeDurable: instanceWrapper.isDependencyTreeDurable(),
|
|
29
|
+
})
|
|
30
|
+
: contextId;
|
|
31
|
+
}
|
|
24
32
|
}
|
|
25
33
|
exports.ContextCreator = ContextCreator;
|
package/injector/module.js
CHANGED
|
@@ -214,7 +214,8 @@ class Module {
|
|
|
214
214
|
return !(0, shared_utils_1.isUndefined)(provider.useClass);
|
|
215
215
|
}
|
|
216
216
|
isCustomValue(provider) {
|
|
217
|
-
return
|
|
217
|
+
return ((0, shared_utils_1.isObject)(provider) &&
|
|
218
|
+
Object.prototype.hasOwnProperty.call(provider, 'useValue'));
|
|
218
219
|
}
|
|
219
220
|
isCustomFactory(provider) {
|
|
220
221
|
return !(0, shared_utils_1.isUndefined)(provider.useFactory);
|
|
@@ -35,7 +35,7 @@ class InterceptorsContextCreator extends context_creator_1.ContextCreator {
|
|
|
35
35
|
if (!instanceWrapper) {
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
38
|
-
const instanceHost = instanceWrapper.getInstanceByContextId(contextId, inquirerId);
|
|
38
|
+
const instanceHost = instanceWrapper.getInstanceByContextId(this.getContextId(contextId, instanceWrapper), inquirerId);
|
|
39
39
|
return instanceHost && instanceHost.instance;
|
|
40
40
|
}
|
|
41
41
|
getInstanceByMetatype(metatype) {
|
|
@@ -59,7 +59,7 @@ class InterceptorsContextCreator extends context_creator_1.ContextCreator {
|
|
|
59
59
|
}
|
|
60
60
|
const scopedInterceptorWrappers = this.config.getGlobalRequestInterceptors();
|
|
61
61
|
const scopedInterceptors = (0, iterare_1.iterate)(scopedInterceptorWrappers)
|
|
62
|
-
.map(wrapper => wrapper.getInstanceByContextId(contextId, inquirerId))
|
|
62
|
+
.map(wrapper => wrapper.getInstanceByContextId(this.getContextId(contextId, wrapper), inquirerId))
|
|
63
63
|
.filter(host => !!host)
|
|
64
64
|
.map(host => host.instance)
|
|
65
65
|
.toArray();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/core",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.12",
|
|
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.12"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@nestjs/common": "^9.0.0",
|
|
@@ -35,7 +35,7 @@ class PipesContextCreator extends context_creator_1.ContextCreator {
|
|
|
35
35
|
if (!instanceWrapper) {
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
38
|
-
const instanceHost = instanceWrapper.getInstanceByContextId(contextId, inquirerId);
|
|
38
|
+
const instanceHost = instanceWrapper.getInstanceByContextId(this.getContextId(contextId, instanceWrapper), inquirerId);
|
|
39
39
|
return instanceHost && instanceHost.instance;
|
|
40
40
|
}
|
|
41
41
|
getInstanceByMetatype(metatype) {
|
|
@@ -59,7 +59,7 @@ class PipesContextCreator extends context_creator_1.ContextCreator {
|
|
|
59
59
|
}
|
|
60
60
|
const scopedPipeWrappers = this.config.getGlobalRequestPipes();
|
|
61
61
|
const scopedPipes = (0, iterare_1.iterate)(scopedPipeWrappers)
|
|
62
|
-
.map(wrapper => wrapper.getInstanceByContextId(contextId, inquirerId))
|
|
62
|
+
.map(wrapper => wrapper.getInstanceByContextId(this.getContextId(contextId, wrapper), inquirerId))
|
|
63
63
|
.filter(host => !!host)
|
|
64
64
|
.map(host => host.instance)
|
|
65
65
|
.toArray();
|