@lenne.tech/nest-server 12.9.4 → 12.10.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/.claude/rules/configurable-features.md +5 -1
- package/.claude/rules/package-management.md +38 -12
- package/.claude/rules/role-system.md +12 -0
- package/.claude/rules/testing.md +4 -4
- package/CLAUDE.md +10 -1
- package/FRAMEWORK-API.md +2 -1
- package/dist/core/common/decorators/rest-user.decorator.js +4 -0
- package/dist/core/common/decorators/rest-user.decorator.js.map +1 -1
- package/dist/core/common/filters/http-exception-log.filter.js +3 -0
- package/dist/core/common/filters/http-exception-log.filter.js.map +1 -1
- package/dist/core/common/helpers/context.helper.js +9 -0
- package/dist/core/common/helpers/context.helper.js.map +1 -1
- package/dist/core/common/helpers/decorator.helper.js +4 -0
- package/dist/core/common/helpers/decorator.helper.js.map +1 -1
- package/dist/core/common/helpers/execution-context-request.helper.d.ts +14 -1
- package/dist/core/common/helpers/execution-context-request.helper.js +36 -0
- package/dist/core/common/helpers/execution-context-request.helper.js.map +1 -1
- package/dist/core/common/helpers/graphql-upload.helper.d.ts +10 -0
- package/dist/core/common/helpers/graphql-upload.helper.js +237 -0
- package/dist/core/common/helpers/graphql-upload.helper.js.map +1 -0
- package/dist/core/common/helpers/redact-secrets.helper.js +7 -2
- package/dist/core/common/helpers/redact-secrets.helper.js.map +1 -1
- package/dist/core/common/interceptors/translate-response.interceptor.js +4 -0
- package/dist/core/common/interceptors/translate-response.interceptor.js.map +1 -1
- package/dist/core/common/interfaces/server-options.interface.d.ts +11 -0
- package/dist/core/common/middleware/request-context.middleware.js +3 -0
- package/dist/core/common/middleware/request-context.middleware.js.map +1 -1
- package/dist/core/common/plugins/complexity.plugin.js +73 -9
- package/dist/core/common/plugins/complexity.plugin.js.map +1 -1
- package/dist/core/common/services/request-context.service.d.ts +2 -0
- package/dist/core/common/services/request-context.service.js +3 -0
- package/dist/core/common/services/request-context.service.js.map +1 -1
- package/dist/core/modules/ai/core-ai-mcp.controller.js +4 -2
- package/dist/core/modules/ai/core-ai-mcp.controller.js.map +1 -1
- package/dist/core/modules/ai/core-ai.constants.d.ts +1 -0
- package/dist/core/modules/ai/core-ai.constants.js +1 -0
- package/dist/core/modules/ai/core-ai.constants.js.map +1 -1
- package/dist/core/modules/ai/core-ai.module.js +2 -0
- package/dist/core/modules/ai/core-ai.module.js.map +1 -1
- package/dist/core/modules/ai/decorators/ai-agent-function.decorator.d.ts +8 -0
- package/dist/core/modules/ai/decorators/ai-agent-function.decorator.js +8 -0
- package/dist/core/modules/ai/decorators/ai-agent-function.decorator.js.map +1 -0
- package/dist/core/modules/ai/helpers/ai-verified-user.helper.d.ts +12 -0
- package/dist/core/modules/ai/helpers/ai-verified-user.helper.js +23 -0
- package/dist/core/modules/ai/helpers/ai-verified-user.helper.js.map +1 -0
- package/dist/core/modules/ai/index.d.ts +8 -0
- package/dist/core/modules/ai/index.js +8 -0
- package/dist/core/modules/ai/index.js.map +1 -1
- package/dist/core/modules/ai/interfaces/llm-provider.interface.d.ts +1 -0
- package/dist/core/modules/ai/models/core-ai-mcp-oauth.models.js +2 -0
- package/dist/core/modules/ai/models/core-ai-mcp-oauth.models.js.map +1 -1
- package/dist/core/modules/ai/providers/ai-egress.helper.d.ts +6 -0
- package/dist/core/modules/ai/providers/ai-egress.helper.js +58 -0
- package/dist/core/modules/ai/providers/ai-egress.helper.js.map +1 -0
- package/dist/core/modules/ai/providers/ai-sdk.packages.d.ts +16 -0
- package/dist/core/modules/ai/providers/ai-sdk.packages.js +99 -0
- package/dist/core/modules/ai/providers/ai-sdk.packages.js.map +1 -0
- package/dist/core/modules/ai/providers/ai-sdk.provider.d.ts +51 -0
- package/dist/core/modules/ai/providers/ai-sdk.provider.js +244 -0
- package/dist/core/modules/ai/providers/ai-sdk.provider.js.map +1 -0
- package/dist/core/modules/ai/providers/llm-provider.factory.d.ts +11 -1
- package/dist/core/modules/ai/providers/llm-provider.factory.js +44 -3
- package/dist/core/modules/ai/providers/llm-provider.factory.js.map +1 -1
- package/dist/core/modules/ai/providers/openai-compatible.provider.js +4 -21
- package/dist/core/modules/ai/providers/openai-compatible.provider.js.map +1 -1
- package/dist/core/modules/ai/services/core-ai-agent-function.bridge.d.ts +34 -0
- package/dist/core/modules/ai/services/core-ai-agent-function.bridge.js +130 -0
- package/dist/core/modules/ai/services/core-ai-agent-function.bridge.js.map +1 -0
- package/dist/core/modules/ai/services/core-ai-mcp-oauth.service.d.ts +28 -3
- package/dist/core/modules/ai/services/core-ai-mcp-oauth.service.js +141 -15
- package/dist/core/modules/ai/services/core-ai-mcp-oauth.service.js.map +1 -1
- package/dist/core/modules/ai/services/core-ai-mcp.service.js +2 -1
- package/dist/core/modules/ai/services/core-ai-mcp.service.js.map +1 -1
- package/dist/core/modules/ai/services/core-ai.service.js +2 -7
- package/dist/core/modules/ai/services/core-ai.service.js.map +1 -1
- package/dist/core/modules/ai/tools/ai-tool-result.helper.d.ts +2 -0
- package/dist/core/modules/ai/tools/ai-tool-result.helper.js +117 -0
- package/dist/core/modules/ai/tools/ai-tool-result.helper.js.map +1 -0
- package/dist/core/modules/ai/tools/ai-tool-schema.helper.d.ts +36 -0
- package/dist/core/modules/ai/tools/ai-tool-schema.helper.js +81 -0
- package/dist/core/modules/ai/tools/ai-tool-schema.helper.js.map +1 -0
- package/dist/core/modules/ai/tools/ai-tool.registry.js +2 -1
- package/dist/core/modules/ai/tools/ai-tool.registry.js.map +1 -1
- package/dist/core/modules/auth/guards/auth.guard.js +10 -2
- package/dist/core/modules/auth/guards/auth.guard.js.map +1 -1
- package/dist/core/modules/auth/guards/legacy-auth-rate-limit.guard.js +4 -1
- package/dist/core/modules/auth/guards/legacy-auth-rate-limit.guard.js.map +1 -1
- package/dist/core/modules/auth/guards/roles.guard.js +11 -1
- package/dist/core/modules/auth/guards/roles.guard.js.map +1 -1
- package/dist/core/modules/better-auth/better-auth-roles.guard.js +15 -1
- package/dist/core/modules/better-auth/better-auth-roles.guard.js.map +1 -1
- package/dist/core/modules/better-auth/better-auth.config.js +78 -0
- package/dist/core/modules/better-auth/better-auth.config.js.map +1 -1
- package/dist/core/modules/tenant/core-tenant.guard.js +9 -1
- package/dist/core/modules/tenant/core-tenant.guard.js.map +1 -1
- package/dist/core.module.js +2 -1
- package/dist/core.module.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/types/graphql-upload.d.ts +34 -2
- package/docs/REQUEST-LIFECYCLE.md +59 -10
- package/migration-guides/12.10.0-to-12.10.1.md +182 -0
- package/migration-guides/12.9.3-to-12.9.4.md +3 -1
- package/migration-guides/12.9.x-to-12.10.x.md +271 -0
- package/package.json +46 -21
- package/src/core/common/decorators/rest-user.decorator.ts +6 -0
- package/src/core/common/filters/http-exception-log.filter.ts +8 -0
- package/src/core/common/helpers/context.helper.ts +14 -0
- package/src/core/common/helpers/decorator.helper.ts +5 -0
- package/src/core/common/helpers/execution-context-request.helper.ts +97 -1
- package/src/core/common/helpers/graphql-upload.helper.ts +520 -0
- package/src/core/common/helpers/redact-secrets.helper.ts +22 -3
- package/src/core/common/interceptors/translate-response.interceptor.ts +8 -0
- package/src/core/common/interfaces/server-options.interface.ts +98 -0
- package/src/core/common/middleware/request-context.middleware.ts +3 -0
- package/src/core/common/plugins/complexity.plugin.ts +150 -9
- package/src/core/common/services/request-context.service.ts +11 -0
- package/src/core/modules/ai/INTEGRATION-CHECKLIST.md +16 -0
- package/src/core/modules/ai/README.md +101 -0
- package/src/core/modules/ai/core-ai-mcp.controller.ts +7 -2
- package/src/core/modules/ai/core-ai.constants.ts +4 -0
- package/src/core/modules/ai/core-ai.module.ts +3 -0
- package/src/core/modules/ai/decorators/ai-agent-function.decorator.ts +44 -0
- package/src/core/modules/ai/helpers/ai-verified-user.helper.ts +47 -0
- package/src/core/modules/ai/index.ts +8 -0
- package/src/core/modules/ai/interfaces/ai-tool.interface.ts +5 -1
- package/src/core/modules/ai/interfaces/llm-provider.interface.ts +6 -0
- package/src/core/modules/ai/models/core-ai-mcp-oauth.models.ts +4 -0
- package/src/core/modules/ai/providers/ai-egress.helper.ts +98 -0
- package/src/core/modules/ai/providers/ai-sdk.packages.ts +153 -0
- package/src/core/modules/ai/providers/ai-sdk.provider.ts +383 -0
- package/src/core/modules/ai/providers/llm-provider.factory.ts +93 -2
- package/src/core/modules/ai/providers/openai-compatible.provider.ts +5 -23
- package/src/core/modules/ai/services/core-ai-agent-function.bridge.ts +170 -0
- package/src/core/modules/ai/services/core-ai-mcp-oauth.service.ts +240 -20
- package/src/core/modules/ai/services/core-ai-mcp.service.ts +3 -1
- package/src/core/modules/ai/services/core-ai.service.ts +5 -7
- package/src/core/modules/ai/tools/ai-tool-result.helper.ts +153 -0
- package/src/core/modules/ai/tools/ai-tool-schema.helper.ts +134 -0
- package/src/core/modules/ai/tools/ai-tool.registry.ts +6 -1
- package/src/core/modules/auth/guards/auth.guard.ts +19 -2
- package/src/core/modules/auth/guards/legacy-auth-rate-limit.guard.ts +9 -2
- package/src/core/modules/auth/guards/roles.guard.ts +23 -1
- package/src/core/modules/better-auth/INTEGRATION-CHECKLIST.md +11 -0
- package/src/core/modules/better-auth/README.md +204 -0
- package/src/core/modules/better-auth/better-auth-roles.guard.ts +29 -1
- package/src/core/modules/better-auth/better-auth.config.ts +138 -1
- package/src/core/modules/tenant/core-tenant.guard.ts +13 -1
- package/src/core.module.ts +5 -1
- package/src/index.ts +1 -0
- package/src/types/graphql-upload.d.ts +34 -2
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { createParamDecorator, ExecutionContext } from '@nestjs/common';
|
|
2
2
|
|
|
3
|
+
import { isAgentCallContext, resolveAgentCallRequest } from '../helpers/execution-context-request.helper.js';
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* User decorator for REST request
|
|
5
7
|
*/
|
|
6
8
|
export const RESTUser = createParamDecorator((data: unknown, ctx: ExecutionContext) => {
|
|
9
|
+
// An agent function / MCP call: the request's user, never one in the call's arguments (nestjs-ai plan §1)
|
|
10
|
+
if (isAgentCallContext(ctx)) {
|
|
11
|
+
return resolveAgentCallRequest(ctx)?.user;
|
|
12
|
+
}
|
|
7
13
|
const request = ctx.switchToHttp().getRequest();
|
|
8
14
|
return request.user;
|
|
9
15
|
});
|
|
@@ -37,6 +37,14 @@ export class HttpExceptionLogFilter implements ExceptionFilter {
|
|
|
37
37
|
return exception;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
// Any transport without an HTTP response of its own — an agent function call (`'ai'`) or an MCP call (`'mcp'`),
|
|
41
|
+
// whose second argument is the CALL, not a response (nestjs-ai plan §1). Returning nothing hands the exception
|
|
42
|
+
// back to the caller's handler, which tells the model or MCP client its message. Writing to `switchToHttp()`
|
|
43
|
+
// there threw a TypeError instead, and the model read "Internal server error" for every 401 / 403 / 404.
|
|
44
|
+
if (type !== 'http') {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
|
|
40
48
|
// REST
|
|
41
49
|
const ctx = host.switchToHttp();
|
|
42
50
|
const res = ctx.getResponse<Response>();
|
|
@@ -2,6 +2,8 @@ import { ExecutionContext } from '@nestjs/common';
|
|
|
2
2
|
import { GqlExecutionContext } from '@nestjs/graphql';
|
|
3
3
|
import { Request as RequestType } from 'express';
|
|
4
4
|
|
|
5
|
+
import { isAgentCallContext, resolveAgentCallRequest } from './execution-context-request.helper.js';
|
|
6
|
+
|
|
5
7
|
/**
|
|
6
8
|
* Helper for context processing
|
|
7
9
|
* @deprecated use functions directly
|
|
@@ -33,6 +35,18 @@ export function getContextData(context: ExecutionContext): {
|
|
|
33
35
|
return { args: null, currentUser: null, request: null };
|
|
34
36
|
}
|
|
35
37
|
|
|
38
|
+
// An agent function / MCP call (nestjs-ai plan §1): the user is the one of the request the call runs in — never a
|
|
39
|
+
// `user` in the call's arguments, which the model or the MCP client wrote. A request-less call has no user, so the
|
|
40
|
+
// interceptors filter its result for an anonymous caller (the strictest view).
|
|
41
|
+
if (isAgentCallContext(context)) {
|
|
42
|
+
const agentRequest = resolveAgentCallRequest(context);
|
|
43
|
+
return {
|
|
44
|
+
args: context.getArgByIndex(0),
|
|
45
|
+
currentUser: agentRequest?.user,
|
|
46
|
+
request: (agentRequest ?? null) as RequestType,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
36
50
|
// Init data
|
|
37
51
|
let user: { [key: string]: any };
|
|
38
52
|
let rawContext: any = null;
|
|
@@ -3,12 +3,17 @@ import { GqlContextType, GqlExecutionContext } from '@nestjs/graphql';
|
|
|
3
3
|
import type { PopulateOptions } from 'mongoose';
|
|
4
4
|
|
|
5
5
|
import { getPopulateOptions } from './db.helper.js';
|
|
6
|
+
import { isAgentCallContext, resolveAgentCallRequest } from './execution-context-request.helper.js';
|
|
6
7
|
import { removePropertiesDeep } from './input.helper.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Decorator function to get current user for Controller (http context) and Resolver (graphql context)
|
|
10
11
|
*/
|
|
11
12
|
export function currentUserDec(data, ctx: ExecutionContext) {
|
|
13
|
+
// An agent function / MCP call: the request's user, never one in the call's arguments (nestjs-ai plan §1)
|
|
14
|
+
if (isAgentCallContext(ctx)) {
|
|
15
|
+
return resolveAgentCallRequest(ctx)?.user;
|
|
16
|
+
}
|
|
12
17
|
if (ctx.getType<GqlContextType>() === 'graphql') {
|
|
13
18
|
const gqlContext = GqlExecutionContext.create(ctx);
|
|
14
19
|
return gqlContext.getContext().req.user;
|
|
@@ -28,7 +28,97 @@
|
|
|
28
28
|
* `src/core/common/**` and from `src/core/modules/**` alike without adding an import edge between
|
|
29
29
|
* them. See `.claude/rules/architecture.md` → "DI Token Placement (SWC-Safe)".
|
|
30
30
|
*/
|
|
31
|
-
import type { ExecutionContext } from '@nestjs/common';
|
|
31
|
+
import type { ArgumentsHost, ExecutionContext } from '@nestjs/common';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The execution context types of an agent function call (`@nestjs/ai`, `'ai'`) and of an MCP primitive call
|
|
35
|
+
* (`@nestjs/mcp`, `'mcp'`). nestjs-ai plan §1.
|
|
36
|
+
*
|
|
37
|
+
* Both packages wrap a method with Nest's `ExternalContextCreator`, so EVERY global guard, interceptor and filter of
|
|
38
|
+
* the application runs around it — ours included, in any project that installs either package, whether or not it uses
|
|
39
|
+
* the framework's own AI module. Their arguments are `[input, call]`:
|
|
40
|
+
*
|
|
41
|
+
* | Index | `'ai'` (`AgentFunctionContext`) | `'mcp'` (`McpContext`) | Trust |
|
|
42
|
+
* |-------|---------------------------------|------------------------|-------|
|
|
43
|
+
* | 0 | the tool arguments the MODEL wrote | the tool arguments the MCP CLIENT sent | none — attacker-controlled |
|
|
44
|
+
* | 1 | built by `@nestjs/ai` from the call's `caller` (`request`, `user`, `scopes`) | built by `@nestjs/mcp` (`request`, `authInfo`) | server code |
|
|
45
|
+
*
|
|
46
|
+
* Before 12.10.0 every guard fell back to `switchToHttp().getRequest()` on such a context — which is index 0, the
|
|
47
|
+
* MODEL's arguments. A tool call `{ "user": { "roles": ["admin"] } }` was then the request a guard decided on. The
|
|
48
|
+
* resolvers below are duck-typed against that argument layout on purpose: `src/core/common/` imports neither package,
|
|
49
|
+
* so a project without them loads nothing new.
|
|
50
|
+
*/
|
|
51
|
+
export const AGENT_CALL_CONTEXT_TYPES: ReadonlySet<string> = new Set(['ai', 'mcp']);
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The second argument of an agent or MCP call, as far as the framework reads it. Everything else on it belongs to the
|
|
55
|
+
* package that built it.
|
|
56
|
+
*/
|
|
57
|
+
export interface AgentCallLike {
|
|
58
|
+
/** `'mcp'` only: the verified access token, when `@nestjs/mcp`'s `auth` option is configured. */
|
|
59
|
+
authInfo?: { [key: string]: unknown; extra?: Record<PropertyKey, unknown> };
|
|
60
|
+
/** The agent function's / tool's name. */
|
|
61
|
+
name?: string;
|
|
62
|
+
/** The HTTP platform's request the call runs in; `undefined` for a queue job, a durable run, stdio. */
|
|
63
|
+
request?: GuardRequestLike;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Symbol under which `CoreAiMcpOAuthService.createMcpTokenVerifier()` (AI module) records the user an MCP OAuth access token belongs to,
|
|
68
|
+
* in the `extra` of the `AuthInfo` it returns to `@nestjs/mcp`. A symbol rather than a string key, so a verifier of
|
|
69
|
+
* another identity provider cannot name it by accident and a JSON payload cannot carry it at all. `Symbol.for`, so a
|
|
70
|
+
* second copy of the framework in one process (npm and vendored) agrees on it.
|
|
71
|
+
*/
|
|
72
|
+
export const MCP_VERIFIED_USER = Symbol.for('lt.nest-server.mcp-verified-user');
|
|
73
|
+
|
|
74
|
+
/** Whether `context` is an agent function call (`'ai'`) or an MCP primitive call (`'mcp'`). */
|
|
75
|
+
export function isAgentCallContext(context: ArgumentsHost | undefined): boolean {
|
|
76
|
+
let type: unknown;
|
|
77
|
+
try {
|
|
78
|
+
type = context?.getType?.();
|
|
79
|
+
} catch {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
return typeof type === 'string' && AGENT_CALL_CONTEXT_TYPES.has(type);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** The call object (`args[1]`) of an agent or MCP call; `undefined` for any other context. */
|
|
86
|
+
export function agentCallOf(context: ArgumentsHost | undefined): AgentCallLike | undefined {
|
|
87
|
+
if (!isAgentCallContext(context)) {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
const call = context.getArgByIndex(1);
|
|
91
|
+
return call && typeof call === 'object' ? (call as AgentCallLike) : undefined;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The request an agent or MCP call runs in — never its arguments.
|
|
96
|
+
*
|
|
97
|
+
* `undefined` for a REQUEST-LESS caller: `@nestjs/ai`'s `caller: { user, scopes }` (a queue job, a durable run) or MCP
|
|
98
|
+
* over stdio. The framework treats such a caller as ANONYMOUS (nestjs-ai plan §1, owner decision recorded there): its
|
|
99
|
+
* `caller.user` is data the calling code put there — a job payload read back from Redis, a workflow's stored input —
|
|
100
|
+
* that nothing authenticated, and the tenant scope of the data layer (`RequestContext`) has no request to come from.
|
|
101
|
+
* So a role-gated agent function or tool refuses it with 401; one open to `S_EVERYONE` runs. A project that runs a
|
|
102
|
+
* role-gated agent function from a job authenticates first and passes the request (`caller: { request }`).
|
|
103
|
+
*
|
|
104
|
+
* MCP: when the request carries no user but `@nestjs/mcp`'s `authInfo` was produced by the framework's own MCP OAuth
|
|
105
|
+
* verifier (`CoreAiMcpOAuthService.createMcpTokenVerifier()`), the user that verifier loaded becomes `request.user` — the same step
|
|
106
|
+
* `CoreAiMcpController.scopeLateResolvedUser()` takes for `/ai/mcp`, so the data layer sees the caller too.
|
|
107
|
+
*/
|
|
108
|
+
export function resolveAgentCallRequest(context: ArgumentsHost | undefined): GuardRequestLike | undefined {
|
|
109
|
+
const call = agentCallOf(context);
|
|
110
|
+
const request = call?.request;
|
|
111
|
+
if (!request || typeof request !== 'object') {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
if (!request.user) {
|
|
115
|
+
const verified = call.authInfo?.extra?.[MCP_VERIFIED_USER];
|
|
116
|
+
if (verified && typeof verified === 'object') {
|
|
117
|
+
request.user = verified;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return request;
|
|
121
|
+
}
|
|
32
122
|
|
|
33
123
|
/**
|
|
34
124
|
* The shape a guard reads and writes. It is deliberately loose: on HTTP this IS the Express request,
|
|
@@ -61,6 +151,8 @@ function isSubscriptionContext(value: any): boolean {
|
|
|
61
151
|
* Resolve the object a guard should decide on.
|
|
62
152
|
*
|
|
63
153
|
* Order matters:
|
|
154
|
+
* 0. An agent function or MCP call (`'ai'` / `'mcp'`): the request the call runs in, or `undefined` — never the
|
|
155
|
+
* call's arguments, which the HTTP fallback below would return (see {@link resolveAgentCallRequest}).
|
|
64
156
|
* 1. `ctx.getContext().req` — HTTP GraphQL, and the shape every existing consumer expects.
|
|
65
157
|
* 2. The graphql-ws subscription context itself, when it looks like one (see above).
|
|
66
158
|
* 3. `switchToHttp().getRequest()` — REST controllers. On a GraphQL context this returns the
|
|
@@ -73,6 +165,10 @@ export function resolveGuardRequest(
|
|
|
73
165
|
context: ExecutionContext,
|
|
74
166
|
gqlContextOf: (context: ExecutionContext) => any,
|
|
75
167
|
): GuardRequestLike | undefined {
|
|
168
|
+
if (isAgentCallContext(context)) {
|
|
169
|
+
return resolveAgentCallRequest(context);
|
|
170
|
+
}
|
|
171
|
+
|
|
76
172
|
let gqlContext: any;
|
|
77
173
|
try {
|
|
78
174
|
gqlContext = gqlContextOf(context);
|