@webpieces/core-util 0.2.91 → 0.2.93

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/core-util",
3
- "version": "0.2.91",
3
+ "version": "0.2.93",
4
4
  "description": "Utility functions for WebPieces - works in browser and Node.js",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -0,0 +1,21 @@
1
+ import { Header } from './Header';
2
+ /**
3
+ * ContextKey - Typed key for non-HTTP context values stored in RequestContext.
4
+ *
5
+ * Similar to PlatformHeader but for context-only values that don't correspond
6
+ * to HTTP headers (e.g., METHOD_META, REQUEST_PATH).
7
+ *
8
+ * Customers can define their own ContextKey instances for app-specific values.
9
+ *
10
+ * Usage:
11
+ * ```typescript
12
+ * const MY_KEY = new ContextKey('my-app-key');
13
+ * RequestContext.putHeader(MY_KEY, someValue);
14
+ * const value = RequestContext.getHeader(MY_KEY);
15
+ * ```
16
+ */
17
+ export declare class ContextKey implements Header {
18
+ private readonly keyName;
19
+ constructor(keyName: string);
20
+ getHeaderName(): string;
21
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContextKey = void 0;
4
+ /**
5
+ * ContextKey - Typed key for non-HTTP context values stored in RequestContext.
6
+ *
7
+ * Similar to PlatformHeader but for context-only values that don't correspond
8
+ * to HTTP headers (e.g., METHOD_META, REQUEST_PATH).
9
+ *
10
+ * Customers can define their own ContextKey instances for app-specific values.
11
+ *
12
+ * Usage:
13
+ * ```typescript
14
+ * const MY_KEY = new ContextKey('my-app-key');
15
+ * RequestContext.putHeader(MY_KEY, someValue);
16
+ * const value = RequestContext.getHeader(MY_KEY);
17
+ * ```
18
+ */
19
+ class ContextKey {
20
+ constructor(keyName) {
21
+ this.keyName = keyName;
22
+ }
23
+ getHeaderName() {
24
+ return this.keyName;
25
+ }
26
+ }
27
+ exports.ContextKey = ContextKey;
28
+ //# sourceMappingURL=ContextKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContextKey.js","sourceRoot":"","sources":["../../../../../packages/core/core-util/src/ContextKey.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;GAcG;AACH,MAAa,UAAU;IACnB,YAA6B,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;IAAG,CAAC;IAEhD,aAAa;QACT,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;CACJ;AAND,gCAMC","sourcesContent":["import { Header } from './Header';\n\n/**\n * ContextKey - Typed key for non-HTTP context values stored in RequestContext.\n *\n * Similar to PlatformHeader but for context-only values that don't correspond\n * to HTTP headers (e.g., METHOD_META, REQUEST_PATH).\n *\n * Customers can define their own ContextKey instances for app-specific values.\n *\n * Usage:\n * ```typescript\n * const MY_KEY = new ContextKey('my-app-key');\n * RequestContext.putHeader(MY_KEY, someValue);\n * const value = RequestContext.getHeader(MY_KEY);\n * ```\n */\nexport class ContextKey implements Header {\n constructor(private readonly keyName: string) {}\n\n getHeaderName(): string {\n return this.keyName;\n }\n}\n"]}
package/src/index.d.ts CHANGED
@@ -8,3 +8,4 @@
8
8
  */
9
9
  export { toError } from './lib/errorUtils';
10
10
  export { Header } from './Header';
11
+ export { ContextKey } from './ContextKey';
package/src/index.js CHANGED
@@ -8,7 +8,9 @@
8
8
  * @packageDocumentation
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.toError = void 0;
11
+ exports.ContextKey = exports.toError = void 0;
12
12
  var errorUtils_1 = require("./lib/errorUtils");
13
13
  Object.defineProperty(exports, "toError", { enumerable: true, get: function () { return errorUtils_1.toError; } });
14
+ var ContextKey_1 = require("./ContextKey");
15
+ Object.defineProperty(exports, "ContextKey", { enumerable: true, get: function () { return ContextKey_1.ContextKey; } });
14
16
  //# sourceMappingURL=index.js.map
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":";AAAA;;;;;;;GAOG;;;AAEH,+CAA2C;AAAlC,qGAAA,OAAO,OAAA","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';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/core/core-util/src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,+CAA2C;AAAlC,qGAAA,OAAO,OAAA;AAEhB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA","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"]}