@nest-boot/request-context 7.7.6 → 8.0.0-beta.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/dist/create-request-context.decorator.d.ts +1 -57
- package/dist/create-request-context.decorator.js +3 -59
- package/dist/create-request-context.decorator.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +7 -23
- package/dist/index.js.map +1 -1
- package/dist/repl.d.ts +0 -41
- package/dist/repl.js +23 -100
- package/dist/repl.js.map +1 -1
- package/dist/request-context.constants.d.ts +0 -22
- package/dist/request-context.constants.js +2 -27
- package/dist/request-context.constants.js.map +1 -1
- package/dist/request-context.d.ts +0 -296
- package/dist/request-context.interceptor.d.ts +0 -33
- package/dist/request-context.interceptor.js +11 -49
- package/dist/request-context.interceptor.js.map +1 -1
- package/dist/request-context.js +12 -265
- package/dist/request-context.js.map +1 -1
- package/dist/request-context.middleware.d.ts +0 -27
- package/dist/request-context.middleware.js +11 -41
- package/dist/request-context.middleware.js.map +1 -1
- package/dist/request-context.module.d.ts +1 -42
- package/dist/request-context.module.js +18 -60
- package/dist/request-context.module.js.map +1 -1
- package/package.json +33 -21
- package/dist/request-context.interceptor.spec.d.ts +0 -1
- package/dist/request-context.interceptor.spec.js +0 -247
- package/dist/request-context.interceptor.spec.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
|
@@ -1,59 +1,3 @@
|
|
|
1
|
-
import { RequestContext } from "./request-context";
|
|
2
|
-
/**
|
|
3
|
-
* Helper type that extracts the argument types of a method.
|
|
4
|
-
*/
|
|
1
|
+
import { RequestContext } from "./request-context.js";
|
|
5
2
|
export type MethodArgs<T, M extends keyof T> = T[M] extends (...args: infer A) => any ? A : never;
|
|
6
|
-
/**
|
|
7
|
-
* Method decorator that wraps the method execution in a new request context.
|
|
8
|
-
*
|
|
9
|
-
* This is useful for creating request contexts for background jobs, event handlers,
|
|
10
|
-
* or any other code that runs outside of HTTP request handling.
|
|
11
|
-
*
|
|
12
|
-
* @typeParam T - The class type containing the method
|
|
13
|
-
* @typeParam P - The property key of the method
|
|
14
|
-
* @param fn - A function that creates the RequestContext, receiving the class instance and method arguments
|
|
15
|
-
* @returns A method decorator
|
|
16
|
-
*
|
|
17
|
-
* @example Basic usage with a job processor
|
|
18
|
-
* ```typescript
|
|
19
|
-
* import { CreateRequestContext, RequestContext } from '@nest-boot/request-context';
|
|
20
|
-
*
|
|
21
|
-
* class JobProcessor {
|
|
22
|
-
* @CreateRequestContext((instance, jobData) =>
|
|
23
|
-
* new RequestContext({ type: 'job', id: jobData.id })
|
|
24
|
-
* )
|
|
25
|
-
* async processJob(jobData: { id: string; payload: any }) {
|
|
26
|
-
* // This code runs within a request context
|
|
27
|
-
* console.log(`Processing job ${RequestContext.id}`);
|
|
28
|
-
* // ...
|
|
29
|
-
* }
|
|
30
|
-
* }
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* @example With service injection
|
|
34
|
-
* ```typescript
|
|
35
|
-
* import { Injectable } from '@nestjs/common';
|
|
36
|
-
* import { CreateRequestContext, RequestContext } from '@nest-boot/request-context';
|
|
37
|
-
*
|
|
38
|
-
* @Injectable()
|
|
39
|
-
* class EventHandler {
|
|
40
|
-
* @CreateRequestContext((instance, event) =>
|
|
41
|
-
* new RequestContext({
|
|
42
|
-
* type: 'event',
|
|
43
|
-
* id: event.correlationId,
|
|
44
|
-
* })
|
|
45
|
-
* )
|
|
46
|
-
* async handleEvent(event: { correlationId: string; data: any }) {
|
|
47
|
-
* // Access context within the handler
|
|
48
|
-
* RequestContext.set('eventType', event.data.type);
|
|
49
|
-
* await this.processEvent(event);
|
|
50
|
-
* }
|
|
51
|
-
*
|
|
52
|
-
* private async processEvent(event: any) {
|
|
53
|
-
* // Context is still available here
|
|
54
|
-
* const eventType = RequestContext.get('eventType');
|
|
55
|
-
* }
|
|
56
|
-
* }
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
3
|
export declare function CreateRequestContext<T extends object, P extends keyof T>(fn: (instance: T, ...args: MethodArgs<T, P>) => RequestContext): (_target: T, _propertyKey: P, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
@@ -1,67 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.CreateRequestContext = CreateRequestContext;
|
|
4
|
-
const request_context_1 = require("./request-context");
|
|
5
|
-
/**
|
|
6
|
-
* Method decorator that wraps the method execution in a new request context.
|
|
7
|
-
*
|
|
8
|
-
* This is useful for creating request contexts for background jobs, event handlers,
|
|
9
|
-
* or any other code that runs outside of HTTP request handling.
|
|
10
|
-
*
|
|
11
|
-
* @typeParam T - The class type containing the method
|
|
12
|
-
* @typeParam P - The property key of the method
|
|
13
|
-
* @param fn - A function that creates the RequestContext, receiving the class instance and method arguments
|
|
14
|
-
* @returns A method decorator
|
|
15
|
-
*
|
|
16
|
-
* @example Basic usage with a job processor
|
|
17
|
-
* ```typescript
|
|
18
|
-
* import { CreateRequestContext, RequestContext } from '@nest-boot/request-context';
|
|
19
|
-
*
|
|
20
|
-
* class JobProcessor {
|
|
21
|
-
* @CreateRequestContext((instance, jobData) =>
|
|
22
|
-
* new RequestContext({ type: 'job', id: jobData.id })
|
|
23
|
-
* )
|
|
24
|
-
* async processJob(jobData: { id: string; payload: any }) {
|
|
25
|
-
* // This code runs within a request context
|
|
26
|
-
* console.log(`Processing job ${RequestContext.id}`);
|
|
27
|
-
* // ...
|
|
28
|
-
* }
|
|
29
|
-
* }
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* @example With service injection
|
|
33
|
-
* ```typescript
|
|
34
|
-
* import { Injectable } from '@nestjs/common';
|
|
35
|
-
* import { CreateRequestContext, RequestContext } from '@nest-boot/request-context';
|
|
36
|
-
*
|
|
37
|
-
* @Injectable()
|
|
38
|
-
* class EventHandler {
|
|
39
|
-
* @CreateRequestContext((instance, event) =>
|
|
40
|
-
* new RequestContext({
|
|
41
|
-
* type: 'event',
|
|
42
|
-
* id: event.correlationId,
|
|
43
|
-
* })
|
|
44
|
-
* )
|
|
45
|
-
* async handleEvent(event: { correlationId: string; data: any }) {
|
|
46
|
-
* // Access context within the handler
|
|
47
|
-
* RequestContext.set('eventType', event.data.type);
|
|
48
|
-
* await this.processEvent(event);
|
|
49
|
-
* }
|
|
50
|
-
*
|
|
51
|
-
* private async processEvent(event: any) {
|
|
52
|
-
* // Context is still available here
|
|
53
|
-
* const eventType = RequestContext.get('eventType');
|
|
54
|
-
* }
|
|
55
|
-
* }
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
function CreateRequestContext(fn) {
|
|
1
|
+
import { RequestContext } from "./request-context.js";
|
|
2
|
+
export function CreateRequestContext(fn) {
|
|
59
3
|
return (_target, _propertyKey, descriptor) => {
|
|
60
4
|
if (descriptor.value) {
|
|
61
5
|
const original = descriptor.value;
|
|
62
6
|
descriptor.value = function (...args) {
|
|
63
7
|
const ctx = fn(this, ...args);
|
|
64
|
-
return
|
|
8
|
+
return RequestContext.run(ctx, () => original.apply(this, args));
|
|
65
9
|
};
|
|
66
10
|
}
|
|
67
11
|
return descriptor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-request-context.decorator.js","sourceRoot":"","sources":["../src/create-request-context.decorator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-request-context.decorator.js","sourceRoot":"","sources":["../src/create-request-context.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAgEtD,MAAM,UAAU,oBAAoB,CAClC,EAA8D;IAE9D,OAAO,CAAC,OAAU,EAAE,YAAe,EAAE,UAA8B,EAAE,EAAE;QACrE,IAAI,UAAU,CAAC,KAAK,EAAE,CAAC;YACrB,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC;YAElC,UAAU,CAAC,KAAK,GAAG,UAAmB,GAAG,IAAsB;gBAC7D,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;gBAC9B,OAAO,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;YACnE,CAAC,CAAC;QACJ,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from "./create-request-context.decorator";
|
|
2
|
-
export * from "./repl";
|
|
3
|
-
export * from "./request-context";
|
|
4
|
-
export * from "./request-context.
|
|
5
|
-
export * from "./request-context.
|
|
6
|
-
export * from "./request-context.middleware";
|
|
7
|
-
export * from "./request-context.module";
|
|
1
|
+
export * from "./create-request-context.decorator.js";
|
|
2
|
+
export * from "./repl.js";
|
|
3
|
+
export * from "./request-context.constants.js";
|
|
4
|
+
export * from "./request-context.interceptor.js";
|
|
5
|
+
export * from "./request-context.js";
|
|
6
|
+
export * from "./request-context.middleware.js";
|
|
7
|
+
export * from "./request-context.module.js";
|
package/dist/index.js
CHANGED
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./create-request-context.decorator"), exports);
|
|
18
|
-
__exportStar(require("./repl"), exports);
|
|
19
|
-
__exportStar(require("./request-context"), exports);
|
|
20
|
-
__exportStar(require("./request-context.constants"), exports);
|
|
21
|
-
__exportStar(require("./request-context.interceptor"), exports);
|
|
22
|
-
__exportStar(require("./request-context.middleware"), exports);
|
|
23
|
-
__exportStar(require("./request-context.module"), exports);
|
|
1
|
+
export * from "./create-request-context.decorator.js";
|
|
2
|
+
export * from "./repl.js";
|
|
3
|
+
export * from "./request-context.constants.js";
|
|
4
|
+
export * from "./request-context.interceptor.js";
|
|
5
|
+
export * from "./request-context.js";
|
|
6
|
+
export * from "./request-context.middleware.js";
|
|
7
|
+
export * from "./request-context.module.js";
|
|
24
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC;AACtD,cAAc,WAAW,CAAC;AAC1B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC"}
|
package/dist/repl.d.ts
CHANGED
|
@@ -1,44 +1,3 @@
|
|
|
1
1
|
import { DynamicModule, Type } from "@nestjs/common";
|
|
2
2
|
import type { REPLServer } from "repl";
|
|
3
|
-
/**
|
|
4
|
-
* Starts a REPL (Read-Eval-Print Loop) session with request context support.
|
|
5
|
-
*
|
|
6
|
-
* This function creates a NestJS application context and starts an interactive
|
|
7
|
-
* REPL session where all commands run within a request context. This is useful
|
|
8
|
-
* for debugging and testing services that depend on request context.
|
|
9
|
-
*
|
|
10
|
-
* The REPL session:
|
|
11
|
-
* - Runs within a request context of type 'repl'
|
|
12
|
-
* - Has access to all NestJS providers
|
|
13
|
-
* - Maintains context across async operations
|
|
14
|
-
*
|
|
15
|
-
* @param module - The NestJS module (class or DynamicModule) to create the context from
|
|
16
|
-
* @returns A promise that resolves to the REPL server instance
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* // repl.ts
|
|
21
|
-
* import { repl } from '@nest-boot/request-context';
|
|
22
|
-
* import { AppModule } from './app.module';
|
|
23
|
-
*
|
|
24
|
-
* async function bootstrap() {
|
|
25
|
-
* await repl(AppModule);
|
|
26
|
-
* }
|
|
27
|
-
*
|
|
28
|
-
* bootstrap();
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* @example Running the REPL
|
|
32
|
-
* ```bash
|
|
33
|
-
* npx ts-node -r tsconfig-paths/register repl.ts
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* @example Using services in REPL
|
|
37
|
-
* ```typescript
|
|
38
|
-
* // In the REPL session:
|
|
39
|
-
* > const userService = get(UserService)
|
|
40
|
-
* > await userService.findAll()
|
|
41
|
-
* > RequestContext.id // Access current context ID
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
3
|
export declare function repl(module: Type | DynamicModule): Promise<REPLServer>;
|
package/dist/repl.js
CHANGED
|
@@ -1,103 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.repl = repl;
|
|
37
|
-
const common_1 = require("@nestjs/common");
|
|
38
|
-
const cli_colors_util_1 = require("@nestjs/common/utils/cli-colors.util");
|
|
39
|
-
const core_1 = require("@nestjs/core");
|
|
40
|
-
const assign_to_object_util_1 = require("@nestjs/core/repl/assign-to-object.util");
|
|
41
|
-
const constants_1 = require("@nestjs/core/repl/constants");
|
|
42
|
-
const repl_context_1 = require("@nestjs/core/repl/repl-context");
|
|
43
|
-
const repl_logger_1 = require("@nestjs/core/repl/repl-logger");
|
|
44
|
-
const repl_native_commands_1 = require("@nestjs/core/repl/repl-native-commands");
|
|
45
|
-
const async_hooks_1 = require("async_hooks");
|
|
46
|
-
const stream_1 = require("stream");
|
|
47
|
-
const request_context_1 = require("./request-context");
|
|
48
|
-
/**
|
|
49
|
-
* Starts a REPL (Read-Eval-Print Loop) session with request context support.
|
|
50
|
-
*
|
|
51
|
-
* This function creates a NestJS application context and starts an interactive
|
|
52
|
-
* REPL session where all commands run within a request context. This is useful
|
|
53
|
-
* for debugging and testing services that depend on request context.
|
|
54
|
-
*
|
|
55
|
-
* The REPL session:
|
|
56
|
-
* - Runs within a request context of type 'repl'
|
|
57
|
-
* - Has access to all NestJS providers
|
|
58
|
-
* - Maintains context across async operations
|
|
59
|
-
*
|
|
60
|
-
* @param module - The NestJS module (class or DynamicModule) to create the context from
|
|
61
|
-
* @returns A promise that resolves to the REPL server instance
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```typescript
|
|
65
|
-
* // repl.ts
|
|
66
|
-
* import { repl } from '@nest-boot/request-context';
|
|
67
|
-
* import { AppModule } from './app.module';
|
|
68
|
-
*
|
|
69
|
-
* async function bootstrap() {
|
|
70
|
-
* await repl(AppModule);
|
|
71
|
-
* }
|
|
72
|
-
*
|
|
73
|
-
* bootstrap();
|
|
74
|
-
* ```
|
|
75
|
-
*
|
|
76
|
-
* @example Running the REPL
|
|
77
|
-
* ```bash
|
|
78
|
-
* npx ts-node -r tsconfig-paths/register repl.ts
|
|
79
|
-
* ```
|
|
80
|
-
*
|
|
81
|
-
* @example Using services in REPL
|
|
82
|
-
* ```typescript
|
|
83
|
-
* // In the REPL session:
|
|
84
|
-
* > const userService = get(UserService)
|
|
85
|
-
* > await userService.findAll()
|
|
86
|
-
* > RequestContext.id // Access current context ID
|
|
87
|
-
* ```
|
|
88
|
-
*/
|
|
89
|
-
async function repl(module) {
|
|
90
|
-
const app = await core_1.NestFactory.createApplicationContext(module, {
|
|
1
|
+
import { Logger } from "@nestjs/common";
|
|
2
|
+
import { clc } from "@nestjs/common/utils/cli-colors.util";
|
|
3
|
+
import { NestFactory } from "@nestjs/core";
|
|
4
|
+
import { assignToObject } from "@nestjs/core/repl/assign-to-object.util";
|
|
5
|
+
import { REPL_INITIALIZED_MESSAGE } from "@nestjs/core/repl/constants";
|
|
6
|
+
import { ReplContext } from "@nestjs/core/repl/repl-context";
|
|
7
|
+
import { ReplLogger } from "@nestjs/core/repl/repl-logger";
|
|
8
|
+
import { defineDefaultCommandsOnRepl } from "@nestjs/core/repl/repl-native-commands";
|
|
9
|
+
import { AsyncResource } from "async_hooks";
|
|
10
|
+
import { Transform } from "stream";
|
|
11
|
+
import { RequestContext } from "./request-context.js";
|
|
12
|
+
export async function repl(module) {
|
|
13
|
+
const app = await NestFactory.createApplicationContext(module, {
|
|
91
14
|
abortOnError: false,
|
|
92
|
-
logger: new
|
|
15
|
+
logger: new ReplLogger(),
|
|
93
16
|
});
|
|
94
17
|
await app.init();
|
|
95
|
-
const replContext = new
|
|
96
|
-
|
|
97
|
-
return await
|
|
98
|
-
const asyncResource = new
|
|
99
|
-
const replServer = (await
|
|
100
|
-
input: new Proxy(process.stdin.pipe(new
|
|
18
|
+
const replContext = new ReplContext(app);
|
|
19
|
+
Logger.log(REPL_INITIALIZED_MESSAGE);
|
|
20
|
+
return await RequestContext.run(new RequestContext({ type: "repl" }), async () => {
|
|
21
|
+
const asyncResource = new AsyncResource("REPL");
|
|
22
|
+
const replServer = (await import("repl")).start({
|
|
23
|
+
input: new Proxy(process.stdin.pipe(new Transform({
|
|
101
24
|
transform(chunk, encoding, callback) {
|
|
102
25
|
asyncResource.runInAsyncScope(callback, null, null, chunk);
|
|
103
26
|
},
|
|
@@ -112,11 +35,11 @@ async function repl(module) {
|
|
|
112
35
|
},
|
|
113
36
|
}),
|
|
114
37
|
output: process.stdout,
|
|
115
|
-
prompt:
|
|
38
|
+
prompt: clc.green("> "),
|
|
116
39
|
ignoreUndefined: true,
|
|
117
40
|
});
|
|
118
|
-
|
|
119
|
-
|
|
41
|
+
assignToObject(replServer.context, replContext.globalScope);
|
|
42
|
+
defineDefaultCommandsOnRepl(replServer);
|
|
120
43
|
return replServer;
|
|
121
44
|
});
|
|
122
45
|
}
|
package/dist/repl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repl.js","sourceRoot":"","sources":["../src/repl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"repl.js","sourceRoot":"","sources":["../src/repl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,EAAQ,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,sCAAsC,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AA2CtD,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,MAA4B;IACrD,MAAM,GAAG,GAAG,MAAM,WAAW,CAAC,wBAAwB,CAAC,MAAM,EAAE;QAC7D,YAAY,EAAE,KAAK;QACnB,MAAM,EAAE,IAAI,UAAU,EAAE;KACzB,CAAC,CAAC;IAEH,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAEjB,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC;IACzC,MAAM,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IAErC,OAAO,MAAM,cAAc,CAAC,GAAG,CAC7B,IAAI,cAAc,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EACpC,KAAK,IAAI,EAAE;QACT,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;QAEhD,MAAM,UAAU,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;YAC9C,KAAK,EAAE,IAAI,KAAK,CACd,OAAO,CAAC,KAAK,CAAC,IAAI,CAChB,IAAI,SAAS,CAAC;gBACZ,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ;oBACjC,aAAa,CAAC,eAAe,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;gBAC7D,CAAC;aACF,CAAC,CACH,EACD;gBACE,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ;oBACxB,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;wBACnB,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;oBAC7C,CAAC;yBAAM,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;wBACjC,OAAO,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;oBACpD,CAAC;gBACH,CAAC;aACF,CACF;YACD,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;YACvB,eAAe,EAAE,IAAI;SACtB,CAAC,CAAC;QAEH,cAAc,CAAC,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;QAE5D,2BAA2B,CAAC,UAAU,CAAC,CAAC;QAExC,OAAO,UAAU,CAAC;IACpB,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Token for storing the HTTP request object in the request context.
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* ```typescript
|
|
6
|
-
* import { REQUEST } from '@nest-boot/request-context';
|
|
7
|
-
* import { Request } from 'express';
|
|
8
|
-
*
|
|
9
|
-
* const req = RequestContext.get<Request>(REQUEST);
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
1
|
export declare const REQUEST = "REQUEST";
|
|
13
|
-
/**
|
|
14
|
-
* Token for storing the HTTP response object in the request context.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* import { RESPONSE } from '@nest-boot/request-context';
|
|
19
|
-
* import { Response } from 'express';
|
|
20
|
-
*
|
|
21
|
-
* const res = RequestContext.get<Response>(RESPONSE);
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
2
|
export declare const RESPONSE = "RESPONSE";
|
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.RESPONSE = exports.REQUEST = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Token for storing the HTTP request object in the request context.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import { REQUEST } from '@nest-boot/request-context';
|
|
10
|
-
* import { Request } from 'express';
|
|
11
|
-
*
|
|
12
|
-
* const req = RequestContext.get<Request>(REQUEST);
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
exports.REQUEST = "REQUEST";
|
|
16
|
-
/**
|
|
17
|
-
* Token for storing the HTTP response object in the request context.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* import { RESPONSE } from '@nest-boot/request-context';
|
|
22
|
-
* import { Response } from 'express';
|
|
23
|
-
*
|
|
24
|
-
* const res = RequestContext.get<Response>(RESPONSE);
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
exports.RESPONSE = "RESPONSE";
|
|
1
|
+
export const REQUEST = "REQUEST";
|
|
2
|
+
export const RESPONSE = "RESPONSE";
|
|
28
3
|
//# sourceMappingURL=request-context.constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-context.constants.js","sourceRoot":"","sources":["../src/request-context.constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"request-context.constants.js","sourceRoot":"","sources":["../src/request-context.constants.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AAajC,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC"}
|