@xpadev-net/niconicomments 0.2.73 → 0.2.75
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/bundle.d.ts +1930 -1426
- package/dist/bundle.js +756 -783
- package/package.json +17 -14
package/dist/bundle.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
niconicomments.js v0.2.
|
|
2
|
+
niconicomments.js v0.2.75
|
|
3
3
|
(c) 2021 xpadev-net https://xpadev.net
|
|
4
4
|
Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -213,9 +213,6 @@
|
|
|
213
213
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
214
214
|
return n;
|
|
215
215
|
}
|
|
216
|
-
function _arrayWithHoles(r) {
|
|
217
|
-
if (Array.isArray(r)) return r;
|
|
218
|
-
}
|
|
219
216
|
function _arrayWithoutHoles(r) {
|
|
220
217
|
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
221
218
|
}
|
|
@@ -238,7 +235,7 @@
|
|
|
238
235
|
}
|
|
239
236
|
function _createClass(e, r, t) {
|
|
240
237
|
return Object.defineProperty(e, "prototype", {
|
|
241
|
-
writable:
|
|
238
|
+
writable: false
|
|
242
239
|
}), e;
|
|
243
240
|
}
|
|
244
241
|
function _createForOfIteratorHelper(r, e) {
|
|
@@ -252,9 +249,9 @@
|
|
|
252
249
|
s: F,
|
|
253
250
|
n: function () {
|
|
254
251
|
return n >= r.length ? {
|
|
255
|
-
done:
|
|
252
|
+
done: true
|
|
256
253
|
} : {
|
|
257
|
-
done:
|
|
254
|
+
done: false,
|
|
258
255
|
value: r[n++]
|
|
259
256
|
};
|
|
260
257
|
},
|
|
@@ -267,8 +264,8 @@
|
|
|
267
264
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
268
265
|
}
|
|
269
266
|
var o,
|
|
270
|
-
a =
|
|
271
|
-
u =
|
|
267
|
+
a = true,
|
|
268
|
+
u = false;
|
|
272
269
|
return {
|
|
273
270
|
s: function () {
|
|
274
271
|
t = t.call(r);
|
|
@@ -278,7 +275,7 @@
|
|
|
278
275
|
return a = r.done, r;
|
|
279
276
|
},
|
|
280
277
|
e: function (r) {
|
|
281
|
-
u =
|
|
278
|
+
u = true, o = r;
|
|
282
279
|
},
|
|
283
280
|
f: function () {
|
|
284
281
|
try {
|
|
@@ -292,9 +289,9 @@
|
|
|
292
289
|
function _defineProperty(e, r, t) {
|
|
293
290
|
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
294
291
|
value: t,
|
|
295
|
-
enumerable:
|
|
296
|
-
configurable:
|
|
297
|
-
writable:
|
|
292
|
+
enumerable: true,
|
|
293
|
+
configurable: true,
|
|
294
|
+
writable: true
|
|
298
295
|
}) : e[r] = t, e;
|
|
299
296
|
}
|
|
300
297
|
function _getPrototypeOf(t) {
|
|
@@ -307,11 +304,11 @@
|
|
|
307
304
|
t.prototype = Object.create(e && e.prototype, {
|
|
308
305
|
constructor: {
|
|
309
306
|
value: t,
|
|
310
|
-
writable:
|
|
311
|
-
configurable:
|
|
307
|
+
writable: true,
|
|
308
|
+
configurable: true
|
|
312
309
|
}
|
|
313
310
|
}), Object.defineProperty(t, "prototype", {
|
|
314
|
-
writable:
|
|
311
|
+
writable: false
|
|
315
312
|
}), e && _setPrototypeOf(t, e);
|
|
316
313
|
}
|
|
317
314
|
function _isNativeFunction(t) {
|
|
@@ -332,36 +329,6 @@
|
|
|
332
329
|
function _iterableToArray(r) {
|
|
333
330
|
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
334
331
|
}
|
|
335
|
-
function _iterableToArrayLimit(r, l) {
|
|
336
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
337
|
-
if (null != t) {
|
|
338
|
-
var e,
|
|
339
|
-
n,
|
|
340
|
-
i,
|
|
341
|
-
u,
|
|
342
|
-
a = [],
|
|
343
|
-
f = !0,
|
|
344
|
-
o = !1;
|
|
345
|
-
try {
|
|
346
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
347
|
-
if (Object(t) !== t) return;
|
|
348
|
-
f = !1;
|
|
349
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
350
|
-
} catch (r) {
|
|
351
|
-
o = !0, n = r;
|
|
352
|
-
} finally {
|
|
353
|
-
try {
|
|
354
|
-
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
355
|
-
} finally {
|
|
356
|
-
if (o) throw n;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
return a;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
function _nonIterableRest() {
|
|
363
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
364
|
-
}
|
|
365
332
|
function _nonIterableSpread() {
|
|
366
333
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
367
334
|
}
|
|
@@ -378,7 +345,7 @@
|
|
|
378
345
|
function _objectSpread2(e) {
|
|
379
346
|
for (var r = 1; r < arguments.length; r++) {
|
|
380
347
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
381
|
-
r % 2 ? ownKeys(Object(t),
|
|
348
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
|
|
382
349
|
_defineProperty(e, r, t[r]);
|
|
383
350
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
384
351
|
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
@@ -396,9 +363,6 @@
|
|
|
396
363
|
return t.__proto__ = e, t;
|
|
397
364
|
}, _setPrototypeOf(t, e);
|
|
398
365
|
}
|
|
399
|
-
function _slicedToArray(r, e) {
|
|
400
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
401
|
-
}
|
|
402
366
|
function _toConsumableArray(r) {
|
|
403
367
|
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
404
368
|
}
|
|
@@ -406,7 +370,7 @@
|
|
|
406
370
|
if ("object" != typeof t || !t) return t;
|
|
407
371
|
var e = t[Symbol.toPrimitive];
|
|
408
372
|
if (void 0 !== e) {
|
|
409
|
-
var i = e.call(t, r
|
|
373
|
+
var i = e.call(t, r);
|
|
410
374
|
if ("object" != typeof i) return i;
|
|
411
375
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
412
376
|
}
|
|
@@ -447,254 +411,272 @@
|
|
|
447
411
|
return Wrapper.prototype = Object.create(t.prototype, {
|
|
448
412
|
constructor: {
|
|
449
413
|
value: Wrapper,
|
|
450
|
-
enumerable:
|
|
451
|
-
writable:
|
|
452
|
-
configurable:
|
|
414
|
+
enumerable: false,
|
|
415
|
+
writable: true,
|
|
416
|
+
configurable: true
|
|
453
417
|
}
|
|
454
418
|
}), _setPrototypeOf(Wrapper, t);
|
|
455
419
|
}, _wrapNativeSuper(t);
|
|
456
420
|
}
|
|
457
421
|
|
|
458
|
-
// src/error/ValiError/ValiError.ts
|
|
459
|
-
var ValiError = /*#__PURE__*/function (_Error) {
|
|
460
|
-
/**
|
|
461
|
-
* Creates a Valibot error with useful information.
|
|
462
|
-
*
|
|
463
|
-
* @param issues The error issues.
|
|
464
|
-
*/
|
|
465
|
-
function ValiError(issues) {
|
|
466
|
-
var _this;
|
|
467
|
-
_classCallCheck(this, ValiError);
|
|
468
|
-
_this = _callSuper(this, ValiError, [issues[0].message]);
|
|
469
|
-
_defineProperty(_this, "issues", void 0);
|
|
470
|
-
_this.name = "ValiError";
|
|
471
|
-
_this.issues = issues;
|
|
472
|
-
return _this;
|
|
473
|
-
}
|
|
474
|
-
_inherits(ValiError, _Error);
|
|
475
|
-
return _createClass(ValiError);
|
|
476
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
477
|
-
|
|
478
|
-
// src/utils/actionIssue/actionIssue.ts
|
|
479
|
-
function actionIssue(context, reference, input, label, received) {
|
|
480
|
-
return {
|
|
481
|
-
issues: [{
|
|
482
|
-
context: context,
|
|
483
|
-
reference: reference,
|
|
484
|
-
input: input,
|
|
485
|
-
label: label,
|
|
486
|
-
received: received
|
|
487
|
-
}]
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
// src/utils/actionOutput/actionOutput.ts
|
|
492
|
-
function actionOutput(output) {
|
|
493
|
-
return {
|
|
494
|
-
output: output
|
|
495
|
-
};
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
// src/utils/defaultArgs/defaultArgs.ts
|
|
499
|
-
function defaultArgs(arg1, arg2) {
|
|
500
|
-
return Array.isArray(arg1) ? [void 0, arg1] : [arg1, arg2];
|
|
501
|
-
}
|
|
502
|
-
|
|
503
422
|
// src/storages/globalConfig/globalConfig.ts
|
|
504
423
|
var store;
|
|
505
|
-
|
|
506
|
-
|
|
424
|
+
// @__NO_SIDE_EFFECTS__
|
|
425
|
+
function getGlobalConfig(config2) {
|
|
426
|
+
var _config2$lang, _store, _config2$abortEarly, _store2, _config2$abortPipeEar, _store3;
|
|
507
427
|
return {
|
|
508
|
-
lang: (
|
|
509
|
-
message:
|
|
510
|
-
abortEarly: (
|
|
511
|
-
abortPipeEarly: (
|
|
512
|
-
skipPipe: (_config$skipPipe = config === null || config === void 0 ? void 0 : config.skipPipe) !== null && _config$skipPipe !== void 0 ? _config$skipPipe : (_store4 = store) === null || _store4 === void 0 ? void 0 : _store4.skipPipe
|
|
428
|
+
lang: (_config2$lang = void 0 ) !== null && _config2$lang !== void 0 ? _config2$lang : (_store = store) === null || _store === void 0 ? void 0 : _store.lang,
|
|
429
|
+
message: config2 === null || config2 === void 0 ? void 0 : config2.message,
|
|
430
|
+
abortEarly: (_config2$abortEarly = void 0 ) !== null && _config2$abortEarly !== void 0 ? _config2$abortEarly : (_store2 = store) === null || _store2 === void 0 ? void 0 : _store2.abortEarly,
|
|
431
|
+
abortPipeEarly: (_config2$abortPipeEar = void 0 ) !== null && _config2$abortPipeEar !== void 0 ? _config2$abortPipeEar : (_store3 = store) === null || _store3 === void 0 ? void 0 : _store3.abortPipeEarly
|
|
513
432
|
};
|
|
514
433
|
}
|
|
515
434
|
|
|
516
435
|
// src/storages/globalMessage/globalMessage.ts
|
|
517
436
|
var store2;
|
|
437
|
+
// @__NO_SIDE_EFFECTS__
|
|
518
438
|
function getGlobalMessage(lang) {
|
|
519
|
-
var
|
|
520
|
-
return (
|
|
439
|
+
var _store4;
|
|
440
|
+
return (_store4 = store2) === null || _store4 === void 0 ? void 0 : _store4.get(lang);
|
|
521
441
|
}
|
|
522
442
|
|
|
523
443
|
// src/storages/schemaMessage/schemaMessage.ts
|
|
524
444
|
var store3;
|
|
445
|
+
// @__NO_SIDE_EFFECTS__
|
|
525
446
|
function getSchemaMessage(lang) {
|
|
526
|
-
var
|
|
527
|
-
return (
|
|
447
|
+
var _store6;
|
|
448
|
+
return (_store6 = store3) === null || _store6 === void 0 ? void 0 : _store6.get(lang);
|
|
528
449
|
}
|
|
529
450
|
|
|
530
451
|
// src/storages/specificMessage/specificMessage.ts
|
|
531
452
|
var store4;
|
|
453
|
+
// @__NO_SIDE_EFFECTS__
|
|
532
454
|
function getSpecificMessage(reference, lang) {
|
|
533
|
-
var
|
|
534
|
-
return (
|
|
455
|
+
var _store8;
|
|
456
|
+
return (_store8 = store4) === null || _store8 === void 0 || (_store8 = _store8.get(reference)) === null || _store8 === void 0 ? void 0 : _store8.get(lang);
|
|
535
457
|
}
|
|
536
458
|
|
|
537
|
-
// src/utils/
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
var
|
|
541
|
-
|
|
459
|
+
// src/utils/_stringify/_stringify.ts
|
|
460
|
+
// @__NO_SIDE_EFFECTS__
|
|
461
|
+
function _stringify(input) {
|
|
462
|
+
var type = _typeof(input);
|
|
463
|
+
if (type === "string") {
|
|
464
|
+
return "\"".concat(input, "\"");
|
|
465
|
+
}
|
|
466
|
+
if (type === "number" || type === "bigint" || type === "boolean") {
|
|
467
|
+
return "".concat(input);
|
|
468
|
+
}
|
|
469
|
+
if (type === "object" || type === "function") {
|
|
470
|
+
var _ref, _Object$getPrototypeO;
|
|
471
|
+
return (_ref = input && ((_Object$getPrototypeO = Object.getPrototypeOf(input)) === null || _Object$getPrototypeO === void 0 || (_Object$getPrototypeO = _Object$getPrototypeO.constructor) === null || _Object$getPrototypeO === void 0 ? void 0 : _Object$getPrototypeO.name)) !== null && _ref !== void 0 ? _ref : "null";
|
|
472
|
+
}
|
|
473
|
+
return type;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
// src/utils/_addIssue/_addIssue.ts
|
|
477
|
+
function _addIssue(context, label, dataset, config2, other) {
|
|
478
|
+
var _ref2, _other$expected, _other$received, _ref3, _ref4, _ref5, _ref6, _other$message;
|
|
479
|
+
var input = other && "input" in other ? other.input : dataset.value;
|
|
480
|
+
var expected = (_ref2 = (_other$expected = other === null || other === void 0 ? void 0 : other.expected) !== null && _other$expected !== void 0 ? _other$expected : context.expects) !== null && _ref2 !== void 0 ? _ref2 : null;
|
|
481
|
+
var received = (_other$received = other === null || other === void 0 ? void 0 : other.received) !== null && _other$received !== void 0 ? _other$received : _stringify(input);
|
|
482
|
+
var issue = {
|
|
483
|
+
kind: context.kind,
|
|
484
|
+
type: context.type,
|
|
485
|
+
input: input,
|
|
486
|
+
expected: expected,
|
|
487
|
+
received: received,
|
|
488
|
+
message: "Invalid ".concat(label, ": ").concat(expected ? "Expected ".concat(expected, " but r") : "R", "eceived ").concat(received),
|
|
489
|
+
requirement: context.requirement,
|
|
490
|
+
path: other === null || other === void 0 ? void 0 : other.path,
|
|
491
|
+
issues: other === null || other === void 0 ? void 0 : other.issues,
|
|
492
|
+
lang: config2.lang,
|
|
493
|
+
abortEarly: config2.abortEarly,
|
|
494
|
+
abortPipeEarly: config2.abortPipeEarly
|
|
495
|
+
};
|
|
496
|
+
var isSchema = context.kind === "schema";
|
|
497
|
+
var message2 = (_ref3 = (_ref4 = (_ref5 = (_ref6 = (_other$message = other === null || other === void 0 ? void 0 : other.message) !== null && _other$message !== void 0 ? _other$message : context.message) !== null && _ref6 !== void 0 ? _ref6 : getSpecificMessage(context.reference, issue.lang)) !== null && _ref5 !== void 0 ? _ref5 : isSchema ? getSchemaMessage(issue.lang) : null) !== null && _ref4 !== void 0 ? _ref4 : config2.message) !== null && _ref3 !== void 0 ? _ref3 : getGlobalMessage(issue.lang);
|
|
498
|
+
if (message2 !== void 0) {
|
|
499
|
+
issue.message = typeof message2 === "function" ?
|
|
500
|
+
// @ts-expect-error
|
|
501
|
+
message2(issue) : message2;
|
|
502
|
+
}
|
|
503
|
+
if (isSchema) {
|
|
504
|
+
dataset.typed = false;
|
|
505
|
+
}
|
|
506
|
+
if (dataset.issues) {
|
|
507
|
+
dataset.issues.push(issue);
|
|
508
|
+
} else {
|
|
509
|
+
dataset.issues = [issue];
|
|
510
|
+
}
|
|
542
511
|
}
|
|
543
512
|
|
|
544
|
-
// src/utils/
|
|
545
|
-
|
|
513
|
+
// src/utils/_getStandardProps/_getStandardProps.ts
|
|
514
|
+
// @__NO_SIDE_EFFECTS__
|
|
515
|
+
function _getStandardProps(context) {
|
|
546
516
|
return {
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
517
|
+
version: 1,
|
|
518
|
+
vendor: "valibot",
|
|
519
|
+
validate: function validate(value2) {
|
|
520
|
+
return context["~run"]({
|
|
521
|
+
value: value2
|
|
522
|
+
}, getGlobalConfig());
|
|
523
|
+
}
|
|
550
524
|
};
|
|
551
525
|
}
|
|
552
526
|
|
|
553
|
-
// src/utils/
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
527
|
+
// src/utils/_isValidObjectKey/_isValidObjectKey.ts
|
|
528
|
+
// @__NO_SIDE_EFFECTS__
|
|
529
|
+
function _isValidObjectKey(object2, key) {
|
|
530
|
+
return Object.hasOwn(object2, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// src/utils/_joinExpects/_joinExpects.ts
|
|
534
|
+
// @__NO_SIDE_EFFECTS__
|
|
535
|
+
function _joinExpects(values2, separator) {
|
|
536
|
+
var _list$;
|
|
537
|
+
var list = _toConsumableArray(new Set(values2));
|
|
538
|
+
if (list.length > 1) {
|
|
539
|
+
return "(".concat(list.join(" ".concat(separator, " ")), ")");
|
|
558
540
|
}
|
|
559
|
-
return
|
|
541
|
+
return (_list$ = list[0]) !== null && _list$ !== void 0 ? _list$ : "never";
|
|
560
542
|
}
|
|
561
543
|
|
|
562
|
-
// src/utils/
|
|
563
|
-
function
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
544
|
+
// src/utils/ValiError/ValiError.ts
|
|
545
|
+
var ValiError = /*#__PURE__*/function (_Error) {
|
|
546
|
+
/**
|
|
547
|
+
* Creates a Valibot error with useful information.
|
|
548
|
+
*
|
|
549
|
+
* @param issues The error issues.
|
|
550
|
+
*/
|
|
551
|
+
function ValiError(issues) {
|
|
552
|
+
var _this;
|
|
553
|
+
_classCallCheck(this, ValiError);
|
|
554
|
+
_this = _callSuper(this, ValiError, [issues[0].message]);
|
|
555
|
+
_this.name = "ValiError";
|
|
556
|
+
_this.issues = issues;
|
|
557
|
+
return _this;
|
|
558
|
+
}
|
|
559
|
+
_inherits(ValiError, _Error);
|
|
560
|
+
return _createClass(ValiError);
|
|
561
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
562
|
+
|
|
563
|
+
// src/actions/check/check.ts
|
|
564
|
+
// @__NO_SIDE_EFFECTS__
|
|
565
|
+
function check(requirement, message2) {
|
|
566
|
+
return {
|
|
567
|
+
kind: "validation",
|
|
568
|
+
type: "check",
|
|
569
|
+
reference: check,
|
|
570
|
+
async: false,
|
|
571
|
+
expects: null,
|
|
572
|
+
requirement: requirement,
|
|
573
|
+
message: message2,
|
|
574
|
+
"~run": function run(dataset, config2) {
|
|
575
|
+
if (dataset.typed && !this.requirement(dataset.value)) {
|
|
576
|
+
_addIssue(this, "input", dataset, config2);
|
|
577
|
+
}
|
|
578
|
+
return dataset;
|
|
579
|
+
}
|
|
579
580
|
};
|
|
580
|
-
schemaIssue2.message = i18n(false, issue.context, issue.reference, config, schemaIssue2);
|
|
581
|
-
return schemaIssue2;
|
|
582
581
|
}
|
|
583
582
|
|
|
584
|
-
// src/
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
issues ? issues.push(schemaIssue2) : issues = [schemaIssue2];
|
|
601
|
-
}
|
|
602
|
-
} catch (err) {
|
|
603
|
-
_iterator2.e(err);
|
|
604
|
-
} finally {
|
|
605
|
-
_iterator2.f();
|
|
606
|
-
}
|
|
607
|
-
if (config !== null && config !== void 0 && config.abortEarly || config !== null && config !== void 0 && config.abortPipeEarly) {
|
|
608
|
-
break;
|
|
609
|
-
}
|
|
610
|
-
} else {
|
|
611
|
-
input = result.output;
|
|
612
|
-
}
|
|
583
|
+
// src/actions/notValue/notValue.ts
|
|
584
|
+
// @__NO_SIDE_EFFECTS__
|
|
585
|
+
function notValue(requirement, message2) {
|
|
586
|
+
return {
|
|
587
|
+
kind: "validation",
|
|
588
|
+
type: "not_value",
|
|
589
|
+
reference: notValue,
|
|
590
|
+
async: false,
|
|
591
|
+
expects: requirement instanceof Date ? "!".concat(requirement.toJSON()) : "!".concat(_stringify(requirement)),
|
|
592
|
+
requirement: requirement,
|
|
593
|
+
message: message2,
|
|
594
|
+
"~run": function run(dataset, config2) {
|
|
595
|
+
if (dataset.typed && this.requirement <= dataset.value && this.requirement >= dataset.value) {
|
|
596
|
+
_addIssue(this, "value", dataset, config2, {
|
|
597
|
+
received: dataset.value instanceof Date ? dataset.value.toJSON() : _stringify(dataset.value)
|
|
598
|
+
});
|
|
613
599
|
}
|
|
614
|
-
|
|
615
|
-
_iterator.e(err);
|
|
616
|
-
} finally {
|
|
617
|
-
_iterator.f();
|
|
600
|
+
return dataset;
|
|
618
601
|
}
|
|
619
|
-
}
|
|
620
|
-
return schemaResult(true, input, issues);
|
|
621
|
-
}
|
|
622
|
-
function restAndDefaultArgs(arg1, arg2, arg3) {
|
|
623
|
-
if (!arg1 || _typeof(arg1) === "object" && !Array.isArray(arg1)) {
|
|
624
|
-
var _defaultArgs = defaultArgs(arg2, arg3),
|
|
625
|
-
_defaultArgs2 = _slicedToArray(_defaultArgs, 2),
|
|
626
|
-
error2 = _defaultArgs2[0],
|
|
627
|
-
pipe2 = _defaultArgs2[1];
|
|
628
|
-
return [arg1, error2, pipe2];
|
|
629
|
-
}
|
|
630
|
-
var _defaultArgs3 = defaultArgs(arg1, arg2),
|
|
631
|
-
_defaultArgs4 = _slicedToArray(_defaultArgs3, 2),
|
|
632
|
-
error = _defaultArgs4[0],
|
|
633
|
-
pipe = _defaultArgs4[1];
|
|
634
|
-
return [void 0, error, pipe];
|
|
602
|
+
};
|
|
635
603
|
}
|
|
636
604
|
|
|
637
|
-
// src/
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
var received = stringify(input);
|
|
641
|
-
var expected = (_other$expected = other === null || other === void 0 ? void 0 : other.expected) !== null && _other$expected !== void 0 ? _other$expected : context.expects;
|
|
642
|
-
var issue = {
|
|
643
|
-
reason: (_other$reason = other === null || other === void 0 ? void 0 : other.reason) !== null && _other$reason !== void 0 ? _other$reason : "type",
|
|
644
|
-
context: context.type,
|
|
645
|
-
expected: expected,
|
|
646
|
-
received: received,
|
|
647
|
-
message: "Invalid type: Expected ".concat(expected, " but received ").concat(received),
|
|
648
|
-
input: input,
|
|
649
|
-
path: other === null || other === void 0 ? void 0 : other.path,
|
|
650
|
-
issues: other === null || other === void 0 ? void 0 : other.issues,
|
|
651
|
-
lang: config === null || config === void 0 ? void 0 : config.lang,
|
|
652
|
-
abortEarly: config === null || config === void 0 ? void 0 : config.abortEarly,
|
|
653
|
-
abortPipeEarly: config === null || config === void 0 ? void 0 : config.abortPipeEarly,
|
|
654
|
-
skipPipe: config === null || config === void 0 ? void 0 : config.skipPipe
|
|
655
|
-
};
|
|
656
|
-
issue.message = i18n(true, context, reference, config, issue);
|
|
605
|
+
// src/actions/regex/regex.ts
|
|
606
|
+
// @__NO_SIDE_EFFECTS__
|
|
607
|
+
function regex(requirement, message2) {
|
|
657
608
|
return {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
609
|
+
kind: "validation",
|
|
610
|
+
type: "regex",
|
|
611
|
+
reference: regex,
|
|
612
|
+
async: false,
|
|
613
|
+
expects: "".concat(requirement),
|
|
614
|
+
requirement: requirement,
|
|
615
|
+
message: message2,
|
|
616
|
+
"~run": function run(dataset, config2) {
|
|
617
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) {
|
|
618
|
+
_addIssue(this, "format", dataset, config2);
|
|
619
|
+
}
|
|
620
|
+
return dataset;
|
|
621
|
+
}
|
|
661
622
|
};
|
|
662
623
|
}
|
|
663
624
|
|
|
625
|
+
// src/methods/getFallback/getFallback.ts
|
|
626
|
+
// @__NO_SIDE_EFFECTS__
|
|
627
|
+
function getFallback(schema, dataset, config2) {
|
|
628
|
+
return typeof schema.fallback === "function" ?
|
|
629
|
+
// @ts-expect-error
|
|
630
|
+
schema.fallback(dataset, config2) :
|
|
631
|
+
// @ts-expect-error
|
|
632
|
+
schema.fallback;
|
|
633
|
+
}
|
|
634
|
+
|
|
664
635
|
// src/methods/getDefault/getDefault.ts
|
|
665
|
-
|
|
666
|
-
|
|
636
|
+
// @__NO_SIDE_EFFECTS__
|
|
637
|
+
function getDefault(schema, dataset, config2) {
|
|
638
|
+
return typeof schema["default"] === "function" ?
|
|
639
|
+
// @ts-expect-error
|
|
640
|
+
schema["default"](dataset, config2) :
|
|
641
|
+
// @ts-expect-error
|
|
642
|
+
schema["default"];
|
|
667
643
|
}
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
644
|
+
|
|
645
|
+
// src/methods/is/is.ts
|
|
646
|
+
// @__NO_SIDE_EFFECTS__
|
|
647
|
+
function is(schema, input) {
|
|
648
|
+
return !schema["~run"]({
|
|
649
|
+
value: input
|
|
650
|
+
}, {
|
|
651
|
+
abortEarly: true
|
|
673
652
|
}).issues;
|
|
674
653
|
}
|
|
675
654
|
|
|
676
655
|
// src/schemas/array/array.ts
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
_defaultArgs6 = _slicedToArray(_defaultArgs5, 2),
|
|
680
|
-
message = _defaultArgs6[0],
|
|
681
|
-
pipe = _defaultArgs6[1];
|
|
656
|
+
// @__NO_SIDE_EFFECTS__
|
|
657
|
+
function array(item, message2) {
|
|
682
658
|
return {
|
|
659
|
+
kind: "schema",
|
|
683
660
|
type: "array",
|
|
661
|
+
reference: array,
|
|
684
662
|
expects: "Array",
|
|
685
663
|
async: false,
|
|
686
664
|
item: item,
|
|
687
|
-
message:
|
|
688
|
-
|
|
689
|
-
|
|
665
|
+
message: message2,
|
|
666
|
+
get "~standard"() {
|
|
667
|
+
return _getStandardProps(this);
|
|
668
|
+
},
|
|
669
|
+
"~run": function run(dataset, config2) {
|
|
670
|
+
var input = dataset.value;
|
|
690
671
|
if (Array.isArray(input)) {
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
var output = [];
|
|
672
|
+
dataset.typed = true;
|
|
673
|
+
dataset.value = [];
|
|
694
674
|
for (var key = 0; key < input.length; key++) {
|
|
695
675
|
var value2 = input[key];
|
|
696
|
-
var
|
|
697
|
-
|
|
676
|
+
var itemDataset = this.item["~run"]({
|
|
677
|
+
value: value2
|
|
678
|
+
}, config2);
|
|
679
|
+
if (itemDataset.issues) {
|
|
698
680
|
var pathItem = {
|
|
699
681
|
type: "array",
|
|
700
682
|
origin: "value",
|
|
@@ -702,774 +684,749 @@
|
|
|
702
684
|
key: key,
|
|
703
685
|
value: value2
|
|
704
686
|
};
|
|
705
|
-
var
|
|
706
|
-
|
|
687
|
+
var _iterator12 = _createForOfIteratorHelper(itemDataset.issues),
|
|
688
|
+
_step12;
|
|
707
689
|
try {
|
|
708
|
-
for (
|
|
709
|
-
var
|
|
710
|
-
var issue =
|
|
690
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
691
|
+
var _dataset$issues;
|
|
692
|
+
var issue = _step12.value;
|
|
711
693
|
if (issue.path) {
|
|
712
694
|
issue.path.unshift(pathItem);
|
|
713
695
|
} else {
|
|
714
696
|
issue.path = [pathItem];
|
|
715
697
|
}
|
|
716
|
-
(
|
|
698
|
+
(_dataset$issues = dataset.issues) === null || _dataset$issues === void 0 || _dataset$issues.push(issue);
|
|
717
699
|
}
|
|
718
700
|
} catch (err) {
|
|
719
|
-
|
|
701
|
+
_iterator12.e(err);
|
|
720
702
|
} finally {
|
|
721
|
-
|
|
703
|
+
_iterator12.f();
|
|
722
704
|
}
|
|
723
|
-
if (!issues) {
|
|
724
|
-
issues =
|
|
705
|
+
if (!dataset.issues) {
|
|
706
|
+
dataset.issues = itemDataset.issues;
|
|
725
707
|
}
|
|
726
|
-
if (
|
|
727
|
-
typed = false;
|
|
708
|
+
if (config2.abortEarly) {
|
|
709
|
+
dataset.typed = false;
|
|
728
710
|
break;
|
|
729
711
|
}
|
|
730
712
|
}
|
|
731
|
-
if (!
|
|
732
|
-
typed = false;
|
|
713
|
+
if (!itemDataset.typed) {
|
|
714
|
+
dataset.typed = false;
|
|
733
715
|
}
|
|
734
|
-
|
|
735
|
-
}
|
|
736
|
-
if (typed) {
|
|
737
|
-
return pipeResult(this, output, config, issues);
|
|
716
|
+
dataset.value.push(itemDataset.value);
|
|
738
717
|
}
|
|
739
|
-
|
|
718
|
+
} else {
|
|
719
|
+
_addIssue(this, "type", dataset, config2);
|
|
740
720
|
}
|
|
741
|
-
return
|
|
721
|
+
return dataset;
|
|
742
722
|
}
|
|
743
723
|
};
|
|
744
724
|
}
|
|
745
725
|
|
|
746
726
|
// src/schemas/boolean/boolean.ts
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
_defaultArgs18 = _slicedToArray(_defaultArgs17, 2),
|
|
750
|
-
message = _defaultArgs18[0],
|
|
751
|
-
pipe = _defaultArgs18[1];
|
|
727
|
+
// @__NO_SIDE_EFFECTS__
|
|
728
|
+
function _boolean(message2) {
|
|
752
729
|
return {
|
|
730
|
+
kind: "schema",
|
|
753
731
|
type: "boolean",
|
|
732
|
+
reference: _boolean,
|
|
754
733
|
expects: "boolean",
|
|
755
734
|
async: false,
|
|
756
|
-
message:
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
735
|
+
message: message2,
|
|
736
|
+
get "~standard"() {
|
|
737
|
+
return _getStandardProps(this);
|
|
738
|
+
},
|
|
739
|
+
"~run": function run(dataset, config2) {
|
|
740
|
+
if (typeof dataset.value === "boolean") {
|
|
741
|
+
dataset.typed = true;
|
|
742
|
+
} else {
|
|
743
|
+
_addIssue(this, "type", dataset, config2);
|
|
761
744
|
}
|
|
762
|
-
return
|
|
745
|
+
return dataset;
|
|
763
746
|
}
|
|
764
747
|
};
|
|
765
748
|
}
|
|
766
749
|
|
|
767
750
|
// src/schemas/instance/instance.ts
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
_defaultArgs26 = _slicedToArray(_defaultArgs25, 2),
|
|
771
|
-
message = _defaultArgs26[0],
|
|
772
|
-
pipe = _defaultArgs26[1];
|
|
751
|
+
// @__NO_SIDE_EFFECTS__
|
|
752
|
+
function instance(class_, message2) {
|
|
773
753
|
return {
|
|
754
|
+
kind: "schema",
|
|
774
755
|
type: "instance",
|
|
756
|
+
reference: instance,
|
|
775
757
|
expects: class_.name,
|
|
776
758
|
async: false,
|
|
777
759
|
"class": class_,
|
|
778
|
-
message:
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
760
|
+
message: message2,
|
|
761
|
+
get "~standard"() {
|
|
762
|
+
return _getStandardProps(this);
|
|
763
|
+
},
|
|
764
|
+
"~run": function run(dataset, config2) {
|
|
765
|
+
if (dataset.value instanceof this["class"]) {
|
|
766
|
+
dataset.typed = true;
|
|
767
|
+
} else {
|
|
768
|
+
_addIssue(this, "type", dataset, config2);
|
|
783
769
|
}
|
|
784
|
-
return
|
|
770
|
+
return dataset;
|
|
785
771
|
}
|
|
786
772
|
};
|
|
787
773
|
}
|
|
788
774
|
|
|
789
|
-
// src/schemas/intersect/utils/
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
775
|
+
// src/schemas/intersect/utils/_merge/_merge.ts
|
|
776
|
+
// @__NO_SIDE_EFFECTS__
|
|
777
|
+
function _merge(value1, value2) {
|
|
778
|
+
if (_typeof(value1) === _typeof(value2)) {
|
|
779
|
+
if (value1 === value2 || value1 instanceof Date && value2 instanceof Date && +value1 === +value2) {
|
|
793
780
|
return {
|
|
794
|
-
|
|
781
|
+
value: value1
|
|
795
782
|
};
|
|
796
783
|
}
|
|
797
|
-
if (
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
return result;
|
|
784
|
+
if (value1 && value2 && value1.constructor === Object && value2.constructor === Object) {
|
|
785
|
+
for (var key in value2) {
|
|
786
|
+
if (key in value1) {
|
|
787
|
+
var dataset = /* @__PURE__ */_merge(value1[key], value2[key]);
|
|
788
|
+
if (dataset.issue) {
|
|
789
|
+
return dataset;
|
|
804
790
|
}
|
|
805
|
-
|
|
791
|
+
value1[key] = dataset.value;
|
|
792
|
+
} else {
|
|
793
|
+
value1[key] = value2[key];
|
|
806
794
|
}
|
|
807
|
-
return {
|
|
808
|
-
output: array2
|
|
809
|
-
};
|
|
810
795
|
}
|
|
811
796
|
return {
|
|
812
|
-
|
|
797
|
+
value: value1
|
|
813
798
|
};
|
|
814
799
|
}
|
|
815
|
-
if (
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
return _result;
|
|
800
|
+
if (Array.isArray(value1) && Array.isArray(value2)) {
|
|
801
|
+
if (value1.length === value2.length) {
|
|
802
|
+
for (var index = 0; index < value1.length; index++) {
|
|
803
|
+
var _dataset = /* @__PURE__ */_merge(value1[index], value2[index]);
|
|
804
|
+
if (_dataset.issue) {
|
|
805
|
+
return _dataset;
|
|
822
806
|
}
|
|
823
|
-
|
|
807
|
+
value1[index] = _dataset.value;
|
|
824
808
|
}
|
|
809
|
+
return {
|
|
810
|
+
value: value1
|
|
811
|
+
};
|
|
825
812
|
}
|
|
826
|
-
return {
|
|
827
|
-
output: object2
|
|
828
|
-
};
|
|
829
813
|
}
|
|
830
814
|
}
|
|
831
815
|
return {
|
|
832
|
-
|
|
816
|
+
issue: true
|
|
833
817
|
};
|
|
834
818
|
}
|
|
835
819
|
|
|
836
820
|
// src/schemas/intersect/intersect.ts
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
_defaultArgs30 = _slicedToArray(_defaultArgs29, 2),
|
|
840
|
-
message = _defaultArgs30[0],
|
|
841
|
-
pipe = _defaultArgs30[1];
|
|
821
|
+
// @__NO_SIDE_EFFECTS__
|
|
822
|
+
function intersect(options, message2) {
|
|
842
823
|
return {
|
|
824
|
+
kind: "schema",
|
|
843
825
|
type: "intersect",
|
|
844
|
-
|
|
826
|
+
reference: intersect,
|
|
827
|
+
expects: _joinExpects(options.map(function (option) {
|
|
845
828
|
return option.expects;
|
|
846
|
-
})
|
|
829
|
+
}), "&"),
|
|
847
830
|
async: false,
|
|
848
831
|
options: options,
|
|
849
|
-
message:
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
832
|
+
message: message2,
|
|
833
|
+
get "~standard"() {
|
|
834
|
+
return _getStandardProps(this);
|
|
835
|
+
},
|
|
836
|
+
"~run": function run(dataset, config2) {
|
|
837
|
+
if (this.options.length) {
|
|
838
|
+
var input = dataset.value;
|
|
839
|
+
var outputs;
|
|
840
|
+
dataset.typed = true;
|
|
841
|
+
var _iterator14 = _createForOfIteratorHelper(this.options),
|
|
842
|
+
_step14;
|
|
843
|
+
try {
|
|
844
|
+
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
845
|
+
var schema = _step14.value;
|
|
846
|
+
var optionDataset = schema["~run"]({
|
|
847
|
+
value: input
|
|
848
|
+
}, config2);
|
|
849
|
+
if (optionDataset.issues) {
|
|
850
|
+
if (dataset.issues) {
|
|
851
|
+
var _dataset$issues3;
|
|
852
|
+
(_dataset$issues3 = dataset.issues).push.apply(_dataset$issues3, _toConsumableArray(optionDataset.issues));
|
|
853
|
+
} else {
|
|
854
|
+
dataset.issues = optionDataset.issues;
|
|
855
|
+
}
|
|
856
|
+
if (config2.abortEarly) {
|
|
857
|
+
dataset.typed = false;
|
|
858
|
+
break;
|
|
875
859
|
}
|
|
876
|
-
} else {
|
|
877
|
-
issues = _result2.issues;
|
|
878
860
|
}
|
|
879
|
-
if (
|
|
880
|
-
typed = false;
|
|
881
|
-
|
|
861
|
+
if (!optionDataset.typed) {
|
|
862
|
+
dataset.typed = false;
|
|
863
|
+
}
|
|
864
|
+
if (dataset.typed) {
|
|
865
|
+
if (outputs) {
|
|
866
|
+
outputs.push(optionDataset.value);
|
|
867
|
+
} else {
|
|
868
|
+
outputs = [optionDataset.value];
|
|
869
|
+
}
|
|
882
870
|
}
|
|
883
871
|
}
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
872
|
+
} catch (err) {
|
|
873
|
+
_iterator14.e(err);
|
|
874
|
+
} finally {
|
|
875
|
+
_iterator14.f();
|
|
876
|
+
}
|
|
877
|
+
if (dataset.typed) {
|
|
878
|
+
dataset.value = outputs[0];
|
|
879
|
+
for (var index = 1; index < outputs.length; index++) {
|
|
880
|
+
var mergeDataset = _merge(dataset.value, outputs[index]);
|
|
881
|
+
if (mergeDataset.issue) {
|
|
882
|
+
_addIssue(this, "type", dataset, config2, {
|
|
883
|
+
received: "unknown"
|
|
884
|
+
});
|
|
885
|
+
break;
|
|
886
|
+
}
|
|
887
|
+
dataset.value = mergeDataset.value;
|
|
900
888
|
}
|
|
901
|
-
output = result.output;
|
|
902
889
|
}
|
|
903
|
-
|
|
890
|
+
} else {
|
|
891
|
+
_addIssue(this, "type", dataset, config2);
|
|
904
892
|
}
|
|
905
|
-
return
|
|
893
|
+
return dataset;
|
|
906
894
|
}
|
|
907
895
|
};
|
|
908
896
|
}
|
|
909
897
|
|
|
910
898
|
// src/schemas/literal/literal.ts
|
|
911
|
-
|
|
899
|
+
// @__NO_SIDE_EFFECTS__
|
|
900
|
+
function literal(literal_, message2) {
|
|
912
901
|
return {
|
|
902
|
+
kind: "schema",
|
|
913
903
|
type: "literal",
|
|
914
|
-
|
|
904
|
+
reference: literal,
|
|
905
|
+
expects: _stringify(literal_),
|
|
915
906
|
async: false,
|
|
916
907
|
literal: literal_,
|
|
917
|
-
message:
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
908
|
+
message: message2,
|
|
909
|
+
get "~standard"() {
|
|
910
|
+
return _getStandardProps(this);
|
|
911
|
+
},
|
|
912
|
+
"~run": function run(dataset, config2) {
|
|
913
|
+
if (dataset.value === this.literal) {
|
|
914
|
+
dataset.typed = true;
|
|
915
|
+
} else {
|
|
916
|
+
_addIssue(this, "type", dataset, config2);
|
|
921
917
|
}
|
|
922
|
-
return
|
|
918
|
+
return dataset;
|
|
923
919
|
}
|
|
924
920
|
};
|
|
925
921
|
}
|
|
926
922
|
|
|
927
923
|
// src/schemas/nullable/nullable.ts
|
|
924
|
+
// @__NO_SIDE_EFFECTS__
|
|
928
925
|
function nullable(wrapped, default_) {
|
|
929
926
|
return {
|
|
927
|
+
kind: "schema",
|
|
930
928
|
type: "nullable",
|
|
931
|
-
|
|
929
|
+
reference: nullable,
|
|
930
|
+
expects: "(".concat(wrapped.expects, " | null)"),
|
|
932
931
|
async: false,
|
|
933
932
|
wrapped: wrapped,
|
|
934
933
|
"default": default_,
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
934
|
+
get "~standard"() {
|
|
935
|
+
return _getStandardProps(this);
|
|
936
|
+
},
|
|
937
|
+
"~run": function run(dataset, config2) {
|
|
938
|
+
if (dataset.value === null) {
|
|
939
|
+
if (this["default"] !== void 0) {
|
|
940
|
+
dataset.value = getDefault(this, dataset, config2);
|
|
941
|
+
}
|
|
942
|
+
if (dataset.value === null) {
|
|
943
|
+
dataset.typed = true;
|
|
944
|
+
return dataset;
|
|
940
945
|
}
|
|
941
|
-
input = override;
|
|
942
946
|
}
|
|
943
|
-
return this.wrapped
|
|
947
|
+
return this.wrapped["~run"](dataset, config2);
|
|
944
948
|
}
|
|
945
949
|
};
|
|
946
950
|
}
|
|
947
951
|
|
|
948
952
|
// src/schemas/number/number.ts
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
_defaultArgs38 = _slicedToArray(_defaultArgs37, 2),
|
|
952
|
-
message = _defaultArgs38[0],
|
|
953
|
-
pipe = _defaultArgs38[1];
|
|
953
|
+
// @__NO_SIDE_EFFECTS__
|
|
954
|
+
function number(message2) {
|
|
954
955
|
return {
|
|
956
|
+
kind: "schema",
|
|
955
957
|
type: "number",
|
|
958
|
+
reference: number,
|
|
956
959
|
expects: "number",
|
|
957
960
|
async: false,
|
|
958
|
-
message:
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
961
|
+
message: message2,
|
|
962
|
+
get "~standard"() {
|
|
963
|
+
return _getStandardProps(this);
|
|
964
|
+
},
|
|
965
|
+
"~run": function run(dataset, config2) {
|
|
966
|
+
if (typeof dataset.value === "number" && !isNaN(dataset.value)) {
|
|
967
|
+
dataset.typed = true;
|
|
968
|
+
} else {
|
|
969
|
+
_addIssue(this, "type", dataset, config2);
|
|
963
970
|
}
|
|
964
|
-
return
|
|
971
|
+
return dataset;
|
|
965
972
|
}
|
|
966
973
|
};
|
|
967
974
|
}
|
|
968
975
|
|
|
969
976
|
// src/schemas/object/object.ts
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
_restAndDefaultArgs2 = _slicedToArray(_restAndDefaultArgs, 3),
|
|
973
|
-
rest = _restAndDefaultArgs2[0],
|
|
974
|
-
message = _restAndDefaultArgs2[1],
|
|
975
|
-
pipe = _restAndDefaultArgs2[2];
|
|
976
|
-
var cachedEntries;
|
|
977
|
+
// @__NO_SIDE_EFFECTS__
|
|
978
|
+
function object(entries2, message2) {
|
|
977
979
|
return {
|
|
980
|
+
kind: "schema",
|
|
978
981
|
type: "object",
|
|
982
|
+
reference: object,
|
|
979
983
|
expects: "Object",
|
|
980
984
|
async: false,
|
|
981
|
-
entries:
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
985
|
+
entries: entries2,
|
|
986
|
+
message: message2,
|
|
987
|
+
get "~standard"() {
|
|
988
|
+
return _getStandardProps(this);
|
|
989
|
+
},
|
|
990
|
+
"~run": function run(dataset, config2) {
|
|
991
|
+
var input = dataset.value;
|
|
986
992
|
if (input && _typeof(input) === "object") {
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
var
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
var _pathItem3 = {
|
|
993
|
+
dataset.typed = true;
|
|
994
|
+
dataset.value = {};
|
|
995
|
+
for (var key in this.entries) {
|
|
996
|
+
var valueSchema = this.entries[key];
|
|
997
|
+
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") &&
|
|
998
|
+
// @ts-expect-error
|
|
999
|
+
valueSchema["default"] !== void 0) {
|
|
1000
|
+
var value2 = key in input ?
|
|
1001
|
+
// @ts-expect-error
|
|
1002
|
+
input[key] : getDefault(valueSchema);
|
|
1003
|
+
var valueDataset = valueSchema["~run"]({
|
|
1004
|
+
value: value2
|
|
1005
|
+
}, config2);
|
|
1006
|
+
if (valueDataset.issues) {
|
|
1007
|
+
var pathItem = {
|
|
1003
1008
|
type: "object",
|
|
1004
1009
|
origin: "value",
|
|
1005
1010
|
input: input,
|
|
1006
|
-
key:
|
|
1007
|
-
value:
|
|
1011
|
+
key: key,
|
|
1012
|
+
value: value2
|
|
1008
1013
|
};
|
|
1009
|
-
var
|
|
1010
|
-
|
|
1014
|
+
var _iterator28 = _createForOfIteratorHelper(valueDataset.issues),
|
|
1015
|
+
_step28;
|
|
1011
1016
|
try {
|
|
1012
|
-
for (
|
|
1013
|
-
var
|
|
1014
|
-
var
|
|
1015
|
-
if (
|
|
1016
|
-
|
|
1017
|
+
for (_iterator28.s(); !(_step28 = _iterator28.n()).done;) {
|
|
1018
|
+
var _dataset$issues11;
|
|
1019
|
+
var issue = _step28.value;
|
|
1020
|
+
if (issue.path) {
|
|
1021
|
+
issue.path.unshift(pathItem);
|
|
1017
1022
|
} else {
|
|
1018
|
-
|
|
1023
|
+
issue.path = [pathItem];
|
|
1019
1024
|
}
|
|
1020
|
-
(
|
|
1025
|
+
(_dataset$issues11 = dataset.issues) === null || _dataset$issues11 === void 0 || _dataset$issues11.push(issue);
|
|
1021
1026
|
}
|
|
1022
1027
|
} catch (err) {
|
|
1023
|
-
|
|
1028
|
+
_iterator28.e(err);
|
|
1024
1029
|
} finally {
|
|
1025
|
-
|
|
1030
|
+
_iterator28.f();
|
|
1026
1031
|
}
|
|
1027
|
-
if (!issues) {
|
|
1028
|
-
issues =
|
|
1032
|
+
if (!dataset.issues) {
|
|
1033
|
+
dataset.issues = valueDataset.issues;
|
|
1029
1034
|
}
|
|
1030
|
-
if (
|
|
1031
|
-
typed = false;
|
|
1035
|
+
if (config2.abortEarly) {
|
|
1036
|
+
dataset.typed = false;
|
|
1032
1037
|
break;
|
|
1033
1038
|
}
|
|
1034
1039
|
}
|
|
1035
|
-
if (!
|
|
1036
|
-
typed = false;
|
|
1037
|
-
}
|
|
1038
|
-
if (_result3.output !== void 0 || _key in input) {
|
|
1039
|
-
output[_key] = _result3.output;
|
|
1040
|
+
if (!valueDataset.typed) {
|
|
1041
|
+
dataset.typed = false;
|
|
1040
1042
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
};
|
|
1060
|
-
var _iterator17 = _createForOfIteratorHelper(result.issues),
|
|
1061
|
-
_step17;
|
|
1062
|
-
try {
|
|
1063
|
-
for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
|
|
1064
|
-
var _issues6;
|
|
1065
|
-
var issue = _step17.value;
|
|
1066
|
-
if (issue.path) {
|
|
1067
|
-
issue.path.unshift(pathItem);
|
|
1068
|
-
} else {
|
|
1069
|
-
issue.path = [pathItem];
|
|
1070
|
-
}
|
|
1071
|
-
(_issues6 = issues) === null || _issues6 === void 0 || _issues6.push(issue);
|
|
1072
|
-
}
|
|
1073
|
-
} catch (err) {
|
|
1074
|
-
_iterator17.e(err);
|
|
1075
|
-
} finally {
|
|
1076
|
-
_iterator17.f();
|
|
1077
|
-
}
|
|
1078
|
-
if (!issues) {
|
|
1079
|
-
issues = result.issues;
|
|
1080
|
-
}
|
|
1081
|
-
if (config !== null && config !== void 0 && config.abortEarly) {
|
|
1082
|
-
typed = false;
|
|
1083
|
-
break;
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1086
|
-
if (!result.typed) {
|
|
1087
|
-
typed = false;
|
|
1088
|
-
}
|
|
1089
|
-
output[key] = result.output;
|
|
1043
|
+
dataset.value[key] = valueDataset.value;
|
|
1044
|
+
} else if (valueSchema.fallback !== void 0) {
|
|
1045
|
+
dataset.value[key] = getFallback(valueSchema);
|
|
1046
|
+
} else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
1047
|
+
_addIssue(this, "key", dataset, config2, {
|
|
1048
|
+
input: void 0,
|
|
1049
|
+
expected: "\"".concat(key, "\""),
|
|
1050
|
+
path: [{
|
|
1051
|
+
type: "object",
|
|
1052
|
+
origin: "key",
|
|
1053
|
+
input: input,
|
|
1054
|
+
key: key,
|
|
1055
|
+
// @ts-expect-error
|
|
1056
|
+
value: input[key]
|
|
1057
|
+
}]
|
|
1058
|
+
});
|
|
1059
|
+
if (config2.abortEarly) {
|
|
1060
|
+
break;
|
|
1090
1061
|
}
|
|
1091
1062
|
}
|
|
1092
1063
|
}
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
}
|
|
1096
|
-
return schemaResult(false, output, issues);
|
|
1064
|
+
} else {
|
|
1065
|
+
_addIssue(this, "type", dataset, config2);
|
|
1097
1066
|
}
|
|
1098
|
-
return
|
|
1067
|
+
return dataset;
|
|
1099
1068
|
}
|
|
1100
1069
|
};
|
|
1101
1070
|
}
|
|
1102
1071
|
|
|
1103
1072
|
// src/schemas/optional/optional.ts
|
|
1073
|
+
// @__NO_SIDE_EFFECTS__
|
|
1104
1074
|
function optional(wrapped, default_) {
|
|
1105
1075
|
return {
|
|
1076
|
+
kind: "schema",
|
|
1106
1077
|
type: "optional",
|
|
1107
|
-
|
|
1078
|
+
reference: optional,
|
|
1079
|
+
expects: "(".concat(wrapped.expects, " | undefined)"),
|
|
1108
1080
|
async: false,
|
|
1109
1081
|
wrapped: wrapped,
|
|
1110
1082
|
"default": default_,
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1083
|
+
get "~standard"() {
|
|
1084
|
+
return _getStandardProps(this);
|
|
1085
|
+
},
|
|
1086
|
+
"~run": function run(dataset, config2) {
|
|
1087
|
+
if (dataset.value === void 0) {
|
|
1088
|
+
if (this["default"] !== void 0) {
|
|
1089
|
+
dataset.value = getDefault(this, dataset, config2);
|
|
1090
|
+
}
|
|
1091
|
+
if (dataset.value === void 0) {
|
|
1092
|
+
dataset.typed = true;
|
|
1093
|
+
return dataset;
|
|
1116
1094
|
}
|
|
1117
|
-
input = override;
|
|
1118
|
-
}
|
|
1119
|
-
return this.wrapped._parse(input, config);
|
|
1120
|
-
}
|
|
1121
|
-
};
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
// src/schemas/string/string.ts
|
|
1125
|
-
function string(arg1, arg2) {
|
|
1126
|
-
var _defaultArgs41 = defaultArgs(arg1, arg2),
|
|
1127
|
-
_defaultArgs42 = _slicedToArray(_defaultArgs41, 2),
|
|
1128
|
-
message = _defaultArgs42[0],
|
|
1129
|
-
pipe = _defaultArgs42[1];
|
|
1130
|
-
return {
|
|
1131
|
-
type: "string",
|
|
1132
|
-
expects: "string",
|
|
1133
|
-
async: false,
|
|
1134
|
-
message: message,
|
|
1135
|
-
pipe: pipe,
|
|
1136
|
-
_parse: function _parse(input, config) {
|
|
1137
|
-
if (typeof input === "string") {
|
|
1138
|
-
return pipeResult(this, input, config);
|
|
1139
1095
|
}
|
|
1140
|
-
return
|
|
1096
|
+
return this.wrapped["~run"](dataset, config2);
|
|
1141
1097
|
}
|
|
1142
1098
|
};
|
|
1143
1099
|
}
|
|
1144
1100
|
|
|
1145
|
-
// src/schemas/record/utils/recordArgs/recordArgs.ts
|
|
1146
|
-
function recordArgs(arg1, arg2, arg3, arg4) {
|
|
1147
|
-
if (_typeof(arg2) === "object" && !Array.isArray(arg2)) {
|
|
1148
|
-
var _defaultArgs45 = defaultArgs(arg3, arg4),
|
|
1149
|
-
_defaultArgs46 = _slicedToArray(_defaultArgs45, 2),
|
|
1150
|
-
message2 = _defaultArgs46[0],
|
|
1151
|
-
pipe2 = _defaultArgs46[1];
|
|
1152
|
-
return [arg1, arg2, message2, pipe2];
|
|
1153
|
-
}
|
|
1154
|
-
var _defaultArgs47 = defaultArgs(arg2, arg3),
|
|
1155
|
-
_defaultArgs48 = _slicedToArray(_defaultArgs47, 2),
|
|
1156
|
-
message = _defaultArgs48[0],
|
|
1157
|
-
pipe = _defaultArgs48[1];
|
|
1158
|
-
return [string(), arg1, message, pipe];
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
// src/schemas/record/values.ts
|
|
1162
|
-
var BLOCKED_KEYS = ["__proto__", "prototype", "constructor"];
|
|
1163
|
-
|
|
1164
1101
|
// src/schemas/record/record.ts
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
_recordArgs2 = _slicedToArray(_recordArgs, 4),
|
|
1168
|
-
key = _recordArgs2[0],
|
|
1169
|
-
value2 = _recordArgs2[1],
|
|
1170
|
-
message = _recordArgs2[2],
|
|
1171
|
-
pipe = _recordArgs2[3];
|
|
1102
|
+
// @__NO_SIDE_EFFECTS__
|
|
1103
|
+
function record(key, value2, message2) {
|
|
1172
1104
|
return {
|
|
1105
|
+
kind: "schema",
|
|
1173
1106
|
type: "record",
|
|
1107
|
+
reference: record,
|
|
1174
1108
|
expects: "Object",
|
|
1175
1109
|
async: false,
|
|
1176
1110
|
key: key,
|
|
1177
1111
|
value: value2,
|
|
1178
|
-
message:
|
|
1179
|
-
|
|
1180
|
-
|
|
1112
|
+
message: message2,
|
|
1113
|
+
get "~standard"() {
|
|
1114
|
+
return _getStandardProps(this);
|
|
1115
|
+
},
|
|
1116
|
+
"~run": function run(dataset, config2) {
|
|
1117
|
+
var input = dataset.value;
|
|
1181
1118
|
if (input && _typeof(input) === "object") {
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
var
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
pathItem = {
|
|
1194
|
-
type: "record",
|
|
1119
|
+
dataset.typed = true;
|
|
1120
|
+
dataset.value = {};
|
|
1121
|
+
for (var entryKey in input) {
|
|
1122
|
+
if (_isValidObjectKey(input, entryKey)) {
|
|
1123
|
+
var entryValue = input[entryKey];
|
|
1124
|
+
var keyDataset = this.key["~run"]({
|
|
1125
|
+
value: entryKey
|
|
1126
|
+
}, config2);
|
|
1127
|
+
if (keyDataset.issues) {
|
|
1128
|
+
var pathItem = {
|
|
1129
|
+
type: "object",
|
|
1195
1130
|
origin: "key",
|
|
1196
1131
|
input: input,
|
|
1197
|
-
key:
|
|
1198
|
-
value:
|
|
1132
|
+
key: entryKey,
|
|
1133
|
+
value: entryValue
|
|
1199
1134
|
};
|
|
1200
|
-
var
|
|
1201
|
-
|
|
1135
|
+
var _iterator37 = _createForOfIteratorHelper(keyDataset.issues),
|
|
1136
|
+
_step37;
|
|
1202
1137
|
try {
|
|
1203
|
-
for (
|
|
1204
|
-
var
|
|
1205
|
-
var issue =
|
|
1138
|
+
for (_iterator37.s(); !(_step37 = _iterator37.n()).done;) {
|
|
1139
|
+
var _dataset$issues17;
|
|
1140
|
+
var issue = _step37.value;
|
|
1206
1141
|
issue.path = [pathItem];
|
|
1207
|
-
(
|
|
1142
|
+
(_dataset$issues17 = dataset.issues) === null || _dataset$issues17 === void 0 || _dataset$issues17.push(issue);
|
|
1208
1143
|
}
|
|
1209
1144
|
} catch (err) {
|
|
1210
|
-
|
|
1145
|
+
_iterator37.e(err);
|
|
1211
1146
|
} finally {
|
|
1212
|
-
|
|
1147
|
+
_iterator37.f();
|
|
1213
1148
|
}
|
|
1214
|
-
if (!issues) {
|
|
1215
|
-
issues =
|
|
1149
|
+
if (!dataset.issues) {
|
|
1150
|
+
dataset.issues = keyDataset.issues;
|
|
1216
1151
|
}
|
|
1217
|
-
if (
|
|
1218
|
-
typed = false;
|
|
1152
|
+
if (config2.abortEarly) {
|
|
1153
|
+
dataset.typed = false;
|
|
1219
1154
|
break;
|
|
1220
1155
|
}
|
|
1221
1156
|
}
|
|
1222
|
-
var
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1157
|
+
var valueDataset = this.value["~run"]({
|
|
1158
|
+
value: entryValue
|
|
1159
|
+
}, config2);
|
|
1160
|
+
if (valueDataset.issues) {
|
|
1161
|
+
var _pathItem5 = {
|
|
1162
|
+
type: "object",
|
|
1227
1163
|
origin: "value",
|
|
1228
1164
|
input: input,
|
|
1229
|
-
key:
|
|
1230
|
-
value:
|
|
1165
|
+
key: entryKey,
|
|
1166
|
+
value: entryValue
|
|
1231
1167
|
};
|
|
1232
|
-
var
|
|
1233
|
-
|
|
1168
|
+
var _iterator38 = _createForOfIteratorHelper(valueDataset.issues),
|
|
1169
|
+
_step38;
|
|
1234
1170
|
try {
|
|
1235
|
-
for (
|
|
1236
|
-
var
|
|
1237
|
-
var
|
|
1238
|
-
if (
|
|
1239
|
-
|
|
1171
|
+
for (_iterator38.s(); !(_step38 = _iterator38.n()).done;) {
|
|
1172
|
+
var _dataset$issues18;
|
|
1173
|
+
var _issue5 = _step38.value;
|
|
1174
|
+
if (_issue5.path) {
|
|
1175
|
+
_issue5.path.unshift(_pathItem5);
|
|
1240
1176
|
} else {
|
|
1241
|
-
|
|
1177
|
+
_issue5.path = [_pathItem5];
|
|
1242
1178
|
}
|
|
1243
|
-
(
|
|
1179
|
+
(_dataset$issues18 = dataset.issues) === null || _dataset$issues18 === void 0 || _dataset$issues18.push(_issue5);
|
|
1244
1180
|
}
|
|
1245
1181
|
} catch (err) {
|
|
1246
|
-
|
|
1182
|
+
_iterator38.e(err);
|
|
1247
1183
|
} finally {
|
|
1248
|
-
|
|
1184
|
+
_iterator38.f();
|
|
1249
1185
|
}
|
|
1250
|
-
if (!issues) {
|
|
1251
|
-
issues =
|
|
1186
|
+
if (!dataset.issues) {
|
|
1187
|
+
dataset.issues = valueDataset.issues;
|
|
1252
1188
|
}
|
|
1253
|
-
if (
|
|
1254
|
-
typed = false;
|
|
1189
|
+
if (config2.abortEarly) {
|
|
1190
|
+
dataset.typed = false;
|
|
1255
1191
|
break;
|
|
1256
1192
|
}
|
|
1257
1193
|
}
|
|
1258
|
-
if (!
|
|
1259
|
-
typed = false;
|
|
1194
|
+
if (!keyDataset.typed || !valueDataset.typed) {
|
|
1195
|
+
dataset.typed = false;
|
|
1260
1196
|
}
|
|
1261
|
-
if (
|
|
1262
|
-
|
|
1197
|
+
if (keyDataset.typed) {
|
|
1198
|
+
dataset.value[keyDataset.value] = valueDataset.value;
|
|
1263
1199
|
}
|
|
1264
1200
|
}
|
|
1265
1201
|
}
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1202
|
+
} else {
|
|
1203
|
+
_addIssue(this, "type", dataset, config2);
|
|
1204
|
+
}
|
|
1205
|
+
return dataset;
|
|
1206
|
+
}
|
|
1207
|
+
};
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
// src/schemas/string/string.ts
|
|
1211
|
+
// @__NO_SIDE_EFFECTS__
|
|
1212
|
+
function string(message2) {
|
|
1213
|
+
return {
|
|
1214
|
+
kind: "schema",
|
|
1215
|
+
type: "string",
|
|
1216
|
+
reference: string,
|
|
1217
|
+
expects: "string",
|
|
1218
|
+
async: false,
|
|
1219
|
+
message: message2,
|
|
1220
|
+
get "~standard"() {
|
|
1221
|
+
return _getStandardProps(this);
|
|
1222
|
+
},
|
|
1223
|
+
"~run": function run(dataset, config2) {
|
|
1224
|
+
if (typeof dataset.value === "string") {
|
|
1225
|
+
dataset.typed = true;
|
|
1226
|
+
} else {
|
|
1227
|
+
_addIssue(this, "type", dataset, config2);
|
|
1270
1228
|
}
|
|
1271
|
-
return
|
|
1229
|
+
return dataset;
|
|
1272
1230
|
}
|
|
1273
1231
|
};
|
|
1274
1232
|
}
|
|
1275
1233
|
|
|
1276
|
-
// src/schemas/union/utils/
|
|
1277
|
-
|
|
1234
|
+
// src/schemas/union/utils/_subIssues/_subIssues.ts
|
|
1235
|
+
// @__NO_SIDE_EFFECTS__
|
|
1236
|
+
function _subIssues(datasets) {
|
|
1278
1237
|
var issues;
|
|
1279
|
-
if (
|
|
1280
|
-
var
|
|
1281
|
-
|
|
1238
|
+
if (datasets) {
|
|
1239
|
+
var _iterator61 = _createForOfIteratorHelper(datasets),
|
|
1240
|
+
_step61;
|
|
1282
1241
|
try {
|
|
1283
|
-
for (
|
|
1284
|
-
var
|
|
1242
|
+
for (_iterator61.s(); !(_step61 = _iterator61.n()).done;) {
|
|
1243
|
+
var dataset = _step61.value;
|
|
1285
1244
|
if (issues) {
|
|
1286
|
-
var
|
|
1287
|
-
|
|
1288
|
-
try {
|
|
1289
|
-
for (_iterator32.s(); !(_step32 = _iterator32.n()).done;) {
|
|
1290
|
-
var issue = _step32.value;
|
|
1291
|
-
issues.push(issue);
|
|
1292
|
-
}
|
|
1293
|
-
} catch (err) {
|
|
1294
|
-
_iterator32.e(err);
|
|
1295
|
-
} finally {
|
|
1296
|
-
_iterator32.f();
|
|
1297
|
-
}
|
|
1245
|
+
var _issues;
|
|
1246
|
+
(_issues = issues).push.apply(_issues, _toConsumableArray(dataset.issues));
|
|
1298
1247
|
} else {
|
|
1299
|
-
issues =
|
|
1248
|
+
issues = dataset.issues;
|
|
1300
1249
|
}
|
|
1301
1250
|
}
|
|
1302
1251
|
} catch (err) {
|
|
1303
|
-
|
|
1252
|
+
_iterator61.e(err);
|
|
1304
1253
|
} finally {
|
|
1305
|
-
|
|
1254
|
+
_iterator61.f();
|
|
1306
1255
|
}
|
|
1307
1256
|
}
|
|
1308
1257
|
return issues;
|
|
1309
1258
|
}
|
|
1310
1259
|
|
|
1311
1260
|
// src/schemas/union/union.ts
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
_defaultArgs58 = _slicedToArray(_defaultArgs57, 2),
|
|
1315
|
-
message = _defaultArgs58[0],
|
|
1316
|
-
pipe = _defaultArgs58[1];
|
|
1261
|
+
// @__NO_SIDE_EFFECTS__
|
|
1262
|
+
function union(options, message2) {
|
|
1317
1263
|
return {
|
|
1264
|
+
kind: "schema",
|
|
1318
1265
|
type: "union",
|
|
1319
|
-
|
|
1266
|
+
reference: union,
|
|
1267
|
+
expects: _joinExpects(options.map(function (option) {
|
|
1320
1268
|
return option.expects;
|
|
1321
|
-
})
|
|
1269
|
+
}), "|"),
|
|
1322
1270
|
async: false,
|
|
1323
1271
|
options: options,
|
|
1324
|
-
message:
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
var
|
|
1330
|
-
var
|
|
1331
|
-
var
|
|
1332
|
-
|
|
1272
|
+
message: message2,
|
|
1273
|
+
get "~standard"() {
|
|
1274
|
+
return _getStandardProps(this);
|
|
1275
|
+
},
|
|
1276
|
+
"~run": function run(dataset, config2) {
|
|
1277
|
+
var _untypedDatasets;
|
|
1278
|
+
var validDataset;
|
|
1279
|
+
var typedDatasets;
|
|
1280
|
+
var untypedDatasets;
|
|
1281
|
+
var _iterator62 = _createForOfIteratorHelper(this.options),
|
|
1282
|
+
_step62;
|
|
1333
1283
|
try {
|
|
1334
|
-
for (
|
|
1335
|
-
var schema =
|
|
1336
|
-
var
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1284
|
+
for (_iterator62.s(); !(_step62 = _iterator62.n()).done;) {
|
|
1285
|
+
var schema = _step62.value;
|
|
1286
|
+
var optionDataset = schema["~run"]({
|
|
1287
|
+
value: dataset.value
|
|
1288
|
+
}, config2);
|
|
1289
|
+
if (optionDataset.typed) {
|
|
1290
|
+
if (optionDataset.issues) {
|
|
1291
|
+
if (typedDatasets) {
|
|
1292
|
+
typedDatasets.push(optionDataset);
|
|
1293
|
+
} else {
|
|
1294
|
+
typedDatasets = [optionDataset];
|
|
1295
|
+
}
|
|
1341
1296
|
} else {
|
|
1342
|
-
|
|
1297
|
+
validDataset = optionDataset;
|
|
1298
|
+
break;
|
|
1343
1299
|
}
|
|
1344
1300
|
} else {
|
|
1345
|
-
|
|
1301
|
+
if (untypedDatasets) {
|
|
1302
|
+
untypedDatasets.push(optionDataset);
|
|
1303
|
+
} else {
|
|
1304
|
+
untypedDatasets = [optionDataset];
|
|
1305
|
+
}
|
|
1346
1306
|
}
|
|
1347
1307
|
}
|
|
1348
1308
|
} catch (err) {
|
|
1349
|
-
|
|
1309
|
+
_iterator62.e(err);
|
|
1350
1310
|
} finally {
|
|
1351
|
-
|
|
1311
|
+
_iterator62.f();
|
|
1352
1312
|
}
|
|
1353
|
-
if (
|
|
1354
|
-
return
|
|
1313
|
+
if (validDataset) {
|
|
1314
|
+
return validDataset;
|
|
1355
1315
|
}
|
|
1356
|
-
if (
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
|
|
1316
|
+
if (typedDatasets) {
|
|
1317
|
+
if (typedDatasets.length === 1) {
|
|
1318
|
+
return typedDatasets[0];
|
|
1319
|
+
}
|
|
1320
|
+
_addIssue(this, "type", dataset, config2, {
|
|
1321
|
+
issues: _subIssues(typedDatasets)
|
|
1322
|
+
});
|
|
1323
|
+
dataset.typed = true;
|
|
1324
|
+
} else if (((_untypedDatasets = untypedDatasets) === null || _untypedDatasets === void 0 ? void 0 : _untypedDatasets.length) === 1) {
|
|
1325
|
+
return untypedDatasets[0];
|
|
1326
|
+
} else {
|
|
1327
|
+
_addIssue(this, "type", dataset, config2, {
|
|
1328
|
+
issues: _subIssues(untypedDatasets)
|
|
1329
|
+
});
|
|
1369
1330
|
}
|
|
1370
|
-
return
|
|
1371
|
-
issues: subissues(untypedResults)
|
|
1372
|
-
});
|
|
1331
|
+
return dataset;
|
|
1373
1332
|
}
|
|
1374
1333
|
};
|
|
1375
1334
|
}
|
|
1376
1335
|
|
|
1377
1336
|
// src/schemas/unknown/unknown.ts
|
|
1378
|
-
|
|
1337
|
+
// @__NO_SIDE_EFFECTS__
|
|
1338
|
+
function unknown() {
|
|
1379
1339
|
return {
|
|
1340
|
+
kind: "schema",
|
|
1380
1341
|
type: "unknown",
|
|
1342
|
+
reference: unknown,
|
|
1381
1343
|
expects: "unknown",
|
|
1382
1344
|
async: false,
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1345
|
+
get "~standard"() {
|
|
1346
|
+
return _getStandardProps(this);
|
|
1347
|
+
},
|
|
1348
|
+
"~run": function run(dataset) {
|
|
1349
|
+
dataset.typed = true;
|
|
1350
|
+
return dataset;
|
|
1386
1351
|
}
|
|
1387
1352
|
};
|
|
1388
1353
|
}
|
|
1389
1354
|
|
|
1390
1355
|
// src/methods/omit/omit.ts
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1356
|
+
// @__NO_SIDE_EFFECTS__
|
|
1357
|
+
function omit(schema, keys) {
|
|
1358
|
+
var entries2 = _objectSpread2({}, schema.entries);
|
|
1359
|
+
var _iterator68 = _createForOfIteratorHelper(keys),
|
|
1360
|
+
_step68;
|
|
1361
|
+
try {
|
|
1362
|
+
for (_iterator68.s(); !(_step68 = _iterator68.n()).done;) {
|
|
1363
|
+
var key = _step68.value;
|
|
1364
|
+
delete entries2[key];
|
|
1365
|
+
}
|
|
1366
|
+
} catch (err) {
|
|
1367
|
+
_iterator68.e(err);
|
|
1368
|
+
} finally {
|
|
1369
|
+
_iterator68.f();
|
|
1370
|
+
}
|
|
1371
|
+
return _objectSpread2(_objectSpread2({}, schema), {}, {
|
|
1372
|
+
entries: entries2,
|
|
1373
|
+
get "~standard"() {
|
|
1374
|
+
return _getStandardProps(this);
|
|
1375
|
+
}
|
|
1376
|
+
});
|
|
1403
1377
|
}
|
|
1404
1378
|
|
|
1405
1379
|
// src/methods/parse/parse.ts
|
|
1406
|
-
function parse(schema, input,
|
|
1407
|
-
var
|
|
1408
|
-
|
|
1409
|
-
|
|
1380
|
+
function parse(schema, input, config2) {
|
|
1381
|
+
var dataset = schema["~run"]({
|
|
1382
|
+
value: input
|
|
1383
|
+
}, getGlobalConfig(config2));
|
|
1384
|
+
if (dataset.issues) {
|
|
1385
|
+
throw new ValiError(dataset.issues);
|
|
1410
1386
|
}
|
|
1411
|
-
return
|
|
1387
|
+
return dataset.value;
|
|
1412
1388
|
}
|
|
1413
1389
|
|
|
1414
|
-
// src/methods/
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
return actionIssue(this, custom, input, "input");
|
|
1438
|
-
}
|
|
1439
|
-
};
|
|
1440
|
-
}
|
|
1441
|
-
|
|
1442
|
-
// src/validations/notValue/notValue.ts
|
|
1443
|
-
function notValue(requirement, message) {
|
|
1444
|
-
return {
|
|
1445
|
-
type: "not_value",
|
|
1446
|
-
expects: "!".concat(requirement instanceof Date ? requirement.toJSON() : stringify(requirement)),
|
|
1447
|
-
async: false,
|
|
1448
|
-
message: message,
|
|
1449
|
-
requirement: requirement,
|
|
1450
|
-
_parse: function _parse(input) {
|
|
1451
|
-
if (input < this.requirement || input > this.requirement) {
|
|
1452
|
-
return actionOutput(input);
|
|
1390
|
+
// src/methods/pipe/pipe.ts
|
|
1391
|
+
// @__NO_SIDE_EFFECTS__
|
|
1392
|
+
function pipe() {
|
|
1393
|
+
for (var _len3 = arguments.length, pipe2 = new Array(_len3), _key11 = 0; _key11 < _len3; _key11++) {
|
|
1394
|
+
pipe2[_key11] = arguments[_key11];
|
|
1395
|
+
}
|
|
1396
|
+
return _objectSpread2(_objectSpread2({}, pipe2[0]), {}, {
|
|
1397
|
+
pipe: pipe2,
|
|
1398
|
+
get "~standard"() {
|
|
1399
|
+
return _getStandardProps(this);
|
|
1400
|
+
},
|
|
1401
|
+
"~run": function run(dataset, config2) {
|
|
1402
|
+
for (var _i2 = 0, _pipe = pipe2; _i2 < _pipe.length; _i2++) {
|
|
1403
|
+
var item = _pipe[_i2];
|
|
1404
|
+
if (item.kind !== "metadata") {
|
|
1405
|
+
if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
|
|
1406
|
+
dataset.typed = false;
|
|
1407
|
+
break;
|
|
1408
|
+
}
|
|
1409
|
+
if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) {
|
|
1410
|
+
dataset = item["~run"](dataset, config2);
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1453
1413
|
}
|
|
1454
|
-
return
|
|
1414
|
+
return dataset;
|
|
1455
1415
|
}
|
|
1456
|
-
};
|
|
1416
|
+
});
|
|
1457
1417
|
}
|
|
1458
1418
|
|
|
1459
|
-
// src/
|
|
1460
|
-
|
|
1419
|
+
// src/methods/safeParse/safeParse.ts
|
|
1420
|
+
// @__NO_SIDE_EFFECTS__
|
|
1421
|
+
function safeParse(schema, input, config2) {
|
|
1422
|
+
var dataset = schema["~run"]({
|
|
1423
|
+
value: input
|
|
1424
|
+
}, getGlobalConfig(config2));
|
|
1461
1425
|
return {
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
requirement: requirement,
|
|
1467
|
-
_parse: function _parse(input) {
|
|
1468
|
-
if (this.requirement.test(input)) {
|
|
1469
|
-
return actionOutput(input);
|
|
1470
|
-
}
|
|
1471
|
-
return actionIssue(this, regex, input, "format");
|
|
1472
|
-
}
|
|
1426
|
+
typed: dataset.typed,
|
|
1427
|
+
success: !dataset.issues,
|
|
1428
|
+
output: dataset.value,
|
|
1429
|
+
issues: dataset.issues
|
|
1473
1430
|
};
|
|
1474
1431
|
}
|
|
1475
1432
|
|
|
@@ -1514,7 +1471,7 @@
|
|
|
1514
1471
|
});
|
|
1515
1472
|
const ZRawApiResponse = union([
|
|
1516
1473
|
object({ chat: ZApiChat }),
|
|
1517
|
-
record(string(
|
|
1474
|
+
record(pipe(string(), notValue("chat")), unknown()),
|
|
1518
1475
|
]);
|
|
1519
1476
|
const ZApiPing = object({
|
|
1520
1477
|
content: string(),
|
|
@@ -1603,11 +1560,6 @@
|
|
|
1603
1560
|
literal("gulim"),
|
|
1604
1561
|
literal("simsun"),
|
|
1605
1562
|
]);
|
|
1606
|
-
union([
|
|
1607
|
-
literal("defont"),
|
|
1608
|
-
literal("mincho"),
|
|
1609
|
-
literal("gothic"),
|
|
1610
|
-
]);
|
|
1611
1563
|
const ZCommentFlashFont = union([
|
|
1612
1564
|
literal("defont"),
|
|
1613
1565
|
literal("gulim"),
|
|
@@ -1754,17 +1706,15 @@
|
|
|
1754
1706
|
chatItem: (i) => is(ZXml2jsChatItem, i),
|
|
1755
1707
|
},
|
|
1756
1708
|
legacyOwner: {
|
|
1757
|
-
comments: (i) => is(string(
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
return false;
|
|
1763
|
-
}
|
|
1709
|
+
comments: (i) => is(pipe(string(), check((i) => {
|
|
1710
|
+
const lists = i.split(/\r\n|\r|\n/);
|
|
1711
|
+
for (const list of lists) {
|
|
1712
|
+
if (list.split(":").length < 3) {
|
|
1713
|
+
return false;
|
|
1764
1714
|
}
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1715
|
+
}
|
|
1716
|
+
return true;
|
|
1717
|
+
})), i),
|
|
1768
1718
|
},
|
|
1769
1719
|
owner: {
|
|
1770
1720
|
comment: (i) => is(ZOwnerComment, i),
|
|
@@ -1798,11 +1748,9 @@
|
|
|
1798
1748
|
literal("invisible"),
|
|
1799
1749
|
]), i),
|
|
1800
1750
|
},
|
|
1801
|
-
color: (i) => is(string(
|
|
1802
|
-
colorCode: (i) => is(string(
|
|
1803
|
-
colorCodeAllowAlpha: (i) => is(string([
|
|
1804
|
-
regex(/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/),
|
|
1805
|
-
]), i),
|
|
1751
|
+
color: (i) => is(pipe(string(), check((i) => Object.keys(colors).includes(i))), i),
|
|
1752
|
+
colorCode: (i) => is(pipe(string(), regex(/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6})$/)), i),
|
|
1753
|
+
colorCodeAllowAlpha: (i) => is(pipe(string(), regex(/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/)), i),
|
|
1806
1754
|
},
|
|
1807
1755
|
config: {
|
|
1808
1756
|
initOptions: (item) => {
|
|
@@ -1957,6 +1905,7 @@
|
|
|
1957
1905
|
strokeColor: commands.strokeColor,
|
|
1958
1906
|
wakuColor: commands.wakuColor,
|
|
1959
1907
|
fillColor: commands.fillColor,
|
|
1908
|
+
opacity: commands.opacity,
|
|
1960
1909
|
button: commands.button,
|
|
1961
1910
|
};
|
|
1962
1911
|
};
|
|
@@ -2080,15 +2029,16 @@
|
|
|
2080
2029
|
};
|
|
2081
2030
|
const processReverseScript = (comment, commands) => {
|
|
2082
2031
|
const reverse = RegExp(/^[@\uff20]\u9006(?:\s+)?(\u5168|\u30b3\u30e1|\u6295\u30b3\u30e1)?/).exec(comment.content);
|
|
2083
|
-
|
|
2084
|
-
|
|
2032
|
+
const target = typeGuard.nicoScript.range.target(reverse?.[1])
|
|
2033
|
+
? reverse?.[1]
|
|
2034
|
+
: "全";
|
|
2085
2035
|
if (commands.long === undefined) {
|
|
2086
2036
|
commands.long = 30;
|
|
2087
2037
|
}
|
|
2088
2038
|
nicoScripts.reverse.unshift({
|
|
2089
2039
|
start: comment.vpos,
|
|
2090
2040
|
end: comment.vpos + commands.long * 100,
|
|
2091
|
-
target
|
|
2041
|
+
target,
|
|
2092
2042
|
});
|
|
2093
2043
|
};
|
|
2094
2044
|
const processBanScript = (comment, commands) => {
|
|
@@ -2113,9 +2063,12 @@
|
|
|
2113
2063
|
const options = RegExp(/\s*((?:sm|so|nm|\uff53\uff4d|\uff53\uff4f|\uff4e\uff4d)?[1-9\uff11-\uff19][0-9\uff11-\uff19]*|#[0-9]+:[0-9]+(?:\.[0-9]+)?)\s+(.*)/).exec(input);
|
|
2114
2064
|
if (!options?.[1])
|
|
2115
2065
|
return;
|
|
2066
|
+
const end = commands.long === undefined
|
|
2067
|
+
? undefined
|
|
2068
|
+
: commands.long * 100 + comment.vpos;
|
|
2116
2069
|
nicoScripts.jump.unshift({
|
|
2117
2070
|
start: comment.vpos,
|
|
2118
|
-
end
|
|
2071
|
+
end,
|
|
2119
2072
|
to: options[1],
|
|
2120
2073
|
message: options[2],
|
|
2121
2074
|
});
|
|
@@ -2188,6 +2141,11 @@
|
|
|
2188
2141
|
result.fillColor ??= fillColor;
|
|
2189
2142
|
return;
|
|
2190
2143
|
}
|
|
2144
|
+
const opacity = getOpacity(RegExp(/^nico:opacity:(.+)$/).exec(command));
|
|
2145
|
+
if (typeof opacity === "number") {
|
|
2146
|
+
result.opacity ??= opacity;
|
|
2147
|
+
return;
|
|
2148
|
+
}
|
|
2191
2149
|
if (is(ZCommentLoc, command)) {
|
|
2192
2150
|
result.loc ??= command;
|
|
2193
2151
|
return;
|
|
@@ -2226,6 +2184,15 @@
|
|
|
2226
2184
|
}
|
|
2227
2185
|
return;
|
|
2228
2186
|
};
|
|
2187
|
+
const getOpacity = (match) => {
|
|
2188
|
+
if (!match)
|
|
2189
|
+
return;
|
|
2190
|
+
const value = Number(match[1]);
|
|
2191
|
+
if (!Number.isNaN(value) && value >= 0) {
|
|
2192
|
+
return value;
|
|
2193
|
+
}
|
|
2194
|
+
return;
|
|
2195
|
+
};
|
|
2229
2196
|
const isFlashComment = (comment) => options.mode === "flash" ||
|
|
2230
2197
|
(options.mode === "default" &&
|
|
2231
2198
|
!(comment.mail.includes("gothic") ||
|
|
@@ -2428,11 +2395,13 @@
|
|
|
2428
2395
|
comment.mail.includes("patissier") ||
|
|
2429
2396
|
comment.mail.includes("ender") ||
|
|
2430
2397
|
comment.mail.includes("full")) {
|
|
2431
|
-
userScoreList[comment.user_id]
|
|
2398
|
+
userScoreList[comment.user_id] =
|
|
2399
|
+
(userScoreList[comment.user_id] ?? 0) + 5;
|
|
2432
2400
|
}
|
|
2433
2401
|
const lineCount = (comment.content.match(/\r\n|\n|\r/g) ?? []).length;
|
|
2434
2402
|
if (lineCount > 2) {
|
|
2435
|
-
userScoreList[comment.user_id]
|
|
2403
|
+
userScoreList[comment.user_id] =
|
|
2404
|
+
(userScoreList[comment.user_id] ?? 0) + lineCount / 2;
|
|
2436
2405
|
}
|
|
2437
2406
|
}
|
|
2438
2407
|
return userScoreList;
|
|
@@ -3039,7 +3008,10 @@
|
|
|
3039
3008
|
}
|
|
3040
3009
|
if (this.image) {
|
|
3041
3010
|
this.renderer.save();
|
|
3042
|
-
if (this.comment.
|
|
3011
|
+
if (typeof this.comment.opacity === "number") {
|
|
3012
|
+
this.renderer.setGlobalAlpha(this.comment.opacity);
|
|
3013
|
+
}
|
|
3014
|
+
else if (this.comment._live) {
|
|
3043
3015
|
this.renderer.setGlobalAlpha(config.contextFillLiveOpacity);
|
|
3044
3016
|
}
|
|
3045
3017
|
else {
|
|
@@ -4660,6 +4632,7 @@
|
|
|
4660
4632
|
this.context = context;
|
|
4661
4633
|
this.context.textAlign = "start";
|
|
4662
4634
|
this.context.textBaseline = "alphabetic";
|
|
4635
|
+
this.context.lineJoin = "round";
|
|
4663
4636
|
this.video = video;
|
|
4664
4637
|
}
|
|
4665
4638
|
drawVideo(enableLegacyPip) {
|