@webpieces/core-util 0.3.285 → 0.3.287
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 +1 -1
- package/src/ContextKey.d.ts +33 -15
- package/src/ContextKey.js +37 -15
- package/src/ContextKey.js.map +1 -1
- package/src/http/ContextMgr.d.ts +17 -34
- package/src/http/ContextMgr.js +21 -33
- package/src/http/ContextMgr.js.map +1 -1
- package/src/http/ContextReader.d.ts +14 -23
- package/src/http/ContextReader.js.map +1 -1
- package/src/http/HeaderMethods.d.ts +16 -60
- package/src/http/HeaderMethods.js +25 -92
- package/src/http/HeaderMethods.js.map +1 -1
- package/src/http/HeaderRegistry.d.ts +44 -37
- package/src/http/HeaderRegistry.js +88 -70
- package/src/http/HeaderRegistry.js.map +1 -1
- package/src/http/RequestIdChainProcessor.js +3 -2
- package/src/http/RequestIdChainProcessor.js.map +1 -1
- package/src/http/WebpiecesCoreHeaders.d.ts +29 -38
- package/src/http/WebpiecesCoreHeaders.js +28 -48
- package/src/http/WebpiecesCoreHeaders.js.map +1 -1
- package/src/http/recorder/TestCaseRecorder.js +1 -1
- package/src/http/recorder/TestCaseRecorder.js.map +1 -1
- package/src/index.d.ts +0 -4
- package/src/index.js +2 -8
- package/src/index.js.map +1 -1
- package/src/logging/LogManager.d.ts +5 -0
- package/src/logging/LogManager.js +13 -0
- package/src/logging/LogManager.js.map +1 -1
- package/src/Header.d.ts +0 -22
- package/src/Header.js +0 -3
- package/src/Header.js.map +0 -1
- package/src/http/HeaderTypes.d.ts +0 -29
- package/src/http/HeaderTypes.js +0 -33
- package/src/http/HeaderTypes.js.map +0 -1
- package/src/http/PlatformHeader.d.ts +0 -51
- package/src/http/PlatformHeader.js +0 -63
- package/src/http/PlatformHeader.js.map +0 -1
- package/src/http/PlatformHeadersExtension.d.ts +0 -51
- package/src/http/PlatformHeadersExtension.js +0 -59
- package/src/http/PlatformHeadersExtension.js.map +0 -1
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PlatformHeader = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* PlatformHeader - Defines an HTTP header that can be transferred between services.
|
|
6
|
-
*
|
|
7
|
-
* Port of Java PlatformHeaders, simplified:
|
|
8
|
-
* - No isWantLogged flag (deprecated in Java) - "wants MDC logging" is expressed
|
|
9
|
-
* by setting loggerMdcKey. Headers without one still appear in API logs
|
|
10
|
-
* (masked when isSecured); they just aren't exposed as an MDC dimension key.
|
|
11
|
-
*
|
|
12
|
-
* Implements Header interface from core-util to avoid circular dependencies.
|
|
13
|
-
*
|
|
14
|
-
* Per CLAUDE.md: "All data-only structures MUST be classes, not interfaces."
|
|
15
|
-
* This is a data-only class with no business logic methods.
|
|
16
|
-
*/
|
|
17
|
-
class PlatformHeader {
|
|
18
|
-
/**
|
|
19
|
-
* The HTTP header name (e.g., 'x-request-id', 'x-tenant-id').
|
|
20
|
-
* Also used as the MDC logging key in RequestContext.
|
|
21
|
-
* Case-insensitive per HTTP spec, but stored in canonical form.
|
|
22
|
-
*/
|
|
23
|
-
headerName;
|
|
24
|
-
/**
|
|
25
|
-
* Whether this header should be transferred from HTTP request to RequestContext.
|
|
26
|
-
* If false, header is defined but not automatically transferred.
|
|
27
|
-
* Only headers with isWantTransferred=true are copied from incoming requests.
|
|
28
|
-
*/
|
|
29
|
-
isWantTransferred;
|
|
30
|
-
/**
|
|
31
|
-
* Whether this header contains sensitive data that should be secured/masked in logs.
|
|
32
|
-
* Examples: Authorization tokens, passwords, API keys.
|
|
33
|
-
*/
|
|
34
|
-
isSecured;
|
|
35
|
-
/**
|
|
36
|
-
* Whether this header should be used as a dimension for metrics/monitoring.
|
|
37
|
-
* Examples: x-tenant-id, x-request-id (for distributed tracing).
|
|
38
|
-
*/
|
|
39
|
-
isDimensionForMetrics;
|
|
40
|
-
/**
|
|
41
|
-
* Key used when exposing this header to the logger's MDC / structured log
|
|
42
|
-
* dimensions. Port of Java getLoggerMDCKey(). When set, log maps key this
|
|
43
|
-
* header by it instead of headerName (e.g. 'requestId' vs 'x-request-id').
|
|
44
|
-
* Undefined = not an MDC dimension (Java: getLoggerMDCKey() == null).
|
|
45
|
-
*/
|
|
46
|
-
loggerMdcKey;
|
|
47
|
-
constructor(headerName, isWantTransferred = true, isSecured = false, isDimensionForMetrics = false, loggerMdcKey) {
|
|
48
|
-
this.headerName = headerName;
|
|
49
|
-
this.isWantTransferred = isWantTransferred;
|
|
50
|
-
this.isSecured = isSecured;
|
|
51
|
-
this.isDimensionForMetrics = isDimensionForMetrics;
|
|
52
|
-
this.loggerMdcKey = loggerMdcKey;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Get the header name (implements Header interface).
|
|
56
|
-
* @returns The HTTP header name
|
|
57
|
-
*/
|
|
58
|
-
getHeaderName() {
|
|
59
|
-
return this.headerName;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.PlatformHeader = PlatformHeader;
|
|
63
|
-
//# sourceMappingURL=PlatformHeader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformHeader.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util/src/http/PlatformHeader.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;GAYG;AACH,MAAa,cAAc;IACvB;;;;OAIG;IACM,UAAU,CAAS;IAE5B;;;;OAIG;IACM,iBAAiB,CAAU;IAEpC;;;OAGG;IACM,SAAS,CAAU;IAE5B;;;OAGG;IACM,qBAAqB,CAAU;IAExC;;;;;OAKG;IACM,YAAY,CAAU;IAE/B,YACI,UAAkB,EAClB,oBAA6B,IAAI,EACjC,YAAqB,KAAK,EAC1B,wBAAiC,KAAK,EACtC,YAAqB;QAErB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;QACnD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACrC,CAAC;IAED;;;OAGG;IACH,aAAa;QACT,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;CACJ;AAxDD,wCAwDC","sourcesContent":["import { Header } from '../Header';\n\n/**\n * PlatformHeader - Defines an HTTP header that can be transferred between services.\n *\n * Port of Java PlatformHeaders, simplified:\n * - No isWantLogged flag (deprecated in Java) - \"wants MDC logging\" is expressed\n * by setting loggerMdcKey. Headers without one still appear in API logs\n * (masked when isSecured); they just aren't exposed as an MDC dimension key.\n *\n * Implements Header interface from core-util to avoid circular dependencies.\n *\n * Per CLAUDE.md: \"All data-only structures MUST be classes, not interfaces.\"\n * This is a data-only class with no business logic methods.\n */\nexport class PlatformHeader implements Header {\n /**\n * The HTTP header name (e.g., 'x-request-id', 'x-tenant-id').\n * Also used as the MDC logging key in RequestContext.\n * Case-insensitive per HTTP spec, but stored in canonical form.\n */\n readonly headerName: string;\n\n /**\n * Whether this header should be transferred from HTTP request to RequestContext.\n * If false, header is defined but not automatically transferred.\n * Only headers with isWantTransferred=true are copied from incoming requests.\n */\n readonly isWantTransferred: boolean;\n\n /**\n * Whether this header contains sensitive data that should be secured/masked in logs.\n * Examples: Authorization tokens, passwords, API keys.\n */\n readonly isSecured: boolean;\n\n /**\n * Whether this header should be used as a dimension for metrics/monitoring.\n * Examples: x-tenant-id, x-request-id (for distributed tracing).\n */\n readonly isDimensionForMetrics: boolean;\n\n /**\n * Key used when exposing this header to the logger's MDC / structured log\n * dimensions. Port of Java getLoggerMDCKey(). When set, log maps key this\n * header by it instead of headerName (e.g. 'requestId' vs 'x-request-id').\n * Undefined = not an MDC dimension (Java: getLoggerMDCKey() == null).\n */\n readonly loggerMdcKey?: string;\n\n constructor(\n headerName: string,\n isWantTransferred: boolean = true,\n isSecured: boolean = false,\n isDimensionForMetrics: boolean = false,\n loggerMdcKey?: string\n ) {\n this.headerName = headerName;\n this.isWantTransferred = isWantTransferred;\n this.isSecured = isSecured;\n this.isDimensionForMetrics = isDimensionForMetrics;\n this.loggerMdcKey = loggerMdcKey;\n }\n\n /**\n * Get the header name (implements Header interface).\n * @returns The HTTP header name\n */\n getHeaderName(): string {\n return this.headerName;\n }\n}\n"]}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { PlatformHeader } from './PlatformHeader';
|
|
2
|
-
/**
|
|
3
|
-
* PlatformHeadersExtension - Extension that contributes platform headers to the framework.
|
|
4
|
-
*
|
|
5
|
-
* This is a DI-level extension (not an app-level Plugin).
|
|
6
|
-
* Multiple modules can bind PlatformHeadersExtension instances, and the framework
|
|
7
|
-
* collects them via Inversify @multiInject.
|
|
8
|
-
*
|
|
9
|
-
* Two-level plugin system:
|
|
10
|
-
* 1. **Extensions** (DI-level): Contribute specific capabilities to framework
|
|
11
|
-
* - Examples: PlatformHeadersExtension, BodyContentExtension, EntityLookupExtension
|
|
12
|
-
* - Pattern: Bound via multiInject, consumed by framework
|
|
13
|
-
* - Java equivalent: Multibinder<AddPlatformHeaders>, Multibinder<BodyContentBinder>
|
|
14
|
-
*
|
|
15
|
-
* 2. **Plugins** (App-level): Provide complete features with modules + routes
|
|
16
|
-
* - Examples: HibernatePlugin, JacksonPlugin, Auth0Plugin
|
|
17
|
-
* - Pattern: Implements getGuiceModules() + getRouteModules()
|
|
18
|
-
* - Java equivalent: Plugin interface with getGuiceModules() + getRouteModules()
|
|
19
|
-
*
|
|
20
|
-
* Usage:
|
|
21
|
-
* ```typescript
|
|
22
|
-
* // In WebpiecesModule
|
|
23
|
-
* const coreExtension = new PlatformHeadersExtension([
|
|
24
|
-
* WebpiecesCoreHeaders.REQUEST_ID,
|
|
25
|
-
* WebpiecesCoreHeaders.CORRELATION_ID,
|
|
26
|
-
* ]);
|
|
27
|
-
* bind(HEADER_TYPES.PlatformHeadersExtension).toConstantValue(coreExtension);
|
|
28
|
-
*
|
|
29
|
-
* // In CompanyModule
|
|
30
|
-
* const companyExtension = new PlatformHeadersExtension([
|
|
31
|
-
* CompanyHeaders.TENANT_ID,
|
|
32
|
-
* CompanyHeaders.API_VERSION,
|
|
33
|
-
* ]);
|
|
34
|
-
* bind(HEADER_TYPES.PlatformHeadersExtension).toConstantValue(companyExtension);
|
|
35
|
-
*
|
|
36
|
-
* // Framework collects all extensions
|
|
37
|
-
* constructor(@multiInject(HEADER_TYPES.PlatformHeadersExtension) extensions: PlatformHeadersExtension[]) {}
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
export declare class PlatformHeadersExtension {
|
|
41
|
-
/**
|
|
42
|
-
* The set of platform headers contributed by this extension.
|
|
43
|
-
*/
|
|
44
|
-
readonly headers: PlatformHeader[];
|
|
45
|
-
constructor(headers: PlatformHeader[]);
|
|
46
|
-
/**
|
|
47
|
-
* Get all headers from this extension.
|
|
48
|
-
* @returns Array of platform headers
|
|
49
|
-
*/
|
|
50
|
-
getHeaders(): PlatformHeader[];
|
|
51
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PlatformHeadersExtension = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* PlatformHeadersExtension - Extension that contributes platform headers to the framework.
|
|
6
|
-
*
|
|
7
|
-
* This is a DI-level extension (not an app-level Plugin).
|
|
8
|
-
* Multiple modules can bind PlatformHeadersExtension instances, and the framework
|
|
9
|
-
* collects them via Inversify @multiInject.
|
|
10
|
-
*
|
|
11
|
-
* Two-level plugin system:
|
|
12
|
-
* 1. **Extensions** (DI-level): Contribute specific capabilities to framework
|
|
13
|
-
* - Examples: PlatformHeadersExtension, BodyContentExtension, EntityLookupExtension
|
|
14
|
-
* - Pattern: Bound via multiInject, consumed by framework
|
|
15
|
-
* - Java equivalent: Multibinder<AddPlatformHeaders>, Multibinder<BodyContentBinder>
|
|
16
|
-
*
|
|
17
|
-
* 2. **Plugins** (App-level): Provide complete features with modules + routes
|
|
18
|
-
* - Examples: HibernatePlugin, JacksonPlugin, Auth0Plugin
|
|
19
|
-
* - Pattern: Implements getGuiceModules() + getRouteModules()
|
|
20
|
-
* - Java equivalent: Plugin interface with getGuiceModules() + getRouteModules()
|
|
21
|
-
*
|
|
22
|
-
* Usage:
|
|
23
|
-
* ```typescript
|
|
24
|
-
* // In WebpiecesModule
|
|
25
|
-
* const coreExtension = new PlatformHeadersExtension([
|
|
26
|
-
* WebpiecesCoreHeaders.REQUEST_ID,
|
|
27
|
-
* WebpiecesCoreHeaders.CORRELATION_ID,
|
|
28
|
-
* ]);
|
|
29
|
-
* bind(HEADER_TYPES.PlatformHeadersExtension).toConstantValue(coreExtension);
|
|
30
|
-
*
|
|
31
|
-
* // In CompanyModule
|
|
32
|
-
* const companyExtension = new PlatformHeadersExtension([
|
|
33
|
-
* CompanyHeaders.TENANT_ID,
|
|
34
|
-
* CompanyHeaders.API_VERSION,
|
|
35
|
-
* ]);
|
|
36
|
-
* bind(HEADER_TYPES.PlatformHeadersExtension).toConstantValue(companyExtension);
|
|
37
|
-
*
|
|
38
|
-
* // Framework collects all extensions
|
|
39
|
-
* constructor(@multiInject(HEADER_TYPES.PlatformHeadersExtension) extensions: PlatformHeadersExtension[]) {}
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
class PlatformHeadersExtension {
|
|
43
|
-
/**
|
|
44
|
-
* The set of platform headers contributed by this extension.
|
|
45
|
-
*/
|
|
46
|
-
headers;
|
|
47
|
-
constructor(headers) {
|
|
48
|
-
this.headers = headers;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Get all headers from this extension.
|
|
52
|
-
* @returns Array of platform headers
|
|
53
|
-
*/
|
|
54
|
-
getHeaders() {
|
|
55
|
-
return this.headers;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.PlatformHeadersExtension = PlatformHeadersExtension;
|
|
59
|
-
//# sourceMappingURL=PlatformHeadersExtension.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformHeadersExtension.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util/src/http/PlatformHeadersExtension.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAa,wBAAwB;IACjC;;OAEG;IACM,OAAO,CAAmB;IAEnC,YAAY,OAAyB;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACH,UAAU;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;CACJ;AAjBD,4DAiBC","sourcesContent":["import { PlatformHeader } from './PlatformHeader';\n\n/**\n * PlatformHeadersExtension - Extension that contributes platform headers to the framework.\n *\n * This is a DI-level extension (not an app-level Plugin).\n * Multiple modules can bind PlatformHeadersExtension instances, and the framework\n * collects them via Inversify @multiInject.\n *\n * Two-level plugin system:\n * 1. **Extensions** (DI-level): Contribute specific capabilities to framework\n * - Examples: PlatformHeadersExtension, BodyContentExtension, EntityLookupExtension\n * - Pattern: Bound via multiInject, consumed by framework\n * - Java equivalent: Multibinder<AddPlatformHeaders>, Multibinder<BodyContentBinder>\n *\n * 2. **Plugins** (App-level): Provide complete features with modules + routes\n * - Examples: HibernatePlugin, JacksonPlugin, Auth0Plugin\n * - Pattern: Implements getGuiceModules() + getRouteModules()\n * - Java equivalent: Plugin interface with getGuiceModules() + getRouteModules()\n *\n * Usage:\n * ```typescript\n * // In WebpiecesModule\n * const coreExtension = new PlatformHeadersExtension([\n * WebpiecesCoreHeaders.REQUEST_ID,\n * WebpiecesCoreHeaders.CORRELATION_ID,\n * ]);\n * bind(HEADER_TYPES.PlatformHeadersExtension).toConstantValue(coreExtension);\n *\n * // In CompanyModule\n * const companyExtension = new PlatformHeadersExtension([\n * CompanyHeaders.TENANT_ID,\n * CompanyHeaders.API_VERSION,\n * ]);\n * bind(HEADER_TYPES.PlatformHeadersExtension).toConstantValue(companyExtension);\n *\n * // Framework collects all extensions\n * constructor(@multiInject(HEADER_TYPES.PlatformHeadersExtension) extensions: PlatformHeadersExtension[]) {}\n * ```\n */\nexport class PlatformHeadersExtension {\n /**\n * The set of platform headers contributed by this extension.\n */\n readonly headers: PlatformHeader[];\n\n constructor(headers: PlatformHeader[]) {\n this.headers = headers;\n }\n\n /**\n * Get all headers from this extension.\n * @returns Array of platform headers\n */\n getHeaders(): PlatformHeader[] {\n return this.headers;\n }\n}\n"]}
|