@mattrglobal/verifier-sdk-web 1.1.1-unstable.160 → 1.1.1-unstable.162

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.
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * neverthrow -- 4.3.0
15
15
  *
16
- * valibot -- 0.38.0
16
+ * valibot -- 1.1.0
17
17
  *
18
18
  * is-mobile -- 4.0.0
19
19
  */
@@ -647,9 +647,9 @@ function _addIssue(context, label, dataset, config2, other) {
647
647
  abortPipeEarly: config2.abortPipeEarly
648
648
  };
649
649
  var isSchema = context.kind === "schema";
650
- var message = (_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);
651
- if (message) {
652
- issue.message = typeof message === "function" ? message(issue) : message;
650
+ 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);
651
+ if (message2 !== void 0) {
652
+ issue.message = typeof message2 === "function" ? message2(issue) : message2;
653
653
  }
654
654
  if (isSchema) {
655
655
  dataset.typed = false;
@@ -661,28 +661,40 @@ function _addIssue(context, label, dataset, config2, other) {
661
661
  }
662
662
  }
663
663
 
664
+ function _getStandardProps(context) {
665
+ return {
666
+ version: 1,
667
+ vendor: "valibot",
668
+ validate: function validate(value2) {
669
+ return context["~run"]({
670
+ value: value2
671
+ }, getGlobalConfig());
672
+ }
673
+ };
674
+ }
675
+
664
676
  function _isValidObjectKey(object2, key) {
665
677
  return Object.hasOwn(object2, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
666
678
  }
667
679
 
668
- function _joinExpects(values, separator) {
680
+ function _joinExpects(values2, separator) {
669
681
  var _list$;
670
- var list = _toConsumableArray(new Set(values));
682
+ var list = _toConsumableArray(new Set(values2));
671
683
  if (list.length > 1) {
672
684
  return "(".concat(list.join(" ".concat(separator, " ")), ")");
673
685
  }
674
686
  return (_list$ = list[0]) !== null && _list$ !== void 0 ? _list$ : "never";
675
687
  }
676
688
 
677
- function nonEmpty(message) {
689
+ function nonEmpty(message2) {
678
690
  return {
679
691
  kind: "validation",
680
692
  type: "non_empty",
681
693
  reference: nonEmpty,
682
694
  async: false,
683
695
  expects: "!0",
684
- message: message,
685
- _run: function _run(dataset, config2) {
696
+ message: message2,
697
+ "~run": function run(dataset, config2) {
686
698
  if (dataset.typed && dataset.value.length === 0) {
687
699
  _addIssue(this, "length", dataset, config2, {
688
700
  received: "0"
@@ -693,6 +705,10 @@ function nonEmpty(message) {
693
705
  };
694
706
  }
695
707
 
708
+ function getFallback(schema, dataset, config2) {
709
+ return typeof schema.fallback === "function" ? schema.fallback(dataset, config2) : schema.fallback;
710
+ }
711
+
696
712
  function getDefault(schema, dataset, config2) {
697
713
  return typeof schema["default"] === "function" ? schema["default"](dataset, config2) : schema["default"];
698
714
  }
@@ -704,14 +720,17 @@ function any() {
704
720
  reference: any,
705
721
  expects: "any",
706
722
  async: false,
707
- _run: function _run(dataset) {
723
+ get "~standard"() {
724
+ return _getStandardProps(this);
725
+ },
726
+ "~run": function run(dataset) {
708
727
  dataset.typed = true;
709
728
  return dataset;
710
729
  }
711
730
  };
712
731
  }
713
732
 
714
- function array(item, message) {
733
+ function array(item, message2) {
715
734
  return {
716
735
  kind: "schema",
717
736
  type: "array",
@@ -719,16 +738,18 @@ function array(item, message) {
719
738
  expects: "Array",
720
739
  async: false,
721
740
  item: item,
722
- message: message,
723
- _run: function _run(dataset, config2) {
741
+ message: message2,
742
+ get "~standard"() {
743
+ return _getStandardProps(this);
744
+ },
745
+ "~run": function run(dataset, config2) {
724
746
  var input = dataset.value;
725
747
  if (Array.isArray(input)) {
726
748
  dataset.typed = true;
727
749
  dataset.value = [];
728
750
  for (var key = 0; key < input.length; key++) {
729
751
  var value2 = input[key];
730
- var itemDataset = this.item._run({
731
- typed: false,
752
+ var itemDataset = this.item["~run"]({
732
753
  value: value2
733
754
  }, config2);
734
755
  if (itemDataset.issues) {
@@ -739,11 +760,11 @@ function array(item, message) {
739
760
  key: key,
740
761
  value: value2
741
762
  };
742
- var _iterator10 = _createForOfIteratorHelper(itemDataset.issues), _step10;
763
+ var _iterator14 = _createForOfIteratorHelper(itemDataset.issues), _step14;
743
764
  try {
744
- for (_iterator10.s(); !(_step10 = _iterator10.n()).done; ) {
765
+ for (_iterator14.s(); !(_step14 = _iterator14.n()).done; ) {
745
766
  var _dataset$issues;
746
- var issue = _step10.value;
767
+ var issue = _step14.value;
747
768
  if (issue.path) {
748
769
  issue.path.unshift(pathItem);
749
770
  } else {
@@ -752,9 +773,9 @@ function array(item, message) {
752
773
  (_dataset$issues = dataset.issues) === null || _dataset$issues === void 0 || _dataset$issues.push(issue);
753
774
  }
754
775
  } catch (err) {
755
- _iterator10.e(err);
776
+ _iterator14.e(err);
756
777
  } finally {
757
- _iterator10.f();
778
+ _iterator14.f();
758
779
  }
759
780
  if (!dataset.issues) {
760
781
  dataset.issues = itemDataset.issues;
@@ -777,15 +798,18 @@ function array(item, message) {
777
798
  };
778
799
  }
779
800
 
780
- function _boolean(message) {
801
+ function _boolean(message2) {
781
802
  return {
782
803
  kind: "schema",
783
804
  type: "boolean",
784
805
  reference: _boolean,
785
806
  expects: "boolean",
786
807
  async: false,
787
- message: message,
788
- _run: function _run(dataset, config2) {
808
+ message: message2,
809
+ get "~standard"() {
810
+ return _getStandardProps(this);
811
+ },
812
+ "~run": function run(dataset, config2) {
789
813
  if (typeof dataset.value === "boolean") {
790
814
  dataset.typed = true;
791
815
  } else {
@@ -796,7 +820,7 @@ function _boolean(message) {
796
820
  };
797
821
  }
798
822
 
799
- function literal(literal_, message) {
823
+ function literal(literal_, message2) {
800
824
  return {
801
825
  kind: "schema",
802
826
  type: "literal",
@@ -804,8 +828,11 @@ function literal(literal_, message) {
804
828
  expects: _stringify(literal_),
805
829
  async: false,
806
830
  literal: literal_,
807
- message: message,
808
- _run: function _run(dataset, config2) {
831
+ message: message2,
832
+ get "~standard"() {
833
+ return _getStandardProps(this);
834
+ },
835
+ "~run": function run(dataset, config2) {
809
836
  if (dataset.value === this.literal) {
810
837
  dataset.typed = true;
811
838
  } else {
@@ -816,15 +843,18 @@ function literal(literal_, message) {
816
843
  };
817
844
  }
818
845
 
819
- function number(message) {
846
+ function number(message2) {
820
847
  return {
821
848
  kind: "schema",
822
849
  type: "number",
823
850
  reference: number,
824
851
  expects: "number",
825
852
  async: false,
826
- message: message,
827
- _run: function _run(dataset, config2) {
853
+ message: message2,
854
+ get "~standard"() {
855
+ return _getStandardProps(this);
856
+ },
857
+ "~run": function run(dataset, config2) {
828
858
  if (typeof dataset.value === "number" && !isNaN(dataset.value)) {
829
859
  dataset.typed = true;
830
860
  } else {
@@ -835,65 +865,85 @@ function number(message) {
835
865
  };
836
866
  }
837
867
 
838
- function object(entries, message) {
868
+ function object(entries2, message2) {
839
869
  return {
840
870
  kind: "schema",
841
871
  type: "object",
842
872
  reference: object,
843
873
  expects: "Object",
844
874
  async: false,
845
- entries: entries,
846
- message: message,
847
- _run: function _run(dataset, config2) {
875
+ entries: entries2,
876
+ message: message2,
877
+ get "~standard"() {
878
+ return _getStandardProps(this);
879
+ },
880
+ "~run": function run(dataset, config2) {
848
881
  var input = dataset.value;
849
882
  if (input && _typeof(input) === "object") {
850
883
  dataset.typed = true;
851
884
  dataset.value = {};
852
885
  for (var key in this.entries) {
853
- var value2 = input[key];
854
- var valueDataset = this.entries[key]._run({
855
- typed: false,
856
- value: value2
857
- }, config2);
858
- if (valueDataset.issues) {
859
- var pathItem = {
860
- type: "object",
861
- origin: "value",
862
- input: input,
863
- key: key,
886
+ var valueSchema = this.entries[key];
887
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema["default"] !== void 0) {
888
+ var value2 = key in input ? input[key] : getDefault(valueSchema);
889
+ var valueDataset = valueSchema["~run"]({
864
890
  value: value2
865
- };
866
- var _iterator26 = _createForOfIteratorHelper(valueDataset.issues), _step26;
867
- try {
868
- for (_iterator26.s(); !(_step26 = _iterator26.n()).done; ) {
869
- var _dataset$issues13;
870
- var issue = _step26.value;
871
- if (issue.path) {
872
- issue.path.unshift(pathItem);
873
- } else {
874
- issue.path = [ pathItem ];
891
+ }, config2);
892
+ if (valueDataset.issues) {
893
+ var pathItem = {
894
+ type: "object",
895
+ origin: "value",
896
+ input: input,
897
+ key: key,
898
+ value: value2
899
+ };
900
+ var _iterator30 = _createForOfIteratorHelper(valueDataset.issues), _step30;
901
+ try {
902
+ for (_iterator30.s(); !(_step30 = _iterator30.n()).done; ) {
903
+ var _dataset$issues13;
904
+ var issue = _step30.value;
905
+ if (issue.path) {
906
+ issue.path.unshift(pathItem);
907
+ } else {
908
+ issue.path = [ pathItem ];
909
+ }
910
+ (_dataset$issues13 = dataset.issues) === null || _dataset$issues13 === void 0 || _dataset$issues13.push(issue);
875
911
  }
876
- (_dataset$issues13 = dataset.issues) === null || _dataset$issues13 === void 0 || _dataset$issues13.push(issue);
912
+ } catch (err) {
913
+ _iterator30.e(err);
914
+ } finally {
915
+ _iterator30.f();
916
+ }
917
+ if (!dataset.issues) {
918
+ dataset.issues = valueDataset.issues;
919
+ }
920
+ if (config2.abortEarly) {
921
+ dataset.typed = false;
922
+ break;
877
923
  }
878
- } catch (err) {
879
- _iterator26.e(err);
880
- } finally {
881
- _iterator26.f();
882
924
  }
883
- if (!dataset.issues) {
884
- dataset.issues = valueDataset.issues;
925
+ if (!valueDataset.typed) {
926
+ dataset.typed = false;
885
927
  }
928
+ dataset.value[key] = valueDataset.value;
929
+ } else if (valueSchema.fallback !== void 0) {
930
+ dataset.value[key] = getFallback(valueSchema);
931
+ } else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
932
+ _addIssue(this, "key", dataset, config2, {
933
+ input: void 0,
934
+ expected: '"'.concat(key, '"'),
935
+ path: [ {
936
+ type: "object",
937
+ origin: "key",
938
+ input: input,
939
+ key: key,
940
+ value: input[key]
941
+ } ]
942
+ });
886
943
  if (config2.abortEarly) {
887
- dataset.typed = false;
888
944
  break;
889
945
  }
890
946
  }
891
- if (!valueDataset.typed) {
892
- dataset.typed = false;
893
- }
894
- if (valueDataset.value !== void 0 || key in input) {
895
- dataset.value[key] = valueDataset.value;
896
- }
897
947
  }
898
948
  } else {
899
949
  _addIssue(this, "type", dataset, config2);
@@ -903,17 +953,21 @@ function object(entries, message) {
903
953
  };
904
954
  }
905
955
 
906
- function optional(wrapped) {
907
- var schema = {
956
+ function optional(wrapped, default_) {
957
+ return {
908
958
  kind: "schema",
909
959
  type: "optional",
910
960
  reference: optional,
911
961
  expects: "(".concat(wrapped.expects, " | undefined)"),
912
962
  async: false,
913
963
  wrapped: wrapped,
914
- _run: function _run(dataset, config2) {
964
+ default: default_,
965
+ get "~standard"() {
966
+ return _getStandardProps(this);
967
+ },
968
+ "~run": function run(dataset, config2) {
915
969
  if (dataset.value === void 0) {
916
- if ("default" in this) {
970
+ if (this["default"] !== void 0) {
917
971
  dataset.value = getDefault(this, dataset, config2);
918
972
  }
919
973
  if (dataset.value === void 0) {
@@ -921,19 +975,12 @@ function optional(wrapped) {
921
975
  return dataset;
922
976
  }
923
977
  }
924
- return this.wrapped._run(dataset, config2);
978
+ return this.wrapped["~run"](dataset, config2);
925
979
  }
926
980
  };
927
- for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key11 = 1; _key11 < _len5; _key11++) {
928
- args[_key11 - 1] = arguments[_key11];
929
- }
930
- if (0 in args) {
931
- schema["default"] = args[0];
932
- }
933
- return schema;
934
981
  }
935
982
 
936
- function picklist(options, message) {
983
+ function picklist(options, message2) {
937
984
  return {
938
985
  kind: "schema",
939
986
  type: "picklist",
@@ -941,8 +988,11 @@ function picklist(options, message) {
941
988
  expects: _joinExpects(options.map(_stringify), "|"),
942
989
  async: false,
943
990
  options: options,
944
- message: message,
945
- _run: function _run(dataset, config2) {
991
+ message: message2,
992
+ get "~standard"() {
993
+ return _getStandardProps(this);
994
+ },
995
+ "~run": function run(dataset, config2) {
946
996
  if (this.options.includes(dataset.value)) {
947
997
  dataset.typed = true;
948
998
  } else {
@@ -953,7 +1003,7 @@ function picklist(options, message) {
953
1003
  };
954
1004
  }
955
1005
 
956
- function record(key, value2, message) {
1006
+ function record(key, value2, message2) {
957
1007
  return {
958
1008
  kind: "schema",
959
1009
  type: "record",
@@ -962,8 +1012,11 @@ function record(key, value2, message) {
962
1012
  async: false,
963
1013
  key: key,
964
1014
  value: value2,
965
- message: message,
966
- _run: function _run(dataset, config2) {
1015
+ message: message2,
1016
+ get "~standard"() {
1017
+ return _getStandardProps(this);
1018
+ },
1019
+ "~run": function run(dataset, config2) {
967
1020
  var input = dataset.value;
968
1021
  if (input && _typeof(input) === "object") {
969
1022
  dataset.typed = true;
@@ -971,8 +1024,7 @@ function record(key, value2, message) {
971
1024
  for (var entryKey in input) {
972
1025
  if (_isValidObjectKey(input, entryKey)) {
973
1026
  var entryValue = input[entryKey];
974
- var keyDataset = this.key._run({
975
- typed: false,
1027
+ var keyDataset = this.key["~run"]({
976
1028
  value: entryKey
977
1029
  }, config2);
978
1030
  if (keyDataset.issues) {
@@ -983,18 +1035,18 @@ function record(key, value2, message) {
983
1035
  key: entryKey,
984
1036
  value: entryValue
985
1037
  };
986
- var _iterator35 = _createForOfIteratorHelper(keyDataset.issues), _step35;
1038
+ var _iterator39 = _createForOfIteratorHelper(keyDataset.issues), _step39;
987
1039
  try {
988
- for (_iterator35.s(); !(_step35 = _iterator35.n()).done; ) {
1040
+ for (_iterator39.s(); !(_step39 = _iterator39.n()).done; ) {
989
1041
  var _dataset$issues19;
990
- var issue = _step35.value;
1042
+ var issue = _step39.value;
991
1043
  issue.path = [ pathItem ];
992
1044
  (_dataset$issues19 = dataset.issues) === null || _dataset$issues19 === void 0 || _dataset$issues19.push(issue);
993
1045
  }
994
1046
  } catch (err) {
995
- _iterator35.e(err);
1047
+ _iterator39.e(err);
996
1048
  } finally {
997
- _iterator35.f();
1049
+ _iterator39.f();
998
1050
  }
999
1051
  if (!dataset.issues) {
1000
1052
  dataset.issues = keyDataset.issues;
@@ -1004,8 +1056,7 @@ function record(key, value2, message) {
1004
1056
  break;
1005
1057
  }
1006
1058
  }
1007
- var valueDataset = this.value._run({
1008
- typed: false,
1059
+ var valueDataset = this.value["~run"]({
1009
1060
  value: entryValue
1010
1061
  }, config2);
1011
1062
  if (valueDataset.issues) {
@@ -1016,11 +1067,11 @@ function record(key, value2, message) {
1016
1067
  key: entryKey,
1017
1068
  value: entryValue
1018
1069
  };
1019
- var _iterator36 = _createForOfIteratorHelper(valueDataset.issues), _step36;
1070
+ var _iterator40 = _createForOfIteratorHelper(valueDataset.issues), _step40;
1020
1071
  try {
1021
- for (_iterator36.s(); !(_step36 = _iterator36.n()).done; ) {
1072
+ for (_iterator40.s(); !(_step40 = _iterator40.n()).done; ) {
1022
1073
  var _dataset$issues20;
1023
- var _issue5 = _step36.value;
1074
+ var _issue5 = _step40.value;
1024
1075
  if (_issue5.path) {
1025
1076
  _issue5.path.unshift(_pathItem5);
1026
1077
  } else {
@@ -1029,9 +1080,9 @@ function record(key, value2, message) {
1029
1080
  (_dataset$issues20 = dataset.issues) === null || _dataset$issues20 === void 0 || _dataset$issues20.push(_issue5);
1030
1081
  }
1031
1082
  } catch (err) {
1032
- _iterator36.e(err);
1083
+ _iterator40.e(err);
1033
1084
  } finally {
1034
- _iterator36.f();
1085
+ _iterator40.f();
1035
1086
  }
1036
1087
  if (!dataset.issues) {
1037
1088
  dataset.issues = valueDataset.issues;
@@ -1057,79 +1108,98 @@ function record(key, value2, message) {
1057
1108
  };
1058
1109
  }
1059
1110
 
1060
- function strictObject(entries, message) {
1111
+ function strictObject(entries2, message2) {
1061
1112
  return {
1062
1113
  kind: "schema",
1063
1114
  type: "strict_object",
1064
1115
  reference: strictObject,
1065
1116
  expects: "Object",
1066
1117
  async: false,
1067
- entries: entries,
1068
- message: message,
1069
- _run: function _run(dataset, config2) {
1118
+ entries: entries2,
1119
+ message: message2,
1120
+ get "~standard"() {
1121
+ return _getStandardProps(this);
1122
+ },
1123
+ "~run": function run(dataset, config2) {
1070
1124
  var input = dataset.value;
1071
1125
  if (input && _typeof(input) === "object") {
1072
1126
  dataset.typed = true;
1073
1127
  dataset.value = {};
1074
1128
  for (var key in this.entries) {
1075
- var value2 = input[key];
1076
- var valueDataset = this.entries[key]._run({
1077
- typed: false,
1078
- value: value2
1079
- }, config2);
1080
- if (valueDataset.issues) {
1081
- var pathItem = {
1082
- type: "object",
1083
- origin: "value",
1084
- input: input,
1085
- key: key,
1129
+ var valueSchema = this.entries[key];
1130
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema["default"] !== void 0) {
1131
+ var value2 = key in input ? input[key] : getDefault(valueSchema);
1132
+ var valueDataset = valueSchema["~run"]({
1086
1133
  value: value2
1087
- };
1088
- var _iterator44 = _createForOfIteratorHelper(valueDataset.issues), _step44;
1089
- try {
1090
- for (_iterator44.s(); !(_step44 = _iterator44.n()).done; ) {
1091
- var _dataset$issues25;
1092
- var issue = _step44.value;
1093
- if (issue.path) {
1094
- issue.path.unshift(pathItem);
1095
- } else {
1096
- issue.path = [ pathItem ];
1134
+ }, config2);
1135
+ if (valueDataset.issues) {
1136
+ var pathItem = {
1137
+ type: "object",
1138
+ origin: "value",
1139
+ input: input,
1140
+ key: key,
1141
+ value: value2
1142
+ };
1143
+ var _iterator48 = _createForOfIteratorHelper(valueDataset.issues), _step48;
1144
+ try {
1145
+ for (_iterator48.s(); !(_step48 = _iterator48.n()).done; ) {
1146
+ var _dataset$issues25;
1147
+ var issue = _step48.value;
1148
+ if (issue.path) {
1149
+ issue.path.unshift(pathItem);
1150
+ } else {
1151
+ issue.path = [ pathItem ];
1152
+ }
1153
+ (_dataset$issues25 = dataset.issues) === null || _dataset$issues25 === void 0 || _dataset$issues25.push(issue);
1097
1154
  }
1098
- (_dataset$issues25 = dataset.issues) === null || _dataset$issues25 === void 0 || _dataset$issues25.push(issue);
1155
+ } catch (err) {
1156
+ _iterator48.e(err);
1157
+ } finally {
1158
+ _iterator48.f();
1159
+ }
1160
+ if (!dataset.issues) {
1161
+ dataset.issues = valueDataset.issues;
1162
+ }
1163
+ if (config2.abortEarly) {
1164
+ dataset.typed = false;
1165
+ break;
1099
1166
  }
1100
- } catch (err) {
1101
- _iterator44.e(err);
1102
- } finally {
1103
- _iterator44.f();
1104
1167
  }
1105
- if (!dataset.issues) {
1106
- dataset.issues = valueDataset.issues;
1168
+ if (!valueDataset.typed) {
1169
+ dataset.typed = false;
1107
1170
  }
1171
+ dataset.value[key] = valueDataset.value;
1172
+ } else if (valueSchema.fallback !== void 0) {
1173
+ dataset.value[key] = getFallback(valueSchema);
1174
+ } else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
1175
+ _addIssue(this, "key", dataset, config2, {
1176
+ input: void 0,
1177
+ expected: '"'.concat(key, '"'),
1178
+ path: [ {
1179
+ type: "object",
1180
+ origin: "key",
1181
+ input: input,
1182
+ key: key,
1183
+ value: input[key]
1184
+ } ]
1185
+ });
1108
1186
  if (config2.abortEarly) {
1109
- dataset.typed = false;
1110
1187
  break;
1111
1188
  }
1112
1189
  }
1113
- if (!valueDataset.typed) {
1114
- dataset.typed = false;
1115
- }
1116
- if (valueDataset.value !== void 0 || key in input) {
1117
- dataset.value[key] = valueDataset.value;
1118
- }
1119
1190
  }
1120
1191
  if (!dataset.issues || !config2.abortEarly) {
1121
- for (var _key13 in input) {
1122
- if (!(_key13 in this.entries)) {
1123
- var _value3 = input[_key13];
1124
- _addIssue(this, "type", dataset, config2, {
1125
- input: _value3,
1192
+ for (var _key9 in input) {
1193
+ if (!(_key9 in this.entries)) {
1194
+ _addIssue(this, "key", dataset, config2, {
1195
+ input: _key9,
1126
1196
  expected: "never",
1127
1197
  path: [ {
1128
1198
  type: "object",
1129
- origin: "value",
1199
+ origin: "key",
1130
1200
  input: input,
1131
- key: _key13,
1132
- value: _value3
1201
+ key: _key9,
1202
+ value: input[_key9]
1133
1203
  } ]
1134
1204
  });
1135
1205
  break;
@@ -1144,15 +1214,18 @@ function strictObject(entries, message) {
1144
1214
  };
1145
1215
  }
1146
1216
 
1147
- function string(message) {
1217
+ function string(message2) {
1148
1218
  return {
1149
1219
  kind: "schema",
1150
1220
  type: "string",
1151
1221
  reference: string,
1152
1222
  expects: "string",
1153
1223
  async: false,
1154
- message: message,
1155
- _run: function _run(dataset, config2) {
1224
+ message: message2,
1225
+ get "~standard"() {
1226
+ return _getStandardProps(this);
1227
+ },
1228
+ "~run": function run(dataset, config2) {
1156
1229
  if (typeof dataset.value === "string") {
1157
1230
  dataset.typed = true;
1158
1231
  } else {
@@ -1166,10 +1239,10 @@ function string(message) {
1166
1239
  function _subIssues(datasets) {
1167
1240
  var issues;
1168
1241
  if (datasets) {
1169
- var _iterator59 = _createForOfIteratorHelper(datasets), _step59;
1242
+ var _iterator63 = _createForOfIteratorHelper(datasets), _step63;
1170
1243
  try {
1171
- for (_iterator59.s(); !(_step59 = _iterator59.n()).done; ) {
1172
- var dataset = _step59.value;
1244
+ for (_iterator63.s(); !(_step63 = _iterator63.n()).done; ) {
1245
+ var dataset = _step63.value;
1173
1246
  if (issues) {
1174
1247
  var _issues;
1175
1248
  (_issues = issues).push.apply(_issues, _toConsumableArray(dataset.issues));
@@ -1178,15 +1251,15 @@ function _subIssues(datasets) {
1178
1251
  }
1179
1252
  }
1180
1253
  } catch (err) {
1181
- _iterator59.e(err);
1254
+ _iterator63.e(err);
1182
1255
  } finally {
1183
- _iterator59.f();
1256
+ _iterator63.f();
1184
1257
  }
1185
1258
  }
1186
1259
  return issues;
1187
1260
  }
1188
1261
 
1189
- function union(options, message) {
1262
+ function union(options, message2) {
1190
1263
  return {
1191
1264
  kind: "schema",
1192
1265
  type: "union",
@@ -1196,18 +1269,20 @@ function union(options, message) {
1196
1269
  })), "|"),
1197
1270
  async: false,
1198
1271
  options: options,
1199
- message: message,
1200
- _run: function _run(dataset, config2) {
1272
+ message: message2,
1273
+ get "~standard"() {
1274
+ return _getStandardProps(this);
1275
+ },
1276
+ "~run": function run(dataset, config2) {
1201
1277
  var _untypedDatasets;
1202
1278
  var validDataset;
1203
1279
  var typedDatasets;
1204
1280
  var untypedDatasets;
1205
- var _iterator60 = _createForOfIteratorHelper(this.options), _step60;
1281
+ var _iterator64 = _createForOfIteratorHelper(this.options), _step64;
1206
1282
  try {
1207
- for (_iterator60.s(); !(_step60 = _iterator60.n()).done; ) {
1208
- var schema = _step60.value;
1209
- var optionDataset = schema._run({
1210
- typed: false,
1283
+ for (_iterator64.s(); !(_step64 = _iterator64.n()).done; ) {
1284
+ var schema = _step64.value;
1285
+ var optionDataset = schema["~run"]({
1211
1286
  value: dataset.value
1212
1287
  }, config2);
1213
1288
  if (optionDataset.typed) {
@@ -1230,9 +1305,9 @@ function union(options, message) {
1230
1305
  }
1231
1306
  }
1232
1307
  } catch (err) {
1233
- _iterator60.e(err);
1308
+ _iterator64.e(err);
1234
1309
  } finally {
1235
- _iterator60.f();
1310
+ _iterator64.f();
1236
1311
  }
1237
1312
  if (validDataset) {
1238
1313
  return validDataset;
@@ -1264,7 +1339,10 @@ function unknown() {
1264
1339
  reference: unknown,
1265
1340
  expects: "unknown",
1266
1341
  async: false,
1267
- _run: function _run(dataset) {
1342
+ get "~standard"() {
1343
+ return _getStandardProps(this);
1344
+ },
1345
+ "~run": function run(dataset) {
1268
1346
  dataset.typed = true;
1269
1347
  return dataset;
1270
1348
  }
@@ -1272,21 +1350,24 @@ function unknown() {
1272
1350
  }
1273
1351
 
1274
1352
  function pipe() {
1275
- for (var _len7 = arguments.length, pipe2 = new Array(_len7), _key17 = 0; _key17 < _len7; _key17++) {
1276
- pipe2[_key17] = arguments[_key17];
1353
+ for (var _len3 = arguments.length, pipe2 = new Array(_len3), _key13 = 0; _key13 < _len3; _key13++) {
1354
+ pipe2[_key13] = arguments[_key13];
1277
1355
  }
1278
1356
  return _objectSpread2(_objectSpread2({}, pipe2[0]), {}, {
1279
1357
  pipe: pipe2,
1280
- _run: function _run(dataset, config2) {
1281
- for (var _i = 0, _pipe = pipe2; _i < _pipe.length; _i++) {
1282
- var item = _pipe[_i];
1358
+ get "~standard"() {
1359
+ return _getStandardProps(this);
1360
+ },
1361
+ "~run": function run(dataset, config2) {
1362
+ for (var _i2 = 0, _pipe = pipe2; _i2 < _pipe.length; _i2++) {
1363
+ var item = _pipe[_i2];
1283
1364
  if (item.kind !== "metadata") {
1284
1365
  if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
1285
1366
  dataset.typed = false;
1286
1367
  break;
1287
1368
  }
1288
1369
  if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) {
1289
- dataset = item._run(dataset, config2);
1370
+ dataset = item["~run"](dataset, config2);
1290
1371
  }
1291
1372
  }
1292
1373
  }
@@ -1296,8 +1377,7 @@ function pipe() {
1296
1377
  }
1297
1378
 
1298
1379
  function safeParse(schema, input, config2) {
1299
- var dataset = schema._run({
1300
- typed: false,
1380
+ var dataset = schema["~run"]({
1301
1381
  value: input
1302
1382
  }, getGlobalConfig(config2));
1303
1383
  return {
@@ -1310,10 +1390,20 @@ function safeParse(schema, input, config2) {
1310
1390
 
1311
1391
  const isType = validator => value => safeParse(validator, value).success;
1312
1392
 
1313
- const getValidationErrors = issues => issues.map((({message: message, path: path}) => ({
1314
- message: message,
1315
- path: path === null || path === void 0 ? void 0 : path.map((path => path.key))
1316
- })));
1393
+ const getValidationErrors = issues => {
1394
+ const formatIssue = ({message: message, path: path}) => ({
1395
+ message: message,
1396
+ path: path === null || path === void 0 ? void 0 : path.map((p => p.key))
1397
+ });
1398
+ const uniqueErrors = new Map;
1399
+ issues.flatMap((issue => issue.type === "union" && issue.issues ? issue.issues.map(formatIssue) : [ formatIssue(issue) ])).forEach((error => {
1400
+ const key = `${error.message}-${JSON.stringify(error.path)}`;
1401
+ if (!uniqueErrors.has(key)) {
1402
+ uniqueErrors.set(key, error);
1403
+ }
1404
+ }));
1405
+ return Array.from(uniqueErrors.values());
1406
+ };
1317
1407
 
1318
1408
  const validateType = (value, validator) => {
1319
1409
  const result = safeParse(validator, value);
@@ -1406,14 +1496,6 @@ var PresentationErrorType;
1406
1496
  PresentationErrorType["Unknown"] = "Unknown";
1407
1497
  })(PresentationErrorType || (PresentationErrorType = {}));
1408
1498
 
1409
- const PresentationSuccessResultValidator = object({
1410
- sessionId: string(),
1411
- challenge: string(),
1412
- credentialQuery: array(CredentialQueryValidator),
1413
- credentials: optional(array(any())),
1414
- credentialErrors: optional(array(any()))
1415
- });
1416
-
1417
1499
  const PresentationResultRelaxValidator = object({
1418
1500
  sessionId: string(),
1419
1501
  challenge: optional(string()),
@@ -1423,18 +1505,6 @@ const PresentationResultRelaxValidator = object({
1423
1505
  error: optional(unknown())
1424
1506
  });
1425
1507
 
1426
- const PresentationFailureResultValidator = object({
1427
- sessionId: string(),
1428
- challenge: string(),
1429
- credentialQuery: array(CredentialQueryValidator),
1430
- error: object({
1431
- type: picklist(Object.values(PresentationErrorType)),
1432
- message: string()
1433
- })
1434
- });
1435
-
1436
- const PresentationSessionResultValidator = union([ PresentationSuccessResultValidator, PresentationFailureResultValidator ]);
1437
-
1438
1508
  exports.Mode = void 0;
1439
1509
 
1440
1510
  (function(Mode) {
@@ -1888,7 +1958,7 @@ const receiveMessageHandler = options => async event => {
1888
1958
  return;
1889
1959
  }
1890
1960
  onComplete({
1891
- result: isType(PresentationSessionResultValidator)(result.value) ? result.value : undefined,
1961
+ result: "challenge" in result.value ? result.value : undefined,
1892
1962
  sessionId: result.value.sessionId,
1893
1963
  sessionCompletedInRedirect: false
1894
1964
  });
@@ -2031,7 +2101,7 @@ const requestCredentialsWithDigitalCredentialsApi = async options => {
2031
2101
  }
2032
2102
  const verificationResult = credentialVerificationResult.value;
2033
2103
  return ok({
2034
- result: isType(PresentationSessionResultValidator)(verificationResult) ? verificationResult : undefined,
2104
+ result: "challenge" in verificationResult ? verificationResult : undefined,
2035
2105
  sessionId: sessionId
2036
2106
  });
2037
2107
  };