@aidc-toolkit/utility 0.9.20-beta → 0.9.21-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.
- package/dist/character-set.d.ts +16 -32
- package/dist/character-set.d.ts.map +1 -1
- package/dist/character-set.js +36 -53
- package/dist/character-set.js.map +1 -1
- package/dist/exclusion.d.ts +22 -0
- package/dist/exclusion.d.ts.map +1 -0
- package/dist/exclusion.js +18 -0
- package/dist/exclusion.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -4
- package/src/character-set.ts +36 -55
- package/src/exclusion.ts +24 -0
- package/src/index.ts +1 -0
- package/test/character-set.test.ts +33 -31
- package/test/record.test.ts +21 -22
- package/test/reg-exp.test.ts +1 -4
- package/test/sequence.test.ts +1 -4
- package/test/setup.ts +4 -0
- package/test/transformer.test.ts +1 -4
- package/utility.iml +4 -1
- package/vitest.config.ts +7 -0
package/dist/character-set.d.ts
CHANGED
|
@@ -1,23 +1,7 @@
|
|
|
1
|
+
import { type Exclusion } from "./exclusion.js";
|
|
1
2
|
import type { IndexedCallback } from "./iterable-utility.js";
|
|
2
3
|
import type { StringValidation, StringValidator } from "./string.js";
|
|
3
4
|
import { type TransformerInput, type TransformerOutput } from "./transformer.js";
|
|
4
|
-
/**
|
|
5
|
-
* Exclusion options for validating and creating strings based on character sets.
|
|
6
|
-
*/
|
|
7
|
-
export declare enum Exclusion {
|
|
8
|
-
/**
|
|
9
|
-
* No strings excluded.
|
|
10
|
-
*/
|
|
11
|
-
None = 0,
|
|
12
|
-
/**
|
|
13
|
-
* Strings that start with zero ('0') excluded.
|
|
14
|
-
*/
|
|
15
|
-
FirstZero = 1,
|
|
16
|
-
/**
|
|
17
|
-
* Strings that are all-numeric (e.g., "123456") excluded.
|
|
18
|
-
*/
|
|
19
|
-
AllNumeric = 2
|
|
20
|
-
}
|
|
21
5
|
/**
|
|
22
6
|
* Character set validation parameters.
|
|
23
7
|
*/
|
|
@@ -72,7 +56,7 @@ export declare class CharacterSetValidator implements StringValidator<CharacterS
|
|
|
72
56
|
* set.
|
|
73
57
|
*
|
|
74
58
|
* @param exclusionSupport
|
|
75
|
-
* Exclusions supported by the character set. All character sets implicitly support {@link
|
|
59
|
+
* Exclusions supported by the character set. All character sets implicitly support {@link Exclusions.None}.
|
|
76
60
|
*/
|
|
77
61
|
constructor(characterSet: readonly string[], ...exclusionSupport: readonly Exclusion[]);
|
|
78
62
|
/**
|
|
@@ -188,7 +172,7 @@ export declare class CharacterSetCreator extends CharacterSetValidator {
|
|
|
188
172
|
*/
|
|
189
173
|
private readonly _characterSetSizeMinusOneN;
|
|
190
174
|
/**
|
|
191
|
-
* Domains for every length for every supported {@link
|
|
175
|
+
* Domains for every length for every supported {@link Exclusions}.
|
|
192
176
|
*/
|
|
193
177
|
private readonly _exclusionDomains;
|
|
194
178
|
/**
|
|
@@ -203,7 +187,7 @@ export declare class CharacterSetCreator extends CharacterSetValidator {
|
|
|
203
187
|
* set.
|
|
204
188
|
*
|
|
205
189
|
* @param exclusionSupport
|
|
206
|
-
* Exclusions supported by the character set. All character sets implicitly support {@link
|
|
190
|
+
* Exclusions supported by the character set. All character sets implicitly support {@link Exclusions.None}.
|
|
207
191
|
*/
|
|
208
192
|
constructor(characterSet: readonly string[], ...exclusionSupport: readonly Exclusion[]);
|
|
209
193
|
/**
|
|
@@ -253,7 +237,7 @@ export declare class CharacterSetCreator extends CharacterSetValidator {
|
|
|
253
237
|
* Numeric value(s) of the string(s).
|
|
254
238
|
*
|
|
255
239
|
* @param exclusion
|
|
256
|
-
* String(s) to be excluded from the range of outputs. See {@link
|
|
240
|
+
* String(s) to be excluded from the range of outputs. See {@link Exclusions} for possible values and their meaning.
|
|
257
241
|
*
|
|
258
242
|
* @param tweak
|
|
259
243
|
* If provided, the numerical value of the string(s) is/are "tweaked" using an {@link EncryptionTransformer |
|
|
@@ -273,7 +257,7 @@ export declare class CharacterSetCreator extends CharacterSetValidator {
|
|
|
273
257
|
* String.
|
|
274
258
|
*
|
|
275
259
|
* @param exclusion
|
|
276
|
-
* Strings excluded from the range of inputs. See {@link
|
|
260
|
+
* Strings excluded from the range of inputs. See {@link Exclusions} for possible values and their meaning.
|
|
277
261
|
*
|
|
278
262
|
* @param tweak
|
|
279
263
|
* If provided, the numerical value of the string was "tweaked" using an {@link EncryptionTransformer | encryption
|
|
@@ -285,21 +269,21 @@ export declare class CharacterSetCreator extends CharacterSetValidator {
|
|
|
285
269
|
valueFor(s: string, exclusion?: Exclusion, tweak?: number | bigint): bigint;
|
|
286
270
|
}
|
|
287
271
|
/**
|
|
288
|
-
* Numeric creator. Character set is 0-9. Supports {@link
|
|
272
|
+
* Numeric creator. Character set is 0-9. Supports {@link Exclusions.FirstZero}.
|
|
289
273
|
*/
|
|
290
274
|
export declare const NUMERIC_CREATOR: CharacterSetCreator;
|
|
291
275
|
/**
|
|
292
|
-
* Numeric validator. Character set is 0-9. Supports {@link
|
|
276
|
+
* Numeric validator. Character set is 0-9. Supports {@link Exclusions.FirstZero}.
|
|
293
277
|
*/
|
|
294
278
|
export declare const NUMERIC_VALIDATOR: CharacterSetValidator;
|
|
295
279
|
/**
|
|
296
|
-
* Hexadecimal creator. Character set is 0-9, A-F. Supports {@link
|
|
297
|
-
*
|
|
280
|
+
* Hexadecimal creator. Character set is 0-9, A-F. Supports {@link Exclusions.FirstZero} and {@link
|
|
281
|
+
* Exclusions.AllNumeric}.
|
|
298
282
|
*/
|
|
299
283
|
export declare const HEXADECIMAL_CREATOR: CharacterSetCreator;
|
|
300
284
|
/**
|
|
301
|
-
* Hexadecimal validator. Character set is 0-9, A-F. Supports {@link
|
|
302
|
-
*
|
|
285
|
+
* Hexadecimal validator. Character set is 0-9, A-F. Supports {@link Exclusions.FirstZero} and {@link
|
|
286
|
+
* Exclusions.AllNumeric}.
|
|
303
287
|
*/
|
|
304
288
|
export declare const HEXADECIMAL_VALIDATOR: CharacterSetValidator;
|
|
305
289
|
/**
|
|
@@ -311,13 +295,13 @@ export declare const ALPHABETIC_CREATOR: CharacterSetCreator;
|
|
|
311
295
|
*/
|
|
312
296
|
export declare const ALPHABETIC_VALIDATOR: CharacterSetValidator;
|
|
313
297
|
/**
|
|
314
|
-
* Alphanumeric creator. Character set is 0-9, A-Z. Supports {@link
|
|
315
|
-
*
|
|
298
|
+
* Alphanumeric creator. Character set is 0-9, A-Z. Supports {@link Exclusions.FirstZero} and {@link
|
|
299
|
+
* Exclusions.AllNumeric}.
|
|
316
300
|
*/
|
|
317
301
|
export declare const ALPHANUMERIC_CREATOR: CharacterSetCreator;
|
|
318
302
|
/**
|
|
319
|
-
* Alphanumeric validator. Character set is 0-9, A-Z. Supports {@link
|
|
320
|
-
*
|
|
303
|
+
* Alphanumeric validator. Character set is 0-9, A-Z. Supports {@link Exclusions.FirstZero} and {@link
|
|
304
|
+
* Exclusions.AllNumeric}.
|
|
321
305
|
*/
|
|
322
306
|
export declare const ALPHANUMERIC_VALIDATOR: CharacterSetValidator;
|
|
323
307
|
//# sourceMappingURL=character-set.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"character-set.d.ts","sourceRoot":"","sources":["../src/character-set.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAe,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE9F;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"character-set.d.ts","sourceRoot":"","sources":["../src/character-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAc,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,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iBAAiB,SAAS,gBAAgB,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,iBAAiB,EAAE,SAAS,GAAE,SAA2B,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,eAAe,CAAC,EAAE,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,iBAAiB,CAAC,iBAAiB,EAAE,MAAM,CAAC;IAuCvR;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,GAAE,SAA2B,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;CA+C/F;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,qBAEJ,CAAC;AAEzB;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAsB,qBAAqB,CAAC;AAE1E;;;GAGG;AACH,eAAO,MAAM,mBAAmB,qBAGe,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAA0B,qBAAqB,CAAC;AAElF;;GAEG;AACH,eAAO,MAAM,kBAAkB,qBAG7B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAyB,qBAAqB,CAAC;AAEhF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,qBAIc,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAA2B,qBAAqB,CAAC"}
|
package/dist/character-set.js
CHANGED
|
@@ -1,24 +1,7 @@
|
|
|
1
|
+
import { Exclusions } from "./exclusion.js";
|
|
1
2
|
import { i18nextUtility } from "./locale/i18n.js";
|
|
2
3
|
import { RegExpValidator } from "./reg-exp.js";
|
|
3
4
|
import { Transformer } from "./transformer.js";
|
|
4
|
-
/**
|
|
5
|
-
* Exclusion options for validating and creating strings based on character sets.
|
|
6
|
-
*/
|
|
7
|
-
export var Exclusion;
|
|
8
|
-
(function (Exclusion) {
|
|
9
|
-
/**
|
|
10
|
-
* No strings excluded.
|
|
11
|
-
*/
|
|
12
|
-
Exclusion[Exclusion["None"] = 0] = "None";
|
|
13
|
-
/**
|
|
14
|
-
* Strings that start with zero ('0') excluded.
|
|
15
|
-
*/
|
|
16
|
-
Exclusion[Exclusion["FirstZero"] = 1] = "FirstZero";
|
|
17
|
-
/**
|
|
18
|
-
* Strings that are all-numeric (e.g., "123456") excluded.
|
|
19
|
-
*/
|
|
20
|
-
Exclusion[Exclusion["AllNumeric"] = 2] = "AllNumeric";
|
|
21
|
-
})(Exclusion || (Exclusion = {}));
|
|
22
5
|
/**
|
|
23
6
|
* Character set validator. Validates a string against a specified character set.
|
|
24
7
|
*/
|
|
@@ -58,7 +41,7 @@ export class CharacterSetValidator {
|
|
|
58
41
|
* set.
|
|
59
42
|
*
|
|
60
43
|
* @param exclusionSupport
|
|
61
|
-
* Exclusions supported by the character set. All character sets implicitly support {@link
|
|
44
|
+
* Exclusions supported by the character set. All character sets implicitly support {@link Exclusions.None}.
|
|
62
45
|
*/
|
|
63
46
|
constructor(characterSet, ...exclusionSupport) {
|
|
64
47
|
this._characterSet = characterSet;
|
|
@@ -143,7 +126,7 @@ export class CharacterSetValidator {
|
|
|
143
126
|
* Exclusion.
|
|
144
127
|
*/
|
|
145
128
|
validateExclusion(exclusion) {
|
|
146
|
-
if (exclusion !==
|
|
129
|
+
if (exclusion !== Exclusions.None && !this._exclusionSupport.includes(exclusion)) {
|
|
147
130
|
throw new RangeError(i18nextUtility.t("CharacterSetValidator.exclusionNotSupported", {
|
|
148
131
|
exclusion
|
|
149
132
|
}));
|
|
@@ -200,9 +183,9 @@ export class CharacterSetValidator {
|
|
|
200
183
|
if (validation?.exclusion !== undefined) {
|
|
201
184
|
this.validateExclusion(validation.exclusion);
|
|
202
185
|
switch (validation.exclusion) {
|
|
203
|
-
case
|
|
186
|
+
case Exclusions.None:
|
|
204
187
|
break;
|
|
205
|
-
case
|
|
188
|
+
case Exclusions.FirstZero:
|
|
206
189
|
if (s.startsWith("0")) {
|
|
207
190
|
throw new RangeError(i18nextUtility.t(validation.component === undefined ? "CharacterSetValidator.invalidCharacterAtPosition" : "CharacterSetValidator.invalidCharacterAtPositionOfComponent", {
|
|
208
191
|
component: CharacterSetValidator.componentToString(validation.component),
|
|
@@ -211,7 +194,7 @@ export class CharacterSetValidator {
|
|
|
211
194
|
}));
|
|
212
195
|
}
|
|
213
196
|
break;
|
|
214
|
-
case
|
|
197
|
+
case Exclusions.AllNumeric:
|
|
215
198
|
CharacterSetValidator.NOT_ALL_NUMERIC_VALIDATOR.validate(s);
|
|
216
199
|
break;
|
|
217
200
|
}
|
|
@@ -268,7 +251,7 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
268
251
|
*/
|
|
269
252
|
_characterSetSizeMinusOneN;
|
|
270
253
|
/**
|
|
271
|
-
* Domains for every length for every supported {@link
|
|
254
|
+
* Domains for every length for every supported {@link Exclusions}.
|
|
272
255
|
*/
|
|
273
256
|
_exclusionDomains;
|
|
274
257
|
/**
|
|
@@ -283,7 +266,7 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
283
266
|
* set.
|
|
284
267
|
*
|
|
285
268
|
* @param exclusionSupport
|
|
286
|
-
* Exclusions supported by the character set. All character sets implicitly support {@link
|
|
269
|
+
* Exclusions supported by the character set. All character sets implicitly support {@link Exclusions.None}.
|
|
287
270
|
*/
|
|
288
271
|
constructor(characterSet, ...exclusionSupport) {
|
|
289
272
|
super(characterSet, ...exclusionSupport);
|
|
@@ -291,8 +274,8 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
291
274
|
this._characterSetSizeMinusOneN = BigInt(this.characterSetSize - 1);
|
|
292
275
|
const exclusionDomains = [];
|
|
293
276
|
const exclusionNoneDomains = CharacterSetCreator.createPowersOf(this.characterSetSize);
|
|
294
|
-
exclusionDomains[
|
|
295
|
-
if (exclusionSupport.includes(
|
|
277
|
+
exclusionDomains[Exclusions.None] = exclusionNoneDomains;
|
|
278
|
+
if (exclusionSupport.includes(Exclusions.FirstZero)) {
|
|
296
279
|
if (characterSet[0] !== "0") {
|
|
297
280
|
throw new RangeError(i18nextUtility.t("CharacterSetValidator.firstZeroFirstCharacter"));
|
|
298
281
|
}
|
|
@@ -303,9 +286,9 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
303
286
|
// Domain excludes zero as the first character and so works with previous exclusion none domain.
|
|
304
287
|
exclusionFirstZeroDomains[index] = this._characterSetSizeMinusOneN * exclusionNoneDomains[index - 1];
|
|
305
288
|
}
|
|
306
|
-
exclusionDomains[
|
|
289
|
+
exclusionDomains[Exclusions.FirstZero] = exclusionFirstZeroDomains;
|
|
307
290
|
}
|
|
308
|
-
if (exclusionSupport.includes(
|
|
291
|
+
if (exclusionSupport.includes(Exclusions.AllNumeric)) {
|
|
309
292
|
const exclusionAllNumericDomains = new Array(CharacterSetCreator.MAXIMUM_STRING_LENGTH + 1);
|
|
310
293
|
/**
|
|
311
294
|
* Validate that number indexes are defined and sequential.
|
|
@@ -337,7 +320,7 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
337
320
|
allZerosValue = allZerosValue * this._characterSetSizeN + zeroIndex;
|
|
338
321
|
}
|
|
339
322
|
this._allZerosValues = allZerosValues;
|
|
340
|
-
exclusionDomains[
|
|
323
|
+
exclusionDomains[Exclusions.AllNumeric] = exclusionAllNumericDomains;
|
|
341
324
|
}
|
|
342
325
|
else {
|
|
343
326
|
// Empty array obviates need for non-null assertion while still forcing error if indexed due to a bug.
|
|
@@ -355,7 +338,7 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
355
338
|
* `characterSetSize**power`.
|
|
356
339
|
*/
|
|
357
340
|
powerOfSize(power) {
|
|
358
|
-
return this._exclusionDomains[
|
|
341
|
+
return this._exclusionDomains[Exclusions.None][power];
|
|
359
342
|
}
|
|
360
343
|
/**
|
|
361
344
|
* Determine the shift required to skip all all-numeric strings up to the value.
|
|
@@ -434,7 +417,7 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
434
417
|
* Numeric value(s) of the string(s).
|
|
435
418
|
*
|
|
436
419
|
* @param exclusion
|
|
437
|
-
* String(s) to be excluded from the range of outputs. See {@link
|
|
420
|
+
* String(s) to be excluded from the range of outputs. See {@link Exclusions} for possible values and their meaning.
|
|
438
421
|
*
|
|
439
422
|
* @param tweak
|
|
440
423
|
* If provided, the numerical value of the string(s) is/are "tweaked" using an {@link EncryptionTransformer |
|
|
@@ -446,18 +429,18 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
446
429
|
* @returns
|
|
447
430
|
* String(s) created from the value(s).
|
|
448
431
|
*/
|
|
449
|
-
create(length, valueOrValues, exclusion =
|
|
432
|
+
create(length, valueOrValues, exclusion = Exclusions.None, tweak, creatorCallback) {
|
|
450
433
|
this.validateLength(length);
|
|
451
434
|
this.validateExclusion(exclusion);
|
|
452
435
|
// Zero value in ternary else obviates need for non-null assertion.
|
|
453
|
-
const allZerosValue = exclusion ===
|
|
436
|
+
const allZerosValue = exclusion === Exclusions.AllNumeric ? this._allZerosValues[length] : 0n;
|
|
454
437
|
const transformer = Transformer.get(this._exclusionDomains[exclusion][length], tweak);
|
|
455
438
|
return transformer.forward(valueOrValues, (transformedValue, index) => {
|
|
456
439
|
let s = "";
|
|
457
440
|
// Empty string is valid.
|
|
458
441
|
if (length !== 0) {
|
|
459
442
|
let convertValue = transformedValue;
|
|
460
|
-
if (exclusion ===
|
|
443
|
+
if (exclusion === Exclusions.AllNumeric && convertValue >= allZerosValue) {
|
|
461
444
|
// Value to convert is shifted by the number of all-numeric strings that occur at or prior to it.
|
|
462
445
|
convertValue = convertValue + this.allNumericShift(true, length, convertValue - allZerosValue);
|
|
463
446
|
}
|
|
@@ -469,7 +452,7 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
469
452
|
convertValue = nextConvertValue;
|
|
470
453
|
}
|
|
471
454
|
// Zero is first in the character set for those that support excluding first zero.
|
|
472
|
-
s = this.character(exclusion ===
|
|
455
|
+
s = this.character(exclusion === Exclusions.FirstZero ? Number(convertValue % this._characterSetSizeMinusOneN) + 1 : Number(convertValue % this._characterSetSizeN)) + s;
|
|
473
456
|
}
|
|
474
457
|
return creatorCallback === undefined ? s : creatorCallback(s, index);
|
|
475
458
|
});
|
|
@@ -481,7 +464,7 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
481
464
|
* String.
|
|
482
465
|
*
|
|
483
466
|
* @param exclusion
|
|
484
|
-
* Strings excluded from the range of inputs. See {@link
|
|
467
|
+
* Strings excluded from the range of inputs. See {@link Exclusions} for possible values and their meaning.
|
|
485
468
|
*
|
|
486
469
|
* @param tweak
|
|
487
470
|
* If provided, the numerical value of the string was "tweaked" using an {@link EncryptionTransformer | encryption
|
|
@@ -490,7 +473,7 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
490
473
|
* @returns
|
|
491
474
|
* Numeric value of the string.
|
|
492
475
|
*/
|
|
493
|
-
valueFor(s, exclusion =
|
|
476
|
+
valueFor(s, exclusion = Exclusions.None, tweak) {
|
|
494
477
|
const length = s.length;
|
|
495
478
|
this.validateLength(length);
|
|
496
479
|
this.validateExclusion(exclusion);
|
|
@@ -504,7 +487,7 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
504
487
|
}));
|
|
505
488
|
}
|
|
506
489
|
let value;
|
|
507
|
-
if (index === 0 && exclusion ===
|
|
490
|
+
if (index === 0 && exclusion === Exclusions.FirstZero) {
|
|
508
491
|
if (characterIndex === 0) {
|
|
509
492
|
throw new RangeError(i18nextUtility.t("CharacterSetValidator.invalidCharacterAtPosition", {
|
|
510
493
|
c: "0",
|
|
@@ -519,7 +502,7 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
519
502
|
}
|
|
520
503
|
return value;
|
|
521
504
|
}, 0n);
|
|
522
|
-
if (exclusion ===
|
|
505
|
+
if (exclusion === Exclusions.AllNumeric) {
|
|
523
506
|
const allZerosValue = this._allZerosValues[length];
|
|
524
507
|
if (value >= allZerosValue) {
|
|
525
508
|
// Call will ensure that string is not all-numeric.
|
|
@@ -530,26 +513,26 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
530
513
|
}
|
|
531
514
|
}
|
|
532
515
|
/**
|
|
533
|
-
* Numeric creator. Character set is 0-9. Supports {@link
|
|
516
|
+
* Numeric creator. Character set is 0-9. Supports {@link Exclusions.FirstZero}.
|
|
534
517
|
*/
|
|
535
518
|
export const NUMERIC_CREATOR = new CharacterSetCreator([
|
|
536
519
|
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
|
|
537
|
-
],
|
|
520
|
+
], Exclusions.FirstZero);
|
|
538
521
|
/**
|
|
539
|
-
* Numeric validator. Character set is 0-9. Supports {@link
|
|
522
|
+
* Numeric validator. Character set is 0-9. Supports {@link Exclusions.FirstZero}.
|
|
540
523
|
*/
|
|
541
524
|
export const NUMERIC_VALIDATOR = NUMERIC_CREATOR;
|
|
542
525
|
/**
|
|
543
|
-
* Hexadecimal creator. Character set is 0-9, A-F. Supports {@link
|
|
544
|
-
*
|
|
526
|
+
* Hexadecimal creator. Character set is 0-9, A-F. Supports {@link Exclusions.FirstZero} and {@link
|
|
527
|
+
* Exclusions.AllNumeric}.
|
|
545
528
|
*/
|
|
546
529
|
export const HEXADECIMAL_CREATOR = new CharacterSetCreator([
|
|
547
530
|
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
|
|
548
531
|
"A", "B", "C", "D", "E", "F"
|
|
549
|
-
],
|
|
532
|
+
], Exclusions.FirstZero, Exclusions.AllNumeric);
|
|
550
533
|
/**
|
|
551
|
-
* Hexadecimal validator. Character set is 0-9, A-F. Supports {@link
|
|
552
|
-
*
|
|
534
|
+
* Hexadecimal validator. Character set is 0-9, A-F. Supports {@link Exclusions.FirstZero} and {@link
|
|
535
|
+
* Exclusions.AllNumeric}.
|
|
553
536
|
*/
|
|
554
537
|
export const HEXADECIMAL_VALIDATOR = HEXADECIMAL_CREATOR;
|
|
555
538
|
/**
|
|
@@ -564,17 +547,17 @@ export const ALPHABETIC_CREATOR = new CharacterSetCreator([
|
|
|
564
547
|
*/
|
|
565
548
|
export const ALPHABETIC_VALIDATOR = ALPHABETIC_CREATOR;
|
|
566
549
|
/**
|
|
567
|
-
* Alphanumeric creator. Character set is 0-9, A-Z. Supports {@link
|
|
568
|
-
*
|
|
550
|
+
* Alphanumeric creator. Character set is 0-9, A-Z. Supports {@link Exclusions.FirstZero} and {@link
|
|
551
|
+
* Exclusions.AllNumeric}.
|
|
569
552
|
*/
|
|
570
553
|
export const ALPHANUMERIC_CREATOR = new CharacterSetCreator([
|
|
571
554
|
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
|
|
572
555
|
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
|
|
573
556
|
"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"
|
|
574
|
-
],
|
|
557
|
+
], Exclusions.FirstZero, Exclusions.AllNumeric);
|
|
575
558
|
/**
|
|
576
|
-
* Alphanumeric validator. Character set is 0-9, A-Z. Supports {@link
|
|
577
|
-
*
|
|
559
|
+
* Alphanumeric validator. Character set is 0-9, A-Z. Supports {@link Exclusions.FirstZero} and {@link
|
|
560
|
+
* Exclusions.AllNumeric}.
|
|
578
561
|
*/
|
|
579
562
|
export const ALPHANUMERIC_VALIDATOR = ALPHANUMERIC_CREATOR;
|
|
580
563
|
//# sourceMappingURL=character-set.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"character-set.js","sourceRoot":"","sources":["../src/character-set.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAiD,MAAM,kBAAkB,CAAC;AAE9F;;GAEG;AACH,MAAM,CAAN,IAAY,SAeX;AAfD,WAAY,SAAS;IACjB;;OAEG;IACH,yCAAI,CAAA;IAE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
|
|
1
|
+
/**
|
|
2
|
+
* Exclusion options for validating and creating strings based on character sets.
|
|
3
|
+
*/
|
|
4
|
+
export declare const Exclusions: {
|
|
5
|
+
/**
|
|
6
|
+
* No strings excluded.
|
|
7
|
+
*/
|
|
8
|
+
readonly None: 0;
|
|
9
|
+
/**
|
|
10
|
+
* Strings that start with zero ('0') excluded.
|
|
11
|
+
*/
|
|
12
|
+
readonly FirstZero: 1;
|
|
13
|
+
/**
|
|
14
|
+
* Strings that are all-numeric (e.g., "123456") excluded.
|
|
15
|
+
*/
|
|
16
|
+
readonly AllNumeric: 2;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Exclusion.
|
|
20
|
+
*/
|
|
21
|
+
export type Exclusion = typeof Exclusions[keyof typeof Exclusions];
|
|
22
|
+
//# sourceMappingURL=exclusion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exclusion.d.ts","sourceRoot":"","sources":["../src/exclusion.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,UAAU;IACnB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEG,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,UAAU,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exclusion options for validating and creating strings based on character sets.
|
|
3
|
+
*/
|
|
4
|
+
export const Exclusions = {
|
|
5
|
+
/**
|
|
6
|
+
* No strings excluded.
|
|
7
|
+
*/
|
|
8
|
+
None: 0,
|
|
9
|
+
/**
|
|
10
|
+
* Strings that start with zero ('0') excluded.
|
|
11
|
+
*/
|
|
12
|
+
FirstZero: 1,
|
|
13
|
+
/**
|
|
14
|
+
* Strings that are all-numeric (e.g., "123456") excluded.
|
|
15
|
+
*/
|
|
16
|
+
AllNumeric: 2
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=exclusion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exclusion.js","sourceRoot":"","sources":["../src/exclusion.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACtB;;OAEG;IACH,IAAI,EAAE,CAAC;IAEP;;OAEG;IACH,SAAS,EAAE,CAAC;IAEZ;;OAEG;IACH,UAAU,EAAE,CAAC;CACP,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,mBAAmB,aAAa,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,mBAAmB,aAAa,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aidc-toolkit/utility",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.21-beta",
|
|
4
4
|
"description": "Foundational utilities for AIDC Toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,10 +28,9 @@
|
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@aidc-toolkit/dev": "beta",
|
|
31
|
-
"vitest": "^4.0.
|
|
31
|
+
"vitest": "^4.0.14"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@aidc-toolkit/core": "beta"
|
|
35
|
-
"i18next": "^25.6.3"
|
|
34
|
+
"@aidc-toolkit/core": "beta"
|
|
36
35
|
}
|
|
37
36
|
}
|
package/src/character-set.ts
CHANGED
|
@@ -1,29 +1,10 @@
|
|
|
1
|
+
import { type Exclusion, Exclusions } from "./exclusion.js";
|
|
1
2
|
import type { IndexedCallback } from "./iterable-utility.js";
|
|
2
3
|
import { i18nextUtility } from "./locale/i18n.js";
|
|
3
4
|
import { RegExpValidator } from "./reg-exp.js";
|
|
4
5
|
import type { StringValidation, StringValidator } from "./string.js";
|
|
5
6
|
import { Transformer, type TransformerInput, type TransformerOutput } from "./transformer.js";
|
|
6
7
|
|
|
7
|
-
/**
|
|
8
|
-
* Exclusion options for validating and creating strings based on character sets.
|
|
9
|
-
*/
|
|
10
|
-
export enum Exclusion {
|
|
11
|
-
/**
|
|
12
|
-
* No strings excluded.
|
|
13
|
-
*/
|
|
14
|
-
None,
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Strings that start with zero ('0') excluded.
|
|
18
|
-
*/
|
|
19
|
-
FirstZero,
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Strings that are all-numeric (e.g., "123456") excluded.
|
|
23
|
-
*/
|
|
24
|
-
AllNumeric
|
|
25
|
-
}
|
|
26
|
-
|
|
27
8
|
/**
|
|
28
9
|
* Character set validation parameters.
|
|
29
10
|
*/
|
|
@@ -100,7 +81,7 @@ export class CharacterSetValidator implements StringValidator<CharacterSetValida
|
|
|
100
81
|
* set.
|
|
101
82
|
*
|
|
102
83
|
* @param exclusionSupport
|
|
103
|
-
* Exclusions supported by the character set. All character sets implicitly support {@link
|
|
84
|
+
* Exclusions supported by the character set. All character sets implicitly support {@link Exclusions.None}.
|
|
104
85
|
*/
|
|
105
86
|
constructor(characterSet: readonly string[], ...exclusionSupport: readonly Exclusion[]) {
|
|
106
87
|
this._characterSet = characterSet;
|
|
@@ -197,7 +178,7 @@ export class CharacterSetValidator implements StringValidator<CharacterSetValida
|
|
|
197
178
|
* Exclusion.
|
|
198
179
|
*/
|
|
199
180
|
protected validateExclusion(exclusion: Exclusion): void {
|
|
200
|
-
if (exclusion !==
|
|
181
|
+
if (exclusion !== Exclusions.None && !this._exclusionSupport.includes(exclusion)) {
|
|
201
182
|
throw new RangeError(i18nextUtility.t("CharacterSetValidator.exclusionNotSupported", {
|
|
202
183
|
exclusion
|
|
203
184
|
}));
|
|
@@ -263,10 +244,10 @@ export class CharacterSetValidator implements StringValidator<CharacterSetValida
|
|
|
263
244
|
this.validateExclusion(validation.exclusion);
|
|
264
245
|
|
|
265
246
|
switch (validation.exclusion) {
|
|
266
|
-
case
|
|
247
|
+
case Exclusions.None:
|
|
267
248
|
break;
|
|
268
249
|
|
|
269
|
-
case
|
|
250
|
+
case Exclusions.FirstZero:
|
|
270
251
|
if (s.startsWith("0")) {
|
|
271
252
|
throw new RangeError(i18nextUtility.t(validation.component === undefined ? "CharacterSetValidator.invalidCharacterAtPosition" : "CharacterSetValidator.invalidCharacterAtPositionOfComponent", {
|
|
272
253
|
component: CharacterSetValidator.componentToString(validation.component),
|
|
@@ -276,7 +257,7 @@ export class CharacterSetValidator implements StringValidator<CharacterSetValida
|
|
|
276
257
|
}
|
|
277
258
|
break;
|
|
278
259
|
|
|
279
|
-
case
|
|
260
|
+
case Exclusions.AllNumeric:
|
|
280
261
|
CharacterSetValidator.NOT_ALL_NUMERIC_VALIDATOR.validate(s);
|
|
281
262
|
break;
|
|
282
263
|
}
|
|
@@ -343,7 +324,7 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
343
324
|
private readonly _characterSetSizeMinusOneN: bigint;
|
|
344
325
|
|
|
345
326
|
/**
|
|
346
|
-
* Domains for every length for every supported {@link
|
|
327
|
+
* Domains for every length for every supported {@link Exclusions}.
|
|
347
328
|
*/
|
|
348
329
|
private readonly _exclusionDomains: ReadonlyArray<readonly bigint[]>;
|
|
349
330
|
|
|
@@ -360,7 +341,7 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
360
341
|
* set.
|
|
361
342
|
*
|
|
362
343
|
* @param exclusionSupport
|
|
363
|
-
* Exclusions supported by the character set. All character sets implicitly support {@link
|
|
344
|
+
* Exclusions supported by the character set. All character sets implicitly support {@link Exclusions.None}.
|
|
364
345
|
*/
|
|
365
346
|
constructor(characterSet: readonly string[], ...exclusionSupport: readonly Exclusion[]) {
|
|
366
347
|
super(characterSet, ...exclusionSupport);
|
|
@@ -372,9 +353,9 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
372
353
|
|
|
373
354
|
const exclusionNoneDomains = CharacterSetCreator.createPowersOf(this.characterSetSize);
|
|
374
355
|
|
|
375
|
-
exclusionDomains[
|
|
356
|
+
exclusionDomains[Exclusions.None] = exclusionNoneDomains;
|
|
376
357
|
|
|
377
|
-
if (exclusionSupport.includes(
|
|
358
|
+
if (exclusionSupport.includes(Exclusions.FirstZero)) {
|
|
378
359
|
if (characterSet[0] !== "0") {
|
|
379
360
|
throw new RangeError(i18nextUtility.t("CharacterSetValidator.firstZeroFirstCharacter"));
|
|
380
361
|
}
|
|
@@ -389,10 +370,10 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
389
370
|
exclusionFirstZeroDomains[index] = this._characterSetSizeMinusOneN * exclusionNoneDomains[index - 1];
|
|
390
371
|
}
|
|
391
372
|
|
|
392
|
-
exclusionDomains[
|
|
373
|
+
exclusionDomains[Exclusions.FirstZero] = exclusionFirstZeroDomains;
|
|
393
374
|
}
|
|
394
375
|
|
|
395
|
-
if (exclusionSupport.includes(
|
|
376
|
+
if (exclusionSupport.includes(Exclusions.AllNumeric)) {
|
|
396
377
|
const exclusionAllNumericDomains = new Array<bigint>(CharacterSetCreator.MAXIMUM_STRING_LENGTH + 1);
|
|
397
378
|
|
|
398
379
|
/**
|
|
@@ -436,7 +417,7 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
436
417
|
|
|
437
418
|
this._allZerosValues = allZerosValues;
|
|
438
419
|
|
|
439
|
-
exclusionDomains[
|
|
420
|
+
exclusionDomains[Exclusions.AllNumeric] = exclusionAllNumericDomains;
|
|
440
421
|
} else {
|
|
441
422
|
// Empty array obviates need for non-null assertion while still forcing error if indexed due to a bug.
|
|
442
423
|
this._allZerosValues = [];
|
|
@@ -455,7 +436,7 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
455
436
|
* `characterSetSize**power`.
|
|
456
437
|
*/
|
|
457
438
|
private powerOfSize(power: number): bigint {
|
|
458
|
-
return this._exclusionDomains[
|
|
439
|
+
return this._exclusionDomains[Exclusions.None][power];
|
|
459
440
|
}
|
|
460
441
|
|
|
461
442
|
/**
|
|
@@ -542,7 +523,7 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
542
523
|
* Numeric value(s) of the string(s).
|
|
543
524
|
*
|
|
544
525
|
* @param exclusion
|
|
545
|
-
* String(s) to be excluded from the range of outputs. See {@link
|
|
526
|
+
* String(s) to be excluded from the range of outputs. See {@link Exclusions} for possible values and their meaning.
|
|
546
527
|
*
|
|
547
528
|
* @param tweak
|
|
548
529
|
* If provided, the numerical value of the string(s) is/are "tweaked" using an {@link EncryptionTransformer |
|
|
@@ -554,12 +535,12 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
554
535
|
* @returns
|
|
555
536
|
* String(s) created from the value(s).
|
|
556
537
|
*/
|
|
557
|
-
create<TTransformerInput extends TransformerInput<number | bigint>>(length: number, valueOrValues: TTransformerInput, exclusion: Exclusion =
|
|
538
|
+
create<TTransformerInput extends TransformerInput<number | bigint>>(length: number, valueOrValues: TTransformerInput, exclusion: Exclusion = Exclusions.None, tweak?: number | bigint, creatorCallback?: IndexedCallback<string, string>): TransformerOutput<TTransformerInput, string> {
|
|
558
539
|
this.validateLength(length);
|
|
559
540
|
this.validateExclusion(exclusion);
|
|
560
541
|
|
|
561
542
|
// Zero value in ternary else obviates need for non-null assertion.
|
|
562
|
-
const allZerosValue = exclusion ===
|
|
543
|
+
const allZerosValue = exclusion === Exclusions.AllNumeric ? this._allZerosValues[length] : 0n;
|
|
563
544
|
|
|
564
545
|
const transformer = Transformer.get(this._exclusionDomains[exclusion][length], tweak);
|
|
565
546
|
|
|
@@ -570,7 +551,7 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
570
551
|
if (length !== 0) {
|
|
571
552
|
let convertValue = transformedValue;
|
|
572
553
|
|
|
573
|
-
if (exclusion ===
|
|
554
|
+
if (exclusion === Exclusions.AllNumeric && convertValue >= allZerosValue) {
|
|
574
555
|
// Value to convert is shifted by the number of all-numeric strings that occur at or prior to it.
|
|
575
556
|
convertValue = convertValue + this.allNumericShift(true, length, convertValue - allZerosValue);
|
|
576
557
|
}
|
|
@@ -586,7 +567,7 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
586
567
|
}
|
|
587
568
|
|
|
588
569
|
// Zero is first in the character set for those that support excluding first zero.
|
|
589
|
-
s = this.character(exclusion ===
|
|
570
|
+
s = this.character(exclusion === Exclusions.FirstZero ? Number(convertValue % this._characterSetSizeMinusOneN) + 1 : Number(convertValue % this._characterSetSizeN)) + s;
|
|
590
571
|
}
|
|
591
572
|
|
|
592
573
|
return creatorCallback === undefined ? s : creatorCallback(s, index);
|
|
@@ -600,7 +581,7 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
600
581
|
* String.
|
|
601
582
|
*
|
|
602
583
|
* @param exclusion
|
|
603
|
-
* Strings excluded from the range of inputs. See {@link
|
|
584
|
+
* Strings excluded from the range of inputs. See {@link Exclusions} for possible values and their meaning.
|
|
604
585
|
*
|
|
605
586
|
* @param tweak
|
|
606
587
|
* If provided, the numerical value of the string was "tweaked" using an {@link EncryptionTransformer | encryption
|
|
@@ -609,7 +590,7 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
609
590
|
* @returns
|
|
610
591
|
* Numeric value of the string.
|
|
611
592
|
*/
|
|
612
|
-
valueFor(s: string, exclusion: Exclusion =
|
|
593
|
+
valueFor(s: string, exclusion: Exclusion = Exclusions.None, tweak?: number | bigint): bigint {
|
|
613
594
|
const length = s.length;
|
|
614
595
|
|
|
615
596
|
this.validateLength(length);
|
|
@@ -628,7 +609,7 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
628
609
|
|
|
629
610
|
let value: bigint;
|
|
630
611
|
|
|
631
|
-
if (index === 0 && exclusion ===
|
|
612
|
+
if (index === 0 && exclusion === Exclusions.FirstZero) {
|
|
632
613
|
if (characterIndex === 0) {
|
|
633
614
|
throw new RangeError(i18nextUtility.t("CharacterSetValidator.invalidCharacterAtPosition", {
|
|
634
615
|
c: "0",
|
|
@@ -645,7 +626,7 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
645
626
|
return value;
|
|
646
627
|
}, 0n);
|
|
647
628
|
|
|
648
|
-
if (exclusion ===
|
|
629
|
+
if (exclusion === Exclusions.AllNumeric) {
|
|
649
630
|
const allZerosValue = this._allZerosValues[length];
|
|
650
631
|
|
|
651
632
|
if (value >= allZerosValue) {
|
|
@@ -659,29 +640,29 @@ export class CharacterSetCreator extends CharacterSetValidator {
|
|
|
659
640
|
}
|
|
660
641
|
|
|
661
642
|
/**
|
|
662
|
-
* Numeric creator. Character set is 0-9. Supports {@link
|
|
643
|
+
* Numeric creator. Character set is 0-9. Supports {@link Exclusions.FirstZero}.
|
|
663
644
|
*/
|
|
664
645
|
export const NUMERIC_CREATOR = new CharacterSetCreator([
|
|
665
646
|
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
|
|
666
|
-
],
|
|
647
|
+
], Exclusions.FirstZero);
|
|
667
648
|
|
|
668
649
|
/**
|
|
669
|
-
* Numeric validator. Character set is 0-9. Supports {@link
|
|
650
|
+
* Numeric validator. Character set is 0-9. Supports {@link Exclusions.FirstZero}.
|
|
670
651
|
*/
|
|
671
652
|
export const NUMERIC_VALIDATOR = NUMERIC_CREATOR as CharacterSetValidator;
|
|
672
653
|
|
|
673
654
|
/**
|
|
674
|
-
* Hexadecimal creator. Character set is 0-9, A-F. Supports {@link
|
|
675
|
-
*
|
|
655
|
+
* Hexadecimal creator. Character set is 0-9, A-F. Supports {@link Exclusions.FirstZero} and {@link
|
|
656
|
+
* Exclusions.AllNumeric}.
|
|
676
657
|
*/
|
|
677
658
|
export const HEXADECIMAL_CREATOR = new CharacterSetCreator([
|
|
678
659
|
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
|
|
679
660
|
"A", "B", "C", "D", "E", "F"
|
|
680
|
-
],
|
|
661
|
+
], Exclusions.FirstZero, Exclusions.AllNumeric);
|
|
681
662
|
|
|
682
663
|
/**
|
|
683
|
-
* Hexadecimal validator. Character set is 0-9, A-F. Supports {@link
|
|
684
|
-
*
|
|
664
|
+
* Hexadecimal validator. Character set is 0-9, A-F. Supports {@link Exclusions.FirstZero} and {@link
|
|
665
|
+
* Exclusions.AllNumeric}.
|
|
685
666
|
*/
|
|
686
667
|
export const HEXADECIMAL_VALIDATOR = HEXADECIMAL_CREATOR as CharacterSetValidator;
|
|
687
668
|
|
|
@@ -699,17 +680,17 @@ export const ALPHABETIC_CREATOR = new CharacterSetCreator([
|
|
|
699
680
|
export const ALPHABETIC_VALIDATOR = ALPHABETIC_CREATOR as CharacterSetValidator;
|
|
700
681
|
|
|
701
682
|
/**
|
|
702
|
-
* Alphanumeric creator. Character set is 0-9, A-Z. Supports {@link
|
|
703
|
-
*
|
|
683
|
+
* Alphanumeric creator. Character set is 0-9, A-Z. Supports {@link Exclusions.FirstZero} and {@link
|
|
684
|
+
* Exclusions.AllNumeric}.
|
|
704
685
|
*/
|
|
705
686
|
export const ALPHANUMERIC_CREATOR = new CharacterSetCreator([
|
|
706
687
|
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
|
|
707
688
|
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
|
|
708
689
|
"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"
|
|
709
|
-
],
|
|
690
|
+
], Exclusions.FirstZero, Exclusions.AllNumeric);
|
|
710
691
|
|
|
711
692
|
/**
|
|
712
|
-
* Alphanumeric validator. Character set is 0-9, A-Z. Supports {@link
|
|
713
|
-
*
|
|
693
|
+
* Alphanumeric validator. Character set is 0-9, A-Z. Supports {@link Exclusions.FirstZero} and {@link
|
|
694
|
+
* Exclusions.AllNumeric}.
|
|
714
695
|
*/
|
|
715
696
|
export const ALPHANUMERIC_VALIDATOR = ALPHANUMERIC_CREATOR as CharacterSetValidator;
|
package/src/exclusion.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exclusion options for validating and creating strings based on character sets.
|
|
3
|
+
*/
|
|
4
|
+
export const Exclusions = {
|
|
5
|
+
/**
|
|
6
|
+
* No strings excluded.
|
|
7
|
+
*/
|
|
8
|
+
None: 0,
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Strings that start with zero ('0') excluded.
|
|
12
|
+
*/
|
|
13
|
+
FirstZero: 1,
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Strings that are all-numeric (e.g., "123456") excluded.
|
|
17
|
+
*/
|
|
18
|
+
AllNumeric: 2
|
|
19
|
+
} as const;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Exclusion.
|
|
23
|
+
*/
|
|
24
|
+
export type Exclusion = typeof Exclusions[keyof typeof Exclusions];
|
package/src/index.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { I18nEnvironment } from "@aidc-toolkit/core";
|
|
2
1
|
import { describe, expect, test } from "vitest";
|
|
3
2
|
import {
|
|
4
|
-
ALPHABETIC_CREATOR,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
ALPHABETIC_CREATOR,
|
|
4
|
+
ALPHABETIC_VALIDATOR,
|
|
5
|
+
ALPHANUMERIC_CREATOR,
|
|
6
|
+
ALPHANUMERIC_VALIDATOR,
|
|
7
|
+
CharacterSetCreator,
|
|
8
|
+
type CharacterSetValidator,
|
|
9
|
+
type Exclusion,
|
|
10
|
+
Exclusions,
|
|
11
|
+
HEXADECIMAL_CREATOR,
|
|
12
|
+
HEXADECIMAL_VALIDATOR,
|
|
13
|
+
NUMERIC_CREATOR,
|
|
14
|
+
NUMERIC_VALIDATOR,
|
|
11
15
|
Sequence
|
|
12
16
|
} from "../src";
|
|
13
17
|
|
|
14
|
-
await i18nUtilityInit(I18nEnvironment.CLI);
|
|
15
|
-
|
|
16
18
|
// Type is used to ensure that testCharacterSet() is not called with creator twice.
|
|
17
19
|
type ValidatorNotCreator<T extends CharacterSetValidator> = T extends CharacterSetCreator ? never : T;
|
|
18
20
|
|
|
@@ -49,21 +51,21 @@ function testCharacterSet<T extends CharacterSetValidator>(name: string, charact
|
|
|
49
51
|
expect(characterIndex).toBe(index);
|
|
50
52
|
});
|
|
51
53
|
|
|
52
|
-
expect(characterSetCreator.exclusionSupport.includes(
|
|
53
|
-
expect(characterSetCreator.exclusionSupport.includes(
|
|
54
|
+
expect(characterSetCreator.exclusionSupport.includes(Exclusions.FirstZero)).toBe(excludeFirstZero);
|
|
55
|
+
expect(characterSetCreator.exclusionSupport.includes(Exclusions.AllNumeric)).toBe(excludeAllNumeric);
|
|
54
56
|
});
|
|
55
57
|
|
|
56
58
|
function testCreate(exclusion: Exclusion): void {
|
|
57
59
|
let domain: number;
|
|
58
60
|
|
|
59
61
|
switch (exclusion) {
|
|
60
|
-
case
|
|
61
|
-
expect(() => characterSetCreator.create(0, 0,
|
|
62
|
+
case Exclusions.FirstZero:
|
|
63
|
+
expect(() => characterSetCreator.create(0, 0, Exclusions.FirstZero)).toThrow("Domain 0 must be greater than 0");
|
|
62
64
|
domain = (characterSetSize - 1) * characterSetSize ** (length - 1);
|
|
63
65
|
break;
|
|
64
66
|
|
|
65
|
-
case
|
|
66
|
-
expect(() => characterSetCreator.create(0, 0,
|
|
67
|
+
case Exclusions.AllNumeric:
|
|
68
|
+
expect(() => characterSetCreator.create(0, 0, Exclusions.AllNumeric)).toThrow("Domain 0 must be greater than 0");
|
|
67
69
|
domain = characterSetSize ** length - 10 ** length;
|
|
68
70
|
break;
|
|
69
71
|
|
|
@@ -154,7 +156,7 @@ function testCharacterSet<T extends CharacterSetValidator>(name: string, charact
|
|
|
154
156
|
// Test can take a moderate amount of time.
|
|
155
157
|
timeout: 10 * 1000
|
|
156
158
|
}, () => {
|
|
157
|
-
testCreate(
|
|
159
|
+
testCreate(Exclusions.None);
|
|
158
160
|
});
|
|
159
161
|
|
|
160
162
|
if (excludeFirstZero) {
|
|
@@ -162,10 +164,10 @@ function testCharacterSet<T extends CharacterSetValidator>(name: string, charact
|
|
|
162
164
|
// Test can take a moderate amount of time.
|
|
163
165
|
timeout: 10 * 1000
|
|
164
166
|
}, () => {
|
|
165
|
-
testCreate(
|
|
167
|
+
testCreate(Exclusions.FirstZero);
|
|
166
168
|
|
|
167
|
-
expect(() => characterSetCreator.valueFor("0000",
|
|
168
|
-
expect(() => characterSetCreator.valueFor("1000",
|
|
169
|
+
expect(() => characterSetCreator.valueFor("0000", Exclusions.FirstZero)).toThrow("Invalid character '0' at position 1");
|
|
170
|
+
expect(() => characterSetCreator.valueFor("1000", Exclusions.FirstZero)).not.toThrow(RangeError);
|
|
169
171
|
});
|
|
170
172
|
}
|
|
171
173
|
|
|
@@ -174,15 +176,15 @@ function testCharacterSet<T extends CharacterSetValidator>(name: string, charact
|
|
|
174
176
|
// Test can take a moderate amount of time.
|
|
175
177
|
timeout: 10 * 1000
|
|
176
178
|
}, () => {
|
|
177
|
-
testCreate(
|
|
179
|
+
testCreate(Exclusions.AllNumeric);
|
|
178
180
|
|
|
179
181
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- Nine is known to be present in the character set.
|
|
180
182
|
const afterNine = characterSetCreator.character(characterSetCreator.characterIndex("9")! + 1);
|
|
181
183
|
|
|
182
|
-
expect(() => characterSetCreator.valueFor("0000",
|
|
183
|
-
expect(() => characterSetCreator.valueFor(`000${afterNine}`,
|
|
184
|
-
expect(() => characterSetCreator.valueFor("9999",
|
|
185
|
-
expect(() => characterSetCreator.valueFor(`999${afterNine}`,
|
|
184
|
+
expect(() => characterSetCreator.valueFor("0000", Exclusions.AllNumeric)).toThrow("String must not be all numeric");
|
|
185
|
+
expect(() => characterSetCreator.valueFor(`000${afterNine}`, Exclusions.AllNumeric)).not.toThrow(RangeError);
|
|
186
|
+
expect(() => characterSetCreator.valueFor("9999", Exclusions.AllNumeric)).toThrow("String must not be all numeric");
|
|
187
|
+
expect(() => characterSetCreator.valueFor(`999${afterNine}`, Exclusions.AllNumeric)).not.toThrow(RangeError);
|
|
186
188
|
});
|
|
187
189
|
}
|
|
188
190
|
});
|
|
@@ -192,22 +194,22 @@ describe("Exclusion", () => {
|
|
|
192
194
|
test("First zero", () => {
|
|
193
195
|
expect(() => new CharacterSetCreator([
|
|
194
196
|
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
|
|
195
|
-
],
|
|
197
|
+
], Exclusions.FirstZero)).not.toThrow(RangeError);
|
|
196
198
|
expect(() => new CharacterSetCreator([
|
|
197
199
|
"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"
|
|
198
|
-
],
|
|
200
|
+
], Exclusions.FirstZero)).toThrow("Character set must support zero as first character");
|
|
199
201
|
});
|
|
200
202
|
|
|
201
203
|
test("All numeric", () => {
|
|
202
204
|
expect(() => new CharacterSetCreator([
|
|
203
205
|
"!", "#", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D"
|
|
204
|
-
],
|
|
206
|
+
], Exclusions.AllNumeric)).not.toThrow(RangeError);
|
|
205
207
|
expect(() => new CharacterSetCreator([
|
|
206
208
|
"!", "#", "/", "0", "1", "2", "3", "A", "B", "C", "D"
|
|
207
|
-
],
|
|
209
|
+
], Exclusions.AllNumeric)).toThrow("Character set must support all numeric characters in sequence");
|
|
208
210
|
expect(() => new CharacterSetCreator([
|
|
209
211
|
"!", "#", "/", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "A", "B", "C", "D"
|
|
210
|
-
],
|
|
212
|
+
], Exclusions.AllNumeric)).toThrow("Character set must support all numeric characters in sequence");
|
|
211
213
|
});
|
|
212
214
|
});
|
|
213
215
|
|
|
@@ -220,6 +222,6 @@ const middleNumericCreator = new CharacterSetCreator([
|
|
|
220
222
|
"(", ")",
|
|
221
223
|
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
|
|
222
224
|
"<", ">"
|
|
223
|
-
],
|
|
225
|
+
], Exclusions.AllNumeric);
|
|
224
226
|
|
|
225
227
|
testCharacterSet("Middle numeric", middleNumericCreator, middleNumericCreator as CharacterSetValidator, 14, 4, false, true);
|
package/test/record.test.ts
CHANGED
|
@@ -1,41 +1,40 @@
|
|
|
1
|
-
import { I18nEnvironment } from "@aidc-toolkit/core";
|
|
2
1
|
import { describe, expect, test } from "vitest";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
await i18nUtilityInit(I18nEnvironment.CLI);
|
|
2
|
+
import { RecordValidator } from "../src";
|
|
6
3
|
|
|
7
4
|
describe("Record validator", () => {
|
|
8
|
-
|
|
9
|
-
ValueA
|
|
10
|
-
ValueB
|
|
11
|
-
ValueC
|
|
12
|
-
ValueD
|
|
13
|
-
}
|
|
5
|
+
const StringIndexes = {
|
|
6
|
+
ValueA: "A",
|
|
7
|
+
ValueB: "B",
|
|
8
|
+
ValueC: "C",
|
|
9
|
+
ValueD: "D"
|
|
10
|
+
} as const;
|
|
11
|
+
|
|
12
|
+
type StringIndex = typeof StringIndexes[keyof typeof StringIndexes];
|
|
14
13
|
|
|
15
|
-
const
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
14
|
+
const stringRecord: Record<StringIndex, string> = {
|
|
15
|
+
[StringIndexes.ValueA]: "This is for Value A",
|
|
16
|
+
[StringIndexes.ValueB]: "This is for Value B",
|
|
17
|
+
[StringIndexes.ValueC]: "This is for Value C",
|
|
18
|
+
[StringIndexes.ValueD]: "This is for Value D"
|
|
20
19
|
};
|
|
21
20
|
|
|
22
21
|
test("Validation", () => {
|
|
23
|
-
const
|
|
22
|
+
const stringRecordValidator = new RecordValidator("String index", stringRecord);
|
|
24
23
|
|
|
25
24
|
expect(() => {
|
|
26
|
-
|
|
25
|
+
stringRecordValidator.validate("A");
|
|
27
26
|
}).not.toThrow(RangeError);
|
|
28
27
|
expect(() => {
|
|
29
|
-
|
|
28
|
+
stringRecordValidator.validate("B");
|
|
30
29
|
}).not.toThrow(RangeError);
|
|
31
30
|
expect(() => {
|
|
32
|
-
|
|
31
|
+
stringRecordValidator.validate("C");
|
|
33
32
|
}).not.toThrow(RangeError);
|
|
34
33
|
expect(() => {
|
|
35
|
-
|
|
34
|
+
stringRecordValidator.validate("D");
|
|
36
35
|
}).not.toThrow(RangeError);
|
|
37
36
|
expect(() => {
|
|
38
|
-
|
|
39
|
-
}).toThrow("String
|
|
37
|
+
stringRecordValidator.validate("E");
|
|
38
|
+
}).toThrow("String index \"E\" not found");
|
|
40
39
|
});
|
|
41
40
|
});
|
package/test/reg-exp.test.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { I18nEnvironment } from "@aidc-toolkit/core";
|
|
2
1
|
import { describe, expect, test } from "vitest";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
await i18nUtilityInit(I18nEnvironment.CLI);
|
|
2
|
+
import { RegExpValidator } from "../src";
|
|
6
3
|
|
|
7
4
|
describe("Regular expression validator", () => {
|
|
8
5
|
test("Validation", () => {
|
package/test/sequence.test.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { I18nEnvironment } from "@aidc-toolkit/core";
|
|
2
1
|
import { describe, expect, test } from "vitest";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
await i18nUtilityInit(I18nEnvironment.CLI);
|
|
2
|
+
import { Sequence } from "../src";
|
|
6
3
|
|
|
7
4
|
describe("Sequence", () => {
|
|
8
5
|
const sequence1 = new Sequence(10, 20);
|
package/test/setup.ts
ADDED
package/test/transformer.test.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { I18nEnvironment } from "@aidc-toolkit/core";
|
|
2
1
|
import { describe, expect, test } from "vitest";
|
|
3
|
-
import { EncryptionTransformer,
|
|
4
|
-
|
|
5
|
-
await i18nUtilityInit(I18nEnvironment.CLI);
|
|
2
|
+
import { EncryptionTransformer, IdentityTransformer, Sequence, Transformer } from "../src";
|
|
6
3
|
|
|
7
4
|
function testTransformer(domain: number, tweak?: number, callback?: (value: bigint, forwardValue: bigint) => void): void {
|
|
8
5
|
const transformer = Transformer.get(domain, tweak);
|
package/utility.iml
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
<module type="WEB_MODULE" version="4">
|
|
3
3
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
4
|
<exclude-output />
|
|
5
|
-
<content url="file://$MODULE_DIR$"
|
|
5
|
+
<content url="file://$MODULE_DIR$">
|
|
6
|
+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
|
7
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
|
8
|
+
</content>
|
|
6
9
|
<orderEntry type="inheritedJdk" />
|
|
7
10
|
<orderEntry type="sourceFolder" forTests="false" />
|
|
8
11
|
</component>
|