@webpieces/core-context 0.3.294 → 0.3.296
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/package.json +2 -2
- package/src/HttpRequest.d.ts +27 -0
- package/src/HttpRequest.js +40 -0
- package/src/HttpRequest.js.map +1 -0
- package/src/RequestContext.d.ts +10 -0
- package/src/RequestContext.js +15 -0
- package/src/RequestContext.js.map +1 -1
- package/src/index.d.ts +1 -0
- package/src/index.js +4 -1
- package/src/index.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpieces/core-context",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.296",
|
|
4
4
|
"description": "AsyncLocalStorage-based context management for request-scoped data",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@webpieces/core-util": "0.3.
|
|
25
|
+
"@webpieces/core-util": "0.3.296",
|
|
26
26
|
"@inversifyjs/binding-decorators": "1.1.5",
|
|
27
27
|
"inversify": "7.10.4",
|
|
28
28
|
"reflect-metadata": "0.2.2"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ContextKey } from '@webpieces/core-util';
|
|
2
|
+
/**
|
|
3
|
+
* HttpRequest - webpieces' TRANSPORT-NEUTRAL inbound request.
|
|
4
|
+
*
|
|
5
|
+
* This is @webpieces/http-routing's own request type (http-routing re-exports it), NOT
|
|
6
|
+
* express's `req`. Each transport adapter (the express adapter in @webpieces/http-server, or
|
|
7
|
+
* any other TypeScript web framework) builds an HttpRequest from its native request and hands
|
|
8
|
+
* it to the router. Filters and the auth layer read it via `RequestContext.getRequest()`
|
|
9
|
+
* instead of touching express — which is what lets the SAME filter chain run over HTTP and
|
|
10
|
+
* in-process (tests build an HttpRequest carrying their credential).
|
|
11
|
+
*
|
|
12
|
+
* It lives in core-context (alongside RequestContext, which stores it in AsyncLocalStorage)
|
|
13
|
+
* to avoid a core-context → http-routing cycle; it is a pure data holder (no express, no DI).
|
|
14
|
+
*/
|
|
15
|
+
export declare class HttpRequest {
|
|
16
|
+
readonly method: string;
|
|
17
|
+
readonly path: string;
|
|
18
|
+
/** Header name (lowercased) -> values (HTTP allows multiple values per name). */
|
|
19
|
+
readonly headers: Map<string, string[]>;
|
|
20
|
+
constructor(method: string, path: string,
|
|
21
|
+
/** Header name (lowercased) -> values (HTTP allows multiple values per name). */
|
|
22
|
+
headers: Map<string, string[]>);
|
|
23
|
+
/** First value of a header, looked up by ContextKey.httpHeader (or a raw lowercased name). */
|
|
24
|
+
getHeader(key: ContextKey | string): string | undefined;
|
|
25
|
+
/** All values of a header. */
|
|
26
|
+
getHeaderValues(key: ContextKey | string): string[] | undefined;
|
|
27
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpRequest = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* HttpRequest - webpieces' TRANSPORT-NEUTRAL inbound request.
|
|
6
|
+
*
|
|
7
|
+
* This is @webpieces/http-routing's own request type (http-routing re-exports it), NOT
|
|
8
|
+
* express's `req`. Each transport adapter (the express adapter in @webpieces/http-server, or
|
|
9
|
+
* any other TypeScript web framework) builds an HttpRequest from its native request and hands
|
|
10
|
+
* it to the router. Filters and the auth layer read it via `RequestContext.getRequest()`
|
|
11
|
+
* instead of touching express — which is what lets the SAME filter chain run over HTTP and
|
|
12
|
+
* in-process (tests build an HttpRequest carrying their credential).
|
|
13
|
+
*
|
|
14
|
+
* It lives in core-context (alongside RequestContext, which stores it in AsyncLocalStorage)
|
|
15
|
+
* to avoid a core-context → http-routing cycle; it is a pure data holder (no express, no DI).
|
|
16
|
+
*/
|
|
17
|
+
class HttpRequest {
|
|
18
|
+
method;
|
|
19
|
+
path;
|
|
20
|
+
headers;
|
|
21
|
+
constructor(method, path,
|
|
22
|
+
/** Header name (lowercased) -> values (HTTP allows multiple values per name). */
|
|
23
|
+
headers) {
|
|
24
|
+
this.method = method;
|
|
25
|
+
this.path = path;
|
|
26
|
+
this.headers = headers;
|
|
27
|
+
}
|
|
28
|
+
/** First value of a header, looked up by ContextKey.httpHeader (or a raw lowercased name). */
|
|
29
|
+
getHeader(key) {
|
|
30
|
+
const values = this.getHeaderValues(key);
|
|
31
|
+
return values && values.length > 0 ? values[0] : undefined;
|
|
32
|
+
}
|
|
33
|
+
/** All values of a header. */
|
|
34
|
+
getHeaderValues(key) {
|
|
35
|
+
const name = (typeof key === 'string' ? key : key.httpHeader ?? key.name).toLowerCase();
|
|
36
|
+
return this.headers.get(name);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.HttpRequest = HttpRequest;
|
|
40
|
+
//# sourceMappingURL=HttpRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpRequest.js","sourceRoot":"","sources":["../../../../../packages/core/core-context/src/HttpRequest.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;GAYG;AACH,MAAa,WAAW;IAEA;IACA;IAEA;IAJpB,YACoB,MAAc,EACd,IAAY;IAC5B,iFAAiF;IACjE,OAA8B;QAH9B,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAQ;QAEZ,YAAO,GAAP,OAAO,CAAuB;IAC/C,CAAC;IAEJ,8FAA8F;IAC9F,SAAS,CAAC,GAAwB;QAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;QACzC,OAAO,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/D,CAAC;IAED,8BAA8B;IAC9B,eAAe,CAAC,GAAwB;QACpC,MAAM,IAAI,GAAG,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;QACxF,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;CACJ;AAnBD,kCAmBC","sourcesContent":["import { ContextKey } from '@webpieces/core-util';\n\n/**\n * HttpRequest - webpieces' TRANSPORT-NEUTRAL inbound request.\n *\n * This is @webpieces/http-routing's own request type (http-routing re-exports it), NOT\n * express's `req`. Each transport adapter (the express adapter in @webpieces/http-server, or\n * any other TypeScript web framework) builds an HttpRequest from its native request and hands\n * it to the router. Filters and the auth layer read it via `RequestContext.getRequest()`\n * instead of touching express — which is what lets the SAME filter chain run over HTTP and\n * in-process (tests build an HttpRequest carrying their credential).\n *\n * It lives in core-context (alongside RequestContext, which stores it in AsyncLocalStorage)\n * to avoid a core-context → http-routing cycle; it is a pure data holder (no express, no DI).\n */\nexport class HttpRequest {\n constructor(\n public readonly method: string,\n public readonly path: string,\n /** Header name (lowercased) -> values (HTTP allows multiple values per name). */\n public readonly headers: Map<string, string[]>,\n ) {}\n\n /** First value of a header, looked up by ContextKey.httpHeader (or a raw lowercased name). */\n getHeader(key: ContextKey | string): string | undefined {\n const values = this.getHeaderValues(key);\n return values && values.length > 0 ? values[0] : undefined;\n }\n\n /** All values of a header. */\n getHeaderValues(key: ContextKey | string): string[] | undefined {\n const name = (typeof key === 'string' ? key : key.httpHeader ?? key.name).toLowerCase();\n return this.headers.get(name);\n }\n}\n"]}
|
package/src/RequestContext.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ContextKey } from '@webpieces/core-util';
|
|
2
|
+
import { HttpRequest } from './HttpRequest';
|
|
2
3
|
/**
|
|
3
4
|
* Context management using AsyncLocalStorage.
|
|
4
5
|
* Similar to Java WebPieces Context class that uses ThreadLocal.
|
|
@@ -28,6 +29,15 @@ declare class RequestContextImpl {
|
|
|
28
29
|
getHeader<T = unknown>(key: ContextKey): T | undefined;
|
|
29
30
|
putHeader(key: ContextKey, value: unknown): void;
|
|
30
31
|
hasHeader(key: ContextKey): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Store the transport-neutral {@link HttpRequest} for this request. Called once, above the
|
|
34
|
+
* api boundary, by whichever transport is driving the router (the express adapter, or the
|
|
35
|
+
* in-process client). Filters/auth read it back via {@link getRequest} so they never touch
|
|
36
|
+
* express — the same chain then runs over HTTP and in-process.
|
|
37
|
+
*/
|
|
38
|
+
setRequest(request: HttpRequest): void;
|
|
39
|
+
/** The current {@link HttpRequest}, or undefined if none was set for this context. */
|
|
40
|
+
getRequest(): HttpRequest | undefined;
|
|
31
41
|
getHeaders(keys: ContextKey[]): unknown[];
|
|
32
42
|
/**
|
|
33
43
|
* Store a value in the current context.
|
package/src/RequestContext.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RequestContext = void 0;
|
|
4
4
|
const async_hooks_1 = require("async_hooks");
|
|
5
|
+
/** Reserved context key under which the current HttpRequest is stored. */
|
|
6
|
+
const HTTP_REQUEST_KEY = '__webpieces_http_request__';
|
|
5
7
|
/**
|
|
6
8
|
* Context management using AsyncLocalStorage.
|
|
7
9
|
* Similar to Java WebPieces Context class that uses ThreadLocal.
|
|
@@ -46,6 +48,19 @@ class RequestContextImpl {
|
|
|
46
48
|
hasHeader(key) {
|
|
47
49
|
return this.has(key.name);
|
|
48
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Store the transport-neutral {@link HttpRequest} for this request. Called once, above the
|
|
53
|
+
* api boundary, by whichever transport is driving the router (the express adapter, or the
|
|
54
|
+
* in-process client). Filters/auth read it back via {@link getRequest} so they never touch
|
|
55
|
+
* express — the same chain then runs over HTTP and in-process.
|
|
56
|
+
*/
|
|
57
|
+
setRequest(request) {
|
|
58
|
+
this.put(HTTP_REQUEST_KEY, request);
|
|
59
|
+
}
|
|
60
|
+
/** The current {@link HttpRequest}, or undefined if none was set for this context. */
|
|
61
|
+
getRequest() {
|
|
62
|
+
return this.get(HTTP_REQUEST_KEY);
|
|
63
|
+
}
|
|
49
64
|
// webpieces-disable no-any-unknown -- context values are heterogeneous (strings, recorder, meta objects)
|
|
50
65
|
getHeaders(keys) {
|
|
51
66
|
return keys.map(key => this.getHeader(key));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestContext.js","sourceRoot":"","sources":["../../../../../packages/core/core-context/src/RequestContext.ts"],"names":[],"mappings":";;;AAAA,6CAAgD;
|
|
1
|
+
{"version":3,"file":"RequestContext.js","sourceRoot":"","sources":["../../../../../packages/core/core-context/src/RequestContext.ts"],"names":[],"mappings":";;;AAAA,6CAAgD;AAIhD,0EAA0E;AAC1E,MAAM,gBAAgB,GAAG,4BAA4B,CAAC;AAEtD;;;;;;;;;;;;;GAaG;AACH,MAAM,kBAAkB;IACZ,OAAO,CAAsC;IAErD;QACI,IAAI,CAAC,OAAO,GAAG,IAAI,+BAAiB,EAAoB,CAAC;IAC7D,CAAC;IAED;;;OAGG;IACH,GAAG,CAAI,EAAW;QACd,MAAM,KAAK,GAAG,IAAI,GAAG,EAAe,CAAC;QACrC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,cAAc,CAAI,OAAyB,EAAE,EAAW;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,yGAAyG;IACzG,SAAS,CAAc,GAAe;QAClC,OAAO,IAAI,CAAC,GAAG,CAAI,GAAG,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,yGAAyG;IACzG,SAAS,CAAC,GA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ID;;;GAGG;AACU,QAAA,cAAc,GAAG,IAAI,kBAAkB,EAAE,CAAC","sourcesContent":["import { AsyncLocalStorage } from 'async_hooks';\nimport { ContextKey } from '@webpieces/core-util';\nimport { HttpRequest } from './HttpRequest';\n\n/** Reserved context key under which the current HttpRequest is stored. */\nconst HTTP_REQUEST_KEY = '__webpieces_http_request__';\n\n/**\n * Context management using AsyncLocalStorage.\n * Similar to Java WebPieces Context class that uses ThreadLocal.\n *\n * This allows storing request-scoped data that is automatically available\n * throughout the async call chain, similar to MDC (Mapped Diagnostic Context).\n *\n * Example usage:\n * ```typescript\n * Context.put('REQUEST_ID', '12345');\n * await someAsyncOperation();\n * const id = Context.get('REQUEST_ID'); // Still available!\n * ```\n */\nclass RequestContextImpl {\n private storage: AsyncLocalStorage<Map<string, any>>;\n\n constructor() {\n this.storage = new AsyncLocalStorage<Map<string, any>>();\n }\n\n /**\n * Run a function with a new context.\n * This is typically called at the beginning of a request.\n */\n run<T>(fn: () => T): T {\n const store = new Map<string, any>();\n return this.storage.run(store, fn);\n }\n\n /**\n * Run a function with a specific context.\n */\n runWithContext<T>(context: Map<string, any>, fn: () => T): T {\n return this.storage.run(context, fn);\n }\n\n // webpieces-disable no-any-unknown -- context values are heterogeneous (strings, recorder, meta objects)\n getHeader<T = unknown>(key: ContextKey): T | undefined {\n return this.get<T>(key.name);\n }\n\n // webpieces-disable no-any-unknown -- context values are heterogeneous (strings, recorder, meta objects)\n putHeader(key: ContextKey, value: unknown): void {\n this.put(key.name, value);\n }\n\n hasHeader(key: ContextKey): boolean {\n return this.has(key.name);\n }\n\n /**\n * Store the transport-neutral {@link HttpRequest} for this request. Called once, above the\n * api boundary, by whichever transport is driving the router (the express adapter, or the\n * in-process client). Filters/auth read it back via {@link getRequest} so they never touch\n * express — the same chain then runs over HTTP and in-process.\n */\n setRequest(request: HttpRequest): void {\n this.put(HTTP_REQUEST_KEY, request);\n }\n\n /** The current {@link HttpRequest}, or undefined if none was set for this context. */\n getRequest(): HttpRequest | undefined {\n return this.get<HttpRequest>(HTTP_REQUEST_KEY);\n }\n\n // webpieces-disable no-any-unknown -- context values are heterogeneous (strings, recorder, meta objects)\n getHeaders(keys: ContextKey[]): unknown[] {\n return keys.map(key => this.getHeader(key));\n }\n\n /**\n * Store a value in the current context.\n */\n put(key: string, value: any): void {\n const store = this.storage.getStore();\n if (!store) {\n throw new Error('No context available. Did you call Context.run() first?');\n }\n store.set(key, value);\n }\n\n /**\n * Retrieve a value from the current context.\n */\n get<T = any>(key: string): T | undefined {\n const store = this.storage.getStore();\n return store?.get(key);\n }\n\n /**\n * Remove a value from the current context.\n */\n remove(key: string): void {\n const store = this.storage.getStore();\n store?.delete(key);\n }\n\n /**\n * Clear all values from the current context.\n */\n clear(): void {\n const store = this.storage.getStore();\n store?.clear();\n }\n\n /**\n * Copy the current context to a new Map.\n * Used by XPromise to preserve context across async boundaries.\n */\n copyContext(): Map<string, any> {\n const store = this.storage.getStore();\n if (!store) {\n return new Map();\n }\n return new Map(store);\n }\n\n /**\n * Set the entire context from a Map.\n * Used by XPromise to restore context.\n */\n setContext(context: Map<string, any>): void {\n const store = this.storage.getStore();\n if (!store) {\n throw new Error('No context available. Did you call Context.run() first?');\n }\n store.clear();\n context.forEach((value, key) => {\n store.set(key, value);\n });\n }\n\n /**\n * Get all context entries.\n */\n getAll(): Map<string, any> {\n const store = this.storage.getStore();\n return store ? new Map(store) : new Map();\n }\n\n /**\n * Check if a key exists in the context.\n */\n has(key: string): boolean {\n const store = this.storage.getStore();\n return store?.has(key) ?? false;\n }\n\n /**\n * Check if RequestContext is currently active.\n * Returns true if we're inside a RequestContext.run() block, false otherwise.\n *\n * Useful for tests to verify context is set up before making API calls.\n */\n isActive(): boolean {\n return this.storage.getStore() !== undefined;\n }\n\n}\n\n\n\n/**\n * Global singleton instance of RequestContext.\n * Use this throughout your application.\n */\nexport const RequestContext = new RequestContextImpl();\n"]}
|
package/src/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { RequestContext } from './RequestContext';
|
|
2
|
+
export { HttpRequest } from './HttpRequest';
|
|
2
3
|
export { provideSingleton, provideSingletonAs, provideTransient } from './provide';
|
|
3
4
|
export { provideFrameworkSingleton, provideFrameworkSingletonAs, buildFrameworkModule, } from './frameworkProvide';
|
|
4
5
|
export { ContextMgr, RequestIdChainProcessor } from '@webpieces/core-util';
|
package/src/index.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RequestContextReader = exports.RequestIdChainProcessor = exports.ContextMgr = exports.buildFrameworkModule = exports.provideFrameworkSingletonAs = exports.provideFrameworkSingleton = exports.provideTransient = exports.provideSingletonAs = exports.provideSingleton = exports.RequestContext = void 0;
|
|
3
|
+
exports.RequestContextReader = exports.RequestIdChainProcessor = exports.ContextMgr = exports.buildFrameworkModule = exports.provideFrameworkSingletonAs = exports.provideFrameworkSingleton = exports.provideTransient = exports.provideSingletonAs = exports.provideSingleton = exports.HttpRequest = exports.RequestContext = void 0;
|
|
4
4
|
// Context management with AsyncLocalStorage
|
|
5
5
|
var RequestContext_1 = require("./RequestContext");
|
|
6
6
|
Object.defineProperty(exports, "RequestContext", { enumerable: true, get: function () { return RequestContext_1.RequestContext; } });
|
|
7
|
+
// Transport-neutral request stored in the context (http-routing's request type; re-exported there)
|
|
8
|
+
var HttpRequest_1 = require("./HttpRequest");
|
|
9
|
+
Object.defineProperty(exports, "HttpRequest", { enumerable: true, get: function () { return HttpRequest_1.HttpRequest; } });
|
|
7
10
|
// DI provider decorators (shared DI seam; http-routing re-exports for back-compat)
|
|
8
11
|
var provide_1 = require("./provide");
|
|
9
12
|
Object.defineProperty(exports, "provideSingleton", { enumerable: true, get: function () { return provide_1.provideSingleton; } });
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/core/core-context/src/index.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/core/core-context/src/index.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,mGAAmG;AACnG,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AAEpB,mFAAmF;AACnF,qCAAmF;AAA1E,2GAAA,gBAAgB,OAAA;AAAE,6GAAA,kBAAkB,OAAA;AAAE,2GAAA,gBAAgB,OAAA;AAC/D,sFAAsF;AACtF,wEAAwE;AACxE,uDAI4B;AAHxB,6HAAA,yBAAyB,OAAA;AACzB,+HAAA,2BAA2B,OAAA;AAC3B,wHAAA,oBAAoB,OAAA;AAGxB,gFAAgF;AAChF,8EAA8E;AAC9E,iEAAiE;AACjE,kDAA2E;AAAlE,uGAAA,UAAU,OAAA;AAAE,oHAAA,uBAAuB,OAAA;AAC5C,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA","sourcesContent":["// Context management with AsyncLocalStorage\nexport { RequestContext } from './RequestContext';\n// Transport-neutral request stored in the context (http-routing's request type; re-exported there)\nexport { HttpRequest } from './HttpRequest';\n\n// DI provider decorators (shared DI seam; http-routing re-exports for back-compat)\nexport { provideSingleton, provideSingletonAs, provideTransient } from './provide';\n// Framework-only DI registry (packages/** use these; keeps framework classes out of a\n// client's buildProviderModule() global scan). See frameworkProvide.ts.\nexport {\n provideFrameworkSingleton,\n provideFrameworkSingletonAs,\n buildFrameworkModule,\n} from './frameworkProvide';\n\n// Outbound-header machinery — MOVED to browser+node @webpieces/core-util so the\n// isomorphic http-client can use ContextMgr without pulling in this Node-only\n// (AsyncLocalStorage) package. Re-exported here for back-compat.\nexport { ContextMgr, RequestIdChainProcessor } from '@webpieces/core-util';\nexport { RequestContextReader } from './RequestContextReader';\n"]}
|