@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.
Files changed (40) hide show
  1. package/package.json +1 -1
  2. package/src/ContextKey.d.ts +33 -15
  3. package/src/ContextKey.js +37 -15
  4. package/src/ContextKey.js.map +1 -1
  5. package/src/http/ContextMgr.d.ts +17 -34
  6. package/src/http/ContextMgr.js +21 -33
  7. package/src/http/ContextMgr.js.map +1 -1
  8. package/src/http/ContextReader.d.ts +14 -23
  9. package/src/http/ContextReader.js.map +1 -1
  10. package/src/http/HeaderMethods.d.ts +16 -60
  11. package/src/http/HeaderMethods.js +25 -92
  12. package/src/http/HeaderMethods.js.map +1 -1
  13. package/src/http/HeaderRegistry.d.ts +44 -37
  14. package/src/http/HeaderRegistry.js +88 -70
  15. package/src/http/HeaderRegistry.js.map +1 -1
  16. package/src/http/RequestIdChainProcessor.js +3 -2
  17. package/src/http/RequestIdChainProcessor.js.map +1 -1
  18. package/src/http/WebpiecesCoreHeaders.d.ts +29 -38
  19. package/src/http/WebpiecesCoreHeaders.js +28 -48
  20. package/src/http/WebpiecesCoreHeaders.js.map +1 -1
  21. package/src/http/recorder/TestCaseRecorder.js +1 -1
  22. package/src/http/recorder/TestCaseRecorder.js.map +1 -1
  23. package/src/index.d.ts +0 -4
  24. package/src/index.js +2 -8
  25. package/src/index.js.map +1 -1
  26. package/src/logging/LogManager.d.ts +5 -0
  27. package/src/logging/LogManager.js +13 -0
  28. package/src/logging/LogManager.js.map +1 -1
  29. package/src/Header.d.ts +0 -22
  30. package/src/Header.js +0 -3
  31. package/src/Header.js.map +0 -1
  32. package/src/http/HeaderTypes.d.ts +0 -29
  33. package/src/http/HeaderTypes.js +0 -33
  34. package/src/http/HeaderTypes.js.map +0 -1
  35. package/src/http/PlatformHeader.d.ts +0 -51
  36. package/src/http/PlatformHeader.js +0 -63
  37. package/src/http/PlatformHeader.js.map +0 -1
  38. package/src/http/PlatformHeadersExtension.d.ts +0 -51
  39. package/src/http/PlatformHeadersExtension.js +0 -59
  40. package/src/http/PlatformHeadersExtension.js.map +0 -1
@@ -1,62 +1,53 @@
1
- import { PlatformHeader } from './PlatformHeader';
1
+ import { ContextKey } from '../ContextKey';
2
2
  /**
3
- * Core framework headers for distributed tracing and request correlation.
3
+ * Core framework context keys for distributed tracing and request correlation.
4
4
  *
5
- * These are the minimal headers needed by the WebPieces framework for:
6
- * - Request tracking across services
7
- * - Distributed tracing (REQUEST_ID -> PREVIOUS_REQUEST_ID chaining per hop)
5
+ * These are the minimal keys the WebPieces framework needs for:
6
+ * - Request tracking across services (REQUEST_ID -> PREVIOUS_REQUEST_ID chaining per hop)
8
7
  * - Request correlation
9
- * - Metrics and monitoring
8
+ * - Log correlation (each key logs under its `name`)
10
9
  *
11
- * Pattern inspired by Java MicroSvcHeader enum. Lives in http-api (browser-safe)
10
+ * Pattern inspired by Java MicroSvcHeader enum. Lives in core-util (browser-safe)
12
11
  * so BOTH the http-client (request-id chaining) and http-server can reference it.
12
+ *
13
+ * Exposed as {@link HeaderRegistry.DEFAULT_HEADERS} — a service opts into these by
14
+ * passing `platformHeaders=true` to `HeaderRegistry.configure(...)`.
15
+ *
16
+ * Each key's `name` is the logical/log name; `httpHeader` is the wire name.
13
17
  */
14
18
  export declare class WebpiecesCoreHeaders {
15
19
  /**
16
- * Unique ID for this request.
17
- * Generated by the server if not provided.
18
- * Used for distributed tracing and log correlation.
20
+ * Unique ID for this request. Generated by the server if not provided.
21
+ * Transferred (propagates downstream) and logged under 'requestId'.
19
22
  */
20
- static readonly REQUEST_ID: PlatformHeader;
23
+ static readonly REQUEST_ID: ContextKey;
21
24
  /**
22
- * ID of the previous request in the call chain.
23
- * When service A calls service B, B receives A's REQUEST_ID as PREVIOUS_REQUEST_ID.
24
- * Used for building distributed trace trees.
25
+ * ID of the previous request in the call chain. When service A calls B, B
26
+ * receives A's REQUEST_ID as PREVIOUS_REQUEST_ID (builds the trace tree).
25
27
  */
26
- static readonly PREVIOUS_REQUEST_ID: PlatformHeader;
28
+ static readonly PREVIOUS_REQUEST_ID: ContextKey;
27
29
  /**
28
- * Correlation ID that spans multiple related requests.
29
- * Typically set by the API gateway or first service in the chain.
30
- * All services in the call chain use the same CORRELATION_ID.
30
+ * Correlation ID spanning multiple related requests. Set by the gateway or
31
+ * first service; all hops in the chain share it.
31
32
  */
32
- static readonly CORRELATION_ID: PlatformHeader;
33
+ static readonly CORRELATION_ID: ContextKey;
33
34
  /**
34
35
  * Turns on test-case recording for this request (Java: x-webpieces-recording).
35
- * When present, the server records the endpoint + every downstream call it
36
- * makes into a fixture that can be replayed as a test.
37
36
  * Transferred so recording follows the request across service hops.
38
37
  */
39
- static readonly RECORDING: PlatformHeader;
38
+ static readonly RECORDING: ContextKey;
40
39
  /**
41
- * The bearer credential for an authenticated request. Carries BOTH a user-facing
42
- * JWT (@AuthJwt, validated by the app AuthFilter) and a service-to-service Google
43
- * OIDC token (@AuthOidc, validated by the framework ServiceAuthFilter) — the two
44
- * modes are mutually exclusive per endpoint, so one header serves both. When a
45
- * Cloud Task is delivered, Google injects the OIDC token here as `Authorization`.
46
- * SECURED — masked in logs.
40
+ * The bearer credential for an authenticated request (user JWT or service OIDC
41
+ * token). Transferred and SECURED masked in logs.
47
42
  */
48
- static readonly AUTHORIZATION: PlatformHeader;
43
+ static readonly AUTHORIZATION: ContextKey;
49
44
  /**
50
- * Shared-secret credential for internal callers that cannot mint OIDC tokens
51
- * (@AuthSharedSecret, validated by ServiceAuthFilter via constant-time compare).
52
- * SECURED — masked in logs.
45
+ * Shared-secret credential for internal callers that cannot mint OIDC tokens.
46
+ * Transferred and SECURED masked in logs.
53
47
  */
54
- static readonly SHARED_SECRET: PlatformHeader;
48
+ static readonly SHARED_SECRET: ContextKey;
55
49
  /**
56
- * Get all core headers as an array.
57
- * Used by WebpiecesModule to bind headers to DI container.
58
- *
59
- * @returns Array of all core platform headers
50
+ * Get all core context keys as an array (the platform DEFAULT_HEADERS set).
60
51
  */
61
- static getAllHeaders(): PlatformHeader[];
52
+ static getAllHeaders(): ContextKey[];
62
53
  }
@@ -1,76 +1,56 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WebpiecesCoreHeaders = void 0;
4
- const PlatformHeader_1 = require("./PlatformHeader");
4
+ const ContextKey_1 = require("../ContextKey");
5
5
  /**
6
- * Core framework headers for distributed tracing and request correlation.
6
+ * Core framework context keys for distributed tracing and request correlation.
7
7
  *
8
- * These are the minimal headers needed by the WebPieces framework for:
9
- * - Request tracking across services
10
- * - Distributed tracing (REQUEST_ID -> PREVIOUS_REQUEST_ID chaining per hop)
8
+ * These are the minimal keys the WebPieces framework needs for:
9
+ * - Request tracking across services (REQUEST_ID -> PREVIOUS_REQUEST_ID chaining per hop)
11
10
  * - Request correlation
12
- * - Metrics and monitoring
11
+ * - Log correlation (each key logs under its `name`)
13
12
  *
14
- * Pattern inspired by Java MicroSvcHeader enum. Lives in http-api (browser-safe)
13
+ * Pattern inspired by Java MicroSvcHeader enum. Lives in core-util (browser-safe)
15
14
  * so BOTH the http-client (request-id chaining) and http-server can reference it.
15
+ *
16
+ * Exposed as {@link HeaderRegistry.DEFAULT_HEADERS} — a service opts into these by
17
+ * passing `platformHeaders=true` to `HeaderRegistry.configure(...)`.
18
+ *
19
+ * Each key's `name` is the logical/log name; `httpHeader` is the wire name.
16
20
  */
17
21
  class WebpiecesCoreHeaders {
18
22
  /**
19
- * Unique ID for this request.
20
- * Generated by the server if not provided.
21
- * Used for distributed tracing and log correlation.
23
+ * Unique ID for this request. Generated by the server if not provided.
24
+ * Transferred (propagates downstream) and logged under 'requestId'.
22
25
  */
23
- static REQUEST_ID = new PlatformHeader_1.PlatformHeader('x-request-id', true, // transfer (propagate to downstream services)
24
- false, // not secured (it's just an ID)
25
- true, // use for metrics dimensions
26
- 'requestId' // MDC key (Java MicroSvcHeader parity)
27
- );
26
+ static REQUEST_ID = new ContextKey_1.ContextKey('requestId', 'x-request-id');
28
27
  /**
29
- * ID of the previous request in the call chain.
30
- * When service A calls service B, B receives A's REQUEST_ID as PREVIOUS_REQUEST_ID.
31
- * Used for building distributed trace trees.
28
+ * ID of the previous request in the call chain. When service A calls B, B
29
+ * receives A's REQUEST_ID as PREVIOUS_REQUEST_ID (builds the trace tree).
32
30
  */
33
- static PREVIOUS_REQUEST_ID = new PlatformHeader_1.PlatformHeader('x-previous-request-id', true, false, false, 'previousId' // MDC key (Java MicroSvcHeader parity)
34
- );
31
+ static PREVIOUS_REQUEST_ID = new ContextKey_1.ContextKey('previousId', 'x-previous-request-id');
35
32
  /**
36
- * Correlation ID that spans multiple related requests.
37
- * Typically set by the API gateway or first service in the chain.
38
- * All services in the call chain use the same CORRELATION_ID.
33
+ * Correlation ID spanning multiple related requests. Set by the gateway or
34
+ * first service; all hops in the chain share it.
39
35
  */
40
- static CORRELATION_ID = new PlatformHeader_1.PlatformHeader('x-correlation-id', true, false, true, // use for metrics dimensions
41
- 'correlationId' // MDC key
42
- );
36
+ static CORRELATION_ID = new ContextKey_1.ContextKey('correlationId', 'x-correlation-id');
43
37
  /**
44
38
  * Turns on test-case recording for this request (Java: x-webpieces-recording).
45
- * When present, the server records the endpoint + every downstream call it
46
- * makes into a fixture that can be replayed as a test.
47
39
  * Transferred so recording follows the request across service hops.
48
40
  */
49
- static RECORDING = new PlatformHeader_1.PlatformHeader('x-webpieces-recording', true, false, false);
41
+ static RECORDING = new ContextKey_1.ContextKey('recording', 'x-webpieces-recording');
50
42
  /**
51
- * The bearer credential for an authenticated request. Carries BOTH a user-facing
52
- * JWT (@AuthJwt, validated by the app AuthFilter) and a service-to-service Google
53
- * OIDC token (@AuthOidc, validated by the framework ServiceAuthFilter) — the two
54
- * modes are mutually exclusive per endpoint, so one header serves both. When a
55
- * Cloud Task is delivered, Google injects the OIDC token here as `Authorization`.
56
- * SECURED — masked in logs.
43
+ * The bearer credential for an authenticated request (user JWT or service OIDC
44
+ * token). Transferred and SECURED masked in logs.
57
45
  */
58
- static AUTHORIZATION = new PlatformHeader_1.PlatformHeader('authorization', true, // transfer into RequestContext
59
- true, // SECURED - mask in logs
60
- false);
46
+ static AUTHORIZATION = new ContextKey_1.ContextKey('authorization', 'authorization', /*isSecured*/ true);
61
47
  /**
62
- * Shared-secret credential for internal callers that cannot mint OIDC tokens
63
- * (@AuthSharedSecret, validated by ServiceAuthFilter via constant-time compare).
64
- * SECURED — masked in logs.
48
+ * Shared-secret credential for internal callers that cannot mint OIDC tokens.
49
+ * Transferred and SECURED masked in logs.
65
50
  */
66
- static SHARED_SECRET = new PlatformHeader_1.PlatformHeader('x-webpieces-shared-secret', true, // transfer into RequestContext
67
- true, // SECURED - mask in logs
68
- false);
51
+ static SHARED_SECRET = new ContextKey_1.ContextKey('sharedSecret', 'x-webpieces-shared-secret', /*isSecured*/ true);
69
52
  /**
70
- * Get all core headers as an array.
71
- * Used by WebpiecesModule to bind headers to DI container.
72
- *
73
- * @returns Array of all core platform headers
53
+ * Get all core context keys as an array (the platform DEFAULT_HEADERS set).
74
54
  */
75
55
  static getAllHeaders() {
76
56
  return [
@@ -1 +1 @@
1
- {"version":3,"file":"WebpiecesCoreHeaders.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util/src/http/WebpiecesCoreHeaders.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAElD;;;;;;;;;;;GAWG;AACH,MAAa,oBAAoB;IAC7B;;;;OAIG;IACH,MAAM,CAAU,UAAU,GAAG,IAAI,+BAAc,CAC3C,cAAc,EACd,IAAI,EAAS,8CAA8C;IAC3D,KAAK,EAAQ,gCAAgC;IAC7C,IAAI,EAAS,6BAA6B;IAC1C,WAAW,CAAE,uCAAuC;KACvD,CAAC;IAEF;;;;OAIG;IACH,MAAM,CAAU,mBAAmB,GAAG,IAAI,+BAAc,CACpD,uBAAuB,EACvB,IAAI,EACJ,KAAK,EACL,KAAK,EACL,YAAY,CAAE,uCAAuC;KACxD,CAAC;IAEF;;;;OAIG;IACH,MAAM,CAAU,cAAc,GAAG,IAAI,+BAAc,CAC/C,kBAAkB,EAClB,IAAI,EACJ,KAAK,EACL,IAAI,EAAa,6BAA6B;IAC9C,eAAe,CAAE,UAAU;KAC9B,CAAC;IAEF;;;;;OAKG;IACH,MAAM,CAAU,SAAS,GAAG,IAAI,+BAAc,CAC1C,uBAAuB,EACvB,IAAI,EACJ,KAAK,EACL,KAAK,CACR,CAAC;IAEF;;;;;;;OAOG;IACH,MAAM,CAAU,aAAa,GAAG,IAAI,+BAAc,CAC9C,eAAe,EACf,IAAI,EAAI,+BAA+B;IACvC,IAAI,EAAI,yBAAyB;IACjC,KAAK,CACR,CAAC;IAEF;;;;OAIG;IACH,MAAM,CAAU,aAAa,GAAG,IAAI,+BAAc,CAC9C,2BAA2B,EAC3B,IAAI,EAAI,+BAA+B;IACvC,IAAI,EAAI,yBAAyB;IACjC,KAAK,CACR,CAAC;IAEF;;;;;OAKG;IACH,MAAM,CAAC,aAAa;QAChB,OAAO;YACH,oBAAoB,CAAC,UAAU;YAC/B,oBAAoB,CAAC,mBAAmB;YACxC,oBAAoB,CAAC,cAAc;YACnC,oBAAoB,CAAC,SAAS;YAC9B,oBAAoB,CAAC,aAAa;YAClC,oBAAoB,CAAC,aAAa;SACrC,CAAC;IACN,CAAC;;AA/FL,oDAgGC","sourcesContent":["import { PlatformHeader } from './PlatformHeader';\n\n/**\n * Core framework headers for distributed tracing and request correlation.\n *\n * These are the minimal headers needed by the WebPieces framework for:\n * - Request tracking across services\n * - Distributed tracing (REQUEST_ID -> PREVIOUS_REQUEST_ID chaining per hop)\n * - Request correlation\n * - Metrics and monitoring\n *\n * Pattern inspired by Java MicroSvcHeader enum. Lives in http-api (browser-safe)\n * so BOTH the http-client (request-id chaining) and http-server can reference it.\n */\nexport class WebpiecesCoreHeaders {\n /**\n * Unique ID for this request.\n * Generated by the server if not provided.\n * Used for distributed tracing and log correlation.\n */\n static readonly REQUEST_ID = new PlatformHeader(\n 'x-request-id',\n true, // transfer (propagate to downstream services)\n false, // not secured (it's just an ID)\n true, // use for metrics dimensions\n 'requestId' // MDC key (Java MicroSvcHeader parity)\n );\n\n /**\n * ID of the previous request in the call chain.\n * When service A calls service B, B receives A's REQUEST_ID as PREVIOUS_REQUEST_ID.\n * Used for building distributed trace trees.\n */\n static readonly PREVIOUS_REQUEST_ID = new PlatformHeader(\n 'x-previous-request-id',\n true,\n false,\n false,\n 'previousId' // MDC key (Java MicroSvcHeader parity)\n );\n\n /**\n * Correlation ID that spans multiple related requests.\n * Typically set by the API gateway or first service in the chain.\n * All services in the call chain use the same CORRELATION_ID.\n */\n static readonly CORRELATION_ID = new PlatformHeader(\n 'x-correlation-id',\n true,\n false,\n true, // use for metrics dimensions\n 'correlationId' // MDC key\n );\n\n /**\n * Turns on test-case recording for this request (Java: x-webpieces-recording).\n * When present, the server records the endpoint + every downstream call it\n * makes into a fixture that can be replayed as a test.\n * Transferred so recording follows the request across service hops.\n */\n static readonly RECORDING = new PlatformHeader(\n 'x-webpieces-recording',\n true,\n false,\n false\n );\n\n /**\n * The bearer credential for an authenticated request. Carries BOTH a user-facing\n * JWT (@AuthJwt, validated by the app AuthFilter) and a service-to-service Google\n * OIDC token (@AuthOidc, validated by the framework ServiceAuthFilter) — the two\n * modes are mutually exclusive per endpoint, so one header serves both. When a\n * Cloud Task is delivered, Google injects the OIDC token here as `Authorization`.\n * SECURED — masked in logs.\n */\n static readonly AUTHORIZATION = new PlatformHeader(\n 'authorization',\n true, // transfer into RequestContext\n true, // SECURED - mask in logs\n false\n );\n\n /**\n * Shared-secret credential for internal callers that cannot mint OIDC tokens\n * (@AuthSharedSecret, validated by ServiceAuthFilter via constant-time compare).\n * SECURED — masked in logs.\n */\n static readonly SHARED_SECRET = new PlatformHeader(\n 'x-webpieces-shared-secret',\n true, // transfer into RequestContext\n true, // SECURED - mask in logs\n false\n );\n\n /**\n * Get all core headers as an array.\n * Used by WebpiecesModule to bind headers to DI container.\n *\n * @returns Array of all core platform headers\n */\n static getAllHeaders(): PlatformHeader[] {\n return [\n WebpiecesCoreHeaders.REQUEST_ID,\n WebpiecesCoreHeaders.PREVIOUS_REQUEST_ID,\n WebpiecesCoreHeaders.CORRELATION_ID,\n WebpiecesCoreHeaders.RECORDING,\n WebpiecesCoreHeaders.AUTHORIZATION,\n WebpiecesCoreHeaders.SHARED_SECRET,\n ];\n }\n}\n"]}
1
+ {"version":3,"file":"WebpiecesCoreHeaders.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util/src/http/WebpiecesCoreHeaders.ts"],"names":[],"mappings":";;;AAAA,8CAA2C;AAE3C;;;;;;;;;;;;;;;GAeG;AACH,MAAa,oBAAoB;IAC7B;;;OAGG;IACH,MAAM,CAAU,UAAU,GAAG,IAAI,uBAAU,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IAEzE;;;OAGG;IACH,MAAM,CAAU,mBAAmB,GAAG,IAAI,uBAAU,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAAC;IAE5F;;;OAGG;IACH,MAAM,CAAU,cAAc,GAAG,IAAI,uBAAU,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC;IAErF;;;OAGG;IACH,MAAM,CAAU,SAAS,GAAG,IAAI,uBAAU,CAAC,WAAW,EAAE,uBAAuB,CAAC,CAAC;IAEjF;;;OAGG;IACH,MAAM,CAAU,aAAa,GAAG,IAAI,uBAAU,CAAC,eAAe,EAAE,eAAe,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAErG;;;OAGG;IACH,MAAM,CAAU,aAAa,GAAG,IAAI,uBAAU,CAAC,cAAc,EAAE,2BAA2B,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAEhH;;OAEG;IACH,MAAM,CAAC,aAAa;QAChB,OAAO;YACH,oBAAoB,CAAC,UAAU;YAC/B,oBAAoB,CAAC,mBAAmB;YACxC,oBAAoB,CAAC,cAAc;YACnC,oBAAoB,CAAC,SAAS;YAC9B,oBAAoB,CAAC,aAAa;YAClC,oBAAoB,CAAC,aAAa;SACrC,CAAC;IACN,CAAC;;AAjDL,oDAkDC","sourcesContent":["import { ContextKey } from '../ContextKey';\n\n/**\n * Core framework context keys for distributed tracing and request correlation.\n *\n * These are the minimal keys the WebPieces framework needs for:\n * - Request tracking across services (REQUEST_ID -> PREVIOUS_REQUEST_ID chaining per hop)\n * - Request correlation\n * - Log correlation (each key logs under its `name`)\n *\n * Pattern inspired by Java MicroSvcHeader enum. Lives in core-util (browser-safe)\n * so BOTH the http-client (request-id chaining) and http-server can reference it.\n *\n * Exposed as {@link HeaderRegistry.DEFAULT_HEADERS} — a service opts into these by\n * passing `platformHeaders=true` to `HeaderRegistry.configure(...)`.\n *\n * Each key's `name` is the logical/log name; `httpHeader` is the wire name.\n */\nexport class WebpiecesCoreHeaders {\n /**\n * Unique ID for this request. Generated by the server if not provided.\n * Transferred (propagates downstream) and logged under 'requestId'.\n */\n static readonly REQUEST_ID = new ContextKey('requestId', 'x-request-id');\n\n /**\n * ID of the previous request in the call chain. When service A calls B, B\n * receives A's REQUEST_ID as PREVIOUS_REQUEST_ID (builds the trace tree).\n */\n static readonly PREVIOUS_REQUEST_ID = new ContextKey('previousId', 'x-previous-request-id');\n\n /**\n * Correlation ID spanning multiple related requests. Set by the gateway or\n * first service; all hops in the chain share it.\n */\n static readonly CORRELATION_ID = new ContextKey('correlationId', 'x-correlation-id');\n\n /**\n * Turns on test-case recording for this request (Java: x-webpieces-recording).\n * Transferred so recording follows the request across service hops.\n */\n static readonly RECORDING = new ContextKey('recording', 'x-webpieces-recording');\n\n /**\n * The bearer credential for an authenticated request (user JWT or service OIDC\n * token). Transferred and SECURED — masked in logs.\n */\n static readonly AUTHORIZATION = new ContextKey('authorization', 'authorization', /*isSecured*/ true);\n\n /**\n * Shared-secret credential for internal callers that cannot mint OIDC tokens.\n * Transferred and SECURED — masked in logs.\n */\n static readonly SHARED_SECRET = new ContextKey('sharedSecret', 'x-webpieces-shared-secret', /*isSecured*/ true);\n\n /**\n * Get all core context keys as an array (the platform DEFAULT_HEADERS set).\n */\n static getAllHeaders(): ContextKey[] {\n return [\n WebpiecesCoreHeaders.REQUEST_ID,\n WebpiecesCoreHeaders.PREVIOUS_REQUEST_ID,\n WebpiecesCoreHeaders.CORRELATION_ID,\n WebpiecesCoreHeaders.RECORDING,\n WebpiecesCoreHeaders.AUTHORIZATION,\n WebpiecesCoreHeaders.SHARED_SECRET,\n ];\n }\n}\n"]}
@@ -10,7 +10,7 @@ class RecorderKeys {
10
10
  * Key under which the active TestCaseRecorder travels in the request
11
11
  * context. Absent = not recording.
12
12
  */
13
- static RECORDER = new ContextKey_1.ContextKey('webpieces-recorder');
13
+ static RECORDER = new ContextKey_1.ContextKey('webpieces-recorder', undefined, false, /*isLogged*/ false);
14
14
  }
15
15
  exports.RecorderKeys = RecorderKeys;
16
16
  //# sourceMappingURL=TestCaseRecorder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TestCaseRecorder.js","sourceRoot":"","sources":["../../../../../../../packages/core/core-util/src/http/recorder/TestCaseRecorder.ts"],"names":[],"mappings":";;;AAAA,iDAA8C;AA6B9C;;GAEG;AACH,MAAa,YAAY;IACrB;;;OAGG;IACH,MAAM,CAAU,QAAQ,GAAG,IAAI,uBAAU,CAAC,oBAAoB,CAAC,CAAC;;AALpE,oCAMC","sourcesContent":["import { ContextKey } from '../../ContextKey';\nimport { RecordedEndpoint } from './RecordedEndpoint';\n\n/**\n * TestCaseRecorder - Records every api call made while serving one inbound\n * request (port of Java TestCaseRecorder).\n *\n * The recorder travels in the request's magic context under\n * RecorderKeys.RECORDER (Java: Context RECORDER_KEY). Downstream hooks -\n * the HTTP client proxy and recordable() in-process wrappers - check the\n * context and record into it when present.\n *\n * The contract lives in http-api (browser-safe, no Node imports) so the\n * http-client can reference it; the implementation (TestCaseRecorderImpl)\n * lives in http-server.\n */\nexport interface TestCaseRecorder {\n /**\n * Record one downstream api call (outbound HTTP or in-process recordable).\n */\n addEndpointInfo(info: RecordedEndpoint): void;\n\n /**\n * The most recently recorded downstream call (for hooks that fill in the\n * response after the call completes).\n */\n getLastEndpointInfo(): RecordedEndpoint | undefined;\n}\n\n/**\n * Context keys for the recording subsystem.\n */\nexport class RecorderKeys {\n /**\n * Key under which the active TestCaseRecorder travels in the request\n * context. Absent = not recording.\n */\n static readonly RECORDER = new ContextKey('webpieces-recorder');\n}\n"]}
1
+ {"version":3,"file":"TestCaseRecorder.js","sourceRoot":"","sources":["../../../../../../../packages/core/core-util/src/http/recorder/TestCaseRecorder.ts"],"names":[],"mappings":";;;AAAA,iDAA8C;AA6B9C;;GAEG;AACH,MAAa,YAAY;IACrB;;;OAGG;IACH,MAAM,CAAU,QAAQ,GAAG,IAAI,uBAAU,CAAC,oBAAoB,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;;AAL1G,oCAMC","sourcesContent":["import { ContextKey } from '../../ContextKey';\nimport { RecordedEndpoint } from './RecordedEndpoint';\n\n/**\n * TestCaseRecorder - Records every api call made while serving one inbound\n * request (port of Java TestCaseRecorder).\n *\n * The recorder travels in the request's magic context under\n * RecorderKeys.RECORDER (Java: Context RECORDER_KEY). Downstream hooks -\n * the HTTP client proxy and recordable() in-process wrappers - check the\n * context and record into it when present.\n *\n * The contract lives in http-api (browser-safe, no Node imports) so the\n * http-client can reference it; the implementation (TestCaseRecorderImpl)\n * lives in http-server.\n */\nexport interface TestCaseRecorder {\n /**\n * Record one downstream api call (outbound HTTP or in-process recordable).\n */\n addEndpointInfo(info: RecordedEndpoint): void;\n\n /**\n * The most recently recorded downstream call (for hooks that fill in the\n * response after the call completes).\n */\n getLastEndpointInfo(): RecordedEndpoint | undefined;\n}\n\n/**\n * Context keys for the recording subsystem.\n */\nexport class RecorderKeys {\n /**\n * Key under which the active TestCaseRecorder travels in the request\n * context. Absent = not recording.\n */\n static readonly RECORDER = new ContextKey('webpieces-recorder', undefined, false, /*isLogged*/ false);\n}\n"]}
package/src/index.d.ts CHANGED
@@ -7,7 +7,6 @@
7
7
  * @packageDocumentation
8
8
  */
9
9
  export { toError } from './lib/errorUtils';
10
- export { Header } from './Header';
11
10
  export { ContextKey } from './ContextKey';
12
11
  export { DocumentDesign, isDocumentDesign, DESIGN_METADATA_KEYS } from './DocumentDesign';
13
12
  export type { Logger, LogLevel } from './logging/Logger';
@@ -20,13 +19,10 @@ export type { AuthMode, ApiKind } from './http/decorators';
20
19
  export { ValidateImplementation } from './http/validators';
21
20
  export { ProtocolError, HttpError, HttpNotFoundError, EndpointNotFoundError, HttpBadRequestError, HttpUnauthorizedError, HttpForbiddenError, HttpTimeoutError, HttpBadGatewayError, HttpGatewayTimeoutError, HttpInternalServerError, HttpVendorError, HttpUserError, ENTITY_NOT_FOUND, WRONG_LOGIN_TYPE, WRONG_LOGIN, NOT_APPROVED, EMAIL_NOT_CONFIRMED, WRONG_DOMAIN, WRONG_COMPANY, NO_REG_CODE, } from './http/errors';
22
21
  export { InstantDto, DateDto, TimeDto, DateTimeDto, InstantUtil, DateUtil, TimeUtil, DateTimeUtil, } from './http/datetime';
23
- export { PlatformHeader } from './http/PlatformHeader';
24
- export { PlatformHeadersExtension } from './http/PlatformHeadersExtension';
25
22
  export { HeaderRegistry } from './http/HeaderRegistry';
26
23
  export { WebpiecesCoreHeaders } from './http/WebpiecesCoreHeaders';
27
24
  export { HeaderMethods } from './http/HeaderMethods';
28
25
  export { ContextReader } from './http/ContextReader';
29
- export { HEADER_TYPES } from './http/HeaderTypes';
30
26
  export { ContextMgr } from './http/ContextMgr';
31
27
  export { RequestIdChainProcessor } from './http/RequestIdChainProcessor';
32
28
  export { LogApiCall } from './http/LogApiCall';
package/src/index.js CHANGED
@@ -9,7 +9,7 @@
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.NOT_APPROVED = exports.WRONG_LOGIN = exports.WRONG_LOGIN_TYPE = exports.ENTITY_NOT_FOUND = exports.HttpUserError = exports.HttpVendorError = exports.HttpInternalServerError = exports.HttpGatewayTimeoutError = exports.HttpBadGatewayError = exports.HttpTimeoutError = exports.HttpForbiddenError = exports.HttpUnauthorizedError = exports.HttpBadRequestError = exports.EndpointNotFoundError = exports.HttpNotFoundError = exports.HttpError = exports.ProtocolError = exports.METADATA_KEYS = exports.RouteMetadata = exports.AuthMeta = exports.validateNoConflictingDecorators = exports.getQueueName = exports.assertPubSubConventions = exports.assertApiKind = exports.getApiKind = exports.assertEveryEndpointHasAuthMode = exports.getAuthMode = exports.getAuthMeta = exports.isApiPath = exports.getEndpoints = exports.getApiPath = exports.Queue = exports.PubSub = exports.Rpc = exports.AuthSharedSecret = exports.AuthOidc = exports.AuthJwt = exports.Public = exports.AuthenticationConfig = exports.Authentication = exports.Endpoint = exports.ApiPath = exports.LogManager = exports.ConsoleLoggerFactory = exports.ConsoleLogger = exports.DESIGN_METADATA_KEYS = exports.isDocumentDesign = exports.DocumentDesign = exports.ContextKey = exports.toError = void 0;
12
- exports.SerializedError = exports.SerializedMap = exports.RecordSerializer = exports.getDoNotRecordFields = exports.DoNotRecord = exports.RecordedTestCase = exports.RecordedError = exports.RecordedEndpoint = exports.RecorderKeys = exports.LogApiCall = exports.RequestIdChainProcessor = exports.ContextMgr = exports.HEADER_TYPES = exports.HeaderMethods = exports.WebpiecesCoreHeaders = exports.HeaderRegistry = exports.PlatformHeadersExtension = exports.PlatformHeader = exports.DateTimeUtil = exports.TimeUtil = exports.DateUtil = exports.InstantUtil = exports.NO_REG_CODE = exports.WRONG_COMPANY = exports.WRONG_DOMAIN = exports.EMAIL_NOT_CONFIRMED = void 0;
12
+ exports.SerializedError = exports.SerializedMap = exports.RecordSerializer = exports.getDoNotRecordFields = exports.DoNotRecord = exports.RecordedTestCase = exports.RecordedError = exports.RecordedEndpoint = exports.RecorderKeys = exports.LogApiCall = exports.RequestIdChainProcessor = exports.ContextMgr = exports.HeaderMethods = exports.WebpiecesCoreHeaders = exports.HeaderRegistry = exports.DateTimeUtil = exports.TimeUtil = exports.DateUtil = exports.InstantUtil = exports.NO_REG_CODE = exports.WRONG_COMPANY = exports.WRONG_DOMAIN = exports.EMAIL_NOT_CONFIRMED = void 0;
13
13
  var errorUtils_1 = require("./lib/errorUtils");
14
14
  Object.defineProperty(exports, "toError", { enumerable: true, get: function () { return errorUtils_1.toError; } });
15
15
  var ContextKey_1 = require("./ContextKey");
@@ -91,19 +91,13 @@ Object.defineProperty(exports, "InstantUtil", { enumerable: true, get: function
91
91
  Object.defineProperty(exports, "DateUtil", { enumerable: true, get: function () { return datetime_1.DateUtil; } });
92
92
  Object.defineProperty(exports, "TimeUtil", { enumerable: true, get: function () { return datetime_1.TimeUtil; } });
93
93
  Object.defineProperty(exports, "DateTimeUtil", { enumerable: true, get: function () { return datetime_1.DateTimeUtil; } });
94
- // Platform Headers
95
- var PlatformHeader_1 = require("./http/PlatformHeader");
96
- Object.defineProperty(exports, "PlatformHeader", { enumerable: true, get: function () { return PlatformHeader_1.PlatformHeader; } });
97
- var PlatformHeadersExtension_1 = require("./http/PlatformHeadersExtension");
98
- Object.defineProperty(exports, "PlatformHeadersExtension", { enumerable: true, get: function () { return PlatformHeadersExtension_1.PlatformHeadersExtension; } });
94
+ // Context keys + registry (the global magic-context header system)
99
95
  var HeaderRegistry_1 = require("./http/HeaderRegistry");
100
96
  Object.defineProperty(exports, "HeaderRegistry", { enumerable: true, get: function () { return HeaderRegistry_1.HeaderRegistry; } });
101
97
  var WebpiecesCoreHeaders_1 = require("./http/WebpiecesCoreHeaders");
102
98
  Object.defineProperty(exports, "WebpiecesCoreHeaders", { enumerable: true, get: function () { return WebpiecesCoreHeaders_1.WebpiecesCoreHeaders; } });
103
99
  var HeaderMethods_1 = require("./http/HeaderMethods");
104
100
  Object.defineProperty(exports, "HeaderMethods", { enumerable: true, get: function () { return HeaderMethods_1.HeaderMethods; } });
105
- var HeaderTypes_1 = require("./http/HeaderTypes");
106
- Object.defineProperty(exports, "HEADER_TYPES", { enumerable: true, get: function () { return HeaderTypes_1.HEADER_TYPES; } });
107
101
  // Outbound-header machinery (context reader + registry -> outbound HTTP headers).
108
102
  // Browser-safe — the server-side reader (RequestContextReader) and browser store
109
103
  // (MutableContextStore) both implement ContextReader, so this lives here rather
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/core/core-util/src/index.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * @webpieces/core-util\n *\n * Utility functions for WebPieces applications.\n * This package works in both browser and Node.js environments.\n *\n * @packageDocumentation\n */\n\nexport { toError } from './lib/errorUtils';\nexport { Header } from './Header';\nexport { ContextKey } from './ContextKey';\n\n// @DocumentDesign — DI-design-root marker. Applies to ANY project kind (server\n// controllers AND library impl classes), so it lives here (browser + Node) rather\n// than in a server-only routing package.\nexport { DocumentDesign, isDocumentDesign, DESIGN_METADATA_KEYS } from './DocumentDesign';\n\n// Logging (merged from former @webpieces/wp-logging).\n// Pluggable logging interface + a browser-safe console default; apps plug in\n// bunyan/winston/pino/etc. via LogManager.setFactory(...). Browser + Node.\nexport type { Logger, LogLevel } from './logging/Logger';\nexport type { LoggerFactory } from './logging/LoggerFactory';\nexport { ConsoleLogger } from './logging/ConsoleLogger';\nexport { ConsoleLoggerFactory } from './logging/ConsoleLoggerFactory';\nexport { LogManager } from './logging/LogManager';\n\n// HTTP API contract (merged from former @webpieces/http-api).\n// Shared HTTP API definition consumed by both client and server: REST\n// decorators, the HttpError hierarchy, datetime DTOs, platform-header\n// registry/readers, ValidateImplementation, and the test-case recorder\n// contract. Pure definitions — express-free, browser + Node safe.\n\n// API definition decorators\nexport {\n ApiPath,\n Endpoint,\n Authentication,\n AuthenticationConfig,\n // Auth mode decorators (clean service-to-service + user JWT model)\n Public,\n AuthJwt,\n AuthOidc,\n AuthSharedSecret,\n // API kind (RPC vs PubSub/Cloud Tasks) + queue naming\n Rpc,\n PubSub,\n Queue,\n getApiPath,\n getEndpoints,\n isApiPath,\n getAuthMeta,\n getAuthMode,\n assertEveryEndpointHasAuthMode,\n getApiKind,\n assertApiKind,\n assertPubSubConventions,\n getQueueName,\n validateNoConflictingDecorators,\n AuthMeta,\n RouteMetadata,\n METADATA_KEYS,\n} from './http/decorators';\nexport type { AuthMode, ApiKind } from './http/decorators';\n\n// Type validators\nexport { ValidateImplementation } from './http/validators';\n\n// HTTP errors\nexport {\n ProtocolError,\n HttpError,\n HttpNotFoundError,\n EndpointNotFoundError,\n HttpBadRequestError,\n HttpUnauthorizedError,\n HttpForbiddenError,\n HttpTimeoutError,\n HttpBadGatewayError,\n HttpGatewayTimeoutError,\n HttpInternalServerError,\n HttpVendorError,\n HttpUserError,\n // Error subtype constants\n ENTITY_NOT_FOUND,\n WRONG_LOGIN_TYPE,\n WRONG_LOGIN,\n NOT_APPROVED,\n EMAIL_NOT_CONFIRMED,\n WRONG_DOMAIN,\n WRONG_COMPANY,\n NO_REG_CODE,\n} from './http/errors';\n\n// Date/Time DTOs and Utilities (inspired by Java Time / JSR-310)\nexport {\n InstantDto,\n DateDto,\n TimeDto,\n DateTimeDto,\n InstantUtil,\n DateUtil,\n TimeUtil,\n DateTimeUtil,\n} from './http/datetime';\n\n// Platform Headers\nexport { PlatformHeader } from './http/PlatformHeader';\nexport { PlatformHeadersExtension } from './http/PlatformHeadersExtension';\nexport { HeaderRegistry } from './http/HeaderRegistry';\nexport { WebpiecesCoreHeaders } from './http/WebpiecesCoreHeaders';\nexport { HeaderMethods } from './http/HeaderMethods';\nexport { ContextReader } from './http/ContextReader';\nexport { HEADER_TYPES } from './http/HeaderTypes';\n\n// Outbound-header machinery (context reader + registry -> outbound HTTP headers).\n// Browser-safe — the server-side reader (RequestContextReader) and browser store\n// (MutableContextStore) both implement ContextReader, so this lives here rather\n// than in the Node-only @webpieces/core-context (which re-exports for back-compat).\nexport { ContextMgr } from './http/ContextMgr';\nexport { RequestIdChainProcessor } from './http/RequestIdChainProcessor';\n\n// API-call logging helper (uses LogManager above)\nexport { LogApiCall } from './http/LogApiCall';\n\n// Test-case recording contract (impl lives in http-server; hooks in http-client)\nexport { TestCaseRecorder, RecorderKeys } from './http/recorder/TestCaseRecorder';\nexport { RecordedEndpoint, RecordedError, RecordedTestCase } from './http/recorder/RecordedEndpoint';\nexport { DoNotRecord, getDoNotRecordFields } from './http/recorder/DoNotRecord';\nexport { RecordSerializer, SerializedMap, SerializedError } from './http/recorder/RecordSerializer';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/core/core-util/src/index.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * @webpieces/core-util\n *\n * Utility functions for WebPieces applications.\n * This package works in both browser and Node.js environments.\n *\n * @packageDocumentation\n */\n\nexport { toError } from './lib/errorUtils';\nexport { ContextKey } from './ContextKey';\n\n// @DocumentDesign — DI-design-root marker. Applies to ANY project kind (server\n// controllers AND library impl classes), so it lives here (browser + Node) rather\n// than in a server-only routing package.\nexport { DocumentDesign, isDocumentDesign, DESIGN_METADATA_KEYS } from './DocumentDesign';\n\n// Logging (merged from former @webpieces/wp-logging).\n// Pluggable logging interface + a browser-safe console default; apps plug in\n// bunyan/winston/pino/etc. via LogManager.setFactory(...). Browser + Node.\nexport type { Logger, LogLevel } from './logging/Logger';\nexport type { LoggerFactory } from './logging/LoggerFactory';\nexport { ConsoleLogger } from './logging/ConsoleLogger';\nexport { ConsoleLoggerFactory } from './logging/ConsoleLoggerFactory';\nexport { LogManager } from './logging/LogManager';\n\n// HTTP API contract (merged from former @webpieces/http-api).\n// Shared HTTP API definition consumed by both client and server: REST\n// decorators, the HttpError hierarchy, datetime DTOs, platform-header\n// registry/readers, ValidateImplementation, and the test-case recorder\n// contract. Pure definitions — express-free, browser + Node safe.\n\n// API definition decorators\nexport {\n ApiPath,\n Endpoint,\n Authentication,\n AuthenticationConfig,\n // Auth mode decorators (clean service-to-service + user JWT model)\n Public,\n AuthJwt,\n AuthOidc,\n AuthSharedSecret,\n // API kind (RPC vs PubSub/Cloud Tasks) + queue naming\n Rpc,\n PubSub,\n Queue,\n getApiPath,\n getEndpoints,\n isApiPath,\n getAuthMeta,\n getAuthMode,\n assertEveryEndpointHasAuthMode,\n getApiKind,\n assertApiKind,\n assertPubSubConventions,\n getQueueName,\n validateNoConflictingDecorators,\n AuthMeta,\n RouteMetadata,\n METADATA_KEYS,\n} from './http/decorators';\nexport type { AuthMode, ApiKind } from './http/decorators';\n\n// Type validators\nexport { ValidateImplementation } from './http/validators';\n\n// HTTP errors\nexport {\n ProtocolError,\n HttpError,\n HttpNotFoundError,\n EndpointNotFoundError,\n HttpBadRequestError,\n HttpUnauthorizedError,\n HttpForbiddenError,\n HttpTimeoutError,\n HttpBadGatewayError,\n HttpGatewayTimeoutError,\n HttpInternalServerError,\n HttpVendorError,\n HttpUserError,\n // Error subtype constants\n ENTITY_NOT_FOUND,\n WRONG_LOGIN_TYPE,\n WRONG_LOGIN,\n NOT_APPROVED,\n EMAIL_NOT_CONFIRMED,\n WRONG_DOMAIN,\n WRONG_COMPANY,\n NO_REG_CODE,\n} from './http/errors';\n\n// Date/Time DTOs and Utilities (inspired by Java Time / JSR-310)\nexport {\n InstantDto,\n DateDto,\n TimeDto,\n DateTimeDto,\n InstantUtil,\n DateUtil,\n TimeUtil,\n DateTimeUtil,\n} from './http/datetime';\n\n// Context keys + registry (the global magic-context header system)\nexport { HeaderRegistry } from './http/HeaderRegistry';\nexport { WebpiecesCoreHeaders } from './http/WebpiecesCoreHeaders';\nexport { HeaderMethods } from './http/HeaderMethods';\nexport { ContextReader } from './http/ContextReader';\n\n// Outbound-header machinery (context reader + registry -> outbound HTTP headers).\n// Browser-safe — the server-side reader (RequestContextReader) and browser store\n// (MutableContextStore) both implement ContextReader, so this lives here rather\n// than in the Node-only @webpieces/core-context (which re-exports for back-compat).\nexport { ContextMgr } from './http/ContextMgr';\nexport { RequestIdChainProcessor } from './http/RequestIdChainProcessor';\n\n// API-call logging helper (uses LogManager above)\nexport { LogApiCall } from './http/LogApiCall';\n\n// Test-case recording contract (impl lives in http-server; hooks in http-client)\nexport { TestCaseRecorder, RecorderKeys } from './http/recorder/TestCaseRecorder';\nexport { RecordedEndpoint, RecordedError, RecordedTestCase } from './http/recorder/RecordedEndpoint';\nexport { DoNotRecord, getDoNotRecordFields } from './http/recorder/DoNotRecord';\nexport { RecordSerializer, SerializedMap, SerializedError } from './http/recorder/RecordSerializer';\n"]}
@@ -29,6 +29,11 @@ export declare class LogManager {
29
29
  * Install the process-wide logging backend. Call once at app startup. Loggers
30
30
  * already handed out via {@link getLogger} switch to it immediately (they are
31
31
  * deferred facades), so import-time loggers are covered too.
32
+ *
33
+ * FAIL-FAST ORDERING: {@link HeaderRegistry} MUST be configured first — logging
34
+ * masks secured values and keys log lines off the registry's context keys, so a
35
+ * factory installed before the registry exists would log an incomplete/incorrect
36
+ * context. We log + throw rather than silently mis-log.
32
37
  */
33
38
  static setFactory(factory: LoggerFactory): void;
34
39
  /** Get a named logger (a stable deferred facade over the current backend). */
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LogManager = void 0;
4
4
  const ConsoleLoggerFactory_1 = require("./ConsoleLoggerFactory");
5
+ const HeaderRegistry_1 = require("../http/HeaderRegistry");
5
6
  /**
6
7
  * A stable per-name facade that re-resolves the currently installed factory on
7
8
  * EVERY call. This is why a module-scope `const log = LogManager.getLogger('X')`
@@ -60,8 +61,20 @@ class LogManager {
60
61
  * Install the process-wide logging backend. Call once at app startup. Loggers
61
62
  * already handed out via {@link getLogger} switch to it immediately (they are
62
63
  * deferred facades), so import-time loggers are covered too.
64
+ *
65
+ * FAIL-FAST ORDERING: {@link HeaderRegistry} MUST be configured first — logging
66
+ * masks secured values and keys log lines off the registry's context keys, so a
67
+ * factory installed before the registry exists would log an incomplete/incorrect
68
+ * context. We log + throw rather than silently mis-log.
63
69
  */
64
70
  static setFactory(factory) {
71
+ if (!HeaderRegistry_1.HeaderRegistry.isConfigured()) {
72
+ const msg = 'HeaderRegistry.configure(...) MUST be called before LogManager.setFactory(...) — ' +
73
+ 'the registry defines which context keys are logged and which are masked.';
74
+ // Log via the current (bootstrap console) backend, then fail fast.
75
+ LogManager.resolveBackend('LogManager').error(msg);
76
+ throw new Error(msg);
77
+ }
65
78
  LogManager.factory = factory;
66
79
  }
67
80
  /** Get a named logger (a stable deferred facade over the current backend). */
@@ -1 +1 @@
1
- {"version":3,"file":"LogManager.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util/src/logging/LogManager.ts"],"names":[],"mappings":";;;AAEA,iEAA8D;AAE9D;;;;;;;GAOG;AACH,MAAM,cAAc;IACa;IAA7B,YAA6B,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAAG,CAAC;IAE7C,KAAK,CAAC,OAAe,EAAE,GAAW;QAC9B,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,GAAW;QAC9B,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAC7D,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,GAAW;QAC7B,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAC5D,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,GAAW;QAC7B,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,GAAW;QAC9B,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAC7D,CAAC;CACJ;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,UAAU;IACX,MAAM,CAAC,OAAO,GAAkB,IAAI,2CAAoB,CAAC,IAAI,CAAC,CAAC;IAC/D,MAAM,CAAU,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE7D;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,OAAsB;QACpC,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC;IACjC,CAAC;IAED,8EAA8E;IAC9E,MAAM,CAAC,SAAS,CAAC,IAAY;QACzB,IAAI,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,MAAM,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;YAClC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,wEAAwE;IACxE,MAAM,CAAC,UAAU;QACb,OAAO,UAAU,CAAC,OAAO,CAAC;IAC9B,CAAC;IAED,yFAAyF;IACzF,MAAM,CAAC,cAAc,CAAC,IAAY;QAC9B,OAAO,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;;AA/BL,gCAgCC","sourcesContent":["import { Logger } from './Logger';\nimport { LoggerFactory } from './LoggerFactory';\nimport { ConsoleLoggerFactory } from './ConsoleLoggerFactory';\n\n/**\n * A stable per-name facade that re-resolves the currently installed factory on\n * EVERY call. This is why a module-scope `const log = LogManager.getLogger('X')`\n * captured at import time (before the app runs) still starts using the real\n * backend the instant `LogManager.setFactory(...)` installs it — and the bootstrap\n * AWAITING banner disappears. Backends cache their concrete logger per name, so\n * this indirection is a cheap Map lookup.\n */\nclass DeferredLogger implements Logger {\n constructor(private readonly name: string) {}\n\n trace(message: string, err?: Error): void {\n LogManager.resolveBackend(this.name).trace(message, err);\n }\n\n debug(message: string, err?: Error): void {\n LogManager.resolveBackend(this.name).debug(message, err);\n }\n\n info(message: string, err?: Error): void {\n LogManager.resolveBackend(this.name).info(message, err);\n }\n\n warn(message: string, err?: Error): void {\n LogManager.resolveBackend(this.name).warn(message, err);\n }\n\n error(message: string, err?: Error): void {\n LogManager.resolveBackend(this.name).error(message, err);\n }\n}\n\n/**\n * LogManager - the global, slf4j-style entry point for logging.\n *\n * Every call site in the codebase does:\n *\n * ```ts\n * const log = LogManager.getLogger('MyClass');\n * log.info('did the thing');\n * log.error('it failed', err); // err?: Error — the ONLY extra arg\n * ```\n *\n * and never knows which backend is behind it. Apps choose their backend ONCE at\n * startup by installing a {@link LoggerFactory}:\n *\n * ```ts\n * LogManager.setFactory(new BunyanLoggerFactory(...)); // node-only app\n * ```\n *\n * Until one is installed, logging goes to a bootstrap {@link ConsoleLoggerFactory}\n * that prefixes every line with an AWAITING banner (so a forgotten `setFactory` is\n * obvious). See `.webpieces/instruct-ai/webpieces.logging.md`.\n */\nexport class LogManager {\n private static factory: LoggerFactory = new ConsoleLoggerFactory(true);\n private static readonly deferred = new Map<string, Logger>();\n\n /**\n * Install the process-wide logging backend. Call once at app startup. Loggers\n * already handed out via {@link getLogger} switch to it immediately (they are\n * deferred facades), so import-time loggers are covered too.\n */\n static setFactory(factory: LoggerFactory): void {\n LogManager.factory = factory;\n }\n\n /** Get a named logger (a stable deferred facade over the current backend). */\n static getLogger(name: string): Logger {\n let logger = LogManager.deferred.get(name);\n if (!logger) {\n logger = new DeferredLogger(name);\n LogManager.deferred.set(name, logger);\n }\n return logger;\n }\n\n /** The currently installed factory (mainly for tests / diagnostics). */\n static getFactory(): LoggerFactory {\n return LogManager.factory;\n }\n\n /** Internal: resolve the concrete backend logger for a name (used by DeferredLogger). */\n static resolveBackend(name: string): Logger {\n return LogManager.factory.getLogger(name);\n }\n}\n"]}
1
+ {"version":3,"file":"LogManager.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util/src/logging/LogManager.ts"],"names":[],"mappings":";;;AAEA,iEAA8D;AAC9D,2DAAwD;AAExD;;;;;;;GAOG;AACH,MAAM,cAAc;IACa;IAA7B,YAA6B,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAAG,CAAC;IAE7C,KAAK,CAAC,OAAe,EAAE,GAAW;QAC9B,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,GAAW;QAC9B,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAC7D,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,GAAW;QAC7B,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAC5D,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,GAAW;QAC7B,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,GAAW;QAC9B,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAC7D,CAAC;CACJ;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,UAAU;IACX,MAAM,CAAC,OAAO,GAAkB,IAAI,2CAAoB,CAAC,IAAI,CAAC,CAAC;IAC/D,MAAM,CAAU,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE7D;;;;;;;;;OASG;IACH,MAAM,CAAC,UAAU,CAAC,OAAsB;QACpC,IAAI,CAAC,+BAAc,CAAC,YAAY,EAAE,EAAE,CAAC;YACjC,MAAM,GAAG,GACL,mFAAmF;gBACnF,0EAA0E,CAAC;YAC/E,mEAAmE;YACnE,UAAU,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnD,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;QACD,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC;IACjC,CAAC;IAED,8EAA8E;IAC9E,MAAM,CAAC,SAAS,CAAC,IAAY;QACzB,IAAI,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,MAAM,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;YAClC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,wEAAwE;IACxE,MAAM,CAAC,UAAU;QACb,OAAO,UAAU,CAAC,OAAO,CAAC;IAC9B,CAAC;IAED,yFAAyF;IACzF,MAAM,CAAC,cAAc,CAAC,IAAY;QAC9B,OAAO,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;;AA5CL,gCA6CC","sourcesContent":["import { Logger } from './Logger';\nimport { LoggerFactory } from './LoggerFactory';\nimport { ConsoleLoggerFactory } from './ConsoleLoggerFactory';\nimport { HeaderRegistry } from '../http/HeaderRegistry';\n\n/**\n * A stable per-name facade that re-resolves the currently installed factory on\n * EVERY call. This is why a module-scope `const log = LogManager.getLogger('X')`\n * captured at import time (before the app runs) still starts using the real\n * backend the instant `LogManager.setFactory(...)` installs it — and the bootstrap\n * AWAITING banner disappears. Backends cache their concrete logger per name, so\n * this indirection is a cheap Map lookup.\n */\nclass DeferredLogger implements Logger {\n constructor(private readonly name: string) {}\n\n trace(message: string, err?: Error): void {\n LogManager.resolveBackend(this.name).trace(message, err);\n }\n\n debug(message: string, err?: Error): void {\n LogManager.resolveBackend(this.name).debug(message, err);\n }\n\n info(message: string, err?: Error): void {\n LogManager.resolveBackend(this.name).info(message, err);\n }\n\n warn(message: string, err?: Error): void {\n LogManager.resolveBackend(this.name).warn(message, err);\n }\n\n error(message: string, err?: Error): void {\n LogManager.resolveBackend(this.name).error(message, err);\n }\n}\n\n/**\n * LogManager - the global, slf4j-style entry point for logging.\n *\n * Every call site in the codebase does:\n *\n * ```ts\n * const log = LogManager.getLogger('MyClass');\n * log.info('did the thing');\n * log.error('it failed', err); // err?: Error — the ONLY extra arg\n * ```\n *\n * and never knows which backend is behind it. Apps choose their backend ONCE at\n * startup by installing a {@link LoggerFactory}:\n *\n * ```ts\n * LogManager.setFactory(new BunyanLoggerFactory(...)); // node-only app\n * ```\n *\n * Until one is installed, logging goes to a bootstrap {@link ConsoleLoggerFactory}\n * that prefixes every line with an AWAITING banner (so a forgotten `setFactory` is\n * obvious). See `.webpieces/instruct-ai/webpieces.logging.md`.\n */\nexport class LogManager {\n private static factory: LoggerFactory = new ConsoleLoggerFactory(true);\n private static readonly deferred = new Map<string, Logger>();\n\n /**\n * Install the process-wide logging backend. Call once at app startup. Loggers\n * already handed out via {@link getLogger} switch to it immediately (they are\n * deferred facades), so import-time loggers are covered too.\n *\n * FAIL-FAST ORDERING: {@link HeaderRegistry} MUST be configured first — logging\n * masks secured values and keys log lines off the registry's context keys, so a\n * factory installed before the registry exists would log an incomplete/incorrect\n * context. We log + throw rather than silently mis-log.\n */\n static setFactory(factory: LoggerFactory): void {\n if (!HeaderRegistry.isConfigured()) {\n const msg =\n 'HeaderRegistry.configure(...) MUST be called before LogManager.setFactory(...) — ' +\n 'the registry defines which context keys are logged and which are masked.';\n // Log via the current (bootstrap console) backend, then fail fast.\n LogManager.resolveBackend('LogManager').error(msg);\n throw new Error(msg);\n }\n LogManager.factory = factory;\n }\n\n /** Get a named logger (a stable deferred facade over the current backend). */\n static getLogger(name: string): Logger {\n let logger = LogManager.deferred.get(name);\n if (!logger) {\n logger = new DeferredLogger(name);\n LogManager.deferred.set(name, logger);\n }\n return logger;\n }\n\n /** The currently installed factory (mainly for tests / diagnostics). */\n static getFactory(): LoggerFactory {\n return LogManager.factory;\n }\n\n /** Internal: resolve the concrete backend logger for a name (used by DeferredLogger). */\n static resolveBackend(name: string): Logger {\n return LogManager.factory.getLogger(name);\n }\n}\n"]}
package/src/Header.d.ts DELETED
@@ -1,22 +0,0 @@
1
- /**
2
- * Header - Interface for HTTP header definitions.
3
- *
4
- * This interface is defined in core-util (lowest level package) to avoid
5
- * circular dependencies. core-context depends on this interface, while
6
- * http-api's PlatformHeader implements it.
7
- *
8
- * Dependency hierarchy:
9
- * - core-util (defines Header interface)
10
- * - core-context (uses Header interface)
11
- * - http-api (PlatformHeader implements Header)
12
- *
13
- * This allows RequestContext to work with headers without depending on
14
- * higher-level packages like http-api.
15
- */
16
- export interface Header {
17
- /**
18
- * Get the HTTP header name (e.g., 'x-request-id', 'Authorization').
19
- * Also used as the key in RequestContext storage.
20
- */
21
- getHeaderName(): string;
22
- }
package/src/Header.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=Header.js.map
package/src/Header.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"Header.js","sourceRoot":"","sources":["../../../../../packages/core/core-util/src/Header.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Header - Interface for HTTP header definitions.\n *\n * This interface is defined in core-util (lowest level package) to avoid\n * circular dependencies. core-context depends on this interface, while\n * http-api's PlatformHeader implements it.\n *\n * Dependency hierarchy:\n * - core-util (defines Header interface)\n * - core-context (uses Header interface)\n * - http-api (PlatformHeader implements Header)\n *\n * This allows RequestContext to work with headers without depending on\n * higher-level packages like http-api.\n */\nexport interface Header {\n /**\n * Get the HTTP header name (e.g., 'x-request-id', 'Authorization').\n * Also used as the key in RequestContext storage.\n */\n getHeaderName(): string;\n}\n"]}
@@ -1,29 +0,0 @@
1
- /**
2
- * DI symbols for platform headers system.
3
- *
4
- * Uses Symbol.for() to create global symbols that work across module boundaries.
5
- * This is important for Inversify multiInject pattern where multiple modules
6
- * bind to the same symbol.
7
- */
8
- export declare const HEADER_TYPES: {
9
- /**
10
- * Symbol for PlatformHeadersExtension instances.
11
- * Multiple modules can bind PlatformHeadersExtension instances to this symbol,
12
- * and consumers can use @multiInject to collect all of them.
13
- *
14
- * Pattern: Extension (DI-level) vs Plugin (App-level)
15
- * - Extensions contribute specific capabilities to framework (headers, converters, etc.)
16
- * - Plugins provide complete features with modules + routes (Hibernate, Jackson, etc.)
17
- *
18
- * Usage:
19
- * ```typescript
20
- * // In a module
21
- * const extension = new PlatformHeadersExtension([header1, header2]);
22
- * bind<PlatformHeadersExtension>(HEADER_TYPES.PlatformHeadersExtension).toConstantValue(extension);
23
- *
24
- * // In a consumer
25
- * constructor(@multiInject(HEADER_TYPES.PlatformHeadersExtension) extensions: PlatformHeadersExtension[]) {}
26
- * ```
27
- */
28
- PlatformHeadersExtension: symbol;
29
- };
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HEADER_TYPES = void 0;
4
- /**
5
- * DI symbols for platform headers system.
6
- *
7
- * Uses Symbol.for() to create global symbols that work across module boundaries.
8
- * This is important for Inversify multiInject pattern where multiple modules
9
- * bind to the same symbol.
10
- */
11
- exports.HEADER_TYPES = {
12
- /**
13
- * Symbol for PlatformHeadersExtension instances.
14
- * Multiple modules can bind PlatformHeadersExtension instances to this symbol,
15
- * and consumers can use @multiInject to collect all of them.
16
- *
17
- * Pattern: Extension (DI-level) vs Plugin (App-level)
18
- * - Extensions contribute specific capabilities to framework (headers, converters, etc.)
19
- * - Plugins provide complete features with modules + routes (Hibernate, Jackson, etc.)
20
- *
21
- * Usage:
22
- * ```typescript
23
- * // In a module
24
- * const extension = new PlatformHeadersExtension([header1, header2]);
25
- * bind<PlatformHeadersExtension>(HEADER_TYPES.PlatformHeadersExtension).toConstantValue(extension);
26
- *
27
- * // In a consumer
28
- * constructor(@multiInject(HEADER_TYPES.PlatformHeadersExtension) extensions: PlatformHeadersExtension[]) {}
29
- * ```
30
- */
31
- PlatformHeadersExtension: Symbol.for('PlatformHeadersExtension'),
32
- };
33
- //# sourceMappingURL=HeaderTypes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HeaderTypes.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util/src/http/HeaderTypes.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACU,QAAA,YAAY,GAAG;IACxB;;;;;;;;;;;;;;;;;;OAkBG;IACH,wBAAwB,EAAE,MAAM,CAAC,GAAG,CAAC,0BAA0B,CAAC;CACnE,CAAC","sourcesContent":["/**\n * DI symbols for platform headers system.\n *\n * Uses Symbol.for() to create global symbols that work across module boundaries.\n * This is important for Inversify multiInject pattern where multiple modules\n * bind to the same symbol.\n */\nexport const HEADER_TYPES = {\n /**\n * Symbol for PlatformHeadersExtension instances.\n * Multiple modules can bind PlatformHeadersExtension instances to this symbol,\n * and consumers can use @multiInject to collect all of them.\n *\n * Pattern: Extension (DI-level) vs Plugin (App-level)\n * - Extensions contribute specific capabilities to framework (headers, converters, etc.)\n * - Plugins provide complete features with modules + routes (Hibernate, Jackson, etc.)\n *\n * Usage:\n * ```typescript\n * // In a module\n * const extension = new PlatformHeadersExtension([header1, header2]);\n * bind<PlatformHeadersExtension>(HEADER_TYPES.PlatformHeadersExtension).toConstantValue(extension);\n *\n * // In a consumer\n * constructor(@multiInject(HEADER_TYPES.PlatformHeadersExtension) extensions: PlatformHeadersExtension[]) {}\n * ```\n */\n PlatformHeadersExtension: Symbol.for('PlatformHeadersExtension'),\n};\n"]}
@@ -1,51 +0,0 @@
1
- import { Header } from '../Header';
2
- /**
3
- * PlatformHeader - Defines an HTTP header that can be transferred between services.
4
- *
5
- * Port of Java PlatformHeaders, simplified:
6
- * - No isWantLogged flag (deprecated in Java) - "wants MDC logging" is expressed
7
- * by setting loggerMdcKey. Headers without one still appear in API logs
8
- * (masked when isSecured); they just aren't exposed as an MDC dimension key.
9
- *
10
- * Implements Header interface from core-util to avoid circular dependencies.
11
- *
12
- * Per CLAUDE.md: "All data-only structures MUST be classes, not interfaces."
13
- * This is a data-only class with no business logic methods.
14
- */
15
- export declare class PlatformHeader implements Header {
16
- /**
17
- * The HTTP header name (e.g., 'x-request-id', 'x-tenant-id').
18
- * Also used as the MDC logging key in RequestContext.
19
- * Case-insensitive per HTTP spec, but stored in canonical form.
20
- */
21
- readonly headerName: string;
22
- /**
23
- * Whether this header should be transferred from HTTP request to RequestContext.
24
- * If false, header is defined but not automatically transferred.
25
- * Only headers with isWantTransferred=true are copied from incoming requests.
26
- */
27
- readonly isWantTransferred: boolean;
28
- /**
29
- * Whether this header contains sensitive data that should be secured/masked in logs.
30
- * Examples: Authorization tokens, passwords, API keys.
31
- */
32
- readonly isSecured: boolean;
33
- /**
34
- * Whether this header should be used as a dimension for metrics/monitoring.
35
- * Examples: x-tenant-id, x-request-id (for distributed tracing).
36
- */
37
- readonly isDimensionForMetrics: boolean;
38
- /**
39
- * Key used when exposing this header to the logger's MDC / structured log
40
- * dimensions. Port of Java getLoggerMDCKey(). When set, log maps key this
41
- * header by it instead of headerName (e.g. 'requestId' vs 'x-request-id').
42
- * Undefined = not an MDC dimension (Java: getLoggerMDCKey() == null).
43
- */
44
- readonly loggerMdcKey?: string;
45
- constructor(headerName: string, isWantTransferred?: boolean, isSecured?: boolean, isDimensionForMetrics?: boolean, loggerMdcKey?: string);
46
- /**
47
- * Get the header name (implements Header interface).
48
- * @returns The HTTP header name
49
- */
50
- getHeaderName(): string;
51
- }