@stll/anonymize 2.2.0 → 2.3.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/dist/capabilities.d.mts +139 -4
- package/dist/capabilities.mjs +88 -3
- package/dist/capabilities.mjs.map +1 -1
- package/dist/constants.mjs +6 -1
- package/dist/constants.mjs.map +1 -1
- package/dist/constants2.d.mts +5 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/native.d.mts +17 -0
- package/dist/native.mjs.map +1 -1
- package/native-pipeline.cs.stlanonpkg +0 -0
- package/native-pipeline.de.stlanonpkg +0 -0
- package/native-pipeline.en.stlanonpkg +0 -0
- package/native-pipeline.stlanonpkg +0 -0
- package/package.json +6 -6
package/dist/capabilities.d.mts
CHANGED
|
@@ -1,11 +1,79 @@
|
|
|
1
1
|
import { o as ENTITY_CAPABILITIES } from "./constants2.mjs";
|
|
2
2
|
//#region src/capabilities.d.ts
|
|
3
|
-
declare const CAPABILITY_MANIFEST_SCHEMA_VERSION:
|
|
3
|
+
declare const CAPABILITY_MANIFEST_SCHEMA_VERSION: 2;
|
|
4
4
|
declare const CAPABILITY_RUNTIMES: readonly ["node", "python", "wasm"];
|
|
5
5
|
type CapabilityRuntime = (typeof CAPABILITY_RUNTIMES)[number];
|
|
6
|
+
declare const CAPABILITY_PARITY_PROFILES: {
|
|
7
|
+
readonly core: readonly ["node", "python", "wasm"];
|
|
8
|
+
readonly local: readonly ["node", "python"];
|
|
9
|
+
readonly document: readonly ["node", "python"];
|
|
10
|
+
};
|
|
11
|
+
type CapabilityParityProfile = keyof typeof CAPABILITY_PARITY_PROFILES;
|
|
12
|
+
declare const CAPABILITY_SURFACES: readonly [{
|
|
13
|
+
readonly id: "package.prepare";
|
|
14
|
+
readonly profile: "core";
|
|
15
|
+
}, {
|
|
16
|
+
readonly id: "package.load";
|
|
17
|
+
readonly profile: "core";
|
|
18
|
+
}, {
|
|
19
|
+
readonly id: "package.load-file";
|
|
20
|
+
readonly profile: "local";
|
|
21
|
+
}, {
|
|
22
|
+
readonly id: "text.normalize";
|
|
23
|
+
readonly profile: "core";
|
|
24
|
+
}, {
|
|
25
|
+
readonly id: "text.redact";
|
|
26
|
+
readonly profile: "core";
|
|
27
|
+
}, {
|
|
28
|
+
readonly id: "text.redact-stream";
|
|
29
|
+
readonly profile: "core";
|
|
30
|
+
}, {
|
|
31
|
+
readonly id: "text.diagnostics";
|
|
32
|
+
readonly profile: "core";
|
|
33
|
+
}, {
|
|
34
|
+
readonly id: "text.summary-diagnostics";
|
|
35
|
+
readonly profile: "core";
|
|
36
|
+
}, {
|
|
37
|
+
readonly id: "text.caller-detections";
|
|
38
|
+
readonly profile: "core";
|
|
39
|
+
}, {
|
|
40
|
+
readonly id: "text.operators";
|
|
41
|
+
readonly profile: "core";
|
|
42
|
+
}, {
|
|
43
|
+
readonly id: "package.default";
|
|
44
|
+
readonly profile: "core";
|
|
45
|
+
}, {
|
|
46
|
+
readonly id: "session.cross-document";
|
|
47
|
+
readonly profile: "core";
|
|
48
|
+
}, {
|
|
49
|
+
readonly id: "session.lifecycle";
|
|
50
|
+
readonly profile: "core";
|
|
51
|
+
}, {
|
|
52
|
+
readonly id: "session.plaintext-transfer";
|
|
53
|
+
readonly profile: "core";
|
|
54
|
+
}, {
|
|
55
|
+
readonly id: "session.encrypted-archive";
|
|
56
|
+
readonly profile: "core";
|
|
57
|
+
}, {
|
|
58
|
+
readonly id: "document.docx.extract";
|
|
59
|
+
readonly profile: "document";
|
|
60
|
+
}, {
|
|
61
|
+
readonly id: "document.docx.rewrite";
|
|
62
|
+
readonly profile: "document";
|
|
63
|
+
}, {
|
|
64
|
+
readonly id: "document.docx.anonymize";
|
|
65
|
+
readonly profile: "document";
|
|
66
|
+
}, {
|
|
67
|
+
readonly id: "document.docx.restore";
|
|
68
|
+
readonly profile: "document";
|
|
69
|
+
}];
|
|
70
|
+
type CapabilitySurface = (typeof CAPABILITY_SURFACES)[number];
|
|
71
|
+
type CapabilitySurfaceId = CapabilitySurface["id"];
|
|
6
72
|
type CapabilityManifest = {
|
|
7
73
|
schemaVersion: typeof CAPABILITY_MANIFEST_SCHEMA_VERSION;
|
|
8
74
|
runtimes: readonly CapabilityRuntime[];
|
|
75
|
+
parityProfiles: typeof CAPABILITY_PARITY_PROFILES;
|
|
76
|
+
surfaces: typeof CAPABILITY_SURFACES;
|
|
9
77
|
entities: typeof ENTITY_CAPABILITIES;
|
|
10
78
|
};
|
|
11
79
|
/**
|
|
@@ -14,8 +82,71 @@ type CapabilityManifest = {
|
|
|
14
82
|
* activation, provenance sources, and runtime parity only.
|
|
15
83
|
*/
|
|
16
84
|
declare const CAPABILITY_MANIFEST: {
|
|
17
|
-
readonly schemaVersion:
|
|
85
|
+
readonly schemaVersion: 2;
|
|
18
86
|
readonly runtimes: readonly ["node", "python", "wasm"];
|
|
87
|
+
readonly parityProfiles: {
|
|
88
|
+
readonly core: readonly ["node", "python", "wasm"];
|
|
89
|
+
readonly local: readonly ["node", "python"];
|
|
90
|
+
readonly document: readonly ["node", "python"];
|
|
91
|
+
};
|
|
92
|
+
readonly surfaces: readonly [{
|
|
93
|
+
readonly id: "package.prepare";
|
|
94
|
+
readonly profile: "core";
|
|
95
|
+
}, {
|
|
96
|
+
readonly id: "package.load";
|
|
97
|
+
readonly profile: "core";
|
|
98
|
+
}, {
|
|
99
|
+
readonly id: "package.load-file";
|
|
100
|
+
readonly profile: "local";
|
|
101
|
+
}, {
|
|
102
|
+
readonly id: "text.normalize";
|
|
103
|
+
readonly profile: "core";
|
|
104
|
+
}, {
|
|
105
|
+
readonly id: "text.redact";
|
|
106
|
+
readonly profile: "core";
|
|
107
|
+
}, {
|
|
108
|
+
readonly id: "text.redact-stream";
|
|
109
|
+
readonly profile: "core";
|
|
110
|
+
}, {
|
|
111
|
+
readonly id: "text.diagnostics";
|
|
112
|
+
readonly profile: "core";
|
|
113
|
+
}, {
|
|
114
|
+
readonly id: "text.summary-diagnostics";
|
|
115
|
+
readonly profile: "core";
|
|
116
|
+
}, {
|
|
117
|
+
readonly id: "text.caller-detections";
|
|
118
|
+
readonly profile: "core";
|
|
119
|
+
}, {
|
|
120
|
+
readonly id: "text.operators";
|
|
121
|
+
readonly profile: "core";
|
|
122
|
+
}, {
|
|
123
|
+
readonly id: "package.default";
|
|
124
|
+
readonly profile: "core";
|
|
125
|
+
}, {
|
|
126
|
+
readonly id: "session.cross-document";
|
|
127
|
+
readonly profile: "core";
|
|
128
|
+
}, {
|
|
129
|
+
readonly id: "session.lifecycle";
|
|
130
|
+
readonly profile: "core";
|
|
131
|
+
}, {
|
|
132
|
+
readonly id: "session.plaintext-transfer";
|
|
133
|
+
readonly profile: "core";
|
|
134
|
+
}, {
|
|
135
|
+
readonly id: "session.encrypted-archive";
|
|
136
|
+
readonly profile: "core";
|
|
137
|
+
}, {
|
|
138
|
+
readonly id: "document.docx.extract";
|
|
139
|
+
readonly profile: "document";
|
|
140
|
+
}, {
|
|
141
|
+
readonly id: "document.docx.rewrite";
|
|
142
|
+
readonly profile: "document";
|
|
143
|
+
}, {
|
|
144
|
+
readonly id: "document.docx.anonymize";
|
|
145
|
+
readonly profile: "document";
|
|
146
|
+
}, {
|
|
147
|
+
readonly id: "document.docx.restore";
|
|
148
|
+
readonly profile: "document";
|
|
149
|
+
}];
|
|
19
150
|
readonly entities: readonly [{
|
|
20
151
|
readonly label: "person";
|
|
21
152
|
readonly selection: "default";
|
|
@@ -80,6 +211,10 @@ declare const CAPABILITY_MANIFEST: {
|
|
|
80
211
|
readonly label: "registration number";
|
|
81
212
|
readonly selection: "default";
|
|
82
213
|
readonly detectionSources: readonly ["regex", "trigger"];
|
|
214
|
+
}, {
|
|
215
|
+
readonly label: "case number";
|
|
216
|
+
readonly selection: "default";
|
|
217
|
+
readonly detectionSources: readonly ["regex", "trigger"];
|
|
83
218
|
}, {
|
|
84
219
|
readonly label: "credit card number";
|
|
85
220
|
readonly selection: "default";
|
|
@@ -87,7 +222,7 @@ declare const CAPABILITY_MANIFEST: {
|
|
|
87
222
|
}, {
|
|
88
223
|
readonly label: "passport number";
|
|
89
224
|
readonly selection: "default";
|
|
90
|
-
readonly detectionSources: readonly ["regex"];
|
|
225
|
+
readonly detectionSources: readonly ["regex", "trigger"];
|
|
91
226
|
}, {
|
|
92
227
|
readonly label: "crypto";
|
|
93
228
|
readonly selection: "default";
|
|
@@ -119,5 +254,5 @@ declare const CAPABILITY_MANIFEST: {
|
|
|
119
254
|
}];
|
|
120
255
|
};
|
|
121
256
|
//#endregion
|
|
122
|
-
export { CAPABILITY_MANIFEST, CAPABILITY_MANIFEST_SCHEMA_VERSION, CAPABILITY_RUNTIMES, CapabilityManifest, CapabilityRuntime };
|
|
257
|
+
export { CAPABILITY_MANIFEST, CAPABILITY_MANIFEST_SCHEMA_VERSION, CAPABILITY_PARITY_PROFILES, CAPABILITY_RUNTIMES, CAPABILITY_SURFACES, CapabilityManifest, CapabilityParityProfile, CapabilityRuntime, CapabilitySurface, CapabilitySurfaceId };
|
|
123
258
|
//# sourceMappingURL=capabilities.d.mts.map
|
package/dist/capabilities.mjs
CHANGED
|
@@ -1,22 +1,107 @@
|
|
|
1
1
|
import { ENTITY_CAPABILITIES } from "./constants.mjs";
|
|
2
2
|
//#region src/capabilities.ts
|
|
3
|
-
const CAPABILITY_MANIFEST_SCHEMA_VERSION =
|
|
3
|
+
const CAPABILITY_MANIFEST_SCHEMA_VERSION = 2;
|
|
4
4
|
const CAPABILITY_RUNTIMES = [
|
|
5
5
|
"node",
|
|
6
6
|
"python",
|
|
7
7
|
"wasm"
|
|
8
8
|
];
|
|
9
|
+
const CAPABILITY_PARITY_PROFILES = {
|
|
10
|
+
core: CAPABILITY_RUNTIMES,
|
|
11
|
+
local: ["node", "python"],
|
|
12
|
+
document: ["node", "python"]
|
|
13
|
+
};
|
|
14
|
+
const CAPABILITY_SURFACES = [
|
|
15
|
+
{
|
|
16
|
+
id: "package.prepare",
|
|
17
|
+
profile: "core"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: "package.load",
|
|
21
|
+
profile: "core"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "package.load-file",
|
|
25
|
+
profile: "local"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "text.normalize",
|
|
29
|
+
profile: "core"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "text.redact",
|
|
33
|
+
profile: "core"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "text.redact-stream",
|
|
37
|
+
profile: "core"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: "text.diagnostics",
|
|
41
|
+
profile: "core"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "text.summary-diagnostics",
|
|
45
|
+
profile: "core"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "text.caller-detections",
|
|
49
|
+
profile: "core"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "text.operators",
|
|
53
|
+
profile: "core"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: "package.default",
|
|
57
|
+
profile: "core"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "session.cross-document",
|
|
61
|
+
profile: "core"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "session.lifecycle",
|
|
65
|
+
profile: "core"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: "session.plaintext-transfer",
|
|
69
|
+
profile: "core"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: "session.encrypted-archive",
|
|
73
|
+
profile: "core"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: "document.docx.extract",
|
|
77
|
+
profile: "document"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: "document.docx.rewrite",
|
|
81
|
+
profile: "document"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "document.docx.anonymize",
|
|
85
|
+
profile: "document"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: "document.docx.restore",
|
|
89
|
+
profile: "document"
|
|
90
|
+
}
|
|
91
|
+
];
|
|
9
92
|
/**
|
|
10
93
|
* Versioned, runtime-free discovery contract for the deterministic pipeline.
|
|
11
94
|
* The manifest contains no accuracy claims; it describes available labels,
|
|
12
95
|
* activation, provenance sources, and runtime parity only.
|
|
13
96
|
*/
|
|
14
97
|
const CAPABILITY_MANIFEST = {
|
|
15
|
-
schemaVersion:
|
|
98
|
+
schemaVersion: 2,
|
|
16
99
|
runtimes: CAPABILITY_RUNTIMES,
|
|
100
|
+
parityProfiles: CAPABILITY_PARITY_PROFILES,
|
|
101
|
+
surfaces: CAPABILITY_SURFACES,
|
|
17
102
|
entities: ENTITY_CAPABILITIES
|
|
18
103
|
};
|
|
19
104
|
//#endregion
|
|
20
|
-
export { CAPABILITY_MANIFEST, CAPABILITY_MANIFEST_SCHEMA_VERSION, CAPABILITY_RUNTIMES };
|
|
105
|
+
export { CAPABILITY_MANIFEST, CAPABILITY_MANIFEST_SCHEMA_VERSION, CAPABILITY_PARITY_PROFILES, CAPABILITY_RUNTIMES, CAPABILITY_SURFACES };
|
|
21
106
|
|
|
22
107
|
//# sourceMappingURL=capabilities.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.mjs","names":[],"sources":["../src/capabilities.ts"],"sourcesContent":["import { ENTITY_CAPABILITIES } from \"./constants\";\n\nexport const CAPABILITY_MANIFEST_SCHEMA_VERSION =
|
|
1
|
+
{"version":3,"file":"capabilities.mjs","names":[],"sources":["../src/capabilities.ts"],"sourcesContent":["import { ENTITY_CAPABILITIES } from \"./constants\";\n\nexport const CAPABILITY_MANIFEST_SCHEMA_VERSION = 2 as const;\n\nexport const CAPABILITY_RUNTIMES = [\"node\", \"python\", \"wasm\"] as const;\n\nexport type CapabilityRuntime = (typeof CAPABILITY_RUNTIMES)[number];\n\nexport const CAPABILITY_PARITY_PROFILES = {\n core: CAPABILITY_RUNTIMES,\n local: [\"node\", \"python\"],\n document: [\"node\", \"python\"],\n} as const satisfies Record<string, readonly CapabilityRuntime[]>;\n\nexport type CapabilityParityProfile = keyof typeof CAPABILITY_PARITY_PROFILES;\n\nexport const CAPABILITY_SURFACES = [\n { id: \"package.prepare\", profile: \"core\" },\n { id: \"package.load\", profile: \"core\" },\n { id: \"package.load-file\", profile: \"local\" },\n { id: \"text.normalize\", profile: \"core\" },\n { id: \"text.redact\", profile: \"core\" },\n { id: \"text.redact-stream\", profile: \"core\" },\n { id: \"text.diagnostics\", profile: \"core\" },\n { id: \"text.summary-diagnostics\", profile: \"core\" },\n { id: \"text.caller-detections\", profile: \"core\" },\n { id: \"text.operators\", profile: \"core\" },\n { id: \"package.default\", profile: \"core\" },\n { id: \"session.cross-document\", profile: \"core\" },\n { id: \"session.lifecycle\", profile: \"core\" },\n { id: \"session.plaintext-transfer\", profile: \"core\" },\n { id: \"session.encrypted-archive\", profile: \"core\" },\n { id: \"document.docx.extract\", profile: \"document\" },\n { id: \"document.docx.rewrite\", profile: \"document\" },\n { id: \"document.docx.anonymize\", profile: \"document\" },\n { id: \"document.docx.restore\", profile: \"document\" },\n] as const satisfies readonly {\n id: string;\n profile: CapabilityParityProfile;\n}[];\n\nexport type CapabilitySurface = (typeof CAPABILITY_SURFACES)[number];\nexport type CapabilitySurfaceId = CapabilitySurface[\"id\"];\n\nexport type CapabilityManifest = {\n schemaVersion: typeof CAPABILITY_MANIFEST_SCHEMA_VERSION;\n runtimes: readonly CapabilityRuntime[];\n parityProfiles: typeof CAPABILITY_PARITY_PROFILES;\n surfaces: typeof CAPABILITY_SURFACES;\n entities: typeof ENTITY_CAPABILITIES;\n};\n\n/**\n * Versioned, runtime-free discovery contract for the deterministic pipeline.\n * The manifest contains no accuracy claims; it describes available labels,\n * activation, provenance sources, and runtime parity only.\n */\nexport const CAPABILITY_MANIFEST = {\n schemaVersion: CAPABILITY_MANIFEST_SCHEMA_VERSION,\n runtimes: CAPABILITY_RUNTIMES,\n parityProfiles: CAPABILITY_PARITY_PROFILES,\n surfaces: CAPABILITY_SURFACES,\n entities: ENTITY_CAPABILITIES,\n} as const satisfies CapabilityManifest;\n"],"mappings":";;AAEA,MAAa,qCAAqC;AAElD,MAAa,sBAAsB;CAAC;CAAQ;CAAU;AAAM;AAI5D,MAAa,6BAA6B;CACxC,MAAM;CACN,OAAO,CAAC,QAAQ,QAAQ;CACxB,UAAU,CAAC,QAAQ,QAAQ;AAC7B;AAIA,MAAa,sBAAsB;CACjC;EAAE,IAAI;EAAmB,SAAS;CAAO;CACzC;EAAE,IAAI;EAAgB,SAAS;CAAO;CACtC;EAAE,IAAI;EAAqB,SAAS;CAAQ;CAC5C;EAAE,IAAI;EAAkB,SAAS;CAAO;CACxC;EAAE,IAAI;EAAe,SAAS;CAAO;CACrC;EAAE,IAAI;EAAsB,SAAS;CAAO;CAC5C;EAAE,IAAI;EAAoB,SAAS;CAAO;CAC1C;EAAE,IAAI;EAA4B,SAAS;CAAO;CAClD;EAAE,IAAI;EAA0B,SAAS;CAAO;CAChD;EAAE,IAAI;EAAkB,SAAS;CAAO;CACxC;EAAE,IAAI;EAAmB,SAAS;CAAO;CACzC;EAAE,IAAI;EAA0B,SAAS;CAAO;CAChD;EAAE,IAAI;EAAqB,SAAS;CAAO;CAC3C;EAAE,IAAI;EAA8B,SAAS;CAAO;CACpD;EAAE,IAAI;EAA6B,SAAS;CAAO;CACnD;EAAE,IAAI;EAAyB,SAAS;CAAW;CACnD;EAAE,IAAI;EAAyB,SAAS;CAAW;CACnD;EAAE,IAAI;EAA2B,SAAS;CAAW;CACrD;EAAE,IAAI;EAAyB,SAAS;CAAW;AACrD;;;;;;AAqBA,MAAa,sBAAsB;CACjC,eAAA;CACA,UAAU;CACV,gBAAgB;CAChB,UAAU;CACV,UAAU;AACZ"}
|
package/dist/constants.mjs
CHANGED
|
@@ -164,6 +164,11 @@ const ENTITY_CAPABILITIES = [
|
|
|
164
164
|
selection: ENTITY_SELECTIONS.DEFAULT,
|
|
165
165
|
detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER]
|
|
166
166
|
},
|
|
167
|
+
{
|
|
168
|
+
label: "case number",
|
|
169
|
+
selection: ENTITY_SELECTIONS.DEFAULT,
|
|
170
|
+
detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER]
|
|
171
|
+
},
|
|
167
172
|
{
|
|
168
173
|
label: "credit card number",
|
|
169
174
|
selection: ENTITY_SELECTIONS.DEFAULT,
|
|
@@ -172,7 +177,7 @@ const ENTITY_CAPABILITIES = [
|
|
|
172
177
|
{
|
|
173
178
|
label: "passport number",
|
|
174
179
|
selection: ENTITY_SELECTIONS.DEFAULT,
|
|
175
|
-
detectionSources: [DETECTION_SOURCES.REGEX]
|
|
180
|
+
detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER]
|
|
176
181
|
},
|
|
177
182
|
{
|
|
178
183
|
label: "crypto",
|
package/dist/constants.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Runtime-free constants for the anonymization pipeline.\n *\n * This module is the SSR-safe / browser-safe entrypoint:\n * importing it must not pull in `@stll/anonymize-wasm`\n * or any other runtime-bearing module.\n * Consumers that only need the static label list,\n * detection-source identifiers, or operator names import\n * from `@stll/anonymize/constants` (or\n * `@stll/anonymize-wasm/constants`) without paying the\n * wasm / regex-set startup cost.\n *\n * `types.ts` re-exports these for back-compat, so existing\n * `import { DEFAULT_ENTITY_LABELS } from \"@stll/anonymize\"`\n * call sites keep working.\n */\n\n/**\n * Source of a detected entity span.\n * Ordered by detection layer in the pipeline.\n */\nexport const DETECTION_SOURCES = {\n TRIGGER: \"trigger\",\n REGEX: \"regex\",\n DENY_LIST: \"deny-list\",\n LEGAL_FORM: \"legal-form\",\n GAZETTEER: \"gazetteer\",\n COUNTRY: \"country\",\n NER: \"ner\",\n COREFERENCE: \"coreference\",\n} as const;\n\nexport type DetectionSource =\n (typeof DETECTION_SOURCES)[keyof typeof DETECTION_SOURCES];\n\n/**\n * Priority levels for detection sources.\n * Higher = more structurally reliable. Used during\n * overlap resolution so deterministic detectors beat\n * probabilistic ones regardless of raw score.\n */\nexport const DETECTOR_PRIORITY = {\n [DETECTION_SOURCES.GAZETTEER]: 5,\n [DETECTION_SOURCES.TRIGGER]: 4,\n [DETECTION_SOURCES.LEGAL_FORM]: 3,\n [DETECTION_SOURCES.REGEX]: 3,\n [DETECTION_SOURCES.COUNTRY]: 3,\n [DETECTION_SOURCES.DENY_LIST]: 2,\n [DETECTION_SOURCES.COREFERENCE]: 2,\n [DETECTION_SOURCES.NER]: 1,\n} as const satisfies Record<DetectionSource, number>;\n\n/**\n * Anonymization operator types. Each operator defines\n * how a confirmed entity is replaced in the output.\n */\nexport const OPERATOR_TYPES = [\"replace\", \"redact\", \"keep\", \"mask\"] as const;\n\nexport type OperatorType = (typeof OPERATOR_TYPES)[number];\n\nexport const ENTITY_SELECTIONS = {\n DEFAULT: \"default\",\n OPT_IN: \"opt-in\",\n} as const;\n\nexport type EntitySelection =\n (typeof ENTITY_SELECTIONS)[keyof typeof ENTITY_SELECTIONS];\n\nexport type EntityCapability = {\n label: string;\n selection: EntitySelection;\n detectionSources: readonly DetectionSource[];\n};\n\n/**\n * Canonical entity capabilities exposed by the deterministic native pipeline.\n * `selection` describes whether the default package requests the label; opt-in\n * labels have built-in detection rules but must be requested explicitly.\n *\n * These labels are ephemeral: entities are regenerated on\n * every pipeline run and never persisted to the database.\n * Renaming a label here requires no migration.\n */\nexport const ENTITY_CAPABILITIES = [\n {\n label: \"person\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [\n DETECTION_SOURCES.TRIGGER,\n DETECTION_SOURCES.REGEX,\n DETECTION_SOURCES.DENY_LIST,\n DETECTION_SOURCES.COREFERENCE,\n ],\n },\n {\n label: \"organization\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [\n DETECTION_SOURCES.TRIGGER,\n DETECTION_SOURCES.DENY_LIST,\n DETECTION_SOURCES.LEGAL_FORM,\n DETECTION_SOURCES.GAZETTEER,\n DETECTION_SOURCES.COREFERENCE,\n ],\n },\n {\n label: \"phone number\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"address\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [\n DETECTION_SOURCES.REGEX,\n DETECTION_SOURCES.TRIGGER,\n DETECTION_SOURCES.DENY_LIST,\n ],\n },\n {\n label: \"country\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.COUNTRY],\n },\n {\n label: \"email address\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX],\n },\n {\n label: \"date\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"date of birth\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"bank account number\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"iban\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"tax identification number\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"identity card number\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"birth number\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"national identification number\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"social security number\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"registration number\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"credit card number\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX],\n },\n {\n label: \"passport number\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX],\n },\n {\n label: \"crypto\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX],\n },\n {\n label: \"monetary amount\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"land parcel\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"misc\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.DENY_LIST],\n },\n {\n label: \"ip address\",\n selection: ENTITY_SELECTIONS.OPT_IN,\n detectionSources: [DETECTION_SOURCES.REGEX],\n },\n {\n label: \"mac address\",\n selection: ENTITY_SELECTIONS.OPT_IN,\n detectionSources: [DETECTION_SOURCES.REGEX],\n },\n {\n label: \"url\",\n selection: ENTITY_SELECTIONS.OPT_IN,\n detectionSources: [DETECTION_SOURCES.REGEX],\n },\n] as const satisfies readonly EntityCapability[];\n\ntype KnownEntityCapability = (typeof ENTITY_CAPABILITIES)[number];\n\nexport type EntityLabel = KnownEntityCapability[\"label\"];\n\nexport const ENTITY_LABELS: readonly EntityLabel[] = ENTITY_CAPABILITIES.map(\n ({ label }) => label,\n);\n\nconst isDefaultEntityCapability = (\n capability: KnownEntityCapability,\n): capability is Extract<\n KnownEntityCapability,\n { selection: typeof ENTITY_SELECTIONS.DEFAULT }\n> => capability.selection === ENTITY_SELECTIONS.DEFAULT;\n\nexport type DefaultEntityLabel = Extract<\n KnownEntityCapability,\n { selection: typeof ENTITY_SELECTIONS.DEFAULT }\n>[\"label\"];\n\nexport const DEFAULT_ENTITY_LABELS: readonly DefaultEntityLabel[] =\n ENTITY_CAPABILITIES.filter(isDefaultEntityCapability).map(\n ({ label }) => label,\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,oBAAoB;CAC/B,SAAS;CACT,OAAO;CACP,WAAW;CACX,YAAY;CACZ,WAAW;CACX,SAAS;CACT,KAAK;CACL,aAAa;AACf;;;;;;;AAWA,MAAa,oBAAoB;EAC9B,kBAAkB,YAAY;EAC9B,kBAAkB,UAAU;EAC5B,kBAAkB,aAAa;EAC/B,kBAAkB,QAAQ;EAC1B,kBAAkB,UAAU;EAC5B,kBAAkB,YAAY;EAC9B,kBAAkB,cAAc;EAChC,kBAAkB,MAAM;AAC3B;;;;;AAMA,MAAa,iBAAiB;CAAC;CAAW;CAAU;CAAQ;AAAM;AAIlE,MAAa,oBAAoB;CAC/B,SAAS;CACT,QAAQ;AACV;;;;;;;;;;AAoBA,MAAa,sBAAsB;CACjC;EACE,OAAO;EACP,WAAW,kBAAkB;EAC7B,kBAAkB;GAChB,kBAAkB;GAClB,kBAAkB;GAClB,kBAAkB;GAClB,kBAAkB;EACpB;CACF;CACA;EACE,OAAO;EACP,WAAW,kBAAkB;EAC7B,kBAAkB;GAChB,kBAAkB;GAClB,kBAAkB;GACl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,WAAW,kBAAkB;EAC7B,kBAAkB,CAAC,kBAAkB,OAAO,kBAAkB,OAAO;CACvE;CACA;EACE,OAAO;EACP,WAAW,kBAAkB;EAC7B,kBAAkB,CAAC,kBAAkB,KAAK;CAC5C;CACA;EACE,OAAO;EACP,WAAW,kBAAkB;EAC7B,kBAAkB,CAAC,kBAAkB,KAAK;CAC5C;CACA;EACE,OAAO;EACP,WAAW,kBAAkB;EAC7B,kBAAkB,CAAC,kBAAkB,KAAK;CAC5C;CACA;EACE,OAAO;EACP,WAAW,kBAAkB;EAC7B,kBAAkB,CAAC,kBAAkB,OAAO,kBAAkB,OAAO;CACvE;CACA;EACE,OAAO;EACP,WAAW,kBAAkB;EAC7B,kBAAkB,CAAC,kBAAkB,OAAO;CAC9C;CACA;EACE,OAAO;EACP,WAAW,kBAAkB;EAC7B,kBAAkB,CAAC,kBAAkB,OAAO,kBAAkB,SAAS;CACzE;CACA;EACE,OAAO;EACP,WAAW,kBAAkB;EAC7B,kBAAkB,CAAC,kBAAkB,KAAK;CAC5C;CACA;EACE,OAAO;EACP,WAAW,kBAAkB;EAC7B,kBAAkB,CAAC,kBAAkB,KAAK;CAC5C;CACA;EACE,OAAO;EACP,WAAW,kBAAkB;EAC7B,kBAAkB,CAAC,kBAAkB,KAAK;CAC5C;AACF;AAMA,MAAa,gBAAwC,oBAAoB,KACtE,EAAE,YAAY,KACjB;AAEA,MAAM,6BACJ,eAIG,WAAW,cAAc,kBAAkB;AAOhD,MAAa,wBACX,oBAAoB,OAAO,yBAAyB,CAAC,CAAC,KACnD,EAAE,YAAY,KACjB"}
|
|
1
|
+
{"version":3,"file":"constants.mjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Runtime-free constants for the anonymization pipeline.\n *\n * This module is the SSR-safe / browser-safe entrypoint:\n * importing it must not pull in `@stll/anonymize-wasm`\n * or any other runtime-bearing module.\n * Consumers that only need the static label list,\n * detection-source identifiers, or operator names import\n * from `@stll/anonymize/constants` (or\n * `@stll/anonymize-wasm/constants`) without paying the\n * wasm / regex-set startup cost.\n *\n * `types.ts` re-exports these for back-compat, so existing\n * `import { DEFAULT_ENTITY_LABELS } from \"@stll/anonymize\"`\n * call sites keep working.\n */\n\n/**\n * Source of a detected entity span.\n * Ordered by detection layer in the pipeline.\n */\nexport const DETECTION_SOURCES = {\n TRIGGER: \"trigger\",\n REGEX: \"regex\",\n DENY_LIST: \"deny-list\",\n LEGAL_FORM: \"legal-form\",\n GAZETTEER: \"gazetteer\",\n COUNTRY: \"country\",\n NER: \"ner\",\n COREFERENCE: \"coreference\",\n} as const;\n\nexport type DetectionSource =\n (typeof DETECTION_SOURCES)[keyof typeof DETECTION_SOURCES];\n\n/**\n * Priority levels for detection sources.\n * Higher = more structurally reliable. Used during\n * overlap resolution so deterministic detectors beat\n * probabilistic ones regardless of raw score.\n */\nexport const DETECTOR_PRIORITY = {\n [DETECTION_SOURCES.GAZETTEER]: 5,\n [DETECTION_SOURCES.TRIGGER]: 4,\n [DETECTION_SOURCES.LEGAL_FORM]: 3,\n [DETECTION_SOURCES.REGEX]: 3,\n [DETECTION_SOURCES.COUNTRY]: 3,\n [DETECTION_SOURCES.DENY_LIST]: 2,\n [DETECTION_SOURCES.COREFERENCE]: 2,\n [DETECTION_SOURCES.NER]: 1,\n} as const satisfies Record<DetectionSource, number>;\n\n/**\n * Anonymization operator types. Each operator defines\n * how a confirmed entity is replaced in the output.\n */\nexport const OPERATOR_TYPES = [\"replace\", \"redact\", \"keep\", \"mask\"] as const;\n\nexport type OperatorType = (typeof OPERATOR_TYPES)[number];\n\nexport const ENTITY_SELECTIONS = {\n DEFAULT: \"default\",\n OPT_IN: \"opt-in\",\n} as const;\n\nexport type EntitySelection =\n (typeof ENTITY_SELECTIONS)[keyof typeof ENTITY_SELECTIONS];\n\nexport type EntityCapability = {\n label: string;\n selection: EntitySelection;\n detectionSources: readonly DetectionSource[];\n};\n\n/**\n * Canonical entity capabilities exposed by the deterministic native pipeline.\n * `selection` describes whether the default package requests the label; opt-in\n * labels have built-in detection rules but must be requested explicitly.\n *\n * These labels are ephemeral: entities are regenerated on\n * every pipeline run and never persisted to the database.\n * Renaming a label here requires no migration.\n */\nexport const ENTITY_CAPABILITIES = [\n {\n label: \"person\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [\n DETECTION_SOURCES.TRIGGER,\n DETECTION_SOURCES.REGEX,\n DETECTION_SOURCES.DENY_LIST,\n DETECTION_SOURCES.COREFERENCE,\n ],\n },\n {\n label: \"organization\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [\n DETECTION_SOURCES.TRIGGER,\n DETECTION_SOURCES.DENY_LIST,\n DETECTION_SOURCES.LEGAL_FORM,\n DETECTION_SOURCES.GAZETTEER,\n DETECTION_SOURCES.COREFERENCE,\n ],\n },\n {\n label: \"phone number\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"address\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [\n DETECTION_SOURCES.REGEX,\n DETECTION_SOURCES.TRIGGER,\n DETECTION_SOURCES.DENY_LIST,\n ],\n },\n {\n label: \"country\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.COUNTRY],\n },\n {\n label: \"email address\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX],\n },\n {\n label: \"date\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"date of birth\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"bank account number\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"iban\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"tax identification number\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"identity card number\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"birth number\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"national identification number\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"social security number\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"registration number\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"case number\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"credit card number\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX],\n },\n {\n label: \"passport number\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"crypto\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX],\n },\n {\n label: \"monetary amount\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"land parcel\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.TRIGGER],\n },\n {\n label: \"misc\",\n selection: ENTITY_SELECTIONS.DEFAULT,\n detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.DENY_LIST],\n },\n {\n label: \"ip address\",\n selection: ENTITY_SELECTIONS.OPT_IN,\n detectionSources: [DETECTION_SOURCES.REGEX],\n },\n {\n label: \"mac address\",\n selection: ENTITY_SELECTIONS.OPT_IN,\n detectionSources: [DETECTION_SOURCES.REGEX],\n },\n {\n label: \"url\",\n selection: ENTITY_SELECTIONS.OPT_IN,\n detectionSources: [DETECTION_SOURCES.REGEX],\n },\n] as const satisfies readonly EntityCapability[];\n\ntype KnownEntityCapability = (typeof ENTITY_CAPABILITIES)[number];\n\nexport type EntityLabel = KnownEntityCapability[\"label\"];\n\nexport const ENTITY_LABELS: readonly EntityLabel[] = ENTITY_CAPABILITIES.map(\n ({ label }) => label,\n);\n\nconst isDefaultEntityCapability = (\n capability: KnownEntityCapability,\n): capability is Extract<\n KnownEntityCapability,\n { selection: typeof ENTITY_SELECTIONS.DEFAULT }\n> => capability.selection === ENTITY_SELECTIONS.DEFAULT;\n\nexport type DefaultEntityLabel = Extract<\n KnownEntityCapability,\n { selection: typeof ENTITY_SELECTIONS.DEFAULT }\n>[\"label\"];\n\nexport const DEFAULT_ENTITY_LABELS: readonly DefaultEntityLabel[] =\n ENTITY_CAPABILITIES.filter(isDefaultEntityCapability).map(\n ({ label }) => label,\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,oBAAoB;CAC/B,SAAS;CACT,OAAO;CACP,WAAW;CACX,YAAY;CACZ,WAAW;CACX,SAAS;CACT,KAAK;CACL,aAAa;AACf;;;;;;;AAWA,MAAa,oBAAoB;EAC9B,kBAAkB,YAAY;EAC9B,kBAAkB,UAAU;EAC5B,kBAAkB,aAAa;EAC/B,kBAAkB,QAAQ;EAC1B,kBAAkB,UAAU;EAC5B,k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5C;CACA;EACE,OAAO;EACP,WAAW,kBAAkB;EAC7B,kBAAkB,CAAC,kBAAkB,KAAK;CAC5C;AACF;AAMA,MAAa,gBAAwC,oBAAoB,KACtE,EAAE,YAAY,KACjB;AAEA,MAAM,6BACJ,eAIG,WAAW,cAAc,kBAAkB;AAOhD,MAAa,wBACX,oBAAoB,OAAO,yBAAyB,CAAC,CAAC,KACnD,EAAE,YAAY,KACjB"}
|
package/dist/constants2.d.mts
CHANGED
|
@@ -135,6 +135,10 @@ declare const ENTITY_CAPABILITIES: readonly [{
|
|
|
135
135
|
readonly label: "registration number";
|
|
136
136
|
readonly selection: "default";
|
|
137
137
|
readonly detectionSources: readonly ["regex", "trigger"];
|
|
138
|
+
}, {
|
|
139
|
+
readonly label: "case number";
|
|
140
|
+
readonly selection: "default";
|
|
141
|
+
readonly detectionSources: readonly ["regex", "trigger"];
|
|
138
142
|
}, {
|
|
139
143
|
readonly label: "credit card number";
|
|
140
144
|
readonly selection: "default";
|
|
@@ -142,7 +146,7 @@ declare const ENTITY_CAPABILITIES: readonly [{
|
|
|
142
146
|
}, {
|
|
143
147
|
readonly label: "passport number";
|
|
144
148
|
readonly selection: "default";
|
|
145
|
-
readonly detectionSources: readonly ["regex"];
|
|
149
|
+
readonly detectionSources: readonly ["regex", "trigger"];
|
|
146
150
|
}, {
|
|
147
151
|
readonly label: "crypto";
|
|
148
152
|
readonly selection: "default";
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as DetectionSource, c as ENTITY_SELECTIONS, d as EntitySelection, f as OPERATOR_TYPES, i as DefaultEntityLabel, l as EntityCapability, n as DETECTION_SOURCES, o as ENTITY_CAPABILITIES, p as OperatorType, r as DETECTOR_PRIORITY, s as ENTITY_LABELS, t as DEFAULT_ENTITY_LABELS, u as EntityLabel } from "./constants2.mjs";
|
|
2
|
-
import { CAPABILITY_MANIFEST, CAPABILITY_MANIFEST_SCHEMA_VERSION, CAPABILITY_RUNTIMES, CapabilityManifest, CapabilityRuntime } from "./capabilities.mjs";
|
|
2
|
+
import { CAPABILITY_MANIFEST, CAPABILITY_MANIFEST_SCHEMA_VERSION, CAPABILITY_PARITY_PROFILES, CAPABILITY_RUNTIMES, CAPABILITY_SURFACES, CapabilityManifest, CapabilityParityProfile, CapabilityRuntime, CapabilitySurface, CapabilitySurfaceId } from "./capabilities.mjs";
|
|
3
3
|
import { $ as getNativeBindingVersion, A as NativeStaticRedactionResult, B as SharedNativePreparedPackageOptions, C as NativeSessionCallerRedactionInput, Ct as TriggerGroupConfig, D as NativeSessionMetadata, Dt as NativePreparedSearchConfig, E as NativeSessionLifecycle, Et as TriggerValidation, F as PreparedNativeRedactionSession, G as assertNativeBindingVersion, H as SharedNativeRedactTextOptions, I as PreparedNativeSessionRedactionPlan, J as createNativePipelineFromPackage, K as createNativeAnonymizerFromConfig, L as PreparedSearch, M as PreparedAnonymizer, N as PreparedNativeAnonymizer, O as NativeSessionRedactionAtOptions, P as PreparedNativePipeline, Q as encodeNativeSearchConfigInput, R as SharedNativeDiagnosticsJsonOptions, S as NativeSessionBlockRedactionPlan, St as TriggerExtension, T as NativeSessionDeletionSummary, Tt as TriggerStrategy, U as SharedNativeRedactTextStreamJsonOptions, V as SharedNativeRedactTextJsonOptions, W as SharedNativeSearchPackageOptions, Z as encodeNativeSearchConfig, _ as NativePreparedSessionRedactionPlanBinding, _t as OperatorConfig, a as NativeBindingVersionOptions, b as NativeSearchPackageInput, bt as ReviewDecision, c as NativeCreateSessionWithLifecycleOptions, d as NativeOpenSessionArchiveOptions, dt as CustomRegexPattern, f as NativeOperatorConfig, ft as DenyListCategory, g as NativePreparedSearchBinding, gt as GazetteerEntry, h as NativePreparedRedactionSessionBinding, ht as Entity, i as NativeAnonymizerFromPackageOptions, j as NativeTextReplacement, k as NativeSessionStatus, l as NativeDiagnosticsBatchCallback, lt as AnonymisationOperator, m as NativePipelineFromPackageOptions, mt as DictionaryMeta, n as NativeAnonymizeBinding, o as NativeCallerDetection, p as NativePipelineEntity, pt as Dictionaries, q as createNativeAnonymizerFromPackage, r as NativeAnonymizerFromConfigOptions, rt as prepareNativeSearchPackage, s as NativeCallerRedactionOptions, t as CALLER_DETECTION_CONTRACT_VERSION, u as NativeNormalizeOptions, ut as CustomDenyListEntry, v as NativeRedactionResult, vt as PipelineConfig, w as NativeSessionCallerRedactionPlanOptions, wt as TriggerRule, x as NativeSearchPackageOptions, xt as ReviewedEntity, y as NativeResultEventCallback, yt as RedactionResult, z as SharedNativeDiagnosticsStreamJsonOptions } from "./native.mjs";
|
|
4
4
|
import { A as readDefaultNativePipelinePackageFileAsync, B as redact_text_stream_json, C as native_package_version, D as preload_default_native_pipeline, E as preloadDefaultNativePipelineAsync, F as redactDefaultTextJson, G as NativePipelinePackageOptions, H as DEFAULT_NATIVE_PIPELINE_CONFIG, I as redact_default_text, J as createNativePipelineFromConfig, K as NativePipelineUnsupportedFeature, L as redact_default_text_json, M as readNativePipelinePackageFileAsync, N as read_default_native_pipeline_package_file, O as prepare_search_package, P as redactDefaultText, R as redact_text, S as load_prepared_package_file, T as preloadDefaultNativePipeline, U as NativePipelineBuildOptions, V as summary_diagnostics_json, W as NativePipelineCompatibility, X as prepareNativePipelineConfig, Y as getNativePipelineCompatibility, Z as prepareNativePipelinePackage, _ as diagnostics_stream_json, a as LoadNativeBindingOptions, b as loadNativeAnonymizeBinding, c as NativeRequire, d as availableDefaultNativePipelineLanguages, f as available_default_native_pipeline_languages, g as diagnostics_json, h as create_native_pipeline_from_default_package, i as DefaultNativePipelineWarmup, j as readNativePipelinePackageFile, k as readDefaultNativePipelinePackageFile, l as NativeSdkOptions, m as createNativePipelineFromPackageFile, n as DefaultNativePipelinePackageFileOptions, o as NativeLibc, p as createNativePipelineFromDefaultPackage, q as assertNativePipelineSupported, r as DefaultNativePipelinePackageOptions, s as NativePipelinePackageFileOptions, t as DEFAULT_NATIVE_PIPELINE_WARMUPS, u as NativeSdkPackageOptions, v as getDefaultNativePipeline, w as normalize_for_search, x as load_prepared_package, y as get_default_native_pipeline, z as redact_text_json } from "./native-node.mjs";
|
|
5
5
|
//#region src/redact.d.ts
|
|
@@ -15,5 +15,5 @@ declare const exportRedactionKey: (redactionMap: Map<string, string>, operatorMa
|
|
|
15
15
|
*/
|
|
16
16
|
declare const deanonymise: (redactedText: string, redactionMap: Map<string, string>) => string;
|
|
17
17
|
//#endregion
|
|
18
|
-
export { type AnonymisationOperator, CALLER_DETECTION_CONTRACT_VERSION, CAPABILITY_MANIFEST, CAPABILITY_MANIFEST_SCHEMA_VERSION, CAPABILITY_RUNTIMES, type CapabilityManifest, type CapabilityRuntime, type CustomDenyListEntry, type CustomRegexPattern, DEFAULT_ENTITY_LABELS, DEFAULT_NATIVE_PIPELINE_CONFIG, DEFAULT_NATIVE_PIPELINE_WARMUPS, DETECTION_SOURCES, DETECTOR_PRIORITY, type DefaultEntityLabel, DefaultNativePipelinePackageFileOptions, DefaultNativePipelinePackageOptions, DefaultNativePipelineWarmup, type DenyListCategory, type DetectionSource, type Dictionaries, type DictionaryMeta, ENTITY_CAPABILITIES, ENTITY_LABELS, ENTITY_SELECTIONS, type Entity, type EntityCapability, type EntityLabel, type EntitySelection, type GazetteerEntry, LoadNativeBindingOptions, NativeAnonymizeBinding, NativeAnonymizerFromConfigOptions, NativeAnonymizerFromPackageOptions, NativeBindingVersionOptions, NativeCallerDetection, NativeCallerRedactionOptions, NativeCreateSessionWithLifecycleOptions, NativeDiagnosticsBatchCallback, NativeLibc, NativeNormalizeOptions, NativeOpenSessionArchiveOptions, NativeOperatorConfig, type NativePipelineBuildOptions, type NativePipelineCompatibility, NativePipelineEntity, NativePipelineFromPackageOptions, NativePipelinePackageFileOptions, type NativePipelinePackageOptions, type NativePipelineUnsupportedFeature, NativePreparedRedactionSessionBinding, NativePreparedSearchBinding, type NativePreparedSearchConfig, NativePreparedSessionRedactionPlanBinding, NativeRedactionResult, NativeRequire, NativeResultEventCallback, NativeSdkOptions, NativeSdkPackageOptions, NativeSearchPackageInput, NativeSearchPackageOptions, NativeSessionBlockRedactionPlan, NativeSessionCallerRedactionInput, NativeSessionCallerRedactionPlanOptions, NativeSessionDeletionSummary, NativeSessionLifecycle, NativeSessionMetadata, NativeSessionRedactionAtOptions, NativeSessionStatus, NativeStaticRedactionResult, NativeTextReplacement, OPERATOR_TYPES, type OperatorConfig, type OperatorType, type PipelineConfig, PreparedAnonymizer, PreparedNativeAnonymizer, PreparedNativePipeline, PreparedNativeRedactionSession, PreparedNativeSessionRedactionPlan, PreparedSearch, type RedactionResult, type ReviewDecision, type ReviewedEntity, SharedNativeDiagnosticsJsonOptions, SharedNativeDiagnosticsStreamJsonOptions, SharedNativePreparedPackageOptions, SharedNativeRedactTextJsonOptions, SharedNativeRedactTextOptions, SharedNativeRedactTextStreamJsonOptions, SharedNativeSearchPackageOptions, type TriggerExtension, type TriggerGroupConfig, type TriggerRule, type TriggerStrategy, type TriggerValidation, assertNativeBindingVersion, assertNativePipelineSupported, availableDefaultNativePipelineLanguages, available_default_native_pipeline_languages, createNativeAnonymizerFromConfig, createNativeAnonymizerFromPackage, createNativePipelineFromConfig, createNativePipelineFromDefaultPackage, createNativePipelineFromPackage, createNativePipelineFromPackageFile, create_native_pipeline_from_default_package, deanonymise, diagnostics_json, diagnostics_stream_json, encodeNativeSearchConfig, encodeNativeSearchConfigInput, exportRedactionKey, getDefaultNativePipeline, getNativeBindingVersion, getNativePipelineCompatibility, get_default_native_pipeline, loadNativeAnonymizeBinding, load_prepared_package, load_prepared_package_file, native_package_version, normalize_for_search, preloadDefaultNativePipeline, preloadDefaultNativePipelineAsync, preload_default_native_pipeline, prepareNativePipelineConfig, prepareNativePipelinePackage, prepareNativeSearchPackage, prepare_search_package, readDefaultNativePipelinePackageFile, readDefaultNativePipelinePackageFileAsync, readNativePipelinePackageFile, readNativePipelinePackageFileAsync, read_default_native_pipeline_package_file, redactDefaultText, redactDefaultTextJson, redact_default_text, redact_default_text_json, redact_text, redact_text_json, redact_text_stream_json, summary_diagnostics_json };
|
|
18
|
+
export { type AnonymisationOperator, CALLER_DETECTION_CONTRACT_VERSION, CAPABILITY_MANIFEST, CAPABILITY_MANIFEST_SCHEMA_VERSION, CAPABILITY_PARITY_PROFILES, CAPABILITY_RUNTIMES, CAPABILITY_SURFACES, type CapabilityManifest, type CapabilityParityProfile, type CapabilityRuntime, type CapabilitySurface, type CapabilitySurfaceId, type CustomDenyListEntry, type CustomRegexPattern, DEFAULT_ENTITY_LABELS, DEFAULT_NATIVE_PIPELINE_CONFIG, DEFAULT_NATIVE_PIPELINE_WARMUPS, DETECTION_SOURCES, DETECTOR_PRIORITY, type DefaultEntityLabel, DefaultNativePipelinePackageFileOptions, DefaultNativePipelinePackageOptions, DefaultNativePipelineWarmup, type DenyListCategory, type DetectionSource, type Dictionaries, type DictionaryMeta, ENTITY_CAPABILITIES, ENTITY_LABELS, ENTITY_SELECTIONS, type Entity, type EntityCapability, type EntityLabel, type EntitySelection, type GazetteerEntry, LoadNativeBindingOptions, NativeAnonymizeBinding, NativeAnonymizerFromConfigOptions, NativeAnonymizerFromPackageOptions, NativeBindingVersionOptions, NativeCallerDetection, NativeCallerRedactionOptions, NativeCreateSessionWithLifecycleOptions, NativeDiagnosticsBatchCallback, NativeLibc, NativeNormalizeOptions, NativeOpenSessionArchiveOptions, NativeOperatorConfig, type NativePipelineBuildOptions, type NativePipelineCompatibility, NativePipelineEntity, NativePipelineFromPackageOptions, NativePipelinePackageFileOptions, type NativePipelinePackageOptions, type NativePipelineUnsupportedFeature, NativePreparedRedactionSessionBinding, NativePreparedSearchBinding, type NativePreparedSearchConfig, NativePreparedSessionRedactionPlanBinding, NativeRedactionResult, NativeRequire, NativeResultEventCallback, NativeSdkOptions, NativeSdkPackageOptions, NativeSearchPackageInput, NativeSearchPackageOptions, NativeSessionBlockRedactionPlan, NativeSessionCallerRedactionInput, NativeSessionCallerRedactionPlanOptions, NativeSessionDeletionSummary, NativeSessionLifecycle, NativeSessionMetadata, NativeSessionRedactionAtOptions, NativeSessionStatus, NativeStaticRedactionResult, NativeTextReplacement, OPERATOR_TYPES, type OperatorConfig, type OperatorType, type PipelineConfig, PreparedAnonymizer, PreparedNativeAnonymizer, PreparedNativePipeline, PreparedNativeRedactionSession, PreparedNativeSessionRedactionPlan, PreparedSearch, type RedactionResult, type ReviewDecision, type ReviewedEntity, SharedNativeDiagnosticsJsonOptions, SharedNativeDiagnosticsStreamJsonOptions, SharedNativePreparedPackageOptions, SharedNativeRedactTextJsonOptions, SharedNativeRedactTextOptions, SharedNativeRedactTextStreamJsonOptions, SharedNativeSearchPackageOptions, type TriggerExtension, type TriggerGroupConfig, type TriggerRule, type TriggerStrategy, type TriggerValidation, assertNativeBindingVersion, assertNativePipelineSupported, availableDefaultNativePipelineLanguages, available_default_native_pipeline_languages, createNativeAnonymizerFromConfig, createNativeAnonymizerFromPackage, createNativePipelineFromConfig, createNativePipelineFromDefaultPackage, createNativePipelineFromPackage, createNativePipelineFromPackageFile, create_native_pipeline_from_default_package, deanonymise, diagnostics_json, diagnostics_stream_json, encodeNativeSearchConfig, encodeNativeSearchConfigInput, exportRedactionKey, getDefaultNativePipeline, getNativeBindingVersion, getNativePipelineCompatibility, get_default_native_pipeline, loadNativeAnonymizeBinding, load_prepared_package, load_prepared_package_file, native_package_version, normalize_for_search, preloadDefaultNativePipeline, preloadDefaultNativePipelineAsync, preload_default_native_pipeline, prepareNativePipelineConfig, prepareNativePipelinePackage, prepareNativeSearchPackage, prepare_search_package, readDefaultNativePipelinePackageFile, readDefaultNativePipelinePackageFileAsync, readNativePipelinePackageFile, readNativePipelinePackageFileAsync, read_default_native_pipeline_package_file, redactDefaultText, redactDefaultTextJson, redact_default_text, redact_default_text_json, redact_text, redact_text_json, redact_text_stream_json, summary_diagnostics_json };
|
|
19
19
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CALLER_DETECTION_CONTRACT_VERSION, PreparedAnonymizer, PreparedNativeAnonymizer, PreparedNativePipeline, PreparedNativeRedactionSession, PreparedNativeSessionRedactionPlan, PreparedSearch, assertNativeBindingVersion, createNativeAnonymizerFromConfig, createNativeAnonymizerFromPackage, createNativePipelineFromPackage, encodeNativeSearchConfig, encodeNativeSearchConfigInput, getNativeBindingVersion, prepareNativeSearchPackage } from "./native.mjs";
|
|
2
2
|
import { A as redact_text_json, C as readNativePipelinePackageFileAsync, D as redact_default_text, E as redactDefaultTextJson, F as createNativePipelineFromConfig, I as getNativePipelineCompatibility, L as prepareNativePipelineConfig, M as summary_diagnostics_json, N as DEFAULT_NATIVE_PIPELINE_CONFIG, O as redact_default_text_json, P as assertNativePipelineSupported, R as prepareNativePipelinePackage, S as readNativePipelinePackageFile, T as redactDefaultText, _ as preloadDefaultNativePipelineAsync, a as createNativePipelineFromPackageFile, b as readDefaultNativePipelinePackageFile, c as diagnostics_stream_json, d as loadNativeAnonymizeBinding, f as load_prepared_package, g as preloadDefaultNativePipeline, h as normalize_for_search, i as createNativePipelineFromDefaultPackage, j as redact_text_stream_json, k as redact_text, l as getDefaultNativePipeline, m as native_package_version, n as availableDefaultNativePipelineLanguages, o as create_native_pipeline_from_default_package, p as load_prepared_package_file, r as available_default_native_pipeline_languages, s as diagnostics_json, t as DEFAULT_NATIVE_PIPELINE_WARMUPS, u as get_default_native_pipeline, v as preload_default_native_pipeline, w as read_default_native_pipeline_package_file, x as readDefaultNativePipelinePackageFileAsync, y as prepare_search_package } from "./native-node2.mjs";
|
|
3
3
|
import { DEFAULT_ENTITY_LABELS, DETECTION_SOURCES, DETECTOR_PRIORITY, ENTITY_CAPABILITIES, ENTITY_LABELS, ENTITY_SELECTIONS, OPERATOR_TYPES } from "./constants.mjs";
|
|
4
|
-
import { CAPABILITY_MANIFEST, CAPABILITY_MANIFEST_SCHEMA_VERSION, CAPABILITY_RUNTIMES } from "./capabilities.mjs";
|
|
4
|
+
import { CAPABILITY_MANIFEST, CAPABILITY_MANIFEST_SCHEMA_VERSION, CAPABILITY_PARITY_PROFILES, CAPABILITY_RUNTIMES, CAPABILITY_SURFACES } from "./capabilities.mjs";
|
|
5
5
|
//#region src/redact.ts
|
|
6
6
|
/**
|
|
7
7
|
* Serialize the redaction key to JSON for export.
|
|
@@ -26,6 +26,6 @@ const deanonymise = (redactedText, redactionMap) => {
|
|
|
26
26
|
return result;
|
|
27
27
|
};
|
|
28
28
|
//#endregion
|
|
29
|
-
export { CALLER_DETECTION_CONTRACT_VERSION, CAPABILITY_MANIFEST, CAPABILITY_MANIFEST_SCHEMA_VERSION, CAPABILITY_RUNTIMES, DEFAULT_ENTITY_LABELS, DEFAULT_NATIVE_PIPELINE_CONFIG, DEFAULT_NATIVE_PIPELINE_WARMUPS, DETECTION_SOURCES, DETECTOR_PRIORITY, ENTITY_CAPABILITIES, ENTITY_LABELS, ENTITY_SELECTIONS, OPERATOR_TYPES, PreparedAnonymizer, PreparedNativeAnonymizer, PreparedNativePipeline, PreparedNativeRedactionSession, PreparedNativeSessionRedactionPlan, PreparedSearch, assertNativeBindingVersion, assertNativePipelineSupported, availableDefaultNativePipelineLanguages, available_default_native_pipeline_languages, createNativeAnonymizerFromConfig, createNativeAnonymizerFromPackage, createNativePipelineFromConfig, createNativePipelineFromDefaultPackage, createNativePipelineFromPackage, createNativePipelineFromPackageFile, create_native_pipeline_from_default_package, deanonymise, diagnostics_json, diagnostics_stream_json, encodeNativeSearchConfig, encodeNativeSearchConfigInput, exportRedactionKey, getDefaultNativePipeline, getNativeBindingVersion, getNativePipelineCompatibility, get_default_native_pipeline, loadNativeAnonymizeBinding, load_prepared_package, load_prepared_package_file, native_package_version, normalize_for_search, preloadDefaultNativePipeline, preloadDefaultNativePipelineAsync, preload_default_native_pipeline, prepareNativePipelineConfig, prepareNativePipelinePackage, prepareNativeSearchPackage, prepare_search_package, readDefaultNativePipelinePackageFile, readDefaultNativePipelinePackageFileAsync, readNativePipelinePackageFile, readNativePipelinePackageFileAsync, read_default_native_pipeline_package_file, redactDefaultText, redactDefaultTextJson, redact_default_text, redact_default_text_json, redact_text, redact_text_json, redact_text_stream_json, summary_diagnostics_json };
|
|
29
|
+
export { CALLER_DETECTION_CONTRACT_VERSION, CAPABILITY_MANIFEST, CAPABILITY_MANIFEST_SCHEMA_VERSION, CAPABILITY_PARITY_PROFILES, CAPABILITY_RUNTIMES, CAPABILITY_SURFACES, DEFAULT_ENTITY_LABELS, DEFAULT_NATIVE_PIPELINE_CONFIG, DEFAULT_NATIVE_PIPELINE_WARMUPS, DETECTION_SOURCES, DETECTOR_PRIORITY, ENTITY_CAPABILITIES, ENTITY_LABELS, ENTITY_SELECTIONS, OPERATOR_TYPES, PreparedAnonymizer, PreparedNativeAnonymizer, PreparedNativePipeline, PreparedNativeRedactionSession, PreparedNativeSessionRedactionPlan, PreparedSearch, assertNativeBindingVersion, assertNativePipelineSupported, availableDefaultNativePipelineLanguages, available_default_native_pipeline_languages, createNativeAnonymizerFromConfig, createNativeAnonymizerFromPackage, createNativePipelineFromConfig, createNativePipelineFromDefaultPackage, createNativePipelineFromPackage, createNativePipelineFromPackageFile, create_native_pipeline_from_default_package, deanonymise, diagnostics_json, diagnostics_stream_json, encodeNativeSearchConfig, encodeNativeSearchConfigInput, exportRedactionKey, getDefaultNativePipeline, getNativeBindingVersion, getNativePipelineCompatibility, get_default_native_pipeline, loadNativeAnonymizeBinding, load_prepared_package, load_prepared_package_file, native_package_version, normalize_for_search, preloadDefaultNativePipeline, preloadDefaultNativePipelineAsync, preload_default_native_pipeline, prepareNativePipelineConfig, prepareNativePipelinePackage, prepareNativeSearchPackage, prepare_search_package, readDefaultNativePipelinePackageFile, readDefaultNativePipelinePackageFileAsync, readNativePipelinePackageFile, readNativePipelinePackageFileAsync, read_default_native_pipeline_package_file, redactDefaultText, redactDefaultTextJson, redact_default_text, redact_default_text_json, redact_text, redact_text_json, redact_text_stream_json, summary_diagnostics_json };
|
|
30
30
|
|
|
31
31
|
//# sourceMappingURL=index.mjs.map
|
package/dist/native.d.mts
CHANGED
|
@@ -143,6 +143,8 @@ type NativeTriggerData = {
|
|
|
143
143
|
};
|
|
144
144
|
type NativeLegalFormData = {
|
|
145
145
|
suffixes: string[];
|
|
146
|
+
detection_only_suffixes: string[];
|
|
147
|
+
institutional_heads: string[];
|
|
146
148
|
normalized_boundary_suffixes: string[];
|
|
147
149
|
normalized_in_name_words: string[];
|
|
148
150
|
normalized_suffix_words: string[];
|
|
@@ -158,11 +160,17 @@ type NativeLegalFormData = {
|
|
|
158
160
|
in_name_prepositions: string[];
|
|
159
161
|
company_suffix_words: string[];
|
|
160
162
|
comma_gated_direct_prefixes: string[];
|
|
163
|
+
institutional_complement_heads: string[];
|
|
164
|
+
institutional_complement_starters: string[];
|
|
165
|
+
institutional_complement_connectors: string[];
|
|
166
|
+
institutional_generic_words: string[];
|
|
167
|
+
institutional_prefix_generic_words: string[];
|
|
161
168
|
};
|
|
162
169
|
type NativeDateMonthData = Record<string, string[]>;
|
|
163
170
|
type NativeYearWordData = Record<string, string[]>;
|
|
164
171
|
type NativeDateData = {
|
|
165
172
|
month_names_by_language: NativeDateMonthData;
|
|
173
|
+
lowercase_month_ambiguities: NativeDateMonthData;
|
|
166
174
|
year_words_by_language: NativeYearWordData;
|
|
167
175
|
};
|
|
168
176
|
type NativeMonetaryData = {
|
|
@@ -266,6 +274,8 @@ type NativeSignatureData = {
|
|
|
266
274
|
name_particles: string[];
|
|
267
275
|
post_nominal_suffixes: string[];
|
|
268
276
|
organization_suffixes: string[];
|
|
277
|
+
form_field_labels: string[];
|
|
278
|
+
signature_stamp_phrases: string[];
|
|
269
279
|
image_stub_prefixes: string[];
|
|
270
280
|
};
|
|
271
281
|
type NativePreparedSearchConfig = {
|
|
@@ -840,6 +850,13 @@ type NativePreparedSearchBinding = {
|
|
|
840
850
|
redactStaticEntitiesSummaryDiagnosticsJson?: (fullText: string, operators?: NativeBindingOperatorConfig) => string;
|
|
841
851
|
};
|
|
842
852
|
type NativeAnonymizeBinding = {
|
|
853
|
+
extractDocxTextJson?: (document: Uint8Array) => string;
|
|
854
|
+
rewriteDocxTextNative?: (document: Uint8Array, rewritesJson: string) => {
|
|
855
|
+
document: Uint8Array;
|
|
856
|
+
rewrittenBlockCount: number;
|
|
857
|
+
appliedReplacementCount: number;
|
|
858
|
+
};
|
|
859
|
+
planDocxRestorationJson?: (document: Uint8Array, sessionId: string) => string;
|
|
843
860
|
normalizeForSearch: (text: string) => string;
|
|
844
861
|
nativePackageVersion: () => string;
|
|
845
862
|
NativePreparedSearch: {
|
package/dist/native.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.mjs","names":["#session","#plan","#prepared","#anonymizer"],"sources":["../src/native.ts"],"sourcesContent":["import type { NativePreparedSearchConfig } from \"./native-search-config\";\nimport type { OperatorSelection, OperatorType } from \"./types\";\n\nexport type { NativePreparedSearchConfig } from \"./native-search-config\";\n\ntype NativeBindingOperatorConfig = {\n operators?: Record<string, OperatorSelection>;\n redactString?: string;\n};\n\ntype NativeBindingCallerRedactionOptions = {\n requestJson: string;\n operators?: NativeBindingOperatorConfig;\n};\n\ntype NativeBindingSessionCallerRedactionInput = {\n fullText: string;\n requestJson: string;\n};\n\ntype NativeBindingSessionCallerRedactionPlanOptions = {\n inputs: NativeBindingSessionCallerRedactionInput[];\n operators?: NativeBindingOperatorConfig;\n observedAtEpochSeconds?: number;\n};\n\ntype NativeBindingOpenSessionArchiveOptions = {\n archive: Uint8Array;\n key: Uint8Array;\n expectedSessionId: string;\n observedAtEpochSeconds?: number;\n};\n\nexport type NativeDiagnosticsBatchCallback = (diagnosticsJson: string) => void;\nexport type NativeResultEventCallback = (eventJson: string) => void;\n\ntype NativeBindingRedactionEntry = {\n placeholder: string;\n original: string;\n};\n\ntype NativeBindingOperatorEntry = {\n placeholder: string;\n operator: OperatorType;\n};\n\ntype NativeBindingPipelineEntity = {\n start: number;\n end: number;\n label: string;\n text: string;\n score: number;\n source: string;\n sourceDetail?: string | null;\n providerId?: string | null;\n detectionId?: string | null;\n};\n\ntype NativeBindingRedactionResult = {\n redactedText: string;\n redactionMap: NativeBindingRedactionEntry[];\n operatorMap: NativeBindingOperatorEntry[];\n entityCount: number;\n};\n\ntype NativeBindingStaticRedactionResult = {\n resolvedEntities: NativeBindingPipelineEntity[];\n redaction: NativeBindingRedactionResult;\n};\n\ntype CanonicalPipelineEntity = {\n start: number;\n end: number;\n label: string;\n text: string;\n score: number;\n source: string;\n source_detail?: string | null;\n provider_id?: string | null;\n detection_id?: string | null;\n};\n\ntype CanonicalStaticRedactionResult = {\n resolved_entities: CanonicalPipelineEntity[];\n redaction: {\n redacted_text: string;\n redaction_map: NativeBindingRedactionEntry[];\n operator_map: NativeBindingOperatorEntry[];\n entity_count: number;\n };\n};\n\ntype CanonicalSessionMetadata = {\n session_id: string;\n created_at_epoch_seconds: number | null;\n expires_at_epoch_seconds: number | null;\n mapping_count: number;\n status: NativeSessionStatus;\n};\n\ntype CanonicalSessionDeletionSummary = {\n session_id: string;\n deleted_mapping_count: number;\n};\n\ntype CanonicalSessionRedactionPlanResult = {\n replacements: Array<{\n start: number;\n end: number;\n replacement: string;\n }>;\n entity_count: number;\n caller_entity_count: number;\n};\n\nexport type NativeSessionStatus =\n | \"active\"\n | \"not_yet_active\"\n | \"expired\"\n | \"deleted\";\n\nexport type NativeSessionLifecycle = {\n createdAtEpochSeconds: number;\n expiresAtEpochSeconds?: number;\n};\n\nexport type NativeSessionMetadata = {\n sessionId: string;\n createdAtEpochSeconds: number | null;\n expiresAtEpochSeconds: number | null;\n mappingCount: number;\n status: NativeSessionStatus;\n};\n\nexport type NativeSessionDeletionSummary = {\n sessionId: string;\n deletedMappingCount: number;\n};\n\nexport type NativeSessionRedactionAtOptions = {\n fullText: string;\n observedAtEpochSeconds: number;\n operators?: NativeOperatorConfig;\n};\n\nexport type NativeCreateSessionWithLifecycleOptions = NativeSessionLifecycle & {\n sessionId: string;\n};\n\nexport type NativeOpenSessionArchiveOptions = {\n archive: Uint8Array;\n key: Uint8Array;\n expectedSessionId: string;\n observedAtEpochSeconds?: number;\n};\n\nexport type NativePreparedRedactionSessionBinding = {\n sessionId: () => string;\n mappingCount: () => number;\n restoreText?: (fullText: string) => string;\n restoreTextAt?: (fullText: string, observedAtEpochSeconds: number) => string;\n toPlaintextJson: () => string;\n toPlaintextJsonAt?: (observedAtEpochSeconds: number) => string;\n toEncryptedArchive?: (key: Uint8Array) => Uint8Array;\n toEncryptedArchiveAt?: (\n key: Uint8Array,\n observedAtEpochSeconds: number,\n ) => Uint8Array;\n inspectJson?: (observedAtEpochSeconds?: number) => string;\n deleteJson?: () => string;\n redactStaticEntitiesJson: (\n fullText: string,\n operators?: NativeBindingOperatorConfig,\n ) => string;\n redactStaticEntitiesJsonAt?: (\n fullText: string,\n observedAtEpochSeconds: number,\n operators?: NativeBindingOperatorConfig,\n ) => string;\n planStaticEntitiesWithCallerDetections?: (\n options: NativeBindingSessionCallerRedactionPlanOptions,\n ) => NativePreparedSessionRedactionPlanBinding;\n};\n\nexport type NativePreparedSessionRedactionPlanBinding = {\n resultJson: () => string;\n commit: () => void;\n};\n\nexport type NativePreparedSearchBinding = {\n prepareDiagnosticsJson?: () => string;\n warmLazyRegex?: () => void;\n warm_lazy_regex?: () => void;\n warmLazyRegexDiagnosticsJson?: () => string;\n warm_lazy_regex_diagnostics_json?: () => string;\n createRedactionSession?: (\n sessionId: string,\n ) => NativePreparedRedactionSessionBinding;\n createRedactionSessionWithLifecycle?: (\n sessionId: string,\n createdAtEpochSeconds: number,\n expiresAtEpochSeconds?: number,\n ) => NativePreparedRedactionSessionBinding;\n restoreRedactionSession?: (\n plaintextJson: string,\n ) => NativePreparedRedactionSessionBinding;\n restoreEncryptedRedactionSession?: (\n options: NativeBindingOpenSessionArchiveOptions,\n ) => NativePreparedRedactionSessionBinding;\n redactStaticEntities: (\n fullText: string,\n operators?: NativeBindingOperatorConfig,\n ) => NativeBindingStaticRedactionResult;\n redactStaticEntitiesJson?: (\n fullText: string,\n operators?: NativeBindingOperatorConfig,\n ) => string;\n redactStaticEntitiesWithCallerDetectionsJson?: (\n fullText: string,\n options: NativeBindingCallerRedactionOptions,\n ) => string;\n redactStaticEntitiesWithCallerDetectionsDiagnosticsJson?: (\n fullText: string,\n options: NativeBindingCallerRedactionOptions,\n ) => string;\n redactStaticEntitiesResultStreamJson?: (\n fullText: string,\n operators: NativeBindingOperatorConfig | undefined,\n onEvent: NativeResultEventCallback,\n ) => string;\n redactStaticEntitiesDiagnosticsJson?: (\n fullText: string,\n operators?: NativeBindingOperatorConfig,\n ) => string;\n redactStaticEntitiesDiagnosticsStreamJson?: (\n fullText: string,\n operators: NativeBindingOperatorConfig | undefined,\n onBatch: NativeDiagnosticsBatchCallback,\n ) => string;\n redactStaticEntitiesSummaryDiagnosticsJson?: (\n fullText: string,\n operators?: NativeBindingOperatorConfig,\n ) => string;\n};\n\nexport type NativeAnonymizeBinding = {\n normalizeForSearch: (text: string) => string;\n nativePackageVersion: () => string;\n NativePreparedSearch: {\n fromConfigJsonBytes: (\n configJson: Uint8Array,\n ) => NativePreparedSearchBinding;\n fromPreparedPackageBytes: (\n packageBytes: Uint8Array,\n ) => NativePreparedSearchBinding;\n fromPreparedPackageBytesWithoutCache?: (\n packageBytes: Uint8Array,\n ) => NativePreparedSearchBinding;\n fromTrustedPreparedPackageBytes?: (\n packageBytes: Uint8Array,\n ) => NativePreparedSearchBinding;\n fromTrustedPreparedPackageBytesWithoutCache?: (\n packageBytes: Uint8Array,\n ) => NativePreparedSearchBinding;\n };\n prepareStaticSearchPackageBytes: (configJson: Uint8Array) => Uint8Array;\n prepareStaticSearchCompressedPackageBytes: (\n configJson: Uint8Array,\n ) => Uint8Array;\n // Rust config assembler (replaces the retired TypeScript config-assembly\n // layer). Takes the pipeline config plus out-of-band dictionaries and\n // gazetteer JSON and returns either the assembled config JSON or ready\n // package bytes. Optional so older bindings without the assembler still\n // satisfy the type; native-node loads them from the same `.node`.\n assembleStaticSearchConfigJson?: (\n pipelineConfigJson: Uint8Array,\n dictionariesJson?: Uint8Array,\n gazetteerJson?: Uint8Array,\n ) => Uint8Array;\n assembleStaticSearchPackageBytes?: (\n pipelineConfigJson: Uint8Array,\n dictionariesJson?: Uint8Array,\n gazetteerJson?: Uint8Array,\n ) => Uint8Array;\n assembleStaticSearchCompressedPackageBytes?: (\n pipelineConfigJson: Uint8Array,\n dictionariesJson?: Uint8Array,\n gazetteerJson?: Uint8Array,\n ) => Uint8Array;\n};\n\nexport type NativeOperatorConfig = {\n operators?: Record<string, OperatorSelection>;\n redactString?: string;\n};\n\nexport const CALLER_DETECTION_CONTRACT_VERSION = 2;\n\nexport type NativeCallerDetection = {\n start: number;\n end: number;\n label: string;\n score: number;\n providerId: string;\n detectionId: string;\n};\n\nexport type NativeCallerRedactionOptions = {\n detections: readonly NativeCallerDetection[];\n operators?: NativeOperatorConfig;\n};\n\nexport type NativeSessionCallerRedactionInput = {\n fullText: string;\n detections: readonly NativeCallerDetection[];\n};\n\nexport type NativeSessionCallerRedactionPlanOptions = {\n inputs: readonly NativeSessionCallerRedactionInput[];\n operators?: NativeOperatorConfig;\n observedAtEpochSeconds?: number;\n};\n\nexport type NativeTextReplacement = {\n start: number;\n end: number;\n replacement: string;\n};\n\nexport type NativeSessionBlockRedactionPlan = {\n replacements: readonly NativeTextReplacement[];\n entityCount: number;\n callerEntityCount: number;\n};\n\nconst callerDetectionRequestJson = (\n detections: readonly NativeCallerDetection[],\n): string =>\n JSON.stringify({\n version: CALLER_DETECTION_CONTRACT_VERSION,\n detections: detections.map((detection) => ({\n start: detection.start,\n end: detection.end,\n label: detection.label,\n score: detection.score,\n provider_id: detection.providerId,\n detection_id: detection.detectionId,\n })),\n });\n\nexport type NativePipelineEntity = {\n start: number;\n end: number;\n label: string;\n text: string;\n score: number;\n source: string;\n sourceDetail?: string;\n providerId?: string;\n detectionId?: string;\n};\n\nexport type NativeRedactionResult = {\n redactedText: string;\n redactionMap: Map<string, string>;\n operatorMap: Map<string, OperatorType>;\n entityCount: number;\n};\n\nexport type NativeStaticRedactionResult = {\n resolvedEntities: NativePipelineEntity[];\n redaction: NativeRedactionResult;\n};\n\nexport type NativeSearchPackageOptions = {\n binding: NativeAnonymizeBinding;\n config: NativePreparedSearchConfig;\n compressed?: boolean;\n};\n\nexport type NativeSearchPackageInput =\n | NativePreparedSearchConfig\n | string\n | Uint8Array;\n\nexport type SharedNativeSearchPackageOptions = {\n binding: NativeAnonymizeBinding;\n config: NativeSearchPackageInput;\n compressed?: boolean;\n};\n\nexport type SharedNativePreparedPackageOptions = {\n binding: NativeAnonymizeBinding;\n packageBytes: Uint8Array;\n};\n\nexport type SharedNativeRedactTextJsonOptions = {\n binding: NativeAnonymizeBinding;\n config: NativeSearchPackageInput;\n fullText: string;\n operators?: NativeOperatorConfig;\n};\n\nexport type SharedNativeRedactTextOptions = SharedNativeRedactTextJsonOptions;\n\nexport type SharedNativeDiagnosticsJsonOptions =\n SharedNativeRedactTextJsonOptions;\n\nexport type SharedNativeDiagnosticsStreamJsonOptions =\n SharedNativeRedactTextJsonOptions & {\n onBatch: NativeDiagnosticsBatchCallback;\n };\n\nexport type SharedNativeRedactTextStreamJsonOptions =\n SharedNativeRedactTextJsonOptions & {\n onEvent: NativeResultEventCallback;\n };\n\nexport type NativeNormalizeOptions = {\n binding: NativeAnonymizeBinding;\n text: string;\n};\n\nexport type NativeAnonymizerFromConfigOptions = {\n binding: NativeAnonymizeBinding;\n config: NativePreparedSearchConfig;\n};\n\nexport type NativeAnonymizerFromPackageOptions = {\n binding: NativeAnonymizeBinding;\n packageBytes: Uint8Array;\n};\n\nexport type NativePipelineFromPackageOptions =\n NativeAnonymizerFromPackageOptions;\n\nexport type NativeBindingVersionOptions = {\n binding: NativeAnonymizeBinding;\n expectedVersion: string;\n};\n\nexport class PreparedNativeRedactionSession {\n readonly #session: NativePreparedRedactionSessionBinding;\n\n constructor(session: NativePreparedRedactionSessionBinding) {\n this.#session = session;\n }\n\n sessionId(): string {\n return this.#session.sessionId();\n }\n\n session_id(): string {\n return this.sessionId();\n }\n\n mappingCount(): number {\n return this.#session.mappingCount();\n }\n\n mapping_count(): number {\n return this.mappingCount();\n }\n\n restoreText(fullText: string, observedAtEpochSeconds?: number): string {\n if (observedAtEpochSeconds === undefined) {\n const restore = this.#session.restoreText;\n if (!restore) {\n throw new Error(\n \"Native anonymize binding does not support session restoration\",\n );\n }\n return restore.call(this.#session, fullText);\n }\n const restore = this.#session.restoreTextAt;\n if (!restore) {\n throw new Error(\n \"Native anonymize binding does not support session restoration lifecycle controls\",\n );\n }\n return restore.call(this.#session, fullText, observedAtEpochSeconds);\n }\n\n restore_text(fullText: string, observedAtEpochSeconds?: number): string {\n return this.restoreText(fullText, observedAtEpochSeconds);\n }\n\n toPlaintextJson(): string {\n return this.#session.toPlaintextJson();\n }\n\n to_plaintext_json(): string {\n return this.toPlaintextJson();\n }\n\n toPlaintextJsonAt(observedAtEpochSeconds: number): string {\n const serialize = this.#session.toPlaintextJsonAt;\n if (!serialize) {\n throw new Error(\n \"Native anonymize binding does not support session lifecycle controls\",\n );\n }\n return serialize.call(this.#session, observedAtEpochSeconds);\n }\n\n to_plaintext_json_at(observedAtEpochSeconds: number): string {\n return this.toPlaintextJsonAt(observedAtEpochSeconds);\n }\n\n toEncryptedArchive(key: Uint8Array): Uint8Array {\n const serialize = this.#session.toEncryptedArchive;\n if (!serialize) {\n throw new Error(\n \"Native anonymize binding does not support encrypted session archives\",\n );\n }\n return serialize.call(this.#session, key);\n }\n\n to_encrypted_archive(key: Uint8Array): Uint8Array {\n return this.toEncryptedArchive(key);\n }\n\n toEncryptedArchiveAt(\n key: Uint8Array,\n observedAtEpochSeconds: number,\n ): Uint8Array {\n const serialize = this.#session.toEncryptedArchiveAt;\n if (!serialize) {\n throw new Error(\n \"Native anonymize binding does not support encrypted session archives\",\n );\n }\n return serialize.call(this.#session, key, observedAtEpochSeconds);\n }\n\n to_encrypted_archive_at(\n key: Uint8Array,\n observedAtEpochSeconds: number,\n ): Uint8Array {\n return this.toEncryptedArchiveAt(key, observedAtEpochSeconds);\n }\n\n inspect(observedAtEpochSeconds?: number): NativeSessionMetadata {\n const inspect = this.#session.inspectJson;\n if (!inspect) {\n throw new Error(\n \"Native anonymize binding does not support session lifecycle controls\",\n );\n }\n const metadata: CanonicalSessionMetadata = JSON.parse(\n inspect.call(this.#session, observedAtEpochSeconds),\n );\n return {\n sessionId: metadata.session_id,\n createdAtEpochSeconds: metadata.created_at_epoch_seconds,\n expiresAtEpochSeconds: metadata.expires_at_epoch_seconds,\n mappingCount: metadata.mapping_count,\n status: metadata.status,\n };\n }\n\n delete(): NativeSessionDeletionSummary {\n const deleteSession = this.#session.deleteJson;\n if (!deleteSession) {\n throw new Error(\n \"Native anonymize binding does not support session lifecycle controls\",\n );\n }\n const summary: CanonicalSessionDeletionSummary = JSON.parse(\n deleteSession.call(this.#session),\n );\n return {\n sessionId: summary.session_id,\n deletedMappingCount: summary.deleted_mapping_count,\n };\n }\n\n redactStaticEntities(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): NativeStaticRedactionResult {\n const result: CanonicalStaticRedactionResult = JSON.parse(\n this.redact_text_json(fullText, operators),\n );\n return fromCanonicalStaticRedactionResult(result);\n }\n\n redactText(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): NativeStaticRedactionResult {\n return this.redactStaticEntities(fullText, operators);\n }\n\n redact_text(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): NativeStaticRedactionResult {\n return this.redactText(fullText, operators);\n }\n\n redactTextJson(fullText: string, operators?: NativeOperatorConfig): string {\n return this.redact_text_json(fullText, operators);\n }\n\n redact_text_json(fullText: string, operators?: NativeOperatorConfig): string {\n return this.#session.redactStaticEntitiesJson(\n fullText,\n toBindingOperatorConfig(operators),\n );\n }\n\n redactStaticEntitiesAt(\n options: NativeSessionRedactionAtOptions,\n ): NativeStaticRedactionResult {\n const result: CanonicalStaticRedactionResult = JSON.parse(\n this.redactTextJsonAt(options),\n );\n return fromCanonicalStaticRedactionResult(result);\n }\n\n redactTextAt(\n options: NativeSessionRedactionAtOptions,\n ): NativeStaticRedactionResult {\n return this.redactStaticEntitiesAt(options);\n }\n\n redact_text_at(\n options: NativeSessionRedactionAtOptions,\n ): NativeStaticRedactionResult {\n return this.redactTextAt(options);\n }\n\n redact_static_entities_at(\n options: NativeSessionRedactionAtOptions,\n ): NativeStaticRedactionResult {\n return this.redactStaticEntitiesAt(options);\n }\n\n redactTextJsonAt({\n fullText,\n observedAtEpochSeconds,\n operators,\n }: NativeSessionRedactionAtOptions): string {\n const redact = this.#session.redactStaticEntitiesJsonAt;\n if (!redact) {\n throw new Error(\n \"Native anonymize binding does not support session lifecycle controls\",\n );\n }\n return redact.call(\n this.#session,\n fullText,\n observedAtEpochSeconds,\n toBindingOperatorConfig(operators),\n );\n }\n\n redact_text_json_at(options: NativeSessionRedactionAtOptions): string {\n return this.redactTextJsonAt(options);\n }\n\n planTextBatchWithCallerDetections({\n inputs,\n operators,\n observedAtEpochSeconds,\n }: NativeSessionCallerRedactionPlanOptions): PreparedNativeSessionRedactionPlan {\n const plan = this.#session.planStaticEntitiesWithCallerDetections;\n if (!plan) {\n throw new Error(\n \"Native anonymize binding does not support transactional caller-detection session plans\",\n );\n }\n const bindingOperators = toBindingOperatorConfig(operators);\n const bindingPlan = plan.call(this.#session, {\n inputs: inputs.map(({ detections, fullText }) => ({\n fullText,\n requestJson: callerDetectionRequestJson(detections),\n })),\n ...(bindingOperators === undefined\n ? {}\n : { operators: bindingOperators }),\n ...(observedAtEpochSeconds === undefined\n ? {}\n : { observedAtEpochSeconds }),\n });\n return new PreparedNativeSessionRedactionPlan(bindingPlan);\n }\n}\n\nexport class PreparedNativeSessionRedactionPlan {\n readonly blocks: readonly NativeSessionBlockRedactionPlan[];\n readonly #plan: NativePreparedSessionRedactionPlanBinding;\n\n constructor(plan: NativePreparedSessionRedactionPlanBinding) {\n this.#plan = plan;\n const blocks: CanonicalSessionRedactionPlanResult[] = JSON.parse(\n plan.resultJson(),\n );\n this.blocks = blocks.map(\n ({ caller_entity_count, entity_count, replacements }) => ({\n replacements,\n entityCount: entity_count,\n callerEntityCount: caller_entity_count,\n }),\n );\n }\n\n commit(): void {\n this.#plan.commit();\n }\n}\n\nexport class PreparedNativeAnonymizer {\n readonly #prepared: NativePreparedSearchBinding;\n\n constructor(prepared: NativePreparedSearchBinding) {\n this.#prepared = prepared;\n }\n\n prepareDiagnosticsJson(): string | null {\n return this.#prepared.prepareDiagnosticsJson?.() ?? null;\n }\n\n prepare_diagnostics_json(): string | null {\n return this.prepareDiagnosticsJson();\n }\n\n warmLazyRegex(): void {\n if (this.#prepared.warmLazyRegex) {\n this.#prepared.warmLazyRegex();\n return;\n }\n this.#prepared.warm_lazy_regex?.();\n }\n\n warm_lazy_regex(): void {\n this.warmLazyRegex();\n }\n\n warmLazyRegexDiagnosticsJson(): string | null {\n if (this.#prepared.warmLazyRegexDiagnosticsJson) {\n return this.#prepared.warmLazyRegexDiagnosticsJson();\n }\n return this.#prepared.warm_lazy_regex_diagnostics_json?.() ?? null;\n }\n\n warm_lazy_regex_diagnostics_json(): string | null {\n return this.warmLazyRegexDiagnosticsJson();\n }\n\n createRedactionSession(sessionId: string): PreparedNativeRedactionSession {\n const create = this.#prepared.createRedactionSession;\n if (!create) {\n throw new Error(\n \"Native anonymize binding does not support redaction sessions\",\n );\n }\n return new PreparedNativeRedactionSession(\n create.call(this.#prepared, sessionId),\n );\n }\n\n create_redaction_session(sessionId: string): PreparedNativeRedactionSession {\n return this.createRedactionSession(sessionId);\n }\n\n createRedactionSessionWithLifecycle({\n sessionId,\n createdAtEpochSeconds,\n expiresAtEpochSeconds,\n }: NativeCreateSessionWithLifecycleOptions): PreparedNativeRedactionSession {\n const create = this.#prepared.createRedactionSessionWithLifecycle;\n if (!create) {\n throw new Error(\n \"Native anonymize binding does not support session lifecycle controls\",\n );\n }\n return new PreparedNativeRedactionSession(\n create.call(\n this.#prepared,\n sessionId,\n createdAtEpochSeconds,\n expiresAtEpochSeconds,\n ),\n );\n }\n\n create_redaction_session_with_lifecycle(\n options: NativeCreateSessionWithLifecycleOptions,\n ): PreparedNativeRedactionSession {\n return this.createRedactionSessionWithLifecycle(options);\n }\n\n restoreRedactionSession(\n plaintextJson: string,\n ): PreparedNativeRedactionSession {\n const restore = this.#prepared.restoreRedactionSession;\n if (!restore) {\n throw new Error(\n \"Native anonymize binding does not support redaction sessions\",\n );\n }\n return new PreparedNativeRedactionSession(\n restore.call(this.#prepared, plaintextJson),\n );\n }\n\n restore_redaction_session(\n plaintextJson: string,\n ): PreparedNativeRedactionSession {\n return this.restoreRedactionSession(plaintextJson);\n }\n\n restoreEncryptedRedactionSession({\n archive,\n key,\n expectedSessionId,\n observedAtEpochSeconds,\n }: NativeOpenSessionArchiveOptions): PreparedNativeRedactionSession {\n const restore = this.#prepared.restoreEncryptedRedactionSession;\n if (!restore) {\n throw new Error(\n \"Native anonymize binding does not support encrypted session archives\",\n );\n }\n return new PreparedNativeRedactionSession(\n restore.call(this.#prepared, {\n archive,\n key,\n expectedSessionId,\n ...(observedAtEpochSeconds === undefined\n ? {}\n : { observedAtEpochSeconds }),\n }),\n );\n }\n\n restore_encrypted_redaction_session(\n options: NativeOpenSessionArchiveOptions,\n ): PreparedNativeRedactionSession {\n return this.restoreEncryptedRedactionSession(options);\n }\n\n redactStaticEntities(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): NativeStaticRedactionResult {\n return toNativeStaticRedactionResult(\n this.#prepared.redactStaticEntities(\n fullText,\n toBindingOperatorConfig(operators),\n ),\n );\n }\n\n redact_text(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): NativeStaticRedactionResult {\n return this.redactStaticEntities(fullText, operators);\n }\n\n redact_text_json(fullText: string, operators?: NativeOperatorConfig): string {\n const bindingOperators = toBindingOperatorConfig(operators);\n if (this.#prepared.redactStaticEntitiesJson) {\n return this.#prepared.redactStaticEntitiesJson(\n fullText,\n bindingOperators,\n );\n }\n return JSON.stringify(\n toBindingStaticRedactionResult(\n toNativeStaticRedactionResult(\n this.#prepared.redactStaticEntities(fullText, bindingOperators),\n ),\n ),\n );\n }\n\n redactStaticEntitiesWithCallerDetections(\n fullText: string,\n options: NativeCallerRedactionOptions,\n ): NativeStaticRedactionResult {\n if (!this.#prepared.redactStaticEntitiesWithCallerDetectionsJson) {\n throw new Error(\n \"Native anonymize binding does not support caller detections\",\n );\n }\n const requestJson = callerDetectionRequestJson(options.detections);\n const operators = toBindingOperatorConfig(options.operators);\n const result: CanonicalStaticRedactionResult = JSON.parse(\n this.#prepared.redactStaticEntitiesWithCallerDetectionsJson(fullText, {\n requestJson,\n ...(operators ? { operators } : {}),\n }),\n );\n return fromCanonicalStaticRedactionResult(result);\n }\n\n redact_text_with_caller_detections(\n fullText: string,\n options: NativeCallerRedactionOptions,\n ): NativeStaticRedactionResult {\n return this.redactStaticEntitiesWithCallerDetections(fullText, options);\n }\n\n redactStaticEntitiesWithCallerDetectionsDiagnosticsJson(\n fullText: string,\n options: NativeCallerRedactionOptions,\n ): string | null {\n const redact =\n this.#prepared.redactStaticEntitiesWithCallerDetectionsDiagnosticsJson;\n if (!redact) {\n return null;\n }\n const requestJson = callerDetectionRequestJson(options.detections);\n const operators = toBindingOperatorConfig(options.operators);\n return redact.call(this.#prepared, fullText, {\n requestJson,\n ...(operators ? { operators } : {}),\n });\n }\n\n redact_static_entities_with_caller_detections_diagnostics_json(\n fullText: string,\n options: NativeCallerRedactionOptions,\n ): string | null {\n return this.redactStaticEntitiesWithCallerDetectionsDiagnosticsJson(\n fullText,\n options,\n );\n }\n\n redactTextJson(fullText: string, operators?: NativeOperatorConfig): string {\n return this.redact_text_json(fullText, operators);\n }\n\n redactTextStreamJson(\n fullText: string,\n onEvent: NativeResultEventCallback,\n operators?: NativeOperatorConfig,\n ): string | null {\n if (!this.#prepared.redactStaticEntitiesResultStreamJson) {\n return null;\n }\n return this.#prepared.redactStaticEntitiesResultStreamJson(\n fullText,\n toBindingOperatorConfig(operators),\n onEvent,\n );\n }\n\n redact_text_stream_json(\n fullText: string,\n onEvent: NativeResultEventCallback,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.redactTextStreamJson(fullText, onEvent, operators);\n }\n\n redactStaticEntitiesDiagnosticsJson(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): string | null {\n if (!this.#prepared.redactStaticEntitiesDiagnosticsJson) {\n return null;\n }\n return this.#prepared.redactStaticEntitiesDiagnosticsJson(\n fullText,\n toBindingOperatorConfig(operators),\n );\n }\n\n diagnostics_json(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.redactStaticEntitiesDiagnosticsJson(fullText, operators);\n }\n\n diagnosticsStreamJson(\n fullText: string,\n onBatch: NativeDiagnosticsBatchCallback,\n operators?: NativeOperatorConfig,\n ): string | null {\n if (!this.#prepared.redactStaticEntitiesDiagnosticsStreamJson) {\n return null;\n }\n return this.#prepared.redactStaticEntitiesDiagnosticsStreamJson(\n fullText,\n toBindingOperatorConfig(operators),\n onBatch,\n );\n }\n\n diagnostics_stream_json(\n fullText: string,\n onBatch: NativeDiagnosticsBatchCallback,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.diagnosticsStreamJson(fullText, onBatch, operators);\n }\n\n redactStaticEntitiesSummaryDiagnosticsJson(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): string | null {\n if (!this.#prepared.redactStaticEntitiesSummaryDiagnosticsJson) {\n return null;\n }\n return this.#prepared.redactStaticEntitiesSummaryDiagnosticsJson(\n fullText,\n toBindingOperatorConfig(operators),\n );\n }\n\n summary_diagnostics_json(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.redactStaticEntitiesSummaryDiagnosticsJson(fullText, operators);\n }\n}\n\nexport class PreparedNativePipeline {\n readonly #anonymizer: PreparedNativeAnonymizer;\n\n constructor(anonymizer: PreparedNativeAnonymizer) {\n this.#anonymizer = anonymizer;\n }\n\n prepareDiagnosticsJson(): string | null {\n return this.#anonymizer.prepareDiagnosticsJson();\n }\n\n prepare_diagnostics_json(): string | null {\n return this.prepareDiagnosticsJson();\n }\n\n warmLazyRegex(): void {\n this.#anonymizer.warmLazyRegex();\n }\n\n warm_lazy_regex(): void {\n this.warmLazyRegex();\n }\n\n warmLazyRegexDiagnosticsJson(): string | null {\n return this.#anonymizer.warmLazyRegexDiagnosticsJson();\n }\n\n warm_lazy_regex_diagnostics_json(): string | null {\n return this.warmLazyRegexDiagnosticsJson();\n }\n\n createRedactionSession(sessionId: string): PreparedNativeRedactionSession {\n return this.#anonymizer.createRedactionSession(sessionId);\n }\n\n create_redaction_session(sessionId: string): PreparedNativeRedactionSession {\n return this.createRedactionSession(sessionId);\n }\n\n createRedactionSessionWithLifecycle(\n options: NativeCreateSessionWithLifecycleOptions,\n ): PreparedNativeRedactionSession {\n return this.#anonymizer.createRedactionSessionWithLifecycle(options);\n }\n\n create_redaction_session_with_lifecycle(\n options: NativeCreateSessionWithLifecycleOptions,\n ): PreparedNativeRedactionSession {\n return this.createRedactionSessionWithLifecycle(options);\n }\n\n restoreRedactionSession(\n plaintextJson: string,\n ): PreparedNativeRedactionSession {\n return this.#anonymizer.restoreRedactionSession(plaintextJson);\n }\n\n restore_redaction_session(\n plaintextJson: string,\n ): PreparedNativeRedactionSession {\n return this.restoreRedactionSession(plaintextJson);\n }\n\n restoreEncryptedRedactionSession(\n options: NativeOpenSessionArchiveOptions,\n ): PreparedNativeRedactionSession {\n return this.#anonymizer.restoreEncryptedRedactionSession(options);\n }\n\n restore_encrypted_redaction_session(\n options: NativeOpenSessionArchiveOptions,\n ): PreparedNativeRedactionSession {\n return this.restoreEncryptedRedactionSession(options);\n }\n\n redactText(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): NativeStaticRedactionResult {\n return this.#anonymizer.redactStaticEntities(fullText, operators);\n }\n\n redact_text(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): NativeStaticRedactionResult {\n return this.redactText(fullText, operators);\n }\n\n redact_text_json(fullText: string, operators?: NativeOperatorConfig): string {\n return this.#anonymizer.redact_text_json(fullText, operators);\n }\n\n redactTextWithCallerDetections(\n fullText: string,\n options: NativeCallerRedactionOptions,\n ): NativeStaticRedactionResult {\n return this.#anonymizer.redactStaticEntitiesWithCallerDetections(\n fullText,\n options,\n );\n }\n\n redact_text_with_caller_detections(\n fullText: string,\n options: NativeCallerRedactionOptions,\n ): NativeStaticRedactionResult {\n return this.redactTextWithCallerDetections(fullText, options);\n }\n\n redactTextWithCallerDetectionsDiagnosticsJson(\n fullText: string,\n options: NativeCallerRedactionOptions,\n ): string | null {\n return this.#anonymizer.redactStaticEntitiesWithCallerDetectionsDiagnosticsJson(\n fullText,\n options,\n );\n }\n\n redact_text_with_caller_detections_diagnostics_json(\n fullText: string,\n options: NativeCallerRedactionOptions,\n ): string | null {\n return this.redactTextWithCallerDetectionsDiagnosticsJson(\n fullText,\n options,\n );\n }\n\n redactTextJson(fullText: string, operators?: NativeOperatorConfig): string {\n return this.redact_text_json(fullText, operators);\n }\n\n redactTextStreamJson(\n fullText: string,\n onEvent: NativeResultEventCallback,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.#anonymizer.redactTextStreamJson(fullText, onEvent, operators);\n }\n\n redact_text_stream_json(\n fullText: string,\n onEvent: NativeResultEventCallback,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.redactTextStreamJson(fullText, onEvent, operators);\n }\n\n redactTextDiagnosticsJson(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.#anonymizer.redactStaticEntitiesDiagnosticsJson(\n fullText,\n operators,\n );\n }\n\n diagnostics_json(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.redactTextDiagnosticsJson(fullText, operators);\n }\n\n diagnosticsStreamJson(\n fullText: string,\n onBatch: NativeDiagnosticsBatchCallback,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.#anonymizer.diagnosticsStreamJson(fullText, onBatch, operators);\n }\n\n diagnostics_stream_json(\n fullText: string,\n onBatch: NativeDiagnosticsBatchCallback,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.diagnosticsStreamJson(fullText, onBatch, operators);\n }\n\n redactTextSummaryDiagnosticsJson(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.#anonymizer.redactStaticEntitiesSummaryDiagnosticsJson(\n fullText,\n operators,\n );\n }\n\n summary_diagnostics_json(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.redactTextSummaryDiagnosticsJson(fullText, operators);\n }\n}\n\nexport const encodeNativeSearchConfig = (\n config: NativePreparedSearchConfig,\n): Uint8Array => new TextEncoder().encode(JSON.stringify(config));\n\nexport const encodeNativeSearchConfigInput = (\n config: NativeSearchPackageInput,\n): Uint8Array => {\n if (typeof config === \"string\") {\n return new TextEncoder().encode(config);\n }\n if (config instanceof Uint8Array) {\n return config;\n }\n return encodeNativeSearchConfig(config);\n};\n\nexport const getNativeBindingVersion = (\n binding: NativeAnonymizeBinding,\n): string => binding.nativePackageVersion();\n\nexport const native_package_version = getNativeBindingVersion;\n\nexport const normalize_for_search = ({\n binding,\n text,\n}: NativeNormalizeOptions): string => binding.normalizeForSearch(text);\n\nexport const assertNativeBindingVersion = ({\n binding,\n expectedVersion,\n}: NativeBindingVersionOptions): void => {\n const actualVersion = getNativeBindingVersion(binding);\n if (actualVersion !== expectedVersion) {\n throw new Error(\n `Native anonymize binding version ${actualVersion} does not match ${expectedVersion}`,\n );\n }\n};\n\nexport const prepareNativeSearchPackage = ({\n binding,\n config,\n compressed = false,\n}: NativeSearchPackageOptions): Uint8Array => {\n const configBytes = encodeNativeSearchConfig(config);\n return compressed\n ? binding.prepareStaticSearchCompressedPackageBytes(configBytes)\n : binding.prepareStaticSearchPackageBytes(configBytes);\n};\n\nexport const prepare_search_package = ({\n binding,\n config,\n compressed = false,\n}: SharedNativeSearchPackageOptions): Uint8Array => {\n const configBytes = encodeNativeSearchConfigInput(config);\n return compressed\n ? binding.prepareStaticSearchCompressedPackageBytes(configBytes)\n : binding.prepareStaticSearchPackageBytes(configBytes);\n};\n\nexport const createNativeAnonymizerFromConfig = ({\n binding,\n config,\n}: NativeAnonymizerFromConfigOptions): PreparedNativeAnonymizer =>\n new PreparedNativeAnonymizer(\n binding.NativePreparedSearch.fromConfigJsonBytes(\n encodeNativeSearchConfig(config),\n ),\n );\n\nexport const createNativeAnonymizerFromPackage = ({\n binding,\n packageBytes,\n}: NativeAnonymizerFromPackageOptions): PreparedNativeAnonymizer =>\n new PreparedNativeAnonymizer(\n binding.NativePreparedSearch.fromPreparedPackageBytes(packageBytes),\n );\n\nexport const load_prepared_package = ({\n binding,\n packageBytes,\n}: SharedNativePreparedPackageOptions): PreparedNativeAnonymizer =>\n createNativeAnonymizerFromPackage({ binding, packageBytes });\n\nexport const redact_text_json = ({\n binding,\n config,\n fullText,\n operators,\n}: SharedNativeRedactTextJsonOptions): string =>\n new PreparedNativeAnonymizer(\n binding.NativePreparedSearch.fromConfigJsonBytes(\n encodeNativeSearchConfigInput(config),\n ),\n ).redact_text_json(fullText, operators);\n\nexport const redact_text = ({\n binding,\n config,\n fullText,\n operators,\n}: SharedNativeRedactTextOptions): NativeStaticRedactionResult =>\n new PreparedNativeAnonymizer(\n binding.NativePreparedSearch.fromConfigJsonBytes(\n encodeNativeSearchConfigInput(config),\n ),\n ).redact_text(fullText, operators);\n\nexport const redact_text_stream_json = ({\n binding,\n config,\n fullText,\n operators,\n onEvent,\n}: SharedNativeRedactTextStreamJsonOptions): string | null =>\n new PreparedNativeAnonymizer(\n binding.NativePreparedSearch.fromConfigJsonBytes(\n encodeNativeSearchConfigInput(config),\n ),\n ).redact_text_stream_json(fullText, onEvent, operators);\n\nexport const diagnostics_json = ({\n binding,\n config,\n fullText,\n operators,\n}: SharedNativeDiagnosticsJsonOptions): string | null =>\n new PreparedNativeAnonymizer(\n binding.NativePreparedSearch.fromConfigJsonBytes(\n encodeNativeSearchConfigInput(config),\n ),\n ).diagnostics_json(fullText, operators);\n\nexport const diagnostics_stream_json = ({\n binding,\n config,\n fullText,\n operators,\n onBatch,\n}: SharedNativeDiagnosticsStreamJsonOptions): string | null =>\n new PreparedNativeAnonymizer(\n binding.NativePreparedSearch.fromConfigJsonBytes(\n encodeNativeSearchConfigInput(config),\n ),\n ).diagnostics_stream_json(fullText, onBatch, operators);\n\nexport const summary_diagnostics_json = ({\n binding,\n config,\n fullText,\n operators,\n}: SharedNativeDiagnosticsJsonOptions): string | null =>\n new PreparedNativeAnonymizer(\n binding.NativePreparedSearch.fromConfigJsonBytes(\n encodeNativeSearchConfigInput(config),\n ),\n ).summary_diagnostics_json(fullText, operators);\n\nexport const createNativePipelineFromPackage = ({\n binding,\n packageBytes,\n}: NativePipelineFromPackageOptions): PreparedNativePipeline =>\n new PreparedNativePipeline(\n createNativeAnonymizerFromPackage({ binding, packageBytes }),\n );\n\nexport const PreparedSearch = PreparedNativeAnonymizer;\nexport type PreparedSearch = PreparedNativeAnonymizer;\nexport const PreparedAnonymizer = PreparedNativeAnonymizer;\nexport type PreparedAnonymizer = PreparedNativeAnonymizer;\n\nconst toBindingOperatorConfig = (\n config: NativeOperatorConfig | undefined,\n): NativeBindingOperatorConfig | undefined => {\n if (!config) {\n return undefined;\n }\n const bindingConfig: NativeBindingOperatorConfig = {};\n if (config.operators !== undefined) {\n bindingConfig.operators = config.operators;\n }\n if (config.redactString !== undefined) {\n bindingConfig.redactString = config.redactString;\n }\n return bindingConfig;\n};\n\nconst toNativeStaticRedactionResult = (\n result: NativeBindingStaticRedactionResult,\n): NativeStaticRedactionResult => ({\n resolvedEntities: result.resolvedEntities.map(toNativePipelineEntity),\n redaction: toNativeRedactionResult(result.redaction),\n});\n\nconst fromCanonicalStaticRedactionResult = (\n result: CanonicalStaticRedactionResult,\n): NativeStaticRedactionResult => ({\n resolvedEntities: result.resolved_entities.map(\n ({ source_detail, provider_id, detection_id, ...entity }) => ({\n ...entity,\n ...(source_detail ? { sourceDetail: source_detail } : {}),\n ...(provider_id ? { providerId: provider_id } : {}),\n ...(detection_id ? { detectionId: detection_id } : {}),\n }),\n ),\n redaction: {\n redactedText: result.redaction.redacted_text,\n redactionMap: toRedactionMap(result.redaction.redaction_map),\n operatorMap: toOperatorMap(result.redaction.operator_map),\n entityCount: result.redaction.entity_count,\n },\n});\n\nconst toBindingStaticRedactionResult = (\n result: NativeStaticRedactionResult,\n): CanonicalStaticRedactionResult => ({\n resolved_entities: result.resolvedEntities.map(toBindingPipelineEntity),\n redaction: {\n redacted_text: result.redaction.redactedText,\n redaction_map: [...result.redaction.redactionMap.entries()].map(\n ([placeholder, original]) => ({ placeholder, original }),\n ),\n operator_map: [...result.redaction.operatorMap.entries()].map(\n ([placeholder, operator]) => ({ placeholder, operator }),\n ),\n entity_count: result.redaction.entityCount,\n },\n});\n\nconst toNativePipelineEntity = (\n entity: NativeBindingPipelineEntity,\n): NativePipelineEntity => ({\n start: entity.start,\n end: entity.end,\n label: entity.label,\n text: entity.text,\n score: entity.score,\n source: entity.source,\n ...(entity.sourceDetail ? { sourceDetail: entity.sourceDetail } : {}),\n ...(entity.providerId ? { providerId: entity.providerId } : {}),\n ...(entity.detectionId ? { detectionId: entity.detectionId } : {}),\n});\n\nconst toBindingPipelineEntity = ({\n sourceDetail,\n providerId,\n detectionId,\n ...entity\n}: NativePipelineEntity): CanonicalPipelineEntity => ({\n ...entity,\n source_detail: sourceDetail ?? null,\n provider_id: providerId ?? null,\n detection_id: detectionId ?? null,\n});\n\nconst toNativeRedactionResult = (\n result: NativeBindingRedactionResult,\n): NativeRedactionResult => ({\n redactedText: result.redactedText,\n redactionMap: toRedactionMap(result.redactionMap),\n operatorMap: toOperatorMap(result.operatorMap),\n entityCount: result.entityCount,\n});\n\nconst toRedactionMap = (\n entries: readonly NativeBindingRedactionEntry[],\n): Map<string, string> => {\n const map = new Map<string, string>();\n for (const entry of entries) {\n map.set(entry.placeholder, entry.original);\n }\n return map;\n};\n\nconst toOperatorMap = (\n entries: readonly NativeBindingOperatorEntry[],\n): Map<string, OperatorType> => {\n const map = new Map<string, OperatorType>();\n for (const entry of entries) {\n map.set(entry.placeholder, entry.operator);\n }\n return map;\n};\n"],"mappings":";AAwSA,MAAa,oCAAoC;AAuCjD,MAAM,8BACJ,eAEA,KAAK,UAAU;CACb,SAAA;CACA,YAAY,WAAW,KAAK,eAAe;EACzC,OAAO,UAAU;EACjB,KAAK,UAAU;EACf,OAAO,UAAU;EACjB,OAAO,UAAU;EACjB,aAAa,UAAU;EACvB,cAAc,UAAU;CAC1B,EAAE;AACJ,CAAC;AA6FH,IAAa,iCAAb,MAA4C;CAC1C;CAEA,YAAY,SAAgD;EAC1D,KAAKA,WAAW;CAClB;CAEA,YAAoB;EAClB,OAAO,KAAKA,SAAS,UAAU;CACjC;CAEA,aAAqB;EACnB,OAAO,KAAK,UAAU;CACxB;CAEA,eAAuB;EACrB,OAAO,KAAKA,SAAS,aAAa;CACpC;CAEA,gBAAwB;EACtB,OAAO,KAAK,aAAa;CAC3B;CAEA,YAAY,UAAkB,wBAAyC;EACrE,IAAI,2BAA2B,KAAA,GAAW;GACxC,MAAM,UAAU,KAAKA,SAAS;GAC9B,IAAI,CAAC,SACH,MAAM,IAAI,MACR,+DACF;GAEF,OAAO,QAAQ,KAAK,KAAKA,UAAU,QAAQ;EAC7C;EACA,MAAM,UAAU,KAAKA,SAAS;EAC9B,IAAI,CAAC,SACH,MAAM,IAAI,MACR,kFACF;EAEF,OAAO,QAAQ,KAAK,KAAKA,UAAU,UAAU,sBAAsB;CACrE;CAEA,aAAa,UAAkB,wBAAyC;EACtE,OAAO,KAAK,YAAY,UAAU,sBAAsB;CAC1D;CAEA,kBAA0B;EACxB,OAAO,KAAKA,SAAS,gBAAgB;CACvC;CAEA,oBAA4B;EAC1B,OAAO,KAAK,gBAAgB;CAC9B;CAEA,kBAAkB,wBAAwC;EACxD,MAAM,YAAY,KAAKA,SAAS;EAChC,IAAI,CAAC,WACH,MAAM,IAAI,MACR,sEACF;EAEF,OAAO,UAAU,KAAK,KAAKA,UAAU,sBAAs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version":3,"file":"native.mjs","names":["#session","#plan","#prepared","#anonymizer"],"sources":["../src/native.ts"],"sourcesContent":["import type { NativePreparedSearchConfig } from \"./native-search-config\";\nimport type { OperatorSelection, OperatorType } from \"./types\";\n\nexport type { NativePreparedSearchConfig } from \"./native-search-config\";\n\ntype NativeBindingOperatorConfig = {\n operators?: Record<string, OperatorSelection>;\n redactString?: string;\n};\n\ntype NativeBindingCallerRedactionOptions = {\n requestJson: string;\n operators?: NativeBindingOperatorConfig;\n};\n\ntype NativeBindingSessionCallerRedactionInput = {\n fullText: string;\n requestJson: string;\n};\n\ntype NativeBindingSessionCallerRedactionPlanOptions = {\n inputs: NativeBindingSessionCallerRedactionInput[];\n operators?: NativeBindingOperatorConfig;\n observedAtEpochSeconds?: number;\n};\n\ntype NativeBindingOpenSessionArchiveOptions = {\n archive: Uint8Array;\n key: Uint8Array;\n expectedSessionId: string;\n observedAtEpochSeconds?: number;\n};\n\nexport type NativeDiagnosticsBatchCallback = (diagnosticsJson: string) => void;\nexport type NativeResultEventCallback = (eventJson: string) => void;\n\ntype NativeBindingRedactionEntry = {\n placeholder: string;\n original: string;\n};\n\ntype NativeBindingOperatorEntry = {\n placeholder: string;\n operator: OperatorType;\n};\n\ntype NativeBindingPipelineEntity = {\n start: number;\n end: number;\n label: string;\n text: string;\n score: number;\n source: string;\n sourceDetail?: string | null;\n providerId?: string | null;\n detectionId?: string | null;\n};\n\ntype NativeBindingRedactionResult = {\n redactedText: string;\n redactionMap: NativeBindingRedactionEntry[];\n operatorMap: NativeBindingOperatorEntry[];\n entityCount: number;\n};\n\ntype NativeBindingStaticRedactionResult = {\n resolvedEntities: NativeBindingPipelineEntity[];\n redaction: NativeBindingRedactionResult;\n};\n\ntype CanonicalPipelineEntity = {\n start: number;\n end: number;\n label: string;\n text: string;\n score: number;\n source: string;\n source_detail?: string | null;\n provider_id?: string | null;\n detection_id?: string | null;\n};\n\ntype CanonicalStaticRedactionResult = {\n resolved_entities: CanonicalPipelineEntity[];\n redaction: {\n redacted_text: string;\n redaction_map: NativeBindingRedactionEntry[];\n operator_map: NativeBindingOperatorEntry[];\n entity_count: number;\n };\n};\n\ntype CanonicalSessionMetadata = {\n session_id: string;\n created_at_epoch_seconds: number | null;\n expires_at_epoch_seconds: number | null;\n mapping_count: number;\n status: NativeSessionStatus;\n};\n\ntype CanonicalSessionDeletionSummary = {\n session_id: string;\n deleted_mapping_count: number;\n};\n\ntype CanonicalSessionRedactionPlanResult = {\n replacements: Array<{\n start: number;\n end: number;\n replacement: string;\n }>;\n entity_count: number;\n caller_entity_count: number;\n};\n\nexport type NativeSessionStatus =\n | \"active\"\n | \"not_yet_active\"\n | \"expired\"\n | \"deleted\";\n\nexport type NativeSessionLifecycle = {\n createdAtEpochSeconds: number;\n expiresAtEpochSeconds?: number;\n};\n\nexport type NativeSessionMetadata = {\n sessionId: string;\n createdAtEpochSeconds: number | null;\n expiresAtEpochSeconds: number | null;\n mappingCount: number;\n status: NativeSessionStatus;\n};\n\nexport type NativeSessionDeletionSummary = {\n sessionId: string;\n deletedMappingCount: number;\n};\n\nexport type NativeSessionRedactionAtOptions = {\n fullText: string;\n observedAtEpochSeconds: number;\n operators?: NativeOperatorConfig;\n};\n\nexport type NativeCreateSessionWithLifecycleOptions = NativeSessionLifecycle & {\n sessionId: string;\n};\n\nexport type NativeOpenSessionArchiveOptions = {\n archive: Uint8Array;\n key: Uint8Array;\n expectedSessionId: string;\n observedAtEpochSeconds?: number;\n};\n\nexport type NativePreparedRedactionSessionBinding = {\n sessionId: () => string;\n mappingCount: () => number;\n restoreText?: (fullText: string) => string;\n restoreTextAt?: (fullText: string, observedAtEpochSeconds: number) => string;\n toPlaintextJson: () => string;\n toPlaintextJsonAt?: (observedAtEpochSeconds: number) => string;\n toEncryptedArchive?: (key: Uint8Array) => Uint8Array;\n toEncryptedArchiveAt?: (\n key: Uint8Array,\n observedAtEpochSeconds: number,\n ) => Uint8Array;\n inspectJson?: (observedAtEpochSeconds?: number) => string;\n deleteJson?: () => string;\n redactStaticEntitiesJson: (\n fullText: string,\n operators?: NativeBindingOperatorConfig,\n ) => string;\n redactStaticEntitiesJsonAt?: (\n fullText: string,\n observedAtEpochSeconds: number,\n operators?: NativeBindingOperatorConfig,\n ) => string;\n planStaticEntitiesWithCallerDetections?: (\n options: NativeBindingSessionCallerRedactionPlanOptions,\n ) => NativePreparedSessionRedactionPlanBinding;\n};\n\nexport type NativePreparedSessionRedactionPlanBinding = {\n resultJson: () => string;\n commit: () => void;\n};\n\nexport type NativePreparedSearchBinding = {\n prepareDiagnosticsJson?: () => string;\n warmLazyRegex?: () => void;\n warm_lazy_regex?: () => void;\n warmLazyRegexDiagnosticsJson?: () => string;\n warm_lazy_regex_diagnostics_json?: () => string;\n createRedactionSession?: (\n sessionId: string,\n ) => NativePreparedRedactionSessionBinding;\n createRedactionSessionWithLifecycle?: (\n sessionId: string,\n createdAtEpochSeconds: number,\n expiresAtEpochSeconds?: number,\n ) => NativePreparedRedactionSessionBinding;\n restoreRedactionSession?: (\n plaintextJson: string,\n ) => NativePreparedRedactionSessionBinding;\n restoreEncryptedRedactionSession?: (\n options: NativeBindingOpenSessionArchiveOptions,\n ) => NativePreparedRedactionSessionBinding;\n redactStaticEntities: (\n fullText: string,\n operators?: NativeBindingOperatorConfig,\n ) => NativeBindingStaticRedactionResult;\n redactStaticEntitiesJson?: (\n fullText: string,\n operators?: NativeBindingOperatorConfig,\n ) => string;\n redactStaticEntitiesWithCallerDetectionsJson?: (\n fullText: string,\n options: NativeBindingCallerRedactionOptions,\n ) => string;\n redactStaticEntitiesWithCallerDetectionsDiagnosticsJson?: (\n fullText: string,\n options: NativeBindingCallerRedactionOptions,\n ) => string;\n redactStaticEntitiesResultStreamJson?: (\n fullText: string,\n operators: NativeBindingOperatorConfig | undefined,\n onEvent: NativeResultEventCallback,\n ) => string;\n redactStaticEntitiesDiagnosticsJson?: (\n fullText: string,\n operators?: NativeBindingOperatorConfig,\n ) => string;\n redactStaticEntitiesDiagnosticsStreamJson?: (\n fullText: string,\n operators: NativeBindingOperatorConfig | undefined,\n onBatch: NativeDiagnosticsBatchCallback,\n ) => string;\n redactStaticEntitiesSummaryDiagnosticsJson?: (\n fullText: string,\n operators?: NativeBindingOperatorConfig,\n ) => string;\n};\n\nexport type NativeAnonymizeBinding = {\n extractDocxTextJson?: (document: Uint8Array) => string;\n rewriteDocxTextNative?: (\n document: Uint8Array,\n rewritesJson: string,\n ) => {\n document: Uint8Array;\n rewrittenBlockCount: number;\n appliedReplacementCount: number;\n };\n planDocxRestorationJson?: (document: Uint8Array, sessionId: string) => string;\n normalizeForSearch: (text: string) => string;\n nativePackageVersion: () => string;\n NativePreparedSearch: {\n fromConfigJsonBytes: (\n configJson: Uint8Array,\n ) => NativePreparedSearchBinding;\n fromPreparedPackageBytes: (\n packageBytes: Uint8Array,\n ) => NativePreparedSearchBinding;\n fromPreparedPackageBytesWithoutCache?: (\n packageBytes: Uint8Array,\n ) => NativePreparedSearchBinding;\n fromTrustedPreparedPackageBytes?: (\n packageBytes: Uint8Array,\n ) => NativePreparedSearchBinding;\n fromTrustedPreparedPackageBytesWithoutCache?: (\n packageBytes: Uint8Array,\n ) => NativePreparedSearchBinding;\n };\n prepareStaticSearchPackageBytes: (configJson: Uint8Array) => Uint8Array;\n prepareStaticSearchCompressedPackageBytes: (\n configJson: Uint8Array,\n ) => Uint8Array;\n // Rust config assembler (replaces the retired TypeScript config-assembly\n // layer). Takes the pipeline config plus out-of-band dictionaries and\n // gazetteer JSON and returns either the assembled config JSON or ready\n // package bytes. Optional so older bindings without the assembler still\n // satisfy the type; native-node loads them from the same `.node`.\n assembleStaticSearchConfigJson?: (\n pipelineConfigJson: Uint8Array,\n dictionariesJson?: Uint8Array,\n gazetteerJson?: Uint8Array,\n ) => Uint8Array;\n assembleStaticSearchPackageBytes?: (\n pipelineConfigJson: Uint8Array,\n dictionariesJson?: Uint8Array,\n gazetteerJson?: Uint8Array,\n ) => Uint8Array;\n assembleStaticSearchCompressedPackageBytes?: (\n pipelineConfigJson: Uint8Array,\n dictionariesJson?: Uint8Array,\n gazetteerJson?: Uint8Array,\n ) => Uint8Array;\n};\n\nexport type NativeOperatorConfig = {\n operators?: Record<string, OperatorSelection>;\n redactString?: string;\n};\n\nexport const CALLER_DETECTION_CONTRACT_VERSION = 2;\n\nexport type NativeCallerDetection = {\n start: number;\n end: number;\n label: string;\n score: number;\n providerId: string;\n detectionId: string;\n};\n\nexport type NativeCallerRedactionOptions = {\n detections: readonly NativeCallerDetection[];\n operators?: NativeOperatorConfig;\n};\n\nexport type NativeSessionCallerRedactionInput = {\n fullText: string;\n detections: readonly NativeCallerDetection[];\n};\n\nexport type NativeSessionCallerRedactionPlanOptions = {\n inputs: readonly NativeSessionCallerRedactionInput[];\n operators?: NativeOperatorConfig;\n observedAtEpochSeconds?: number;\n};\n\nexport type NativeTextReplacement = {\n start: number;\n end: number;\n replacement: string;\n};\n\nexport type NativeSessionBlockRedactionPlan = {\n replacements: readonly NativeTextReplacement[];\n entityCount: number;\n callerEntityCount: number;\n};\n\nconst callerDetectionRequestJson = (\n detections: readonly NativeCallerDetection[],\n): string =>\n JSON.stringify({\n version: CALLER_DETECTION_CONTRACT_VERSION,\n detections: detections.map((detection) => ({\n start: detection.start,\n end: detection.end,\n label: detection.label,\n score: detection.score,\n provider_id: detection.providerId,\n detection_id: detection.detectionId,\n })),\n });\n\nexport type NativePipelineEntity = {\n start: number;\n end: number;\n label: string;\n text: string;\n score: number;\n source: string;\n sourceDetail?: string;\n providerId?: string;\n detectionId?: string;\n};\n\nexport type NativeRedactionResult = {\n redactedText: string;\n redactionMap: Map<string, string>;\n operatorMap: Map<string, OperatorType>;\n entityCount: number;\n};\n\nexport type NativeStaticRedactionResult = {\n resolvedEntities: NativePipelineEntity[];\n redaction: NativeRedactionResult;\n};\n\nexport type NativeSearchPackageOptions = {\n binding: NativeAnonymizeBinding;\n config: NativePreparedSearchConfig;\n compressed?: boolean;\n};\n\nexport type NativeSearchPackageInput =\n | NativePreparedSearchConfig\n | string\n | Uint8Array;\n\nexport type SharedNativeSearchPackageOptions = {\n binding: NativeAnonymizeBinding;\n config: NativeSearchPackageInput;\n compressed?: boolean;\n};\n\nexport type SharedNativePreparedPackageOptions = {\n binding: NativeAnonymizeBinding;\n packageBytes: Uint8Array;\n};\n\nexport type SharedNativeRedactTextJsonOptions = {\n binding: NativeAnonymizeBinding;\n config: NativeSearchPackageInput;\n fullText: string;\n operators?: NativeOperatorConfig;\n};\n\nexport type SharedNativeRedactTextOptions = SharedNativeRedactTextJsonOptions;\n\nexport type SharedNativeDiagnosticsJsonOptions =\n SharedNativeRedactTextJsonOptions;\n\nexport type SharedNativeDiagnosticsStreamJsonOptions =\n SharedNativeRedactTextJsonOptions & {\n onBatch: NativeDiagnosticsBatchCallback;\n };\n\nexport type SharedNativeRedactTextStreamJsonOptions =\n SharedNativeRedactTextJsonOptions & {\n onEvent: NativeResultEventCallback;\n };\n\nexport type NativeNormalizeOptions = {\n binding: NativeAnonymizeBinding;\n text: string;\n};\n\nexport type NativeAnonymizerFromConfigOptions = {\n binding: NativeAnonymizeBinding;\n config: NativePreparedSearchConfig;\n};\n\nexport type NativeAnonymizerFromPackageOptions = {\n binding: NativeAnonymizeBinding;\n packageBytes: Uint8Array;\n};\n\nexport type NativePipelineFromPackageOptions =\n NativeAnonymizerFromPackageOptions;\n\nexport type NativeBindingVersionOptions = {\n binding: NativeAnonymizeBinding;\n expectedVersion: string;\n};\n\nexport class PreparedNativeRedactionSession {\n readonly #session: NativePreparedRedactionSessionBinding;\n\n constructor(session: NativePreparedRedactionSessionBinding) {\n this.#session = session;\n }\n\n sessionId(): string {\n return this.#session.sessionId();\n }\n\n session_id(): string {\n return this.sessionId();\n }\n\n mappingCount(): number {\n return this.#session.mappingCount();\n }\n\n mapping_count(): number {\n return this.mappingCount();\n }\n\n restoreText(fullText: string, observedAtEpochSeconds?: number): string {\n if (observedAtEpochSeconds === undefined) {\n const restore = this.#session.restoreText;\n if (!restore) {\n throw new Error(\n \"Native anonymize binding does not support session restoration\",\n );\n }\n return restore.call(this.#session, fullText);\n }\n const restore = this.#session.restoreTextAt;\n if (!restore) {\n throw new Error(\n \"Native anonymize binding does not support session restoration lifecycle controls\",\n );\n }\n return restore.call(this.#session, fullText, observedAtEpochSeconds);\n }\n\n restore_text(fullText: string, observedAtEpochSeconds?: number): string {\n return this.restoreText(fullText, observedAtEpochSeconds);\n }\n\n toPlaintextJson(): string {\n return this.#session.toPlaintextJson();\n }\n\n to_plaintext_json(): string {\n return this.toPlaintextJson();\n }\n\n toPlaintextJsonAt(observedAtEpochSeconds: number): string {\n const serialize = this.#session.toPlaintextJsonAt;\n if (!serialize) {\n throw new Error(\n \"Native anonymize binding does not support session lifecycle controls\",\n );\n }\n return serialize.call(this.#session, observedAtEpochSeconds);\n }\n\n to_plaintext_json_at(observedAtEpochSeconds: number): string {\n return this.toPlaintextJsonAt(observedAtEpochSeconds);\n }\n\n toEncryptedArchive(key: Uint8Array): Uint8Array {\n const serialize = this.#session.toEncryptedArchive;\n if (!serialize) {\n throw new Error(\n \"Native anonymize binding does not support encrypted session archives\",\n );\n }\n return serialize.call(this.#session, key);\n }\n\n to_encrypted_archive(key: Uint8Array): Uint8Array {\n return this.toEncryptedArchive(key);\n }\n\n toEncryptedArchiveAt(\n key: Uint8Array,\n observedAtEpochSeconds: number,\n ): Uint8Array {\n const serialize = this.#session.toEncryptedArchiveAt;\n if (!serialize) {\n throw new Error(\n \"Native anonymize binding does not support encrypted session archives\",\n );\n }\n return serialize.call(this.#session, key, observedAtEpochSeconds);\n }\n\n to_encrypted_archive_at(\n key: Uint8Array,\n observedAtEpochSeconds: number,\n ): Uint8Array {\n return this.toEncryptedArchiveAt(key, observedAtEpochSeconds);\n }\n\n inspect(observedAtEpochSeconds?: number): NativeSessionMetadata {\n const inspect = this.#session.inspectJson;\n if (!inspect) {\n throw new Error(\n \"Native anonymize binding does not support session lifecycle controls\",\n );\n }\n const metadata: CanonicalSessionMetadata = JSON.parse(\n inspect.call(this.#session, observedAtEpochSeconds),\n );\n return {\n sessionId: metadata.session_id,\n createdAtEpochSeconds: metadata.created_at_epoch_seconds,\n expiresAtEpochSeconds: metadata.expires_at_epoch_seconds,\n mappingCount: metadata.mapping_count,\n status: metadata.status,\n };\n }\n\n delete(): NativeSessionDeletionSummary {\n const deleteSession = this.#session.deleteJson;\n if (!deleteSession) {\n throw new Error(\n \"Native anonymize binding does not support session lifecycle controls\",\n );\n }\n const summary: CanonicalSessionDeletionSummary = JSON.parse(\n deleteSession.call(this.#session),\n );\n return {\n sessionId: summary.session_id,\n deletedMappingCount: summary.deleted_mapping_count,\n };\n }\n\n redactStaticEntities(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): NativeStaticRedactionResult {\n const result: CanonicalStaticRedactionResult = JSON.parse(\n this.redact_text_json(fullText, operators),\n );\n return fromCanonicalStaticRedactionResult(result);\n }\n\n redactText(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): NativeStaticRedactionResult {\n return this.redactStaticEntities(fullText, operators);\n }\n\n redact_text(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): NativeStaticRedactionResult {\n return this.redactText(fullText, operators);\n }\n\n redactTextJson(fullText: string, operators?: NativeOperatorConfig): string {\n return this.redact_text_json(fullText, operators);\n }\n\n redact_text_json(fullText: string, operators?: NativeOperatorConfig): string {\n return this.#session.redactStaticEntitiesJson(\n fullText,\n toBindingOperatorConfig(operators),\n );\n }\n\n redactStaticEntitiesAt(\n options: NativeSessionRedactionAtOptions,\n ): NativeStaticRedactionResult {\n const result: CanonicalStaticRedactionResult = JSON.parse(\n this.redactTextJsonAt(options),\n );\n return fromCanonicalStaticRedactionResult(result);\n }\n\n redactTextAt(\n options: NativeSessionRedactionAtOptions,\n ): NativeStaticRedactionResult {\n return this.redactStaticEntitiesAt(options);\n }\n\n redact_text_at(\n options: NativeSessionRedactionAtOptions,\n ): NativeStaticRedactionResult {\n return this.redactTextAt(options);\n }\n\n redact_static_entities_at(\n options: NativeSessionRedactionAtOptions,\n ): NativeStaticRedactionResult {\n return this.redactStaticEntitiesAt(options);\n }\n\n redactTextJsonAt({\n fullText,\n observedAtEpochSeconds,\n operators,\n }: NativeSessionRedactionAtOptions): string {\n const redact = this.#session.redactStaticEntitiesJsonAt;\n if (!redact) {\n throw new Error(\n \"Native anonymize binding does not support session lifecycle controls\",\n );\n }\n return redact.call(\n this.#session,\n fullText,\n observedAtEpochSeconds,\n toBindingOperatorConfig(operators),\n );\n }\n\n redact_text_json_at(options: NativeSessionRedactionAtOptions): string {\n return this.redactTextJsonAt(options);\n }\n\n planTextBatchWithCallerDetections({\n inputs,\n operators,\n observedAtEpochSeconds,\n }: NativeSessionCallerRedactionPlanOptions): PreparedNativeSessionRedactionPlan {\n const plan = this.#session.planStaticEntitiesWithCallerDetections;\n if (!plan) {\n throw new Error(\n \"Native anonymize binding does not support transactional caller-detection session plans\",\n );\n }\n const bindingOperators = toBindingOperatorConfig(operators);\n const bindingPlan = plan.call(this.#session, {\n inputs: inputs.map(({ detections, fullText }) => ({\n fullText,\n requestJson: callerDetectionRequestJson(detections),\n })),\n ...(bindingOperators === undefined\n ? {}\n : { operators: bindingOperators }),\n ...(observedAtEpochSeconds === undefined\n ? {}\n : { observedAtEpochSeconds }),\n });\n return new PreparedNativeSessionRedactionPlan(bindingPlan);\n }\n}\n\nexport class PreparedNativeSessionRedactionPlan {\n readonly blocks: readonly NativeSessionBlockRedactionPlan[];\n readonly #plan: NativePreparedSessionRedactionPlanBinding;\n\n constructor(plan: NativePreparedSessionRedactionPlanBinding) {\n this.#plan = plan;\n const blocks: CanonicalSessionRedactionPlanResult[] = JSON.parse(\n plan.resultJson(),\n );\n this.blocks = blocks.map(\n ({ caller_entity_count, entity_count, replacements }) => ({\n replacements,\n entityCount: entity_count,\n callerEntityCount: caller_entity_count,\n }),\n );\n }\n\n commit(): void {\n this.#plan.commit();\n }\n}\n\nexport class PreparedNativeAnonymizer {\n readonly #prepared: NativePreparedSearchBinding;\n\n constructor(prepared: NativePreparedSearchBinding) {\n this.#prepared = prepared;\n }\n\n prepareDiagnosticsJson(): string | null {\n return this.#prepared.prepareDiagnosticsJson?.() ?? null;\n }\n\n prepare_diagnostics_json(): string | null {\n return this.prepareDiagnosticsJson();\n }\n\n warmLazyRegex(): void {\n if (this.#prepared.warmLazyRegex) {\n this.#prepared.warmLazyRegex();\n return;\n }\n this.#prepared.warm_lazy_regex?.();\n }\n\n warm_lazy_regex(): void {\n this.warmLazyRegex();\n }\n\n warmLazyRegexDiagnosticsJson(): string | null {\n if (this.#prepared.warmLazyRegexDiagnosticsJson) {\n return this.#prepared.warmLazyRegexDiagnosticsJson();\n }\n return this.#prepared.warm_lazy_regex_diagnostics_json?.() ?? null;\n }\n\n warm_lazy_regex_diagnostics_json(): string | null {\n return this.warmLazyRegexDiagnosticsJson();\n }\n\n createRedactionSession(sessionId: string): PreparedNativeRedactionSession {\n const create = this.#prepared.createRedactionSession;\n if (!create) {\n throw new Error(\n \"Native anonymize binding does not support redaction sessions\",\n );\n }\n return new PreparedNativeRedactionSession(\n create.call(this.#prepared, sessionId),\n );\n }\n\n create_redaction_session(sessionId: string): PreparedNativeRedactionSession {\n return this.createRedactionSession(sessionId);\n }\n\n createRedactionSessionWithLifecycle({\n sessionId,\n createdAtEpochSeconds,\n expiresAtEpochSeconds,\n }: NativeCreateSessionWithLifecycleOptions): PreparedNativeRedactionSession {\n const create = this.#prepared.createRedactionSessionWithLifecycle;\n if (!create) {\n throw new Error(\n \"Native anonymize binding does not support session lifecycle controls\",\n );\n }\n return new PreparedNativeRedactionSession(\n create.call(\n this.#prepared,\n sessionId,\n createdAtEpochSeconds,\n expiresAtEpochSeconds,\n ),\n );\n }\n\n create_redaction_session_with_lifecycle(\n options: NativeCreateSessionWithLifecycleOptions,\n ): PreparedNativeRedactionSession {\n return this.createRedactionSessionWithLifecycle(options);\n }\n\n restoreRedactionSession(\n plaintextJson: string,\n ): PreparedNativeRedactionSession {\n const restore = this.#prepared.restoreRedactionSession;\n if (!restore) {\n throw new Error(\n \"Native anonymize binding does not support redaction sessions\",\n );\n }\n return new PreparedNativeRedactionSession(\n restore.call(this.#prepared, plaintextJson),\n );\n }\n\n restore_redaction_session(\n plaintextJson: string,\n ): PreparedNativeRedactionSession {\n return this.restoreRedactionSession(plaintextJson);\n }\n\n restoreEncryptedRedactionSession({\n archive,\n key,\n expectedSessionId,\n observedAtEpochSeconds,\n }: NativeOpenSessionArchiveOptions): PreparedNativeRedactionSession {\n const restore = this.#prepared.restoreEncryptedRedactionSession;\n if (!restore) {\n throw new Error(\n \"Native anonymize binding does not support encrypted session archives\",\n );\n }\n return new PreparedNativeRedactionSession(\n restore.call(this.#prepared, {\n archive,\n key,\n expectedSessionId,\n ...(observedAtEpochSeconds === undefined\n ? {}\n : { observedAtEpochSeconds }),\n }),\n );\n }\n\n restore_encrypted_redaction_session(\n options: NativeOpenSessionArchiveOptions,\n ): PreparedNativeRedactionSession {\n return this.restoreEncryptedRedactionSession(options);\n }\n\n redactStaticEntities(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): NativeStaticRedactionResult {\n return toNativeStaticRedactionResult(\n this.#prepared.redactStaticEntities(\n fullText,\n toBindingOperatorConfig(operators),\n ),\n );\n }\n\n redact_text(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): NativeStaticRedactionResult {\n return this.redactStaticEntities(fullText, operators);\n }\n\n redact_text_json(fullText: string, operators?: NativeOperatorConfig): string {\n const bindingOperators = toBindingOperatorConfig(operators);\n if (this.#prepared.redactStaticEntitiesJson) {\n return this.#prepared.redactStaticEntitiesJson(\n fullText,\n bindingOperators,\n );\n }\n return JSON.stringify(\n toBindingStaticRedactionResult(\n toNativeStaticRedactionResult(\n this.#prepared.redactStaticEntities(fullText, bindingOperators),\n ),\n ),\n );\n }\n\n redactStaticEntitiesWithCallerDetections(\n fullText: string,\n options: NativeCallerRedactionOptions,\n ): NativeStaticRedactionResult {\n if (!this.#prepared.redactStaticEntitiesWithCallerDetectionsJson) {\n throw new Error(\n \"Native anonymize binding does not support caller detections\",\n );\n }\n const requestJson = callerDetectionRequestJson(options.detections);\n const operators = toBindingOperatorConfig(options.operators);\n const result: CanonicalStaticRedactionResult = JSON.parse(\n this.#prepared.redactStaticEntitiesWithCallerDetectionsJson(fullText, {\n requestJson,\n ...(operators ? { operators } : {}),\n }),\n );\n return fromCanonicalStaticRedactionResult(result);\n }\n\n redact_text_with_caller_detections(\n fullText: string,\n options: NativeCallerRedactionOptions,\n ): NativeStaticRedactionResult {\n return this.redactStaticEntitiesWithCallerDetections(fullText, options);\n }\n\n redactStaticEntitiesWithCallerDetectionsDiagnosticsJson(\n fullText: string,\n options: NativeCallerRedactionOptions,\n ): string | null {\n const redact =\n this.#prepared.redactStaticEntitiesWithCallerDetectionsDiagnosticsJson;\n if (!redact) {\n return null;\n }\n const requestJson = callerDetectionRequestJson(options.detections);\n const operators = toBindingOperatorConfig(options.operators);\n return redact.call(this.#prepared, fullText, {\n requestJson,\n ...(operators ? { operators } : {}),\n });\n }\n\n redact_static_entities_with_caller_detections_diagnostics_json(\n fullText: string,\n options: NativeCallerRedactionOptions,\n ): string | null {\n return this.redactStaticEntitiesWithCallerDetectionsDiagnosticsJson(\n fullText,\n options,\n );\n }\n\n redactTextJson(fullText: string, operators?: NativeOperatorConfig): string {\n return this.redact_text_json(fullText, operators);\n }\n\n redactTextStreamJson(\n fullText: string,\n onEvent: NativeResultEventCallback,\n operators?: NativeOperatorConfig,\n ): string | null {\n if (!this.#prepared.redactStaticEntitiesResultStreamJson) {\n return null;\n }\n return this.#prepared.redactStaticEntitiesResultStreamJson(\n fullText,\n toBindingOperatorConfig(operators),\n onEvent,\n );\n }\n\n redact_text_stream_json(\n fullText: string,\n onEvent: NativeResultEventCallback,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.redactTextStreamJson(fullText, onEvent, operators);\n }\n\n redactStaticEntitiesDiagnosticsJson(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): string | null {\n if (!this.#prepared.redactStaticEntitiesDiagnosticsJson) {\n return null;\n }\n return this.#prepared.redactStaticEntitiesDiagnosticsJson(\n fullText,\n toBindingOperatorConfig(operators),\n );\n }\n\n diagnostics_json(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.redactStaticEntitiesDiagnosticsJson(fullText, operators);\n }\n\n diagnosticsStreamJson(\n fullText: string,\n onBatch: NativeDiagnosticsBatchCallback,\n operators?: NativeOperatorConfig,\n ): string | null {\n if (!this.#prepared.redactStaticEntitiesDiagnosticsStreamJson) {\n return null;\n }\n return this.#prepared.redactStaticEntitiesDiagnosticsStreamJson(\n fullText,\n toBindingOperatorConfig(operators),\n onBatch,\n );\n }\n\n diagnostics_stream_json(\n fullText: string,\n onBatch: NativeDiagnosticsBatchCallback,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.diagnosticsStreamJson(fullText, onBatch, operators);\n }\n\n redactStaticEntitiesSummaryDiagnosticsJson(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): string | null {\n if (!this.#prepared.redactStaticEntitiesSummaryDiagnosticsJson) {\n return null;\n }\n return this.#prepared.redactStaticEntitiesSummaryDiagnosticsJson(\n fullText,\n toBindingOperatorConfig(operators),\n );\n }\n\n summary_diagnostics_json(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.redactStaticEntitiesSummaryDiagnosticsJson(fullText, operators);\n }\n}\n\nexport class PreparedNativePipeline {\n readonly #anonymizer: PreparedNativeAnonymizer;\n\n constructor(anonymizer: PreparedNativeAnonymizer) {\n this.#anonymizer = anonymizer;\n }\n\n prepareDiagnosticsJson(): string | null {\n return this.#anonymizer.prepareDiagnosticsJson();\n }\n\n prepare_diagnostics_json(): string | null {\n return this.prepareDiagnosticsJson();\n }\n\n warmLazyRegex(): void {\n this.#anonymizer.warmLazyRegex();\n }\n\n warm_lazy_regex(): void {\n this.warmLazyRegex();\n }\n\n warmLazyRegexDiagnosticsJson(): string | null {\n return this.#anonymizer.warmLazyRegexDiagnosticsJson();\n }\n\n warm_lazy_regex_diagnostics_json(): string | null {\n return this.warmLazyRegexDiagnosticsJson();\n }\n\n createRedactionSession(sessionId: string): PreparedNativeRedactionSession {\n return this.#anonymizer.createRedactionSession(sessionId);\n }\n\n create_redaction_session(sessionId: string): PreparedNativeRedactionSession {\n return this.createRedactionSession(sessionId);\n }\n\n createRedactionSessionWithLifecycle(\n options: NativeCreateSessionWithLifecycleOptions,\n ): PreparedNativeRedactionSession {\n return this.#anonymizer.createRedactionSessionWithLifecycle(options);\n }\n\n create_redaction_session_with_lifecycle(\n options: NativeCreateSessionWithLifecycleOptions,\n ): PreparedNativeRedactionSession {\n return this.createRedactionSessionWithLifecycle(options);\n }\n\n restoreRedactionSession(\n plaintextJson: string,\n ): PreparedNativeRedactionSession {\n return this.#anonymizer.restoreRedactionSession(plaintextJson);\n }\n\n restore_redaction_session(\n plaintextJson: string,\n ): PreparedNativeRedactionSession {\n return this.restoreRedactionSession(plaintextJson);\n }\n\n restoreEncryptedRedactionSession(\n options: NativeOpenSessionArchiveOptions,\n ): PreparedNativeRedactionSession {\n return this.#anonymizer.restoreEncryptedRedactionSession(options);\n }\n\n restore_encrypted_redaction_session(\n options: NativeOpenSessionArchiveOptions,\n ): PreparedNativeRedactionSession {\n return this.restoreEncryptedRedactionSession(options);\n }\n\n redactText(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): NativeStaticRedactionResult {\n return this.#anonymizer.redactStaticEntities(fullText, operators);\n }\n\n redact_text(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): NativeStaticRedactionResult {\n return this.redactText(fullText, operators);\n }\n\n redact_text_json(fullText: string, operators?: NativeOperatorConfig): string {\n return this.#anonymizer.redact_text_json(fullText, operators);\n }\n\n redactTextWithCallerDetections(\n fullText: string,\n options: NativeCallerRedactionOptions,\n ): NativeStaticRedactionResult {\n return this.#anonymizer.redactStaticEntitiesWithCallerDetections(\n fullText,\n options,\n );\n }\n\n redact_text_with_caller_detections(\n fullText: string,\n options: NativeCallerRedactionOptions,\n ): NativeStaticRedactionResult {\n return this.redactTextWithCallerDetections(fullText, options);\n }\n\n redactTextWithCallerDetectionsDiagnosticsJson(\n fullText: string,\n options: NativeCallerRedactionOptions,\n ): string | null {\n return this.#anonymizer.redactStaticEntitiesWithCallerDetectionsDiagnosticsJson(\n fullText,\n options,\n );\n }\n\n redact_text_with_caller_detections_diagnostics_json(\n fullText: string,\n options: NativeCallerRedactionOptions,\n ): string | null {\n return this.redactTextWithCallerDetectionsDiagnosticsJson(\n fullText,\n options,\n );\n }\n\n redactTextJson(fullText: string, operators?: NativeOperatorConfig): string {\n return this.redact_text_json(fullText, operators);\n }\n\n redactTextStreamJson(\n fullText: string,\n onEvent: NativeResultEventCallback,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.#anonymizer.redactTextStreamJson(fullText, onEvent, operators);\n }\n\n redact_text_stream_json(\n fullText: string,\n onEvent: NativeResultEventCallback,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.redactTextStreamJson(fullText, onEvent, operators);\n }\n\n redactTextDiagnosticsJson(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.#anonymizer.redactStaticEntitiesDiagnosticsJson(\n fullText,\n operators,\n );\n }\n\n diagnostics_json(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.redactTextDiagnosticsJson(fullText, operators);\n }\n\n diagnosticsStreamJson(\n fullText: string,\n onBatch: NativeDiagnosticsBatchCallback,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.#anonymizer.diagnosticsStreamJson(fullText, onBatch, operators);\n }\n\n diagnostics_stream_json(\n fullText: string,\n onBatch: NativeDiagnosticsBatchCallback,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.diagnosticsStreamJson(fullText, onBatch, operators);\n }\n\n redactTextSummaryDiagnosticsJson(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.#anonymizer.redactStaticEntitiesSummaryDiagnosticsJson(\n fullText,\n operators,\n );\n }\n\n summary_diagnostics_json(\n fullText: string,\n operators?: NativeOperatorConfig,\n ): string | null {\n return this.redactTextSummaryDiagnosticsJson(fullText, operators);\n }\n}\n\nexport const encodeNativeSearchConfig = (\n config: NativePreparedSearchConfig,\n): Uint8Array => new TextEncoder().encode(JSON.stringify(config));\n\nexport const encodeNativeSearchConfigInput = (\n config: NativeSearchPackageInput,\n): Uint8Array => {\n if (typeof config === \"string\") {\n return new TextEncoder().encode(config);\n }\n if (config instanceof Uint8Array) {\n return config;\n }\n return encodeNativeSearchConfig(config);\n};\n\nexport const getNativeBindingVersion = (\n binding: NativeAnonymizeBinding,\n): string => binding.nativePackageVersion();\n\nexport const native_package_version = getNativeBindingVersion;\n\nexport const normalize_for_search = ({\n binding,\n text,\n}: NativeNormalizeOptions): string => binding.normalizeForSearch(text);\n\nexport const assertNativeBindingVersion = ({\n binding,\n expectedVersion,\n}: NativeBindingVersionOptions): void => {\n const actualVersion = getNativeBindingVersion(binding);\n if (actualVersion !== expectedVersion) {\n throw new Error(\n `Native anonymize binding version ${actualVersion} does not match ${expectedVersion}`,\n );\n }\n};\n\nexport const prepareNativeSearchPackage = ({\n binding,\n config,\n compressed = false,\n}: NativeSearchPackageOptions): Uint8Array => {\n const configBytes = encodeNativeSearchConfig(config);\n return compressed\n ? binding.prepareStaticSearchCompressedPackageBytes(configBytes)\n : binding.prepareStaticSearchPackageBytes(configBytes);\n};\n\nexport const prepare_search_package = ({\n binding,\n config,\n compressed = false,\n}: SharedNativeSearchPackageOptions): Uint8Array => {\n const configBytes = encodeNativeSearchConfigInput(config);\n return compressed\n ? binding.prepareStaticSearchCompressedPackageBytes(configBytes)\n : binding.prepareStaticSearchPackageBytes(configBytes);\n};\n\nexport const createNativeAnonymizerFromConfig = ({\n binding,\n config,\n}: NativeAnonymizerFromConfigOptions): PreparedNativeAnonymizer =>\n new PreparedNativeAnonymizer(\n binding.NativePreparedSearch.fromConfigJsonBytes(\n encodeNativeSearchConfig(config),\n ),\n );\n\nexport const createNativeAnonymizerFromPackage = ({\n binding,\n packageBytes,\n}: NativeAnonymizerFromPackageOptions): PreparedNativeAnonymizer =>\n new PreparedNativeAnonymizer(\n binding.NativePreparedSearch.fromPreparedPackageBytes(packageBytes),\n );\n\nexport const load_prepared_package = ({\n binding,\n packageBytes,\n}: SharedNativePreparedPackageOptions): PreparedNativeAnonymizer =>\n createNativeAnonymizerFromPackage({ binding, packageBytes });\n\nexport const redact_text_json = ({\n binding,\n config,\n fullText,\n operators,\n}: SharedNativeRedactTextJsonOptions): string =>\n new PreparedNativeAnonymizer(\n binding.NativePreparedSearch.fromConfigJsonBytes(\n encodeNativeSearchConfigInput(config),\n ),\n ).redact_text_json(fullText, operators);\n\nexport const redact_text = ({\n binding,\n config,\n fullText,\n operators,\n}: SharedNativeRedactTextOptions): NativeStaticRedactionResult =>\n new PreparedNativeAnonymizer(\n binding.NativePreparedSearch.fromConfigJsonBytes(\n encodeNativeSearchConfigInput(config),\n ),\n ).redact_text(fullText, operators);\n\nexport const redact_text_stream_json = ({\n binding,\n config,\n fullText,\n operators,\n onEvent,\n}: SharedNativeRedactTextStreamJsonOptions): string | null =>\n new PreparedNativeAnonymizer(\n binding.NativePreparedSearch.fromConfigJsonBytes(\n encodeNativeSearchConfigInput(config),\n ),\n ).redact_text_stream_json(fullText, onEvent, operators);\n\nexport const diagnostics_json = ({\n binding,\n config,\n fullText,\n operators,\n}: SharedNativeDiagnosticsJsonOptions): string | null =>\n new PreparedNativeAnonymizer(\n binding.NativePreparedSearch.fromConfigJsonBytes(\n encodeNativeSearchConfigInput(config),\n ),\n ).diagnostics_json(fullText, operators);\n\nexport const diagnostics_stream_json = ({\n binding,\n config,\n fullText,\n operators,\n onBatch,\n}: SharedNativeDiagnosticsStreamJsonOptions): string | null =>\n new PreparedNativeAnonymizer(\n binding.NativePreparedSearch.fromConfigJsonBytes(\n encodeNativeSearchConfigInput(config),\n ),\n ).diagnostics_stream_json(fullText, onBatch, operators);\n\nexport const summary_diagnostics_json = ({\n binding,\n config,\n fullText,\n operators,\n}: SharedNativeDiagnosticsJsonOptions): string | null =>\n new PreparedNativeAnonymizer(\n binding.NativePreparedSearch.fromConfigJsonBytes(\n encodeNativeSearchConfigInput(config),\n ),\n ).summary_diagnostics_json(fullText, operators);\n\nexport const createNativePipelineFromPackage = ({\n binding,\n packageBytes,\n}: NativePipelineFromPackageOptions): PreparedNativePipeline =>\n new PreparedNativePipeline(\n createNativeAnonymizerFromPackage({ binding, packageBytes }),\n );\n\nexport const PreparedSearch = PreparedNativeAnonymizer;\nexport type PreparedSearch = PreparedNativeAnonymizer;\nexport const PreparedAnonymizer = PreparedNativeAnonymizer;\nexport type PreparedAnonymizer = PreparedNativeAnonymizer;\n\nconst toBindingOperatorConfig = (\n config: NativeOperatorConfig | undefined,\n): NativeBindingOperatorConfig | undefined => {\n if (!config) {\n return undefined;\n }\n const bindingConfig: NativeBindingOperatorConfig = {};\n if (config.operators !== undefined) {\n bindingConfig.operators = config.operators;\n }\n if (config.redactString !== undefined) {\n bindingConfig.redactString = config.redactString;\n }\n return bindingConfig;\n};\n\nconst toNativeStaticRedactionResult = (\n result: NativeBindingStaticRedactionResult,\n): NativeStaticRedactionResult => ({\n resolvedEntities: result.resolvedEntities.map(toNativePipelineEntity),\n redaction: toNativeRedactionResult(result.redaction),\n});\n\nconst fromCanonicalStaticRedactionResult = (\n result: CanonicalStaticRedactionResult,\n): NativeStaticRedactionResult => ({\n resolvedEntities: result.resolved_entities.map(\n ({ source_detail, provider_id, detection_id, ...entity }) => ({\n ...entity,\n ...(source_detail ? { sourceDetail: source_detail } : {}),\n ...(provider_id ? { providerId: provider_id } : {}),\n ...(detection_id ? { detectionId: detection_id } : {}),\n }),\n ),\n redaction: {\n redactedText: result.redaction.redacted_text,\n redactionMap: toRedactionMap(result.redaction.redaction_map),\n operatorMap: toOperatorMap(result.redaction.operator_map),\n entityCount: result.redaction.entity_count,\n },\n});\n\nconst toBindingStaticRedactionResult = (\n result: NativeStaticRedactionResult,\n): CanonicalStaticRedactionResult => ({\n resolved_entities: result.resolvedEntities.map(toBindingPipelineEntity),\n redaction: {\n redacted_text: result.redaction.redactedText,\n redaction_map: [...result.redaction.redactionMap.entries()].map(\n ([placeholder, original]) => ({ placeholder, original }),\n ),\n operator_map: [...result.redaction.operatorMap.entries()].map(\n ([placeholder, operator]) => ({ placeholder, operator }),\n ),\n entity_count: result.redaction.entityCount,\n },\n});\n\nconst toNativePipelineEntity = (\n entity: NativeBindingPipelineEntity,\n): NativePipelineEntity => ({\n start: entity.start,\n end: entity.end,\n label: entity.label,\n text: entity.text,\n score: entity.score,\n source: entity.source,\n ...(entity.sourceDetail ? { sourceDetail: entity.sourceDetail } : {}),\n ...(entity.providerId ? { providerId: entity.providerId } : {}),\n ...(entity.detectionId ? { detectionId: entity.detectionId } : {}),\n});\n\nconst toBindingPipelineEntity = ({\n sourceDetail,\n providerId,\n detectionId,\n ...entity\n}: NativePipelineEntity): CanonicalPipelineEntity => ({\n ...entity,\n source_detail: sourceDetail ?? null,\n provider_id: providerId ?? null,\n detection_id: detectionId ?? null,\n});\n\nconst toNativeRedactionResult = (\n result: NativeBindingRedactionResult,\n): NativeRedactionResult => ({\n redactedText: result.redactedText,\n redactionMap: toRedactionMap(result.redactionMap),\n operatorMap: toOperatorMap(result.operatorMap),\n entityCount: result.entityCount,\n});\n\nconst toRedactionMap = (\n entries: readonly NativeBindingRedactionEntry[],\n): Map<string, string> => {\n const map = new Map<string, string>();\n for (const entry of entries) {\n map.set(entry.placeholder, entry.original);\n }\n return map;\n};\n\nconst toOperatorMap = (\n entries: readonly NativeBindingOperatorEntry[],\n): Map<string, OperatorType> => {\n const map = new Map<string, OperatorType>();\n for (const entry of entries) {\n map.set(entry.placeholder, entry.operator);\n }\n return map;\n};\n"],"mappings":";AAkTA,MAAa,oCAAoC;AAuCjD,MAAM,8BACJ,eAEA,KAAK,UAAU;CACb,SAAA;CACA,YAAY,WAAW,KAAK,eAAe;EACzC,OAAO,UA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EACA,cAAc,CAAC,GAAG,OAAO,UAAU,YAAY,QAAQ,CAAC,CAAC,CAAC,KACvD,CAAC,aAAa,eAAe;GAAE;GAAa;EAAS,EACxD;EACA,cAAc,OAAO,UAAU;CACjC;AACF;AAEA,MAAM,0BACJ,YAC0B;CAC1B,OAAO,OAAO;CACd,KAAK,OAAO;CACZ,OAAO,OAAO;CACd,MAAM,OAAO;CACb,OAAO,OAAO;CACd,QAAQ,OAAO;CACf,GAAI,OAAO,eAAe,EAAE,cAAc,OAAO,aAAa,IAAI,CAAC;CACnE,GAAI,OAAO,aAAa,EAAE,YAAY,OAAO,WAAW,IAAI,CAAC;CAC7D,GAAI,OAAO,cAAc,EAAE,aAAa,OAAO,YAAY,IAAI,CAAC;AAClE;AAEA,MAAM,2BAA2B,EAC/B,cACA,YACA,aACA,GAAG,cACiD;CACpD,GAAG;CACH,eAAe,gBAAgB;CAC/B,aAAa,cAAc;CAC3B,cAAc,eAAe;AAC/B;AAEA,MAAM,2BACJ,YAC2B;CAC3B,cAAc,OAAO;CACrB,cAAc,eAAe,OAAO,YAAY;CAChD,aAAa,cAAc,OAAO,WAAW;CAC7C,aAAa,OAAO;AACtB;AAEA,MAAM,kBACJ,YACwB;CACxB,MAAM,sBAAM,IAAI,IAAoB;CACpC,KAAK,MAAM,SAAS,SAClB,IAAI,IAAI,MAAM,aAAa,MAAM,QAAQ;CAE3C,OAAO;AACT;AAEA,MAAM,iBACJ,YAC8B;CAC9B,MAAM,sBAAM,IAAI,IAA0B;CAC1C,KAAK,MAAM,SAAS,SAClB,IAAI,IAAI,MAAM,aAAa,MAAM,QAAQ;CAE3C,OAAO;AACT"}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/anonymize",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Deterministic PII detection and anonymization with regex, deny lists, and coreference resolution",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anonymization",
|
|
@@ -88,11 +88,11 @@
|
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
"optionalDependencies": {
|
|
91
|
-
"@stll/anonymize-darwin-arm64": "2.
|
|
92
|
-
"@stll/anonymize-darwin-x64": "2.
|
|
93
|
-
"@stll/anonymize-linux-arm64-gnu": "2.
|
|
94
|
-
"@stll/anonymize-linux-x64-gnu": "2.
|
|
95
|
-
"@stll/anonymize-win32-x64-msvc": "2.
|
|
91
|
+
"@stll/anonymize-darwin-arm64": "2.3.0",
|
|
92
|
+
"@stll/anonymize-darwin-x64": "2.3.0",
|
|
93
|
+
"@stll/anonymize-linux-arm64-gnu": "2.3.0",
|
|
94
|
+
"@stll/anonymize-linux-x64-gnu": "2.3.0",
|
|
95
|
+
"@stll/anonymize-win32-x64-msvc": "2.3.0"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@napi-rs/cli": "^3.7.3",
|