@nestjs/core 9.3.10 → 9.3.11
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/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/interceptors/interceptors-context-creator.js +2 -2
- package/package.json +2 -2
- package/pipes/pipes-context-creator.js +2 -2
|
@@ -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;
|
|
@@ -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.11",
|
|
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.11"
|
|
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();
|