field-redactor 1.5.0 → 1.6.0
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/CHANGELOG.md +23 -0
- package/CONTRIBUTING.md +64 -0
- package/README.md +3 -0
- package/dist/api/fieldRedactor.d.ts +53 -0
- package/dist/api/fieldRedactor.d.ts.map +1 -0
- package/dist/api/fieldRedactor.js +169 -0
- package/dist/api/fieldRedactor.js.map +1 -0
- package/dist/api/fieldRedactorConfigBuilder.d.ts +57 -0
- package/dist/api/fieldRedactorConfigBuilder.d.ts.map +1 -0
- package/dist/api/fieldRedactorConfigBuilder.js +115 -0
- package/dist/api/fieldRedactorConfigBuilder.js.map +1 -0
- package/dist/api/fieldRedactorDeps.d.ts +19 -0
- package/dist/api/fieldRedactorDeps.d.ts.map +1 -0
- package/dist/api/fieldRedactorDeps.js +45 -0
- package/dist/api/fieldRedactorDeps.js.map +1 -0
- package/dist/arrayRedaction.d.ts +12 -0
- package/dist/arrayRedaction.d.ts.map +1 -0
- package/dist/arrayRedaction.js +70 -0
- package/dist/arrayRedaction.js.map +1 -0
- package/dist/config/configValidator.d.ts +9 -0
- package/dist/config/configValidator.d.ts.map +1 -0
- package/dist/config/configValidator.js +77 -0
- package/dist/config/configValidator.js.map +1 -0
- package/dist/config/customObjectSchemas.d.ts +7 -0
- package/dist/config/customObjectSchemas.d.ts.map +1 -0
- package/dist/config/customObjectSchemas.js +35 -0
- package/dist/config/customObjectSchemas.js.map +1 -0
- package/dist/config/presets.d.ts +22 -0
- package/dist/config/presets.d.ts.map +1 -0
- package/dist/config/presets.js +50 -0
- package/dist/config/presets.js.map +1 -0
- package/dist/config/redactionRules.d.ts +25 -0
- package/dist/config/redactionRules.d.ts.map +1 -0
- package/dist/config/redactionRules.js +108 -0
- package/dist/config/redactionRules.js.map +1 -0
- package/dist/configValidator.d.ts +3 -4
- package/dist/configValidator.d.ts.map +1 -1
- package/dist/configValidator.js +9 -26
- package/dist/configValidator.js.map +1 -1
- package/dist/customObjectFieldHandler.d.ts +21 -0
- package/dist/customObjectFieldHandler.d.ts.map +1 -0
- package/dist/customObjectFieldHandler.js +159 -0
- package/dist/customObjectFieldHandler.js.map +1 -0
- package/dist/customObjectManager.d.ts +1 -1
- package/dist/customObjectManager.js +3 -3
- package/dist/customObjectManager.js.map +1 -1
- package/dist/customObjectSchemas.d.ts +7 -0
- package/dist/customObjectSchemas.d.ts.map +1 -0
- package/dist/customObjectSchemas.js +35 -0
- package/dist/customObjectSchemas.js.map +1 -0
- package/dist/dryRun.d.ts +2 -1
- package/dist/dryRun.d.ts.map +1 -1
- package/dist/dryRun.js +2 -2
- package/dist/dryRun.js.map +1 -1
- package/dist/dryRunAttribution.d.ts +5 -3
- package/dist/dryRunAttribution.d.ts.map +1 -1
- package/dist/dryRunAttribution.js +9 -101
- package/dist/dryRunAttribution.js.map +1 -1
- package/dist/dryrun/dryRun.d.ts +9 -0
- package/dist/dryrun/dryRun.d.ts.map +1 -0
- package/dist/dryrun/dryRun.js +75 -0
- package/dist/dryrun/dryRun.js.map +1 -0
- package/dist/dryrun/dryRunAttribution.d.ts +10 -0
- package/dist/dryrun/dryRunAttribution.d.ts.map +1 -0
- package/dist/dryrun/dryRunAttribution.js +14 -0
- package/dist/dryrun/dryRunAttribution.js.map +1 -0
- package/dist/engine/arrayRedaction.d.ts +12 -0
- package/dist/engine/arrayRedaction.d.ts.map +1 -0
- package/dist/engine/arrayRedaction.js +70 -0
- package/dist/engine/arrayRedaction.js.map +1 -0
- package/dist/engine/customObjectFieldHandler.d.ts +35 -0
- package/dist/engine/customObjectFieldHandler.d.ts.map +1 -0
- package/dist/engine/customObjectFieldHandler.js +167 -0
- package/dist/engine/customObjectFieldHandler.js.map +1 -0
- package/dist/engine/objectRedactor.d.ts +18 -0
- package/dist/engine/objectRedactor.d.ts.map +1 -0
- package/dist/engine/objectRedactor.js +38 -0
- package/dist/engine/objectRedactor.js.map +1 -0
- package/dist/engine/objectRedactorCustomObject.d.ts +27 -0
- package/dist/engine/objectRedactorCustomObject.d.ts.map +1 -0
- package/dist/engine/objectRedactorCustomObject.js +54 -0
- package/dist/engine/objectRedactorCustomObject.js.map +1 -0
- package/dist/engine/objectRedactorHelpers.d.ts +9 -0
- package/dist/engine/objectRedactorHelpers.d.ts.map +1 -0
- package/dist/engine/objectRedactorHelpers.js +61 -0
- package/dist/engine/objectRedactorHelpers.js.map +1 -0
- package/dist/engine/objectRedactorMutation.d.ts +10 -0
- package/dist/engine/objectRedactorMutation.d.ts.map +1 -0
- package/dist/engine/objectRedactorMutation.js +89 -0
- package/dist/engine/objectRedactorMutation.js.map +1 -0
- package/dist/engine/objectRedactorSync.d.ts +2 -0
- package/dist/engine/objectRedactorSync.d.ts.map +1 -0
- package/dist/engine/objectRedactorSync.js +7 -0
- package/dist/engine/objectRedactorSync.js.map +1 -0
- package/dist/engine/objectRedactorTraversal.d.ts +41 -0
- package/dist/engine/objectRedactorTraversal.d.ts.map +1 -0
- package/dist/engine/objectRedactorTraversal.js +201 -0
- package/dist/engine/objectRedactorTraversal.js.map +1 -0
- package/dist/engine/primitiveRedactor.d.ts +33 -0
- package/dist/engine/primitiveRedactor.d.ts.map +1 -0
- package/dist/engine/primitiveRedactor.js +75 -0
- package/dist/engine/primitiveRedactor.js.map +1 -0
- package/dist/engine/traversalServices.d.ts +21 -0
- package/dist/engine/traversalServices.d.ts.map +1 -0
- package/dist/engine/traversalServices.js +3 -0
- package/dist/engine/traversalServices.js.map +1 -0
- package/dist/fieldDisposition.d.ts +3 -0
- package/dist/fieldDisposition.d.ts.map +1 -0
- package/dist/fieldDisposition.js +6 -0
- package/dist/fieldDisposition.js.map +1 -0
- package/dist/fieldRedactor.d.ts +6 -21
- package/dist/fieldRedactor.d.ts.map +1 -1
- package/dist/fieldRedactor.js +37 -56
- package/dist/fieldRedactor.js.map +1 -1
- package/dist/fieldRedactorConfigBuilder.d.ts +7 -1
- package/dist/fieldRedactorConfigBuilder.d.ts.map +1 -1
- package/dist/fieldRedactorConfigBuilder.js +14 -1
- package/dist/fieldRedactorConfigBuilder.js.map +1 -1
- package/dist/fieldRedactorDeps.d.ts +2 -0
- package/dist/fieldRedactorDeps.d.ts.map +1 -1
- package/dist/fieldRedactorDeps.js +11 -9
- package/dist/fieldRedactorDeps.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/jsonWalk.d.ts +1 -1
- package/dist/jsonWalk.d.ts.map +1 -1
- package/dist/jsonWalk.js +2 -33
- package/dist/jsonWalk.js.map +1 -1
- package/dist/maybeAsync.d.ts +7 -0
- package/dist/maybeAsync.d.ts.map +1 -0
- package/dist/maybeAsync.js +56 -0
- package/dist/maybeAsync.js.map +1 -0
- package/dist/objectRedactor.d.ts +2 -1
- package/dist/objectRedactor.d.ts.map +1 -1
- package/dist/objectRedactor.js +2 -2
- package/dist/objectRedactor.js.map +1 -1
- package/dist/objectRedactorCustomObject.d.ts +19 -40
- package/dist/objectRedactorCustomObject.d.ts.map +1 -1
- package/dist/objectRedactorCustomObject.js +20 -101
- package/dist/objectRedactorCustomObject.js.map +1 -1
- package/dist/objectRedactorHelpers.d.ts.map +1 -1
- package/dist/objectRedactorHelpers.js +3 -0
- package/dist/objectRedactorHelpers.js.map +1 -1
- package/dist/objectRedactorTraversal.d.ts +20 -36
- package/dist/objectRedactorTraversal.d.ts.map +1 -1
- package/dist/objectRedactorTraversal.js +141 -516
- package/dist/objectRedactorTraversal.js.map +1 -1
- package/dist/pathParsing.d.ts +11 -0
- package/dist/pathParsing.d.ts.map +1 -0
- package/dist/pathParsing.js +53 -0
- package/dist/pathParsing.js.map +1 -0
- package/dist/pathRuleMatcher.d.ts +19 -0
- package/dist/pathRuleMatcher.d.ts.map +1 -0
- package/dist/pathRuleMatcher.js +42 -0
- package/dist/pathRuleMatcher.js.map +1 -0
- package/dist/redactionRules.d.ts +3 -4
- package/dist/redactionRules.d.ts.map +1 -1
- package/dist/redactionRules.js +7 -9
- package/dist/redactionRules.js.map +1 -1
- package/dist/ruleResolver.d.ts +65 -0
- package/dist/ruleResolver.d.ts.map +1 -0
- package/dist/ruleResolver.js +193 -0
- package/dist/ruleResolver.js.map +1 -0
- package/dist/rules/customObjectManager.d.ts +28 -0
- package/dist/rules/customObjectManager.d.ts.map +1 -0
- package/dist/rules/customObjectManager.js +60 -0
- package/dist/rules/customObjectManager.js.map +1 -0
- package/dist/rules/fieldDisposition.d.ts +3 -0
- package/dist/rules/fieldDisposition.d.ts.map +1 -0
- package/dist/rules/fieldDisposition.js +6 -0
- package/dist/rules/fieldDisposition.js.map +1 -0
- package/dist/rules/pathRuleMatcher.d.ts +19 -0
- package/dist/rules/pathRuleMatcher.d.ts.map +1 -0
- package/dist/rules/pathRuleMatcher.js +40 -0
- package/dist/rules/pathRuleMatcher.js.map +1 -0
- package/dist/rules/ruleResolver.d.ts +65 -0
- package/dist/rules/ruleResolver.d.ts.map +1 -0
- package/dist/rules/ruleResolver.js +194 -0
- package/dist/rules/ruleResolver.js.map +1 -0
- package/dist/rules/secretManager.d.ts +32 -0
- package/dist/rules/secretManager.d.ts.map +1 -0
- package/dist/rules/secretManager.js +85 -0
- package/dist/rules/secretManager.js.map +1 -0
- package/dist/rules/valuePatternMatcher.d.ts +15 -0
- package/dist/rules/valuePatternMatcher.d.ts.map +1 -0
- package/dist/rules/valuePatternMatcher.js +30 -0
- package/dist/rules/valuePatternMatcher.js.map +1 -0
- package/dist/secretManager.d.ts +6 -19
- package/dist/secretManager.d.ts.map +1 -1
- package/dist/secretManager.js +19 -30
- package/dist/secretManager.js.map +1 -1
- package/dist/traversalServices.d.ts +21 -0
- package/dist/traversalServices.d.ts.map +1 -0
- package/dist/traversalServices.js +3 -0
- package/dist/traversalServices.js.map +1 -0
- package/dist/types.d.ts +41 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +8 -1
- package/dist/types.js.map +1 -1
- package/dist/util/jsonWalk.d.ts +10 -0
- package/dist/util/jsonWalk.d.ts.map +1 -0
- package/dist/util/jsonWalk.js +53 -0
- package/dist/util/jsonWalk.js.map +1 -0
- package/dist/util/maybeAsync.d.ts +7 -0
- package/dist/util/maybeAsync.d.ts.map +1 -0
- package/dist/util/maybeAsync.js +56 -0
- package/dist/util/maybeAsync.js.map +1 -0
- package/dist/util/pathParsing.d.ts +11 -0
- package/dist/util/pathParsing.d.ts.map +1 -0
- package/dist/util/pathParsing.js +53 -0
- package/dist/util/pathParsing.js.map +1 -0
- package/dist/util/regexUtils.d.ts +3 -0
- package/dist/util/regexUtils.d.ts.map +1 -0
- package/dist/util/regexUtils.js +8 -0
- package/dist/util/regexUtils.js.map +1 -0
- package/docs/guides/migration-1.5-to-1.6.md +56 -0
- package/docs/guides/path-rules.md +47 -0
- package/docs/reference/config.md +5 -1
- package/docs/release-notes/README.md +3 -1
- package/docs/release-notes/v1.6.0.md +59 -0
- package/jest.config.js +3 -1
- package/package.json +8 -2
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Migration: npm 1.5.x → 1.6.0
|
|
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**.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install field-redactor@1.6.0
|
|
9
|
+
# or
|
|
10
|
+
yarn add field-redactor@1.6.0
|
|
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.0](../release-notes/v1.6.0.md)
|
|
56
|
+
- [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`).
|
package/docs/reference/config.md
CHANGED
|
@@ -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,7 @@ Per-version release notes for published **field-redactor** git tags. npm release
|
|
|
4
4
|
|
|
5
5
|
| Version | npm | Notes |
|
|
6
6
|
| --- | --- | --- |
|
|
7
|
+
| **v1.6.0** | Yes | [v1.6.0.md](v1.6.0.md) — path rules, passKeys, naming aliases, architecture |
|
|
7
8
|
| **v1.5.0** | Yes | [v1.5.0.md](v1.5.0.md) — DX polish, value patterns, unified traversal |
|
|
8
9
|
| v1.3.0 | No (superseded by 1.5.0) | [v1.3.0.md](v1.3.0.md) — sync API, COW, builder, dryRun, presets |
|
|
9
10
|
| v1.2.2 | No | [v1.2.2.md](v1.2.2.md) |
|
|
@@ -14,7 +15,8 @@ Per-version release notes for published **field-redactor** git tags. npm release
|
|
|
14
15
|
|
|
15
16
|
## Migration
|
|
16
17
|
|
|
17
|
-
- [1.
|
|
18
|
+
- [1.5.x → 1.6.0](../guides/migration-1.5-to-1.6.md) — path rules, naming aliases, package exports
|
|
19
|
+
- [1.2.x → 1.5.0](../guides/migration-1.2-to-1.5.md) — upgrade path from the previous npm line
|
|
18
20
|
|
|
19
21
|
## Internal milestones (removed)
|
|
20
22
|
|
|
@@ -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)
|
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.
|
|
3
|
+
"version": "1.6.0",
|
|
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
|
}
|