@stll/anonymize-wasm 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,123 @@
1
+ import { o as ENTITY_CAPABILITIES } from "./constants2.mjs";
2
+ //#region src/capabilities.d.ts
3
+ declare const CAPABILITY_MANIFEST_SCHEMA_VERSION: 1;
4
+ declare const CAPABILITY_RUNTIMES: readonly ["node", "python", "wasm"];
5
+ type CapabilityRuntime = (typeof CAPABILITY_RUNTIMES)[number];
6
+ type CapabilityManifest = {
7
+ schemaVersion: typeof CAPABILITY_MANIFEST_SCHEMA_VERSION;
8
+ runtimes: readonly CapabilityRuntime[];
9
+ entities: typeof ENTITY_CAPABILITIES;
10
+ };
11
+ /**
12
+ * Versioned, runtime-free discovery contract for the deterministic pipeline.
13
+ * The manifest contains no accuracy claims; it describes available labels,
14
+ * activation, provenance sources, and runtime parity only.
15
+ */
16
+ declare const CAPABILITY_MANIFEST: {
17
+ readonly schemaVersion: 1;
18
+ readonly runtimes: readonly ["node", "python", "wasm"];
19
+ readonly entities: readonly [{
20
+ readonly label: "person";
21
+ readonly selection: "default";
22
+ readonly detectionSources: readonly ["trigger", "regex", "deny-list", "coreference"];
23
+ }, {
24
+ readonly label: "organization";
25
+ readonly selection: "default";
26
+ readonly detectionSources: readonly ["trigger", "deny-list", "legal-form", "gazetteer", "coreference"];
27
+ }, {
28
+ readonly label: "phone number";
29
+ readonly selection: "default";
30
+ readonly detectionSources: readonly ["regex", "trigger"];
31
+ }, {
32
+ readonly label: "address";
33
+ readonly selection: "default";
34
+ readonly detectionSources: readonly ["regex", "trigger", "deny-list"];
35
+ }, {
36
+ readonly label: "country";
37
+ readonly selection: "default";
38
+ readonly detectionSources: readonly ["country"];
39
+ }, {
40
+ readonly label: "email address";
41
+ readonly selection: "default";
42
+ readonly detectionSources: readonly ["regex"];
43
+ }, {
44
+ readonly label: "date";
45
+ readonly selection: "default";
46
+ readonly detectionSources: readonly ["regex", "trigger"];
47
+ }, {
48
+ readonly label: "date of birth";
49
+ readonly selection: "default";
50
+ readonly detectionSources: readonly ["trigger"];
51
+ }, {
52
+ readonly label: "bank account number";
53
+ readonly selection: "default";
54
+ readonly detectionSources: readonly ["regex", "trigger"];
55
+ }, {
56
+ readonly label: "iban";
57
+ readonly selection: "default";
58
+ readonly detectionSources: readonly ["regex", "trigger"];
59
+ }, {
60
+ readonly label: "tax identification number";
61
+ readonly selection: "default";
62
+ readonly detectionSources: readonly ["regex", "trigger"];
63
+ }, {
64
+ readonly label: "identity card number";
65
+ readonly selection: "default";
66
+ readonly detectionSources: readonly ["regex", "trigger"];
67
+ }, {
68
+ readonly label: "birth number";
69
+ readonly selection: "default";
70
+ readonly detectionSources: readonly ["regex", "trigger"];
71
+ }, {
72
+ readonly label: "national identification number";
73
+ readonly selection: "default";
74
+ readonly detectionSources: readonly ["regex", "trigger"];
75
+ }, {
76
+ readonly label: "social security number";
77
+ readonly selection: "default";
78
+ readonly detectionSources: readonly ["regex", "trigger"];
79
+ }, {
80
+ readonly label: "registration number";
81
+ readonly selection: "default";
82
+ readonly detectionSources: readonly ["regex", "trigger"];
83
+ }, {
84
+ readonly label: "credit card number";
85
+ readonly selection: "default";
86
+ readonly detectionSources: readonly ["regex"];
87
+ }, {
88
+ readonly label: "passport number";
89
+ readonly selection: "default";
90
+ readonly detectionSources: readonly ["regex"];
91
+ }, {
92
+ readonly label: "crypto";
93
+ readonly selection: "default";
94
+ readonly detectionSources: readonly ["regex"];
95
+ }, {
96
+ readonly label: "monetary amount";
97
+ readonly selection: "default";
98
+ readonly detectionSources: readonly ["regex", "trigger"];
99
+ }, {
100
+ readonly label: "land parcel";
101
+ readonly selection: "default";
102
+ readonly detectionSources: readonly ["trigger"];
103
+ }, {
104
+ readonly label: "misc";
105
+ readonly selection: "default";
106
+ readonly detectionSources: readonly ["regex", "deny-list"];
107
+ }, {
108
+ readonly label: "ip address";
109
+ readonly selection: "opt-in";
110
+ readonly detectionSources: readonly ["regex"];
111
+ }, {
112
+ readonly label: "mac address";
113
+ readonly selection: "opt-in";
114
+ readonly detectionSources: readonly ["regex"];
115
+ }, {
116
+ readonly label: "url";
117
+ readonly selection: "opt-in";
118
+ readonly detectionSources: readonly ["regex"];
119
+ }];
120
+ };
121
+ //#endregion
122
+ export { CAPABILITY_MANIFEST, CAPABILITY_MANIFEST_SCHEMA_VERSION, CAPABILITY_RUNTIMES, CapabilityManifest, CapabilityRuntime };
123
+ //# sourceMappingURL=capabilities.d.mts.map
@@ -0,0 +1,22 @@
1
+ import { ENTITY_CAPABILITIES } from "./constants.mjs";
2
+ //#region src/capabilities.ts
3
+ const CAPABILITY_MANIFEST_SCHEMA_VERSION = 1;
4
+ const CAPABILITY_RUNTIMES = [
5
+ "node",
6
+ "python",
7
+ "wasm"
8
+ ];
9
+ /**
10
+ * Versioned, runtime-free discovery contract for the deterministic pipeline.
11
+ * The manifest contains no accuracy claims; it describes available labels,
12
+ * activation, provenance sources, and runtime parity only.
13
+ */
14
+ const CAPABILITY_MANIFEST = {
15
+ schemaVersion: 1,
16
+ runtimes: CAPABILITY_RUNTIMES,
17
+ entities: ENTITY_CAPABILITIES
18
+ };
19
+ //#endregion
20
+ export { CAPABILITY_MANIFEST, CAPABILITY_MANIFEST_SCHEMA_VERSION, CAPABILITY_RUNTIMES };
21
+
22
+ //# sourceMappingURL=capabilities.mjs.map
@@ -0,0 +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,2 +1,2 @@
1
- import { a as OPERATOR_TYPES, i as DetectionSource, n as DETECTION_SOURCES, o as OperatorType, r as DETECTOR_PRIORITY, t as DEFAULT_ENTITY_LABELS } from "./constants2.mjs";
2
- export { DEFAULT_ENTITY_LABELS, DETECTION_SOURCES, DETECTOR_PRIORITY, DetectionSource, OPERATOR_TYPES, OperatorType };
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
+ export { DEFAULT_ENTITY_LABELS, DETECTION_SOURCES, DETECTOR_PRIORITY, DefaultEntityLabel, DetectionSource, ENTITY_CAPABILITIES, ENTITY_LABELS, ENTITY_SELECTIONS, EntityCapability, EntityLabel, EntitySelection, OPERATOR_TYPES, OperatorType };
@@ -49,41 +49,171 @@ const DETECTOR_PRIORITY = {
49
49
  * Anonymization operator types. Each operator defines
50
50
  * how a confirmed entity is replaced in the output.
51
51
  */
52
- const OPERATOR_TYPES = ["replace", "redact"];
52
+ const OPERATOR_TYPES = [
53
+ "replace",
54
+ "redact",
55
+ "keep",
56
+ "mask"
57
+ ];
58
+ const ENTITY_SELECTIONS = {
59
+ DEFAULT: "default",
60
+ OPT_IN: "opt-in"
61
+ };
53
62
  /**
54
- * Canonical entity labels used across the pipeline.
55
- * NER models may use different native labels; the bench
56
- * NER wrapper maps model output to these canonical names.
63
+ * Canonical entity capabilities exposed by the deterministic native pipeline.
64
+ * `selection` describes whether the default package requests the label; opt-in
65
+ * labels have built-in detection rules but must be requested explicitly.
57
66
  *
58
67
  * These labels are ephemeral: entities are regenerated on
59
68
  * every pipeline run and never persisted to the database.
60
69
  * Renaming a label here requires no migration.
61
70
  */
62
- const DEFAULT_ENTITY_LABELS = [
63
- "person",
64
- "organization",
65
- "phone number",
66
- "address",
67
- "country",
68
- "email address",
69
- "date",
70
- "date of birth",
71
- "bank account number",
72
- "iban",
73
- "tax identification number",
74
- "identity card number",
75
- "birth number",
76
- "national identification number",
77
- "social security number",
78
- "registration number",
79
- "credit card number",
80
- "passport number",
81
- "crypto",
82
- "monetary amount",
83
- "land parcel",
84
- "misc"
71
+ const ENTITY_CAPABILITIES = [
72
+ {
73
+ label: "person",
74
+ selection: ENTITY_SELECTIONS.DEFAULT,
75
+ detectionSources: [
76
+ DETECTION_SOURCES.TRIGGER,
77
+ DETECTION_SOURCES.REGEX,
78
+ DETECTION_SOURCES.DENY_LIST,
79
+ DETECTION_SOURCES.COREFERENCE
80
+ ]
81
+ },
82
+ {
83
+ label: "organization",
84
+ selection: ENTITY_SELECTIONS.DEFAULT,
85
+ detectionSources: [
86
+ DETECTION_SOURCES.TRIGGER,
87
+ DETECTION_SOURCES.DENY_LIST,
88
+ DETECTION_SOURCES.LEGAL_FORM,
89
+ DETECTION_SOURCES.GAZETTEER,
90
+ DETECTION_SOURCES.COREFERENCE
91
+ ]
92
+ },
93
+ {
94
+ label: "phone number",
95
+ selection: ENTITY_SELECTIONS.DEFAULT,
96
+ detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER]
97
+ },
98
+ {
99
+ label: "address",
100
+ selection: ENTITY_SELECTIONS.DEFAULT,
101
+ detectionSources: [
102
+ DETECTION_SOURCES.REGEX,
103
+ DETECTION_SOURCES.TRIGGER,
104
+ DETECTION_SOURCES.DENY_LIST
105
+ ]
106
+ },
107
+ {
108
+ label: "country",
109
+ selection: ENTITY_SELECTIONS.DEFAULT,
110
+ detectionSources: [DETECTION_SOURCES.COUNTRY]
111
+ },
112
+ {
113
+ label: "email address",
114
+ selection: ENTITY_SELECTIONS.DEFAULT,
115
+ detectionSources: [DETECTION_SOURCES.REGEX]
116
+ },
117
+ {
118
+ label: "date",
119
+ selection: ENTITY_SELECTIONS.DEFAULT,
120
+ detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER]
121
+ },
122
+ {
123
+ label: "date of birth",
124
+ selection: ENTITY_SELECTIONS.DEFAULT,
125
+ detectionSources: [DETECTION_SOURCES.TRIGGER]
126
+ },
127
+ {
128
+ label: "bank account number",
129
+ selection: ENTITY_SELECTIONS.DEFAULT,
130
+ detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER]
131
+ },
132
+ {
133
+ label: "iban",
134
+ selection: ENTITY_SELECTIONS.DEFAULT,
135
+ detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER]
136
+ },
137
+ {
138
+ label: "tax identification number",
139
+ selection: ENTITY_SELECTIONS.DEFAULT,
140
+ detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER]
141
+ },
142
+ {
143
+ label: "identity card number",
144
+ selection: ENTITY_SELECTIONS.DEFAULT,
145
+ detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER]
146
+ },
147
+ {
148
+ label: "birth number",
149
+ selection: ENTITY_SELECTIONS.DEFAULT,
150
+ detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER]
151
+ },
152
+ {
153
+ label: "national identification number",
154
+ selection: ENTITY_SELECTIONS.DEFAULT,
155
+ detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER]
156
+ },
157
+ {
158
+ label: "social security number",
159
+ selection: ENTITY_SELECTIONS.DEFAULT,
160
+ detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER]
161
+ },
162
+ {
163
+ label: "registration number",
164
+ selection: ENTITY_SELECTIONS.DEFAULT,
165
+ detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER]
166
+ },
167
+ {
168
+ label: "credit card number",
169
+ selection: ENTITY_SELECTIONS.DEFAULT,
170
+ detectionSources: [DETECTION_SOURCES.REGEX]
171
+ },
172
+ {
173
+ label: "passport number",
174
+ selection: ENTITY_SELECTIONS.DEFAULT,
175
+ detectionSources: [DETECTION_SOURCES.REGEX]
176
+ },
177
+ {
178
+ label: "crypto",
179
+ selection: ENTITY_SELECTIONS.DEFAULT,
180
+ detectionSources: [DETECTION_SOURCES.REGEX]
181
+ },
182
+ {
183
+ label: "monetary amount",
184
+ selection: ENTITY_SELECTIONS.DEFAULT,
185
+ detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.TRIGGER]
186
+ },
187
+ {
188
+ label: "land parcel",
189
+ selection: ENTITY_SELECTIONS.DEFAULT,
190
+ detectionSources: [DETECTION_SOURCES.TRIGGER]
191
+ },
192
+ {
193
+ label: "misc",
194
+ selection: ENTITY_SELECTIONS.DEFAULT,
195
+ detectionSources: [DETECTION_SOURCES.REGEX, DETECTION_SOURCES.DENY_LIST]
196
+ },
197
+ {
198
+ label: "ip address",
199
+ selection: ENTITY_SELECTIONS.OPT_IN,
200
+ detectionSources: [DETECTION_SOURCES.REGEX]
201
+ },
202
+ {
203
+ label: "mac address",
204
+ selection: ENTITY_SELECTIONS.OPT_IN,
205
+ detectionSources: [DETECTION_SOURCES.REGEX]
206
+ },
207
+ {
208
+ label: "url",
209
+ selection: ENTITY_SELECTIONS.OPT_IN,
210
+ detectionSources: [DETECTION_SOURCES.REGEX]
211
+ }
85
212
  ];
213
+ const ENTITY_LABELS = ENTITY_CAPABILITIES.map(({ label }) => label);
214
+ const isDefaultEntityCapability = (capability) => capability.selection === ENTITY_SELECTIONS.DEFAULT;
215
+ const DEFAULT_ENTITY_LABELS = ENTITY_CAPABILITIES.filter(isDefaultEntityCapability).map(({ label }) => label);
86
216
  //#endregion
87
- export { DEFAULT_ENTITY_LABELS, DETECTION_SOURCES, DETECTOR_PRIORITY, OPERATOR_TYPES };
217
+ export { DEFAULT_ENTITY_LABELS, DETECTION_SOURCES, DETECTOR_PRIORITY, ENTITY_CAPABILITIES, ENTITY_LABELS, ENTITY_SELECTIONS, OPERATOR_TYPES };
88
218
 
89
219
  //# sourceMappingURL=constants.mjs.map
@@ -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/text-search`,\n * `@stll/anonymize-wasm`, or any other runtime-bearing\n * module. 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\"] as const;\n\nexport type OperatorType = (typeof OPERATOR_TYPES)[number];\n\n/**\n * Canonical entity labels used across the pipeline.\n * NER models may use different native labels; the bench\n * NER wrapper maps model output to these canonical names.\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 DEFAULT_ENTITY_LABELS = [\n \"person\",\n \"organization\",\n \"phone number\",\n \"address\",\n \"country\",\n \"email address\",\n \"date\",\n \"date of birth\",\n \"bank account number\",\n \"iban\",\n \"tax identification number\",\n \"identity card number\",\n \"birth number\",\n \"national identification number\",\n \"social security number\",\n \"registration number\",\n \"credit card number\",\n \"passport number\",\n \"crypto\",\n \"monetary amount\",\n \"land parcel\",\n \"misc\",\n] as const;\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,WAAW,QAAQ;;;;;;;;;;AAalD,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
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/text-search`,\n * `@stll/anonymize-wasm`, or any other runtime-bearing\n * module. 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(isDefault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AW,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"}
@@ -50,18 +50,135 @@ declare const DETECTOR_PRIORITY: {
50
50
  * Anonymization operator types. Each operator defines
51
51
  * how a confirmed entity is replaced in the output.
52
52
  */
53
- declare const OPERATOR_TYPES: readonly ["replace", "redact"];
53
+ declare const OPERATOR_TYPES: readonly ["replace", "redact", "keep", "mask"];
54
54
  type OperatorType = (typeof OPERATOR_TYPES)[number];
55
+ declare const ENTITY_SELECTIONS: {
56
+ readonly DEFAULT: "default";
57
+ readonly OPT_IN: "opt-in";
58
+ };
59
+ type EntitySelection = (typeof ENTITY_SELECTIONS)[keyof typeof ENTITY_SELECTIONS];
60
+ type EntityCapability = {
61
+ label: string;
62
+ selection: EntitySelection;
63
+ detectionSources: readonly DetectionSource[];
64
+ };
55
65
  /**
56
- * Canonical entity labels used across the pipeline.
57
- * NER models may use different native labels; the bench
58
- * NER wrapper maps model output to these canonical names.
66
+ * Canonical entity capabilities exposed by the deterministic native pipeline.
67
+ * `selection` describes whether the default package requests the label; opt-in
68
+ * labels have built-in detection rules but must be requested explicitly.
59
69
  *
60
70
  * These labels are ephemeral: entities are regenerated on
61
71
  * every pipeline run and never persisted to the database.
62
72
  * Renaming a label here requires no migration.
63
73
  */
64
- declare const DEFAULT_ENTITY_LABELS: readonly ["person", "organization", "phone number", "address", "country", "email address", "date", "date of birth", "bank account number", "iban", "tax identification number", "identity card number", "birth number", "national identification number", "social security number", "registration number", "credit card number", "passport number", "crypto", "monetary amount", "land parcel", "misc"];
74
+ declare const ENTITY_CAPABILITIES: readonly [{
75
+ readonly label: "person";
76
+ readonly selection: "default";
77
+ readonly detectionSources: readonly ["trigger", "regex", "deny-list", "coreference"];
78
+ }, {
79
+ readonly label: "organization";
80
+ readonly selection: "default";
81
+ readonly detectionSources: readonly ["trigger", "deny-list", "legal-form", "gazetteer", "coreference"];
82
+ }, {
83
+ readonly label: "phone number";
84
+ readonly selection: "default";
85
+ readonly detectionSources: readonly ["regex", "trigger"];
86
+ }, {
87
+ readonly label: "address";
88
+ readonly selection: "default";
89
+ readonly detectionSources: readonly ["regex", "trigger", "deny-list"];
90
+ }, {
91
+ readonly label: "country";
92
+ readonly selection: "default";
93
+ readonly detectionSources: readonly ["country"];
94
+ }, {
95
+ readonly label: "email address";
96
+ readonly selection: "default";
97
+ readonly detectionSources: readonly ["regex"];
98
+ }, {
99
+ readonly label: "date";
100
+ readonly selection: "default";
101
+ readonly detectionSources: readonly ["regex", "trigger"];
102
+ }, {
103
+ readonly label: "date of birth";
104
+ readonly selection: "default";
105
+ readonly detectionSources: readonly ["trigger"];
106
+ }, {
107
+ readonly label: "bank account number";
108
+ readonly selection: "default";
109
+ readonly detectionSources: readonly ["regex", "trigger"];
110
+ }, {
111
+ readonly label: "iban";
112
+ readonly selection: "default";
113
+ readonly detectionSources: readonly ["regex", "trigger"];
114
+ }, {
115
+ readonly label: "tax identification number";
116
+ readonly selection: "default";
117
+ readonly detectionSources: readonly ["regex", "trigger"];
118
+ }, {
119
+ readonly label: "identity card number";
120
+ readonly selection: "default";
121
+ readonly detectionSources: readonly ["regex", "trigger"];
122
+ }, {
123
+ readonly label: "birth number";
124
+ readonly selection: "default";
125
+ readonly detectionSources: readonly ["regex", "trigger"];
126
+ }, {
127
+ readonly label: "national identification number";
128
+ readonly selection: "default";
129
+ readonly detectionSources: readonly ["regex", "trigger"];
130
+ }, {
131
+ readonly label: "social security number";
132
+ readonly selection: "default";
133
+ readonly detectionSources: readonly ["regex", "trigger"];
134
+ }, {
135
+ readonly label: "registration number";
136
+ readonly selection: "default";
137
+ readonly detectionSources: readonly ["regex", "trigger"];
138
+ }, {
139
+ readonly label: "credit card number";
140
+ readonly selection: "default";
141
+ readonly detectionSources: readonly ["regex"];
142
+ }, {
143
+ readonly label: "passport number";
144
+ readonly selection: "default";
145
+ readonly detectionSources: readonly ["regex"];
146
+ }, {
147
+ readonly label: "crypto";
148
+ readonly selection: "default";
149
+ readonly detectionSources: readonly ["regex"];
150
+ }, {
151
+ readonly label: "monetary amount";
152
+ readonly selection: "default";
153
+ readonly detectionSources: readonly ["regex", "trigger"];
154
+ }, {
155
+ readonly label: "land parcel";
156
+ readonly selection: "default";
157
+ readonly detectionSources: readonly ["trigger"];
158
+ }, {
159
+ readonly label: "misc";
160
+ readonly selection: "default";
161
+ readonly detectionSources: readonly ["regex", "deny-list"];
162
+ }, {
163
+ readonly label: "ip address";
164
+ readonly selection: "opt-in";
165
+ readonly detectionSources: readonly ["regex"];
166
+ }, {
167
+ readonly label: "mac address";
168
+ readonly selection: "opt-in";
169
+ readonly detectionSources: readonly ["regex"];
170
+ }, {
171
+ readonly label: "url";
172
+ readonly selection: "opt-in";
173
+ readonly detectionSources: readonly ["regex"];
174
+ }];
175
+ type KnownEntityCapability = (typeof ENTITY_CAPABILITIES)[number];
176
+ type EntityLabel = KnownEntityCapability["label"];
177
+ declare const ENTITY_LABELS: readonly EntityLabel[];
178
+ type DefaultEntityLabel = Extract<KnownEntityCapability, {
179
+ selection: typeof ENTITY_SELECTIONS.DEFAULT;
180
+ }>["label"];
181
+ declare const DEFAULT_ENTITY_LABELS: readonly DefaultEntityLabel[];
65
182
  //#endregion
66
- export { OPERATOR_TYPES as a, DetectionSource as i, DETECTION_SOURCES as n, OperatorType as o, DETECTOR_PRIORITY as r, DEFAULT_ENTITY_LABELS as t };
183
+ export { DetectionSource as a, ENTITY_SELECTIONS as c, EntitySelection as d, OPERATOR_TYPES as f, DefaultEntityLabel as i, EntityCapability as l, DETECTION_SOURCES as n, ENTITY_CAPABILITIES as o, OperatorType as p, DETECTOR_PRIORITY as r, ENTITY_LABELS as s, DEFAULT_ENTITY_LABELS as t, EntityLabel as u };
67
184
  //# sourceMappingURL=constants2.d.mts.map
@@ -11973,7 +11973,9 @@ var {
11973
11973
  }
11974
11974
  });
11975
11975
  var index_wasi_browser_default = __napiModule.exports;
11976
+ var NativePreparedRedactionSession = __napiModule.exports.NativePreparedRedactionSession;
11976
11977
  var NativePreparedSearch = __napiModule.exports.NativePreparedSearch;
11978
+ var NativePreparedSessionRedactionPlan = __napiModule.exports.NativePreparedSessionRedactionPlan;
11977
11979
  var assembleStaticSearchCompressedPackageBytes = __napiModule.exports.assembleStaticSearchCompressedPackageBytes;
11978
11980
  var assembleStaticSearchConfigJson = __napiModule.exports.assembleStaticSearchConfigJson;
11979
11981
  var assembleStaticSearchPackageBytes = __napiModule.exports.assembleStaticSearchPackageBytes;
@@ -11998,5 +12000,7 @@ export {
11998
12000
  assembleStaticSearchPackageBytes,
11999
12001
  assembleStaticSearchConfigJson,
12000
12002
  assembleStaticSearchCompressedPackageBytes,
12001
- NativePreparedSearch
12003
+ NativePreparedSessionRedactionPlan,
12004
+ NativePreparedSearch,
12005
+ NativePreparedRedactionSession
12002
12006
  };
@@ -108,7 +108,9 @@ const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule
108
108
  },
109
109
  })
110
110
  module.exports = __napiModule.exports
111
+ module.exports.NativePreparedRedactionSession = __napiModule.exports.NativePreparedRedactionSession
111
112
  module.exports.NativePreparedSearch = __napiModule.exports.NativePreparedSearch
113
+ module.exports.NativePreparedSessionRedactionPlan = __napiModule.exports.NativePreparedSessionRedactionPlan
112
114
  module.exports.assembleStaticSearchCompressedPackageBytes = __napiModule.exports.assembleStaticSearchCompressedPackageBytes
113
115
  module.exports.assembleStaticSearchConfigJson = __napiModule.exports.assembleStaticSearchConfigJson
114
116
  module.exports.assembleStaticSearchPackageBytes = __napiModule.exports.assembleStaticSearchPackageBytes
Binary file
package/dist/vite.d.mts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Plugin } from "vite";
2
-
3
2
  //#region src/vite.d.ts
4
3
  /** Which bundled `.stlanonpkg` prepared packages the plugin emits into a
5
4
  * production build. The wasm binary, glue, and workers are always emitted; only