@aidc-toolkit/utility 0.9.6-beta → 0.9.8-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/index.cjs +161 -550
- package/dist/index.d.cts +612 -64
- package/dist/index.d.ts +612 -64
- package/dist/index.js +145 -548
- package/package.json +6 -5
- package/src/{character_set.ts → character-set.ts} +17 -36
- package/src/index.ts +3 -4
- package/src/locale/i18n.ts +37 -6
- package/src/locale/i18next.d.ts +3 -3
- package/src/record.ts +3 -4
- package/src/{reg_exp.ts → reg-exp.ts} +2 -3
- package/src/sequencer.ts +8 -50
- package/src/transformer.ts +89 -23
- package/test/{character_set.test.ts → character-set.test.ts} +3 -2
- package/test/record.test.ts +3 -3
- package/test/{reg_exp.test.ts → reg-exp.test.ts} +3 -3
- package/test/sequencer.test.ts +10 -21
- package/test/transformer.test.ts +31 -3
- package/src/iterator_proxy.ts +0 -517
- package/src/types.ts +0 -46
- package/test/iterator_proxy.test.ts +0 -252
- /package/src/locale/en/{locale_strings.ts → locale-strings.ts} +0 -0
- /package/src/locale/fr/{locale_strings.ts → locale-strings.ts} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
@@ -28,391 +38,106 @@ __export(src_exports, {
|
|
|
28
38
|
Exclusion: () => Exclusion,
|
|
29
39
|
HEXADECIMAL_CREATOR: () => HEXADECIMAL_CREATOR,
|
|
30
40
|
IdentityTransformer: () => IdentityTransformer,
|
|
31
|
-
IteratorProxy: () => IteratorProxy,
|
|
32
41
|
NUMERIC_CREATOR: () => NUMERIC_CREATOR,
|
|
33
42
|
RecordValidator: () => RecordValidator,
|
|
34
43
|
RegExpValidator: () => RegExpValidator,
|
|
35
44
|
Sequencer: () => Sequencer,
|
|
36
|
-
Transformer: () => Transformer
|
|
45
|
+
Transformer: () => Transformer,
|
|
46
|
+
i18nUtilityInit: () => i18nUtilityInit,
|
|
47
|
+
i18nextUtility: () => i18nextUtility,
|
|
48
|
+
transformIterable: () => transformIterable,
|
|
49
|
+
utilityNS: () => utilityNS,
|
|
50
|
+
utilityResources: () => utilityResources
|
|
37
51
|
});
|
|
38
52
|
module.exports = __toCommonJS(src_exports);
|
|
39
53
|
|
|
40
|
-
// src/
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Get the initial iterable.
|
|
77
|
-
*/
|
|
78
|
-
get initialIterable() {
|
|
79
|
-
return this._initialIterable;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Get the initial iterator.
|
|
83
|
-
*/
|
|
84
|
-
get initialIterator() {
|
|
85
|
-
if (this._initialIterator === void 0) {
|
|
86
|
-
this._initialIterator = this.initialIterable[Symbol.iterator]();
|
|
87
|
-
}
|
|
88
|
-
return this._initialIterator;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* @inheritDoc
|
|
92
|
-
*/
|
|
93
|
-
get [Symbol.toStringTag]() {
|
|
94
|
-
return "IteratorProxy";
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* @inheritDoc
|
|
98
|
-
*/
|
|
99
|
-
[Symbol.dispose]() {
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* @inheritDoc
|
|
103
|
-
*/
|
|
104
|
-
[Symbol.iterator]() {
|
|
105
|
-
return this;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Get the next result from the initial iterator.
|
|
109
|
-
*
|
|
110
|
-
* @param value
|
|
111
|
-
* Tuple value to be passed to Iterator.next().
|
|
112
|
-
*
|
|
113
|
-
* @returns
|
|
114
|
-
* Next result from the initial iterator.
|
|
115
|
-
*/
|
|
116
|
-
initialNext(...value) {
|
|
117
|
-
return this.initialIterator.next(...value);
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* @inheritDoc
|
|
121
|
-
*/
|
|
122
|
-
map(callback) {
|
|
123
|
-
return new IteratorMapProxy(this, callback);
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* @inheritDoc
|
|
127
|
-
*/
|
|
128
|
-
flatMap(callback) {
|
|
129
|
-
return new IteratorFlatMapProxy(this, callback);
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* @inheritDoc
|
|
133
|
-
*/
|
|
134
|
-
filter(predicate) {
|
|
135
|
-
return new IteratorFilterProxy(this, predicate, true);
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* @inheritDoc
|
|
139
|
-
*/
|
|
140
|
-
take(limit) {
|
|
141
|
-
return new IteratorTakeProxy(this, limit);
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* @inheritDoc
|
|
145
|
-
*/
|
|
146
|
-
drop(count) {
|
|
147
|
-
return new IteratorDropProxy(this, count);
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* @inheritDoc
|
|
151
|
-
*/
|
|
152
|
-
reduce(callback, initialValue) {
|
|
153
|
-
let index = 0;
|
|
154
|
-
let result = initialValue;
|
|
155
|
-
for (const value of this) {
|
|
156
|
-
if (index === 0 && arguments.length === 1) {
|
|
157
|
-
result = value;
|
|
158
|
-
} else {
|
|
159
|
-
result = callback(result, value, index);
|
|
160
|
-
}
|
|
161
|
-
index++;
|
|
162
|
-
}
|
|
163
|
-
if (index === 0 && arguments.length === 1) {
|
|
164
|
-
throw new Error("reduce() of empty iterator with no initial value");
|
|
165
|
-
}
|
|
166
|
-
return result;
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* @inheritDoc
|
|
170
|
-
*/
|
|
171
|
-
toArray() {
|
|
172
|
-
return Array.from(this);
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* @inheritDoc
|
|
176
|
-
*/
|
|
177
|
-
forEach(callback) {
|
|
178
|
-
let index = 0;
|
|
179
|
-
for (const element of this) {
|
|
180
|
-
callback(element, index++);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* @inheritDoc
|
|
185
|
-
*/
|
|
186
|
-
some(predicate) {
|
|
187
|
-
return new IteratorFilterProxy(this, predicate, true).next().done !== true;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* @inheritDoc
|
|
191
|
-
*/
|
|
192
|
-
every(predicate) {
|
|
193
|
-
return new IteratorFilterProxy(this, predicate, false).next().done === true;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* @inheritDoc
|
|
197
|
-
*/
|
|
198
|
-
find(predicate) {
|
|
199
|
-
return new IteratorFilterProxy(this, predicate, true).next().value;
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
var IteratorProxyObject = class extends IteratorProxyBase {
|
|
203
|
-
/**
|
|
204
|
-
* @inheritDoc
|
|
205
|
-
*/
|
|
206
|
-
next(...value) {
|
|
207
|
-
return this.initialNext(...value);
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
var IteratorMapProxyBase = class extends IteratorProxyBase {
|
|
211
|
-
/**
|
|
212
|
-
* Callback.
|
|
213
|
-
*/
|
|
214
|
-
_callback;
|
|
215
|
-
/**
|
|
216
|
-
* Index into initial iteration source.
|
|
217
|
-
*/
|
|
218
|
-
_index;
|
|
219
|
-
/**
|
|
220
|
-
* Constructor.
|
|
221
|
-
*
|
|
222
|
-
* @param initialIterationSource
|
|
223
|
-
* Initial iteration source.
|
|
224
|
-
*
|
|
225
|
-
* @param callback
|
|
226
|
-
* Callback.
|
|
227
|
-
*/
|
|
228
|
-
constructor(initialIterationSource, callback) {
|
|
229
|
-
super(initialIterationSource);
|
|
230
|
-
this._callback = callback;
|
|
231
|
-
this._index = 0;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Get the next result from the intermediate iterator.
|
|
235
|
-
*
|
|
236
|
-
* @param value
|
|
237
|
-
* Tuple value to be passed to Iterator.next().
|
|
238
|
-
*
|
|
239
|
-
* @returns
|
|
240
|
-
* Next result from the intermediate iterator.
|
|
241
|
-
*/
|
|
242
|
-
intermediateNext(...value) {
|
|
243
|
-
const initialResult = this.initialNext(...value);
|
|
244
|
-
return initialResult.done !== true ? {
|
|
245
|
-
value: this._callback(initialResult.value, this._index++)
|
|
246
|
-
} : {
|
|
247
|
-
done: true,
|
|
248
|
-
value: void 0
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
var IteratorMapProxy = class extends IteratorMapProxyBase {
|
|
253
|
-
/**
|
|
254
|
-
* @inheritDoc
|
|
255
|
-
*/
|
|
256
|
-
next(...value) {
|
|
257
|
-
return this.intermediateNext(...value);
|
|
258
|
-
}
|
|
259
|
-
};
|
|
260
|
-
var IteratorFlatMapProxy = class extends IteratorMapProxyBase {
|
|
261
|
-
_intermediateIterator;
|
|
262
|
-
/**
|
|
263
|
-
* @inheritDoc
|
|
264
|
-
*/
|
|
265
|
-
next(...value) {
|
|
266
|
-
let finalResult = void 0;
|
|
267
|
-
do {
|
|
268
|
-
if (this._intermediateIterator === void 0) {
|
|
269
|
-
const intermediateResult = this.intermediateNext(...value);
|
|
270
|
-
if (intermediateResult.done === true) {
|
|
271
|
-
finalResult = intermediateResult;
|
|
272
|
-
} else {
|
|
273
|
-
this._intermediateIterator = IteratorProxyBase.toIterable(intermediateResult.value)[Symbol.iterator]();
|
|
274
|
-
}
|
|
275
|
-
} else {
|
|
276
|
-
const pendingFinalResult = this._intermediateIterator.next();
|
|
277
|
-
if (pendingFinalResult.done === true) {
|
|
278
|
-
this._intermediateIterator = void 0;
|
|
279
|
-
} else {
|
|
280
|
-
finalResult = pendingFinalResult;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
} while (finalResult === void 0);
|
|
284
|
-
return finalResult;
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
var IteratorFilterProxy = class extends IteratorProxyBase {
|
|
288
|
-
/**
|
|
289
|
-
* Predicate.
|
|
290
|
-
*/
|
|
291
|
-
_predicate;
|
|
292
|
-
/**
|
|
293
|
-
* Expected truthy result of the predicate.
|
|
294
|
-
*/
|
|
295
|
-
_expectedTruthy;
|
|
296
|
-
/**
|
|
297
|
-
* Index into iteration source.
|
|
298
|
-
*/
|
|
299
|
-
_index;
|
|
300
|
-
/**
|
|
301
|
-
* Constructor.
|
|
302
|
-
*
|
|
303
|
-
* @param iterationSource
|
|
304
|
-
* Iteration source.
|
|
305
|
-
*
|
|
306
|
-
* @param predicate
|
|
307
|
-
* Predicate.
|
|
308
|
-
*
|
|
309
|
-
* @param expectedTruthy
|
|
310
|
-
* Expected truthy result of the predicate.
|
|
311
|
-
*/
|
|
312
|
-
constructor(iterationSource, predicate, expectedTruthy) {
|
|
313
|
-
super(iterationSource);
|
|
314
|
-
this._predicate = predicate;
|
|
315
|
-
this._expectedTruthy = expectedTruthy;
|
|
316
|
-
this._index = 0;
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* @inheritDoc
|
|
320
|
-
*/
|
|
321
|
-
next(...value) {
|
|
322
|
-
let result;
|
|
323
|
-
const expectedTruthy = this._expectedTruthy;
|
|
324
|
-
do {
|
|
325
|
-
result = this.initialNext(...value);
|
|
326
|
-
} while (result.done !== true && Boolean(this._predicate(result.value, this._index++)) !== expectedTruthy);
|
|
327
|
-
return result;
|
|
328
|
-
}
|
|
329
|
-
};
|
|
330
|
-
var IteratorCountProxyBase = class extends IteratorProxyObject {
|
|
331
|
-
/**
|
|
332
|
-
* Count.
|
|
333
|
-
*/
|
|
334
|
-
_count;
|
|
335
|
-
/**
|
|
336
|
-
* Constructor.
|
|
337
|
-
*
|
|
338
|
-
* @param initialIterationSource
|
|
339
|
-
* Initial iteration source.
|
|
340
|
-
*
|
|
341
|
-
* @param count
|
|
342
|
-
* Count.
|
|
343
|
-
*/
|
|
344
|
-
constructor(initialIterationSource, count) {
|
|
345
|
-
super(initialIterationSource);
|
|
346
|
-
if (!Number.isInteger(count) || count < 0) {
|
|
347
|
-
throw new RangeError("Count must be a positive integer");
|
|
348
|
-
}
|
|
349
|
-
this._count = count;
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* Determine if iterator is exhausted (by count or by iterator itself).
|
|
353
|
-
*/
|
|
354
|
-
get exhausted() {
|
|
355
|
-
return this._count <= 0;
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* @inheritDoc
|
|
359
|
-
*/
|
|
360
|
-
next(...value) {
|
|
361
|
-
const result = super.next(...value);
|
|
362
|
-
if (result.done !== true) {
|
|
363
|
-
this._count--;
|
|
364
|
-
} else {
|
|
365
|
-
this._count = 0;
|
|
366
|
-
}
|
|
367
|
-
return result;
|
|
54
|
+
// src/locale/i18n.ts
|
|
55
|
+
var import_core = require("@aidc-toolkit/core");
|
|
56
|
+
var import_i18next = __toESM(require("i18next"), 1);
|
|
57
|
+
|
|
58
|
+
// src/locale/en/locale-strings.ts
|
|
59
|
+
var localeStrings = {
|
|
60
|
+
Transformer: {
|
|
61
|
+
domainMustBeGreaterThanZero: "Domain {{domain}} must be greater than 0",
|
|
62
|
+
tweakMustBeGreaterThanOrEqualToZero: "Tweak {{tweak}} must be greater than or equal to 0",
|
|
63
|
+
valueMustBeGreaterThanOrEqualToZero: "Value {{value}} must be greater than or equal to 0",
|
|
64
|
+
valueMustBeLessThan: "Value {{value}} must be less than {{domain}}",
|
|
65
|
+
minValueMustBeGreaterThanOrEqualToZero: "Minimum value {{minValue}} must be greater than or equal to 0",
|
|
66
|
+
maxValueMustBeLessThan: "Maximum value {{maxValue}} must be less than {{domain}}"
|
|
67
|
+
},
|
|
68
|
+
RegExpValidator: {
|
|
69
|
+
stringDoesNotMatchPattern: "String {{s}} does not match pattern"
|
|
70
|
+
},
|
|
71
|
+
CharacterSetValidator: {
|
|
72
|
+
firstZeroFirstCharacter: "Character set must support zero as first character",
|
|
73
|
+
allNumericAllNumericCharacters: "Character set must support all numeric characters in sequence",
|
|
74
|
+
stringMustNotBeAllNumeric: "String must not be all numeric",
|
|
75
|
+
lengthMustBeGreaterThanOrEqualTo: "Length {{length}} must be greater than or equal to {{minimumLength}}",
|
|
76
|
+
lengthMustBeLessThanOrEqualTo: "Length {{length}} must be less than or equal to {{maximumLength}}",
|
|
77
|
+
lengthMustBeEqualTo: "Length {{length}} must be equal to {{exactLength}}",
|
|
78
|
+
lengthOfComponentMustBeGreaterThanOrEqualTo: "Length {{length}} of {{component}} must be greater than or equal to {{minimumLength}}",
|
|
79
|
+
lengthOfComponentMustBeLessThanOrEqualTo: "Length {{length}} of {{component}} must be less than or equal to {{maximumLength}}",
|
|
80
|
+
lengthOfComponentMustBeEqualTo: "Length {{length}} of {{component}} must be equal to {{exactLength}}",
|
|
81
|
+
invalidCharacterAtPosition: "Invalid character '{{c}}' at position {{position}}",
|
|
82
|
+
invalidCharacterAtPositionOfComponent: "Invalid character '{{c}}' at position {{position}} of {{component}}",
|
|
83
|
+
exclusionNotSupported: "Exclusion value of {{exclusion}} is not supported",
|
|
84
|
+
invalidTweakWithAllNumericExclusion: "Tweak must not be used with all-numeric exclusion",
|
|
85
|
+
endSequenceValueMustBeLessThanOrEqualTo: "End sequence value (start sequence value + count - 1) must be less than {{domain}}"
|
|
86
|
+
},
|
|
87
|
+
RecordValidator: {
|
|
88
|
+
typeNameKeyNotFound: '{{typeName}} "{{key}}" not found'
|
|
368
89
|
}
|
|
369
90
|
};
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
}
|
|
91
|
+
|
|
92
|
+
// src/locale/fr/locale-strings.ts
|
|
93
|
+
var localeStrings2 = {
|
|
94
|
+
Transformer: {
|
|
95
|
+
domainMustBeGreaterThanZero: "Le domaine {{domain}} doit \xEAtre sup\xE9rieur \xE0 0",
|
|
96
|
+
tweakMustBeGreaterThanOrEqualToZero: "Le r\xE9glage {{tweak}} doit \xEAtre sup\xE9rieur ou \xE9gal \xE0 0",
|
|
97
|
+
valueMustBeGreaterThanOrEqualToZero: "La valeur {{value}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 0",
|
|
98
|
+
valueMustBeLessThan: "La valeur {{value}} doit \xEAtre inf\xE9rieure \xE0 {{domain}}",
|
|
99
|
+
minValueMustBeGreaterThanOrEqualToZero: "La valeur minimale {{minValue}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 0",
|
|
100
|
+
maxValueMustBeLessThan: "La valeur maximale {{maxValue}} doit \xEAtre inf\xE9rieure \xE0 {{domain}}"
|
|
101
|
+
},
|
|
102
|
+
RegExpValidator: {
|
|
103
|
+
stringDoesNotMatchPattern: "La cha\xEEne {{s}} ne correspond pas au mod\xE8le"
|
|
104
|
+
},
|
|
105
|
+
CharacterSetValidator: {
|
|
106
|
+
firstZeroFirstCharacter: "Le jeu de caract\xE8res doit prendre en charge z\xE9ro comme premier caract\xE8re",
|
|
107
|
+
allNumericAllNumericCharacters: "Le jeu de caract\xE8res doit prendre en charge tous les caract\xE8res num\xE9riques en s\xE9quence",
|
|
108
|
+
stringMustNotBeAllNumeric: "La cha\xEEne ne doit pas \xEAtre enti\xE8rement num\xE9rique",
|
|
109
|
+
lengthMustBeGreaterThanOrEqualTo: "La longueur {{length}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 {{minimumLength}}",
|
|
110
|
+
lengthMustBeLessThanOrEqualTo: "La longueur {{length}} doit \xEAtre inf\xE9rieure ou \xE9gale \xE0 {{maximumLength}}",
|
|
111
|
+
lengthMustBeEqualTo: "La longueur {{length}} doit \xEAtre \xE9gale \xE0 {{exactLength}}",
|
|
112
|
+
lengthOfComponentMustBeGreaterThanOrEqualTo: "La longueur {{length}} de {{component}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 {{minimumLength}}",
|
|
113
|
+
lengthOfComponentMustBeLessThanOrEqualTo: "La longueur {{length}} de {{component}} doit \xEAtre inf\xE9rieure ou \xE9gale \xE0 {{maximumLength}}",
|
|
114
|
+
lengthOfComponentMustBeEqualTo: "La longueur {{length}} de {{component}} doit \xEAtre \xE9gale \xE0 {{exactLength}}",
|
|
115
|
+
invalidCharacterAtPosition: "Caract\xE8re non valide '{{c}}' \xE0 la position {{position}}",
|
|
116
|
+
invalidCharacterAtPositionOfComponent: "Caract\xE8re non valide '{{c}}' \xE0 la position {{position}} de {{component}}",
|
|
117
|
+
exclusionNotSupported: "La valeur d'exclusion de {{exclusion}} n'est pas prise en charge",
|
|
118
|
+
invalidTweakWithAllNumericExclusion: "Le r\xE9glage ne doit pas \xEAtre utilis\xE9 avec une exclusion enti\xE8rement num\xE9rique",
|
|
119
|
+
endSequenceValueMustBeLessThanOrEqualTo: "La valeur de la s\xE9quence de fin (valeur de la s\xE9quence de d\xE9but + nombre - 1) doit \xEAtre inf\xE9rieure \xE0 {{domaine}}"
|
|
120
|
+
},
|
|
121
|
+
RecordValidator: {
|
|
122
|
+
typeNameKeyNotFound: '{{typeName}} "{{key}}" introuvable'
|
|
379
123
|
}
|
|
380
124
|
};
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
125
|
+
|
|
126
|
+
// src/locale/i18n.ts
|
|
127
|
+
var utilityNS = "aidct_utility";
|
|
128
|
+
(0, import_core.i18nAssertValidResources)(localeStrings, "fr", localeStrings2);
|
|
129
|
+
var utilityResources = {
|
|
130
|
+
en: {
|
|
131
|
+
aidct_utility: localeStrings
|
|
132
|
+
},
|
|
133
|
+
fr: {
|
|
134
|
+
aidct_utility: localeStrings2
|
|
390
135
|
}
|
|
391
136
|
};
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
supported = process.env["NODE_ENV"] !== "test";
|
|
396
|
-
} catch (_e) {
|
|
397
|
-
supported = true;
|
|
398
|
-
}
|
|
399
|
-
if (supported) {
|
|
400
|
-
try {
|
|
401
|
-
Iterator.from([]);
|
|
402
|
-
} catch (_e) {
|
|
403
|
-
supported = false;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
return supported ? Iterator : {
|
|
407
|
-
/**
|
|
408
|
-
* @inheritDoc
|
|
409
|
-
*/
|
|
410
|
-
from(value) {
|
|
411
|
-
return value instanceof IteratorProxyBase ? value : new IteratorProxyObject(value);
|
|
412
|
-
}
|
|
413
|
-
};
|
|
137
|
+
var i18nextUtility = import_i18next.default.createInstance();
|
|
138
|
+
async function i18nUtilityInit(environment, debug = false) {
|
|
139
|
+
await (0, import_core.i18nCoreInit)(i18nextUtility, environment, debug, utilityNS, utilityResources);
|
|
414
140
|
}
|
|
415
|
-
var IteratorProxy = iteratorProxy();
|
|
416
141
|
|
|
417
142
|
// src/sequencer.ts
|
|
418
143
|
var Sequencer = class {
|
|
@@ -440,10 +165,6 @@ var Sequencer = class {
|
|
|
440
165
|
* Maximum value (inclusive).
|
|
441
166
|
*/
|
|
442
167
|
_maxValue;
|
|
443
|
-
/**
|
|
444
|
-
* Next value.
|
|
445
|
-
*/
|
|
446
|
-
_nextValue;
|
|
447
168
|
/**
|
|
448
169
|
* Constructor.
|
|
449
170
|
*
|
|
@@ -458,8 +179,7 @@ var Sequencer = class {
|
|
|
458
179
|
this._startValue = BigInt(startValue);
|
|
459
180
|
this._endValue = this._startValue + BigInt(count);
|
|
460
181
|
this._count = count;
|
|
461
|
-
|
|
462
|
-
if (ascending) {
|
|
182
|
+
if (count >= 0) {
|
|
463
183
|
this._nextDelta = 1n;
|
|
464
184
|
this._minValue = this._startValue;
|
|
465
185
|
this._maxValue = this._endValue - 1n;
|
|
@@ -468,7 +188,6 @@ var Sequencer = class {
|
|
|
468
188
|
this._minValue = this._endValue + 1n;
|
|
469
189
|
this._maxValue = this._startValue;
|
|
470
190
|
}
|
|
471
|
-
this._nextValue = this._startValue;
|
|
472
191
|
}
|
|
473
192
|
/**
|
|
474
193
|
* Get the start value (inclusive).
|
|
@@ -503,121 +222,27 @@ var Sequencer = class {
|
|
|
503
222
|
/**
|
|
504
223
|
* Iterable implementation.
|
|
505
224
|
*
|
|
506
|
-
* @
|
|
507
|
-
*
|
|
508
|
-
*/
|
|
509
|
-
[Symbol.iterator]() {
|
|
510
|
-
return this;
|
|
511
|
-
}
|
|
512
|
-
/**
|
|
513
|
-
* Iterator implementation.
|
|
514
|
-
*
|
|
515
|
-
* @returns
|
|
516
|
-
* Iterator result. If iterator is exhausted, the value is absolute value of the count.
|
|
225
|
+
* @yields
|
|
226
|
+
* Next value in sequence.
|
|
517
227
|
*/
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
if (!done) {
|
|
522
|
-
result = {
|
|
523
|
-
value: this._nextValue
|
|
524
|
-
};
|
|
525
|
-
this._nextValue += this._nextDelta;
|
|
526
|
-
} else {
|
|
527
|
-
result = {
|
|
528
|
-
done: true,
|
|
529
|
-
value: Math.abs(this._count)
|
|
530
|
-
};
|
|
228
|
+
*[Symbol.iterator]() {
|
|
229
|
+
for (let value = this._startValue; value !== this._endValue; value += this._nextDelta) {
|
|
230
|
+
yield value;
|
|
531
231
|
}
|
|
532
|
-
return result;
|
|
533
|
-
}
|
|
534
|
-
/**
|
|
535
|
-
* Reset the iterator.
|
|
536
|
-
*/
|
|
537
|
-
reset() {
|
|
538
|
-
this._nextValue = this._startValue;
|
|
539
232
|
}
|
|
540
233
|
};
|
|
541
234
|
|
|
542
|
-
// src/locale/i18n.ts
|
|
543
|
-
var import_core = require("@aidc-toolkit/core");
|
|
544
|
-
|
|
545
|
-
// src/locale/en/locale_strings.ts
|
|
546
|
-
var localeStrings = {
|
|
547
|
-
Transformer: {
|
|
548
|
-
domainMustBeGreaterThanZero: "Domain {{domain}} must be greater than 0",
|
|
549
|
-
tweakMustBeGreaterThanOrEqualToZero: "Tweak {{tweak}} must be greater than or equal to 0",
|
|
550
|
-
valueMustBeGreaterThanOrEqualToZero: "Value {{value}} must be greater than or equal to 0",
|
|
551
|
-
valueMustBeLessThan: "Value {{value}} must be less than {{domain}}",
|
|
552
|
-
minValueMustBeGreaterThanOrEqualToZero: "Minimum value {{minValue}} must be greater than or equal to 0",
|
|
553
|
-
maxValueMustBeLessThan: "Maximum value {{maxValue}} must be less than {{domain}}"
|
|
554
|
-
},
|
|
555
|
-
RegExpValidator: {
|
|
556
|
-
stringDoesNotMatchPattern: "String {{s}} does not match pattern"
|
|
557
|
-
},
|
|
558
|
-
CharacterSetValidator: {
|
|
559
|
-
firstZeroFirstCharacter: "Character set must support zero as first character",
|
|
560
|
-
allNumericAllNumericCharacters: "Character set must support all numeric characters in sequence",
|
|
561
|
-
stringMustNotBeAllNumeric: "String must not be all numeric",
|
|
562
|
-
lengthMustBeGreaterThanOrEqualTo: "Length {{length}} must be greater than or equal to {{minimumLength}}",
|
|
563
|
-
lengthMustBeLessThanOrEqualTo: "Length {{length}} must be less than or equal to {{maximumLength}}",
|
|
564
|
-
lengthMustBeEqualTo: "Length {{length}} must be equal to {{exactLength}}",
|
|
565
|
-
lengthOfComponentMustBeGreaterThanOrEqualTo: "Length {{length}} of {{component}} must be greater than or equal to {{minimumLength}}",
|
|
566
|
-
lengthOfComponentMustBeLessThanOrEqualTo: "Length {{length}} of {{component}} must be less than or equal to {{maximumLength}}",
|
|
567
|
-
lengthOfComponentMustBeEqualTo: "Length {{length}} of {{component}} must be equal to {{exactLength}}",
|
|
568
|
-
invalidCharacterAtPosition: "Invalid character '{{c}}' at position {{position}}",
|
|
569
|
-
invalidCharacterAtPositionOfComponent: "Invalid character '{{c}}' at position {{position}} of {{component}}",
|
|
570
|
-
exclusionNotSupported: "Exclusion value of {{exclusion}} is not supported",
|
|
571
|
-
invalidTweakWithAllNumericExclusion: "Tweak must not be used with all-numeric exclusion",
|
|
572
|
-
endSequenceValueMustBeLessThanOrEqualTo: "End sequence value (start sequence value + count - 1) must be less than {{domain}}"
|
|
573
|
-
},
|
|
574
|
-
RecordValidator: {
|
|
575
|
-
typeNameKeyNotFound: '{{typeName}} "{{key}}" not found'
|
|
576
|
-
}
|
|
577
|
-
};
|
|
578
|
-
|
|
579
|
-
// src/locale/fr/locale_strings.ts
|
|
580
|
-
var localeStrings2 = {
|
|
581
|
-
Transformer: {
|
|
582
|
-
domainMustBeGreaterThanZero: "Le domaine {{domain}} doit \xEAtre sup\xE9rieur \xE0 0",
|
|
583
|
-
tweakMustBeGreaterThanOrEqualToZero: "Le r\xE9glage {{tweak}} doit \xEAtre sup\xE9rieur ou \xE9gal \xE0 0",
|
|
584
|
-
valueMustBeGreaterThanOrEqualToZero: "La valeur {{value}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 0",
|
|
585
|
-
valueMustBeLessThan: "La valeur {{value}} doit \xEAtre inf\xE9rieure \xE0 {{domain}}",
|
|
586
|
-
minValueMustBeGreaterThanOrEqualToZero: "La valeur minimale {{minValue}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 0",
|
|
587
|
-
maxValueMustBeLessThan: "La valeur maximale {{maxValue}} doit \xEAtre inf\xE9rieure \xE0 {{domain}}"
|
|
588
|
-
},
|
|
589
|
-
RegExpValidator: {
|
|
590
|
-
stringDoesNotMatchPattern: "La cha\xEEne {{s}} ne correspond pas au mod\xE8le"
|
|
591
|
-
},
|
|
592
|
-
CharacterSetValidator: {
|
|
593
|
-
firstZeroFirstCharacter: "Le jeu de caract\xE8res doit prendre en charge z\xE9ro comme premier caract\xE8re",
|
|
594
|
-
allNumericAllNumericCharacters: "Le jeu de caract\xE8res doit prendre en charge tous les caract\xE8res num\xE9riques en s\xE9quence",
|
|
595
|
-
stringMustNotBeAllNumeric: "La cha\xEEne ne doit pas \xEAtre enti\xE8rement num\xE9rique",
|
|
596
|
-
lengthMustBeGreaterThanOrEqualTo: "La longueur {{length}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 {{minimumLength}}",
|
|
597
|
-
lengthMustBeLessThanOrEqualTo: "La longueur {{length}} doit \xEAtre inf\xE9rieure ou \xE9gale \xE0 {{maximumLength}}",
|
|
598
|
-
lengthMustBeEqualTo: "La longueur {{length}} doit \xEAtre \xE9gale \xE0 {{exactLength}}",
|
|
599
|
-
lengthOfComponentMustBeGreaterThanOrEqualTo: "La longueur {{length}} de {{component}} doit \xEAtre sup\xE9rieure ou \xE9gale \xE0 {{minimumLength}}",
|
|
600
|
-
lengthOfComponentMustBeLessThanOrEqualTo: "La longueur {{length}} de {{component}} doit \xEAtre inf\xE9rieure ou \xE9gale \xE0 {{maximumLength}}",
|
|
601
|
-
lengthOfComponentMustBeEqualTo: "La longueur {{length}} de {{component}} doit \xEAtre \xE9gale \xE0 {{exactLength}}",
|
|
602
|
-
invalidCharacterAtPosition: "Caract\xE8re non valide '{{c}}' \xE0 la position {{position}}",
|
|
603
|
-
invalidCharacterAtPositionOfComponent: "Caract\xE8re non valide '{{c}}' \xE0 la position {{position}} de {{component}}",
|
|
604
|
-
exclusionNotSupported: "La valeur d'exclusion de {{exclusion}} n'est pas prise en charge",
|
|
605
|
-
invalidTweakWithAllNumericExclusion: "Le r\xE9glage ne doit pas \xEAtre utilis\xE9 avec une exclusion enti\xE8rement num\xE9rique",
|
|
606
|
-
endSequenceValueMustBeLessThanOrEqualTo: "La valeur de la s\xE9quence de fin (valeur de la s\xE9quence de d\xE9but + nombre - 1) doit \xEAtre inf\xE9rieure \xE0 {{domaine}}"
|
|
607
|
-
},
|
|
608
|
-
RecordValidator: {
|
|
609
|
-
typeNameKeyNotFound: '{{typeName}} "{{key}}" introuvable'
|
|
610
|
-
}
|
|
611
|
-
};
|
|
612
|
-
|
|
613
|
-
// src/locale/i18n.ts
|
|
614
|
-
var utilityNS = "aidct_utility";
|
|
615
|
-
(0, import_core.i18nAssertValidResources)(localeStrings, "fr", localeStrings2);
|
|
616
|
-
(0, import_core.i18nAddResourceBundle)("en", utilityNS, localeStrings);
|
|
617
|
-
(0, import_core.i18nAddResourceBundle)("fr", utilityNS, localeStrings2);
|
|
618
|
-
var i18n_default = import_core.i18next;
|
|
619
|
-
|
|
620
235
|
// src/transformer.ts
|
|
236
|
+
function transformIterable(iterable, transformerCallback) {
|
|
237
|
+
return {
|
|
238
|
+
*[Symbol.iterator]() {
|
|
239
|
+
let index = 0;
|
|
240
|
+
for (const input of iterable) {
|
|
241
|
+
yield transformerCallback(input, index++);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
}
|
|
621
246
|
var Transformer = class _Transformer {
|
|
622
247
|
/**
|
|
623
248
|
* Transformers cache, mapping a domain to another map, which maps an optional tweak to a transformer.
|
|
@@ -636,8 +261,7 @@ var Transformer = class _Transformer {
|
|
|
636
261
|
constructor(domain) {
|
|
637
262
|
this._domain = BigInt(domain);
|
|
638
263
|
if (this._domain <= 0n) {
|
|
639
|
-
throw new RangeError(
|
|
640
|
-
ns: utilityNS,
|
|
264
|
+
throw new RangeError(i18nextUtility.t("Transformer.domainMustBeGreaterThanZero", {
|
|
641
265
|
domain
|
|
642
266
|
}));
|
|
643
267
|
}
|
|
@@ -686,14 +310,12 @@ var Transformer = class _Transformer {
|
|
|
686
310
|
*/
|
|
687
311
|
validate(value) {
|
|
688
312
|
if (value < 0n) {
|
|
689
|
-
throw new RangeError(
|
|
690
|
-
ns: utilityNS,
|
|
313
|
+
throw new RangeError(i18nextUtility.t("Transformer.valueMustBeGreaterThanOrEqualToZero", {
|
|
691
314
|
value
|
|
692
315
|
}));
|
|
693
316
|
}
|
|
694
317
|
if (value >= this.domain) {
|
|
695
|
-
throw new RangeError(
|
|
696
|
-
ns: utilityNS,
|
|
318
|
+
throw new RangeError(i18nextUtility.t("Transformer.valueMustBeLessThan", {
|
|
697
319
|
value,
|
|
698
320
|
domain: this.domain
|
|
699
321
|
}));
|
|
@@ -709,29 +331,35 @@ var Transformer = class _Transformer {
|
|
|
709
331
|
result = transformerCallback === void 0 ? transformedValue : transformerCallback(transformedValue, 0);
|
|
710
332
|
} else if (valueOrValues instanceof Sequencer) {
|
|
711
333
|
if (valueOrValues.minValue < 0n) {
|
|
712
|
-
throw new RangeError(
|
|
713
|
-
ns: utilityNS,
|
|
334
|
+
throw new RangeError(i18nextUtility.t("Transformer.minValueMustBeGreaterThanOrEqualToZero", {
|
|
714
335
|
minValue: valueOrValues.minValue
|
|
715
336
|
}));
|
|
716
337
|
}
|
|
717
338
|
if (valueOrValues.maxValue >= this.domain) {
|
|
718
|
-
throw new RangeError(
|
|
719
|
-
ns: utilityNS,
|
|
339
|
+
throw new RangeError(i18nextUtility.t("Transformer.maxValueMustBeLessThan", {
|
|
720
340
|
maxValue: valueOrValues.maxValue,
|
|
721
341
|
domain: this.domain
|
|
722
342
|
}));
|
|
723
343
|
}
|
|
724
|
-
|
|
344
|
+
if (transformerCallback === void 0) {
|
|
345
|
+
result = transformIterable(valueOrValues, (value) => this.doForward(value));
|
|
346
|
+
} else {
|
|
347
|
+
result = transformIterable(valueOrValues, (value, index) => transformerCallback(this.doForward(value), index));
|
|
348
|
+
}
|
|
725
349
|
} else {
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
350
|
+
if (transformerCallback === void 0) {
|
|
351
|
+
result = transformIterable(valueOrValues, (value) => {
|
|
352
|
+
const valueN = BigInt(value);
|
|
353
|
+
this.validate(valueN);
|
|
354
|
+
return this.doForward(valueN);
|
|
355
|
+
});
|
|
356
|
+
} else {
|
|
357
|
+
result = transformIterable(valueOrValues, (value, index) => {
|
|
358
|
+
const valueN = BigInt(value);
|
|
359
|
+
this.validate(valueN);
|
|
360
|
+
return transformerCallback(this.doForward(valueN), index);
|
|
361
|
+
});
|
|
362
|
+
}
|
|
735
363
|
}
|
|
736
364
|
return result;
|
|
737
365
|
}
|
|
@@ -827,8 +455,7 @@ var EncryptionTransformer = class _EncryptionTransformer extends Transformer {
|
|
|
827
455
|
constructor(domain, tweak) {
|
|
828
456
|
super(domain);
|
|
829
457
|
if (tweak < 0n) {
|
|
830
|
-
throw new RangeError(
|
|
831
|
-
ns: utilityNS,
|
|
458
|
+
throw new RangeError(i18nextUtility.t("Transformer.tweakMustBeGreaterThanOrEqualToZero", {
|
|
832
459
|
tweak
|
|
833
460
|
}));
|
|
834
461
|
}
|
|
@@ -1019,7 +646,7 @@ var EncryptionTransformer = class _EncryptionTransformer extends Transformer {
|
|
|
1019
646
|
}
|
|
1020
647
|
};
|
|
1021
648
|
|
|
1022
|
-
// src/
|
|
649
|
+
// src/reg-exp.ts
|
|
1023
650
|
var RegExpValidator = class {
|
|
1024
651
|
/**
|
|
1025
652
|
* Regular expression.
|
|
@@ -1051,8 +678,7 @@ var RegExpValidator = class {
|
|
|
1051
678
|
* Error message.
|
|
1052
679
|
*/
|
|
1053
680
|
createErrorMessage(s) {
|
|
1054
|
-
return
|
|
1055
|
-
ns: utilityNS,
|
|
681
|
+
return i18nextUtility.t("RegExpValidator.stringDoesNotMatchPattern", {
|
|
1056
682
|
s
|
|
1057
683
|
});
|
|
1058
684
|
}
|
|
@@ -1108,9 +734,8 @@ var RecordValidator = class {
|
|
|
1108
734
|
* Record key.
|
|
1109
735
|
*/
|
|
1110
736
|
validate(key) {
|
|
1111
|
-
if (this.record
|
|
1112
|
-
throw new RangeError(
|
|
1113
|
-
ns: utilityNS,
|
|
737
|
+
if (!(key in this.record)) {
|
|
738
|
+
throw new RangeError(i18nextUtility.t("RecordValidator.typeNameKeyNotFound", {
|
|
1114
739
|
typeName: this.typeName,
|
|
1115
740
|
key
|
|
1116
741
|
}));
|
|
@@ -1118,7 +743,7 @@ var RecordValidator = class {
|
|
|
1118
743
|
}
|
|
1119
744
|
};
|
|
1120
745
|
|
|
1121
|
-
// src/
|
|
746
|
+
// src/character-set.ts
|
|
1122
747
|
var Exclusion = /* @__PURE__ */ ((Exclusion2) => {
|
|
1123
748
|
Exclusion2[Exclusion2["None"] = 0] = "None";
|
|
1124
749
|
Exclusion2[Exclusion2["FirstZero"] = 1] = "FirstZero";
|
|
@@ -1137,9 +762,7 @@ var CharacterSetValidator = class _CharacterSetValidator {
|
|
|
1137
762
|
* Error message.
|
|
1138
763
|
*/
|
|
1139
764
|
createErrorMessage(_s) {
|
|
1140
|
-
return
|
|
1141
|
-
ns: utilityNS
|
|
1142
|
-
});
|
|
765
|
+
return i18nextUtility.t("CharacterSetValidator.stringMustNotBeAllNumeric");
|
|
1143
766
|
}
|
|
1144
767
|
}(/\D/);
|
|
1145
768
|
/**
|
|
@@ -1249,8 +872,7 @@ var CharacterSetValidator = class _CharacterSetValidator {
|
|
|
1249
872
|
*/
|
|
1250
873
|
validateExclusion(exclusion) {
|
|
1251
874
|
if (exclusion !== 0 /* None */ && !this._exclusionSupport.includes(exclusion)) {
|
|
1252
|
-
throw new RangeError(
|
|
1253
|
-
ns: utilityNS,
|
|
875
|
+
throw new RangeError(i18nextUtility.t("CharacterSetValidator.exclusionNotSupported", {
|
|
1254
876
|
exclusion
|
|
1255
877
|
}));
|
|
1256
878
|
}
|
|
@@ -1272,15 +894,13 @@ var CharacterSetValidator = class _CharacterSetValidator {
|
|
|
1272
894
|
if (minimumLength !== void 0 && length < minimumLength) {
|
|
1273
895
|
let errorMessage;
|
|
1274
896
|
if (maximumLength !== void 0 && maximumLength === minimumLength) {
|
|
1275
|
-
errorMessage =
|
|
1276
|
-
ns: utilityNS,
|
|
897
|
+
errorMessage = i18nextUtility.t(validation?.component === void 0 ? "CharacterSetValidator.lengthMustBeEqualTo" : "CharacterSetValidator.lengthOfComponentMustBeEqualTo", {
|
|
1277
898
|
component: _CharacterSetValidator.componentToString(validation?.component),
|
|
1278
899
|
length,
|
|
1279
900
|
exactLength: minimumLength
|
|
1280
901
|
});
|
|
1281
902
|
} else {
|
|
1282
|
-
errorMessage =
|
|
1283
|
-
ns: utilityNS,
|
|
903
|
+
errorMessage = i18nextUtility.t(validation?.component === void 0 ? "CharacterSetValidator.lengthMustBeGreaterThanOrEqualTo" : "CharacterSetValidator.lengthOfComponentMustBeGreaterThanOrEqualTo", {
|
|
1284
904
|
component: _CharacterSetValidator.componentToString(validation?.component),
|
|
1285
905
|
length,
|
|
1286
906
|
minimumLength
|
|
@@ -1289,8 +909,7 @@ var CharacterSetValidator = class _CharacterSetValidator {
|
|
|
1289
909
|
throw new RangeError(errorMessage);
|
|
1290
910
|
}
|
|
1291
911
|
if (maximumLength !== void 0 && length > maximumLength) {
|
|
1292
|
-
throw new RangeError(
|
|
1293
|
-
ns: utilityNS,
|
|
912
|
+
throw new RangeError(i18nextUtility.t(validation?.component === void 0 ? "CharacterSetValidator.lengthMustBeLessThanOrEqualTo" : "CharacterSetValidator.lengthOfComponentMustBeLessThanOrEqualTo", {
|
|
1294
913
|
component: _CharacterSetValidator.componentToString(validation?.component),
|
|
1295
914
|
length,
|
|
1296
915
|
maximumLength
|
|
@@ -1298,8 +917,7 @@ var CharacterSetValidator = class _CharacterSetValidator {
|
|
|
1298
917
|
}
|
|
1299
918
|
const index = this.characterIndexes(s).findIndex((characterIndex) => characterIndex === void 0);
|
|
1300
919
|
if (index !== -1) {
|
|
1301
|
-
throw new RangeError(
|
|
1302
|
-
ns: utilityNS,
|
|
920
|
+
throw new RangeError(i18nextUtility.t(validation?.component === void 0 ? "CharacterSetValidator.invalidCharacterAtPosition" : "CharacterSetValidator.invalidCharacterAtPositionOfComponent", {
|
|
1303
921
|
component: _CharacterSetValidator.componentToString(validation?.component),
|
|
1304
922
|
c: s.charAt(index),
|
|
1305
923
|
position: index + (validation?.positionOffset ?? 0) + 1
|
|
@@ -1312,8 +930,7 @@ var CharacterSetValidator = class _CharacterSetValidator {
|
|
|
1312
930
|
break;
|
|
1313
931
|
case 1 /* FirstZero */:
|
|
1314
932
|
if (s.startsWith("0")) {
|
|
1315
|
-
throw new RangeError(
|
|
1316
|
-
ns: utilityNS,
|
|
933
|
+
throw new RangeError(i18nextUtility.t(validation.component === void 0 ? "CharacterSetValidator.invalidCharacterAtPosition" : "CharacterSetValidator.invalidCharacterAtPositionOfComponent", {
|
|
1317
934
|
component: _CharacterSetValidator.componentToString(validation.component),
|
|
1318
935
|
c: "0",
|
|
1319
936
|
position: (validation.positionOffset ?? 0) + 1
|
|
@@ -1400,9 +1017,7 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
|
|
|
1400
1017
|
exclusionDomains[0 /* None */] = exclusionNoneDomains;
|
|
1401
1018
|
if (exclusionSupport.includes(1 /* FirstZero */)) {
|
|
1402
1019
|
if (characterSet[0] !== "0") {
|
|
1403
|
-
throw new RangeError(
|
|
1404
|
-
ns: utilityNS
|
|
1405
|
-
}));
|
|
1020
|
+
throw new RangeError(i18nextUtility.t("CharacterSetValidator.firstZeroFirstCharacter"));
|
|
1406
1021
|
}
|
|
1407
1022
|
const exclusionFirstZeroDomains = new Array(_CharacterSetCreator.MAXIMUM_STRING_LENGTH + 1);
|
|
1408
1023
|
exclusionFirstZeroDomains[0] = 0n;
|
|
@@ -1416,9 +1031,7 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
|
|
|
1416
1031
|
let expectedNumberIndex = numberIndexes2[0];
|
|
1417
1032
|
for (const numberIndex of numberIndexes2) {
|
|
1418
1033
|
if (numberIndex === void 0 || numberIndex !== expectedNumberIndex) {
|
|
1419
|
-
throw new RangeError(
|
|
1420
|
-
ns: utilityNS
|
|
1421
|
-
}));
|
|
1034
|
+
throw new RangeError(i18nextUtility.t("CharacterSetValidator.allNumericAllNumericCharacters"));
|
|
1422
1035
|
}
|
|
1423
1036
|
expectedNumberIndex = numberIndex + 1;
|
|
1424
1037
|
}
|
|
@@ -1473,9 +1086,7 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
|
|
|
1473
1086
|
let shift;
|
|
1474
1087
|
if (length === 0) {
|
|
1475
1088
|
if (!shiftForward && value < 10n) {
|
|
1476
|
-
throw new RangeError(
|
|
1477
|
-
ns: utilityNS
|
|
1478
|
-
}));
|
|
1089
|
+
throw new RangeError(i18nextUtility.t("CharacterSetValidator.stringMustNotBeAllNumeric"));
|
|
1479
1090
|
}
|
|
1480
1091
|
shift = 10n;
|
|
1481
1092
|
} else {
|
|
@@ -1499,15 +1110,13 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
|
|
|
1499
1110
|
*/
|
|
1500
1111
|
validateLength(length) {
|
|
1501
1112
|
if (length < 0) {
|
|
1502
|
-
throw new RangeError(
|
|
1503
|
-
ns: utilityNS,
|
|
1113
|
+
throw new RangeError(i18nextUtility.t("CharacterSetValidator.lengthMustBeGreaterThanOrEqualTo", {
|
|
1504
1114
|
length,
|
|
1505
1115
|
minimumLength: 0
|
|
1506
1116
|
}));
|
|
1507
1117
|
}
|
|
1508
1118
|
if (length > _CharacterSetCreator.MAXIMUM_STRING_LENGTH) {
|
|
1509
|
-
throw new RangeError(
|
|
1510
|
-
ns: utilityNS,
|
|
1119
|
+
throw new RangeError(i18nextUtility.t("CharacterSetValidator.lengthMustBeLessThanOrEqualTo", {
|
|
1511
1120
|
length,
|
|
1512
1121
|
maximumLength: _CharacterSetCreator.MAXIMUM_STRING_LENGTH
|
|
1513
1122
|
}));
|
|
@@ -1581,8 +1190,7 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
|
|
|
1581
1190
|
const characterSetSizeN = BigInt(this.characterSetSize);
|
|
1582
1191
|
let value = this.characterIndexes(s).reduce((accumulator, characterIndex, index) => {
|
|
1583
1192
|
if (characterIndex === void 0) {
|
|
1584
|
-
throw new RangeError(
|
|
1585
|
-
ns: utilityNS,
|
|
1193
|
+
throw new RangeError(i18nextUtility.t("CharacterSetValidator.invalidCharacterAtPosition", {
|
|
1586
1194
|
c: s.charAt(index),
|
|
1587
1195
|
position: index + 1
|
|
1588
1196
|
}));
|
|
@@ -1590,8 +1198,7 @@ var CharacterSetCreator = class _CharacterSetCreator extends CharacterSetValidat
|
|
|
1590
1198
|
let value2;
|
|
1591
1199
|
if (index === 0 && exclusion === 1 /* FirstZero */) {
|
|
1592
1200
|
if (characterIndex === 0) {
|
|
1593
|
-
throw new RangeError(
|
|
1594
|
-
ns: utilityNS,
|
|
1201
|
+
throw new RangeError(i18nextUtility.t("CharacterSetValidator.invalidCharacterAtPosition", {
|
|
1595
1202
|
c: "0",
|
|
1596
1203
|
position: 1
|
|
1597
1204
|
}));
|
|
@@ -1717,10 +1324,14 @@ var ALPHANUMERIC_CREATOR = new CharacterSetCreator([
|
|
|
1717
1324
|
Exclusion,
|
|
1718
1325
|
HEXADECIMAL_CREATOR,
|
|
1719
1326
|
IdentityTransformer,
|
|
1720
|
-
IteratorProxy,
|
|
1721
1327
|
NUMERIC_CREATOR,
|
|
1722
1328
|
RecordValidator,
|
|
1723
1329
|
RegExpValidator,
|
|
1724
1330
|
Sequencer,
|
|
1725
|
-
Transformer
|
|
1331
|
+
Transformer,
|
|
1332
|
+
i18nUtilityInit,
|
|
1333
|
+
i18nextUtility,
|
|
1334
|
+
transformIterable,
|
|
1335
|
+
utilityNS,
|
|
1336
|
+
utilityResources
|
|
1726
1337
|
});
|