field-redactor 1.5.0 → 1.6.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.
Files changed (233) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/CONTRIBUTING.md +64 -0
  3. package/README.md +3 -0
  4. package/dist/api/fieldRedactor.d.ts +51 -0
  5. package/dist/api/fieldRedactor.d.ts.map +1 -0
  6. package/dist/api/fieldRedactor.js +165 -0
  7. package/dist/api/fieldRedactor.js.map +1 -0
  8. package/dist/api/fieldRedactorConfigBuilder.d.ts +57 -0
  9. package/dist/api/fieldRedactorConfigBuilder.d.ts.map +1 -0
  10. package/dist/api/fieldRedactorConfigBuilder.js +115 -0
  11. package/dist/api/fieldRedactorConfigBuilder.js.map +1 -0
  12. package/dist/api/fieldRedactorDeps.d.ts +19 -0
  13. package/dist/api/fieldRedactorDeps.d.ts.map +1 -0
  14. package/dist/api/fieldRedactorDeps.js +45 -0
  15. package/dist/api/fieldRedactorDeps.js.map +1 -0
  16. package/dist/arrayRedaction.d.ts +12 -0
  17. package/dist/arrayRedaction.d.ts.map +1 -0
  18. package/dist/arrayRedaction.js +70 -0
  19. package/dist/arrayRedaction.js.map +1 -0
  20. package/dist/config/configValidator.d.ts +9 -0
  21. package/dist/config/configValidator.d.ts.map +1 -0
  22. package/dist/config/configValidator.js +77 -0
  23. package/dist/config/configValidator.js.map +1 -0
  24. package/dist/config/customObjectSchemas.d.ts +7 -0
  25. package/dist/config/customObjectSchemas.d.ts.map +1 -0
  26. package/dist/config/customObjectSchemas.js +35 -0
  27. package/dist/config/customObjectSchemas.js.map +1 -0
  28. package/dist/config/presets.d.ts +22 -0
  29. package/dist/config/presets.d.ts.map +1 -0
  30. package/dist/config/presets.js +50 -0
  31. package/dist/config/presets.js.map +1 -0
  32. package/dist/config/redactionRules.d.ts +26 -0
  33. package/dist/config/redactionRules.d.ts.map +1 -0
  34. package/dist/config/redactionRules.js +107 -0
  35. package/dist/config/redactionRules.js.map +1 -0
  36. package/dist/configValidator.d.ts +3 -4
  37. package/dist/configValidator.d.ts.map +1 -1
  38. package/dist/configValidator.js +9 -26
  39. package/dist/configValidator.js.map +1 -1
  40. package/dist/customObjectFieldHandler.d.ts +21 -0
  41. package/dist/customObjectFieldHandler.d.ts.map +1 -0
  42. package/dist/customObjectFieldHandler.js +159 -0
  43. package/dist/customObjectFieldHandler.js.map +1 -0
  44. package/dist/customObjectManager.d.ts +1 -1
  45. package/dist/customObjectManager.js +3 -3
  46. package/dist/customObjectManager.js.map +1 -1
  47. package/dist/customObjectSchemas.d.ts +7 -0
  48. package/dist/customObjectSchemas.d.ts.map +1 -0
  49. package/dist/customObjectSchemas.js +35 -0
  50. package/dist/customObjectSchemas.js.map +1 -0
  51. package/dist/dryRun.d.ts +2 -1
  52. package/dist/dryRun.d.ts.map +1 -1
  53. package/dist/dryRun.js +2 -2
  54. package/dist/dryRun.js.map +1 -1
  55. package/dist/dryRunAttribution.d.ts +5 -3
  56. package/dist/dryRunAttribution.d.ts.map +1 -1
  57. package/dist/dryRunAttribution.js +9 -101
  58. package/dist/dryRunAttribution.js.map +1 -1
  59. package/dist/dryrun/dryRun.d.ts +9 -0
  60. package/dist/dryrun/dryRun.d.ts.map +1 -0
  61. package/dist/dryrun/dryRun.js +75 -0
  62. package/dist/dryrun/dryRun.js.map +1 -0
  63. package/dist/dryrun/dryRunAttribution.d.ts +10 -0
  64. package/dist/dryrun/dryRunAttribution.d.ts.map +1 -0
  65. package/dist/dryrun/dryRunAttribution.js +14 -0
  66. package/dist/dryrun/dryRunAttribution.js.map +1 -0
  67. package/dist/engine/arrayRedaction.d.ts +12 -0
  68. package/dist/engine/arrayRedaction.d.ts.map +1 -0
  69. package/dist/engine/arrayRedaction.js +70 -0
  70. package/dist/engine/arrayRedaction.js.map +1 -0
  71. package/dist/engine/customObjectFieldHandler.d.ts +30 -0
  72. package/dist/engine/customObjectFieldHandler.d.ts.map +1 -0
  73. package/dist/engine/customObjectFieldHandler.js +149 -0
  74. package/dist/engine/customObjectFieldHandler.js.map +1 -0
  75. package/dist/engine/objectRedactor.d.ts +18 -0
  76. package/dist/engine/objectRedactor.d.ts.map +1 -0
  77. package/dist/engine/objectRedactor.js +38 -0
  78. package/dist/engine/objectRedactor.js.map +1 -0
  79. package/dist/engine/objectRedactorCustomObject.d.ts +12 -0
  80. package/dist/engine/objectRedactorCustomObject.d.ts.map +1 -0
  81. package/dist/engine/objectRedactorCustomObject.js +22 -0
  82. package/dist/engine/objectRedactorCustomObject.js.map +1 -0
  83. package/dist/engine/objectRedactorHelpers.d.ts +8 -0
  84. package/dist/engine/objectRedactorHelpers.d.ts.map +1 -0
  85. package/dist/engine/objectRedactorHelpers.js +35 -0
  86. package/dist/engine/objectRedactorHelpers.js.map +1 -0
  87. package/dist/engine/objectRedactorMutation.d.ts +10 -0
  88. package/dist/engine/objectRedactorMutation.d.ts.map +1 -0
  89. package/dist/engine/objectRedactorMutation.js +89 -0
  90. package/dist/engine/objectRedactorMutation.js.map +1 -0
  91. package/dist/engine/objectRedactorSync.d.ts +2 -0
  92. package/dist/engine/objectRedactorSync.d.ts.map +1 -0
  93. package/dist/engine/objectRedactorSync.js +7 -0
  94. package/dist/engine/objectRedactorSync.js.map +1 -0
  95. package/dist/engine/objectRedactorTraversal.d.ts +41 -0
  96. package/dist/engine/objectRedactorTraversal.d.ts.map +1 -0
  97. package/dist/engine/objectRedactorTraversal.js +201 -0
  98. package/dist/engine/objectRedactorTraversal.js.map +1 -0
  99. package/dist/engine/primitiveRedactor.d.ts +33 -0
  100. package/dist/engine/primitiveRedactor.d.ts.map +1 -0
  101. package/dist/engine/primitiveRedactor.js +75 -0
  102. package/dist/engine/primitiveRedactor.js.map +1 -0
  103. package/dist/engine/traversalServices.d.ts +21 -0
  104. package/dist/engine/traversalServices.d.ts.map +1 -0
  105. package/dist/engine/traversalServices.js +3 -0
  106. package/dist/engine/traversalServices.js.map +1 -0
  107. package/dist/fieldDisposition.d.ts +3 -0
  108. package/dist/fieldDisposition.d.ts.map +1 -0
  109. package/dist/fieldDisposition.js +6 -0
  110. package/dist/fieldDisposition.js.map +1 -0
  111. package/dist/fieldRedactor.d.ts +6 -21
  112. package/dist/fieldRedactor.d.ts.map +1 -1
  113. package/dist/fieldRedactor.js +37 -56
  114. package/dist/fieldRedactor.js.map +1 -1
  115. package/dist/fieldRedactorConfigBuilder.d.ts +7 -1
  116. package/dist/fieldRedactorConfigBuilder.d.ts.map +1 -1
  117. package/dist/fieldRedactorConfigBuilder.js +14 -1
  118. package/dist/fieldRedactorConfigBuilder.js.map +1 -1
  119. package/dist/fieldRedactorDeps.d.ts +2 -0
  120. package/dist/fieldRedactorDeps.d.ts.map +1 -1
  121. package/dist/fieldRedactorDeps.js +11 -9
  122. package/dist/fieldRedactorDeps.js.map +1 -1
  123. package/dist/index.d.ts +7 -7
  124. package/dist/index.d.ts.map +1 -1
  125. package/dist/index.js +5 -5
  126. package/dist/index.js.map +1 -1
  127. package/dist/jsonWalk.d.ts +1 -1
  128. package/dist/jsonWalk.d.ts.map +1 -1
  129. package/dist/jsonWalk.js +2 -33
  130. package/dist/jsonWalk.js.map +1 -1
  131. package/dist/maybeAsync.d.ts +7 -0
  132. package/dist/maybeAsync.d.ts.map +1 -0
  133. package/dist/maybeAsync.js +56 -0
  134. package/dist/maybeAsync.js.map +1 -0
  135. package/dist/objectRedactor.d.ts +2 -1
  136. package/dist/objectRedactor.d.ts.map +1 -1
  137. package/dist/objectRedactor.js +2 -2
  138. package/dist/objectRedactor.js.map +1 -1
  139. package/dist/objectRedactorCustomObject.d.ts +19 -40
  140. package/dist/objectRedactorCustomObject.d.ts.map +1 -1
  141. package/dist/objectRedactorCustomObject.js +20 -101
  142. package/dist/objectRedactorCustomObject.js.map +1 -1
  143. package/dist/objectRedactorHelpers.d.ts.map +1 -1
  144. package/dist/objectRedactorHelpers.js +3 -0
  145. package/dist/objectRedactorHelpers.js.map +1 -1
  146. package/dist/objectRedactorTraversal.d.ts +20 -36
  147. package/dist/objectRedactorTraversal.d.ts.map +1 -1
  148. package/dist/objectRedactorTraversal.js +141 -516
  149. package/dist/objectRedactorTraversal.js.map +1 -1
  150. package/dist/pathParsing.d.ts +11 -0
  151. package/dist/pathParsing.d.ts.map +1 -0
  152. package/dist/pathParsing.js +53 -0
  153. package/dist/pathParsing.js.map +1 -0
  154. package/dist/pathRuleMatcher.d.ts +19 -0
  155. package/dist/pathRuleMatcher.d.ts.map +1 -0
  156. package/dist/pathRuleMatcher.js +42 -0
  157. package/dist/pathRuleMatcher.js.map +1 -0
  158. package/dist/redactionRules.d.ts +3 -4
  159. package/dist/redactionRules.d.ts.map +1 -1
  160. package/dist/redactionRules.js +7 -9
  161. package/dist/redactionRules.js.map +1 -1
  162. package/dist/ruleResolver.d.ts +65 -0
  163. package/dist/ruleResolver.d.ts.map +1 -0
  164. package/dist/ruleResolver.js +193 -0
  165. package/dist/ruleResolver.js.map +1 -0
  166. package/dist/rules/customObjectManager.d.ts +28 -0
  167. package/dist/rules/customObjectManager.d.ts.map +1 -0
  168. package/dist/rules/customObjectManager.js +60 -0
  169. package/dist/rules/customObjectManager.js.map +1 -0
  170. package/dist/rules/fieldDisposition.d.ts +3 -0
  171. package/dist/rules/fieldDisposition.d.ts.map +1 -0
  172. package/dist/rules/fieldDisposition.js +6 -0
  173. package/dist/rules/fieldDisposition.js.map +1 -0
  174. package/dist/rules/pathRuleMatcher.d.ts +19 -0
  175. package/dist/rules/pathRuleMatcher.d.ts.map +1 -0
  176. package/dist/rules/pathRuleMatcher.js +40 -0
  177. package/dist/rules/pathRuleMatcher.js.map +1 -0
  178. package/dist/rules/ruleResolver.d.ts +63 -0
  179. package/dist/rules/ruleResolver.d.ts.map +1 -0
  180. package/dist/rules/ruleResolver.js +188 -0
  181. package/dist/rules/ruleResolver.js.map +1 -0
  182. package/dist/rules/schemaSiblingKey.d.ts +4 -0
  183. package/dist/rules/schemaSiblingKey.d.ts.map +1 -0
  184. package/dist/rules/schemaSiblingKey.js +19 -0
  185. package/dist/rules/schemaSiblingKey.js.map +1 -0
  186. package/dist/rules/secretManager.d.ts +31 -0
  187. package/dist/rules/secretManager.d.ts.map +1 -0
  188. package/dist/rules/secretManager.js +85 -0
  189. package/dist/rules/secretManager.js.map +1 -0
  190. package/dist/rules/valuePatternMatcher.d.ts +15 -0
  191. package/dist/rules/valuePatternMatcher.d.ts.map +1 -0
  192. package/dist/rules/valuePatternMatcher.js +30 -0
  193. package/dist/rules/valuePatternMatcher.js.map +1 -0
  194. package/dist/secretManager.d.ts +6 -19
  195. package/dist/secretManager.d.ts.map +1 -1
  196. package/dist/secretManager.js +19 -30
  197. package/dist/secretManager.js.map +1 -1
  198. package/dist/traversalServices.d.ts +21 -0
  199. package/dist/traversalServices.d.ts.map +1 -0
  200. package/dist/traversalServices.js +3 -0
  201. package/dist/traversalServices.js.map +1 -0
  202. package/dist/types.d.ts +41 -5
  203. package/dist/types.d.ts.map +1 -1
  204. package/dist/types.js +8 -1
  205. package/dist/types.js.map +1 -1
  206. package/dist/util/jsonWalk.d.ts +10 -0
  207. package/dist/util/jsonWalk.d.ts.map +1 -0
  208. package/dist/util/jsonWalk.js +53 -0
  209. package/dist/util/jsonWalk.js.map +1 -0
  210. package/dist/util/maybeAsync.d.ts +6 -0
  211. package/dist/util/maybeAsync.d.ts.map +1 -0
  212. package/dist/util/maybeAsync.js +54 -0
  213. package/dist/util/maybeAsync.js.map +1 -0
  214. package/dist/util/pathParsing.d.ts +11 -0
  215. package/dist/util/pathParsing.d.ts.map +1 -0
  216. package/dist/util/pathParsing.js +53 -0
  217. package/dist/util/pathParsing.js.map +1 -0
  218. package/dist/util/primitiveCoercion.d.ts +4 -0
  219. package/dist/util/primitiveCoercion.d.ts.map +1 -0
  220. package/dist/util/primitiveCoercion.js +21 -0
  221. package/dist/util/primitiveCoercion.js.map +1 -0
  222. package/dist/util/regexUtils.d.ts +3 -0
  223. package/dist/util/regexUtils.d.ts.map +1 -0
  224. package/dist/util/regexUtils.js +8 -0
  225. package/dist/util/regexUtils.js.map +1 -0
  226. package/docs/guides/migration-1.5-to-1.6.md +57 -0
  227. package/docs/guides/path-rules.md +47 -0
  228. package/docs/reference/config.md +5 -1
  229. package/docs/release-notes/README.md +4 -1
  230. package/docs/release-notes/v1.6.0.md +59 -0
  231. package/docs/release-notes/v1.6.1.md +24 -0
  232. package/jest.config.js +3 -1
  233. package/package.json +8 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primitiveCoercion.d.ts","sourceRoot":"","sources":["../../src/util/primitiveCoercion.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,SAAS,EACT,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAElB,wBAAgB,cAAc,CAAC,GAAG,EAAE,SAAS,GAAG,SAAS,GAAG,mBAAmB,CAU9E;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,GAAG,mBAAmB,CAM3F"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getStringValue = getStringValue;
4
+ exports.toRedactablePrimitive = toRedactablePrimitive;
5
+ const types_1 = require("../types");
6
+ function getStringValue(val) {
7
+ if ((0, types_1.isJsonObject)(val) || Array.isArray(val)) {
8
+ return JSON.stringify(val);
9
+ }
10
+ if (val instanceof Date || typeof val === 'function') {
11
+ return val.toString();
12
+ }
13
+ return val;
14
+ }
15
+ function toRedactablePrimitive(value) {
16
+ if (value instanceof Date || typeof value === 'function') {
17
+ return getStringValue(value);
18
+ }
19
+ return value;
20
+ }
21
+ //# sourceMappingURL=primitiveCoercion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primitiveCoercion.js","sourceRoot":"","sources":["../../src/util/primitiveCoercion.ts"],"names":[],"mappings":";;AAOA,wCAUC;AAED,sDAMC;AAzBD,oCAKkB;AAElB,SAAgB,cAAc,CAAC,GAA0B;IACvD,IAAI,IAAA,oBAAY,EAAC,GAAG,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,IAAI,GAAG,YAAY,IAAI,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;QACrD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAgB,qBAAqB,CAAC,KAAgC;IACpE,IAAI,KAAK,YAAY,IAAI,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;QACzD,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const formatRegExp: (regex: RegExp) => string;
2
+ export declare const regexIdentity: (regex: RegExp) => string;
3
+ //# sourceMappingURL=regexUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regexUtils.d.ts","sourceRoot":"","sources":["../../src/util/regexUtils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,UAAW,MAAM,KAAG,MAA2C,CAAC;AAEzF,eAAO,MAAM,aAAa,UAAW,MAAM,KAAG,MAA2C,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.regexIdentity = exports.formatRegExp = void 0;
4
+ const formatRegExp = (regex) => `/${regex.source}/${regex.flags}`;
5
+ exports.formatRegExp = formatRegExp;
6
+ const regexIdentity = (regex) => `${regex.source}\0${regex.flags}`;
7
+ exports.regexIdentity = regexIdentity;
8
+ //# sourceMappingURL=regexUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regexUtils.js","sourceRoot":"","sources":["../../src/util/regexUtils.ts"],"names":[],"mappings":";;;AAAO,MAAM,YAAY,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;AAA5E,QAAA,YAAY,gBAAgE;AAElF,MAAM,aAAa,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,KAAK,EAAE,CAAC;AAA7E,QAAA,aAAa,iBAAgE"}
@@ -0,0 +1,57 @@
1
+ # Migration: npm 1.5.x → 1.6.x
2
+
3
+ **1.6.0** is a minor release: new features and aliases with no required config changes for typical upgrades from **1.5.0**. **1.6.1** is an internal cleanup patch (install only; see [v1.6.1 release notes](../release-notes/v1.6.1.md)).
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install field-redactor@1.6.1
9
+ # or
10
+ yarn add field-redactor@1.6.1
11
+ ```
12
+
13
+ ## What you can adopt (optional)
14
+
15
+ ### Path rules and pass keys
16
+
17
+ ```typescript
18
+ FieldRedactor.createSafe({
19
+ pathRules: [{ path: 'metadata.*.value', mode: 'shallow' }],
20
+ passKeys: [/^id$/]
21
+ });
22
+ ```
23
+
24
+ See [Path rules & allowlists](path-rules.md).
25
+
26
+ ### Preferred Opaque / Remove names
27
+
28
+ | Prefer | Legacy (still works) |
29
+ | --- | --- |
30
+ | `opaqueSecretKeys` | `fullSecretKeys` |
31
+ | `removeSecretKeys` | `deleteSecretKeys` |
32
+ | `CustomObjectMatchType.Opaque` | `CustomObjectMatchType.Full` |
33
+ | `CustomObjectMatchType.Remove` | `CustomObjectMatchType.Delete` |
34
+
35
+ Builder methods `.opaque()` / `.remove()` were already the preferred labels in 1.5.0.
36
+
37
+ ## Behavior-sensitive notes
38
+
39
+ ### Package `exports`
40
+
41
+ Only the package root is exported. If you imported internal files (for example `field-redactor/dist/objectRedactor`), switch to the public API from `field-redactor`.
42
+
43
+ ### Deep imports of moved modules
44
+
45
+ Source files were reorganized under `api/`, `engine/`, `rules/`, etc. That affects only consumers who imported unpublished internal paths—not `import { FieldRedactor } from 'field-redactor'`.
46
+
47
+ ## No action required
48
+
49
+ - Existing `secretKeys` / `deepSecretKeys` / `fullSecretKeys` / `deleteSecretKeys` configs
50
+ - `createSafe()`, builder, presets, `dryRun` / `dryRunSync`
51
+ - Copy-on-write and sync APIs from 1.5.0
52
+
53
+ ## Links
54
+
55
+ - [Release notes v1.6.1](../release-notes/v1.6.1.md)
56
+ - [Release notes v1.6.0](../release-notes/v1.6.0.md)
57
+ - [CHANGELOG](../../CHANGELOG.md)
@@ -0,0 +1,47 @@
1
+ # Path rules and allowlists
2
+
3
+ Use **path rules** when sensitivity lives at a stable JSON location rather than a reusable key name. Use **passKeys** (or a `pass` path rule) to keep specific fields visible inside a deep-redacted subtree.
4
+
5
+ ## Path rules
6
+
7
+ Path patterns use `.` between object keys, `[index]` for array positions, and `*` as a single-segment wildcard.
8
+
9
+ ```typescript
10
+ import { FieldRedactorConfigBuilder } from 'field-redactor';
11
+
12
+ const redactor = FieldRedactorConfigBuilder.create()
13
+ .pathRule('metadata.*.value', 'shallow')
14
+ .pathRule('session.token', 'remove')
15
+ .buildSafeRedactor();
16
+ ```
17
+
18
+ | Mode | Effect at matched path |
19
+ | --- | --- |
20
+ | `shallow` | Redact scalar values (or recurse into objects/arrays) |
21
+ | `deep` | Redact all descendant primitives |
22
+ | `opaque` | Stringify and redact the value |
23
+ | `remove` | Delete the field |
24
+ | `pass` | Leave the field and subtree unchanged |
25
+
26
+ Path rules take precedence over key-regex rules but not over schema (`customObjects`) matches.
27
+
28
+ ## Allowlist keys (`passKeys`)
29
+
30
+ When a parent is deep-redacted, matching key names are preserved:
31
+
32
+ ```typescript
33
+ FieldRedactor.createSafe({
34
+ deepSecretKeys: [/accountInfo/],
35
+ passKeys: [/^id$/, /^externalId$/]
36
+ });
37
+ ```
38
+
39
+ Equivalent path-rule form for a single field:
40
+
41
+ ```typescript
42
+ .pathRule('accountInfo.id', 'pass')
43
+ ```
44
+
45
+ ## dryRun attribution
46
+
47
+ `report.pathRules` includes path-based matches with `pattern` set to the configured path expression (for example `metadata.*.value`).
@@ -12,6 +12,8 @@
12
12
  | **Remove** | `deleteSecretKeys` | `RegExp[]` | `[]` | Delete matching keys |
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
+ | **Path rule** | `pathRules` | `PathRule[]` | `[]` | Apply a mode at a JSON path (`metadata.*.value`) |
16
+ | **Allowlist** | `passKeys` | `RegExp[]` | `[]` | Never redact matching key names under deep parents |
15
17
  | — | `schemaNames` | `string[]` | — | Optional labels parallel to `customObjects` for `dryRun` reports |
16
18
  | — | `ignoreBooleans` | `boolean` | `false` | Skip boolean redaction when `true` |
17
19
  | — | `ignoreNullOrUndefined` | `boolean` | `true` | Skip null/undefined redaction when `true` |
@@ -54,7 +56,9 @@ const redactor = FieldRedactorConfigBuilder.create()
54
56
  .buildSafeRedactor();
55
57
  ```
56
58
 
57
- Methods: `shallow`, `deep`, `opaque`, `remove` / `delete`, `schema`, `valuePattern`, `usePreset`, `redactor`, `syncRedactor`, `ignoreBooleans`, `ignoreNullOrUndefined`, `cloneInput`, `strict`, `onConfigWarning`, `build`, `buildRedactor`, `buildSafeRedactor`.
59
+ Methods: `shallow`, `deep`, `opaque`, `remove` / `delete`, `schema`, `valuePattern`, `pathRule`, `passKey`, `usePreset`, `redactor`, `syncRedactor`, `ignoreBooleans`, `ignoreNullOrUndefined`, `cloneInput`, `strict`, `onConfigWarning`, `build`, `buildRedactor`, `buildSafeRedactor`.
60
+
61
+ **Precedence:** Schema → path rule → opaque → deep → remove → shallow → value-pattern → default.
58
62
 
59
63
  ## Configuration validation
60
64
 
@@ -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.1** | Yes | [v1.6.1.md](v1.6.1.md) — internal simplification / layering cleanup |
8
+ | **v1.6.0** | Yes | [v1.6.0.md](v1.6.0.md) — path rules, passKeys, naming aliases, architecture |
7
9
  | **v1.5.0** | Yes | [v1.5.0.md](v1.5.0.md) — DX polish, value patterns, unified traversal |
8
10
  | v1.3.0 | No (superseded by 1.5.0) | [v1.3.0.md](v1.3.0.md) — sync API, COW, builder, dryRun, presets |
9
11
  | v1.2.2 | No | [v1.2.2.md](v1.2.2.md) |
@@ -14,7 +16,8 @@ Per-version release notes for published **field-redactor** git tags. npm release
14
16
 
15
17
  ## Migration
16
18
 
17
- - [1.2.x → 1.5.0](../guides/migration-1.2-to-1.5.md) — recommended upgrade path from the previous npm line.
19
+ - [1.5.x → 1.6.x](../guides/migration-1.5-to-1.6.md) — path rules, naming aliases, package exports
20
+ - [1.2.x → 1.5.0](../guides/migration-1.2-to-1.5.md) — upgrade path from the previous npm line
18
21
 
19
22
  ## Internal milestones (removed)
20
23
 
@@ -0,0 +1,59 @@
1
+ # Release notes — v1.6.0
2
+
3
+ Field Redactor **1.6.0** adds path-based rules and pass-key allowlists, preferred Opaque/Remove naming aliases, and a large internal architecture cleanup. The public root API remains backward compatible with **1.5.0**.
4
+
5
+ **Upgrade from 1.5.0:** Additive for normal `import { … } from 'field-redactor'` consumers. See [Migration: 1.5 → 1.6](../guides/migration-1.5-to-1.6.md) if you deep-imported `dist/` paths or want the new vocabulary.
6
+
7
+ ## Highlights
8
+
9
+ | Area | What’s new |
10
+ | --- | --- |
11
+ | **Path rules** | `pathRules` / `.pathRule()` — redact by JSON path (`metadata.*.value`) with modes shallow, deep, opaque, remove, pass |
12
+ | **Pass keys** | `passKeys` / `.passKey()` — exempt key names under deep parents |
13
+ | **Naming** | Preferred `opaqueSecretKeys` / `removeSecretKeys` and `CustomObjectMatchType.Opaque` / `Remove` (legacy names still work) |
14
+ | **Architecture** | Shared `RuleResolver`, layered `src/` packages, unified MaybeAsync traversal |
15
+
16
+ ## Path rules and pass keys
17
+
18
+ ```typescript
19
+ import { FieldRedactorConfigBuilder } from 'field-redactor';
20
+
21
+ const redactor = FieldRedactorConfigBuilder.create()
22
+ .pathRule('metadata.*.value', 'shallow')
23
+ .pathRule('session.token', 'remove')
24
+ .deep(/accountInfo/)
25
+ .passKey(/^id$/, /^profile$/)
26
+ .buildSafeRedactor();
27
+ ```
28
+
29
+ **Precedence:** schema → path rule → opaque/deep/remove/shallow key rules → value pattern → default.
30
+
31
+ ## Naming aliases
32
+
33
+ ```typescript
34
+ // Preferred
35
+ { opaqueSecretKeys: [/payload/], removeSecretKeys: [/authKey/] }
36
+
37
+ // Still supported
38
+ { fullSecretKeys: [/payload/], deleteSecretKeys: [/authKey/] }
39
+
40
+ CustomObjectMatchType.Opaque; // same value as Full
41
+ CustomObjectMatchType.Remove; // same value as Delete
42
+ ```
43
+
44
+ ## Package boundary
45
+
46
+ `package.json` `"exports"` now exposes only the package root (`.`). Deep imports such as `field-redactor/dist/...` are unsupported.
47
+
48
+ ## Internal (no intended API change)
49
+
50
+ - `RuleResolver` is the single source of truth for traversal and dry-run attribution
51
+ - Source layout: `api/`, `engine/`, `rules/`, `dryrun/`, `config/`, `util/`
52
+ - Removed internal `ObjectRedactorSyncTraversal` alias (never part of the public export surface)
53
+ - Contributor guide: [CONTRIBUTING.md](../../CONTRIBUTING.md)
54
+
55
+ ## Links
56
+
57
+ - [CHANGELOG](../../CHANGELOG.md)
58
+ - [Path rules guide](../guides/path-rules.md)
59
+ - [Migration 1.5 → 1.6](../guides/migration-1.5-to-1.6.md)
@@ -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)
package/jest.config.js CHANGED
@@ -8,7 +8,9 @@ module.exports = {
8
8
  coverageDirectory: './tmp/jest-coverage',
9
9
  coveragePathIgnorePatterns: [
10
10
  './node_modules/',
11
- './tests/mocks/'
11
+ './tests/mocks/',
12
+ './tests/helpers/',
13
+ './tests/integration/fixtures/'
12
14
  ],
13
15
  collectCoverage: true,
14
16
  coverageThreshold: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "field-redactor",
3
- "version": "1.5.0",
3
+ "version": "1.6.1",
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",
@@ -47,5 +47,11 @@
47
47
  "trailingComma": "none",
48
48
  "printWidth": 120
49
49
  },
50
- "prepublishOnly": "yarn build"
50
+ "prepublishOnly": "yarn build",
51
+ "exports": {
52
+ ".": {
53
+ "types": "./dist/index.d.ts",
54
+ "default": "./dist/index.js"
55
+ }
56
+ }
51
57
  }