field-redactor 1.6.0 → 1.6.2

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 (75) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/CONTRIBUTING.md +5 -3
  3. package/README.md +2 -2
  4. package/dist/api/fieldRedactor.d.ts +3 -5
  5. package/dist/api/fieldRedactor.d.ts.map +1 -1
  6. package/dist/api/fieldRedactor.js +7 -11
  7. package/dist/api/fieldRedactor.js.map +1 -1
  8. package/dist/api/fieldRedactorConfigBuilder.d.ts +3 -3
  9. package/dist/api/fieldRedactorConfigBuilder.d.ts.map +1 -1
  10. package/dist/api/fieldRedactorConfigBuilder.js +7 -9
  11. package/dist/api/fieldRedactorConfigBuilder.js.map +1 -1
  12. package/dist/api/fieldRedactorDeps.d.ts +2 -2
  13. package/dist/api/fieldRedactorDeps.d.ts.map +1 -1
  14. package/dist/api/fieldRedactorDeps.js +6 -6
  15. package/dist/api/fieldRedactorDeps.js.map +1 -1
  16. package/dist/config/presets.d.ts +2 -2
  17. package/dist/config/presets.js +1 -1
  18. package/dist/config/redactionRules.d.ts +13 -7
  19. package/dist/config/redactionRules.d.ts.map +1 -1
  20. package/dist/config/redactionRules.js +20 -16
  21. package/dist/config/redactionRules.js.map +1 -1
  22. package/dist/dryrun/dryRun.d.ts.map +1 -1
  23. package/dist/dryrun/dryRun.js +2 -2
  24. package/dist/dryrun/dryRun.js.map +1 -1
  25. package/dist/engine/arrayRedaction.js +1 -1
  26. package/dist/engine/arrayRedaction.js.map +1 -1
  27. package/dist/engine/customObjectFieldHandler.d.ts +4 -9
  28. package/dist/engine/customObjectFieldHandler.d.ts.map +1 -1
  29. package/dist/engine/customObjectFieldHandler.js +90 -108
  30. package/dist/engine/customObjectFieldHandler.js.map +1 -1
  31. package/dist/engine/objectRedactorCustomObject.d.ts +8 -23
  32. package/dist/engine/objectRedactorCustomObject.d.ts.map +1 -1
  33. package/dist/engine/objectRedactorCustomObject.js +8 -40
  34. package/dist/engine/objectRedactorCustomObject.js.map +1 -1
  35. package/dist/engine/objectRedactorHelpers.d.ts +3 -4
  36. package/dist/engine/objectRedactorHelpers.d.ts.map +1 -1
  37. package/dist/engine/objectRedactorHelpers.js +12 -38
  38. package/dist/engine/objectRedactorHelpers.js.map +1 -1
  39. package/dist/engine/objectRedactorTraversal.d.ts +1 -0
  40. package/dist/engine/objectRedactorTraversal.d.ts.map +1 -1
  41. package/dist/engine/objectRedactorTraversal.js +2 -1
  42. package/dist/engine/objectRedactorTraversal.js.map +1 -1
  43. package/dist/rules/ruleResolver.d.ts +3 -5
  44. package/dist/rules/ruleResolver.d.ts.map +1 -1
  45. package/dist/rules/ruleResolver.js +17 -23
  46. package/dist/rules/ruleResolver.js.map +1 -1
  47. package/dist/rules/schemaSiblingKey.d.ts +4 -0
  48. package/dist/rules/schemaSiblingKey.d.ts.map +1 -0
  49. package/dist/rules/schemaSiblingKey.js +19 -0
  50. package/dist/rules/schemaSiblingKey.js.map +1 -0
  51. package/dist/rules/secretManager.d.ts +6 -7
  52. package/dist/rules/secretManager.d.ts.map +1 -1
  53. package/dist/rules/secretManager.js +13 -8
  54. package/dist/rules/secretManager.js.map +1 -1
  55. package/dist/types.d.ts +12 -12
  56. package/dist/types.d.ts.map +1 -1
  57. package/dist/types.js +4 -4
  58. package/dist/types.js.map +1 -1
  59. package/dist/util/maybeAsync.d.ts +0 -1
  60. package/dist/util/maybeAsync.d.ts.map +1 -1
  61. package/dist/util/maybeAsync.js +1 -3
  62. package/dist/util/maybeAsync.js.map +1 -1
  63. package/dist/util/primitiveCoercion.d.ts +4 -0
  64. package/dist/util/primitiveCoercion.d.ts.map +1 -0
  65. package/dist/util/primitiveCoercion.js +21 -0
  66. package/dist/util/primitiveCoercion.js.map +1 -0
  67. package/docs/guides/anti-patterns.md +1 -1
  68. package/docs/guides/metadata-redaction.md +2 -2
  69. package/docs/guides/migration-1.5-to-1.6.md +7 -5
  70. package/docs/guides/secret-key-modes.md +9 -14
  71. package/docs/reference/config.md +2 -2
  72. package/docs/release-notes/README.md +3 -1
  73. package/docs/release-notes/v1.6.1.md +24 -0
  74. package/docs/release-notes/v1.6.2.md +26 -0
  75. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  # Secret key modes
2
2
 
3
- FieldRedactor applies **Shallow**, **Deep**, **Opaque**, and **Remove** rules via regex key matching. Throughout the docs, these are the conceptual names; the config fields are `secretKeys`, `deepSecretKeys`, `fullSecretKeys`, and `deleteSecretKeys`.
3
+ FieldRedactor applies **Shallow**, **Deep**, **Opaque**, and **Remove** rules via regex key matching. Throughout the docs, these are the conceptual names; the config fields are `secretKeys`, `deepSecretKeys`, `opaqueSecretKeys`, and `removeSecretKeys` (legacy aliases `fullSecretKeys` / `deleteSecretKeys` still work).
4
4
 
5
5
  **Precedence** (highest wins): Schema (`customObjects`) → Opaque → Deep → Remove → Shallow → Value-pattern (`valuePatterns`)
6
6
 
@@ -20,8 +20,8 @@ Same input for every row:
20
20
  | --- | --- | --- | --- |
21
21
  | **Shallow** | `secretKeys` | `[/email/]` | `contactInfo.email` → `"REDACTED"`; `city`, `username` unchanged |
22
22
  | **Deep** | `deepSecretKeys` | `[/contactInfo/]` | All primitives inside `contactInfo` redacted |
23
- | **Opaque** | `fullSecretKeys` | `[/contactInfo/]` | Entire `contactInfo` replaced with `"REDACTED"` |
24
- | **Remove** | `deleteSecretKeys` | `[/authKey/]` | `authKey` key removed from output |
23
+ | **Opaque** | `opaqueSecretKeys` | `[/contactInfo/]` | Entire `contactInfo` replaced with `"REDACTED"` |
24
+ | **Remove** | `removeSecretKeys` | `[/authKey/]` | `authKey` key removed from output |
25
25
 
26
26
  ### Builder API
27
27
 
@@ -74,13 +74,13 @@ await fieldRedactor.redact({
74
74
  // → email, id, and other primitives under contactInfo are redacted
75
75
  ```
76
76
 
77
- ## Opaque (`fullSecretKeys`)
77
+ ## Opaque (`opaqueSecretKeys`)
78
78
 
79
79
  Stringify the entire value at matching keys, then redact. Typical for objects and arrays you want to hide completely.
80
80
 
81
81
  ```typescript
82
82
  const fieldRedactor = new FieldRedactor({
83
- fullSecretKeys: [/contactInfo/i]
83
+ opaqueSecretKeys: [/contactInfo/i]
84
84
  });
85
85
 
86
86
  await fieldRedactor.redact({
@@ -89,20 +89,15 @@ await fieldRedactor.redact({
89
89
  // → { contactInfo: "REDACTED" }
90
90
  ```
91
91
 
92
- ## Remove (`deleteSecretKeys`)
92
+ ## Remove (`removeSecretKeys`)
93
93
 
94
94
  Delete matching keys from the output.
95
95
 
96
96
  ```typescript
97
97
  const fieldRedactor = new FieldRedactor({
98
- deleteSecretKeys: [/authKey/i]
98
+ removeSecretKeys: [/authKey/i]
99
99
  });
100
100
 
101
- await fieldRedactor.redact({ userId: 271, appAuthKey: '12345' });
102
- // → { userId: 271 }
101
+ await fieldRedactor.redact({ authKey: 'secret-token', username: 'alice' });
102
+ // → { username: 'alice' }
103
103
  ```
104
-
105
- ## Related
106
-
107
- - [Metadata redaction](metadata-redaction.md) — when sensitivity depends on sibling fields
108
- - [Configuration reference](../reference/config.md) — all options and API details
@@ -8,8 +8,8 @@
8
8
  | — | `syncRedactor` | `(val) => string` | `"REDACTED"` sync | Sync redactor; enables `redactSync()` without per-field Promises |
9
9
  | **Shallow** | `secretKeys` | `RegExp[]` | `null` | Redact matching scalar values; if no rules at all, everything matches |
10
10
  | **Deep** | `deepSecretKeys` | `RegExp[]` | `[]` | Deeply redact all primitives under matching keys |
11
- | **Opaque** | `fullSecretKeys` | `RegExp[]` | `[]` | Stringify and redact entire values |
12
- | **Remove** | `deleteSecretKeys` | `RegExp[]` | `[]` | Delete matching keys |
11
+ | **Opaque** | `opaqueSecretKeys` | `RegExp[]` | `[]` | Stringify and redact entire values (legacy alias: `fullSecretKeys`) |
12
+ | **Remove** | `removeSecretKeys` | `RegExp[]` | `[]` | Delete matching keys (legacy alias: `deleteSecretKeys`) |
13
13
  | **Schema** | `customObjects` | `CustomObject[]` | `[]` | Per-shape rules; see [metadata guide](../guides/metadata-redaction.md) |
14
14
  | **Value-pattern** | `valuePatterns` | `RegExp[]` | `[]` | Opt-in: redact scalars whose string form matches a pattern |
15
15
  | **Path rule** | `pathRules` | `PathRule[]` | `[]` | Apply a mode at a JSON path (`metadata.*.value`) |
@@ -4,6 +4,8 @@ Per-version release notes for published **field-redactor** git tags. npm release
4
4
 
5
5
  | Version | npm | Notes |
6
6
  | --- | --- | --- |
7
+ | **v1.6.2** | Yes | [v1.6.2.md](v1.6.2.md) — canonical opaque/remove naming; drop ObjectRedactor façade |
8
+ | **v1.6.1** | Yes | [v1.6.1.md](v1.6.1.md) — internal simplification / layering cleanup |
7
9
  | **v1.6.0** | Yes | [v1.6.0.md](v1.6.0.md) — path rules, passKeys, naming aliases, architecture |
8
10
  | **v1.5.0** | Yes | [v1.5.0.md](v1.5.0.md) — DX polish, value patterns, unified traversal |
9
11
  | v1.3.0 | No (superseded by 1.5.0) | [v1.3.0.md](v1.3.0.md) — sync API, COW, builder, dryRun, presets |
@@ -15,7 +17,7 @@ Per-version release notes for published **field-redactor** git tags. npm release
15
17
 
16
18
  ## Migration
17
19
 
18
- - [1.5.x → 1.6.0](../guides/migration-1.5-to-1.6.md) — path rules, naming aliases, package exports
20
+ - [1.5.x → 1.6.x](../guides/migration-1.5-to-1.6.md) — path rules, naming aliases, package exports
19
21
  - [1.2.x → 1.5.0](../guides/migration-1.2-to-1.5.md) — upgrade path from the previous npm line
20
22
 
21
23
  ## Internal milestones (removed)
@@ -0,0 +1,24 @@
1
+ # Release notes — v1.6.1
2
+
3
+ Field Redactor **1.6.1** is a patch release focused on internal simplification after **1.6.0**. Behavior and the documented public API are unchanged for typical `import { … } from 'field-redactor'` consumers.
4
+
5
+ **Upgrade from 1.6.0:** Install `1.6.1`. No config or call-site changes required unless you relied on the undocumented convenience alias `FieldRedactor.fromConfig()` (use `new FieldRedactor(config)` or `create` / `createSafe` instead).
6
+
7
+ ## Highlights
8
+
9
+ | Area | What changed |
10
+ | --- | --- |
11
+ | **Custom objects** | One `handleField` path; single match-type dispatcher |
12
+ | **Layering** | Sibling-key + primitive helpers live under `rules/` / `util/` (rules no longer import engine) |
13
+ | **Config** | Alias normalize once on construct; shared `forceDeepForKey` / path-mode map |
14
+ | **Dead code** | Removed unused re-export shims and dry-run attribution wrappers |
15
+
16
+ ## Removed
17
+
18
+ - `FieldRedactor.fromConfig(config)` — was identical to `new FieldRedactor(config)` and unused in-repo.
19
+
20
+ ## Links
21
+
22
+ - [CHANGELOG](../../CHANGELOG.md)
23
+ - [Release notes v1.6.0](v1.6.0.md)
24
+ - [Migration 1.5 → 1.6](../guides/migration-1.5-to-1.6.md)
@@ -0,0 +1,26 @@
1
+ # Release notes — v1.6.2
2
+
3
+ Field Redactor **1.6.2** folds two internal cleanups onto **1.6.1**: Opaque/Remove as the canonical config and runtime vocabulary, and removal of the thin `ObjectRedactor` orchestrator. Typical `import { … } from 'field-redactor'` consumers need no call-site changes.
4
+
5
+ **Upgrade from 1.6.1:** Install `1.6.2`. Prefer `opaqueSecretKeys` / `removeSecretKeys` and `CustomObjectMatchType.Opaque` / `Remove` in new config; legacy `fullSecretKeys` / `deleteSecretKeys` and `Full` / `Delete` still work.
6
+
7
+ ## Highlights
8
+
9
+ | Area | What changed |
10
+ | --- | --- |
11
+ | **Naming** | Canonical storage and matching use opaque/remove; full/delete are input-only aliases |
12
+ | **SecretManager** | `isOpaqueSecretKey` / `isRemoveSecretKey` (legacy config keys still accepted) |
13
+ | **Builder / presets** | Write preferred field names |
14
+ | **Engine** | `FieldRedactor` → `ObjectRedactorTraversal` directly; builder uses a static import |
15
+
16
+ ## Compatibility
17
+
18
+ - Public root API unchanged for normal usage
19
+ - `FieldRedactorConfigBuilder.buildRedactor()` / `buildSafeRedactor()` behavior unchanged
20
+ - Docs and presets lead with Opaque/Remove vocabulary
21
+
22
+ ## Links
23
+
24
+ - [CHANGELOG](../../CHANGELOG.md)
25
+ - [Release notes v1.6.1](v1.6.1.md)
26
+ - [Migration 1.5 → 1.6](../guides/migration-1.5-to-1.6.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "field-redactor",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "description": "Utility for redacting PII from complex JSON objects for which simpler redaction tools are insufficient.",
5
5
  "author": {
6
6
  "name": "Andrew Molony",