@stll/anonymize 2.1.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/README.md +3 -6
- package/dist/capabilities.d.mts +139 -4
- package/dist/capabilities.mjs +88 -3
- package/dist/capabilities.mjs.map +1 -1
- package/dist/constants.mjs +9 -4
- package/dist/constants.mjs.map +1 -1
- package/dist/constants2.d.mts +8 -4
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/native-node2.mjs +26 -10
- package/dist/native-node2.mjs.map +1 -1
- package/dist/native.d.mts +20 -13
- 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 +11 -17
package/README.md
CHANGED
|
@@ -298,16 +298,13 @@ export default {
|
|
|
298
298
|
- Native architecture and extension guidance:
|
|
299
299
|
[`ARCHITECTURE.md`](ARCHITECTURE.md).
|
|
300
300
|
- `labels: []` disables deterministic label filtering.
|
|
301
|
-
-
|
|
302
|
-
|
|
303
|
-
|
|
301
|
+
- Model-produced (NER) spans are not part of `PipelineConfig`; supply
|
|
302
|
+
deterministic custom rules today and use the caller-detection API for
|
|
303
|
+
model-produced spans.
|
|
304
304
|
- `enableNameCorpus` also controls whether first names, surnames, and titles are injected into deny-list matching when `enableDenyList` is enabled.
|
|
305
305
|
- The optional `@stll/anonymize-data` package carries the published dictionary and trigger data used when building prepared packages.
|
|
306
306
|
- `customDenyList` and `customRegexes` are part of the prepared package input and should be regenerated when they change.
|
|
307
|
-
- The old TypeScript pipeline is kept only as temporary internal migration/test scaffolding under `src/legacy.ts`; it is not the product runtime.
|
|
308
307
|
|
|
309
308
|
## Built on
|
|
310
309
|
|
|
311
|
-
- `@stll/text-search`
|
|
312
|
-
- `@stll/stdnum`
|
|
313
310
|
- `@stll/anonymize-data`
|
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
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Runtime-free constants for the anonymization pipeline.
|
|
4
4
|
*
|
|
5
5
|
* This module is the SSR-safe / browser-safe entrypoint:
|
|
6
|
-
* importing it must not pull in `@stll/
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* importing it must not pull in `@stll/anonymize-wasm`
|
|
7
|
+
* or any other runtime-bearing module.
|
|
8
|
+
* Consumers that only need the static label list,
|
|
9
9
|
* detection-source identifiers, or operator names import
|
|
10
10
|
* from `@stll/anonymize/constants` (or
|
|
11
11
|
* `@stll/anonymize-wasm/constants`) without paying the
|
|
@@ -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/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(isDefaultEntityCapability).map(\n ({ label }) => label,\n );\n"],"mappings":"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"}
|
|
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":"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"}
|
package/dist/constants2.d.mts
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Runtime-free constants for the anonymization pipeline.
|
|
4
4
|
*
|
|
5
5
|
* This module is the SSR-safe / browser-safe entrypoint:
|
|
6
|
-
* importing it must not pull in `@stll/
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* importing it must not pull in `@stll/anonymize-wasm`
|
|
7
|
+
* or any other runtime-bearing module.
|
|
8
|
+
* Consumers that only need the static label list,
|
|
9
9
|
* detection-source identifiers, or operator names import
|
|
10
10
|
* from `@stll/anonymize/constants` (or
|
|
11
11
|
* `@stll/anonymize-wasm/constants`) without paying the
|
|
@@ -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-node2.mjs
CHANGED
|
@@ -186,12 +186,31 @@ const pipelineConfigKey = (config, gazetteerEntries) => {
|
|
|
186
186
|
const gazFingerprint = config.enableGazetteer && gazetteerEntries.length > 0 ? gazetteerEntries.map((entry) => `${entry.id}:${entry.canonical}:${entry.label}:${[...entry.variants].sort().join(",")}`).toSorted().join(";") : "";
|
|
187
187
|
return `${config.enableDenyList}:${config.enableTriggerPhrases}:${legalFormsEnabled}:${config.enableNameCorpus}:${contentLanguageFingerprint(config)}:${config.nameCorpusLanguages?.toSorted().join(",") ?? ""}:${config.enableRegex}:${config.threshold}:${config.enableConfidenceBoost}:${config.enableHotwordRules === true}:${config.enableCoreference === true}:${config.enableZoneClassification === true}:${config.labels.toSorted().join(",")}:${config.denyListCountries?.toSorted().join(",") ?? ""}:${config.denyListRegions?.toSorted().join(",") ?? ""}:${config.denyListExcludeCategories?.toSorted().join(",") ?? ""}:${customDenyFingerprint}:${customRegexFingerprint}:${config.enableGazetteer}:${gazFingerprint}:${config.enableCountries !== false}`;
|
|
188
188
|
};
|
|
189
|
-
//#endregion
|
|
190
|
-
//#region src/native-pipeline.ts
|
|
191
189
|
const sharedPackageByDictionaries = /* @__PURE__ */ new WeakMap();
|
|
192
190
|
const sharedPackageWithoutDictionaries = /* @__PURE__ */ new Map();
|
|
193
191
|
const dictionaryCacheIds = /* @__PURE__ */ new WeakMap();
|
|
194
192
|
let nextDictionaryCacheId = 0;
|
|
193
|
+
/** Record `key` as most-recently-used in `cache`, evicting the
|
|
194
|
+
* least-recently-used entry first once the cache is at capacity. A `Map`'s
|
|
195
|
+
* insertion order doubles as recency order here: touching an existing key
|
|
196
|
+
* deletes then re-sets it to move it to the end, and eviction drops the
|
|
197
|
+
* first (oldest) key.
|
|
198
|
+
*
|
|
199
|
+
* Evicting a still-in-flight build only drops the cache's reference to its
|
|
200
|
+
* promise; the caller that started the build (and any concurrent caller that
|
|
201
|
+
* already read the promise before eviction) still resolves it correctly via
|
|
202
|
+
* the guarded `sharedCache.get(key) === promise` checks in
|
|
203
|
+
* `getCachedNativePipelinePackage`. A later caller for the same key just
|
|
204
|
+
* misses the dedupe and starts a fresh build — bounded memory takes priority
|
|
205
|
+
* over perfect dedupe under cache pressure. */
|
|
206
|
+
const touchSharedPackageCacheEntry = (cache, key, value) => {
|
|
207
|
+
cache.delete(key);
|
|
208
|
+
if (cache.size >= 32) {
|
|
209
|
+
const oldestKey = cache.keys().next().value;
|
|
210
|
+
if (oldestKey !== void 0) cache.delete(oldestKey);
|
|
211
|
+
}
|
|
212
|
+
cache.set(key, value);
|
|
213
|
+
};
|
|
195
214
|
const dictionaryCacheKey = (dictionaries) => {
|
|
196
215
|
if (dictionaries === void 0) return "none";
|
|
197
216
|
const existing = dictionaryCacheIds.get(dictionaries);
|
|
@@ -210,7 +229,7 @@ const sharedPackageCacheFor = (dictionaries) => {
|
|
|
210
229
|
};
|
|
211
230
|
const getNativePipelineCompatibility = (config) => {
|
|
212
231
|
const unsupportedFeatures = [];
|
|
213
|
-
if (config.enableNer) unsupportedFeatures.push("enableNer");
|
|
232
|
+
if ("enableNer" in config && Boolean(config.enableNer)) unsupportedFeatures.push("enableNer");
|
|
214
233
|
if (unsupportedFeatures.length === 0) return { status: "supported" };
|
|
215
234
|
return {
|
|
216
235
|
status: "unsupported",
|
|
@@ -229,11 +248,8 @@ const encoder = new TextEncoder();
|
|
|
229
248
|
* the separate bundle preferentially, and keeping the (large) dictionaries out
|
|
230
249
|
* of the config JSON avoids serializing them twice.
|
|
231
250
|
*/
|
|
232
|
-
const toAssembleInputs = ({ dictionaries,
|
|
233
|
-
pipelineConfigJson: encoder.encode(JSON.stringify(
|
|
234
|
-
...config,
|
|
235
|
-
enableNer
|
|
236
|
-
})),
|
|
251
|
+
const toAssembleInputs = ({ dictionaries, ...config }, gazetteerEntries) => ({
|
|
252
|
+
pipelineConfigJson: encoder.encode(JSON.stringify(config)),
|
|
237
253
|
dictionariesJson: dictionaries === void 0 ? void 0 : encoder.encode(JSON.stringify(dictionaries)),
|
|
238
254
|
gazetteerJson: gazetteerEntries.length === 0 ? void 0 : encoder.encode(JSON.stringify(gazetteerEntries))
|
|
239
255
|
});
|
|
@@ -287,6 +303,7 @@ const getCachedNativePipelinePackage = async ({ binding, config, gazetteerEntrie
|
|
|
287
303
|
const sharedCache = sharedPackageCacheFor(scopedConfig.dictionaries);
|
|
288
304
|
const shared = sharedCache.get(key);
|
|
289
305
|
if (shared !== void 0) {
|
|
306
|
+
touchSharedPackageCacheEntry(sharedCache, key, shared);
|
|
290
307
|
const packageBytes = await shared;
|
|
291
308
|
ctx.nativePipelinePackage = packageBytes;
|
|
292
309
|
ctx.nativePipelinePackageKey = key;
|
|
@@ -302,7 +319,7 @@ const getCachedNativePipelinePackage = async ({ binding, config, gazetteerEntrie
|
|
|
302
319
|
compressed
|
|
303
320
|
});
|
|
304
321
|
ctx.nativePipelinePackagePromise = promise;
|
|
305
|
-
sharedCache
|
|
322
|
+
touchSharedPackageCacheEntry(sharedCache, key, promise);
|
|
306
323
|
let packageBytes;
|
|
307
324
|
try {
|
|
308
325
|
packageBytes = await promise;
|
|
@@ -339,7 +356,6 @@ const DEFAULT_NATIVE_PIPELINE_CONFIG = {
|
|
|
339
356
|
enableDenyList: true,
|
|
340
357
|
enableGazetteer: false,
|
|
341
358
|
enableCountries: true,
|
|
342
|
-
enableNer: false,
|
|
343
359
|
enableConfidenceBoost: true,
|
|
344
360
|
enableCoreference: true,
|
|
345
361
|
enableHotwordRules: true,
|