@stll/anonymize 1.5.0 → 2.0.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/ATTRIBUTION.md +70 -0
- package/README.md +86 -48
- package/dist/index.d.mts +3 -1201
- package/dist/index.mjs +3 -16267
- package/dist/index.mjs.map +1 -1
- package/dist/native-node.d.mts +138 -0
- package/dist/native-node.mjs +3 -0
- package/dist/native-node2.d.mts +3 -0
- package/dist/native-node2.mjs +728 -0
- package/dist/native-node2.mjs.map +1 -0
- package/dist/native.d.mts +970 -0
- package/dist/native.mjs +230 -0
- package/dist/native.mjs.map +1 -0
- package/dist/native2.d.mts +2 -0
- package/index.cjs +3 -0
- 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 +57 -9
- package/scripts/build-native-pipeline-package.mjs +225 -0
- package/dist/address-boundaries.mjs +0 -195
- package/dist/address-boundaries.mjs.map +0 -1
- package/dist/address-prepositions.mjs +0 -182
- package/dist/address-prepositions.mjs.map +0 -1
- package/dist/address-stop-keywords.mjs +0 -137
- package/dist/address-stop-keywords.mjs.map +0 -1
- package/dist/address-stopwords.mjs +0 -84
- package/dist/address-stopwords.mjs.map +0 -1
- package/dist/allow-list.mjs +0 -196
- package/dist/allow-list.mjs.map +0 -1
- package/dist/clause-noun-heads.mjs +0 -75
- package/dist/clause-noun-heads.mjs.map +0 -1
- package/dist/common-words-en.mjs +0 -9887
- package/dist/common-words-en.mjs.map +0 -1
- package/dist/coreference.cs.mjs +0 -14
- package/dist/coreference.cs.mjs.map +0 -1
- package/dist/coreference.de.mjs +0 -14
- package/dist/coreference.de.mjs.map +0 -1
- package/dist/coreference.en.mjs +0 -14
- package/dist/coreference.en.mjs.map +0 -1
- package/dist/coreference.es.mjs +0 -22
- package/dist/coreference.es.mjs.map +0 -1
- package/dist/coreference.fr.mjs +0 -32
- package/dist/coreference.fr.mjs.map +0 -1
- package/dist/coreference.it.mjs +0 -27
- package/dist/coreference.it.mjs.map +0 -1
- package/dist/coreference.pl.mjs +0 -27
- package/dist/coreference.pl.mjs.map +0 -1
- package/dist/coreference.pt-br.mjs +0 -14
- package/dist/coreference.pt-br.mjs.map +0 -1
- package/dist/coreference.sk.mjs +0 -27
- package/dist/coreference.sk.mjs.map +0 -1
- package/dist/currencies.mjs +0 -231
- package/dist/currencies.mjs.map +0 -1
- package/dist/date-months.mjs +0 -618
- package/dist/date-months.mjs.map +0 -1
- package/dist/document-structure-headings.mjs +0 -90
- package/dist/document-structure-headings.mjs.map +0 -1
- package/dist/generic-roles.mjs +0 -244
- package/dist/generic-roles.mjs.map +0 -1
- package/dist/hotword-rules.mjs +0 -149
- package/dist/hotword-rules.mjs.map +0 -1
- package/dist/legal-form-leading-clauses.mjs +0 -23
- package/dist/legal-form-leading-clauses.mjs.map +0 -1
- package/dist/legal-forms.mjs +0 -2115
- package/dist/legal-forms.mjs.map +0 -1
- package/dist/legal-role-heads.cs.mjs +0 -42
- package/dist/legal-role-heads.cs.mjs.map +0 -1
- package/dist/legal-role-heads.de.mjs +0 -33
- package/dist/legal-role-heads.de.mjs.map +0 -1
- package/dist/legal-role-heads.en.mjs +0 -37
- package/dist/legal-role-heads.en.mjs.map +0 -1
- package/dist/legal-role-heads.es.mjs +0 -54
- package/dist/legal-role-heads.es.mjs.map +0 -1
- package/dist/legal-role-heads.fr.mjs +0 -72
- package/dist/legal-role-heads.fr.mjs.map +0 -1
- package/dist/legal-role-heads.it.mjs +0 -68
- package/dist/legal-role-heads.it.mjs.map +0 -1
- package/dist/legal-role-heads.pl.mjs +0 -84
- package/dist/legal-role-heads.pl.mjs.map +0 -1
- package/dist/legal-role-heads.pt-br.mjs +0 -63
- package/dist/legal-role-heads.pt-br.mjs.map +0 -1
- package/dist/legal-role-heads.sk.mjs +0 -80
- package/dist/legal-role-heads.sk.mjs.map +0 -1
- package/dist/manifest.mjs +0 -69
- package/dist/manifest.mjs.map +0 -1
- package/dist/names-exclusions.mjs +0 -223
- package/dist/names-exclusions.mjs.map +0 -1
- package/dist/names-first.mjs +0 -418
- package/dist/names-first.mjs.map +0 -1
- package/dist/names-nw-ar.mjs +0 -202
- package/dist/names-nw-ar.mjs.map +0 -1
- package/dist/names-nw-excluded-allcaps.mjs +0 -112
- package/dist/names-nw-excluded-allcaps.mjs.map +0 -1
- package/dist/names-nw-fil.mjs +0 -202
- package/dist/names-nw-fil.mjs.map +0 -1
- package/dist/names-nw-id.mjs +0 -210
- package/dist/names-nw-id.mjs.map +0 -1
- package/dist/names-nw-in.mjs +0 -526
- package/dist/names-nw-in.mjs.map +0 -1
- package/dist/names-nw-ja-latn.mjs +0 -260
- package/dist/names-nw-ja-latn.mjs.map +0 -1
- package/dist/names-nw-ko.mjs +0 -162
- package/dist/names-nw-ko.mjs.map +0 -1
- package/dist/names-nw-th.mjs +0 -188
- package/dist/names-nw-th.mjs.map +0 -1
- package/dist/names-nw-vi.mjs +0 -151
- package/dist/names-nw-vi.mjs.map +0 -1
- package/dist/names-nw-zh-latn.mjs +0 -197
- package/dist/names-nw-zh-latn.mjs.map +0 -1
- package/dist/names-surnames.mjs +0 -113
- package/dist/names-surnames.mjs.map +0 -1
- package/dist/names-title-tokens.mjs +0 -40
- package/dist/names-title-tokens.mjs.map +0 -1
- package/dist/person-stopwords.mjs +0 -205
- package/dist/person-stopwords.mjs.map +0 -1
- package/dist/section-headings.mjs +0 -64
- package/dist/section-headings.mjs.map +0 -1
- package/dist/sentence-verb-indicators.mjs +0 -232
- package/dist/sentence-verb-indicators.mjs.map +0 -1
- package/dist/signing-clauses.mjs +0 -78
- package/dist/signing-clauses.mjs.map +0 -1
- package/dist/stopwords.mjs +0 -9915
- package/dist/stopwords.mjs.map +0 -1
- package/dist/structural-single-cap-prefixes.mjs +0 -99
- package/dist/structural-single-cap-prefixes.mjs.map +0 -1
- package/dist/triggers.cs.mjs +0 -569
- package/dist/triggers.cs.mjs.map +0 -1
- package/dist/triggers.de.mjs +0 -139
- package/dist/triggers.de.mjs.map +0 -1
- package/dist/triggers.en.mjs +0 -119
- package/dist/triggers.en.mjs.map +0 -1
- package/dist/triggers.es.mjs +0 -96
- package/dist/triggers.es.mjs.map +0 -1
- package/dist/triggers.fr.mjs +0 -275
- package/dist/triggers.fr.mjs.map +0 -1
- package/dist/triggers.global.mjs +0 -79
- package/dist/triggers.global.mjs.map +0 -1
- package/dist/triggers.hu.mjs +0 -41
- package/dist/triggers.hu.mjs.map +0 -1
- package/dist/triggers.it.mjs +0 -74
- package/dist/triggers.it.mjs.map +0 -1
- package/dist/triggers.pl.mjs +0 -271
- package/dist/triggers.pl.mjs.map +0 -1
- package/dist/triggers.pt-br.mjs +0 -193
- package/dist/triggers.pt-br.mjs.map +0 -1
- package/dist/triggers.ro.mjs +0 -59
- package/dist/triggers.ro.mjs.map +0 -1
- package/dist/triggers.sk.mjs +0 -555
- package/dist/triggers.sk.mjs.map +0 -1
- package/dist/triggers.sv.mjs +0 -58
- package/dist/triggers.sv.mjs.map +0 -1
- package/dist/year-words.mjs +0 -62
- package/dist/year-words.mjs.map +0 -1
|
@@ -0,0 +1,970 @@
|
|
|
1
|
+
import { i as DetectionSource, n as DETECTION_SOURCES, o as OperatorType } from "./constants2.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/native-search-config.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Structural type for the prepared static-search config the native binding
|
|
6
|
+
* consumes and the Rust assembler emits (`assembleStaticSearchConfigJson`).
|
|
7
|
+
*
|
|
8
|
+
* This config used to be built in TypeScript by `build-unified-search.ts`; that
|
|
9
|
+
* layer was retired in favor of the Rust assembler
|
|
10
|
+
* (`crates/anonymize-adapter-contract` `assemble_static_search_config`). The
|
|
11
|
+
* type now lives here as a pure, dependency-free description of the JSON the
|
|
12
|
+
* binding accepts on its `fromConfigJsonBytes` / prepare paths, so callers that
|
|
13
|
+
* hold a pre-assembled config keep a precise type without pulling in the
|
|
14
|
+
* deleted detector modules.
|
|
15
|
+
*/
|
|
16
|
+
type PatternSlice = {
|
|
17
|
+
start: number;
|
|
18
|
+
end: number;
|
|
19
|
+
};
|
|
20
|
+
type NativeSearchPatternKind = "literal" | "literal-with-options" | "regex" | "fuzzy";
|
|
21
|
+
type NativeSearchPattern = {
|
|
22
|
+
kind: NativeSearchPatternKind;
|
|
23
|
+
pattern: string;
|
|
24
|
+
distance?: number;
|
|
25
|
+
case_insensitive?: boolean;
|
|
26
|
+
whole_words?: boolean;
|
|
27
|
+
lazy?: boolean;
|
|
28
|
+
prefilter_any?: string[];
|
|
29
|
+
prefilter_case_insensitive?: boolean;
|
|
30
|
+
prefilter_regex?: string;
|
|
31
|
+
prefilter_window_bytes?: number;
|
|
32
|
+
prepared_artifact_policy?: "include" | "omit";
|
|
33
|
+
};
|
|
34
|
+
type NativeSearchOptions = {
|
|
35
|
+
literal_case_insensitive?: boolean;
|
|
36
|
+
literal_whole_words?: boolean;
|
|
37
|
+
regex_whole_words?: boolean;
|
|
38
|
+
regex_overlap_all?: boolean;
|
|
39
|
+
regex_artifact_policy?: "include" | "omit";
|
|
40
|
+
fuzzy_case_insensitive?: boolean;
|
|
41
|
+
fuzzy_whole_words?: boolean;
|
|
42
|
+
fuzzy_normalize_diacritics?: boolean;
|
|
43
|
+
};
|
|
44
|
+
type NativeRegexMatchMeta = {
|
|
45
|
+
label: string;
|
|
46
|
+
score: number;
|
|
47
|
+
source_detail?: string;
|
|
48
|
+
requires_validation?: boolean;
|
|
49
|
+
validator_id?: string;
|
|
50
|
+
validator_input?: string;
|
|
51
|
+
min_byte_length?: number;
|
|
52
|
+
};
|
|
53
|
+
type NativeSigningPlaceGuardData = {
|
|
54
|
+
prefix_phrases: string[];
|
|
55
|
+
suffix_phrases: string[];
|
|
56
|
+
};
|
|
57
|
+
type NativeDenyListFilterData = {
|
|
58
|
+
stopwords: string[];
|
|
59
|
+
allow_list: string[];
|
|
60
|
+
person_stopwords: string[];
|
|
61
|
+
person_trailing_nouns: string[];
|
|
62
|
+
address_stopwords: string[];
|
|
63
|
+
address_jurisdiction_prefixes: string[];
|
|
64
|
+
street_types: string[];
|
|
65
|
+
address_component_terms: string[];
|
|
66
|
+
ambiguous_street_type_terms: string[];
|
|
67
|
+
first_names: string[];
|
|
68
|
+
generic_roles: string[];
|
|
69
|
+
number_abbrev_prefixes: string[];
|
|
70
|
+
sentence_starters: string[];
|
|
71
|
+
trailing_address_word_exclusions: string[];
|
|
72
|
+
document_heading_words: string[];
|
|
73
|
+
document_heading_ordinal_markers: string[];
|
|
74
|
+
defined_term_cues: string[];
|
|
75
|
+
signing_place_guards: NativeSigningPlaceGuardData[];
|
|
76
|
+
};
|
|
77
|
+
type NativeDenyListMatchData = {
|
|
78
|
+
labels?: string[][];
|
|
79
|
+
label_table?: string[];
|
|
80
|
+
label_indices?: number[][];
|
|
81
|
+
custom_labels?: string[][];
|
|
82
|
+
custom_label_indices?: number[][];
|
|
83
|
+
originals: string[];
|
|
84
|
+
sources?: string[][];
|
|
85
|
+
source_table?: string[];
|
|
86
|
+
source_indices?: number[][];
|
|
87
|
+
filters?: NativeDenyListFilterData;
|
|
88
|
+
};
|
|
89
|
+
type NativeTriggerStrategy = {
|
|
90
|
+
type: "to-next-comma";
|
|
91
|
+
stop_words?: string[];
|
|
92
|
+
max_length?: number;
|
|
93
|
+
} | {
|
|
94
|
+
type: "to-end-of-line";
|
|
95
|
+
} | {
|
|
96
|
+
type: "n-words";
|
|
97
|
+
count: number;
|
|
98
|
+
} | {
|
|
99
|
+
type: "company-id-value";
|
|
100
|
+
} | {
|
|
101
|
+
type: "address";
|
|
102
|
+
max_chars?: number;
|
|
103
|
+
} | {
|
|
104
|
+
type: "match-pattern";
|
|
105
|
+
pattern: string;
|
|
106
|
+
flags?: string;
|
|
107
|
+
};
|
|
108
|
+
type NativeTriggerValidation = {
|
|
109
|
+
type: "starts-uppercase";
|
|
110
|
+
} | {
|
|
111
|
+
type: "min-length";
|
|
112
|
+
min: number;
|
|
113
|
+
} | {
|
|
114
|
+
type: "max-length";
|
|
115
|
+
max: number;
|
|
116
|
+
} | {
|
|
117
|
+
type: "no-digits";
|
|
118
|
+
} | {
|
|
119
|
+
type: "has-digits";
|
|
120
|
+
} | {
|
|
121
|
+
type: "matches-pattern";
|
|
122
|
+
pattern: string;
|
|
123
|
+
flags?: string;
|
|
124
|
+
} | {
|
|
125
|
+
type: "valid-id";
|
|
126
|
+
validator: string;
|
|
127
|
+
};
|
|
128
|
+
type NativeTriggerRule = {
|
|
129
|
+
trigger: string;
|
|
130
|
+
label: string;
|
|
131
|
+
strategy: NativeTriggerStrategy;
|
|
132
|
+
validations: NativeTriggerValidation[];
|
|
133
|
+
include_trigger: boolean;
|
|
134
|
+
};
|
|
135
|
+
type NativeTriggerData = {
|
|
136
|
+
rules: NativeTriggerRule[];
|
|
137
|
+
address_stop_keywords: string[];
|
|
138
|
+
party_position_terms: string[];
|
|
139
|
+
post_nominals: string[];
|
|
140
|
+
sentence_terminal_currency_terms: string[];
|
|
141
|
+
phone_extension_labels: string[];
|
|
142
|
+
number_markers: string[];
|
|
143
|
+
number_labels: string[];
|
|
144
|
+
};
|
|
145
|
+
type NativeLegalFormData = {
|
|
146
|
+
suffixes: string[];
|
|
147
|
+
normalized_boundary_suffixes: string[];
|
|
148
|
+
normalized_in_name_words: string[];
|
|
149
|
+
normalized_suffix_words: string[];
|
|
150
|
+
role_heads: string[];
|
|
151
|
+
sentence_verb_indicators: string[];
|
|
152
|
+
clause_noun_heads: string[];
|
|
153
|
+
connector_prose_heads: string[];
|
|
154
|
+
structural_single_cap_prefixes: string[];
|
|
155
|
+
leading_clause_phrases: string[];
|
|
156
|
+
leading_clause_direct_prefixes: string[];
|
|
157
|
+
connector_words: string[];
|
|
158
|
+
and_connector_words: string[];
|
|
159
|
+
in_name_prepositions: string[];
|
|
160
|
+
company_suffix_words: string[];
|
|
161
|
+
comma_gated_direct_prefixes: string[];
|
|
162
|
+
};
|
|
163
|
+
type NativeDateMonthData = Record<string, string[]>;
|
|
164
|
+
type NativeYearWordData = Record<string, string[]>;
|
|
165
|
+
type NativeDateData = {
|
|
166
|
+
month_names_by_language: NativeDateMonthData;
|
|
167
|
+
year_words_by_language: NativeYearWordData;
|
|
168
|
+
};
|
|
169
|
+
type NativeMonetaryData = {
|
|
170
|
+
currencies: {
|
|
171
|
+
codes: string[];
|
|
172
|
+
symbols: string[];
|
|
173
|
+
local_names: string[];
|
|
174
|
+
};
|
|
175
|
+
amount_words: {
|
|
176
|
+
written_amount_patterns: Array<{
|
|
177
|
+
keywords: string[];
|
|
178
|
+
}>;
|
|
179
|
+
magnitude_suffixes: Array<{
|
|
180
|
+
words: string[];
|
|
181
|
+
abbreviations_case_insensitive: string[];
|
|
182
|
+
abbreviations_case_sensitive: string[];
|
|
183
|
+
}>;
|
|
184
|
+
share_quantity_terms: Array<{
|
|
185
|
+
modifiers: string[];
|
|
186
|
+
nouns: string[];
|
|
187
|
+
}>;
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
type NativeAddressSeedData = {
|
|
191
|
+
boundary_words: string[];
|
|
192
|
+
br_cep_cue_words: string[];
|
|
193
|
+
unit_abbreviations: string[];
|
|
194
|
+
};
|
|
195
|
+
type NativeAddressContextData = {
|
|
196
|
+
address_prepositions: string[];
|
|
197
|
+
temporal_prepositions: string[];
|
|
198
|
+
street_abbreviations: string[];
|
|
199
|
+
bare_house_stopwords: string[];
|
|
200
|
+
};
|
|
201
|
+
type NativeCoreferencePatternData = {
|
|
202
|
+
pattern: string;
|
|
203
|
+
flags: string;
|
|
204
|
+
};
|
|
205
|
+
type NativeCoreferenceData = {
|
|
206
|
+
definition_patterns: NativeCoreferencePatternData[];
|
|
207
|
+
role_stop_terms: string[];
|
|
208
|
+
legal_form_aliases: string[];
|
|
209
|
+
organization_suffixes: string[];
|
|
210
|
+
organization_determiners: string[];
|
|
211
|
+
};
|
|
212
|
+
type NativeNameCorpusData = {
|
|
213
|
+
first_names: string[];
|
|
214
|
+
surnames: string[];
|
|
215
|
+
title_tokens: string[];
|
|
216
|
+
title_abbreviations: string[];
|
|
217
|
+
excluded_words: string[];
|
|
218
|
+
common_words: string[];
|
|
219
|
+
non_western_names: string[];
|
|
220
|
+
excluded_all_caps: string[];
|
|
221
|
+
ja_suffixes: string[];
|
|
222
|
+
arabic_connectors: string[];
|
|
223
|
+
relation_connectors: string[];
|
|
224
|
+
hyphenated_prefixes: string[];
|
|
225
|
+
cjk_non_person_terms: string[];
|
|
226
|
+
cjk_surname_starters: string[];
|
|
227
|
+
organization_terms: string[];
|
|
228
|
+
};
|
|
229
|
+
type NativeNameCorpusMode = "full" | "supplemental";
|
|
230
|
+
type NativeZonePatternData = {
|
|
231
|
+
pattern: string;
|
|
232
|
+
flags: string;
|
|
233
|
+
};
|
|
234
|
+
type NativeZoneSigningClauseData = {
|
|
235
|
+
prefix: string;
|
|
236
|
+
suffix: string;
|
|
237
|
+
prepositions: string[];
|
|
238
|
+
};
|
|
239
|
+
type NativeZoneData = {
|
|
240
|
+
section_heading_patterns: NativeZonePatternData[];
|
|
241
|
+
signing_clauses: NativeZoneSigningClauseData[];
|
|
242
|
+
};
|
|
243
|
+
type NativeCountryData = {
|
|
244
|
+
labels: string[];
|
|
245
|
+
isoCodes: string[];
|
|
246
|
+
variants: Array<"name" | "alias" | "alpha3" | "alpha2">;
|
|
247
|
+
};
|
|
248
|
+
type NativeGazetteerData = {
|
|
249
|
+
labels: string[];
|
|
250
|
+
is_fuzzy: boolean[];
|
|
251
|
+
};
|
|
252
|
+
type NativeHotwordRule = {
|
|
253
|
+
hotwords: string[];
|
|
254
|
+
target_labels: string[];
|
|
255
|
+
score_adjustment: number;
|
|
256
|
+
reclassify_to?: string;
|
|
257
|
+
proximity_before: number;
|
|
258
|
+
proximity_after: number;
|
|
259
|
+
};
|
|
260
|
+
type NativeHotwordRuleData = {
|
|
261
|
+
rules: NativeHotwordRule[];
|
|
262
|
+
pattern_rule_indices: number[];
|
|
263
|
+
};
|
|
264
|
+
type NativeSignatureData = {
|
|
265
|
+
labels: string[];
|
|
266
|
+
witness_phrases: string[];
|
|
267
|
+
name_particles: string[];
|
|
268
|
+
post_nominal_suffixes: string[];
|
|
269
|
+
organization_suffixes: string[];
|
|
270
|
+
image_stub_prefixes: string[];
|
|
271
|
+
};
|
|
272
|
+
type NativePreparedSearchConfig = {
|
|
273
|
+
regex_patterns: NativeSearchPattern[];
|
|
274
|
+
custom_regex_patterns: NativeSearchPattern[];
|
|
275
|
+
literal_patterns: NativeSearchPattern[];
|
|
276
|
+
regex_options: NativeSearchOptions;
|
|
277
|
+
custom_regex_options: NativeSearchOptions;
|
|
278
|
+
literal_options: NativeSearchOptions;
|
|
279
|
+
literal_patterns_from_deny_list_data?: boolean;
|
|
280
|
+
allowed_labels: string[];
|
|
281
|
+
threshold: number;
|
|
282
|
+
confidence_boost: boolean;
|
|
283
|
+
slices: {
|
|
284
|
+
regex: PatternSlice;
|
|
285
|
+
custom_regex: PatternSlice;
|
|
286
|
+
legal_forms?: PatternSlice;
|
|
287
|
+
triggers?: PatternSlice;
|
|
288
|
+
deny_list: PatternSlice;
|
|
289
|
+
street_types?: PatternSlice;
|
|
290
|
+
gazetteer: PatternSlice;
|
|
291
|
+
countries: PatternSlice;
|
|
292
|
+
hotwords?: PatternSlice;
|
|
293
|
+
};
|
|
294
|
+
regex_meta: NativeRegexMatchMeta[];
|
|
295
|
+
custom_regex_meta: NativeRegexMatchMeta[];
|
|
296
|
+
deny_list_data?: NativeDenyListMatchData;
|
|
297
|
+
false_positive_filters?: NativeDenyListFilterData;
|
|
298
|
+
gazetteer_data?: NativeGazetteerData;
|
|
299
|
+
country_data?: NativeCountryData;
|
|
300
|
+
hotword_data?: NativeHotwordRuleData;
|
|
301
|
+
trigger_data?: NativeTriggerData;
|
|
302
|
+
legal_form_data?: NativeLegalFormData;
|
|
303
|
+
address_seed_data?: NativeAddressSeedData;
|
|
304
|
+
zone_data?: NativeZoneData;
|
|
305
|
+
address_context_data?: NativeAddressContextData;
|
|
306
|
+
coreference_data?: NativeCoreferenceData;
|
|
307
|
+
name_corpus_data?: NativeNameCorpusData;
|
|
308
|
+
signature_data?: NativeSignatureData;
|
|
309
|
+
name_corpus_mode?: NativeNameCorpusMode;
|
|
310
|
+
date_data?: NativeDateData;
|
|
311
|
+
monetary_data?: NativeMonetaryData;
|
|
312
|
+
};
|
|
313
|
+
//#endregion
|
|
314
|
+
//#region src/types.d.ts
|
|
315
|
+
/**
|
|
316
|
+
* Fields shared by every entity span in the source text.
|
|
317
|
+
*/
|
|
318
|
+
type EntityBase = {
|
|
319
|
+
start: number;
|
|
320
|
+
end: number;
|
|
321
|
+
label: string;
|
|
322
|
+
text: string;
|
|
323
|
+
score: number;
|
|
324
|
+
sourceDetail?: "custom-deny-list" | "custom-regex" | "gazetteer-extension";
|
|
325
|
+
};
|
|
326
|
+
/**
|
|
327
|
+
* A PII entity span found by a primary detection layer
|
|
328
|
+
* (regex, NER, legal forms, deny list, ...).
|
|
329
|
+
*/
|
|
330
|
+
type DetectedEntity = EntityBase & {
|
|
331
|
+
source: Exclude<DetectionSource, typeof DETECTION_SOURCES.COREFERENCE>;
|
|
332
|
+
};
|
|
333
|
+
/**
|
|
334
|
+
* An alias mention of a previously detected entity: a
|
|
335
|
+
* defined term ("the Seller") or a propagated bare
|
|
336
|
+
* mention ("Acme" after "Acme Corp.").
|
|
337
|
+
*
|
|
338
|
+
* `corefSourceText` is required by construction, so an
|
|
339
|
+
* alias cannot exist without the link back to its source
|
|
340
|
+
* entity. Placeholder numbering reads it to give the
|
|
341
|
+
* alias the same placeholder as the source. The link
|
|
342
|
+
* travels with the entity instead of living in a
|
|
343
|
+
* side-channel map that a producer could forget to
|
|
344
|
+
* write — or that a later pass could clear.
|
|
345
|
+
*/
|
|
346
|
+
type CorefAliasEntity = EntityBase & {
|
|
347
|
+
source: typeof DETECTION_SOURCES.COREFERENCE; /** Full text of the source entity this alias refers to. */
|
|
348
|
+
corefSourceText: string;
|
|
349
|
+
};
|
|
350
|
+
/**
|
|
351
|
+
* A detected PII entity span in the source text.
|
|
352
|
+
* Every detection layer produces these.
|
|
353
|
+
*/
|
|
354
|
+
type Entity = DetectedEntity | CorefAliasEntity;
|
|
355
|
+
/**
|
|
356
|
+
* Entity after human review. Extends the base Entity
|
|
357
|
+
* with a review decision.
|
|
358
|
+
*/
|
|
359
|
+
type ReviewDecision = "confirmed" | "rejected" | "relabeled";
|
|
360
|
+
type ReviewedEntity = Entity & {
|
|
361
|
+
decision?: ReviewDecision;
|
|
362
|
+
originalLabel?: string;
|
|
363
|
+
};
|
|
364
|
+
/**
|
|
365
|
+
* A single entry in the workspace-scoped gazetteer
|
|
366
|
+
* (deny list). Persisted in IndexedDB.
|
|
367
|
+
*/
|
|
368
|
+
type GazetteerEntry = {
|
|
369
|
+
id: string;
|
|
370
|
+
canonical: string;
|
|
371
|
+
label: string;
|
|
372
|
+
variants: string[];
|
|
373
|
+
workspaceId: string;
|
|
374
|
+
createdAt: number;
|
|
375
|
+
source: "manual" | "confirmed-from-model";
|
|
376
|
+
};
|
|
377
|
+
/** Extraction strategy — closed discriminated union. */
|
|
378
|
+
type TriggerStrategy = {
|
|
379
|
+
type: "to-next-comma";
|
|
380
|
+
/**
|
|
381
|
+
* Optional list of lowercase keywords that terminate
|
|
382
|
+
* the value scan, in addition to commas/newlines. Useful
|
|
383
|
+
* for triggers like court names that may continue past
|
|
384
|
+
* a missing comma into adjacent clause text ("Městským
|
|
385
|
+
* soudem v Praze dne 1. 1. 2020"); listing `"dne"` here
|
|
386
|
+
* stops the scan at the date boundary. Matched on a
|
|
387
|
+
* word-boundary, case-insensitive.
|
|
388
|
+
*/
|
|
389
|
+
stopWords?: string[];
|
|
390
|
+
/**
|
|
391
|
+
* Hard cap on the captured span length, in characters,
|
|
392
|
+
* regardless of where the next comma / stop char sits.
|
|
393
|
+
* Use for triggers that label short formulaic phrases
|
|
394
|
+
* ("State of Delaware") and must not absorb the rest
|
|
395
|
+
* of a long forum-selection clause when the comma is
|
|
396
|
+
* sentences away. Falls back to the default 100-char
|
|
397
|
+
* fallback when omitted.
|
|
398
|
+
*/
|
|
399
|
+
maxLength?: number;
|
|
400
|
+
} | {
|
|
401
|
+
type: "to-end-of-line";
|
|
402
|
+
} | {
|
|
403
|
+
type: "n-words";
|
|
404
|
+
count: number;
|
|
405
|
+
} | {
|
|
406
|
+
type: "company-id-value";
|
|
407
|
+
} | {
|
|
408
|
+
type: "address";
|
|
409
|
+
maxChars?: number;
|
|
410
|
+
} | {
|
|
411
|
+
/**
|
|
412
|
+
* Extract the first regex match in the value text.
|
|
413
|
+
* Useful for shape-bounded values that follow a
|
|
414
|
+
* label on the same line as other fields, where
|
|
415
|
+
* `to-end-of-line` would over-capture. The pattern
|
|
416
|
+
* is anchored to the start of the (already
|
|
417
|
+
* leading-whitespace-stripped) value, so use
|
|
418
|
+
* `(?:.*?)` prefix only when intentional.
|
|
419
|
+
*/
|
|
420
|
+
type: "match-pattern";
|
|
421
|
+
pattern: string;
|
|
422
|
+
flags?: string;
|
|
423
|
+
};
|
|
424
|
+
/** Validation rules — closed discriminated union. */
|
|
425
|
+
type TriggerValidation = {
|
|
426
|
+
type: "starts-uppercase";
|
|
427
|
+
} | {
|
|
428
|
+
type: "min-length";
|
|
429
|
+
min: number;
|
|
430
|
+
} | {
|
|
431
|
+
type: "max-length";
|
|
432
|
+
max: number;
|
|
433
|
+
} | {
|
|
434
|
+
type: "no-digits";
|
|
435
|
+
} | {
|
|
436
|
+
type: "has-digits";
|
|
437
|
+
} | {
|
|
438
|
+
type: "matches-pattern";
|
|
439
|
+
pattern: string;
|
|
440
|
+
flags?: string;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Run a named stdnum validator (checksum + length)
|
|
444
|
+
* against the captured value. Keeps the trigger
|
|
445
|
+
* path symmetrical with the formatted-regex
|
|
446
|
+
* detectors so e.g. `CPF nº 00000000000` does not
|
|
447
|
+
* survive as a tax-ID entity.
|
|
448
|
+
*/
|
|
449
|
+
| {
|
|
450
|
+
type: "valid-id";
|
|
451
|
+
validator: ValidIdValidator;
|
|
452
|
+
};
|
|
453
|
+
/** Built-in stdnum validators that can be referenced
|
|
454
|
+
* by `valid-id` validations. */
|
|
455
|
+
type ValidIdValidator = "br.cpf" | "br.cnpj" | "us.rtn";
|
|
456
|
+
/** Auto-generated trigger variants — closed set. */
|
|
457
|
+
type TriggerExtension = "add-colon" | "add-trailing-space" | "add-colon-space" | "normalize-spaces";
|
|
458
|
+
/** V2 trigger config entry (JSON shape). */
|
|
459
|
+
type TriggerGroupConfig = {
|
|
460
|
+
id?: string;
|
|
461
|
+
triggers: string[];
|
|
462
|
+
label: string;
|
|
463
|
+
strategy: TriggerStrategy;
|
|
464
|
+
extensions?: TriggerExtension[];
|
|
465
|
+
validations?: TriggerValidation[];
|
|
466
|
+
/** When true, include the trigger text in the
|
|
467
|
+
* entity span (e.g., court names). */
|
|
468
|
+
includeTrigger?: boolean;
|
|
469
|
+
};
|
|
470
|
+
/** Compiled validation with pre-built regex. */
|
|
471
|
+
type CompiledValidation = {
|
|
472
|
+
type: "starts-uppercase";
|
|
473
|
+
re: RegExp;
|
|
474
|
+
} | {
|
|
475
|
+
type: "min-length";
|
|
476
|
+
min: number;
|
|
477
|
+
} | {
|
|
478
|
+
type: "max-length";
|
|
479
|
+
max: number;
|
|
480
|
+
} | {
|
|
481
|
+
type: "no-digits";
|
|
482
|
+
re: RegExp;
|
|
483
|
+
} | {
|
|
484
|
+
type: "has-digits";
|
|
485
|
+
re: RegExp;
|
|
486
|
+
} | {
|
|
487
|
+
type: "matches-pattern";
|
|
488
|
+
re: RegExp;
|
|
489
|
+
} | {
|
|
490
|
+
type: "valid-id";
|
|
491
|
+
validator: ValidIdValidator;
|
|
492
|
+
check: (value: string) => boolean;
|
|
493
|
+
};
|
|
494
|
+
/**
|
|
495
|
+
* Runtime rule — one per trigger string after
|
|
496
|
+
* expansion. Fed to the Aho-Corasick automaton.
|
|
497
|
+
*/
|
|
498
|
+
type TriggerRule = {
|
|
499
|
+
trigger: string;
|
|
500
|
+
label: string;
|
|
501
|
+
strategy: TriggerStrategy;
|
|
502
|
+
validations: CompiledValidation[];
|
|
503
|
+
includeTrigger: boolean;
|
|
504
|
+
};
|
|
505
|
+
/** Per-label operator selection. Key is the entity label. */
|
|
506
|
+
type OperatorConfig = {
|
|
507
|
+
/** Operator per label. Missing labels default to "replace". */operators: Record<string, OperatorType>; /** Custom replacement string for the redact operator. */
|
|
508
|
+
redactString: string;
|
|
509
|
+
};
|
|
510
|
+
/** Whether an operator produces a reversible redaction entry. */
|
|
511
|
+
type OperatorReversibility = "reversible" | "irreversible";
|
|
512
|
+
type AnonymisationOperator = {
|
|
513
|
+
type: OperatorType;
|
|
514
|
+
reversibility: OperatorReversibility;
|
|
515
|
+
/**
|
|
516
|
+
* Apply the operator to a single entity occurrence.
|
|
517
|
+
* Returns the replacement string to embed in the document.
|
|
518
|
+
*/
|
|
519
|
+
apply: (text: string, label: string, placeholder: string, redactString: string) => string;
|
|
520
|
+
};
|
|
521
|
+
/**
|
|
522
|
+
* Redacted document output with stable entity mapping.
|
|
523
|
+
*/
|
|
524
|
+
type RedactionResult = {
|
|
525
|
+
redactedText: string;
|
|
526
|
+
/**
|
|
527
|
+
* Maps placeholder to original text. Only populated for
|
|
528
|
+
* reversible operators (replace). Empty for redact.
|
|
529
|
+
*/
|
|
530
|
+
redactionMap: Map<string, string>; /** Maps placeholder to the operator that produced it. */
|
|
531
|
+
operatorMap: Map<string, OperatorType>;
|
|
532
|
+
entityCount: number;
|
|
533
|
+
};
|
|
534
|
+
/**
|
|
535
|
+
* Configuration for the detection pipeline.
|
|
536
|
+
*/
|
|
537
|
+
type DenyListCategory = "Names" | "Places" | "Addresses" | "Courts" | "Financial" | "Government" | "Healthcare" | "Education" | "Political" | "Organizations" | "International";
|
|
538
|
+
/**
|
|
539
|
+
* Metadata for a single dictionary entry in the
|
|
540
|
+
* deny-list system. Mirrors the shape from
|
|
541
|
+
* the anonymize-data package so consumers can pass
|
|
542
|
+
* pre-loaded data without a runtime dependency.
|
|
543
|
+
*/
|
|
544
|
+
type DictionaryMeta = {
|
|
545
|
+
label: string;
|
|
546
|
+
category: DenyListCategory;
|
|
547
|
+
country: string | null;
|
|
548
|
+
};
|
|
549
|
+
/**
|
|
550
|
+
* Caller-supplied exact terms for deny-list matching.
|
|
551
|
+
* These entries are merged with the published deny-list
|
|
552
|
+
* dictionaries when `enableDenyList` is enabled.
|
|
553
|
+
*/
|
|
554
|
+
type CustomDenyListEntry = {
|
|
555
|
+
value: string;
|
|
556
|
+
label: string;
|
|
557
|
+
variants?: readonly string[];
|
|
558
|
+
};
|
|
559
|
+
/**
|
|
560
|
+
* Caller-supplied regex detector. The pattern is passed
|
|
561
|
+
* to the underlying text-search regex engine, so use its
|
|
562
|
+
* supported regex syntax. Inline flags such as `(?i)` are
|
|
563
|
+
* accepted when supported by that engine.
|
|
564
|
+
*/
|
|
565
|
+
type CustomRegexPattern = {
|
|
566
|
+
pattern: string;
|
|
567
|
+
label: string;
|
|
568
|
+
score?: number;
|
|
569
|
+
preparedArtifactPolicy?: "include" | "omit";
|
|
570
|
+
};
|
|
571
|
+
/**
|
|
572
|
+
* Pre-loaded dictionary data for dependency injection.
|
|
573
|
+
* Consumers that want name/city/deny-list detection
|
|
574
|
+
* load dictionaries themselves (e.g. from the
|
|
575
|
+
* anonymize-data package) and pass them here; the
|
|
576
|
+
* anonymize package has zero cross-package imports.
|
|
577
|
+
*
|
|
578
|
+
* All fields are optional. When a field is absent,
|
|
579
|
+
* the corresponding detection path is skipped (same
|
|
580
|
+
* behavior as when no dictionaries are available).
|
|
581
|
+
*/
|
|
582
|
+
type Dictionaries = {
|
|
583
|
+
/**
|
|
584
|
+
* First names per language code (e.g., "cs", "de").
|
|
585
|
+
* Merged with legacy config names at init time.
|
|
586
|
+
*/
|
|
587
|
+
firstNames?: Readonly<Record<string, readonly string[]>>;
|
|
588
|
+
/**
|
|
589
|
+
* Surnames per language code.
|
|
590
|
+
* Merged with legacy config names at init time.
|
|
591
|
+
*/
|
|
592
|
+
surnames?: Readonly<Record<string, readonly string[]>>;
|
|
593
|
+
/**
|
|
594
|
+
* Non-Western name tokens per locale code
|
|
595
|
+
* (e.g., "in", "ar", "ja-latn", "ko", "zh-latn",
|
|
596
|
+
* "th", "vi", "fil", "id"). Merged with bundled
|
|
597
|
+
* names-nw-*.json data at init time.
|
|
598
|
+
*/
|
|
599
|
+
nonWesternNames?: Readonly<Record<string, readonly string[]>>;
|
|
600
|
+
/**
|
|
601
|
+
* Pre-loaded deny-list dictionaries keyed by
|
|
602
|
+
* dictionary ID (e.g., "courts/CZ", "banks/DE").
|
|
603
|
+
* Each value is the array of terms for that
|
|
604
|
+
* dictionary.
|
|
605
|
+
*/
|
|
606
|
+
denyList?: Readonly<Record<string, readonly string[]>>;
|
|
607
|
+
/**
|
|
608
|
+
* Metadata per dictionary ID. Required when
|
|
609
|
+
* `denyList` is provided so the pipeline knows
|
|
610
|
+
* labels, categories, and country filters.
|
|
611
|
+
*/
|
|
612
|
+
denyListMeta?: Readonly<Record<string, DictionaryMeta>>;
|
|
613
|
+
/**
|
|
614
|
+
* Pre-loaded city names, already merged across
|
|
615
|
+
* all desired countries.
|
|
616
|
+
*
|
|
617
|
+
* Prefer `citiesByCountry` when callers also pass
|
|
618
|
+
* `denyListCountries` / `denyListRegions`; merged
|
|
619
|
+
* city arrays cannot be scoped after injection.
|
|
620
|
+
*/
|
|
621
|
+
cities?: readonly string[];
|
|
622
|
+
/**
|
|
623
|
+
* Pre-loaded city names keyed by ISO 3166-1 alpha-2
|
|
624
|
+
* country code. When provided, the deny-list builder
|
|
625
|
+
* applies `denyListCountries` / `denyListRegions`
|
|
626
|
+
* before adding city patterns to the search automaton.
|
|
627
|
+
*/
|
|
628
|
+
citiesByCountry?: Readonly<Record<string, readonly string[]>>;
|
|
629
|
+
};
|
|
630
|
+
type PipelineConfig = {
|
|
631
|
+
threshold: number;
|
|
632
|
+
enableTriggerPhrases: boolean;
|
|
633
|
+
enableRegex: boolean;
|
|
634
|
+
/**
|
|
635
|
+
* Expected content language codes. When present, these
|
|
636
|
+
* derive default dictionary scopes for name corpus and
|
|
637
|
+
* deny-list matching unless the lower-level scope fields
|
|
638
|
+
* below are set explicitly.
|
|
639
|
+
*/
|
|
640
|
+
languages?: string[];
|
|
641
|
+
/**
|
|
642
|
+
* Convenience form for single-language documents. Ignored
|
|
643
|
+
* when `languages` is also provided.
|
|
644
|
+
*/
|
|
645
|
+
language?: string;
|
|
646
|
+
/**
|
|
647
|
+
* Enables legal-form organization detection.
|
|
648
|
+
* Required for typed callers; legacy untyped
|
|
649
|
+
* callers that omit this field are treated as
|
|
650
|
+
* enabled at runtime for backward compatibility.
|
|
651
|
+
*/
|
|
652
|
+
enableLegalForms: boolean;
|
|
653
|
+
/**
|
|
654
|
+
* Enables first-name/surname/title corpus matching.
|
|
655
|
+
* When deny-list mode is enabled, this also controls
|
|
656
|
+
* whether name-corpus entries are injected into the
|
|
657
|
+
* deny-list search automaton.
|
|
658
|
+
*/
|
|
659
|
+
enableNameCorpus: boolean;
|
|
660
|
+
/**
|
|
661
|
+
* Optional language scope for first-name/surname
|
|
662
|
+
* dictionaries, using the keys present in
|
|
663
|
+
* `dictionaries.firstNames` / `dictionaries.surnames`
|
|
664
|
+
* (for example `["en", "de"]`). When omitted, all
|
|
665
|
+
* injected name languages are used for backward
|
|
666
|
+
* compatibility.
|
|
667
|
+
*/
|
|
668
|
+
nameCorpusLanguages?: string[];
|
|
669
|
+
enableDenyList: boolean;
|
|
670
|
+
denyListCountries?: string[];
|
|
671
|
+
denyListRegions?: string[];
|
|
672
|
+
denyListExcludeCategories?: string[];
|
|
673
|
+
/**
|
|
674
|
+
* Caller-owned exact terms to match through the
|
|
675
|
+
* deny-list layer. Requires `enableDenyList: true`.
|
|
676
|
+
*/
|
|
677
|
+
customDenyList?: readonly CustomDenyListEntry[];
|
|
678
|
+
/**
|
|
679
|
+
* Caller-owned regex detectors. Requires
|
|
680
|
+
* `enableRegex: true`.
|
|
681
|
+
*/
|
|
682
|
+
customRegexes?: readonly CustomRegexPattern[];
|
|
683
|
+
enableGazetteer: boolean;
|
|
684
|
+
/**
|
|
685
|
+
* Detect country names (ISO 3166-1 names, curated
|
|
686
|
+
* aliases, alpha-3 codes). Defaults to true. Names
|
|
687
|
+
* span all manifest languages plus widely-used
|
|
688
|
+
* additions (Dutch, Russian, Chinese, Arabic, etc.).
|
|
689
|
+
*/
|
|
690
|
+
enableCountries?: boolean;
|
|
691
|
+
enableNer: boolean;
|
|
692
|
+
enableConfidenceBoost: boolean;
|
|
693
|
+
enableCoreference: boolean;
|
|
694
|
+
enableZoneClassification?: boolean;
|
|
695
|
+
enableHotwordRules?: boolean;
|
|
696
|
+
/**
|
|
697
|
+
* Requested output labels. An empty array means
|
|
698
|
+
* "do not filter by label" for deterministic
|
|
699
|
+
* detectors; NER falls back to DEFAULT_ENTITY_LABELS.
|
|
700
|
+
*/
|
|
701
|
+
labels: string[];
|
|
702
|
+
workspaceId: string;
|
|
703
|
+
/**
|
|
704
|
+
* Pre-loaded dictionary data for name, deny-list,
|
|
705
|
+
* and city detection. When omitted, dictionary-based
|
|
706
|
+
* detection paths are skipped. Consumers load from
|
|
707
|
+
* the anonymize-data package and pass the data here.
|
|
708
|
+
*/
|
|
709
|
+
dictionaries?: Dictionaries;
|
|
710
|
+
};
|
|
711
|
+
//#endregion
|
|
712
|
+
//#region src/native.d.ts
|
|
713
|
+
type NativeBindingOperatorConfig = {
|
|
714
|
+
operators?: Record<string, OperatorType>;
|
|
715
|
+
redactString?: string;
|
|
716
|
+
};
|
|
717
|
+
type NativeDiagnosticsBatchCallback = (diagnosticsJson: string) => void;
|
|
718
|
+
type NativeResultEventCallback = (eventJson: string) => void;
|
|
719
|
+
type NativeBindingRedactionEntry = {
|
|
720
|
+
placeholder: string;
|
|
721
|
+
original: string;
|
|
722
|
+
};
|
|
723
|
+
type NativeBindingOperatorEntry = {
|
|
724
|
+
placeholder: string;
|
|
725
|
+
operator: OperatorType;
|
|
726
|
+
};
|
|
727
|
+
type NativeBindingPipelineEntity = {
|
|
728
|
+
start: number;
|
|
729
|
+
end: number;
|
|
730
|
+
label: string;
|
|
731
|
+
text: string;
|
|
732
|
+
score: number;
|
|
733
|
+
source: string;
|
|
734
|
+
sourceDetail?: string | null;
|
|
735
|
+
};
|
|
736
|
+
type NativeBindingRedactionResult = {
|
|
737
|
+
redactedText: string;
|
|
738
|
+
redactionMap: NativeBindingRedactionEntry[];
|
|
739
|
+
operatorMap: NativeBindingOperatorEntry[];
|
|
740
|
+
entityCount: number;
|
|
741
|
+
};
|
|
742
|
+
type NativeBindingStaticRedactionResult = {
|
|
743
|
+
resolvedEntities: NativeBindingPipelineEntity[];
|
|
744
|
+
redaction: NativeBindingRedactionResult;
|
|
745
|
+
};
|
|
746
|
+
type NativePreparedSearchBinding = {
|
|
747
|
+
prepareDiagnosticsJson?: () => string;
|
|
748
|
+
warmLazyRegex?: () => void;
|
|
749
|
+
warm_lazy_regex?: () => void;
|
|
750
|
+
warmLazyRegexDiagnosticsJson?: () => string;
|
|
751
|
+
warm_lazy_regex_diagnostics_json?: () => string;
|
|
752
|
+
redactStaticEntities: (fullText: string, operators?: NativeBindingOperatorConfig) => NativeBindingStaticRedactionResult;
|
|
753
|
+
redactStaticEntitiesJson?: (fullText: string, operators?: NativeBindingOperatorConfig) => string;
|
|
754
|
+
redactStaticEntitiesResultStreamJson?: (fullText: string, operators: NativeBindingOperatorConfig | undefined, onEvent: NativeResultEventCallback) => string;
|
|
755
|
+
redactStaticEntitiesDiagnosticsJson?: (fullText: string, operators?: NativeBindingOperatorConfig) => string;
|
|
756
|
+
redactStaticEntitiesDiagnosticsStreamJson?: (fullText: string, operators: NativeBindingOperatorConfig | undefined, onBatch: NativeDiagnosticsBatchCallback) => string;
|
|
757
|
+
redactStaticEntitiesSummaryDiagnosticsJson?: (fullText: string, operators?: NativeBindingOperatorConfig) => string;
|
|
758
|
+
};
|
|
759
|
+
type NativeAnonymizeBinding = {
|
|
760
|
+
normalizeForSearch: (text: string) => string;
|
|
761
|
+
nativePackageVersion: () => string;
|
|
762
|
+
NativePreparedSearch: {
|
|
763
|
+
fromConfigJsonBytes: (configJson: Uint8Array) => NativePreparedSearchBinding;
|
|
764
|
+
fromPreparedPackageBytes: (packageBytes: Uint8Array) => NativePreparedSearchBinding;
|
|
765
|
+
fromPreparedPackageBytesWithoutCache?: (packageBytes: Uint8Array) => NativePreparedSearchBinding;
|
|
766
|
+
fromTrustedPreparedPackageBytes?: (packageBytes: Uint8Array) => NativePreparedSearchBinding;
|
|
767
|
+
fromTrustedPreparedPackageBytesWithoutCache?: (packageBytes: Uint8Array) => NativePreparedSearchBinding;
|
|
768
|
+
};
|
|
769
|
+
prepareStaticSearchPackageBytes: (configJson: Uint8Array) => Uint8Array;
|
|
770
|
+
prepareStaticSearchCompressedPackageBytes: (configJson: Uint8Array) => Uint8Array;
|
|
771
|
+
assembleStaticSearchConfigJson?: (pipelineConfigJson: Uint8Array, dictionariesJson?: Uint8Array, gazetteerJson?: Uint8Array) => Uint8Array;
|
|
772
|
+
assembleStaticSearchPackageBytes?: (pipelineConfigJson: Uint8Array, dictionariesJson?: Uint8Array, gazetteerJson?: Uint8Array) => Uint8Array;
|
|
773
|
+
assembleStaticSearchCompressedPackageBytes?: (pipelineConfigJson: Uint8Array, dictionariesJson?: Uint8Array, gazetteerJson?: Uint8Array) => Uint8Array;
|
|
774
|
+
};
|
|
775
|
+
type NativeOperatorConfig = {
|
|
776
|
+
operators?: Record<string, OperatorType>;
|
|
777
|
+
redactString?: string;
|
|
778
|
+
};
|
|
779
|
+
type NativePipelineEntity = {
|
|
780
|
+
start: number;
|
|
781
|
+
end: number;
|
|
782
|
+
label: string;
|
|
783
|
+
text: string;
|
|
784
|
+
score: number;
|
|
785
|
+
source: string;
|
|
786
|
+
sourceDetail?: string;
|
|
787
|
+
};
|
|
788
|
+
type NativeRedactionResult = {
|
|
789
|
+
redactedText: string;
|
|
790
|
+
redactionMap: Map<string, string>;
|
|
791
|
+
operatorMap: Map<string, OperatorType>;
|
|
792
|
+
entityCount: number;
|
|
793
|
+
};
|
|
794
|
+
type NativeStaticRedactionResult = {
|
|
795
|
+
resolvedEntities: NativePipelineEntity[];
|
|
796
|
+
redaction: NativeRedactionResult;
|
|
797
|
+
};
|
|
798
|
+
type NativeSearchPackageOptions = {
|
|
799
|
+
binding: NativeAnonymizeBinding;
|
|
800
|
+
config: NativePreparedSearchConfig;
|
|
801
|
+
compressed?: boolean;
|
|
802
|
+
};
|
|
803
|
+
type NativeSearchPackageInput = NativePreparedSearchConfig | string | Uint8Array;
|
|
804
|
+
type SharedNativeSearchPackageOptions = {
|
|
805
|
+
binding: NativeAnonymizeBinding;
|
|
806
|
+
config: NativeSearchPackageInput;
|
|
807
|
+
compressed?: boolean;
|
|
808
|
+
};
|
|
809
|
+
type SharedNativePreparedPackageOptions = {
|
|
810
|
+
binding: NativeAnonymizeBinding;
|
|
811
|
+
packageBytes: Uint8Array;
|
|
812
|
+
};
|
|
813
|
+
type SharedNativeRedactTextJsonOptions = {
|
|
814
|
+
binding: NativeAnonymizeBinding;
|
|
815
|
+
config: NativeSearchPackageInput;
|
|
816
|
+
fullText: string;
|
|
817
|
+
operators?: NativeOperatorConfig;
|
|
818
|
+
};
|
|
819
|
+
type SharedNativeRedactTextOptions = SharedNativeRedactTextJsonOptions;
|
|
820
|
+
type SharedNativeDiagnosticsJsonOptions = SharedNativeRedactTextJsonOptions;
|
|
821
|
+
type SharedNativeDiagnosticsStreamJsonOptions = SharedNativeRedactTextJsonOptions & {
|
|
822
|
+
onBatch: NativeDiagnosticsBatchCallback;
|
|
823
|
+
};
|
|
824
|
+
type SharedNativeRedactTextStreamJsonOptions = SharedNativeRedactTextJsonOptions & {
|
|
825
|
+
onEvent: NativeResultEventCallback;
|
|
826
|
+
};
|
|
827
|
+
type NativeNormalizeOptions = {
|
|
828
|
+
binding: NativeAnonymizeBinding;
|
|
829
|
+
text: string;
|
|
830
|
+
};
|
|
831
|
+
type NativeAnonymizerFromConfigOptions = {
|
|
832
|
+
binding: NativeAnonymizeBinding;
|
|
833
|
+
config: NativePreparedSearchConfig;
|
|
834
|
+
};
|
|
835
|
+
type NativeAnonymizerFromPackageOptions = {
|
|
836
|
+
binding: NativeAnonymizeBinding;
|
|
837
|
+
packageBytes: Uint8Array;
|
|
838
|
+
};
|
|
839
|
+
type NativePipelineFromPackageOptions = NativeAnonymizerFromPackageOptions;
|
|
840
|
+
type NativeBindingVersionOptions = {
|
|
841
|
+
binding: NativeAnonymizeBinding;
|
|
842
|
+
expectedVersion: string;
|
|
843
|
+
};
|
|
844
|
+
declare class PreparedNativeAnonymizer {
|
|
845
|
+
#private;
|
|
846
|
+
constructor(prepared: NativePreparedSearchBinding);
|
|
847
|
+
prepareDiagnosticsJson(): string | null;
|
|
848
|
+
prepare_diagnostics_json(): string | null;
|
|
849
|
+
warmLazyRegex(): void;
|
|
850
|
+
warm_lazy_regex(): void;
|
|
851
|
+
warmLazyRegexDiagnosticsJson(): string | null;
|
|
852
|
+
warm_lazy_regex_diagnostics_json(): string | null;
|
|
853
|
+
redactStaticEntities(fullText: string, operators?: NativeOperatorConfig): NativeStaticRedactionResult;
|
|
854
|
+
redact_text(fullText: string, operators?: NativeOperatorConfig): NativeStaticRedactionResult;
|
|
855
|
+
redact_text_json(fullText: string, operators?: NativeOperatorConfig): string;
|
|
856
|
+
redactTextJson(fullText: string, operators?: NativeOperatorConfig): string;
|
|
857
|
+
redactTextStreamJson(fullText: string, onEvent: NativeResultEventCallback, operators?: NativeOperatorConfig): string | null;
|
|
858
|
+
redact_text_stream_json(fullText: string, onEvent: NativeResultEventCallback, operators?: NativeOperatorConfig): string | null;
|
|
859
|
+
redactStaticEntitiesDiagnosticsJson(fullText: string, operators?: NativeOperatorConfig): string | null;
|
|
860
|
+
diagnostics_json(fullText: string, operators?: NativeOperatorConfig): string | null;
|
|
861
|
+
diagnosticsStreamJson(fullText: string, onBatch: NativeDiagnosticsBatchCallback, operators?: NativeOperatorConfig): string | null;
|
|
862
|
+
diagnostics_stream_json(fullText: string, onBatch: NativeDiagnosticsBatchCallback, operators?: NativeOperatorConfig): string | null;
|
|
863
|
+
redactStaticEntitiesSummaryDiagnosticsJson(fullText: string, operators?: NativeOperatorConfig): string | null;
|
|
864
|
+
summary_diagnostics_json(fullText: string, operators?: NativeOperatorConfig): string | null;
|
|
865
|
+
}
|
|
866
|
+
declare class PreparedNativePipeline {
|
|
867
|
+
#private;
|
|
868
|
+
constructor(anonymizer: PreparedNativeAnonymizer);
|
|
869
|
+
prepareDiagnosticsJson(): string | null;
|
|
870
|
+
prepare_diagnostics_json(): string | null;
|
|
871
|
+
warmLazyRegex(): void;
|
|
872
|
+
warm_lazy_regex(): void;
|
|
873
|
+
warmLazyRegexDiagnosticsJson(): string | null;
|
|
874
|
+
warm_lazy_regex_diagnostics_json(): string | null;
|
|
875
|
+
redactText(fullText: string, operators?: NativeOperatorConfig): NativeStaticRedactionResult;
|
|
876
|
+
redact_text(fullText: string, operators?: NativeOperatorConfig): NativeStaticRedactionResult;
|
|
877
|
+
redact_text_json(fullText: string, operators?: NativeOperatorConfig): string;
|
|
878
|
+
redactTextJson(fullText: string, operators?: NativeOperatorConfig): string;
|
|
879
|
+
redactTextStreamJson(fullText: string, onEvent: NativeResultEventCallback, operators?: NativeOperatorConfig): string | null;
|
|
880
|
+
redact_text_stream_json(fullText: string, onEvent: NativeResultEventCallback, operators?: NativeOperatorConfig): string | null;
|
|
881
|
+
redactTextDiagnosticsJson(fullText: string, operators?: NativeOperatorConfig): string | null;
|
|
882
|
+
diagnostics_json(fullText: string, operators?: NativeOperatorConfig): string | null;
|
|
883
|
+
diagnosticsStreamJson(fullText: string, onBatch: NativeDiagnosticsBatchCallback, operators?: NativeOperatorConfig): string | null;
|
|
884
|
+
diagnostics_stream_json(fullText: string, onBatch: NativeDiagnosticsBatchCallback, operators?: NativeOperatorConfig): string | null;
|
|
885
|
+
redactTextSummaryDiagnosticsJson(fullText: string, operators?: NativeOperatorConfig): string | null;
|
|
886
|
+
summary_diagnostics_json(fullText: string, operators?: NativeOperatorConfig): string | null;
|
|
887
|
+
}
|
|
888
|
+
declare const encodeNativeSearchConfig: (config: NativePreparedSearchConfig) => Uint8Array;
|
|
889
|
+
declare const encodeNativeSearchConfigInput: (config: NativeSearchPackageInput) => Uint8Array;
|
|
890
|
+
declare const getNativeBindingVersion: (binding: NativeAnonymizeBinding) => string;
|
|
891
|
+
declare const native_package_version: (binding: NativeAnonymizeBinding) => string;
|
|
892
|
+
declare const normalize_for_search: ({
|
|
893
|
+
binding,
|
|
894
|
+
text
|
|
895
|
+
}: NativeNormalizeOptions) => string;
|
|
896
|
+
declare const assertNativeBindingVersion: ({
|
|
897
|
+
binding,
|
|
898
|
+
expectedVersion
|
|
899
|
+
}: NativeBindingVersionOptions) => void;
|
|
900
|
+
declare const prepareNativeSearchPackage: ({
|
|
901
|
+
binding,
|
|
902
|
+
config,
|
|
903
|
+
compressed
|
|
904
|
+
}: NativeSearchPackageOptions) => Uint8Array;
|
|
905
|
+
declare const prepare_search_package: ({
|
|
906
|
+
binding,
|
|
907
|
+
config,
|
|
908
|
+
compressed
|
|
909
|
+
}: SharedNativeSearchPackageOptions) => Uint8Array;
|
|
910
|
+
declare const createNativeAnonymizerFromConfig: ({
|
|
911
|
+
binding,
|
|
912
|
+
config
|
|
913
|
+
}: NativeAnonymizerFromConfigOptions) => PreparedNativeAnonymizer;
|
|
914
|
+
declare const createNativeAnonymizerFromPackage: ({
|
|
915
|
+
binding,
|
|
916
|
+
packageBytes
|
|
917
|
+
}: NativeAnonymizerFromPackageOptions) => PreparedNativeAnonymizer;
|
|
918
|
+
declare const load_prepared_package: ({
|
|
919
|
+
binding,
|
|
920
|
+
packageBytes
|
|
921
|
+
}: SharedNativePreparedPackageOptions) => PreparedNativeAnonymizer;
|
|
922
|
+
declare const redact_text_json: ({
|
|
923
|
+
binding,
|
|
924
|
+
config,
|
|
925
|
+
fullText,
|
|
926
|
+
operators
|
|
927
|
+
}: SharedNativeRedactTextJsonOptions) => string;
|
|
928
|
+
declare const redact_text: ({
|
|
929
|
+
binding,
|
|
930
|
+
config,
|
|
931
|
+
fullText,
|
|
932
|
+
operators
|
|
933
|
+
}: SharedNativeRedactTextOptions) => NativeStaticRedactionResult;
|
|
934
|
+
declare const redact_text_stream_json: ({
|
|
935
|
+
binding,
|
|
936
|
+
config,
|
|
937
|
+
fullText,
|
|
938
|
+
operators,
|
|
939
|
+
onEvent
|
|
940
|
+
}: SharedNativeRedactTextStreamJsonOptions) => string | null;
|
|
941
|
+
declare const diagnostics_json: ({
|
|
942
|
+
binding,
|
|
943
|
+
config,
|
|
944
|
+
fullText,
|
|
945
|
+
operators
|
|
946
|
+
}: SharedNativeDiagnosticsJsonOptions) => string | null;
|
|
947
|
+
declare const diagnostics_stream_json: ({
|
|
948
|
+
binding,
|
|
949
|
+
config,
|
|
950
|
+
fullText,
|
|
951
|
+
operators,
|
|
952
|
+
onBatch
|
|
953
|
+
}: SharedNativeDiagnosticsStreamJsonOptions) => string | null;
|
|
954
|
+
declare const summary_diagnostics_json: ({
|
|
955
|
+
binding,
|
|
956
|
+
config,
|
|
957
|
+
fullText,
|
|
958
|
+
operators
|
|
959
|
+
}: SharedNativeDiagnosticsJsonOptions) => string | null;
|
|
960
|
+
declare const createNativePipelineFromPackage: ({
|
|
961
|
+
binding,
|
|
962
|
+
packageBytes
|
|
963
|
+
}: NativePipelineFromPackageOptions) => PreparedNativePipeline;
|
|
964
|
+
declare const PreparedSearch: typeof PreparedNativeAnonymizer;
|
|
965
|
+
type PreparedSearch = PreparedNativeAnonymizer;
|
|
966
|
+
declare const PreparedAnonymizer: typeof PreparedNativeAnonymizer;
|
|
967
|
+
type PreparedAnonymizer = PreparedNativeAnonymizer;
|
|
968
|
+
//#endregion
|
|
969
|
+
export { OperatorConfig as $, createNativePipelineFromPackage as A, prepare_search_package as B, SharedNativeRedactTextJsonOptions as C, assertNativeBindingVersion as D, SharedNativeSearchPackageOptions as E, getNativeBindingVersion as F, AnonymisationOperator as G, redact_text_json as H, load_prepared_package as I, DenyListCategory as J, CustomDenyListEntry as K, native_package_version as L, diagnostics_stream_json as M, encodeNativeSearchConfig as N, createNativeAnonymizerFromConfig as O, encodeNativeSearchConfigInput as P, GazetteerEntry as Q, normalize_for_search as R, SharedNativePreparedPackageOptions as S, SharedNativeRedactTextStreamJsonOptions as T, redact_text_stream_json as U, redact_text as V, summary_diagnostics_json as W, DictionaryMeta as X, Dictionaries as Y, Entity as Z, PreparedNativeAnonymizer as _, NativeDiagnosticsBatchCallback as a, TriggerGroupConfig as at, SharedNativeDiagnosticsJsonOptions as b, NativePipelineEntity as c, TriggerValidation as ct, NativeRedactionResult as d, PipelineConfig as et, NativeResultEventCallback as f, PreparedAnonymizer as g, NativeStaticRedactionResult as h, NativeBindingVersionOptions as i, TriggerExtension as it, diagnostics_json as j, createNativeAnonymizerFromPackage as k, NativePipelineFromPackageOptions as l, NativePreparedSearchConfig as lt, NativeSearchPackageOptions as m, NativeAnonymizerFromConfigOptions as n, ReviewDecision as nt, NativeNormalizeOptions as o, TriggerRule as ot, NativeSearchPackageInput as p, CustomRegexPattern as q, NativeAnonymizerFromPackageOptions as r, ReviewedEntity as rt, NativeOperatorConfig as s, TriggerStrategy as st, NativeAnonymizeBinding as t, RedactionResult as tt, NativePreparedSearchBinding as u, PreparedNativePipeline as v, SharedNativeRedactTextOptions as w, SharedNativeDiagnosticsStreamJsonOptions as x, PreparedSearch as y, prepareNativeSearchPackage as z };
|
|
970
|
+
//# sourceMappingURL=native.d.mts.map
|