@stll/anonymize-wasm 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.
@@ -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: 1;
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: 1;
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
@@ -1,22 +1,107 @@
1
1
  import { ENTITY_CAPABILITIES } from "./constants.mjs";
2
2
  //#region src/capabilities.ts
3
- const CAPABILITY_MANIFEST_SCHEMA_VERSION = 1;
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: 1,
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 as const;\n\nexport const CAPABILITY_RUNTIMES = [\"node\", \"python\", \"wasm\"] as const;\n\nexport type CapabilityRuntime = (typeof CAPABILITY_RUNTIMES)[number];\n\nexport type CapabilityManifest = {\n schemaVersion: typeof CAPABILITY_MANIFEST_SCHEMA_VERSION;\n runtimes: readonly CapabilityRuntime[];\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 entities: ENTITY_CAPABILITIES,\n} as const satisfies CapabilityManifest;\n"],"mappings":";;AAEA,MAAa,qCAAqC;AAElD,MAAa,sBAAsB;CAAC;CAAQ;CAAU;AAAM;;;;;;AAe5D,MAAa,sBAAsB;CACjC,eAAA;CACA,UAAU;CACV,UAAU;AACZ"}
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"}
@@ -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",
@@ -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,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A,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,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;GAClB,kBAAkB;GAClB,kBAAkB;GAClB,kBAAkB;EACpB;CACF;CACA;EACE,OAAO;EACP,WAAW,kBAAkB;EAC7B,kBAAkB,CAAC,kBAAkB,OAAO,kBAAkB,OAAO;CACvE;CACA;EACE,OAAO;EACP,WAAW,kBAAkB;EAC7B,kBAAkB;GAChB,kBAAkB;GAClB,kBAAkB;GAClB,kBAAkB;EACpB;CACF;CACA;EACE,OAAO;EACP,WAAW,kBAAkB;EAC7B,kBAAkB,CAAC,kBAAkB,OAAO;CAC9C;CACA;EACE,OAAO;EACP,WAAW,kBAAkB;EAC7B,kBAAkB,CAAC,kBAAkB,KAAK;CAC5C;CACA;EAC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;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"}
@@ -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";
@@ -11979,23 +11979,29 @@ var NativePreparedSessionRedactionPlan = __napiModule.exports.NativePreparedSess
11979
11979
  var assembleStaticSearchCompressedPackageBytes = __napiModule.exports.assembleStaticSearchCompressedPackageBytes;
11980
11980
  var assembleStaticSearchConfigJson = __napiModule.exports.assembleStaticSearchConfigJson;
11981
11981
  var assembleStaticSearchPackageBytes = __napiModule.exports.assembleStaticSearchPackageBytes;
11982
+ var extractDocxTextJson = __napiModule.exports.extractDocxTextJson;
11982
11983
  var nativePackageVersion = __napiModule.exports.nativePackageVersion;
11983
11984
  var normalizeForSearch = __napiModule.exports.normalizeForSearch;
11985
+ var planDocxRestorationJson = __napiModule.exports.planDocxRestorationJson;
11984
11986
  var prepareStaticSearchArtifactsBytes = __napiModule.exports.prepareStaticSearchArtifactsBytes;
11985
11987
  var prepareStaticSearchCompressedPackageBytes = __napiModule.exports.prepareStaticSearchCompressedPackageBytes;
11986
11988
  var prepareStaticSearchPackageBytes = __napiModule.exports.prepareStaticSearchPackageBytes;
11987
11989
  var redactStaticEntitiesDiagnosticsJson = __napiModule.exports.redactStaticEntitiesDiagnosticsJson;
11988
11990
  var redactStaticEntitiesJson = __napiModule.exports.redactStaticEntitiesJson;
11989
11991
  var redactStaticEntitiesSummaryDiagnosticsJson = __napiModule.exports.redactStaticEntitiesSummaryDiagnosticsJson;
11992
+ var rewriteDocxTextNative = __napiModule.exports.rewriteDocxTextNative;
11990
11993
  export {
11994
+ rewriteDocxTextNative,
11991
11995
  redactStaticEntitiesSummaryDiagnosticsJson,
11992
11996
  redactStaticEntitiesJson,
11993
11997
  redactStaticEntitiesDiagnosticsJson,
11994
11998
  prepareStaticSearchPackageBytes,
11995
11999
  prepareStaticSearchCompressedPackageBytes,
11996
12000
  prepareStaticSearchArtifactsBytes,
12001
+ planDocxRestorationJson,
11997
12002
  normalizeForSearch,
11998
12003
  nativePackageVersion,
12004
+ extractDocxTextJson,
11999
12005
  index_wasi_browser_default as default,
12000
12006
  assembleStaticSearchPackageBytes,
12001
12007
  assembleStaticSearchConfigJson,
@@ -114,11 +114,14 @@ module.exports.NativePreparedSessionRedactionPlan = __napiModule.exports.NativeP
114
114
  module.exports.assembleStaticSearchCompressedPackageBytes = __napiModule.exports.assembleStaticSearchCompressedPackageBytes
115
115
  module.exports.assembleStaticSearchConfigJson = __napiModule.exports.assembleStaticSearchConfigJson
116
116
  module.exports.assembleStaticSearchPackageBytes = __napiModule.exports.assembleStaticSearchPackageBytes
117
+ module.exports.extractDocxTextJson = __napiModule.exports.extractDocxTextJson
117
118
  module.exports.nativePackageVersion = __napiModule.exports.nativePackageVersion
118
119
  module.exports.normalizeForSearch = __napiModule.exports.normalizeForSearch
120
+ module.exports.planDocxRestorationJson = __napiModule.exports.planDocxRestorationJson
119
121
  module.exports.prepareStaticSearchArtifactsBytes = __napiModule.exports.prepareStaticSearchArtifactsBytes
120
122
  module.exports.prepareStaticSearchCompressedPackageBytes = __napiModule.exports.prepareStaticSearchCompressedPackageBytes
121
123
  module.exports.prepareStaticSearchPackageBytes = __napiModule.exports.prepareStaticSearchPackageBytes
122
124
  module.exports.redactStaticEntitiesDiagnosticsJson = __napiModule.exports.redactStaticEntitiesDiagnosticsJson
123
125
  module.exports.redactStaticEntitiesJson = __napiModule.exports.redactStaticEntitiesJson
124
126
  module.exports.redactStaticEntitiesSummaryDiagnosticsJson = __napiModule.exports.redactStaticEntitiesSummaryDiagnosticsJson
127
+ module.exports.rewriteDocxTextNative = __napiModule.exports.rewriteDocxTextNative
Binary file
package/dist/wasm.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
  //#region src/native-search-config.d.ts
4
4
  /**
5
5
  * Structural type for the prepared static-search config the native binding
@@ -144,6 +144,8 @@ type NativeTriggerData = {
144
144
  };
145
145
  type NativeLegalFormData = {
146
146
  suffixes: string[];
147
+ detection_only_suffixes: string[];
148
+ institutional_heads: string[];
147
149
  normalized_boundary_suffixes: string[];
148
150
  normalized_in_name_words: string[];
149
151
  normalized_suffix_words: string[];
@@ -159,11 +161,17 @@ type NativeLegalFormData = {
159
161
  in_name_prepositions: string[];
160
162
  company_suffix_words: string[];
161
163
  comma_gated_direct_prefixes: string[];
164
+ institutional_complement_heads: string[];
165
+ institutional_complement_starters: string[];
166
+ institutional_complement_connectors: string[];
167
+ institutional_generic_words: string[];
168
+ institutional_prefix_generic_words: string[];
162
169
  };
163
170
  type NativeDateMonthData = Record<string, string[]>;
164
171
  type NativeYearWordData = Record<string, string[]>;
165
172
  type NativeDateData = {
166
173
  month_names_by_language: NativeDateMonthData;
174
+ lowercase_month_ambiguities: NativeDateMonthData;
167
175
  year_words_by_language: NativeYearWordData;
168
176
  };
169
177
  type NativeMonetaryData = {
@@ -267,6 +275,8 @@ type NativeSignatureData = {
267
275
  name_particles: string[];
268
276
  post_nominal_suffixes: string[];
269
277
  organization_suffixes: string[];
278
+ form_field_labels: string[];
279
+ signature_stamp_phrases: string[];
270
280
  image_stub_prefixes: string[];
271
281
  };
272
282
  type NativePreparedSearchConfig = {
@@ -713,6 +723,13 @@ type NativePreparedSearchBinding = {
713
723
  redactStaticEntitiesSummaryDiagnosticsJson?: (fullText: string, operators?: NativeBindingOperatorConfig) => string;
714
724
  };
715
725
  type NativeAnonymizeBinding = {
726
+ extractDocxTextJson?: (document: Uint8Array) => string;
727
+ rewriteDocxTextNative?: (document: Uint8Array, rewritesJson: string) => {
728
+ document: Uint8Array;
729
+ rewrittenBlockCount: number;
730
+ appliedReplacementCount: number;
731
+ };
732
+ planDocxRestorationJson?: (document: Uint8Array, sessionId: string) => string;
716
733
  normalizeForSearch: (text: string) => string;
717
734
  nativePackageVersion: () => string;
718
735
  NativePreparedSearch: {
@@ -1054,5 +1071,5 @@ declare const diagnostics_json: (config: NativeSearchPackageInput, fullText: str
1054
1071
  declare const diagnostics_stream_json: (config: NativeSearchPackageInput, fullText: string, onBatch: NativeDiagnosticsBatchCallback, operators?: NativeOperatorConfig, options?: WasmBindingOptions) => Promise<string | null>;
1055
1072
  declare const summary_diagnostics_json: (config: NativeSearchPackageInput, fullText: string, operators?: NativeOperatorConfig, options?: WasmBindingOptions) => Promise<string | null>;
1056
1073
  //#endregion
1057
- export { type AnonymisationOperator, CALLER_DETECTION_CONTRACT_VERSION, CAPABILITY_MANIFEST, CAPABILITY_MANIFEST_SCHEMA_VERSION, CAPABILITY_RUNTIMES, type CapabilityManifest, type CapabilityRuntime, DEFAULT_ENTITY_LABELS, DETECTION_SOURCES, DETECTOR_PRIORITY, type DefaultEntityLabel, type DetectionSource, type Dictionaries, ENTITY_CAPABILITIES, ENTITY_LABELS, ENTITY_SELECTIONS, type Entity, type EntityCapability, type EntityLabel, type EntitySelection, type GazetteerEntry, LoadPreparedPackageOptions, NativeAnonymizeBinding, NativeAnonymizerFromConfigOptions, NativeAnonymizerFromPackageOptions, NativeBindingVersionOptions, NativeCallerDetection, NativeCallerRedactionOptions, NativeCreateSessionWithLifecycleOptions, NativeDiagnosticsBatchCallback, NativeNormalizeOptions, NativeOpenSessionArchiveOptions, NativeOperatorConfig, type NativePipelineBuildOptions, type NativePipelineCompatibility, NativePipelineEntity, NativePipelineFromPackageOptions, type NativePipelinePackageOptions, type NativePipelineUnsupportedFeature, NativePreparedRedactionSessionBinding, NativePreparedSearchBinding, type NativePreparedSearchConfig, NativePreparedSessionRedactionPlanBinding, NativeRedactionResult, NativeResultEventCallback, NativeSearchPackageInput, NativeSearchPackageOptions, NativeSessionBlockRedactionPlan, NativeSessionCallerRedactionInput, NativeSessionCallerRedactionPlanOptions, NativeSessionDeletionSummary, NativeSessionLifecycle, NativeSessionMetadata, NativeSessionRedactionAtOptions, NativeSessionStatus, NativeStaticRedactionResult, NativeTextReplacement, OPERATOR_TYPES, type OperatorConfig, type OperatorType, type PipelineConfig, type PipelineContext, PrepareSearchPackageOptions, PreparedAnonymizer, PreparedNativeAnonymizer, PreparedNativePipeline, PreparedNativeRedactionSession, PreparedNativeSessionRedactionPlan, PreparedPackageSource, PreparedSearch, type RedactionResult, type ReviewDecision, type ReviewedEntity, SharedNativeDiagnosticsJsonOptions, SharedNativeDiagnosticsStreamJsonOptions, SharedNativePreparedPackageOptions, SharedNativeRedactTextJsonOptions, SharedNativeRedactTextOptions, SharedNativeRedactTextStreamJsonOptions, SharedNativeSearchPackageOptions, WasmBindingOptions, assertNativeBindingVersion, assertNativePipelineSupported, createNativeAnonymizerFromConfig, createNativeAnonymizerFromPackage, createNativePipelineFromConfig, createNativePipelineFromPackage, createPipelineContext, deanonymise, defaultPackageUrl, diagnostics_json, diagnostics_stream_json, encodeNativeSearchConfig, encodeNativeSearchConfigInput, exportRedactionKey, getBinding, getDefaultPipeline, getNativeBindingVersion, getNativePipelineCompatibility, loadDefaultPipeline, loadPipeline, load_prepared_package, native_package_version, normalize_for_search, prepareNativePipelineConfig, prepareNativePipelinePackage, prepareNativeSearchPackage, prepare_search_package, redactDefaultText, redactDefaultTextJson, redact_text, redact_text_json, redact_text_stream_json, summary_diagnostics_json };
1074
+ 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, DEFAULT_ENTITY_LABELS, DETECTION_SOURCES, DETECTOR_PRIORITY, type DefaultEntityLabel, type DetectionSource, type Dictionaries, ENTITY_CAPABILITIES, ENTITY_LABELS, ENTITY_SELECTIONS, type Entity, type EntityCapability, type EntityLabel, type EntitySelection, type GazetteerEntry, LoadPreparedPackageOptions, NativeAnonymizeBinding, NativeAnonymizerFromConfigOptions, NativeAnonymizerFromPackageOptions, NativeBindingVersionOptions, NativeCallerDetection, NativeCallerRedactionOptions, NativeCreateSessionWithLifecycleOptions, NativeDiagnosticsBatchCallback, NativeNormalizeOptions, NativeOpenSessionArchiveOptions, NativeOperatorConfig, type NativePipelineBuildOptions, type NativePipelineCompatibility, NativePipelineEntity, NativePipelineFromPackageOptions, type NativePipelinePackageOptions, type NativePipelineUnsupportedFeature, NativePreparedRedactionSessionBinding, NativePreparedSearchBinding, type NativePreparedSearchConfig, NativePreparedSessionRedactionPlanBinding, NativeRedactionResult, NativeResultEventCallback, NativeSearchPackageInput, NativeSearchPackageOptions, NativeSessionBlockRedactionPlan, NativeSessionCallerRedactionInput, NativeSessionCallerRedactionPlanOptions, NativeSessionDeletionSummary, NativeSessionLifecycle, NativeSessionMetadata, NativeSessionRedactionAtOptions, NativeSessionStatus, NativeStaticRedactionResult, NativeTextReplacement, OPERATOR_TYPES, type OperatorConfig, type OperatorType, type PipelineConfig, type PipelineContext, PrepareSearchPackageOptions, PreparedAnonymizer, PreparedNativeAnonymizer, PreparedNativePipeline, PreparedNativeRedactionSession, PreparedNativeSessionRedactionPlan, PreparedPackageSource, PreparedSearch, type RedactionResult, type ReviewDecision, type ReviewedEntity, SharedNativeDiagnosticsJsonOptions, SharedNativeDiagnosticsStreamJsonOptions, SharedNativePreparedPackageOptions, SharedNativeRedactTextJsonOptions, SharedNativeRedactTextOptions, SharedNativeRedactTextStreamJsonOptions, SharedNativeSearchPackageOptions, WasmBindingOptions, assertNativeBindingVersion, assertNativePipelineSupported, createNativeAnonymizerFromConfig, createNativeAnonymizerFromPackage, createNativePipelineFromConfig, createNativePipelineFromPackage, createPipelineContext, deanonymise, defaultPackageUrl, diagnostics_json, diagnostics_stream_json, encodeNativeSearchConfig, encodeNativeSearchConfigInput, exportRedactionKey, getBinding, getDefaultPipeline, getNativeBindingVersion, getNativePipelineCompatibility, loadDefaultPipeline, loadPipeline, load_prepared_package, native_package_version, normalize_for_search, prepareNativePipelineConfig, prepareNativePipelinePackage, prepareNativeSearchPackage, prepare_search_package, redactDefaultText, redactDefaultTextJson, redact_text, redact_text_json, redact_text_stream_json, summary_diagnostics_json };
1058
1075
  //# sourceMappingURL=wasm.d.mts.map
package/dist/wasm.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { DEFAULT_ENTITY_LABELS, DETECTION_SOURCES, DETECTOR_PRIORITY, ENTITY_CAPABILITIES, ENTITY_LABELS, ENTITY_SELECTIONS, OPERATOR_TYPES } from "./constants.mjs";
2
- import { CAPABILITY_MANIFEST, CAPABILITY_MANIFEST_SCHEMA_VERSION, CAPABILITY_RUNTIMES } from "./capabilities.mjs";
2
+ import { CAPABILITY_MANIFEST, CAPABILITY_MANIFEST_SCHEMA_VERSION, CAPABILITY_PARITY_PROFILES, CAPABILITY_RUNTIMES, CAPABILITY_SURFACES } from "./capabilities.mjs";
3
3
  //#region src/native.ts
4
4
  const CALLER_DETECTION_CONTRACT_VERSION = 2;
5
5
  const callerDetectionRequestJson = (detections) => JSON.stringify({
@@ -1077,6 +1077,6 @@ const normalizeLanguage = (language) => {
1077
1077
  return normalized;
1078
1078
  };
1079
1079
  //#endregion
1080
- export { CALLER_DETECTION_CONTRACT_VERSION, CAPABILITY_MANIFEST, CAPABILITY_MANIFEST_SCHEMA_VERSION, CAPABILITY_RUNTIMES, DEFAULT_ENTITY_LABELS, DETECTION_SOURCES, DETECTOR_PRIORITY, ENTITY_CAPABILITIES, ENTITY_LABELS, ENTITY_SELECTIONS, OPERATOR_TYPES, PreparedAnonymizer, PreparedNativeAnonymizer, PreparedNativePipeline, PreparedNativeRedactionSession, PreparedNativeSessionRedactionPlan, PreparedSearch, assertNativeBindingVersion, assertNativePipelineSupported, createNativeAnonymizerFromConfig, createNativeAnonymizerFromPackage, createNativePipelineFromConfig, createNativePipelineFromPackage, createPipelineContext, deanonymise, defaultPackageUrl, diagnostics_json, diagnostics_stream_json, encodeNativeSearchConfig, encodeNativeSearchConfigInput, exportRedactionKey, getBinding, getDefaultPipeline, getNativeBindingVersion, getNativePipelineCompatibility, loadDefaultPipeline, loadPipeline, load_prepared_package, native_package_version, normalize_for_search, prepareNativePipelineConfig, prepareNativePipelinePackage, prepareNativeSearchPackage, prepare_search_package, redactDefaultText, redactDefaultTextJson, redact_text, redact_text_json, redact_text_stream_json, summary_diagnostics_json };
1080
+ export { CALLER_DETECTION_CONTRACT_VERSION, CAPABILITY_MANIFEST, CAPABILITY_MANIFEST_SCHEMA_VERSION, CAPABILITY_PARITY_PROFILES, CAPABILITY_RUNTIMES, CAPABILITY_SURFACES, DEFAULT_ENTITY_LABELS, DETECTION_SOURCES, DETECTOR_PRIORITY, ENTITY_CAPABILITIES, ENTITY_LABELS, ENTITY_SELECTIONS, OPERATOR_TYPES, PreparedAnonymizer, PreparedNativeAnonymizer, PreparedNativePipeline, PreparedNativeRedactionSession, PreparedNativeSessionRedactionPlan, PreparedSearch, assertNativeBindingVersion, assertNativePipelineSupported, createNativeAnonymizerFromConfig, createNativeAnonymizerFromPackage, createNativePipelineFromConfig, createNativePipelineFromPackage, createPipelineContext, deanonymise, defaultPackageUrl, diagnostics_json, diagnostics_stream_json, encodeNativeSearchConfig, encodeNativeSearchConfigInput, exportRedactionKey, getBinding, getDefaultPipeline, getNativeBindingVersion, getNativePipelineCompatibility, loadDefaultPipeline, loadPipeline, load_prepared_package, native_package_version, normalize_for_search, prepareNativePipelineConfig, prepareNativePipelinePackage, prepareNativeSearchPackage, prepare_search_package, redactDefaultText, redactDefaultTextJson, redact_text, redact_text_json, redact_text_stream_json, summary_diagnostics_json };
1081
1081
 
1082
1082
  //# sourceMappingURL=wasm.mjs.map