@webpieces/http-routing 0.3.233 → 0.3.235
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpieces/http-routing",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.235",
|
|
4
4
|
"description": "Decorator-based routing with auto-wiring for WebPieces",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@webpieces/http-api": "0.3.
|
|
25
|
-
"@webpieces/http-filters": "0.3.
|
|
24
|
+
"@webpieces/http-api": "0.3.235",
|
|
25
|
+
"@webpieces/http-filters": "0.3.235",
|
|
26
26
|
"inversify": "7.10.4",
|
|
27
27
|
"minimatch": "10.0.1"
|
|
28
28
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PlatformHeader, ContextReader } from '@webpieces/http-api';
|
|
2
|
+
import { ContextKey } from '@webpieces/core-util';
|
|
2
3
|
/**
|
|
3
4
|
* RequestContextReader - Reads headers from Node.js RequestContext.
|
|
4
5
|
*
|
|
@@ -19,4 +20,10 @@ export declare class RequestContextReader implements ContextReader {
|
|
|
19
20
|
* @returns The header value, or undefined if not in context
|
|
20
21
|
*/
|
|
21
22
|
read(header: PlatformHeader): string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Read a non-header context value (e.g. the active TestCaseRecorder under
|
|
25
|
+
* RecorderKeys.RECORDER). Lets the isomorphic http-client find server-side
|
|
26
|
+
* context without importing core-context itself.
|
|
27
|
+
*/
|
|
28
|
+
readValue(key: ContextKey): unknown;
|
|
22
29
|
}
|
|
@@ -25,6 +25,15 @@ class RequestContextReader {
|
|
|
25
25
|
// Use RequestContext.getHeader() which calls header.getHeaderName()
|
|
26
26
|
return core_context_1.RequestContext.getHeader(header);
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Read a non-header context value (e.g. the active TestCaseRecorder under
|
|
30
|
+
* RecorderKeys.RECORDER). Lets the isomorphic http-client find server-side
|
|
31
|
+
* context without importing core-context itself.
|
|
32
|
+
*/
|
|
33
|
+
// webpieces-disable no-any-unknown -- context values are heterogeneous (recorder, meta objects)
|
|
34
|
+
readValue(key) {
|
|
35
|
+
return core_context_1.RequestContext.getHeader(key);
|
|
36
|
+
}
|
|
28
37
|
}
|
|
29
38
|
exports.RequestContextReader = RequestContextReader;
|
|
30
39
|
//# sourceMappingURL=RequestContextReader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestContextReader.js","sourceRoot":"","sources":["../../../../../packages/http/http-routing/src/RequestContextReader.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"RequestContextReader.js","sourceRoot":"","sources":["../../../../../packages/http/http-routing/src/RequestContextReader.ts"],"names":[],"mappings":";;;AAEA,0DAAyD;AAEzD;;;;;;;;;;;GAWG;AACH,MAAa,oBAAoB;IAC7B;;;;;OAKG;IACH,IAAI,CAAC,MAAsB;QACvB,oEAAoE;QACpE,OAAO,6BAAc,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED;;;;OAIG;IACH,gGAAgG;IAChG,SAAS,CAAC,GAAe;QACrB,OAAO,6BAAc,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;CACJ;AArBD,oDAqBC","sourcesContent":["import { PlatformHeader, ContextReader } from '@webpieces/http-api';\nimport { ContextKey } from '@webpieces/core-util';\nimport { RequestContext } from '@webpieces/core-context';\n\n/**\n * RequestContextReader - Reads headers from Node.js RequestContext.\n *\n * Only works in Node.js with active AsyncLocalStorage context.\n * This is a server-side only implementation.\n *\n * NOTE: This class is in @webpieces/http-routing (Node.js only) instead of\n * @webpieces/http-client (cross-platform) because it has a hard dependency\n * on @webpieces/core-context which uses Node.js AsyncLocalStorage.\n *\n * For browser environments, use StaticContextReader from @webpieces/http-client.\n */\nexport class RequestContextReader implements ContextReader {\n /**\n * Read a header value from the active RequestContext.\n *\n * @param header - The platform header to read\n * @returns The header value, or undefined if not in context\n */\n read(header: PlatformHeader): string | undefined {\n // Use RequestContext.getHeader() which calls header.getHeaderName()\n return RequestContext.getHeader(header);\n }\n\n /**\n * Read a non-header context value (e.g. the active TestCaseRecorder under\n * RecorderKeys.RECORDER). Lets the isomorphic http-client find server-side\n * context without importing core-context itself.\n */\n // webpieces-disable no-any-unknown -- context values are heterogeneous (recorder, meta objects)\n readValue(key: ContextKey): unknown {\n return RequestContext.getHeader(key);\n }\n}\n"]}
|
package/src/WebpiecesConfig.d.ts
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
* Per CLAUDE.md: Data-only structure = class
|
|
4
4
|
*/
|
|
5
5
|
export declare class WebpiecesConfig {
|
|
6
|
+
/**
|
|
7
|
+
* Record EVERY request as a test case (fixture + generated spec), instead
|
|
8
|
+
* of only requests carrying the x-webpieces-recording header.
|
|
9
|
+
* Intended for tests/dev - do not leave on in production.
|
|
10
|
+
*/
|
|
11
|
+
recordingAlwaysOn?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Directory where recorded fixtures + generated specs are written.
|
|
14
|
+
* When unset, recordings are only logged.
|
|
15
|
+
*/
|
|
16
|
+
recordingDir?: string;
|
|
6
17
|
}
|
|
7
18
|
/**
|
|
8
19
|
* DI token for WebpiecesConfig injection.
|
package/src/WebpiecesConfig.js
CHANGED
|
@@ -6,6 +6,18 @@ exports.WEBPIECES_CONFIG_TOKEN = exports.WebpiecesConfig = void 0;
|
|
|
6
6
|
* Per CLAUDE.md: Data-only structure = class
|
|
7
7
|
*/
|
|
8
8
|
class WebpiecesConfig {
|
|
9
|
+
// CORS is auto-enabled for localhost:* → localhost:*
|
|
10
|
+
/**
|
|
11
|
+
* Record EVERY request as a test case (fixture + generated spec), instead
|
|
12
|
+
* of only requests carrying the x-webpieces-recording header.
|
|
13
|
+
* Intended for tests/dev - do not leave on in production.
|
|
14
|
+
*/
|
|
15
|
+
recordingAlwaysOn;
|
|
16
|
+
/**
|
|
17
|
+
* Directory where recorded fixtures + generated specs are written.
|
|
18
|
+
* When unset, recordings are only logged.
|
|
19
|
+
*/
|
|
20
|
+
recordingDir;
|
|
9
21
|
}
|
|
10
22
|
exports.WebpiecesConfig = WebpiecesConfig;
|
|
11
23
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebpiecesConfig.js","sourceRoot":"","sources":["../../../../../packages/http/http-routing/src/WebpiecesConfig.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,MAAa,eAAe;
|
|
1
|
+
{"version":3,"file":"WebpiecesConfig.js","sourceRoot":"","sources":["../../../../../packages/http/http-routing/src/WebpiecesConfig.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,MAAa,eAAe;IACxB,qDAAqD;IAErD;;;;OAIG;IACH,iBAAiB,CAAW;IAE5B;;;OAGG;IACH,YAAY,CAAU;CACzB;AAfD,0CAeC;AAED;;GAEG;AACU,QAAA,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC","sourcesContent":["/**\n * Configuration for WebPieces server.\n * Per CLAUDE.md: Data-only structure = class\n */\nexport class WebpiecesConfig {\n // CORS is auto-enabled for localhost:* → localhost:*\n\n /**\n * Record EVERY request as a test case (fixture + generated spec), instead\n * of only requests carrying the x-webpieces-recording header.\n * Intended for tests/dev - do not leave on in production.\n */\n recordingAlwaysOn?: boolean;\n\n /**\n * Directory where recorded fixtures + generated specs are written.\n * When unset, recordings are only logged.\n */\n recordingDir?: string;\n}\n\n/**\n * DI token for WebpiecesConfig injection.\n */\nexport const WEBPIECES_CONFIG_TOKEN = Symbol.for('WebpiecesConfig');\n"]}
|