@xpadev-net/niconicomments 0.2.64 → 0.2.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/bundle.d.ts +489 -45
  2. package/dist/bundle.js +380 -491
  3. package/package.json +11 -11
package/dist/bundle.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- niconicomments.js v0.2.64
2
+ niconicomments.js v0.2.66
3
3
  (c) 2021 xpadev-net https://xpadev.net
4
4
  Released under the MIT License.
5
5
  */
@@ -524,28 +524,70 @@
524
524
  return _createClass(ValiError);
525
525
  }( /*#__PURE__*/_wrapNativeSuper(Error));
526
526
 
527
- // src/utils/getIssues/getIssues.ts
528
- function getIssues(issues) {
527
+ // src/utils/errorMessage/errorMessage.ts
528
+ function errorMessage(message) {
529
+ return typeof message === "function" ? message() : message;
530
+ }
531
+
532
+ // src/utils/actionIssue/actionIssue.ts
533
+ function actionIssue(validation, message, input, requirement, path) {
529
534
  return {
530
- issues: issues
535
+ issues: [{
536
+ validation: validation,
537
+ message: errorMessage(message),
538
+ input: input,
539
+ requirement: requirement,
540
+ path: path
541
+ }]
531
542
  };
532
543
  }
533
544
 
534
- // src/utils/getOutput/getOutput.ts
535
- function getOutput(output) {
545
+ // src/utils/actionOutput/actionOutput.ts
546
+ function actionOutput(output) {
536
547
  return {
537
548
  output: output
538
549
  };
539
550
  }
540
551
 
541
- // src/utils/executePipe/utils/getIssue/getIssue.ts
542
- function getIssue(info, issue) {
552
+ // src/utils/defaultArgs/defaultArgs.ts
553
+ function defaultArgs(arg1, arg2) {
554
+ return Array.isArray(arg1) ? [void 0, arg1] : [arg1, arg2];
555
+ }
556
+
557
+ // src/utils/parseResult/parseResult.ts
558
+ function parseResult(typed, output, issues) {
559
+ return {
560
+ typed: typed,
561
+ output: output,
562
+ issues: issues
563
+ };
564
+ }
565
+
566
+ // src/utils/restAndDefaultArgs/restAndDefaultArgs.ts
567
+ function restAndDefaultArgs(arg1, arg2, arg3) {
568
+ if (!arg1 || _typeof(arg1) === "object" && !Array.isArray(arg1)) {
569
+ var _defaultArgs = defaultArgs(arg2, arg3),
570
+ _defaultArgs2 = _slicedToArray(_defaultArgs, 2),
571
+ error2 = _defaultArgs2[0],
572
+ pipe2 = _defaultArgs2[1];
573
+ return [arg1, error2, pipe2];
574
+ }
575
+ var _defaultArgs3 = defaultArgs(arg1, arg2),
576
+ _defaultArgs4 = _slicedToArray(_defaultArgs3, 2),
577
+ error = _defaultArgs4[0],
578
+ pipe = _defaultArgs4[1];
579
+ return [void 0, error, pipe];
580
+ }
581
+
582
+ // src/utils/pipeResult/utils/pipeIssue/pipeIssue.ts
583
+ function pipeIssue(info, issue) {
543
584
  return {
544
585
  reason: info === null || info === void 0 ? void 0 : info.reason,
545
586
  validation: issue.validation,
546
587
  origin: (info === null || info === void 0 ? void 0 : info.origin) || "value",
547
588
  message: issue.message,
548
589
  input: issue.input,
590
+ requirement: issue === null || issue === void 0 ? void 0 : issue.requirement,
549
591
  path: issue.path,
550
592
  abortEarly: info === null || info === void 0 ? void 0 : info.abortEarly,
551
593
  abortPipeEarly: info === null || info === void 0 ? void 0 : info.abortPipeEarly,
@@ -553,8 +595,8 @@
553
595
  };
554
596
  }
555
597
 
556
- // src/utils/executePipe/utils/getPipeInfo/getPipeInfo.ts
557
- function getPipeInfo(info, reason) {
598
+ // src/utils/pipeResult/utils/pipeInfo/pipeInfo.ts
599
+ function pipeInfo(info, reason) {
558
600
  return {
559
601
  reason: reason,
560
602
  origin: info === null || info === void 0 ? void 0 : info.origin,
@@ -564,91 +606,56 @@
564
606
  };
565
607
  }
566
608
 
567
- // src/utils/executePipe/executePipe.ts
568
- function executePipe(input, pipe, parseInfo, reason) {
569
- if (!pipe || !pipe.length || parseInfo !== null && parseInfo !== void 0 && parseInfo.skipPipe) {
570
- return getOutput(input);
571
- }
572
- var pipeInfo;
573
- var issues;
609
+ // src/utils/pipeResult/pipeResult.ts
610
+ function pipeResult(input, pipe, parseInfo, reason, issues) {
611
+ var info;
574
612
  var output = input;
575
- var _iterator = _createForOfIteratorHelper(pipe),
576
- _step;
577
- try {
578
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
579
- var action = _step.value;
580
- var result = action(output);
581
- if (result.issues) {
582
- pipeInfo = pipeInfo || getPipeInfo(parseInfo, reason);
583
- var _iterator2 = _createForOfIteratorHelper(result.issues),
584
- _step2;
585
- try {
586
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
587
- var issueInfo = _step2.value;
588
- var issue = getIssue(pipeInfo, issueInfo);
589
- issues ? issues.push(issue) : issues = [issue];
613
+ if (pipe !== null && pipe !== void 0 && pipe.length && !(parseInfo !== null && parseInfo !== void 0 && parseInfo.skipPipe)) {
614
+ var _iterator = _createForOfIteratorHelper(pipe),
615
+ _step;
616
+ try {
617
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
618
+ var action = _step.value;
619
+ var result = action._parse(output);
620
+ if (result.issues) {
621
+ info = info || pipeInfo(parseInfo, reason);
622
+ var _iterator2 = _createForOfIteratorHelper(result.issues),
623
+ _step2;
624
+ try {
625
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
626
+ var issueInfo = _step2.value;
627
+ var issue = pipeIssue(info, issueInfo);
628
+ issues ? issues.push(issue) : issues = [issue];
629
+ }
630
+ } catch (err) {
631
+ _iterator2.e(err);
632
+ } finally {
633
+ _iterator2.f();
590
634
  }
591
- } catch (err) {
592
- _iterator2.e(err);
593
- } finally {
594
- _iterator2.f();
595
- }
596
- if (pipeInfo.abortEarly || pipeInfo.abortPipeEarly) {
597
- break;
635
+ if (info.abortEarly || info.abortPipeEarly) {
636
+ break;
637
+ }
638
+ } else {
639
+ output = result.output;
598
640
  }
599
- } else {
600
- output = result.output;
601
641
  }
642
+ } catch (err) {
643
+ _iterator.e(err);
644
+ } finally {
645
+ _iterator.f();
602
646
  }
603
- } catch (err) {
604
- _iterator.e(err);
605
- } finally {
606
- _iterator.f();
607
- }
608
- return issues ? getIssues(issues) : getOutput(output);
609
- }
610
- function getDefaultArgs(arg1, arg2) {
611
- return Array.isArray(arg1) ? [void 0, arg1] : [arg1, arg2];
612
- }
613
-
614
- // src/utils/getErrorMessage/getErrorMessage.ts
615
- function getErrorMessage(error) {
616
- return typeof error === "function" ? error() : error;
617
- }
618
-
619
- // src/utils/getPipeIssues/getPipeIssues.ts
620
- function getPipeIssues(validation, error, input) {
621
- return getIssues([{
622
- validation: validation,
623
- message: getErrorMessage(error),
624
- input: input
625
- }]);
626
- }
627
-
628
- // src/utils/getRestAndDefaultArgs/getRestAndDefaultArgs.ts
629
- function getRestAndDefaultArgs(arg1, arg2, arg3) {
630
- if (!arg1 || _typeof(arg1) === "object" && !Array.isArray(arg1)) {
631
- var _getDefaultArgs = getDefaultArgs(arg2, arg3),
632
- _getDefaultArgs2 = _slicedToArray(_getDefaultArgs, 2),
633
- error2 = _getDefaultArgs2[0],
634
- pipe2 = _getDefaultArgs2[1];
635
- return [arg1, error2, pipe2];
636
647
  }
637
- var _getDefaultArgs3 = getDefaultArgs(arg1, arg2),
638
- _getDefaultArgs4 = _slicedToArray(_getDefaultArgs3, 2),
639
- error = _getDefaultArgs4[0],
640
- pipe = _getDefaultArgs4[1];
641
- return [void 0, error, pipe];
648
+ return parseResult(true, output, issues);
642
649
  }
643
-
644
- // src/utils/getSchemaIssues/getSchemaIssues.ts
645
- function getSchemaIssues(info, reason, validation, error, input, issues) {
650
+ function schemaIssue(info, reason, validation, message, input, issues) {
646
651
  return {
652
+ typed: false,
653
+ output: input,
647
654
  issues: [{
648
655
  reason: reason,
649
656
  validation: validation,
650
657
  origin: (info === null || info === void 0 ? void 0 : info.origin) || "value",
651
- message: getErrorMessage(error),
658
+ message: errorMessage(message),
652
659
  input: input,
653
660
  issues: issues,
654
661
  abortEarly: info === null || info === void 0 ? void 0 : info.abortEarly,
@@ -657,48 +664,41 @@
657
664
  }]
658
665
  };
659
666
  }
660
- function is(schema, input) {
667
+
668
+ // src/methods/getDefault/getDefault.ts
669
+ function getDefault(schema) {
670
+ return typeof schema["default"] === "function" ? schema["default"]() : schema["default"];
671
+ }
672
+ function is(schema, input, info) {
661
673
  return !schema._parse(input, {
662
- abortEarly: true
674
+ abortEarly: true,
675
+ skipPipe: info === null || info === void 0 ? void 0 : info.skipPipe
663
676
  }).issues;
664
677
  }
665
678
 
666
679
  // src/schemas/array/array.ts
667
680
  function array(item, arg2, arg3) {
668
- var _getDefaultArgs5 = getDefaultArgs(arg2, arg3),
669
- _getDefaultArgs6 = _slicedToArray(_getDefaultArgs5, 2),
670
- error = _getDefaultArgs6[0],
671
- pipe = _getDefaultArgs6[1];
681
+ var _defaultArgs5 = defaultArgs(arg2, arg3),
682
+ _defaultArgs6 = _slicedToArray(_defaultArgs5, 2),
683
+ _defaultArgs6$ = _defaultArgs6[0],
684
+ message = _defaultArgs6$ === void 0 ? "Invalid type" : _defaultArgs6$,
685
+ pipe = _defaultArgs6[1];
672
686
  return {
673
- /**
674
- * The schema type.
675
- */
676
687
  type: "array",
677
- /**
678
- * The item schema.
679
- */
680
- item: item,
681
- /**
682
- * Whether it's async.
683
- */
684
688
  async: false,
685
- /**
686
- * Parses unknown input based on its schema.
687
- *
688
- * @param input The input to be parsed.
689
- * @param info The parse info.
690
- *
691
- * @returns The parsed output.
692
- */
689
+ item: item,
690
+ message: message,
691
+ pipe: pipe,
693
692
  _parse: function _parse(input, info) {
694
693
  if (!Array.isArray(input)) {
695
- return getSchemaIssues(info, "type", "array", error || "Invalid type", input);
694
+ return schemaIssue(info, "type", "array", this.message, input);
696
695
  }
696
+ var typed = true;
697
697
  var issues;
698
698
  var output = [];
699
699
  for (var key = 0; key < input.length; key++) {
700
700
  var value2 = input[key];
701
- var result = item._parse(value2, info);
701
+ var result = this.item._parse(value2, info);
702
702
  if (result.issues) {
703
703
  var pathItem = {
704
704
  type: "array",
@@ -706,12 +706,12 @@
706
706
  key: key,
707
707
  value: value2
708
708
  };
709
- var _iterator3 = _createForOfIteratorHelper(result.issues),
710
- _step3;
709
+ var _iterator5 = _createForOfIteratorHelper(result.issues),
710
+ _step5;
711
711
  try {
712
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
712
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
713
713
  var _issues;
714
- var issue = _step3.value;
714
+ var issue = _step5.value;
715
715
  if (issue.path) {
716
716
  issue.path.unshift(pathItem);
717
717
  } else {
@@ -720,53 +720,48 @@
720
720
  (_issues = issues) === null || _issues === void 0 || _issues.push(issue);
721
721
  }
722
722
  } catch (err) {
723
- _iterator3.e(err);
723
+ _iterator5.e(err);
724
724
  } finally {
725
- _iterator3.f();
725
+ _iterator5.f();
726
726
  }
727
727
  if (!issues) {
728
728
  issues = result.issues;
729
729
  }
730
730
  if (info !== null && info !== void 0 && info.abortEarly) {
731
+ typed = false;
731
732
  break;
732
733
  }
733
- } else {
734
- output.push(result.output);
735
734
  }
735
+ if (!result.typed) {
736
+ typed = false;
737
+ }
738
+ output.push(result.output);
739
+ }
740
+ if (typed) {
741
+ return pipeResult(output, this.pipe, info, "array", issues);
736
742
  }
737
- return issues ? getIssues(issues) : executePipe(output, pipe, info, "array");
743
+ return parseResult(false, output, issues);
738
744
  }
739
745
  };
740
746
  }
741
747
 
742
748
  // src/schemas/boolean/boolean.ts
743
749
  function _boolean(arg1, arg2) {
744
- var _getDefaultArgs17 = getDefaultArgs(arg1, arg2),
745
- _getDefaultArgs18 = _slicedToArray(_getDefaultArgs17, 2),
746
- error = _getDefaultArgs18[0],
747
- pipe = _getDefaultArgs18[1];
750
+ var _defaultArgs17 = defaultArgs(arg1, arg2),
751
+ _defaultArgs18 = _slicedToArray(_defaultArgs17, 2),
752
+ _defaultArgs18$ = _defaultArgs18[0],
753
+ message = _defaultArgs18$ === void 0 ? "Invalid type" : _defaultArgs18$,
754
+ pipe = _defaultArgs18[1];
748
755
  return {
749
- /**
750
- * The schema type.
751
- */
752
756
  type: "boolean",
753
- /**
754
- * Whether it's async.
755
- */
756
757
  async: false,
757
- /**
758
- * Parses unknown input based on its schema.
759
- *
760
- * @param input The input to be parsed.
761
- * @param info The parse info.
762
- *
763
- * @returns The parsed output.
764
- */
758
+ message: message,
759
+ pipe: pipe,
765
760
  _parse: function _parse(input, info) {
766
761
  if (typeof input !== "boolean") {
767
- return getSchemaIssues(info, "type", "boolean", error || "Invalid type", input);
762
+ return schemaIssue(info, "type", "boolean", this.message, input);
768
763
  }
769
- return executePipe(input, pipe, info, "boolean");
764
+ return pipeResult(input, this.pipe, info, "boolean");
770
765
  }
771
766
  };
772
767
  }
@@ -775,7 +770,9 @@
775
770
  function mergeOutputs(output1, output2) {
776
771
  if (_typeof(output1) === _typeof(output2)) {
777
772
  if (output1 === output2 || output1 instanceof Date && output2 instanceof Date && +output1 === +output2) {
778
- return getOutput(output1);
773
+ return {
774
+ output: output1
775
+ };
779
776
  }
780
777
  if (Array.isArray(output1) && Array.isArray(output2)) {
781
778
  if (output1.length === output2.length) {
@@ -787,7 +784,9 @@
787
784
  }
788
785
  array2.push(result.output);
789
786
  }
790
- return getOutput(array2);
787
+ return {
788
+ output: array2
789
+ };
791
790
  }
792
791
  return {
793
792
  invalid: true
@@ -804,7 +803,9 @@
804
803
  object2[key] = _result.output;
805
804
  }
806
805
  }
807
- return getOutput(object2);
806
+ return {
807
+ output: object2
808
+ };
808
809
  }
809
810
  }
810
811
  return {
@@ -813,114 +814,85 @@
813
814
  }
814
815
 
815
816
  // src/schemas/intersect/intersect.ts
816
- function intersect(options, error) {
817
+ function intersect(options) {
818
+ var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "Invalid type";
817
819
  return {
818
- /**
819
- * The schema type.
820
- */
821
820
  type: "intersect",
822
- /**
823
- * The intersect options.
824
- */
825
- options: options,
826
- /**
827
- * Whether it's async.
828
- */
829
821
  async: false,
830
- /**
831
- * Parses unknown input based on its schema.
832
- *
833
- * @param input The input to be parsed.
834
- * @param info The parse info.
835
- *
836
- * @returns The parsed output.
837
- */
822
+ options: options,
823
+ message: message,
838
824
  _parse: function _parse(input, info) {
825
+ var typed = true;
839
826
  var issues;
840
- var outputs;
841
- var _iterator5 = _createForOfIteratorHelper(options),
842
- _step5;
827
+ var output;
828
+ var outputs = [];
829
+ var _iterator7 = _createForOfIteratorHelper(this.options),
830
+ _step7;
843
831
  try {
844
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
845
- var schema = _step5.value;
832
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
833
+ var schema = _step7.value;
846
834
  var _result2 = schema._parse(input, info);
847
835
  if (_result2.issues) {
848
836
  if (issues) {
849
- var _iterator6 = _createForOfIteratorHelper(_result2.issues),
850
- _step6;
837
+ var _iterator8 = _createForOfIteratorHelper(_result2.issues),
838
+ _step8;
851
839
  try {
852
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
853
- var issue = _step6.value;
840
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
841
+ var issue = _step8.value;
854
842
  issues.push(issue);
855
843
  }
856
844
  } catch (err) {
857
- _iterator6.e(err);
845
+ _iterator8.e(err);
858
846
  } finally {
859
- _iterator6.f();
847
+ _iterator8.f();
860
848
  }
861
849
  } else {
862
850
  issues = _result2.issues;
863
851
  }
864
852
  if (info !== null && info !== void 0 && info.abortEarly) {
853
+ typed = false;
865
854
  break;
866
855
  }
867
- } else {
868
- if (outputs) {
869
- outputs.push(_result2.output);
870
- } else {
871
- outputs = [_result2.output];
872
- }
873
856
  }
857
+ if (!_result2.typed) {
858
+ typed = false;
859
+ }
860
+ outputs.push(_result2.output);
874
861
  }
875
862
  } catch (err) {
876
- _iterator5.e(err);
863
+ _iterator7.e(err);
877
864
  } finally {
878
- _iterator5.f();
865
+ _iterator7.f();
879
866
  }
880
- if (issues) {
881
- return getIssues(issues);
882
- }
883
- var output = outputs[0];
884
- for (var index = 1; index < outputs.length; index++) {
885
- var result = mergeOutputs(output, outputs[index]);
886
- if (result.invalid) {
887
- return getSchemaIssues(info, "type", "intersect", error || "Invalid type", input);
867
+ if (typed) {
868
+ output = outputs[0];
869
+ for (var index = 1; index < outputs.length; index++) {
870
+ var result = mergeOutputs(output, outputs[index]);
871
+ if (result.invalid) {
872
+ return schemaIssue(info, "type", "intersect", this.message, input);
873
+ }
874
+ output = result.output;
888
875
  }
889
- output = result.output;
876
+ return parseResult(true, output, issues);
890
877
  }
891
- return getOutput(output);
878
+ return parseResult(false, output, issues);
892
879
  }
893
880
  };
894
881
  }
895
882
 
896
883
  // src/schemas/literal/literal.ts
897
- function literal(literal2, error) {
884
+ function literal(literal2) {
885
+ var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "Invalid type";
898
886
  return {
899
- /**
900
- * The schema type.
901
- */
902
887
  type: "literal",
903
- /**
904
- * The literal value.
905
- */
906
- literal: literal2,
907
- /**
908
- * Whether it's async.
909
- */
910
888
  async: false,
911
- /**
912
- * Parses unknown input based on its schema.
913
- *
914
- * @param input The input to be parsed.
915
- * @param info The parse info.
916
- *
917
- * @returns The parsed output.
918
- */
889
+ literal: literal2,
890
+ message: message,
919
891
  _parse: function _parse(input, info) {
920
- if (input !== literal2) {
921
- return getSchemaIssues(info, "type", "literal", error || "Invalid type", input);
892
+ if (input !== this.literal) {
893
+ return schemaIssue(info, "type", "literal", this.message, input);
922
894
  }
923
- return getOutput(input);
895
+ return parseResult(true, input);
924
896
  }
925
897
  };
926
898
  }
@@ -928,124 +900,75 @@
928
900
  // src/schemas/nullable/nullable.ts
929
901
  function nullable(wrapped, default_) {
930
902
  return {
931
- /**
932
- * The schema type.
933
- */
934
903
  type: "nullable",
935
- /**
936
- * The wrapped schema.
937
- */
938
- wrapped: wrapped,
939
- /**
940
- * Returns the default value.
941
- */
942
- getDefault: function getDefault() {
943
- return typeof default_ === "function" ? default_() : default_;
944
- },
945
- /**
946
- * Whether it's async.
947
- */
948
904
  async: false,
949
- /**
950
- * Parses unknown input based on its schema.
951
- *
952
- * @param input The input to be parsed.
953
- * @param info The parse info.
954
- *
955
- * @returns The parsed output.
956
- */
905
+ wrapped: wrapped,
906
+ "default": default_,
957
907
  _parse: function _parse(input, info) {
958
908
  if (input === null) {
959
- var override = this.getDefault();
909
+ var override = getDefault(this);
960
910
  if (override === void 0) {
961
- return getOutput(input);
911
+ return parseResult(true, input);
962
912
  }
963
913
  input = override;
964
914
  }
965
- return wrapped._parse(input, info);
915
+ return this.wrapped._parse(input, info);
966
916
  }
967
917
  };
968
918
  }
969
919
 
970
920
  // src/schemas/number/number.ts
971
921
  function number(arg1, arg2) {
972
- var _getDefaultArgs33 = getDefaultArgs(arg1, arg2),
973
- _getDefaultArgs34 = _slicedToArray(_getDefaultArgs33, 2),
974
- error = _getDefaultArgs34[0],
975
- pipe = _getDefaultArgs34[1];
922
+ var _defaultArgs33 = defaultArgs(arg1, arg2),
923
+ _defaultArgs34 = _slicedToArray(_defaultArgs33, 2),
924
+ _defaultArgs34$ = _defaultArgs34[0],
925
+ message = _defaultArgs34$ === void 0 ? "Invalid type" : _defaultArgs34$,
926
+ pipe = _defaultArgs34[1];
976
927
  return {
977
- /**
978
- * The schema type.
979
- */
980
928
  type: "number",
981
- /**
982
- * Whether it's async.
983
- */
984
929
  async: false,
985
- /**
986
- * Parses unknown input based on its schema.
987
- *
988
- * @param input The input to be parsed.
989
- * @param info The parse info.
990
- *
991
- * @returns The parsed output.
992
- */
930
+ message: message,
931
+ pipe: pipe,
993
932
  _parse: function _parse(input, info) {
994
933
  if (typeof input !== "number" || isNaN(input)) {
995
- return getSchemaIssues(info, "type", "number", error || "Invalid type", input);
934
+ return schemaIssue(info, "type", "number", this.message, input);
996
935
  }
997
- return executePipe(input, pipe, info, "number");
936
+ return pipeResult(input, this.pipe, info, "number");
998
937
  }
999
938
  };
1000
939
  }
1001
940
 
1002
941
  // src/schemas/object/object.ts
1003
942
  function object(entries, arg2, arg3, arg4) {
1004
- var _getRestAndDefaultArg = getRestAndDefaultArgs(arg2, arg3, arg4),
1005
- _getRestAndDefaultArg2 = _slicedToArray(_getRestAndDefaultArg, 3),
1006
- rest = _getRestAndDefaultArg2[0],
1007
- error = _getRestAndDefaultArg2[1],
1008
- pipe = _getRestAndDefaultArg2[2];
943
+ var _restAndDefaultArgs = restAndDefaultArgs(arg2, arg3, arg4),
944
+ _restAndDefaultArgs2 = _slicedToArray(_restAndDefaultArgs, 3),
945
+ rest = _restAndDefaultArgs2[0],
946
+ _restAndDefaultArgs2$ = _restAndDefaultArgs2[1],
947
+ message = _restAndDefaultArgs2$ === void 0 ? "Invalid type" : _restAndDefaultArgs2$,
948
+ pipe = _restAndDefaultArgs2[2];
1009
949
  var cachedEntries;
1010
950
  return {
1011
- /**
1012
- * The schema type.
1013
- */
1014
951
  type: "object",
1015
- /**
1016
- * The entries schema.
1017
- */
952
+ async: false,
1018
953
  entries: entries,
1019
- /**
1020
- * The rest schema.
1021
- */
1022
954
  rest: rest,
1023
- /**
1024
- * Whether it's async.
1025
- */
1026
- async: false,
1027
- /**
1028
- * Parses unknown input based on its schema.
1029
- *
1030
- * @param input The input to be parsed.
1031
- * @param info The parse info.
1032
- *
1033
- * @returns The parsed output.
1034
- */
955
+ message: message,
956
+ pipe: pipe,
1035
957
  _parse: function _parse(input, info) {
1036
958
  if (!input || _typeof(input) !== "object") {
1037
- return getSchemaIssues(info, "type", "object", error || "Invalid type", input);
959
+ return schemaIssue(info, "type", "object", this.message, input);
1038
960
  }
1039
- cachedEntries = cachedEntries || Object.entries(entries);
961
+ cachedEntries = cachedEntries || Object.entries(this.entries);
962
+ var typed = true;
1040
963
  var issues;
1041
964
  var output = {};
1042
- var _iterator11 = _createForOfIteratorHelper(cachedEntries),
1043
- _step11;
965
+ var _iterator13 = _createForOfIteratorHelper(cachedEntries),
966
+ _step13;
1044
967
  try {
1045
- for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
1046
- var _step11$value = _slicedToArray(_step11.value, 2),
1047
- _key3 = _step11$value[0],
1048
- schema = _step11$value[1];
968
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
969
+ var _step13$value = _slicedToArray(_step13.value, 2),
970
+ _key3 = _step13$value[0],
971
+ schema = _step13$value[1];
1049
972
  var _value = input[_key3];
1050
973
  var _result3 = schema._parse(_value, info);
1051
974
  if (_result3.issues) {
@@ -1055,12 +978,12 @@
1055
978
  key: _key3,
1056
979
  value: _value
1057
980
  };
1058
- var _iterator13 = _createForOfIteratorHelper(_result3.issues),
1059
- _step13;
981
+ var _iterator15 = _createForOfIteratorHelper(_result3.issues),
982
+ _step15;
1060
983
  try {
1061
- for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
984
+ for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
1062
985
  var _issues7;
1063
- var _issue2 = _step13.value;
986
+ var _issue2 = _step15.value;
1064
987
  if (_issue2.path) {
1065
988
  _issue2.path.unshift(_pathItem);
1066
989
  } else {
@@ -1069,30 +992,35 @@
1069
992
  (_issues7 = issues) === null || _issues7 === void 0 || _issues7.push(_issue2);
1070
993
  }
1071
994
  } catch (err) {
1072
- _iterator13.e(err);
995
+ _iterator15.e(err);
1073
996
  } finally {
1074
- _iterator13.f();
997
+ _iterator15.f();
1075
998
  }
1076
999
  if (!issues) {
1077
1000
  issues = _result3.issues;
1078
1001
  }
1079
1002
  if (info !== null && info !== void 0 && info.abortEarly) {
1003
+ typed = false;
1080
1004
  break;
1081
1005
  }
1082
- } else if (_result3.output !== void 0 || _key3 in input) {
1006
+ }
1007
+ if (!_result3.typed) {
1008
+ typed = false;
1009
+ }
1010
+ if (_result3.output !== void 0 || _key3 in input) {
1083
1011
  output[_key3] = _result3.output;
1084
1012
  }
1085
1013
  }
1086
1014
  } catch (err) {
1087
- _iterator11.e(err);
1015
+ _iterator13.e(err);
1088
1016
  } finally {
1089
- _iterator11.f();
1017
+ _iterator13.f();
1090
1018
  }
1091
- if (rest && !(info !== null && info !== void 0 && info.abortEarly && issues)) {
1019
+ if (this.rest && !(info !== null && info !== void 0 && info.abortEarly && issues)) {
1092
1020
  for (var key in input) {
1093
- if (!(key in entries)) {
1021
+ if (!(key in this.entries)) {
1094
1022
  var value2 = input[key];
1095
- var result = rest._parse(value2, info);
1023
+ var result = this.rest._parse(value2, info);
1096
1024
  if (result.issues) {
1097
1025
  var pathItem = {
1098
1026
  type: "object",
@@ -1100,12 +1028,12 @@
1100
1028
  key: key,
1101
1029
  value: value2
1102
1030
  };
1103
- var _iterator12 = _createForOfIteratorHelper(result.issues),
1104
- _step12;
1031
+ var _iterator14 = _createForOfIteratorHelper(result.issues),
1032
+ _step14;
1105
1033
  try {
1106
- for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
1034
+ for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
1107
1035
  var _issues6;
1108
- var issue = _step12.value;
1036
+ var issue = _step14.value;
1109
1037
  if (issue.path) {
1110
1038
  issue.path.unshift(pathItem);
1111
1039
  } else {
@@ -1114,23 +1042,29 @@
1114
1042
  (_issues6 = issues) === null || _issues6 === void 0 || _issues6.push(issue);
1115
1043
  }
1116
1044
  } catch (err) {
1117
- _iterator12.e(err);
1045
+ _iterator14.e(err);
1118
1046
  } finally {
1119
- _iterator12.f();
1047
+ _iterator14.f();
1120
1048
  }
1121
1049
  if (!issues) {
1122
1050
  issues = result.issues;
1123
1051
  }
1124
1052
  if (info !== null && info !== void 0 && info.abortEarly) {
1053
+ typed = false;
1125
1054
  break;
1126
1055
  }
1127
- } else {
1128
- output[key] = result.output;
1129
1056
  }
1057
+ if (!result.typed) {
1058
+ typed = false;
1059
+ }
1060
+ output[key] = result.output;
1130
1061
  }
1131
1062
  }
1132
1063
  }
1133
- return issues ? getIssues(issues) : executePipe(output, pipe, info, "object");
1064
+ if (typed) {
1065
+ return pipeResult(output, this.pipe, info, "object", issues);
1066
+ }
1067
+ return parseResult(false, output, issues);
1134
1068
  }
1135
1069
  };
1136
1070
  }
@@ -1138,91 +1072,58 @@
1138
1072
  // src/schemas/optional/optional.ts
1139
1073
  function optional(wrapped, default_) {
1140
1074
  return {
1141
- /**
1142
- * The schema type.
1143
- */
1144
1075
  type: "optional",
1145
- /**
1146
- * The wrapped schema.
1147
- */
1148
- wrapped: wrapped,
1149
- /**
1150
- * Returns the default value.
1151
- */
1152
- getDefault: function getDefault() {
1153
- return typeof default_ === "function" ? default_() : default_;
1154
- },
1155
- /**
1156
- * Whether it's async.
1157
- */
1158
1076
  async: false,
1159
- /**
1160
- * Parses unknown input based on its schema.
1161
- *
1162
- * @param input The input to be parsed.
1163
- * @param info The parse info.
1164
- *
1165
- * @returns The parsed output.
1166
- */
1077
+ wrapped: wrapped,
1078
+ "default": default_,
1167
1079
  _parse: function _parse(input, info) {
1168
1080
  if (input === void 0) {
1169
- var override = this.getDefault();
1081
+ var override = getDefault(this);
1170
1082
  if (override === void 0) {
1171
- return getOutput(input);
1083
+ return parseResult(true, input);
1172
1084
  }
1173
1085
  input = override;
1174
1086
  }
1175
- return wrapped._parse(input, info);
1087
+ return this.wrapped._parse(input, info);
1176
1088
  }
1177
1089
  };
1178
1090
  }
1179
1091
 
1180
1092
  // src/schemas/string/string.ts
1181
1093
  function string(arg1, arg2) {
1182
- var _getDefaultArgs37 = getDefaultArgs(arg1, arg2),
1183
- _getDefaultArgs38 = _slicedToArray(_getDefaultArgs37, 2),
1184
- error = _getDefaultArgs38[0],
1185
- pipe = _getDefaultArgs38[1];
1094
+ var _defaultArgs37 = defaultArgs(arg1, arg2),
1095
+ _defaultArgs38 = _slicedToArray(_defaultArgs37, 2),
1096
+ _defaultArgs38$ = _defaultArgs38[0],
1097
+ message = _defaultArgs38$ === void 0 ? "Invalid type" : _defaultArgs38$,
1098
+ pipe = _defaultArgs38[1];
1186
1099
  return {
1187
- /**
1188
- * The schema type.
1189
- */
1190
1100
  type: "string",
1191
- /**
1192
- * Whether it's async.
1193
- */
1194
1101
  async: false,
1195
- /**
1196
- * Parses unknown input based on its schema.
1197
- *
1198
- * @param input The input to be parsed.
1199
- * @param info The parse info.
1200
- *
1201
- * @returns The parsed output.
1202
- */
1102
+ message: message,
1103
+ pipe: pipe,
1203
1104
  _parse: function _parse(input, info) {
1204
1105
  if (typeof input !== "string") {
1205
- return getSchemaIssues(info, "type", "string", error || "Invalid type", input);
1106
+ return schemaIssue(info, "type", "string", this.message, input);
1206
1107
  }
1207
- return executePipe(input, pipe, info, "string");
1108
+ return pipeResult(input, this.pipe, info, "string");
1208
1109
  }
1209
1110
  };
1210
1111
  }
1211
1112
 
1212
- // src/schemas/record/utils/getRecordArgs/getRecordArgs.ts
1213
- function getRecordArgs(arg1, arg2, arg3, arg4) {
1113
+ // src/schemas/record/utils/recordArgs/recordArgs.ts
1114
+ function recordArgs(arg1, arg2, arg3, arg4) {
1214
1115
  if (_typeof(arg2) === "object" && !Array.isArray(arg2)) {
1215
- var _getDefaultArgs41 = getDefaultArgs(arg3, arg4),
1216
- _getDefaultArgs42 = _slicedToArray(_getDefaultArgs41, 2),
1217
- error2 = _getDefaultArgs42[0],
1218
- pipe2 = _getDefaultArgs42[1];
1219
- return [arg1, arg2, error2, pipe2];
1116
+ var _defaultArgs41 = defaultArgs(arg3, arg4),
1117
+ _defaultArgs42 = _slicedToArray(_defaultArgs41, 2),
1118
+ message2 = _defaultArgs42[0],
1119
+ pipe2 = _defaultArgs42[1];
1120
+ return [arg1, arg2, message2, pipe2];
1220
1121
  }
1221
- var _getDefaultArgs43 = getDefaultArgs(arg2, arg3),
1222
- _getDefaultArgs44 = _slicedToArray(_getDefaultArgs43, 2),
1223
- error = _getDefaultArgs44[0],
1224
- pipe = _getDefaultArgs44[1];
1225
- return [string(), arg1, error, pipe];
1122
+ var _defaultArgs43 = defaultArgs(arg2, arg3),
1123
+ _defaultArgs44 = _slicedToArray(_defaultArgs43, 2),
1124
+ message = _defaultArgs44[0],
1125
+ pipe = _defaultArgs44[1];
1126
+ return [string(), arg1, message, pipe];
1226
1127
  }
1227
1128
 
1228
1129
  // src/schemas/record/values.ts
@@ -1230,41 +1131,25 @@
1230
1131
 
1231
1132
  // src/schemas/record/record.ts
1232
1133
  function record(arg1, arg2, arg3, arg4) {
1233
- var _getRecordArgs = getRecordArgs(arg1, arg2, arg3, arg4),
1234
- _getRecordArgs2 = _slicedToArray(_getRecordArgs, 4),
1235
- key = _getRecordArgs2[0],
1236
- value2 = _getRecordArgs2[1],
1237
- error = _getRecordArgs2[2],
1238
- pipe = _getRecordArgs2[3];
1134
+ var _recordArgs = recordArgs(arg1, arg2, arg3, arg4),
1135
+ _recordArgs2 = _slicedToArray(_recordArgs, 4),
1136
+ key = _recordArgs2[0],
1137
+ value2 = _recordArgs2[1],
1138
+ _recordArgs2$ = _recordArgs2[2],
1139
+ message = _recordArgs2$ === void 0 ? "Invalid type" : _recordArgs2$,
1140
+ pipe = _recordArgs2[3];
1239
1141
  return {
1240
- /**
1241
- * The schema type.
1242
- */
1243
1142
  type: "record",
1244
- /**
1245
- * The key schema.
1246
- */
1143
+ async: false,
1247
1144
  key: key,
1248
- /**
1249
- * The value schema.
1250
- */
1251
1145
  value: value2,
1252
- /**
1253
- * Whether it's async.
1254
- */
1255
- async: false,
1256
- /**
1257
- * Parses unknown input based on its schema.
1258
- *
1259
- * @param input The input to be parsed.
1260
- * @param info The parse info.
1261
- *
1262
- * @returns The parsed output.
1263
- */
1146
+ message: message,
1147
+ pipe: pipe,
1264
1148
  _parse: function _parse(input, info) {
1265
1149
  if (!input || _typeof(input) !== "object") {
1266
- return getSchemaIssues(info, "type", "record", error || "Invalid type", input);
1150
+ return schemaIssue(info, "type", "record", this.message, input);
1267
1151
  }
1152
+ var typed = true;
1268
1153
  var issues;
1269
1154
  var output = {};
1270
1155
  for (var _i = 0, _Object$entries = Object.entries(input); _i < _Object$entries.length; _i++) {
@@ -1273,7 +1158,7 @@
1273
1158
  inputValue = _Object$entries$_i[1];
1274
1159
  if (!BLOCKED_KEYS.includes(inputKey)) {
1275
1160
  var pathItem = void 0;
1276
- var keyResult = key._parse(inputKey, {
1161
+ var keyResult = this.key._parse(inputKey, {
1277
1162
  origin: "key",
1278
1163
  abortEarly: info === null || info === void 0 ? void 0 : info.abortEarly,
1279
1164
  abortPipeEarly: info === null || info === void 0 ? void 0 : info.abortPipeEarly,
@@ -1286,28 +1171,29 @@
1286
1171
  key: inputKey,
1287
1172
  value: inputValue
1288
1173
  };
1289
- var _iterator16 = _createForOfIteratorHelper(keyResult.issues),
1290
- _step16;
1174
+ var _iterator18 = _createForOfIteratorHelper(keyResult.issues),
1175
+ _step18;
1291
1176
  try {
1292
- for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
1177
+ for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
1293
1178
  var _issues10;
1294
- var issue = _step16.value;
1179
+ var issue = _step18.value;
1295
1180
  issue.path = [pathItem];
1296
1181
  (_issues10 = issues) === null || _issues10 === void 0 || _issues10.push(issue);
1297
1182
  }
1298
1183
  } catch (err) {
1299
- _iterator16.e(err);
1184
+ _iterator18.e(err);
1300
1185
  } finally {
1301
- _iterator16.f();
1186
+ _iterator18.f();
1302
1187
  }
1303
1188
  if (!issues) {
1304
1189
  issues = keyResult.issues;
1305
1190
  }
1306
1191
  if (info !== null && info !== void 0 && info.abortEarly) {
1192
+ typed = false;
1307
1193
  break;
1308
1194
  }
1309
1195
  }
1310
- var valueResult = value2._parse(inputValue, info);
1196
+ var valueResult = this.value._parse(inputValue, info);
1311
1197
  if (valueResult.issues) {
1312
1198
  pathItem = pathItem || {
1313
1199
  type: "record",
@@ -1315,12 +1201,12 @@
1315
1201
  key: inputKey,
1316
1202
  value: inputValue
1317
1203
  };
1318
- var _iterator17 = _createForOfIteratorHelper(valueResult.issues),
1319
- _step17;
1204
+ var _iterator19 = _createForOfIteratorHelper(valueResult.issues),
1205
+ _step19;
1320
1206
  try {
1321
- for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
1207
+ for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
1322
1208
  var _issues11;
1323
- var _issue3 = _step17.value;
1209
+ var _issue3 = _step19.value;
1324
1210
  if (_issue3.path) {
1325
1211
  _issue3.path.unshift(pathItem);
1326
1212
  } else {
@@ -1329,72 +1215,64 @@
1329
1215
  (_issues11 = issues) === null || _issues11 === void 0 || _issues11.push(_issue3);
1330
1216
  }
1331
1217
  } catch (err) {
1332
- _iterator17.e(err);
1218
+ _iterator19.e(err);
1333
1219
  } finally {
1334
- _iterator17.f();
1220
+ _iterator19.f();
1335
1221
  }
1336
1222
  if (!issues) {
1337
1223
  issues = valueResult.issues;
1338
1224
  }
1339
1225
  if (info !== null && info !== void 0 && info.abortEarly) {
1226
+ typed = false;
1340
1227
  break;
1341
1228
  }
1342
1229
  }
1343
- if (!keyResult.issues && !valueResult.issues) {
1230
+ if (!keyResult.typed || !valueResult.typed) {
1231
+ typed = false;
1232
+ }
1233
+ if (keyResult.typed) {
1344
1234
  output[keyResult.output] = valueResult.output;
1345
1235
  }
1346
1236
  }
1347
1237
  }
1348
- return issues ? getIssues(issues) : executePipe(output, pipe, info, "record");
1238
+ if (typed) {
1239
+ return pipeResult(output, this.pipe, info, "record", issues);
1240
+ }
1241
+ return parseResult(false, output, issues);
1349
1242
  }
1350
1243
  };
1351
1244
  }
1352
1245
 
1353
1246
  // src/schemas/union/union.ts
1354
- function union(options, error) {
1247
+ function union(options) {
1248
+ var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "Invalid type";
1355
1249
  return {
1356
- /**
1357
- * The schema type.
1358
- */
1359
1250
  type: "union",
1360
- /**
1361
- * The union options.
1362
- */
1363
- options: options,
1364
- /**
1365
- * Whether it's async.
1366
- */
1367
1251
  async: false,
1368
- /**
1369
- * Parses unknown input based on its schema.
1370
- *
1371
- * @param input The input to be parsed.
1372
- * @param info The parse info.
1373
- *
1374
- * @returns The parsed output.
1375
- */
1252
+ options: options,
1253
+ message: message,
1376
1254
  _parse: function _parse(input, info) {
1377
1255
  var issues;
1378
1256
  var output;
1379
- var _iterator26 = _createForOfIteratorHelper(options),
1380
- _step26;
1257
+ var _iterator28 = _createForOfIteratorHelper(this.options),
1258
+ _step28;
1381
1259
  try {
1382
- for (_iterator26.s(); !(_step26 = _iterator26.n()).done;) {
1383
- var schema = _step26.value;
1260
+ for (_iterator28.s(); !(_step28 = _iterator28.n()).done;) {
1261
+ var schema = _step28.value;
1384
1262
  var result = schema._parse(input, info);
1385
1263
  if (result.issues) {
1386
1264
  if (issues) {
1387
- var _iterator27 = _createForOfIteratorHelper(result.issues),
1388
- _step27;
1265
+ var _iterator29 = _createForOfIteratorHelper(result.issues),
1266
+ _step29;
1389
1267
  try {
1390
- for (_iterator27.s(); !(_step27 = _iterator27.n()).done;) {
1391
- var issue = _step27.value;
1268
+ for (_iterator29.s(); !(_step29 = _iterator29.n()).done;) {
1269
+ var issue = _step29.value;
1392
1270
  issues.push(issue);
1393
1271
  }
1394
1272
  } catch (err) {
1395
- _iterator27.e(err);
1273
+ _iterator29.e(err);
1396
1274
  } finally {
1397
- _iterator27.f();
1275
+ _iterator29.f();
1398
1276
  }
1399
1277
  } else {
1400
1278
  issues = result.issues;
@@ -1405,54 +1283,43 @@
1405
1283
  }
1406
1284
  }
1407
1285
  } catch (err) {
1408
- _iterator26.e(err);
1286
+ _iterator28.e(err);
1409
1287
  } finally {
1410
- _iterator26.f();
1288
+ _iterator28.f();
1411
1289
  }
1412
- return output ? getOutput(output[0]) : getSchemaIssues(info, "type", "union", error || "Invalid type", input, issues);
1290
+ if (output) {
1291
+ return parseResult(true, output[0]);
1292
+ }
1293
+ return schemaIssue(info, "type", "union", this.message, input, issues);
1413
1294
  }
1414
1295
  };
1415
1296
  }
1416
1297
 
1417
1298
  // src/schemas/unknown/unknown.ts
1418
- function unknown() {
1419
- var pipe = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
1299
+ function unknown(pipe) {
1420
1300
  return {
1421
- /**
1422
- * The schema type.
1423
- */
1424
1301
  type: "unknown",
1425
- /**
1426
- * Whether it's async.
1427
- */
1428
1302
  async: false,
1429
- /**
1430
- * Parses unknown input based on its schema.
1431
- *
1432
- * @param input The input to be parsed.
1433
- * @param info The parse info.
1434
- *
1435
- * @returns The parsed output.
1436
- */
1303
+ pipe: pipe,
1437
1304
  _parse: function _parse(input, info) {
1438
- return executePipe(input, pipe, info, "unknown");
1305
+ return pipeResult(input, this.pipe, info, "unknown");
1439
1306
  }
1440
1307
  };
1441
1308
  }
1442
1309
 
1443
1310
  // src/methods/omit/omit.ts
1444
1311
  function omit(schema, keys, arg3, arg4, arg5) {
1445
- var _getRestAndDefaultArg13 = getRestAndDefaultArgs(arg3, arg4, arg5),
1446
- _getRestAndDefaultArg14 = _slicedToArray(_getRestAndDefaultArg13, 3),
1447
- rest = _getRestAndDefaultArg14[0],
1448
- error = _getRestAndDefaultArg14[1],
1449
- pipe = _getRestAndDefaultArg14[2];
1312
+ var _restAndDefaultArgs13 = restAndDefaultArgs(arg3, arg4, arg5),
1313
+ _restAndDefaultArgs14 = _slicedToArray(_restAndDefaultArgs13, 3),
1314
+ rest = _restAndDefaultArgs14[0],
1315
+ message = _restAndDefaultArgs14[1],
1316
+ pipe = _restAndDefaultArgs14[2];
1450
1317
  return object(Object.entries(schema.entries).reduce(function (entries, _ref24) {
1451
1318
  var _ref25 = _slicedToArray(_ref24, 2),
1452
1319
  key = _ref25[0],
1453
1320
  schema2 = _ref25[1];
1454
1321
  return keys.includes(key) ? entries : _objectSpread2(_objectSpread2({}, entries), {}, _defineProperty({}, key, schema2));
1455
- }, {}), rest, error, pipe);
1322
+ }, {}), rest, message, pipe);
1456
1323
  }
1457
1324
 
1458
1325
  // src/methods/parse/parse.ts
@@ -1467,35 +1334,55 @@
1467
1334
  // src/methods/safeParse/safeParse.ts
1468
1335
  function safeParse(schema, input, info) {
1469
1336
  var result = schema._parse(input, info);
1470
- return result.issues ? {
1471
- success: false,
1472
- error: new ValiError(result.issues),
1473
- issues: result.issues
1474
- } : {
1475
- success: true,
1337
+ return {
1338
+ typed: result.typed,
1339
+ success: !result.issues,
1476
1340
  data: result.output,
1477
- output: result.output
1341
+ output: result.output,
1342
+ error: result.issues && new ValiError(result.issues),
1343
+ issues: result.issues
1478
1344
  };
1479
1345
  }
1480
1346
 
1481
1347
  // src/validations/custom/custom.ts
1482
- function custom(requirement, error) {
1483
- return function (input) {
1484
- return !requirement(input) ? getPipeIssues("custom", error || "Invalid input", input) : getOutput(input);
1348
+ function custom(requirement) {
1349
+ var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "Invalid input";
1350
+ return {
1351
+ type: "custom",
1352
+ async: false,
1353
+ message: message,
1354
+ requirement: requirement,
1355
+ _parse: function _parse(input) {
1356
+ return !this.requirement(input) ? actionIssue(this.type, this.message, input, this.requirement) : actionOutput(input);
1357
+ }
1485
1358
  };
1486
1359
  }
1487
1360
 
1488
1361
  // src/validations/notValue/notValue.ts
1489
- function notValue(requirement, error) {
1490
- return function (input) {
1491
- return input === requirement ? getPipeIssues("not_value", error || "Invalid value", input) : getOutput(input);
1362
+ function notValue(requirement) {
1363
+ var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "Invalid value";
1364
+ return {
1365
+ type: "not_value",
1366
+ async: false,
1367
+ message: message,
1368
+ requirement: requirement,
1369
+ _parse: function _parse(input) {
1370
+ return input === this.requirement ? actionIssue(this.type, this.message, input, this.requirement) : actionOutput(input);
1371
+ }
1492
1372
  };
1493
1373
  }
1494
1374
 
1495
1375
  // src/validations/regex/regex.ts
1496
- function regex(requirement, error) {
1497
- return function (input) {
1498
- return !requirement.test(input) ? getPipeIssues("regex", error || "Invalid regex", input) : getOutput(input);
1376
+ function regex(requirement) {
1377
+ var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "Invalid regex";
1378
+ return {
1379
+ type: "regex",
1380
+ async: false,
1381
+ message: message,
1382
+ requirement: requirement,
1383
+ _parse: function _parse(input) {
1384
+ return !this.requirement.test(input) ? actionIssue(this.type, this.message, input, this.requirement) : actionOutput(input);
1385
+ }
1499
1386
  };
1500
1387
  }
1501
1388
 
@@ -3004,11 +2891,11 @@
3004
2891
  const cache = imageCache[this.cacheKey];
3005
2892
  if (cache) {
3006
2893
  this.image = cache.image;
3007
- setTimeout(() => {
2894
+ window.setTimeout(() => {
3008
2895
  delete this.image;
3009
2896
  }, this.comment.long * 10 + config.cacheAge);
3010
2897
  clearTimeout(cache.timeout);
3011
- cache.timeout = setTimeout(() => {
2898
+ cache.timeout = window.setTimeout(() => {
3012
2899
  imageCache[this.cacheKey]?.image.destroy();
3013
2900
  delete imageCache[this.cacheKey];
3014
2901
  }, this.comment.long * 10 + config.cacheAge);
@@ -3026,11 +2913,11 @@
3026
2913
  }
3027
2914
  _cacheImage(image) {
3028
2915
  this.image = image;
3029
- setTimeout(() => {
2916
+ window.setTimeout(() => {
3030
2917
  delete this.image;
3031
2918
  }, this.comment.long * 10 + config.cacheAge);
3032
2919
  imageCache[this.cacheKey] = {
3033
- timeout: setTimeout(() => {
2920
+ timeout: window.setTimeout(() => {
3034
2921
  delete imageCache[this.cacheKey];
3035
2922
  }, this.comment.long * 10 + config.cacheAge),
3036
2923
  image,
@@ -4651,6 +4538,8 @@
4651
4538
  }
4652
4539
  this.renderer = renderer;
4653
4540
  this.renderer.setLineWidth(getConfig(config.contextLineWidth, false));
4541
+ const rendererSize = this.renderer.getSize();
4542
+ this.renderer.setScale(rendererSize.width / config.canvasWidth, rendererSize.height / config.canvasHeight);
4654
4543
  let formatType = options.format;
4655
4544
  if (options.formatted) {
4656
4545
  console.warn("Deprecated: options.formatted is no longer recommended. Please use options.format. https://xpadev-net.github.io/niconicomments/#p_format");