typia 7.0.0-dev.20241002 → 7.0.0-dev.20241002-2
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/lib/factories/MetadataCollection.js +2 -2
- package/lib/factories/MetadataCollection.js.map +1 -1
- package/lib/factories/MetadataCommentTagFactory.js +284 -205
- package/lib/factories/MetadataCommentTagFactory.js.map +1 -1
- package/lib/programmers/helpers/UnionPredicator.js +1 -1
- package/lib/programmers/helpers/UnionPredicator.js.map +1 -1
- package/lib/programmers/http/HttpHeadersProgrammer.js +1 -1
- package/lib/programmers/http/HttpHeadersProgrammer.js.map +1 -1
- package/lib/programmers/protobuf/ProtobufMessageProgrammer.js +1 -1
- package/lib/programmers/protobuf/ProtobufMessageProgrammer.js.map +1 -1
- package/lib/utils/MapUtil.d.ts +1 -1
- package/lib/utils/MapUtil.js +7 -9
- package/lib/utils/MapUtil.js.map +1 -1
- package/lib/utils/NameEncoder.d.ts +2 -2
- package/lib/utils/NameEncoder.js +4 -6
- package/lib/utils/NameEncoder.js.map +1 -1
- package/package.json +1 -1
- package/src/factories/MetadataCollection.ts +3 -2
- package/src/factories/MetadataCommentTagFactory.ts +212 -133
- package/src/programmers/helpers/UnionPredicator.ts +1 -1
- package/src/programmers/http/HttpHeadersProgrammer.ts +1 -1
- package/src/programmers/protobuf/ProtobufMessageProgrammer.ts +1 -1
- package/src/utils/MapUtil.ts +11 -9
- package/src/utils/NameEncoder.ts +4 -4
|
@@ -41,8 +41,6 @@ var Writable_1 = require("../typings/Writable");
|
|
|
41
41
|
var FormatCheatSheet_1 = require("../tags/internal/FormatCheatSheet");
|
|
42
42
|
var MetadataTypeTagFactory_1 = require("./MetadataTypeTagFactory");
|
|
43
43
|
/**
|
|
44
|
-
* Extremely hard coded, but no reason to maintain.
|
|
45
|
-
*
|
|
46
44
|
* @internal
|
|
47
45
|
*/
|
|
48
46
|
var MetadataCommentTagFactory;
|
|
@@ -193,73 +191,120 @@ var MetadataCommentTagFactory;
|
|
|
193
191
|
var next = PARSER[props.tag.name];
|
|
194
192
|
if (next === undefined)
|
|
195
193
|
return {};
|
|
196
|
-
var
|
|
197
|
-
if (
|
|
194
|
+
var value = (_a = (props.tag.text || [])[0]) === null || _a === void 0 ? void 0 : _a.text;
|
|
195
|
+
if (value === undefined && props.tag.name !== "uniqueItems")
|
|
198
196
|
return props.report("no comment tag value");
|
|
199
|
-
return next(
|
|
197
|
+
return next({
|
|
198
|
+
report: props.report,
|
|
199
|
+
value: value,
|
|
200
|
+
});
|
|
200
201
|
};
|
|
201
202
|
})(MetadataCommentTagFactory || (exports.MetadataCommentTagFactory = MetadataCommentTagFactory = {}));
|
|
203
|
+
/**
|
|
204
|
+
* @internal
|
|
205
|
+
*/
|
|
202
206
|
var PARSER = {
|
|
203
207
|
/* -----------------------------------------------------------
|
|
204
208
|
ARRAY
|
|
205
209
|
----------------------------------------------------------- */
|
|
206
|
-
items: function (
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
210
|
+
items: function (_a) {
|
|
211
|
+
var report = _a.report, value = _a.value;
|
|
212
|
+
return ({
|
|
213
|
+
array: [
|
|
214
|
+
{
|
|
215
|
+
name: "MinItems<".concat(value, ">"),
|
|
216
|
+
target: "array",
|
|
217
|
+
kind: "minItems",
|
|
218
|
+
value: parse_integer({
|
|
219
|
+
report: report,
|
|
220
|
+
value: value,
|
|
221
|
+
unsigned: true,
|
|
222
|
+
}),
|
|
223
|
+
validate: "".concat(value, " <= $input.length"),
|
|
224
|
+
exclusive: true,
|
|
225
|
+
schema: {
|
|
226
|
+
minItems: parse_integer({
|
|
227
|
+
report: report,
|
|
228
|
+
value: value,
|
|
229
|
+
unsigned: true,
|
|
230
|
+
}),
|
|
231
|
+
},
|
|
217
232
|
},
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
233
|
+
{
|
|
234
|
+
name: "MaxItems<".concat(value, ">"),
|
|
235
|
+
target: "array",
|
|
236
|
+
kind: "maxItems",
|
|
237
|
+
value: parse_integer({
|
|
238
|
+
report: report,
|
|
239
|
+
value: value,
|
|
240
|
+
unsigned: true,
|
|
241
|
+
}),
|
|
242
|
+
validate: "$input.length <= ".concat(value),
|
|
243
|
+
exclusive: true,
|
|
244
|
+
schema: {
|
|
245
|
+
maxItems: parse_integer({
|
|
246
|
+
report: report,
|
|
247
|
+
unsigned: true,
|
|
248
|
+
value: value,
|
|
249
|
+
}),
|
|
250
|
+
},
|
|
228
251
|
},
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
minItems: function (
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
252
|
+
],
|
|
253
|
+
});
|
|
254
|
+
},
|
|
255
|
+
minItems: function (_a) {
|
|
256
|
+
var report = _a.report, value = _a.value;
|
|
257
|
+
return ({
|
|
258
|
+
array: [
|
|
259
|
+
{
|
|
260
|
+
name: "MinItems<".concat(value, ">"),
|
|
261
|
+
target: "array",
|
|
262
|
+
kind: "minItems",
|
|
263
|
+
value: parse_integer({
|
|
264
|
+
report: report,
|
|
265
|
+
value: value,
|
|
266
|
+
unsigned: true,
|
|
267
|
+
}),
|
|
268
|
+
validate: "".concat(value, " <= $input.length"),
|
|
269
|
+
exclusive: true,
|
|
270
|
+
schema: {
|
|
271
|
+
minItems: parse_integer({
|
|
272
|
+
report: report,
|
|
273
|
+
value: value,
|
|
274
|
+
unsigned: true,
|
|
275
|
+
}),
|
|
276
|
+
},
|
|
243
277
|
},
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
maxItems: function (
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
278
|
+
],
|
|
279
|
+
});
|
|
280
|
+
},
|
|
281
|
+
maxItems: function (_a) {
|
|
282
|
+
var report = _a.report, value = _a.value;
|
|
283
|
+
return ({
|
|
284
|
+
array: [
|
|
285
|
+
{
|
|
286
|
+
name: "MaxItems<".concat(value, ">"),
|
|
287
|
+
target: "array",
|
|
288
|
+
kind: "maxItems",
|
|
289
|
+
value: parse_integer({
|
|
290
|
+
report: report,
|
|
291
|
+
value: value,
|
|
292
|
+
unsigned: true,
|
|
293
|
+
}),
|
|
294
|
+
validate: "$input.length <= ".concat(value),
|
|
295
|
+
exclusive: true,
|
|
296
|
+
schema: {
|
|
297
|
+
maxItems: parse_integer({
|
|
298
|
+
report: report,
|
|
299
|
+
value: value,
|
|
300
|
+
unsigned: true,
|
|
301
|
+
}),
|
|
302
|
+
},
|
|
258
303
|
},
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
262
|
-
uniqueItems: function () { return
|
|
304
|
+
],
|
|
305
|
+
});
|
|
306
|
+
},
|
|
307
|
+
uniqueItems: function () { return ({
|
|
263
308
|
array: [
|
|
264
309
|
{
|
|
265
310
|
name: "UniqueItems",
|
|
@@ -273,212 +318,234 @@ var PARSER = {
|
|
|
273
318
|
},
|
|
274
319
|
},
|
|
275
320
|
],
|
|
276
|
-
}); }
|
|
321
|
+
}); },
|
|
277
322
|
/* -----------------------------------------------------------
|
|
278
323
|
NUMBER
|
|
279
324
|
----------------------------------------------------------- */
|
|
280
|
-
type: function () {
|
|
325
|
+
type: function (_a) {
|
|
326
|
+
var value = _a.value;
|
|
281
327
|
// EMENDATIONS
|
|
282
|
-
if (
|
|
283
|
-
|
|
284
|
-
if (
|
|
285
|
-
|
|
286
|
-
else if (
|
|
287
|
-
|
|
328
|
+
if (value.startsWith("{") && value.endsWith("}"))
|
|
329
|
+
value = value.substring(1, value.length - 1);
|
|
330
|
+
if (value === "int")
|
|
331
|
+
value = "int32";
|
|
332
|
+
else if (value === "uint")
|
|
333
|
+
value = "uint32";
|
|
288
334
|
// MUST BE ONE OF THEM
|
|
289
|
-
if (["int32", "uint32", "int64", "uint64", "float", "double"].includes(
|
|
335
|
+
if (["int32", "uint32", "int64", "uint64", "float", "double"].includes(value) === false)
|
|
290
336
|
return {};
|
|
291
337
|
return {
|
|
292
338
|
number: [
|
|
293
339
|
{
|
|
294
|
-
name: "Type<".concat(JSON.stringify(
|
|
340
|
+
name: "Type<".concat(JSON.stringify(value), ">"),
|
|
295
341
|
target: "number",
|
|
296
342
|
kind: "type",
|
|
297
|
-
value:
|
|
298
|
-
validate:
|
|
343
|
+
value: value,
|
|
344
|
+
validate: value === "int32"
|
|
299
345
|
? "Math.floor($input) === $input && -2147483648 <= $input && $input <= 2147483647"
|
|
300
|
-
:
|
|
346
|
+
: value === "uint32"
|
|
301
347
|
? "Math.floor($input) === $input && 0 <= $input && $input <= 4294967295"
|
|
302
|
-
:
|
|
348
|
+
: value === "int64"
|
|
303
349
|
? "Math.floor($input) === $input && -9223372036854775808 <= $input && $input <= 9223372036854775807"
|
|
304
|
-
:
|
|
350
|
+
: value === "uint64"
|
|
305
351
|
? "Math.floor($input) === $input && 0 <= $input && $input <= 18446744073709551615"
|
|
306
|
-
:
|
|
352
|
+
: value === "float"
|
|
307
353
|
? "-1.175494351e38 <= $input && $input <= 3.4028235e38"
|
|
308
354
|
: "true",
|
|
309
355
|
exclusive: true,
|
|
310
|
-
schema: ["int32", "uint32", "int64", "uint64"].includes(
|
|
356
|
+
schema: ["int32", "uint32", "int64", "uint64"].includes(value)
|
|
311
357
|
? { type: "integer" }
|
|
312
358
|
: undefined,
|
|
313
359
|
},
|
|
314
360
|
],
|
|
315
|
-
bigint:
|
|
361
|
+
bigint: value === "int64" || "uint64"
|
|
316
362
|
? [
|
|
317
363
|
{
|
|
318
|
-
name: "Type<".concat(JSON.stringify(
|
|
364
|
+
name: "Type<".concat(JSON.stringify(value), ">"),
|
|
319
365
|
target: "bigint",
|
|
320
366
|
kind: "type",
|
|
321
|
-
value:
|
|
322
|
-
validate:
|
|
367
|
+
value: value,
|
|
368
|
+
validate: value === "int64" ? "true" : "BigInt(0) <= $input",
|
|
323
369
|
exclusive: true,
|
|
324
370
|
schema: undefined,
|
|
325
371
|
},
|
|
326
372
|
]
|
|
327
373
|
: [],
|
|
328
374
|
};
|
|
329
|
-
}
|
|
330
|
-
minimum: function (
|
|
375
|
+
},
|
|
376
|
+
minimum: function (props) { return ({
|
|
331
377
|
number: [
|
|
332
378
|
{
|
|
333
|
-
name: "Minimum<".concat(
|
|
379
|
+
name: "Minimum<".concat(props.value, ">"),
|
|
334
380
|
target: "number",
|
|
335
381
|
kind: "minimum",
|
|
336
|
-
value: parse_number(
|
|
337
|
-
validate: "".concat(
|
|
382
|
+
value: parse_number(props),
|
|
383
|
+
validate: "".concat(props.value, " <= $input"),
|
|
338
384
|
exclusive: ["minimum", "exclusiveMinimum"],
|
|
339
385
|
schema: {
|
|
340
|
-
minimum: parse_number(
|
|
386
|
+
minimum: parse_number(props),
|
|
341
387
|
},
|
|
342
388
|
},
|
|
343
389
|
],
|
|
344
390
|
bigint: [
|
|
345
391
|
{
|
|
346
|
-
name: "Minimum<".concat(
|
|
392
|
+
name: "Minimum<".concat(props.value, "n>"),
|
|
347
393
|
target: "bigint",
|
|
348
394
|
kind: "minimum",
|
|
349
395
|
value: (function () {
|
|
350
|
-
var
|
|
351
|
-
|
|
396
|
+
var parsed = parse_integer({
|
|
397
|
+
report: props.report,
|
|
398
|
+
value: props.value,
|
|
399
|
+
unsigned: false,
|
|
400
|
+
});
|
|
401
|
+
return parsed === null ? null : BigInt(parsed);
|
|
352
402
|
})(),
|
|
353
|
-
validate: "".concat(
|
|
403
|
+
validate: "".concat(props.value, " <= $input"),
|
|
354
404
|
exclusive: ["minimum", "exclusiveMinimum"],
|
|
355
405
|
schema: undefined,
|
|
356
406
|
},
|
|
357
407
|
],
|
|
358
|
-
}); }
|
|
359
|
-
maximum: function (
|
|
408
|
+
}); },
|
|
409
|
+
maximum: function (props) { return ({
|
|
360
410
|
number: [
|
|
361
411
|
{
|
|
362
|
-
name: "Maximum<".concat(
|
|
412
|
+
name: "Maximum<".concat(props.value, ">"),
|
|
363
413
|
target: "number",
|
|
364
414
|
kind: "maximum",
|
|
365
|
-
value: parse_number(
|
|
366
|
-
validate: "$input <= ".concat(
|
|
415
|
+
value: parse_number(props),
|
|
416
|
+
validate: "$input <= ".concat(props.value),
|
|
367
417
|
exclusive: ["maximum", "exclusiveMaximum"],
|
|
368
418
|
schema: {
|
|
369
|
-
maximum: parse_number(
|
|
419
|
+
maximum: parse_number(props),
|
|
370
420
|
},
|
|
371
421
|
},
|
|
372
422
|
],
|
|
373
423
|
bigint: [
|
|
374
424
|
{
|
|
375
|
-
name: "Maximum<".concat(
|
|
425
|
+
name: "Maximum<".concat(props.value, "n>"),
|
|
376
426
|
target: "bigint",
|
|
377
427
|
kind: "maximum",
|
|
378
428
|
value: (function () {
|
|
379
|
-
var
|
|
380
|
-
|
|
429
|
+
var parsed = parse_integer({
|
|
430
|
+
report: props.report,
|
|
431
|
+
value: props.value,
|
|
432
|
+
unsigned: false,
|
|
433
|
+
});
|
|
434
|
+
return parsed === null ? null : BigInt(parsed);
|
|
381
435
|
})(),
|
|
382
|
-
validate: "$input <= ".concat(
|
|
436
|
+
validate: "$input <= ".concat(props.value),
|
|
383
437
|
exclusive: ["maximum", "exclusiveMaximum"],
|
|
384
438
|
schema: undefined,
|
|
385
439
|
},
|
|
386
440
|
],
|
|
387
|
-
}); }
|
|
388
|
-
exclusiveMinimum: function (
|
|
441
|
+
}); },
|
|
442
|
+
exclusiveMinimum: function (props) { return ({
|
|
389
443
|
number: [
|
|
390
444
|
{
|
|
391
|
-
name: "ExclusiveMinimum<".concat(
|
|
445
|
+
name: "ExclusiveMinimum<".concat(props.value, ">"),
|
|
392
446
|
target: "number",
|
|
393
447
|
kind: "exclusiveMinimum",
|
|
394
|
-
value: parse_number(
|
|
395
|
-
validate: "".concat(
|
|
448
|
+
value: parse_number(props),
|
|
449
|
+
validate: "".concat(props.value, " < $input"),
|
|
396
450
|
exclusive: ["minimum", "exclusiveMinimum"],
|
|
397
451
|
schema: {
|
|
398
452
|
exclusiveMinimum: true,
|
|
399
|
-
minimum: parse_number(
|
|
453
|
+
minimum: parse_number(props),
|
|
400
454
|
},
|
|
401
455
|
},
|
|
402
456
|
],
|
|
403
457
|
bigint: [
|
|
404
458
|
{
|
|
405
|
-
name: "ExclusiveMinimum<".concat(
|
|
459
|
+
name: "ExclusiveMinimum<".concat(props.value, "n>"),
|
|
406
460
|
target: "bigint",
|
|
407
461
|
kind: "exclusiveMinimum",
|
|
408
462
|
value: (function () {
|
|
409
|
-
var
|
|
410
|
-
|
|
463
|
+
var parsed = parse_integer({
|
|
464
|
+
report: props.report,
|
|
465
|
+
value: props.value,
|
|
466
|
+
unsigned: false,
|
|
467
|
+
});
|
|
468
|
+
return parsed === null ? null : BigInt(parsed);
|
|
411
469
|
})(),
|
|
412
|
-
validate: "".concat(
|
|
470
|
+
validate: "".concat(props.value, " < $input"),
|
|
413
471
|
exclusive: ["minimum", "exclusiveMinimum"],
|
|
414
472
|
schema: undefined,
|
|
415
473
|
},
|
|
416
474
|
],
|
|
417
|
-
}); }
|
|
418
|
-
exclusiveMaximum: function (
|
|
475
|
+
}); },
|
|
476
|
+
exclusiveMaximum: function (props) { return ({
|
|
419
477
|
number: [
|
|
420
478
|
{
|
|
421
|
-
name: "ExclusiveMaximum<".concat(
|
|
479
|
+
name: "ExclusiveMaximum<".concat(props.value, ">"),
|
|
422
480
|
target: "number",
|
|
423
481
|
kind: "exclusiveMaximum",
|
|
424
|
-
value: parse_number(
|
|
425
|
-
validate: "$input < ".concat(
|
|
482
|
+
value: parse_number(props),
|
|
483
|
+
validate: "$input < ".concat(props.value),
|
|
426
484
|
exclusive: ["maximum", "exclusiveMaximum"],
|
|
427
485
|
schema: {
|
|
428
486
|
exclusiveMaximum: true,
|
|
429
|
-
maximum: parse_number(
|
|
487
|
+
maximum: parse_number(props),
|
|
430
488
|
},
|
|
431
489
|
},
|
|
432
490
|
],
|
|
433
491
|
bigint: [
|
|
434
492
|
{
|
|
435
|
-
name: "ExclusiveMaximum<".concat(
|
|
493
|
+
name: "ExclusiveMaximum<".concat(props.value, "n>"),
|
|
436
494
|
target: "bigint",
|
|
437
495
|
kind: "exclusiveMaximum",
|
|
438
496
|
value: (function () {
|
|
439
|
-
var
|
|
440
|
-
|
|
497
|
+
var parsed = parse_integer({
|
|
498
|
+
report: props.report,
|
|
499
|
+
value: props.value,
|
|
500
|
+
unsigned: false,
|
|
501
|
+
});
|
|
502
|
+
return parsed === null ? null : BigInt(parsed);
|
|
441
503
|
})(),
|
|
442
|
-
validate: "$input < ".concat(
|
|
504
|
+
validate: "$input < ".concat(props.value),
|
|
443
505
|
exclusive: ["maximum", "exclusiveMaximum"],
|
|
444
506
|
schema: undefined,
|
|
445
507
|
},
|
|
446
508
|
],
|
|
447
|
-
}); }
|
|
448
|
-
multipleOf: function (
|
|
509
|
+
}); },
|
|
510
|
+
multipleOf: function (props) { return ({
|
|
449
511
|
number: [
|
|
450
512
|
{
|
|
451
|
-
name: "MultipleOf<".concat(
|
|
513
|
+
name: "MultipleOf<".concat(props.value, ">"),
|
|
452
514
|
target: "number",
|
|
453
515
|
kind: "multipleOf",
|
|
454
|
-
value: parse_number(
|
|
455
|
-
validate: "$input % ".concat(
|
|
516
|
+
value: parse_number(props),
|
|
517
|
+
validate: "$input % ".concat(props.value, " === 0"),
|
|
456
518
|
exclusive: true,
|
|
457
519
|
schema: {
|
|
458
|
-
multipleOf: parse_number(
|
|
520
|
+
multipleOf: parse_number(props),
|
|
459
521
|
},
|
|
460
522
|
},
|
|
461
523
|
],
|
|
462
524
|
bigint: [
|
|
463
525
|
{
|
|
464
|
-
name: "MultipleOf<".concat(
|
|
526
|
+
name: "MultipleOf<".concat(props.value, "n>"),
|
|
465
527
|
target: "bigint",
|
|
466
528
|
kind: "multipleOf",
|
|
467
529
|
value: (function () {
|
|
468
|
-
var
|
|
469
|
-
|
|
530
|
+
var parsed = parse_integer({
|
|
531
|
+
report: props.report,
|
|
532
|
+
value: props.value,
|
|
533
|
+
unsigned: false,
|
|
534
|
+
});
|
|
535
|
+
return parsed === null ? null : BigInt(parsed);
|
|
470
536
|
})(),
|
|
471
|
-
validate: "$input % ".concat(
|
|
537
|
+
validate: "$input % ".concat(props.value, "n === 0n"),
|
|
472
538
|
exclusive: true,
|
|
473
539
|
schema: undefined,
|
|
474
540
|
},
|
|
475
541
|
],
|
|
476
|
-
}); }
|
|
542
|
+
}); },
|
|
477
543
|
/* -----------------------------------------------------------
|
|
478
544
|
STRING
|
|
479
545
|
----------------------------------------------------------- */
|
|
480
|
-
format: function () {
|
|
481
|
-
var
|
|
546
|
+
format: function (_a) {
|
|
547
|
+
var value = _a.value;
|
|
548
|
+
var matched = FORMATS.get(value);
|
|
482
549
|
if (matched === undefined)
|
|
483
550
|
return {};
|
|
484
551
|
return {
|
|
@@ -496,101 +563,113 @@ var PARSER = {
|
|
|
496
563
|
},
|
|
497
564
|
],
|
|
498
565
|
};
|
|
499
|
-
}
|
|
500
|
-
pattern: function () {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
566
|
+
},
|
|
567
|
+
pattern: function (_a) {
|
|
568
|
+
var value = _a.value;
|
|
569
|
+
return ({
|
|
570
|
+
string: [
|
|
571
|
+
{
|
|
572
|
+
name: "Pattern<".concat(JSON.stringify(value), ">"),
|
|
573
|
+
target: "string",
|
|
574
|
+
kind: "pattern",
|
|
575
|
+
value: value,
|
|
576
|
+
validate: "RegExp(".concat(JSON.stringify(value), ").test($input)"),
|
|
577
|
+
exclusive: ["format"],
|
|
578
|
+
schema: {
|
|
579
|
+
pattern: value,
|
|
580
|
+
},
|
|
511
581
|
},
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
}
|
|
515
|
-
length: function (
|
|
582
|
+
],
|
|
583
|
+
});
|
|
584
|
+
},
|
|
585
|
+
length: function (props) { return ({
|
|
516
586
|
string: [
|
|
517
587
|
{
|
|
518
|
-
name: "MinLength<".concat(
|
|
588
|
+
name: "MinLength<".concat(props.value, ">"),
|
|
519
589
|
target: "string",
|
|
520
590
|
kind: "minLength",
|
|
521
|
-
value: parse_number(
|
|
522
|
-
validate: "".concat(
|
|
591
|
+
value: parse_number(props),
|
|
592
|
+
validate: "".concat(props.value, " <= $input.length"),
|
|
523
593
|
exclusive: true,
|
|
524
594
|
schema: {
|
|
525
|
-
minLength: parse_number(
|
|
595
|
+
minLength: parse_number(props),
|
|
526
596
|
},
|
|
527
597
|
},
|
|
528
598
|
{
|
|
529
|
-
name: "MaxLength<".concat(
|
|
599
|
+
name: "MaxLength<".concat(props.value, ">"),
|
|
530
600
|
target: "string",
|
|
531
601
|
kind: "maxLength",
|
|
532
|
-
value: parse_number(
|
|
533
|
-
validate: "$input.length <= ".concat(
|
|
602
|
+
value: parse_number(props),
|
|
603
|
+
validate: "$input.length <= ".concat(props.value),
|
|
534
604
|
exclusive: true,
|
|
535
605
|
schema: {
|
|
536
|
-
maxLength: parse_number(
|
|
606
|
+
maxLength: parse_number(props),
|
|
537
607
|
},
|
|
538
608
|
},
|
|
539
609
|
],
|
|
540
|
-
}); }
|
|
541
|
-
minLength: function (
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
610
|
+
}); },
|
|
611
|
+
minLength: function (_a) {
|
|
612
|
+
var report = _a.report, value = _a.value;
|
|
613
|
+
return ({
|
|
614
|
+
string: [
|
|
615
|
+
{
|
|
616
|
+
name: "MinLength<".concat(value, ">"),
|
|
617
|
+
target: "string",
|
|
618
|
+
kind: "minLength",
|
|
619
|
+
value: parse_number({ report: report, value: value }),
|
|
620
|
+
validate: "".concat(value, " <= $input.length"),
|
|
621
|
+
exclusive: true,
|
|
622
|
+
schema: {
|
|
623
|
+
minLength: parse_number({ report: report, value: value }),
|
|
624
|
+
},
|
|
552
625
|
},
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
}
|
|
556
|
-
maxLength: function (
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
626
|
+
],
|
|
627
|
+
});
|
|
628
|
+
},
|
|
629
|
+
maxLength: function (_a) {
|
|
630
|
+
var report = _a.report, value = _a.value;
|
|
631
|
+
return ({
|
|
632
|
+
string: [
|
|
633
|
+
{
|
|
634
|
+
name: "MaxLength<".concat(value, ">"),
|
|
635
|
+
target: "string",
|
|
636
|
+
kind: "maxLength",
|
|
637
|
+
value: parse_number({ report: report, value: value }),
|
|
638
|
+
validate: "$input.length <= ".concat(value),
|
|
639
|
+
exclusive: true,
|
|
640
|
+
schema: {
|
|
641
|
+
maxLength: parse_number({ report: report, value: value }),
|
|
642
|
+
},
|
|
567
643
|
},
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
}
|
|
644
|
+
],
|
|
645
|
+
});
|
|
646
|
+
},
|
|
571
647
|
};
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
648
|
+
/**
|
|
649
|
+
* @internal
|
|
650
|
+
*/
|
|
651
|
+
var parse_number = function (props) {
|
|
652
|
+
var parsed = Number(props.value);
|
|
653
|
+
if (isNaN(parsed) === true)
|
|
654
|
+
return props.report("invalid number");
|
|
655
|
+
return parsed;
|
|
579
656
|
};
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
};
|
|
657
|
+
/**
|
|
658
|
+
* @internal
|
|
659
|
+
*/
|
|
660
|
+
var parse_integer = function (props) {
|
|
661
|
+
var parsed = parse_number(props);
|
|
662
|
+
if (parsed === null)
|
|
663
|
+
return null;
|
|
664
|
+
else if (Math.floor(parsed) !== parsed)
|
|
665
|
+
return props.report("invalid integer");
|
|
666
|
+
else if (props.unsigned === true && parsed < 0)
|
|
667
|
+
return props.report("invalid unsigned integer");
|
|
668
|
+
return parsed;
|
|
593
669
|
};
|
|
670
|
+
/**
|
|
671
|
+
* @internal
|
|
672
|
+
*/
|
|
594
673
|
var FORMATS = new Map(__spreadArray(__spreadArray([], __read(Object.entries(FormatCheatSheet_1.FormatCheatSheet).map(function (_a) {
|
|
595
674
|
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
596
675
|
return [key, [key, value]];
|