@aidc-toolkit/utility 1.0.45 → 1.0.46-beta

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.
Files changed (59) hide show
  1. package/dist/character-set.d.ts +242 -0
  2. package/dist/character-set.d.ts.map +1 -0
  3. package/dist/character-set.js +542 -0
  4. package/dist/character-set.js.map +1 -0
  5. package/dist/exclusion.d.ts +26 -0
  6. package/dist/exclusion.d.ts.map +1 -0
  7. package/dist/exclusion.js +18 -0
  8. package/dist/exclusion.js.map +1 -0
  9. package/dist/index.d.ts +26 -683
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +9 -1
  12. package/dist/index.js.map +1 -0
  13. package/dist/iterable-utility.d.ts +39 -0
  14. package/dist/iterable-utility.d.ts.map +1 -0
  15. package/dist/iterable-utility.js +35 -0
  16. package/dist/iterable-utility.js.map +1 -0
  17. package/dist/locale/en/locale-resources.d.ts +33 -0
  18. package/dist/locale/en/locale-resources.d.ts.map +1 -0
  19. package/dist/locale/en/locale-resources.js +32 -0
  20. package/dist/locale/en/locale-resources.js.map +1 -0
  21. package/dist/locale/fr/locale-resources.d.ts +33 -0
  22. package/dist/locale/fr/locale-resources.d.ts.map +1 -0
  23. package/dist/locale/fr/locale-resources.js +32 -0
  24. package/dist/locale/fr/locale-resources.js.map +1 -0
  25. package/dist/locale/i18n.d.ts +27 -0
  26. package/dist/locale/i18n.d.ts.map +1 -0
  27. package/dist/locale/i18n.js +34 -0
  28. package/dist/locale/i18n.js.map +1 -0
  29. package/dist/record.d.ts +37 -0
  30. package/dist/record.d.ts.map +1 -0
  31. package/dist/record.js +58 -0
  32. package/dist/record.js.map +1 -0
  33. package/dist/reg-exp.d.ts +40 -0
  34. package/dist/reg-exp.d.ts.map +1 -0
  35. package/dist/reg-exp.js +55 -0
  36. package/dist/reg-exp.js.map +1 -0
  37. package/dist/sequence.d.ts +45 -0
  38. package/dist/sequence.d.ts.map +1 -0
  39. package/dist/sequence.js +96 -0
  40. package/dist/sequence.js.map +1 -0
  41. package/dist/string.d.ts +25 -0
  42. package/dist/string.d.ts.map +1 -0
  43. package/dist/string.js +2 -0
  44. package/dist/string.js.map +1 -0
  45. package/dist/transformer.d.ts +191 -0
  46. package/dist/transformer.d.ts.map +1 -0
  47. package/dist/transformer.js +459 -0
  48. package/dist/transformer.js.map +1 -0
  49. package/dist/version.d.ts +5 -0
  50. package/dist/version.d.ts.map +1 -0
  51. package/dist/version.js +5 -0
  52. package/dist/version.js.map +1 -0
  53. package/package.json +3 -3
  54. package/src/character-set.ts +47 -20
  55. package/src/transformer.ts +57 -56
  56. package/src/version.ts +1 -1
  57. package/tsconfig-src.tsbuildinfo +1 -1
  58. package/dist/index.cjs +0 -17
  59. package/dist/index.d.cts +0 -683
package/dist/index.d.ts CHANGED
@@ -1,683 +1,26 @@
1
- import { I18nLanguageDetector } from '@aidc-toolkit/core';
2
- import { Resource, i18n } from 'i18next';
3
-
4
- declare const _default: {
5
- Transformer: {
6
- domainMustBeGreaterThanZero: string;
7
- tweakMustBeGreaterThanOrEqualToZero: string;
8
- valueMustBeGreaterThanOrEqualToZero: string;
9
- valueMustBeLessThan: string;
10
- minimumValueMustBeGreaterThanOrEqualToZero: string;
11
- maximumValueMustBeLessThan: string;
12
- };
13
- RegExpValidator: {
14
- stringDoesNotMatchPattern: string;
15
- };
16
- CharacterSetValidator: {
17
- firstZeroFirstCharacter: string;
18
- allNumericAllNumericCharacters: string;
19
- stringMustNotBeAllNumeric: string;
20
- lengthMustBeGreaterThanOrEqualTo: string;
21
- lengthMustBeLessThanOrEqualTo: string;
22
- lengthMustBeEqualTo: string;
23
- lengthOfComponentMustBeGreaterThanOrEqualTo: string;
24
- lengthOfComponentMustBeLessThanOrEqualTo: string;
25
- lengthOfComponentMustBeEqualTo: string;
26
- invalidCharacterAtPosition: string;
27
- invalidCharacterAtPositionOfComponent: string;
28
- exclusionNotSupported: string;
29
- endSequenceValueMustBeLessThanOrEqualTo: string;
30
- };
31
- RecordValidator: {
32
- typeNameKeyNotFound: string;
33
- };
34
- };
35
-
36
- declare const utilityNS = "aidct_utility";
37
- /**
38
- * Locale strings type is extracted from the English locale strings object.
39
- */
40
- type UtilityLocaleResources = typeof _default;
41
- /**
42
- * Utility resource bundle.
43
- */
44
- declare const utilityResourceBundle: Resource;
45
- declare const i18nextUtility: i18n;
46
- /**
47
- * Initialize internationalization.
48
- *
49
- * @param languageDetector
50
- * Language detector.
51
- *
52
- * @param debug
53
- * Debug setting.
54
- *
55
- * @returns
56
- * Utility resource bundle.
57
- */
58
- declare function i18nUtilityInit(languageDetector: I18nLanguageDetector, debug?: boolean): Promise<Resource>;
59
-
60
- /**
61
- * Sequence. Defines an ascending or descending sequence of big integers implemented as an iterable.
62
- */
63
- declare class Sequence implements Iterable<bigint> {
64
- #private;
65
- /**
66
- * Constructor.
67
- *
68
- * @param startValue
69
- * Start value.
70
- *
71
- * @param count
72
- * Count of values. If count is zero or positive, iteration ascends from start value, otherwise it descends from
73
- * start value.
74
- */
75
- constructor(startValue: number | bigint, count: number);
76
- /**
77
- * Get the start value (inclusive).
78
- */
79
- get startValue(): bigint;
80
- /**
81
- * Get the end value (exclusive).
82
- */
83
- get endValue(): bigint;
84
- /**
85
- * Get the count of values.
86
- */
87
- get count(): number;
88
- /**
89
- * Get the minimum value (inclusive).
90
- */
91
- get minimumValue(): bigint;
92
- /**
93
- * Get the maximum value (inclusive).
94
- */
95
- get maximumValue(): bigint;
96
- /**
97
- * Iterable implementation.
98
- *
99
- * @yields
100
- * Next value in sequence.
101
- */
102
- [Symbol.iterator](): Generator<bigint>;
103
- }
104
-
105
- /**
106
- * Indexed callback, used to map an input and optionally its index in an iterable to an output.
107
- *
108
- * @template TInput
109
- * Input type.
110
- *
111
- * @template TOutput
112
- * Output type.
113
- *
114
- * @param input
115
- * Input value.
116
- *
117
- * @param index
118
- * Index in iterable or undefined for single mapping).
119
- *
120
- * @returns
121
- * Output value.
122
- */
123
- type IndexedCallback<TInput, TOutput> = (input: TInput, index?: number) => TOutput;
124
- /**
125
- * Map an input iterable to an output iterable that applies a transformer callback to each value in the input.
126
- *
127
- * @template TInput
128
- * Input type.
129
- *
130
- * @template TOutput
131
- * Output type.
132
- *
133
- * @param values
134
- * Input values iterable.
135
- *
136
- * @param indexedCallback
137
- * Callback to transform input value to output value.
138
- *
139
- * @returns
140
- * Output values iterable.
141
- */
142
- declare function mapIterable<TInput, TOutput>(values: Iterable<TInput>, indexedCallback: IndexedCallback<TInput, TOutput>): Iterable<TOutput>;
143
-
144
- /**
145
- * Transformer primitive type.
146
- */
147
- type TransformerPrimitive = string | number | bigint | boolean;
148
- /**
149
- * Transformer input type, one of:
150
- *
151
- * - TInput (primitive type)
152
- * - Iterable\<TInput\>
153
- *
154
- * @template TInput
155
- * Transformer input primitive type.
156
- */
157
- type TransformerInput<TInput extends TransformerPrimitive> = TInput | Iterable<TInput>;
158
- /**
159
- * Transformer output, based on transformer input:
160
- *
161
- * - If type TTransformerInput is primitive, result is type TOutput.
162
- * - If type TTransformerInput is Iterable, result is type Iterable\<TOutput\>.
163
- *
164
- * @template TTransformerInput
165
- * Transformer input type.
166
- *
167
- * @template TOutput
168
- * Output base type.
169
- */
170
- type TransformerOutput<TTransformerInput extends TransformerInput<TransformerPrimitive>, TOutput> = TTransformerInput extends (TTransformerInput extends TransformerInput<infer TInput> ? TInput : never) ? TOutput : Iterable<TOutput>;
171
- /**
172
- * Transformer that transforms values in a numeric domain to values in a range equal to the domain or to another range
173
- * defined by a callback function. In other words, the domain determines valid input values and, without a callback, the
174
- * range of valid output values.
175
- *
176
- * The concept is similar to {@link https://en.wikipedia.org/wiki/Format-preserving_encryption | format-preserving
177
- * encryption}, where input values within a specified domain (e.g., {@link
178
- * https://en.wikipedia.org/wiki/Payment_card_number | payment card numbers} ranging from 8-19 digits) are transformed
179
- * into values in the same domain, typically for storage in a database where the data type and length are already fixed
180
- * and exfiltration of the data can have significant repercussions.
181
- *
182
- * Two subclasses are supported directly by this class: {@linkcode IdentityTransformer} (which operates based on a
183
- * domain only) and {@linkcode EncryptionTransformer} (which operates based on a domain and a tweak). If an application
184
- * is expected to make repeated use of a transformer with the same domain and (optional) tweak and can't manage the
185
- * transformer object, an in-memory cache is available via the {@linkcode get | get()} method. Properties in {@linkcode
186
- * IdentityTransformer} and {@linkcode EncryptionTransformer} are read-only once constructed, so there is no issue with
187
- * their shared use.
188
- */
189
- declare abstract class Transformer {
190
- #private;
191
- /**
192
- * Constructor.
193
- *
194
- * @param domain
195
- * Domain.
196
- */
197
- constructor(domain: number | bigint);
198
- /**
199
- * Get a transformer, constructing it if necessary. The type returned is {@linkcode IdentityTransformer} if tweak is
200
- * undefined, {@linkcode EncryptionTransformer} if tweak is defined. Note that although an {@linkcode
201
- * EncryptionTransformer} with a zero tweak operates as an {@linkcode IdentityTransformer}, {@linkcode
202
- * EncryptionTransformer} is still the type returned if a zero tweak is explicitly specified.
203
- *
204
- * @param domain
205
- * Domain.
206
- *
207
- * @param tweak
208
- * Tweak.
209
- *
210
- * @returns
211
- * {@linkcode IdentityTransformer} if tweak is undefined, {@linkcode EncryptionTransformer} if tweak is defined.
212
- */
213
- static get(domain: number | bigint, tweak?: number | bigint): Transformer;
214
- /**
215
- * Get the domain.
216
- */
217
- get domain(): bigint;
218
- /**
219
- * Do the work of transforming a value forward.
220
- *
221
- * @param value
222
- * Value.
223
- *
224
- * @returns
225
- * Transformed value.
226
- */
227
- protected abstract doForward(value: bigint): bigint;
228
- /**
229
- * Transform value(s) forward.
230
- *
231
- * @template TTransformerInput
232
- * Value(s) input type.
233
- *
234
- * @param valueOrValues
235
- * Value(s). If this is an instance of {@linkcode Sequence}, the minimum and maximum values are validated prior to
236
- * transformation. Otherwise, the individual value(s) is/are validated at the time of transformation.
237
- *
238
- * @returns
239
- * Transformed value(s).
240
- */
241
- forward<TTransformerInput extends TransformerInput<number | bigint>>(valueOrValues: TTransformerInput): TransformerOutput<TTransformerInput, bigint>;
242
- /**
243
- * Transform value(s) forward, optionally applying a transformation.
244
- *
245
- * @template TTransformerInput
246
- * Value(s) input type.
247
- *
248
- * @template TOutput
249
- * Transformation callback output type.
250
- *
251
- * @param valueOrValues
252
- * Value(s). If this is an instance of {@linkcode Sequence}, the minimum and maximum values are validated prior to
253
- * transformation. Otherwise, the individual value(s) is/are validated at the time of transformation.
254
- *
255
- * @param transformerCallback
256
- * Called after each value is transformed to convert it to its final value.
257
- *
258
- * @returns
259
- * Transformed value(s).
260
- */
261
- forward<TTransformerInput extends TransformerInput<number | bigint>, TOutput>(valueOrValues: TTransformerInput, transformerCallback: IndexedCallback<bigint, TOutput>): TransformerOutput<TTransformerInput, TOutput>;
262
- /**
263
- * Do the work of transforming a value in reverse.
264
- *
265
- * @param transformedValue
266
- * Transformed value.
267
- *
268
- * @returns
269
- * Value.
270
- */
271
- protected abstract doReverse(transformedValue: bigint): bigint;
272
- /**
273
- * Transform a value in reverse.
274
- *
275
- * @param transformedValue
276
- * Transformed value.
277
- *
278
- * @returns
279
- * Value.
280
- */
281
- reverse(transformedValue: number | bigint): bigint;
282
- }
283
- /**
284
- * Identity transformer. Values are transformed to themselves.
285
- */
286
- declare class IdentityTransformer extends Transformer {
287
- /**
288
- * @inheritDoc
289
- */
290
- protected doForward(value: bigint): bigint;
291
- /**
292
- * @inheritDoc
293
- */
294
- protected doReverse(transformedValue: bigint): bigint;
295
- }
296
- /**
297
- * Encryption transformer. Values are transformed using repeated shuffle and xor operations, similar to those found in
298
- * many cryptography algorithms, particularly AES. While sufficient for obfuscation of numeric sequences (e.g., serial
299
- * number generation, below), if true format-preserving encryption is required, a more robust algorithm such as {@link
300
- * https://doi.org/10.6028/NIST.SP.800-38Gr1.2pd | FF1} is recommended. Furthermore, no work has been done to mitigate
301
- * {@link https://timing.attacks.cr.yp.to/index.html | timing attacks} for key detection.
302
- *
303
- * The purpose of the encryption transformer is to generate pseudo-random values in a deterministic manner to obscure
304
- * the sequence of values generated over time. A typical example is for serial number generation, where knowledge of the
305
- * sequence can infer production volumes (e.g., serial number 1000 implies that at least 1,000 units have been
306
- * manufactured) or can be used in counterfeiting (e.g., a counterfeiter can generate serial numbers 1001, 1002, ...
307
- * with reasonable confidence that they would be valid if queried).
308
- *
309
- * The domain and the tweak together determine the encryption key, which in turn determines the number of rounds of
310
- * shuffle and xor operations. The minimum number of rounds is 4, except where the domain is less than or equal to 256,
311
- * which results in single-byte operations. To ensure that the operations are effective for single-byte domains, the
312
- * number of rounds is 1 and only the xor operation is applied (shuffling a single byte is an identity operation).
313
- *
314
- * Another exception is when there is a tweak value of 0; this results in identity operations where the output value is
315
- * identical to the input value, as no shuffle or xor takes place.
316
- */
317
- declare class EncryptionTransformer extends Transformer {
318
- #private;
319
- /**
320
- * Constructor.
321
- *
322
- * @param domain
323
- * Domain.
324
- *
325
- * @param tweak
326
- * Tweak.
327
- */
328
- constructor(domain: number | bigint, tweak: number | bigint);
329
- /**
330
- * @inheritDoc
331
- */
332
- protected doForward(value: bigint): bigint;
333
- /**
334
- * @inheritDoc
335
- */
336
- protected doReverse(transformedValue: bigint): bigint;
337
- }
338
-
339
- /**
340
- * String validation interface. To ensure signature compatibility in implementing classes, string validation is
341
- * controlled by validation interfaces specific to each validator type.
342
- */
343
- interface StringValidation {
344
- }
345
- /**
346
- * String validator interface.
347
- *
348
- * @template TStringValidation
349
- * String validation type.
350
- */
351
- interface StringValidator<TStringValidation extends StringValidation = StringValidation> {
352
- /**
353
- * Validate a string and throw an error if validation fails.
354
- *
355
- * @param s
356
- * String.
357
- *
358
- * @param validation
359
- * String validation parameters.
360
- */
361
- validate: (s: string, validation?: TStringValidation) => void;
362
- }
363
-
364
- /**
365
- * Regular expression validator. The regular expression applies to the full string only if constructed as such. For
366
- * example, <code>&#x2F;\d&#x2A;&#x2F;</code> (0 or more digits) matches every string, <code>&#x2F;\d+&#x2F;</code> (1
367
- * or more digits) matches strings with at least one digit, <code>&#x2F;^\d&#x2A;$&#x2F;</code> matches strings that are
368
- * all digits or empty, and <code>&#x2F;^\d+$&#x2F;</code> matches strings that are all digits and not empty.
369
- *
370
- * Clients of this class are recommended to override the {@linkcode createErrorMessage | createErrorMessage()} method
371
- * to create a more suitable error message for their use case.
372
- */
373
- declare class RegExpValidator implements StringValidator {
374
- #private;
375
- /**
376
- * Constructor.
377
- *
378
- * @param regExp
379
- * Regular expression. See {@link RegExpValidator | class documentation} for notes.
380
- */
381
- constructor(regExp: RegExp);
382
- /**
383
- * Get the regular expression.
384
- */
385
- get regExp(): RegExp;
386
- /**
387
- * Create an error message for a string. The generic error message is sufficient for many use cases but a more
388
- * domain-specific error message, possibly including the pattern itself, is often required.
389
- *
390
- * @param s
391
- * String.
392
- *
393
- * @returns
394
- * Error message.
395
- */
396
- protected createErrorMessage(s: string): string;
397
- /**
398
- * @inheritDoc
399
- */
400
- validate(s: string): void;
401
- }
402
-
403
- /**
404
- * Record validator. Validation is performed against a record with a string key type and throws an error if the key is
405
- * not found.
406
- *
407
- * @template T
408
- * Property type.
409
- */
410
- declare class RecordValidator<T> implements StringValidator {
411
- #private;
412
- /**
413
- * Constructor.
414
- *
415
- * @param typeName
416
- * Type name for error message.
417
- *
418
- * @param record
419
- * Record in which to look up keys.
420
- */
421
- constructor(typeName: string, record: Readonly<Record<string, T>>);
422
- /**
423
- * Get the type name.
424
- */
425
- get typeName(): string;
426
- /**
427
- * Get the record.
428
- */
429
- get record(): Readonly<Record<string, T>>;
430
- /**
431
- * Validate a key by looking it up in the record.
432
- *
433
- * @param key
434
- * Record key.
435
- */
436
- validate(key: string): void;
437
- }
438
-
439
- /**
440
- * Exclusion options for validating and creating strings based on character sets.
441
- */
442
- declare const Exclusions: {
443
- /**
444
- * No strings excluded.
445
- */
446
- readonly None: 0;
447
- /**
448
- * Strings that start with zero ('0') excluded.
449
- */
450
- readonly FirstZero: 1;
451
- /**
452
- * Strings that are all-numeric (e.g., "123456") excluded.
453
- */
454
- readonly AllNumeric: 2;
455
- };
456
- /**
457
- * Exclusion key.
458
- */
459
- type ExclusionKey = keyof typeof Exclusions;
460
- /**
461
- * Exclusion.
462
- */
463
- type Exclusion = typeof Exclusions[ExclusionKey];
464
-
465
- /**
466
- * Character set validation parameters.
467
- */
468
- interface CharacterSetValidation extends StringValidation {
469
- /**
470
- * Minimum length. If defined and the string is less than this length, an error is thrown.
471
- */
472
- minimumLength?: number | undefined;
473
- /**
474
- * Maximum length. If defined and the string is greater than this length, an error is thrown.
475
- */
476
- maximumLength?: number | undefined;
477
- /**
478
- * Exclusion from the string. If defined and the string is within the exclusion range, an error is thrown.
479
- */
480
- exclusion?: Exclusion | undefined;
481
- /**
482
- * Position offset within a larger string. Strings are sometimes composed of multiple substrings; this parameter
483
- * ensures that the error notes the proper position in the string.
484
- */
485
- positionOffset?: number | undefined;
486
- /**
487
- * Name of component, typically but not exclusively within a larger string. This parameter ensure that the
488
- * error notes the component that triggered it. Value may be a string or a callback that returns a string, the
489
- * latter allowing for localization changes.
490
- */
491
- component?: string | (() => string) | undefined;
492
- }
493
- /**
494
- * Character set validator. Validates a string against a specified character set.
495
- */
496
- declare class CharacterSetValidator implements StringValidator<CharacterSetValidation> {
497
- #private;
498
- /**
499
- * Constructor.
500
- *
501
- * @param characterSet
502
- * Character set. Each element is a single-character string, unique within the array, that defines the character
503
- * set.
504
- *
505
- * @param exclusionSupport
506
- * Exclusions supported by the character set. All character sets implicitly support {@linkcode Exclusions.None}.
507
- */
508
- constructor(characterSet: readonly string[], ...exclusionSupport: readonly Exclusion[]);
509
- /**
510
- * Get the character set.
511
- */
512
- get characterSet(): readonly string[];
513
- /**
514
- * Get the character set size.
515
- */
516
- get characterSetSize(): number;
517
- /**
518
- * Get the exclusions supported by the character set.
519
- */
520
- get exclusionSupport(): readonly Exclusion[];
521
- /**
522
- * Get the character at an index.
523
- *
524
- * @param index
525
- * Index into the character set.
526
- *
527
- * @returns
528
- * Character at the index.
529
- */
530
- character(index: number): string;
531
- /**
532
- * Get the index for a character.
533
- *
534
- * @param c
535
- * Character.
536
- *
537
- * @returns
538
- * Index for the character or undefined if the character is not in the character set.
539
- */
540
- characterIndex(c: string): number | undefined;
541
- /**
542
- * Get the indexes for all characters in a string.
543
- *
544
- * @param s
545
- * String.
546
- *
547
- * @returns
548
- * Array of indexes for each character or undefined if the character is not in the character set.
549
- */
550
- characterIndexes(s: string): ReadonlyArray<number | undefined>;
551
- /**
552
- * Validate that an exclusion is supported. If not, an error is thrown.
553
- *
554
- * @param exclusion
555
- * Exclusion.
556
- */
557
- protected validateExclusion(exclusion: Exclusion): void;
558
- /**
559
- * Validate a string. If the string violates the character set or any of the character set validation parameters, an
560
- * error is thrown.
561
- *
562
- * @param s
563
- * String.
564
- *
565
- * @param validation
566
- * Character set validation parameters.
567
- */
568
- validate(s: string, validation?: CharacterSetValidation): void;
569
- }
570
- /**
571
- * Character set creator. Maps numeric values to strings using the character set as digits.
572
- */
573
- declare class CharacterSetCreator extends CharacterSetValidator {
574
- #private;
575
- /**
576
- * Maximum string length supported.
577
- */
578
- static readonly MAXIMUM_STRING_LENGTH = 40;
579
- /**
580
- * Get a power of 10.
581
- *
582
- * @param power
583
- * Power.
584
- *
585
- * @returns
586
- * `10**power`.
587
- */
588
- static powerOf10(power: number): bigint;
589
- /**
590
- * Constructor.
591
- *
592
- * @param characterSet
593
- * Character set. Each element is a single-character string, unique within the array, that defines the character
594
- * set.
595
- *
596
- * @param exclusionSupport
597
- * Exclusions supported by the character set. All character sets implicitly support {@linkcode Exclusions.None}.
598
- */
599
- constructor(characterSet: readonly string[], ...exclusionSupport: readonly Exclusion[]);
600
- /**
601
- * Create string(s) by mapping value(s) to the equivalent characters in the character set across the length of the
602
- * string.
603
- *
604
- * @template TTransformerInput
605
- * Transformer input type.
606
- *
607
- * @param length
608
- * Required string length.
609
- *
610
- * @param valueOrValues
611
- * Numeric value(s) of the string(s).
612
- *
613
- * @param exclusion
614
- * String(s) to be excluded from the range of outputs. See {@linkcode Exclusions} for possible values and their
615
- * meaning.
616
- *
617
- * @param tweak
618
- * If provided, the numerical value of the string(s) is/are "tweaked" using an {@link EncryptionTransformer |
619
- * encryption transformer}.
620
- *
621
- * @param creatorCallback
622
- * If provided, called after each string is constructed to create the final value.
623
- *
624
- * @returns
625
- * String(s) created from the value(s).
626
- */
627
- create<TTransformerInput extends TransformerInput<number | bigint>>(length: number, valueOrValues: TTransformerInput, exclusion?: Exclusion, tweak?: number | bigint, creatorCallback?: IndexedCallback<string, string>): TransformerOutput<TTransformerInput, string>;
628
- /**
629
- * Determine the value for a string.
630
- *
631
- * @param s
632
- * String.
633
- *
634
- * @param exclusion
635
- * Strings excluded from the range of inputs. See {@linkcode Exclusions} for possible values and their meaning.
636
- *
637
- * @param tweak
638
- * If provided, the numerical value of the string was "tweaked" using an {@link EncryptionTransformer | encryption
639
- * transformer}.
640
- *
641
- * @returns
642
- * Numeric value of the string.
643
- */
644
- valueFor(s: string, exclusion?: Exclusion, tweak?: number | bigint): bigint;
645
- }
646
- /**
647
- * Numeric creator. Character set is 0-9. Supports {@linkcode Exclusions.FirstZero}.
648
- */
649
- declare const NUMERIC_CREATOR: CharacterSetCreator;
650
- /**
651
- * Numeric validator. Character set is 0-9. Supports {@linkcode Exclusions.FirstZero}.
652
- */
653
- declare const NUMERIC_VALIDATOR: CharacterSetValidator;
654
- /**
655
- * Hexadecimal creator. Character set is 0-9, A-F. Supports {@linkcode Exclusions.FirstZero} and {@linkcode
656
- * Exclusions.AllNumeric}.
657
- */
658
- declare const HEXADECIMAL_CREATOR: CharacterSetCreator;
659
- /**
660
- * Hexadecimal validator. Character set is 0-9, A-F. Supports {@linkcode Exclusions.FirstZero} and {@linkcode
661
- * Exclusions.AllNumeric}.
662
- */
663
- declare const HEXADECIMAL_VALIDATOR: CharacterSetValidator;
664
- /**
665
- * Alphabetic creator. Character set is A-Z.
666
- */
667
- declare const ALPHABETIC_CREATOR: CharacterSetCreator;
668
- /**
669
- * Alphabetic validator. Character set is A-Z.
670
- */
671
- declare const ALPHABETIC_VALIDATOR: CharacterSetValidator;
672
- /**
673
- * Alphanumeric creator. Character set is 0-9, A-Z. Supports {@linkcode Exclusions.FirstZero} and {@linkcode
674
- * Exclusions.AllNumeric}.
675
- */
676
- declare const ALPHANUMERIC_CREATOR: CharacterSetCreator;
677
- /**
678
- * Alphanumeric validator. Character set is 0-9, A-Z. Supports {@linkcode Exclusions.FirstZero} and {@linkcode
679
- * Exclusions.AllNumeric}.
680
- */
681
- declare const ALPHANUMERIC_VALIDATOR: CharacterSetValidator;
682
-
683
- export { ALPHABETIC_CREATOR, ALPHABETIC_VALIDATOR, ALPHANUMERIC_CREATOR, ALPHANUMERIC_VALIDATOR, CharacterSetCreator, type CharacterSetValidation, CharacterSetValidator, EncryptionTransformer, type Exclusion, type ExclusionKey, Exclusions, HEXADECIMAL_CREATOR, HEXADECIMAL_VALIDATOR, IdentityTransformer, type IndexedCallback, NUMERIC_CREATOR, NUMERIC_VALIDATOR, RecordValidator, RegExpValidator, Sequence, type StringValidation, type StringValidator, Transformer, type TransformerInput, type TransformerOutput, type TransformerPrimitive, type UtilityLocaleResources, i18nUtilityInit, i18nextUtility, mapIterable, utilityNS, utilityResourceBundle };
1
+ /*!
2
+ * Copyright © 2024-2026 Dolphin Data Development Ltd. and AIDC Toolkit
3
+ * contributors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * https://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export * from "./locale/i18n.js";
18
+ export * from "./sequence.js";
19
+ export * from "./iterable-utility.js";
20
+ export * from "./transformer.js";
21
+ export type * from "./string.js";
22
+ export * from "./reg-exp.js";
23
+ export * from "./record.js";
24
+ export * from "./exclusion.js";
25
+ export * from "./character-set.js";
26
+ //# sourceMappingURL=index.d.ts.map