anonyma 1.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.
@@ -0,0 +1,1031 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * @module schemas
5
+ * @description Optional Zod schemas and JSON Schema definitions for anonyma's
6
+ * public API surface. Import from `"anonyma/schemas"`.
7
+ *
8
+ * These schemas enable:
9
+ * - Runtime input validation
10
+ * - OpenAI / Anthropic function-calling definitions
11
+ * - MCP (Model Context Protocol) tool definitions
12
+ * - Automatic form generation
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * import { AnonymizeOptionsSchema, toJsonSchema } from "anonyma/schemas";
17
+ *
18
+ * // Validate at runtime:
19
+ * const opts = AnonymizeOptionsSchema.parse(unknownInput);
20
+ *
21
+ * // Obtain JSON Schema for an AI tool definition:
22
+ * const jsonSchema = toJsonSchema(AnonymizeOptionsSchema);
23
+ * ```
24
+ *
25
+ * @remarks
26
+ * This module requires `zod` to be installed (`peerDependency`).
27
+ * Import it only when you need runtime validation or AI schema generation.
28
+ */
29
+
30
+ /**
31
+ * Zod schema for the {@link PiiCategory} union.
32
+ */
33
+ declare const PiiCategorySchema: z.ZodEnum<["email", "phone", "ssn", "credit-card", "ipv4", "ipv6", "url", "iban", "date-of-birth", "name", "address", "passport", "drivers-license", "national-id", "bank-account", "cryptocurrency", "tax-id", "medical-record", "health-insurance", "prescription", "api-key", "social-media", "vin", "license-plate", "tracking-number", "case-number", "company-registration"]>;
34
+ /**
35
+ * Zod schema for {@link MaskOptions}.
36
+ */
37
+ declare const MaskOptionsSchema: z.ZodObject<{
38
+ strategy: z.ZodLiteral<"mask">;
39
+ maskChar: z.ZodOptional<z.ZodDefault<z.ZodString>>;
40
+ keepLeading: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
41
+ keepTrailing: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
42
+ }, "strip", z.ZodTypeAny, {
43
+ strategy: "mask";
44
+ maskChar?: string | undefined;
45
+ keepLeading?: number | undefined;
46
+ keepTrailing?: number | undefined;
47
+ }, {
48
+ strategy: "mask";
49
+ maskChar?: string | undefined;
50
+ keepLeading?: number | undefined;
51
+ keepTrailing?: number | undefined;
52
+ }>;
53
+ /**
54
+ * Zod schema for {@link RedactOptions}.
55
+ */
56
+ declare const RedactOptionsSchema: z.ZodObject<{
57
+ strategy: z.ZodLiteral<"redact">;
58
+ label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
59
+ }, "strip", z.ZodTypeAny, {
60
+ strategy: "redact";
61
+ label?: string | undefined;
62
+ }, {
63
+ strategy: "redact";
64
+ label?: string | undefined;
65
+ }>;
66
+ /**
67
+ * Zod schema for {@link PseudonymizeOptions}.
68
+ */
69
+ declare const PseudonymizeOptionsSchema: z.ZodObject<{
70
+ strategy: z.ZodLiteral<"pseudonymize">;
71
+ seed: z.ZodOptional<z.ZodString>;
72
+ prefix: z.ZodOptional<z.ZodDefault<z.ZodString>>;
73
+ }, "strip", z.ZodTypeAny, {
74
+ strategy: "pseudonymize";
75
+ seed?: string | undefined;
76
+ prefix?: string | undefined;
77
+ }, {
78
+ strategy: "pseudonymize";
79
+ seed?: string | undefined;
80
+ prefix?: string | undefined;
81
+ }>;
82
+ /**
83
+ * Zod schema for {@link HashOptions}.
84
+ */
85
+ declare const HashOptionsSchema: z.ZodObject<{
86
+ strategy: z.ZodLiteral<"hash">;
87
+ truncate: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
88
+ pepper: z.ZodOptional<z.ZodString>;
89
+ }, "strip", z.ZodTypeAny, {
90
+ strategy: "hash";
91
+ truncate?: number | undefined;
92
+ pepper?: string | undefined;
93
+ }, {
94
+ strategy: "hash";
95
+ truncate?: number | undefined;
96
+ pepper?: string | undefined;
97
+ }>;
98
+ /**
99
+ * Zod schema for {@link GeneralizeOptions}.
100
+ */
101
+ declare const GeneralizeOptionsSchema: z.ZodObject<{
102
+ strategy: z.ZodLiteral<"generalize">;
103
+ bucketSize: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
104
+ }, "strip", z.ZodTypeAny, {
105
+ strategy: "generalize";
106
+ bucketSize?: number | undefined;
107
+ }, {
108
+ strategy: "generalize";
109
+ bucketSize?: number | undefined;
110
+ }>;
111
+ /**
112
+ * Discriminated union schema for {@link StrategyOptions}.
113
+ */
114
+ declare const StrategyOptionsSchema: z.ZodDiscriminatedUnion<"strategy", [z.ZodObject<{
115
+ strategy: z.ZodLiteral<"mask">;
116
+ maskChar: z.ZodOptional<z.ZodDefault<z.ZodString>>;
117
+ keepLeading: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
118
+ keepTrailing: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
119
+ }, "strip", z.ZodTypeAny, {
120
+ strategy: "mask";
121
+ maskChar?: string | undefined;
122
+ keepLeading?: number | undefined;
123
+ keepTrailing?: number | undefined;
124
+ }, {
125
+ strategy: "mask";
126
+ maskChar?: string | undefined;
127
+ keepLeading?: number | undefined;
128
+ keepTrailing?: number | undefined;
129
+ }>, z.ZodObject<{
130
+ strategy: z.ZodLiteral<"redact">;
131
+ label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
132
+ }, "strip", z.ZodTypeAny, {
133
+ strategy: "redact";
134
+ label?: string | undefined;
135
+ }, {
136
+ strategy: "redact";
137
+ label?: string | undefined;
138
+ }>, z.ZodObject<{
139
+ strategy: z.ZodLiteral<"pseudonymize">;
140
+ seed: z.ZodOptional<z.ZodString>;
141
+ prefix: z.ZodOptional<z.ZodDefault<z.ZodString>>;
142
+ }, "strip", z.ZodTypeAny, {
143
+ strategy: "pseudonymize";
144
+ seed?: string | undefined;
145
+ prefix?: string | undefined;
146
+ }, {
147
+ strategy: "pseudonymize";
148
+ seed?: string | undefined;
149
+ prefix?: string | undefined;
150
+ }>, z.ZodObject<{
151
+ strategy: z.ZodLiteral<"hash">;
152
+ truncate: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
153
+ pepper: z.ZodOptional<z.ZodString>;
154
+ }, "strip", z.ZodTypeAny, {
155
+ strategy: "hash";
156
+ truncate?: number | undefined;
157
+ pepper?: string | undefined;
158
+ }, {
159
+ strategy: "hash";
160
+ truncate?: number | undefined;
161
+ pepper?: string | undefined;
162
+ }>, z.ZodObject<{
163
+ strategy: z.ZodLiteral<"generalize">;
164
+ bucketSize: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
165
+ }, "strip", z.ZodTypeAny, {
166
+ strategy: "generalize";
167
+ bucketSize?: number | undefined;
168
+ }, {
169
+ strategy: "generalize";
170
+ bucketSize?: number | undefined;
171
+ }>]>;
172
+ /**
173
+ * Zod schema for {@link PiiMatch}.
174
+ */
175
+ declare const PiiMatchSchema: z.ZodObject<{
176
+ category: z.ZodEnum<["email", "phone", "ssn", "credit-card", "ipv4", "ipv6", "url", "iban", "date-of-birth", "name", "address", "passport", "drivers-license", "national-id", "bank-account", "cryptocurrency", "tax-id", "medical-record", "health-insurance", "prescription", "api-key", "social-media", "vin", "license-plate", "tracking-number", "case-number", "company-registration"]>;
177
+ value: z.ZodString;
178
+ start: z.ZodNumber;
179
+ end: z.ZodNumber;
180
+ confidence: z.ZodNumber;
181
+ }, "strip", z.ZodTypeAny, {
182
+ value: string;
183
+ category: "email" | "phone" | "ssn" | "credit-card" | "ipv4" | "ipv6" | "url" | "iban" | "date-of-birth" | "name" | "address" | "passport" | "drivers-license" | "national-id" | "bank-account" | "cryptocurrency" | "tax-id" | "medical-record" | "health-insurance" | "prescription" | "api-key" | "social-media" | "vin" | "license-plate" | "tracking-number" | "case-number" | "company-registration";
184
+ start: number;
185
+ end: number;
186
+ confidence: number;
187
+ }, {
188
+ value: string;
189
+ category: "email" | "phone" | "ssn" | "credit-card" | "ipv4" | "ipv6" | "url" | "iban" | "date-of-birth" | "name" | "address" | "passport" | "drivers-license" | "national-id" | "bank-account" | "cryptocurrency" | "tax-id" | "medical-record" | "health-insurance" | "prescription" | "api-key" | "social-media" | "vin" | "license-plate" | "tracking-number" | "case-number" | "company-registration";
190
+ start: number;
191
+ end: number;
192
+ confidence: number;
193
+ }>;
194
+ /**
195
+ * Zod schema for {@link AnonymizeResult}.
196
+ */
197
+ declare const AnonymizeResultSchema: z.ZodObject<{
198
+ text: z.ZodString;
199
+ matches: z.ZodArray<z.ZodObject<{
200
+ category: z.ZodEnum<["email", "phone", "ssn", "credit-card", "ipv4", "ipv6", "url", "iban", "date-of-birth", "name", "address", "passport", "drivers-license", "national-id", "bank-account", "cryptocurrency", "tax-id", "medical-record", "health-insurance", "prescription", "api-key", "social-media", "vin", "license-plate", "tracking-number", "case-number", "company-registration"]>;
201
+ value: z.ZodString;
202
+ start: z.ZodNumber;
203
+ end: z.ZodNumber;
204
+ confidence: z.ZodNumber;
205
+ }, "strip", z.ZodTypeAny, {
206
+ value: string;
207
+ category: "email" | "phone" | "ssn" | "credit-card" | "ipv4" | "ipv6" | "url" | "iban" | "date-of-birth" | "name" | "address" | "passport" | "drivers-license" | "national-id" | "bank-account" | "cryptocurrency" | "tax-id" | "medical-record" | "health-insurance" | "prescription" | "api-key" | "social-media" | "vin" | "license-plate" | "tracking-number" | "case-number" | "company-registration";
208
+ start: number;
209
+ end: number;
210
+ confidence: number;
211
+ }, {
212
+ value: string;
213
+ category: "email" | "phone" | "ssn" | "credit-card" | "ipv4" | "ipv6" | "url" | "iban" | "date-of-birth" | "name" | "address" | "passport" | "drivers-license" | "national-id" | "bank-account" | "cryptocurrency" | "tax-id" | "medical-record" | "health-insurance" | "prescription" | "api-key" | "social-media" | "vin" | "license-plate" | "tracking-number" | "case-number" | "company-registration";
214
+ start: number;
215
+ end: number;
216
+ confidence: number;
217
+ }>, "many">;
218
+ }, "strip", z.ZodTypeAny, {
219
+ text: string;
220
+ matches: {
221
+ value: string;
222
+ category: "email" | "phone" | "ssn" | "credit-card" | "ipv4" | "ipv6" | "url" | "iban" | "date-of-birth" | "name" | "address" | "passport" | "drivers-license" | "national-id" | "bank-account" | "cryptocurrency" | "tax-id" | "medical-record" | "health-insurance" | "prescription" | "api-key" | "social-media" | "vin" | "license-plate" | "tracking-number" | "case-number" | "company-registration";
223
+ start: number;
224
+ end: number;
225
+ confidence: number;
226
+ }[];
227
+ }, {
228
+ text: string;
229
+ matches: {
230
+ value: string;
231
+ category: "email" | "phone" | "ssn" | "credit-card" | "ipv4" | "ipv6" | "url" | "iban" | "date-of-birth" | "name" | "address" | "passport" | "drivers-license" | "national-id" | "bank-account" | "cryptocurrency" | "tax-id" | "medical-record" | "health-insurance" | "prescription" | "api-key" | "social-media" | "vin" | "license-plate" | "tracking-number" | "case-number" | "company-registration";
232
+ start: number;
233
+ end: number;
234
+ confidence: number;
235
+ }[];
236
+ }>;
237
+ /**
238
+ * Zod schema for a single {@link AnonymizationRule}.
239
+ */
240
+ declare const AnonymizationRuleSchema: z.ZodObject<{
241
+ category: z.ZodEnum<["email", "phone", "ssn", "credit-card", "ipv4", "ipv6", "url", "iban", "date-of-birth", "name", "address", "passport", "drivers-license", "national-id", "bank-account", "cryptocurrency", "tax-id", "medical-record", "health-insurance", "prescription", "api-key", "social-media", "vin", "license-plate", "tracking-number", "case-number", "company-registration"]>;
242
+ strategy: z.ZodDiscriminatedUnion<"strategy", [z.ZodObject<{
243
+ strategy: z.ZodLiteral<"mask">;
244
+ maskChar: z.ZodOptional<z.ZodDefault<z.ZodString>>;
245
+ keepLeading: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
246
+ keepTrailing: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
247
+ }, "strip", z.ZodTypeAny, {
248
+ strategy: "mask";
249
+ maskChar?: string | undefined;
250
+ keepLeading?: number | undefined;
251
+ keepTrailing?: number | undefined;
252
+ }, {
253
+ strategy: "mask";
254
+ maskChar?: string | undefined;
255
+ keepLeading?: number | undefined;
256
+ keepTrailing?: number | undefined;
257
+ }>, z.ZodObject<{
258
+ strategy: z.ZodLiteral<"redact">;
259
+ label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
260
+ }, "strip", z.ZodTypeAny, {
261
+ strategy: "redact";
262
+ label?: string | undefined;
263
+ }, {
264
+ strategy: "redact";
265
+ label?: string | undefined;
266
+ }>, z.ZodObject<{
267
+ strategy: z.ZodLiteral<"pseudonymize">;
268
+ seed: z.ZodOptional<z.ZodString>;
269
+ prefix: z.ZodOptional<z.ZodDefault<z.ZodString>>;
270
+ }, "strip", z.ZodTypeAny, {
271
+ strategy: "pseudonymize";
272
+ seed?: string | undefined;
273
+ prefix?: string | undefined;
274
+ }, {
275
+ strategy: "pseudonymize";
276
+ seed?: string | undefined;
277
+ prefix?: string | undefined;
278
+ }>, z.ZodObject<{
279
+ strategy: z.ZodLiteral<"hash">;
280
+ truncate: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
281
+ pepper: z.ZodOptional<z.ZodString>;
282
+ }, "strip", z.ZodTypeAny, {
283
+ strategy: "hash";
284
+ truncate?: number | undefined;
285
+ pepper?: string | undefined;
286
+ }, {
287
+ strategy: "hash";
288
+ truncate?: number | undefined;
289
+ pepper?: string | undefined;
290
+ }>, z.ZodObject<{
291
+ strategy: z.ZodLiteral<"generalize">;
292
+ bucketSize: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
293
+ }, "strip", z.ZodTypeAny, {
294
+ strategy: "generalize";
295
+ bucketSize?: number | undefined;
296
+ }, {
297
+ strategy: "generalize";
298
+ bucketSize?: number | undefined;
299
+ }>]>;
300
+ }, "strip", z.ZodTypeAny, {
301
+ strategy: {
302
+ strategy: "mask";
303
+ maskChar?: string | undefined;
304
+ keepLeading?: number | undefined;
305
+ keepTrailing?: number | undefined;
306
+ } | {
307
+ strategy: "redact";
308
+ label?: string | undefined;
309
+ } | {
310
+ strategy: "pseudonymize";
311
+ seed?: string | undefined;
312
+ prefix?: string | undefined;
313
+ } | {
314
+ strategy: "hash";
315
+ truncate?: number | undefined;
316
+ pepper?: string | undefined;
317
+ } | {
318
+ strategy: "generalize";
319
+ bucketSize?: number | undefined;
320
+ };
321
+ category: "email" | "phone" | "ssn" | "credit-card" | "ipv4" | "ipv6" | "url" | "iban" | "date-of-birth" | "name" | "address" | "passport" | "drivers-license" | "national-id" | "bank-account" | "cryptocurrency" | "tax-id" | "medical-record" | "health-insurance" | "prescription" | "api-key" | "social-media" | "vin" | "license-plate" | "tracking-number" | "case-number" | "company-registration";
322
+ }, {
323
+ strategy: {
324
+ strategy: "mask";
325
+ maskChar?: string | undefined;
326
+ keepLeading?: number | undefined;
327
+ keepTrailing?: number | undefined;
328
+ } | {
329
+ strategy: "redact";
330
+ label?: string | undefined;
331
+ } | {
332
+ strategy: "pseudonymize";
333
+ seed?: string | undefined;
334
+ prefix?: string | undefined;
335
+ } | {
336
+ strategy: "hash";
337
+ truncate?: number | undefined;
338
+ pepper?: string | undefined;
339
+ } | {
340
+ strategy: "generalize";
341
+ bucketSize?: number | undefined;
342
+ };
343
+ category: "email" | "phone" | "ssn" | "credit-card" | "ipv4" | "ipv6" | "url" | "iban" | "date-of-birth" | "name" | "address" | "passport" | "drivers-license" | "national-id" | "bank-account" | "cryptocurrency" | "tax-id" | "medical-record" | "health-insurance" | "prescription" | "api-key" | "social-media" | "vin" | "license-plate" | "tracking-number" | "case-number" | "company-registration";
344
+ }>;
345
+ /**
346
+ * Zod schema for a {@link CustomPattern}.
347
+ */
348
+ declare const CustomPatternSchema: z.ZodObject<{
349
+ pattern: z.ZodType<RegExp, z.ZodTypeDef, RegExp>;
350
+ category: z.ZodOptional<z.ZodString>;
351
+ confidence: z.ZodOptional<z.ZodNumber>;
352
+ label: z.ZodOptional<z.ZodString>;
353
+ }, "strip", z.ZodTypeAny, {
354
+ pattern: RegExp;
355
+ label?: string | undefined;
356
+ category?: string | undefined;
357
+ confidence?: number | undefined;
358
+ }, {
359
+ pattern: RegExp;
360
+ label?: string | undefined;
361
+ category?: string | undefined;
362
+ confidence?: number | undefined;
363
+ }>;
364
+ /**
365
+ * Zod schema for {@link AnonymizeOptions}.
366
+ */
367
+ declare const AnonymizeOptionsSchema: z.ZodObject<{
368
+ rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
369
+ category: z.ZodEnum<["email", "phone", "ssn", "credit-card", "ipv4", "ipv6", "url", "iban", "date-of-birth", "name", "address", "passport", "drivers-license", "national-id", "bank-account", "cryptocurrency", "tax-id", "medical-record", "health-insurance", "prescription", "api-key", "social-media", "vin", "license-plate", "tracking-number", "case-number", "company-registration"]>;
370
+ strategy: z.ZodDiscriminatedUnion<"strategy", [z.ZodObject<{
371
+ strategy: z.ZodLiteral<"mask">;
372
+ maskChar: z.ZodOptional<z.ZodDefault<z.ZodString>>;
373
+ keepLeading: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
374
+ keepTrailing: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
375
+ }, "strip", z.ZodTypeAny, {
376
+ strategy: "mask";
377
+ maskChar?: string | undefined;
378
+ keepLeading?: number | undefined;
379
+ keepTrailing?: number | undefined;
380
+ }, {
381
+ strategy: "mask";
382
+ maskChar?: string | undefined;
383
+ keepLeading?: number | undefined;
384
+ keepTrailing?: number | undefined;
385
+ }>, z.ZodObject<{
386
+ strategy: z.ZodLiteral<"redact">;
387
+ label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
388
+ }, "strip", z.ZodTypeAny, {
389
+ strategy: "redact";
390
+ label?: string | undefined;
391
+ }, {
392
+ strategy: "redact";
393
+ label?: string | undefined;
394
+ }>, z.ZodObject<{
395
+ strategy: z.ZodLiteral<"pseudonymize">;
396
+ seed: z.ZodOptional<z.ZodString>;
397
+ prefix: z.ZodOptional<z.ZodDefault<z.ZodString>>;
398
+ }, "strip", z.ZodTypeAny, {
399
+ strategy: "pseudonymize";
400
+ seed?: string | undefined;
401
+ prefix?: string | undefined;
402
+ }, {
403
+ strategy: "pseudonymize";
404
+ seed?: string | undefined;
405
+ prefix?: string | undefined;
406
+ }>, z.ZodObject<{
407
+ strategy: z.ZodLiteral<"hash">;
408
+ truncate: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
409
+ pepper: z.ZodOptional<z.ZodString>;
410
+ }, "strip", z.ZodTypeAny, {
411
+ strategy: "hash";
412
+ truncate?: number | undefined;
413
+ pepper?: string | undefined;
414
+ }, {
415
+ strategy: "hash";
416
+ truncate?: number | undefined;
417
+ pepper?: string | undefined;
418
+ }>, z.ZodObject<{
419
+ strategy: z.ZodLiteral<"generalize">;
420
+ bucketSize: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
421
+ }, "strip", z.ZodTypeAny, {
422
+ strategy: "generalize";
423
+ bucketSize?: number | undefined;
424
+ }, {
425
+ strategy: "generalize";
426
+ bucketSize?: number | undefined;
427
+ }>]>;
428
+ }, "strip", z.ZodTypeAny, {
429
+ strategy: {
430
+ strategy: "mask";
431
+ maskChar?: string | undefined;
432
+ keepLeading?: number | undefined;
433
+ keepTrailing?: number | undefined;
434
+ } | {
435
+ strategy: "redact";
436
+ label?: string | undefined;
437
+ } | {
438
+ strategy: "pseudonymize";
439
+ seed?: string | undefined;
440
+ prefix?: string | undefined;
441
+ } | {
442
+ strategy: "hash";
443
+ truncate?: number | undefined;
444
+ pepper?: string | undefined;
445
+ } | {
446
+ strategy: "generalize";
447
+ bucketSize?: number | undefined;
448
+ };
449
+ category: "email" | "phone" | "ssn" | "credit-card" | "ipv4" | "ipv6" | "url" | "iban" | "date-of-birth" | "name" | "address" | "passport" | "drivers-license" | "national-id" | "bank-account" | "cryptocurrency" | "tax-id" | "medical-record" | "health-insurance" | "prescription" | "api-key" | "social-media" | "vin" | "license-plate" | "tracking-number" | "case-number" | "company-registration";
450
+ }, {
451
+ strategy: {
452
+ strategy: "mask";
453
+ maskChar?: string | undefined;
454
+ keepLeading?: number | undefined;
455
+ keepTrailing?: number | undefined;
456
+ } | {
457
+ strategy: "redact";
458
+ label?: string | undefined;
459
+ } | {
460
+ strategy: "pseudonymize";
461
+ seed?: string | undefined;
462
+ prefix?: string | undefined;
463
+ } | {
464
+ strategy: "hash";
465
+ truncate?: number | undefined;
466
+ pepper?: string | undefined;
467
+ } | {
468
+ strategy: "generalize";
469
+ bucketSize?: number | undefined;
470
+ };
471
+ category: "email" | "phone" | "ssn" | "credit-card" | "ipv4" | "ipv6" | "url" | "iban" | "date-of-birth" | "name" | "address" | "passport" | "drivers-license" | "national-id" | "bank-account" | "cryptocurrency" | "tax-id" | "medical-record" | "health-insurance" | "prescription" | "api-key" | "social-media" | "vin" | "license-plate" | "tracking-number" | "case-number" | "company-registration";
472
+ }>, "many">>;
473
+ defaultStrategy: z.ZodOptional<z.ZodDiscriminatedUnion<"strategy", [z.ZodObject<{
474
+ strategy: z.ZodLiteral<"mask">;
475
+ maskChar: z.ZodOptional<z.ZodDefault<z.ZodString>>;
476
+ keepLeading: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
477
+ keepTrailing: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
478
+ }, "strip", z.ZodTypeAny, {
479
+ strategy: "mask";
480
+ maskChar?: string | undefined;
481
+ keepLeading?: number | undefined;
482
+ keepTrailing?: number | undefined;
483
+ }, {
484
+ strategy: "mask";
485
+ maskChar?: string | undefined;
486
+ keepLeading?: number | undefined;
487
+ keepTrailing?: number | undefined;
488
+ }>, z.ZodObject<{
489
+ strategy: z.ZodLiteral<"redact">;
490
+ label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
491
+ }, "strip", z.ZodTypeAny, {
492
+ strategy: "redact";
493
+ label?: string | undefined;
494
+ }, {
495
+ strategy: "redact";
496
+ label?: string | undefined;
497
+ }>, z.ZodObject<{
498
+ strategy: z.ZodLiteral<"pseudonymize">;
499
+ seed: z.ZodOptional<z.ZodString>;
500
+ prefix: z.ZodOptional<z.ZodDefault<z.ZodString>>;
501
+ }, "strip", z.ZodTypeAny, {
502
+ strategy: "pseudonymize";
503
+ seed?: string | undefined;
504
+ prefix?: string | undefined;
505
+ }, {
506
+ strategy: "pseudonymize";
507
+ seed?: string | undefined;
508
+ prefix?: string | undefined;
509
+ }>, z.ZodObject<{
510
+ strategy: z.ZodLiteral<"hash">;
511
+ truncate: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
512
+ pepper: z.ZodOptional<z.ZodString>;
513
+ }, "strip", z.ZodTypeAny, {
514
+ strategy: "hash";
515
+ truncate?: number | undefined;
516
+ pepper?: string | undefined;
517
+ }, {
518
+ strategy: "hash";
519
+ truncate?: number | undefined;
520
+ pepper?: string | undefined;
521
+ }>, z.ZodObject<{
522
+ strategy: z.ZodLiteral<"generalize">;
523
+ bucketSize: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
524
+ }, "strip", z.ZodTypeAny, {
525
+ strategy: "generalize";
526
+ bucketSize?: number | undefined;
527
+ }, {
528
+ strategy: "generalize";
529
+ bucketSize?: number | undefined;
530
+ }>]>>;
531
+ includeMatches: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
532
+ customPatterns: z.ZodOptional<z.ZodArray<z.ZodObject<{
533
+ pattern: z.ZodType<RegExp, z.ZodTypeDef, RegExp>;
534
+ category: z.ZodOptional<z.ZodString>;
535
+ confidence: z.ZodOptional<z.ZodNumber>;
536
+ label: z.ZodOptional<z.ZodString>;
537
+ }, "strip", z.ZodTypeAny, {
538
+ pattern: RegExp;
539
+ label?: string | undefined;
540
+ category?: string | undefined;
541
+ confidence?: number | undefined;
542
+ }, {
543
+ pattern: RegExp;
544
+ label?: string | undefined;
545
+ category?: string | undefined;
546
+ confidence?: number | undefined;
547
+ }>, "many">>;
548
+ globalReplacement: z.ZodOptional<z.ZodString>;
549
+ consistentTokens: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
550
+ aggressive: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
551
+ enabledCategories: z.ZodOptional<z.ZodRecord<z.ZodEnum<["email", "phone", "ssn", "credit-card", "ipv4", "ipv6", "url", "iban", "date-of-birth", "name", "address", "passport", "drivers-license", "national-id", "bank-account", "cryptocurrency", "tax-id", "medical-record", "health-insurance", "prescription", "api-key", "social-media", "vin", "license-plate", "tracking-number", "case-number", "company-registration"]>, z.ZodBoolean>>;
552
+ }, "strip", z.ZodTypeAny, {
553
+ rules?: {
554
+ strategy: {
555
+ strategy: "mask";
556
+ maskChar?: string | undefined;
557
+ keepLeading?: number | undefined;
558
+ keepTrailing?: number | undefined;
559
+ } | {
560
+ strategy: "redact";
561
+ label?: string | undefined;
562
+ } | {
563
+ strategy: "pseudonymize";
564
+ seed?: string | undefined;
565
+ prefix?: string | undefined;
566
+ } | {
567
+ strategy: "hash";
568
+ truncate?: number | undefined;
569
+ pepper?: string | undefined;
570
+ } | {
571
+ strategy: "generalize";
572
+ bucketSize?: number | undefined;
573
+ };
574
+ category: "email" | "phone" | "ssn" | "credit-card" | "ipv4" | "ipv6" | "url" | "iban" | "date-of-birth" | "name" | "address" | "passport" | "drivers-license" | "national-id" | "bank-account" | "cryptocurrency" | "tax-id" | "medical-record" | "health-insurance" | "prescription" | "api-key" | "social-media" | "vin" | "license-plate" | "tracking-number" | "case-number" | "company-registration";
575
+ }[] | undefined;
576
+ defaultStrategy?: {
577
+ strategy: "mask";
578
+ maskChar?: string | undefined;
579
+ keepLeading?: number | undefined;
580
+ keepTrailing?: number | undefined;
581
+ } | {
582
+ strategy: "redact";
583
+ label?: string | undefined;
584
+ } | {
585
+ strategy: "pseudonymize";
586
+ seed?: string | undefined;
587
+ prefix?: string | undefined;
588
+ } | {
589
+ strategy: "hash";
590
+ truncate?: number | undefined;
591
+ pepper?: string | undefined;
592
+ } | {
593
+ strategy: "generalize";
594
+ bucketSize?: number | undefined;
595
+ } | undefined;
596
+ includeMatches?: boolean | undefined;
597
+ customPatterns?: {
598
+ pattern: RegExp;
599
+ label?: string | undefined;
600
+ category?: string | undefined;
601
+ confidence?: number | undefined;
602
+ }[] | undefined;
603
+ globalReplacement?: string | undefined;
604
+ consistentTokens?: boolean | undefined;
605
+ aggressive?: boolean | undefined;
606
+ enabledCategories?: Partial<Record<"email" | "phone" | "ssn" | "credit-card" | "ipv4" | "ipv6" | "url" | "iban" | "date-of-birth" | "name" | "address" | "passport" | "drivers-license" | "national-id" | "bank-account" | "cryptocurrency" | "tax-id" | "medical-record" | "health-insurance" | "prescription" | "api-key" | "social-media" | "vin" | "license-plate" | "tracking-number" | "case-number" | "company-registration", boolean>> | undefined;
607
+ }, {
608
+ rules?: {
609
+ strategy: {
610
+ strategy: "mask";
611
+ maskChar?: string | undefined;
612
+ keepLeading?: number | undefined;
613
+ keepTrailing?: number | undefined;
614
+ } | {
615
+ strategy: "redact";
616
+ label?: string | undefined;
617
+ } | {
618
+ strategy: "pseudonymize";
619
+ seed?: string | undefined;
620
+ prefix?: string | undefined;
621
+ } | {
622
+ strategy: "hash";
623
+ truncate?: number | undefined;
624
+ pepper?: string | undefined;
625
+ } | {
626
+ strategy: "generalize";
627
+ bucketSize?: number | undefined;
628
+ };
629
+ category: "email" | "phone" | "ssn" | "credit-card" | "ipv4" | "ipv6" | "url" | "iban" | "date-of-birth" | "name" | "address" | "passport" | "drivers-license" | "national-id" | "bank-account" | "cryptocurrency" | "tax-id" | "medical-record" | "health-insurance" | "prescription" | "api-key" | "social-media" | "vin" | "license-plate" | "tracking-number" | "case-number" | "company-registration";
630
+ }[] | undefined;
631
+ defaultStrategy?: {
632
+ strategy: "mask";
633
+ maskChar?: string | undefined;
634
+ keepLeading?: number | undefined;
635
+ keepTrailing?: number | undefined;
636
+ } | {
637
+ strategy: "redact";
638
+ label?: string | undefined;
639
+ } | {
640
+ strategy: "pseudonymize";
641
+ seed?: string | undefined;
642
+ prefix?: string | undefined;
643
+ } | {
644
+ strategy: "hash";
645
+ truncate?: number | undefined;
646
+ pepper?: string | undefined;
647
+ } | {
648
+ strategy: "generalize";
649
+ bucketSize?: number | undefined;
650
+ } | undefined;
651
+ includeMatches?: boolean | undefined;
652
+ customPatterns?: {
653
+ pattern: RegExp;
654
+ label?: string | undefined;
655
+ category?: string | undefined;
656
+ confidence?: number | undefined;
657
+ }[] | undefined;
658
+ globalReplacement?: string | undefined;
659
+ consistentTokens?: boolean | undefined;
660
+ aggressive?: boolean | undefined;
661
+ enabledCategories?: Partial<Record<"email" | "phone" | "ssn" | "credit-card" | "ipv4" | "ipv6" | "url" | "iban" | "date-of-birth" | "name" | "address" | "passport" | "drivers-license" | "national-id" | "bank-account" | "cryptocurrency" | "tax-id" | "medical-record" | "health-insurance" | "prescription" | "api-key" | "social-media" | "vin" | "license-plate" | "tracking-number" | "case-number" | "company-registration", boolean>> | undefined;
662
+ }>;
663
+ /**
664
+ * Zod schema for a single field rule.
665
+ */
666
+ declare const FieldRuleSchema: z.ZodObject<{
667
+ strategy: z.ZodDiscriminatedUnion<"strategy", [z.ZodObject<{
668
+ strategy: z.ZodLiteral<"mask">;
669
+ maskChar: z.ZodOptional<z.ZodDefault<z.ZodString>>;
670
+ keepLeading: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
671
+ keepTrailing: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
672
+ }, "strip", z.ZodTypeAny, {
673
+ strategy: "mask";
674
+ maskChar?: string | undefined;
675
+ keepLeading?: number | undefined;
676
+ keepTrailing?: number | undefined;
677
+ }, {
678
+ strategy: "mask";
679
+ maskChar?: string | undefined;
680
+ keepLeading?: number | undefined;
681
+ keepTrailing?: number | undefined;
682
+ }>, z.ZodObject<{
683
+ strategy: z.ZodLiteral<"redact">;
684
+ label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
685
+ }, "strip", z.ZodTypeAny, {
686
+ strategy: "redact";
687
+ label?: string | undefined;
688
+ }, {
689
+ strategy: "redact";
690
+ label?: string | undefined;
691
+ }>, z.ZodObject<{
692
+ strategy: z.ZodLiteral<"pseudonymize">;
693
+ seed: z.ZodOptional<z.ZodString>;
694
+ prefix: z.ZodOptional<z.ZodDefault<z.ZodString>>;
695
+ }, "strip", z.ZodTypeAny, {
696
+ strategy: "pseudonymize";
697
+ seed?: string | undefined;
698
+ prefix?: string | undefined;
699
+ }, {
700
+ strategy: "pseudonymize";
701
+ seed?: string | undefined;
702
+ prefix?: string | undefined;
703
+ }>, z.ZodObject<{
704
+ strategy: z.ZodLiteral<"hash">;
705
+ truncate: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
706
+ pepper: z.ZodOptional<z.ZodString>;
707
+ }, "strip", z.ZodTypeAny, {
708
+ strategy: "hash";
709
+ truncate?: number | undefined;
710
+ pepper?: string | undefined;
711
+ }, {
712
+ strategy: "hash";
713
+ truncate?: number | undefined;
714
+ pepper?: string | undefined;
715
+ }>, z.ZodObject<{
716
+ strategy: z.ZodLiteral<"generalize">;
717
+ bucketSize: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
718
+ }, "strip", z.ZodTypeAny, {
719
+ strategy: "generalize";
720
+ bucketSize?: number | undefined;
721
+ }, {
722
+ strategy: "generalize";
723
+ bucketSize?: number | undefined;
724
+ }>]>;
725
+ }, "strip", z.ZodTypeAny, {
726
+ strategy: {
727
+ strategy: "mask";
728
+ maskChar?: string | undefined;
729
+ keepLeading?: number | undefined;
730
+ keepTrailing?: number | undefined;
731
+ } | {
732
+ strategy: "redact";
733
+ label?: string | undefined;
734
+ } | {
735
+ strategy: "pseudonymize";
736
+ seed?: string | undefined;
737
+ prefix?: string | undefined;
738
+ } | {
739
+ strategy: "hash";
740
+ truncate?: number | undefined;
741
+ pepper?: string | undefined;
742
+ } | {
743
+ strategy: "generalize";
744
+ bucketSize?: number | undefined;
745
+ };
746
+ }, {
747
+ strategy: {
748
+ strategy: "mask";
749
+ maskChar?: string | undefined;
750
+ keepLeading?: number | undefined;
751
+ keepTrailing?: number | undefined;
752
+ } | {
753
+ strategy: "redact";
754
+ label?: string | undefined;
755
+ } | {
756
+ strategy: "pseudonymize";
757
+ seed?: string | undefined;
758
+ prefix?: string | undefined;
759
+ } | {
760
+ strategy: "hash";
761
+ truncate?: number | undefined;
762
+ pepper?: string | undefined;
763
+ } | {
764
+ strategy: "generalize";
765
+ bucketSize?: number | undefined;
766
+ };
767
+ }>;
768
+ /**
769
+ * Zod schema for a {@link FieldRuleMap}.
770
+ */
771
+ declare const FieldRuleMapSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
772
+ strategy: z.ZodDiscriminatedUnion<"strategy", [z.ZodObject<{
773
+ strategy: z.ZodLiteral<"mask">;
774
+ maskChar: z.ZodOptional<z.ZodDefault<z.ZodString>>;
775
+ keepLeading: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
776
+ keepTrailing: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
777
+ }, "strip", z.ZodTypeAny, {
778
+ strategy: "mask";
779
+ maskChar?: string | undefined;
780
+ keepLeading?: number | undefined;
781
+ keepTrailing?: number | undefined;
782
+ }, {
783
+ strategy: "mask";
784
+ maskChar?: string | undefined;
785
+ keepLeading?: number | undefined;
786
+ keepTrailing?: number | undefined;
787
+ }>, z.ZodObject<{
788
+ strategy: z.ZodLiteral<"redact">;
789
+ label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
790
+ }, "strip", z.ZodTypeAny, {
791
+ strategy: "redact";
792
+ label?: string | undefined;
793
+ }, {
794
+ strategy: "redact";
795
+ label?: string | undefined;
796
+ }>, z.ZodObject<{
797
+ strategy: z.ZodLiteral<"pseudonymize">;
798
+ seed: z.ZodOptional<z.ZodString>;
799
+ prefix: z.ZodOptional<z.ZodDefault<z.ZodString>>;
800
+ }, "strip", z.ZodTypeAny, {
801
+ strategy: "pseudonymize";
802
+ seed?: string | undefined;
803
+ prefix?: string | undefined;
804
+ }, {
805
+ strategy: "pseudonymize";
806
+ seed?: string | undefined;
807
+ prefix?: string | undefined;
808
+ }>, z.ZodObject<{
809
+ strategy: z.ZodLiteral<"hash">;
810
+ truncate: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
811
+ pepper: z.ZodOptional<z.ZodString>;
812
+ }, "strip", z.ZodTypeAny, {
813
+ strategy: "hash";
814
+ truncate?: number | undefined;
815
+ pepper?: string | undefined;
816
+ }, {
817
+ strategy: "hash";
818
+ truncate?: number | undefined;
819
+ pepper?: string | undefined;
820
+ }>, z.ZodObject<{
821
+ strategy: z.ZodLiteral<"generalize">;
822
+ bucketSize: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
823
+ }, "strip", z.ZodTypeAny, {
824
+ strategy: "generalize";
825
+ bucketSize?: number | undefined;
826
+ }, {
827
+ strategy: "generalize";
828
+ bucketSize?: number | undefined;
829
+ }>]>;
830
+ }, "strip", z.ZodTypeAny, {
831
+ strategy: {
832
+ strategy: "mask";
833
+ maskChar?: string | undefined;
834
+ keepLeading?: number | undefined;
835
+ keepTrailing?: number | undefined;
836
+ } | {
837
+ strategy: "redact";
838
+ label?: string | undefined;
839
+ } | {
840
+ strategy: "pseudonymize";
841
+ seed?: string | undefined;
842
+ prefix?: string | undefined;
843
+ } | {
844
+ strategy: "hash";
845
+ truncate?: number | undefined;
846
+ pepper?: string | undefined;
847
+ } | {
848
+ strategy: "generalize";
849
+ bucketSize?: number | undefined;
850
+ };
851
+ }, {
852
+ strategy: {
853
+ strategy: "mask";
854
+ maskChar?: string | undefined;
855
+ keepLeading?: number | undefined;
856
+ keepTrailing?: number | undefined;
857
+ } | {
858
+ strategy: "redact";
859
+ label?: string | undefined;
860
+ } | {
861
+ strategy: "pseudonymize";
862
+ seed?: string | undefined;
863
+ prefix?: string | undefined;
864
+ } | {
865
+ strategy: "hash";
866
+ truncate?: number | undefined;
867
+ pepper?: string | undefined;
868
+ } | {
869
+ strategy: "generalize";
870
+ bucketSize?: number | undefined;
871
+ };
872
+ }>>;
873
+ /**
874
+ * A minimal JSON Schema representation extracted from a Zod schema.
875
+ * Suitable for use in OpenAI function definitions, MCP tool definitions, etc.
876
+ */
877
+ interface JsonSchemaDefinition {
878
+ readonly type: string;
879
+ readonly description?: string;
880
+ readonly properties?: Record<string, JsonSchemaDefinition>;
881
+ readonly items?: JsonSchemaDefinition;
882
+ readonly enum?: readonly string[];
883
+ readonly required?: readonly string[];
884
+ readonly anyOf?: readonly JsonSchemaDefinition[];
885
+ readonly default?: unknown;
886
+ }
887
+ /**
888
+ * OpenAI-compatible function definition shape.
889
+ */
890
+ interface OpenAiFunctionDefinition {
891
+ readonly name: string;
892
+ readonly description: string;
893
+ readonly parameters: {
894
+ readonly type: "object";
895
+ readonly properties: Record<string, JsonSchemaDefinition>;
896
+ readonly required?: readonly string[];
897
+ };
898
+ }
899
+ /**
900
+ * Pre-built OpenAI / MCP tool definition for the `anonymize` function.
901
+ *
902
+ * @example
903
+ * ```ts
904
+ * import { ANONYMIZE_TOOL_DEFINITION } from "anonyma/schemas";
905
+ *
906
+ * // Pass directly to OpenAI client tools array:
907
+ * const response = await openai.chat.completions.create({
908
+ * model: "gpt-4o",
909
+ * tools: [{ type: "function", function: ANONYMIZE_TOOL_DEFINITION }],
910
+ * messages: [...],
911
+ * });
912
+ * ```
913
+ */
914
+ declare const ANONYMIZE_TOOL_DEFINITION: OpenAiFunctionDefinition;
915
+ /**
916
+ * Pre-built OpenAI / MCP tool definition for the `detect` function.
917
+ */
918
+ declare const DETECT_TOOL_DEFINITION: OpenAiFunctionDefinition;
919
+ /**
920
+ * Pre-built OpenAI / MCP tool definition for the `hasPII` function.
921
+ *
922
+ * @example
923
+ * ```ts
924
+ * import { HAS_PII_TOOL_DEFINITION } from "anonyma/schemas";
925
+ *
926
+ * const response = await openai.chat.completions.create({
927
+ * tools: [{ type: "function", function: HAS_PII_TOOL_DEFINITION }],
928
+ * messages: [...],
929
+ * });
930
+ * ```
931
+ */
932
+ declare const HAS_PII_TOOL_DEFINITION: OpenAiFunctionDefinition;
933
+ /**
934
+ * Pre-built OpenAI / MCP tool definition for the `anonymizeObject` function.
935
+ *
936
+ * @example
937
+ * ```ts
938
+ * import { ANONYMIZE_OBJECT_TOOL_DEFINITION } from "anonyma/schemas";
939
+ * ```
940
+ */
941
+ declare const ANONYMIZE_OBJECT_TOOL_DEFINITION: OpenAiFunctionDefinition;
942
+ /**
943
+ * Machine-readable manifest describing anonyma's capabilities.
944
+ * Useful for AI agents that need to discover and reason about available tools.
945
+ *
946
+ * @example
947
+ * ```ts
948
+ * import { ANONYMA_MANIFEST } from "anonyma/schemas";
949
+ *
950
+ * // Provide to an AI agent as system context:
951
+ * const systemPrompt = `You have access to the following data privacy tool:\n\n${JSON.stringify(ANONYMA_MANIFEST, null, 2)}`;
952
+ * ```
953
+ */
954
+ declare const ANONYMA_MANIFEST: {
955
+ readonly name: "anonyma";
956
+ readonly version: "1.0.0";
957
+ readonly description: "TypeScript-first PII detection & anonymization — 26 built-in detectors (email, SSN, IBAN, passport, credit card, and more), 8 strategies (mask, redact, hash, AES-256 encrypt, tokenize, pseudonymize, generalize, synthesize), 6 compliance presets (GDPR, HIPAA, CCPA, PCI-DSS, SOX, FERPA), reversible tokenization, LLM/AI pipeline helpers, WHATWG streaming, batch processing, checksum validators, and optional Zod/MCP schemas. Zero runtime dependencies.";
958
+ readonly capabilities: {
959
+ readonly detect: {
960
+ readonly description: "Detect PII in free text without modifying it.";
961
+ readonly supportedCategories: readonly ["email", "phone", "ssn", "credit-card", "ipv4", "ipv6", "url", "iban", "date-of-birth", "name", "address", "passport", "drivers-license", "national-id", "bank-account", "cryptocurrency", "tax-id", "medical-record", "health-insurance", "prescription", "api-key", "social-media", "vin", "license-plate", "tracking-number", "case-number", "company-registration"];
962
+ readonly notes: {
963
+ readonly name: string;
964
+ };
965
+ readonly returns: "Array of PiiMatch objects with category, value, position, and confidence.";
966
+ };
967
+ readonly hasPII: {
968
+ readonly description: string;
969
+ readonly returns: "boolean";
970
+ };
971
+ readonly anonymize: {
972
+ readonly description: "Detect and replace PII in free text using a configurable strategy.";
973
+ readonly strategies: {
974
+ readonly mask: "Replace characters with a mask char, keeping optional leading/trailing chars.";
975
+ readonly redact: "Replace the entire value with a label such as [REDACTED].";
976
+ readonly pseudonymize: "Replace with a deterministic pseudonym (requires seed for reproducibility).";
977
+ readonly hash: "Replace with a one-way SHA-256 hash (requires Node.js ≥ 18).";
978
+ readonly generalize: "Replace a numeric value with a bucket range (e.g. 27 → 20-29).";
979
+ readonly tokenize: "Replace with a reversible opaque token ([CATEGORY_NNNN]) for LLM pipelines.";
980
+ readonly encrypt: "Replace with AES-GCM ciphertext (requires Node.js ≥ 18 + passphrase/key).";
981
+ readonly synthesize: "Replace with structurally-valid synthetic data (format-preserving).";
982
+ };
983
+ readonly options: {
984
+ readonly globalReplacement: "Override ALL strategy outputs with a single replacement string.";
985
+ readonly consistentTokens: "Same PII value → same token (EMAIL_1, PHONE_2, etc.) within a call.";
986
+ readonly aggressive: "Use expanded, more permissive regex patterns to catch obfuscated PII.";
987
+ readonly enabledCategories: "Convenience boolean map for enabling/disabling categories.";
988
+ readonly customPatterns: "Ad-hoc regex patterns merged into the detection pipeline.";
989
+ readonly customDetectors: "Override built-in detectors on a per-category basis.";
990
+ readonly preset: "Apply a compliance preset (gdpr | hipaa | ccpa | pci-dss | sox | ferpa).";
991
+ readonly allowlist: "String values that should never be anonymized even when detected as PII.";
992
+ readonly confidenceThreshold: "Minimum confidence score (0-1) for a match to be anonymized.";
993
+ };
994
+ readonly returns: "AnonymizeResult { text: string; matches: PiiMatch[] }";
995
+ };
996
+ readonly tokenize: {
997
+ readonly description: "Replace PII with reversible opaque tokens. Use detokenize() to restore.";
998
+ readonly returns: "TokenizeResult { text: string; mapping: Map<string, string> }";
999
+ };
1000
+ readonly anonymizeObject: {
1001
+ readonly description: string;
1002
+ readonly returns: "A new object of the same shape with all string PII anonymized.";
1003
+ };
1004
+ readonly anonymizeRecord: {
1005
+ readonly description: "Anonymize specific fields in a JSON object using dot-notation paths.";
1006
+ readonly returns: "A new object with the specified fields anonymized.";
1007
+ };
1008
+ readonly batch: {
1009
+ readonly description: string;
1010
+ readonly returns: "BatchResult<T>[] where ok/error per item is available.";
1011
+ };
1012
+ readonly presets: {
1013
+ readonly description: "GDPR, HIPAA, CCPA, PCI-DSS, SOX, FERPA compliance presets.";
1014
+ readonly available: readonly ["gdpr", "hipaa", "ccpa", "pci-dss", "sox", "ferpa"];
1015
+ };
1016
+ };
1017
+ readonly toolDefinitions: {
1018
+ readonly openai: readonly [OpenAiFunctionDefinition, OpenAiFunctionDefinition, OpenAiFunctionDefinition, OpenAiFunctionDefinition];
1019
+ };
1020
+ };
1021
+ type PiiCategoryInput = z.infer<typeof PiiCategorySchema>;
1022
+ type StrategyOptionsInput = z.infer<typeof StrategyOptionsSchema>;
1023
+ type AnonymizeOptionsInput = z.infer<typeof AnonymizeOptionsSchema>;
1024
+ type AnonymizationRuleInput = z.infer<typeof AnonymizationRuleSchema>;
1025
+ type CustomPatternInput = z.infer<typeof CustomPatternSchema>;
1026
+ type PiiMatchOutput = z.infer<typeof PiiMatchSchema>;
1027
+ type AnonymizeResultOutput = z.infer<typeof AnonymizeResultSchema>;
1028
+ type FieldRuleInput = z.infer<typeof FieldRuleSchema>;
1029
+ type FieldRuleMapInput = z.infer<typeof FieldRuleMapSchema>;
1030
+
1031
+ export { ANONYMA_MANIFEST, ANONYMIZE_OBJECT_TOOL_DEFINITION, ANONYMIZE_TOOL_DEFINITION, type AnonymizationRuleInput, AnonymizationRuleSchema, type AnonymizeOptionsInput, AnonymizeOptionsSchema, type AnonymizeResultOutput, AnonymizeResultSchema, type CustomPatternInput, CustomPatternSchema, DETECT_TOOL_DEFINITION, type FieldRuleInput, type FieldRuleMapInput, FieldRuleMapSchema, FieldRuleSchema, GeneralizeOptionsSchema, HAS_PII_TOOL_DEFINITION, HashOptionsSchema, type JsonSchemaDefinition, MaskOptionsSchema, type OpenAiFunctionDefinition, type PiiCategoryInput, PiiCategorySchema, type PiiMatchOutput, PiiMatchSchema, PseudonymizeOptionsSchema, RedactOptionsSchema, type StrategyOptionsInput, StrategyOptionsSchema };