@eliware/common 12.0.0 → 12.0.1

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/README.md CHANGED
@@ -23,7 +23,7 @@ A shared ESM compatibility package for Eliware filesystem, path, logging, error,
23
23
 
24
24
  ## Features
25
25
 
26
- Import shared Eliware APIs from `@eliware/common`.
26
+ Import shared Eliware APIs, including secret-redaction tools, from `@eliware/common`.
27
27
 
28
28
  ## Requirements
29
29
 
@@ -55,7 +55,7 @@ Read the [troubleshooting guide](docs/troubleshooting.md).
55
55
 
56
56
  ## Security
57
57
 
58
- Keep secrets and credentials out of logs and examples.
58
+ Keep secrets and credentials out of logs and examples. Use redaction tools as an extra safeguard.
59
59
 
60
60
  ## API
61
61
 
package/RELEASE_NOTES.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Release Notes
2
2
 
3
+ ## 12.0.1 — 2026-10-12
4
+
5
+ ### Added
6
+
7
+ - Added `@eliware/redact` APIs and TypeScript option types.
8
+
3
9
  ## 12.0.0 — 2026-10-12
4
10
 
5
11
  ### Added
package/docs/api.md CHANGED
@@ -45,6 +45,25 @@ It does not call `toJSON`. It uses default secret keys and limits when you omit
45
45
  It returns JSON-safe values. It converts BigInt values to text and marks circular or truncated values.
46
46
  Read the [log package docs](https://github.com/eliware/log/tree/main/docs) for defaults and details.
47
47
 
48
+ ## Redaction APIs
49
+
50
+ `defaultPolicy` provides the default sensitive key names and marker.
51
+ Call `createPolicy(options?)` to make a frozen policy with custom key names or markers.
52
+ Call `redactValue(value, options?)` to return a redacted copy of an object or array.
53
+ Call `redactHeaders(headers, options?)` to redact header values in an object, pair array, or entries object.
54
+ Call `redactText(value, options?)` to redact common credential patterns, custom key values, and literal secrets.
55
+ Call `replaceLiteralSecret(value, secret, marker?)` to replace one exact secret in text.
56
+
57
+ Policy options include `keys`, `redactKeys`, `marker`, and `circularMarker`.
58
+ Structured values also support `maxDepth`, `maxKeys`, and `maxArray` limits.
59
+ Text also supports `secrets` and the `maxOutputLength` limit.
60
+ The default marker is `[REDACTED]`. The default text limit is 10,000 characters.
61
+ `redactText` detects authorization values, secret assignments, provider tokens, JWT-like strings, and key blocks.
62
+ `redactValue` returns a copy and does not change its input.
63
+ `redactHeaders` keeps the input shape for objects and pair arrays. It returns a lowercase object for entries objects.
64
+ The `safeSerialize` export in Log APIs is the same function as `@eliware/redact` exports.
65
+ Read the [Redact API guide](https://github.com/eliware/redact/blob/main/docs/api.md) for full rules and limits.
66
+
48
67
  ## Error handlers
49
68
 
50
69
  Call `registerHandlers(options?)` to register handlers for process events.
@@ -112,6 +131,7 @@ The package exports these types:
112
131
  - `Logger`
113
132
  - `RegisterHandlersOptions` and `RegisteredHandlers`
114
133
  - `RegisterSignalsOptions` and `SignalsRegistration`
134
+ - `RedactionPolicy`, `SerializationOptions`, `StructuredRedactionOptions`, and `TextRedactionOptions`
115
135
  - `SnowflakeGeneratorOptions` and `SnowflakeConstants`
116
136
 
117
137
  Read the [declaration file](../src/index.d.ts) for the current type exports.
package/docs/package.md CHANGED
@@ -19,6 +19,7 @@ The package uses major version 12 of these Eliware packages:
19
19
  - `@eliware/errors`
20
20
  - `@eliware/log`
21
21
  - `@eliware/path`
22
+ - `@eliware/redact`
22
23
  - `@eliware/signals`
23
24
  - `@eliware/snowflake`
24
25
 
package/docs/usage.md CHANGED
@@ -86,6 +86,22 @@ logger.info("Request complete", safeSerialize({ requestId: "example" }));
86
86
 
87
87
  Pass metadata as the second logger argument. Use `safeSerialize` to remove secret fields before you log data.
88
88
 
89
+ ## Redact sensitive values
90
+
91
+ Use `redactText` to remove credentials from text before you log or store it.
92
+
93
+ ```js
94
+ import { redactText, redactValue } from "@eliware/common";
95
+
96
+ const message = redactText("Authorization: Bearer example-token");
97
+ const record = redactValue({ user: "alex", token: "example-token" });
98
+ console.log(message, record);
99
+ ```
100
+
101
+ `redactText` applies common credential rules. Pass `secrets` to replace known literal values.
102
+ `redactValue` returns a copy with sensitive property values replaced.
103
+ Read the [Redaction APIs](api.md#redaction-apis) for policies, options, limits, and header handling.
104
+
89
105
  ## Handle process errors and signals
90
106
 
91
107
  Call `registerHandlers(options)` to add process error handlers. Call its `removeHandlers()` method when you no longer need them.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eliware/common",
3
- "version": "12.0.0",
3
+ "version": "12.0.1",
4
4
  "type": "module",
5
5
  "description": "A shared ESM compatibility package for Eliware filesystem, path, logging, error, and signal APIs.",
6
6
  "keywords": [
@@ -47,6 +47,7 @@
47
47
  "@eliware/errors": "^12.0.0",
48
48
  "@eliware/log": "^12.0.0",
49
49
  "@eliware/path": "^12.0.0",
50
+ "@eliware/redact": "^12.0.0",
50
51
  "@eliware/signals": "^12.0.0",
51
52
  "@eliware/snowflake": "^12.0.0"
52
53
  },
package/src/index.d.ts CHANGED
@@ -21,6 +21,20 @@ export {
21
21
  constants,
22
22
  } from "@eliware/snowflake";
23
23
  export type { SnowflakeGeneratorOptions, SnowflakeConstants } from "@eliware/snowflake";
24
+ export {
25
+ createPolicy,
26
+ defaultPolicy,
27
+ redactValue,
28
+ redactHeaders,
29
+ redactText,
30
+ replaceLiteralSecret,
31
+ } from "@eliware/redact";
32
+ export type {
33
+ RedactionPolicy,
34
+ SerializationOptions,
35
+ StructuredRedactionOptions,
36
+ TextRedactionOptions,
37
+ } from "@eliware/redact";
24
38
  export { default as registerHandlers } from "@eliware/errors";
25
39
  export { default as registerSignals } from "@eliware/signals";
26
40
  export type {
package/src/index.mjs CHANGED
@@ -15,5 +15,13 @@ export {
15
15
  generate,
16
16
  constants,
17
17
  } from "@eliware/snowflake";
18
+ export {
19
+ createPolicy,
20
+ defaultPolicy,
21
+ redactValue,
22
+ redactHeaders,
23
+ redactText,
24
+ replaceLiteralSecret,
25
+ } from "@eliware/redact";
18
26
  export { default as registerHandlers } from "./errors.mjs";
19
27
  export { default as registerSignals } from "./signals.mjs";