@fern-api/venus-api-sdk 0.0.18 → 0.0.20

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 (80) hide show
  1. package/core.d.ts +1 -0
  2. package/dist/browser/cjs/core.js +702 -167
  3. package/dist/browser/cjs/index.js +996 -391
  4. package/dist/browser/cjs/serialization.js +930 -329
  5. package/dist/browser/esm/core.js +702 -167
  6. package/dist/browser/esm/index.js +996 -391
  7. package/dist/browser/esm/serialization.js +936 -329
  8. package/dist/node/core.js +702 -167
  9. package/dist/node/index.js +996 -391
  10. package/dist/node/serialization.js +1002 -391
  11. package/package.json +2 -2
  12. package/serialization.d.ts +1 -0
  13. package/types/api/resources/organization/client/Client.d.ts +6 -6
  14. package/types/api/resources/organization/client/addUser.d.ts +0 -1
  15. package/types/api/resources/organization/client/create.d.ts +0 -1
  16. package/types/api/resources/organization/client/get.d.ts +0 -1
  17. package/types/api/resources/organization/client/getMyOrganizationFromScopedToken.d.ts +0 -1
  18. package/types/api/resources/organization/client/isMember.d.ts +0 -1
  19. package/types/api/resources/organization/client/update.d.ts +0 -1
  20. package/types/api/resources/registry/client/Client.d.ts +3 -3
  21. package/types/api/resources/registry/client/generateRegistryTokens.d.ts +0 -1
  22. package/types/api/resources/registry/client/hasRegistryPermission.d.ts +0 -1
  23. package/types/api/resources/registry/client/revokeToken.d.ts +0 -1
  24. package/types/api/resources/user/client/Client.d.ts +2 -2
  25. package/types/api/resources/user/client/getMyOrganizations.d.ts +0 -1
  26. package/types/api/resources/user/client/getMyself.d.ts +0 -1
  27. package/types/core/fetcher/Fetcher.d.ts +1 -1
  28. package/types/core/schemas/Schema.d.ts +35 -7
  29. package/types/core/schemas/builders/enum/enum.d.ts +1 -1
  30. package/types/core/schemas/builders/index.d.ts +0 -1
  31. package/types/core/schemas/builders/literals/stringLiteral.d.ts +1 -1
  32. package/types/core/schemas/builders/object/types.d.ts +5 -4
  33. package/types/core/schemas/builders/object-like/getObjectLikeUtils.d.ts +4 -3
  34. package/types/core/schemas/builders/object-like/index.d.ts +2 -2
  35. package/types/core/schemas/builders/object-like/types.d.ts +2 -8
  36. package/types/core/schemas/builders/primitives/any.d.ts +1 -1
  37. package/types/core/schemas/builders/primitives/boolean.d.ts +1 -1
  38. package/types/core/schemas/builders/primitives/number.d.ts +1 -1
  39. package/types/core/schemas/builders/primitives/string.d.ts +1 -1
  40. package/types/core/schemas/builders/primitives/unknown.d.ts +1 -1
  41. package/types/core/schemas/builders/record/index.d.ts +1 -0
  42. package/types/core/schemas/builders/record/record.d.ts +2 -1
  43. package/types/core/schemas/builders/record/types.d.ts +5 -0
  44. package/types/core/schemas/builders/schema-utils/JsonError.d.ts +5 -0
  45. package/types/core/schemas/builders/schema-utils/ParseError.d.ts +5 -0
  46. package/types/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +11 -6
  47. package/types/core/schemas/builders/schema-utils/index.d.ts +2 -1
  48. package/types/core/schemas/builders/schema-utils/stringifyValidationErrors.d.ts +2 -0
  49. package/types/core/schemas/utils/MaybePromise.d.ts +1 -0
  50. package/types/core/schemas/utils/OptionalRecord.d.ts +1 -0
  51. package/types/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +3 -3
  52. package/types/core/schemas/utils/createIdentitySchemaCreator.d.ts +2 -0
  53. package/types/core/schemas/utils/isPlainObject.d.ts +2 -0
  54. package/types/serialization/resources/index.d.ts +2 -0
  55. package/types/serialization/resources/organization/client/addUser.d.ts +0 -7
  56. package/types/serialization/resources/organization/client/create.d.ts +0 -7
  57. package/types/serialization/resources/organization/client/get.d.ts +0 -4
  58. package/types/serialization/resources/organization/client/getMyOrganizationFromScopedToken.d.ts +0 -4
  59. package/types/serialization/resources/organization/client/index.d.ts +1 -0
  60. package/types/serialization/resources/organization/client/requests/AddUserToOrgRequest.d.ts +13 -0
  61. package/types/serialization/resources/organization/client/requests/CreateOrganizationRequest.d.ts +13 -0
  62. package/types/serialization/resources/organization/client/requests/UpdateOrganizationRequest.d.ts +12 -0
  63. package/types/serialization/resources/organization/client/requests/index.d.ts +3 -0
  64. package/types/serialization/resources/organization/client/update.d.ts +0 -6
  65. package/types/serialization/resources/registry/client/generateRegistryTokens.d.ts +0 -10
  66. package/types/serialization/resources/registry/client/hasRegistryPermission.d.ts +1 -8
  67. package/types/serialization/resources/registry/client/index.d.ts +1 -0
  68. package/types/serialization/resources/registry/client/requests/CheckRegistryPermissionRequest.d.ts +13 -0
  69. package/types/serialization/resources/registry/client/requests/GenerateRegistryTokensRequest.d.ts +12 -0
  70. package/types/serialization/resources/registry/client/requests/RevokeTokenRequest.d.ts +13 -0
  71. package/types/serialization/resources/registry/client/requests/index.d.ts +3 -0
  72. package/types/serialization/resources/registry/client/revokeToken.d.ts +0 -7
  73. package/types/serialization/resources/user/index.d.ts +0 -1
  74. package/types/core/schemas/builders/identity/createIdentitySchemaCreator.d.ts +0 -2
  75. package/types/core/schemas/builders/identity/identity.d.ts +0 -2
  76. package/types/core/schemas/builders/identity/index.d.ts +0 -2
  77. package/types/core/schemas/builders/schema-utils/types.d.ts +0 -7
  78. package/types/serialization/resources/user/client/getMyOrganizations.d.ts +0 -10
  79. package/types/serialization/resources/user/client/getMyself.d.ts +0 -10
  80. package/types/serialization/resources/user/client/index.d.ts +0 -2
@@ -792,12 +792,72 @@ var init_api = __esm({
792
792
  }
793
793
  });
794
794
 
795
- // src/core/schemas/builders/schema-utils/types.ts
796
- var OPTIONAL_BRAND;
797
- var init_types5 = __esm({
798
- "src/core/schemas/builders/schema-utils/types.ts"() {
795
+ // src/core/schemas/Schema.ts
796
+ var SchemaType;
797
+ var init_Schema = __esm({
798
+ "src/core/schemas/Schema.ts"() {
799
+ "use strict";
800
+ SchemaType = {
801
+ DATE: "date",
802
+ ENUM: "enum",
803
+ LIST: "list",
804
+ STRING_LITERAL: "stringLiteral",
805
+ OBJECT: "object",
806
+ ANY: "any",
807
+ BOOLEAN: "boolean",
808
+ NUMBER: "number",
809
+ STRING: "string",
810
+ UNKNOWN: "unknown",
811
+ RECORD: "record",
812
+ SET: "set",
813
+ UNION: "union",
814
+ OPTIONAL: "optional"
815
+ };
816
+ }
817
+ });
818
+
819
+ // src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts
820
+ function stringifyValidationError(error) {
821
+ if (error.path.length === 0) {
822
+ return error.message;
823
+ }
824
+ return `${error.path.join(" -> ")}: ${error.message}`;
825
+ }
826
+ var init_stringifyValidationErrors = __esm({
827
+ "src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts"() {
828
+ "use strict";
829
+ }
830
+ });
831
+
832
+ // src/core/schemas/builders/schema-utils/JsonError.ts
833
+ var JsonError;
834
+ var init_JsonError = __esm({
835
+ "src/core/schemas/builders/schema-utils/JsonError.ts"() {
836
+ "use strict";
837
+ init_stringifyValidationErrors();
838
+ JsonError = class extends Error {
839
+ constructor(errors) {
840
+ super(errors.map(stringifyValidationError).join("; "));
841
+ this.errors = errors;
842
+ Object.setPrototypeOf(this, JsonError.prototype);
843
+ }
844
+ };
845
+ }
846
+ });
847
+
848
+ // src/core/schemas/builders/schema-utils/ParseError.ts
849
+ var ParseError;
850
+ var init_ParseError = __esm({
851
+ "src/core/schemas/builders/schema-utils/ParseError.ts"() {
799
852
  "use strict";
800
- OPTIONAL_BRAND = void 0;
853
+ init_stringifyValidationErrors();
854
+ ParseError = class extends Error {
855
+ constructor(errors) {
856
+ super(errors.map(stringifyValidationError).join("; "));
857
+ this.errors = errors;
858
+ Object.setPrototypeOf(this, ParseError.prototype);
859
+ }
860
+ };
801
861
  }
802
862
  });
803
863
 
@@ -805,16 +865,46 @@ var init_types5 = __esm({
805
865
  function getSchemaUtils(schema) {
806
866
  return {
807
867
  optional: () => optional(schema),
808
- transform: (transformer) => transform(schema, transformer)
868
+ transform: (transformer) => transform(schema, transformer),
869
+ parseOrThrow: async (raw, opts) => {
870
+ const parsed = await schema.parse(raw, opts);
871
+ if (parsed.ok) {
872
+ return parsed.value;
873
+ }
874
+ throw new ParseError(parsed.errors);
875
+ },
876
+ jsonOrThrow: async (parsed, opts) => {
877
+ const raw = await schema.json(parsed, opts);
878
+ if (raw.ok) {
879
+ return raw.value;
880
+ }
881
+ throw new JsonError(raw.errors);
882
+ }
809
883
  };
810
884
  }
811
885
  function optional(schema) {
812
886
  const baseSchema = {
813
- parse: (raw, opts) => raw != null ? schema.parse(raw, opts) : void 0,
814
- json: (parsed, opts) => parsed != null ? schema.json(parsed, opts) : void 0
887
+ parse: (raw, opts) => {
888
+ if (raw == null) {
889
+ return {
890
+ ok: true,
891
+ value: void 0
892
+ };
893
+ }
894
+ return schema.parse(raw, opts);
895
+ },
896
+ json: (parsed, opts) => {
897
+ if (parsed == null) {
898
+ return {
899
+ ok: true,
900
+ value: null
901
+ };
902
+ }
903
+ return schema.json(parsed, opts);
904
+ },
905
+ getType: () => SchemaType.OPTIONAL
815
906
  };
816
907
  return {
817
- ...OPTIONAL_BRAND,
818
908
  ...baseSchema,
819
909
  ...getSchemaUtils(baseSchema)
820
910
  };
@@ -822,13 +912,20 @@ function optional(schema) {
822
912
  function transform(schema, transformer) {
823
913
  const baseSchema = {
824
914
  parse: async (raw, opts) => {
825
- const postTransformParsed = await schema.parse(raw, opts);
826
- return transformer.parse(postTransformParsed, opts);
915
+ const parsed = await schema.parse(raw, opts);
916
+ if (!parsed.ok) {
917
+ return parsed;
918
+ }
919
+ return {
920
+ ok: true,
921
+ value: transformer.transform(parsed.value)
922
+ };
827
923
  },
828
- json: async (parsed, opts) => {
829
- const preTransformParsed = await transformer.json(parsed, opts);
830
- return schema.json(preTransformParsed, opts);
831
- }
924
+ json: async (transformed, opts) => {
925
+ const parsed = await transformer.untransform(transformed);
926
+ return schema.json(parsed, opts);
927
+ },
928
+ getType: () => schema.getType()
832
929
  };
833
930
  return {
834
931
  ...baseSchema,
@@ -838,7 +935,9 @@ function transform(schema, transformer) {
838
935
  var init_getSchemaUtils = __esm({
839
936
  "src/core/schemas/builders/schema-utils/getSchemaUtils.ts"() {
840
937
  "use strict";
841
- init_types5();
938
+ init_Schema();
939
+ init_JsonError();
940
+ init_ParseError();
842
941
  }
843
942
  });
844
943
 
@@ -847,25 +946,64 @@ var init_schema_utils = __esm({
847
946
  "src/core/schemas/builders/schema-utils/index.ts"() {
848
947
  "use strict";
849
948
  init_getSchemaUtils();
850
- init_types5();
949
+ init_JsonError();
950
+ init_ParseError();
851
951
  }
852
952
  });
853
953
 
854
954
  // src/core/schemas/builders/date/date.ts
855
955
  function date() {
856
956
  const baseSchema = {
857
- parse: (raw) => new Date(raw),
858
- json: (date2) => date2.toISOString()
957
+ parse: (raw) => {
958
+ if (typeof raw === "string" && ISO_8601_REGEX.test(raw)) {
959
+ return {
960
+ ok: true,
961
+ value: new Date(raw)
962
+ };
963
+ } else {
964
+ return {
965
+ ok: false,
966
+ errors: [
967
+ {
968
+ path: [],
969
+ message: "Not an ISO 8601 date string"
970
+ }
971
+ ]
972
+ };
973
+ }
974
+ },
975
+ json: (date2) => {
976
+ if (date2 instanceof Date) {
977
+ return {
978
+ ok: true,
979
+ value: date2.toISOString()
980
+ };
981
+ } else {
982
+ return {
983
+ ok: false,
984
+ errors: [
985
+ {
986
+ path: [],
987
+ message: "Not a Date object"
988
+ }
989
+ ]
990
+ };
991
+ }
992
+ },
993
+ getType: () => SchemaType.DATE
859
994
  };
860
995
  return {
861
996
  ...baseSchema,
862
997
  ...getSchemaUtils(baseSchema)
863
998
  };
864
999
  }
1000
+ var ISO_8601_REGEX;
865
1001
  var init_date = __esm({
866
1002
  "src/core/schemas/builders/date/date.ts"() {
867
1003
  "use strict";
1004
+ init_Schema();
868
1005
  init_schema_utils();
1006
+ ISO_8601_REGEX = /^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;
869
1007
  }
870
1008
  });
871
1009
 
@@ -877,52 +1015,55 @@ var init_date2 = __esm({
877
1015
  }
878
1016
  });
879
1017
 
880
- // src/core/schemas/builders/identity/identity.ts
881
- function identity() {
882
- const baseSchema = {
883
- parse: (raw) => raw,
884
- json: (parsed) => parsed
885
- };
886
- return {
887
- ...baseSchema,
888
- ...getSchemaUtils(baseSchema)
1018
+ // src/core/schemas/utils/createIdentitySchemaCreator.ts
1019
+ function createIdentitySchemaCreator(schemaType, validate) {
1020
+ return () => {
1021
+ const baseSchema = {
1022
+ parse: validate,
1023
+ json: validate,
1024
+ getType: () => schemaType
1025
+ };
1026
+ return {
1027
+ ...baseSchema,
1028
+ ...getSchemaUtils(baseSchema)
1029
+ };
889
1030
  };
890
1031
  }
891
- var init_identity = __esm({
892
- "src/core/schemas/builders/identity/identity.ts"() {
893
- "use strict";
894
- init_schema_utils();
895
- }
896
- });
897
-
898
- // src/core/schemas/builders/identity/createIdentitySchemaCreator.ts
899
- function createIdentitySchemaCreator() {
900
- return () => identity();
901
- }
902
1032
  var init_createIdentitySchemaCreator = __esm({
903
- "src/core/schemas/builders/identity/createIdentitySchemaCreator.ts"() {
904
- "use strict";
905
- init_identity();
906
- }
907
- });
908
-
909
- // src/core/schemas/builders/identity/index.ts
910
- var init_identity2 = __esm({
911
- "src/core/schemas/builders/identity/index.ts"() {
1033
+ "src/core/schemas/utils/createIdentitySchemaCreator.ts"() {
912
1034
  "use strict";
913
- init_createIdentitySchemaCreator();
914
- init_identity();
1035
+ init_schema_utils();
915
1036
  }
916
1037
  });
917
1038
 
918
1039
  // src/core/schemas/builders/enum/enum.ts
919
- function enum_(_values) {
920
- return createIdentitySchemaCreator()();
1040
+ function enum_(values) {
1041
+ const validValues = new Set(values);
1042
+ const schemaCreator = createIdentitySchemaCreator(SchemaType.ENUM, (value, { allowUnknownKeys = false } = {}) => {
1043
+ if (typeof value === "string" && (validValues.has(value) || allowUnknownKeys)) {
1044
+ return {
1045
+ ok: true,
1046
+ value
1047
+ };
1048
+ } else {
1049
+ return {
1050
+ ok: false,
1051
+ errors: [
1052
+ {
1053
+ path: [],
1054
+ message: "Not one of the allowed values"
1055
+ }
1056
+ ]
1057
+ };
1058
+ }
1059
+ });
1060
+ return schemaCreator();
921
1061
  }
922
1062
  var init_enum = __esm({
923
1063
  "src/core/schemas/builders/enum/enum.ts"() {
924
1064
  "use strict";
925
- init_identity2();
1065
+ init_Schema();
1066
+ init_createIdentitySchemaCreator();
926
1067
  }
927
1068
  });
928
1069
 
@@ -944,8 +1085,9 @@ function lazy(getter) {
944
1085
  }
945
1086
  function constructLazyBaseSchema(getter) {
946
1087
  return {
947
- parse: async (raw) => (await getMemoizedSchema(getter)).parse(raw),
948
- json: async (parsed) => (await getMemoizedSchema(getter)).json(parsed)
1088
+ parse: async (raw, opts) => (await getMemoizedSchema(getter)).parse(raw, opts),
1089
+ json: async (parsed, opts) => (await getMemoizedSchema(getter)).json(parsed, opts),
1090
+ getType: async () => (await getMemoizedSchema(getter)).getType()
949
1091
  };
950
1092
  }
951
1093
  async function getMemoizedSchema(getter) {
@@ -988,6 +1130,28 @@ var init_filterObject = __esm({
988
1130
  }
989
1131
  });
990
1132
 
1133
+ // src/core/schemas/utils/isPlainObject.ts
1134
+ function isPlainObject(value) {
1135
+ if (typeof value !== "object" || value === null) {
1136
+ return false;
1137
+ }
1138
+ if (Object.getPrototypeOf(value) === null) {
1139
+ return true;
1140
+ }
1141
+ let proto = value;
1142
+ while (Object.getPrototypeOf(proto) !== null) {
1143
+ proto = Object.getPrototypeOf(proto);
1144
+ }
1145
+ return Object.getPrototypeOf(value) === proto;
1146
+ }
1147
+ var NOT_AN_OBJECT_ERROR_MESSAGE;
1148
+ var init_isPlainObject = __esm({
1149
+ "src/core/schemas/utils/isPlainObject.ts"() {
1150
+ "use strict";
1151
+ NOT_AN_OBJECT_ERROR_MESSAGE = "Not an object";
1152
+ }
1153
+ });
1154
+
991
1155
  // src/core/schemas/utils/keys.ts
992
1156
  function keys(object2) {
993
1157
  return Object.keys(object2);
@@ -1016,53 +1180,56 @@ var init_partition = __esm({
1016
1180
  }
1017
1181
  });
1018
1182
 
1019
- // src/core/schemas/builders/object-like/types.ts
1020
- var OBJECT_LIKE_BRAND;
1021
- var init_types6 = __esm({
1022
- "src/core/schemas/builders/object-like/types.ts"() {
1023
- "use strict";
1024
- OBJECT_LIKE_BRAND = void 0;
1025
- }
1026
- });
1027
-
1028
1183
  // src/core/schemas/builders/object-like/getObjectLikeUtils.ts
1029
1184
  function getObjectLikeUtils(schema) {
1030
1185
  return {
1031
- withProperties: (properties) => withProperties(schema, properties)
1186
+ withParsedProperties: (properties) => withParsedProperties(schema, properties)
1032
1187
  };
1033
1188
  }
1034
- function withProperties(objectLike, properties) {
1189
+ function withParsedProperties(objectLike, properties) {
1035
1190
  const objectSchema = {
1036
- ...OBJECT_LIKE_BRAND,
1037
1191
  parse: async (raw, opts) => {
1038
1192
  const parsedObject = await objectLike.parse(raw, opts);
1193
+ if (!parsedObject.ok) {
1194
+ return parsedObject;
1195
+ }
1039
1196
  const additionalProperties = Object.entries(properties).reduce(
1040
1197
  (processed, [key, value]) => {
1041
1198
  return {
1042
1199
  ...processed,
1043
- [key]: typeof value === "function" ? value(parsedObject) : value
1200
+ [key]: typeof value === "function" ? value(parsedObject.value) : value
1044
1201
  };
1045
1202
  },
1046
1203
  {}
1047
1204
  );
1048
1205
  return {
1049
- ...parsedObject,
1050
- ...additionalProperties
1206
+ ok: true,
1207
+ value: {
1208
+ ...parsedObject.value,
1209
+ ...additionalProperties
1210
+ }
1051
1211
  };
1052
1212
  },
1053
1213
  json: (parsed, opts) => {
1214
+ if (!isPlainObject(parsed)) {
1215
+ return {
1216
+ ok: false,
1217
+ errors: [
1218
+ {
1219
+ path: [],
1220
+ message: NOT_AN_OBJECT_ERROR_MESSAGE
1221
+ }
1222
+ ]
1223
+ };
1224
+ }
1054
1225
  const addedPropertyKeys = new Set(Object.keys(properties));
1055
- const parsedWithoutAddedProperties = Object.entries(parsed).reduce(
1056
- (filtered, [key, value]) => {
1057
- if (!addedPropertyKeys.has(key)) {
1058
- filtered[key] = value;
1059
- }
1060
- return filtered;
1061
- },
1062
- {}
1226
+ const parsedWithoutAddedProperties = filterObject(
1227
+ parsed,
1228
+ Object.keys(parsed).filter((key) => !addedPropertyKeys.has(key))
1063
1229
  );
1064
1230
  return objectLike.json(parsedWithoutAddedProperties, opts);
1065
- }
1231
+ },
1232
+ getType: () => objectLike.getType()
1066
1233
  };
1067
1234
  return {
1068
1235
  ...objectSchema,
@@ -1073,8 +1240,9 @@ function withProperties(objectLike, properties) {
1073
1240
  var init_getObjectLikeUtils = __esm({
1074
1241
  "src/core/schemas/builders/object-like/getObjectLikeUtils.ts"() {
1075
1242
  "use strict";
1243
+ init_filterObject();
1244
+ init_isPlainObject();
1076
1245
  init_schema_utils();
1077
- init_types6();
1078
1246
  }
1079
1247
  });
1080
1248
 
@@ -1083,7 +1251,6 @@ var init_object_like = __esm({
1083
1251
  "src/core/schemas/builders/object-like/index.ts"() {
1084
1252
  "use strict";
1085
1253
  init_getObjectLikeUtils();
1086
- init_types6();
1087
1254
  }
1088
1255
  });
1089
1256
 
@@ -1107,54 +1274,76 @@ var init_property = __esm({
1107
1274
  // src/core/schemas/builders/object/object.ts
1108
1275
  function object(schemas) {
1109
1276
  const baseSchema = {
1110
- ...OBJECT_LIKE_BRAND,
1111
1277
  _getRawProperties: () => Promise.resolve(
1112
1278
  Object.entries(schemas).map(
1113
1279
  ([parsedKey, propertySchema]) => isProperty(propertySchema) ? propertySchema.rawKey : parsedKey
1114
1280
  )
1115
1281
  ),
1116
1282
  _getParsedProperties: () => Promise.resolve(keys(schemas)),
1117
- parse: async (raw, { skipUnknownKeysOnParse = false } = {}) => {
1283
+ parse: async (raw, opts) => {
1118
1284
  const rawKeyToProperty = {};
1285
+ const requiredKeys = [];
1119
1286
  for (const [parsedKey, schemaOrObjectProperty] of entries(schemas)) {
1120
1287
  const rawKey = isProperty(schemaOrObjectProperty) ? schemaOrObjectProperty.rawKey : parsedKey;
1288
+ const valueSchema = isProperty(schemaOrObjectProperty) ? schemaOrObjectProperty.valueSchema : schemaOrObjectProperty;
1121
1289
  const property2 = {
1122
1290
  rawKey,
1123
1291
  parsedKey,
1124
- valueSchema: isProperty(schemaOrObjectProperty) ? schemaOrObjectProperty.valueSchema : schemaOrObjectProperty
1292
+ valueSchema
1125
1293
  };
1126
1294
  rawKeyToProperty[rawKey] = property2;
1127
- }
1128
- const parsed = {};
1129
- for (const [rawKey, rawPropertyValue] of Object.entries(raw)) {
1130
- const property2 = rawKeyToProperty[rawKey];
1131
- if (property2 != null) {
1132
- const value = await property2.valueSchema.parse(rawPropertyValue);
1133
- parsed[property2.parsedKey] = value;
1134
- } else if (!skipUnknownKeysOnParse && rawPropertyValue != null) {
1135
- parsed[rawKey] = rawPropertyValue;
1295
+ if (await valueSchema.getType() !== "optional") {
1296
+ requiredKeys.push(rawKey);
1136
1297
  }
1137
1298
  }
1138
- return parsed;
1299
+ return validateAndTransformObject({
1300
+ value: raw,
1301
+ requiredKeys,
1302
+ getProperty: (rawKey) => {
1303
+ const property2 = rawKeyToProperty[rawKey];
1304
+ if (property2 == null) {
1305
+ return void 0;
1306
+ }
1307
+ return {
1308
+ transformedKey: property2.parsedKey,
1309
+ transform: (propertyValue) => property2.valueSchema.parse(propertyValue, opts)
1310
+ };
1311
+ },
1312
+ allowUnknownKeys: opts?.allowUnknownKeys ?? false
1313
+ });
1139
1314
  },
1140
- json: async (parsed, { includeUnknownKeysOnJson = false } = {}) => {
1141
- const raw = {};
1142
- for (const [parsedKey, parsedPropertyValue] of entries(parsed)) {
1143
- const schemaOrObjectProperty = schemas[parsedKey];
1144
- if (schemaOrObjectProperty != null) {
1145
- if (isProperty(schemaOrObjectProperty)) {
1146
- const value = await schemaOrObjectProperty.valueSchema.json(parsedPropertyValue);
1147
- raw[schemaOrObjectProperty.rawKey] = value;
1315
+ json: async (parsed, opts) => {
1316
+ const requiredKeys = [];
1317
+ for (const [parsedKey, schemaOrObjectProperty] of entries(schemas)) {
1318
+ const valueSchema = isProperty(schemaOrObjectProperty) ? schemaOrObjectProperty.valueSchema : schemaOrObjectProperty;
1319
+ if (await valueSchema.getType() !== "optional") {
1320
+ requiredKeys.push(parsedKey);
1321
+ }
1322
+ }
1323
+ return validateAndTransformObject({
1324
+ value: parsed,
1325
+ requiredKeys,
1326
+ getProperty: (parsedKey) => {
1327
+ const property2 = schemas[parsedKey];
1328
+ if (property2 == null) {
1329
+ return void 0;
1330
+ }
1331
+ if (isProperty(property2)) {
1332
+ return {
1333
+ transformedKey: property2.rawKey,
1334
+ transform: (propertyValue) => property2.valueSchema.json(propertyValue, opts)
1335
+ };
1148
1336
  } else {
1149
- const value = await schemaOrObjectProperty.json(parsedPropertyValue);
1150
- raw[parsedKey] = value;
1337
+ return {
1338
+ transformedKey: parsedKey,
1339
+ transform: (propertyValue) => property2.json(propertyValue, opts)
1340
+ };
1151
1341
  }
1152
- } else if (includeUnknownKeysOnJson && parsedPropertyValue != null) {
1153
- raw[parsedKey] = parsedPropertyValue;
1154
- }
1155
- }
1156
- return raw;
1157
- }
1342
+ },
1343
+ allowUnknownKeys: opts?.allowUnknownKeys ?? false
1344
+ });
1345
+ },
1346
+ getType: () => SchemaType.OBJECT
1158
1347
  };
1159
1348
  return {
1160
1349
  ...baseSchema,
@@ -1163,11 +1352,72 @@ function object(schemas) {
1163
1352
  ...getObjectUtils(baseSchema)
1164
1353
  };
1165
1354
  }
1355
+ async function validateAndTransformObject({
1356
+ value,
1357
+ requiredKeys,
1358
+ getProperty,
1359
+ allowUnknownKeys
1360
+ }) {
1361
+ if (!isPlainObject(value)) {
1362
+ return {
1363
+ ok: false,
1364
+ errors: [
1365
+ {
1366
+ path: [],
1367
+ message: NOT_AN_OBJECT_ERROR_MESSAGE
1368
+ }
1369
+ ]
1370
+ };
1371
+ }
1372
+ const missingRequiredKeys = new Set(requiredKeys);
1373
+ const errors = [];
1374
+ const transformed = {};
1375
+ for (const [preTransformedKey, preTransformedItemValue] of Object.entries(value)) {
1376
+ const property2 = getProperty(preTransformedKey);
1377
+ if (property2 != null) {
1378
+ missingRequiredKeys.delete(preTransformedKey);
1379
+ const value2 = await property2.transform(preTransformedItemValue);
1380
+ if (value2.ok) {
1381
+ transformed[property2.transformedKey] = value2.value;
1382
+ } else {
1383
+ errors.push(
1384
+ ...value2.errors.map((error) => ({
1385
+ path: [preTransformedKey, ...error.path],
1386
+ message: error.message
1387
+ }))
1388
+ );
1389
+ }
1390
+ } else if (allowUnknownKeys) {
1391
+ transformed[preTransformedKey] = preTransformedItemValue;
1392
+ } else {
1393
+ errors.push({
1394
+ path: [preTransformedKey],
1395
+ message: `Unrecognized key "${preTransformedKey}"`
1396
+ });
1397
+ }
1398
+ }
1399
+ errors.push(
1400
+ ...requiredKeys.filter((key) => missingRequiredKeys.has(key)).map((key) => ({
1401
+ path: [],
1402
+ message: `Missing required key "${key}"`
1403
+ }))
1404
+ );
1405
+ if (errors.length === 0) {
1406
+ return {
1407
+ ok: true,
1408
+ value: transformed
1409
+ };
1410
+ } else {
1411
+ return {
1412
+ ok: false,
1413
+ errors
1414
+ };
1415
+ }
1416
+ }
1166
1417
  function getObjectUtils(schema) {
1167
1418
  return {
1168
1419
  extend: (extension) => {
1169
1420
  const baseSchema = {
1170
- ...OBJECT_LIKE_BRAND,
1171
1421
  _getParsedProperties: async () => [
1172
1422
  ...await schema._getParsedProperties(),
1173
1423
  ...await extension._getParsedProperties()
@@ -1177,27 +1427,22 @@ function getObjectUtils(schema) {
1177
1427
  ...await extension._getRawProperties()
1178
1428
  ],
1179
1429
  parse: async (raw, opts) => {
1180
- const rawExtensionPropertiesSet = new Set(await extension._getRawProperties());
1181
- const [extensionProperties, otherProperties] = partition(
1182
- keys(raw),
1183
- (key) => rawExtensionPropertiesSet.has(key)
1184
- );
1185
- return {
1186
- ...await schema.parse(filterObject(raw, otherProperties), opts),
1187
- ...await extension.parse(filterObject(raw, extensionProperties), opts)
1188
- };
1430
+ return validateAndTransformExtendedObject({
1431
+ extensionKeys: await extension._getRawProperties(),
1432
+ value: raw,
1433
+ transformBase: (rawBase) => schema.parse(rawBase, opts),
1434
+ transformExtension: (rawExtension) => extension.parse(rawExtension, opts)
1435
+ });
1189
1436
  },
1190
1437
  json: async (parsed, opts) => {
1191
- const parsedExtensionPropertiesSet = new Set(await extension._getParsedProperties());
1192
- const [extensionProperties, otherProperties] = partition(
1193
- keys(parsed),
1194
- (key) => parsedExtensionPropertiesSet.has(key)
1195
- );
1196
- return {
1197
- ...await schema.json(filterObject(parsed, otherProperties), opts),
1198
- ...await extension.json(filterObject(parsed, extensionProperties), opts)
1199
- };
1200
- }
1438
+ return validateAndTransformExtendedObject({
1439
+ extensionKeys: await extension._getParsedProperties(),
1440
+ value: parsed,
1441
+ transformBase: (parsedBase) => schema.json(parsedBase, opts),
1442
+ transformExtension: (parsedExtension) => extension.json(parsedExtension, opts)
1443
+ });
1444
+ },
1445
+ getType: () => SchemaType.OBJECT
1201
1446
  };
1202
1447
  return {
1203
1448
  ...baseSchema,
@@ -1208,11 +1453,44 @@ function getObjectUtils(schema) {
1208
1453
  }
1209
1454
  };
1210
1455
  }
1456
+ async function validateAndTransformExtendedObject({
1457
+ extensionKeys,
1458
+ value,
1459
+ transformBase,
1460
+ transformExtension
1461
+ }) {
1462
+ const extensionPropertiesSet = new Set(extensionKeys);
1463
+ const [extensionProperties, baseProperties] = partition(
1464
+ keys(value),
1465
+ (key) => extensionPropertiesSet.has(key)
1466
+ );
1467
+ const transformedBase = await transformBase(filterObject(value, baseProperties));
1468
+ const transformedExtension = await transformExtension(filterObject(value, extensionProperties));
1469
+ if (transformedBase.ok && transformedExtension.ok) {
1470
+ return {
1471
+ ok: true,
1472
+ value: {
1473
+ ...transformedBase.value,
1474
+ ...transformedExtension.value
1475
+ }
1476
+ };
1477
+ } else {
1478
+ return {
1479
+ ok: false,
1480
+ errors: [
1481
+ ...transformedBase.ok ? [] : transformedBase.errors,
1482
+ ...transformedExtension.ok ? [] : transformedExtension.errors
1483
+ ]
1484
+ };
1485
+ }
1486
+ }
1211
1487
  var init_object = __esm({
1212
1488
  "src/core/schemas/builders/object/object.ts"() {
1213
1489
  "use strict";
1490
+ init_Schema();
1214
1491
  init_entries();
1215
1492
  init_filterObject();
1493
+ init_isPlainObject();
1216
1494
  init_keys();
1217
1495
  init_partition();
1218
1496
  init_object_like();
@@ -1233,7 +1511,6 @@ var init_object2 = __esm({
1233
1511
  // src/core/schemas/builders/lazy/lazyObject.ts
1234
1512
  function lazyObject(getter) {
1235
1513
  const baseSchema = {
1236
- ...OBJECT_LIKE_BRAND,
1237
1514
  ...constructLazyBaseSchema(getter),
1238
1515
  _getRawProperties: async () => (await getMemoizedSchema(getter))._getRawProperties(),
1239
1516
  _getParsedProperties: async () => (await getMemoizedSchema(getter))._getParsedProperties()
@@ -1267,17 +1544,60 @@ var init_lazy2 = __esm({
1267
1544
  // src/core/schemas/builders/list/list.ts
1268
1545
  function list(schema) {
1269
1546
  const baseSchema = {
1270
- parse: (raw, opts) => Promise.all(raw.map((item) => schema.parse(item, opts))),
1271
- json: (parsed, opts) => Promise.all(parsed.map((item) => schema.json(item, opts)))
1547
+ parse: async (raw, opts) => validateAndTransformArray(raw, (item) => schema.parse(item, opts)),
1548
+ json: (parsed, opts) => validateAndTransformArray(parsed, (item) => schema.json(item, opts)),
1549
+ getType: () => SchemaType.LIST
1272
1550
  };
1273
1551
  return {
1274
1552
  ...baseSchema,
1275
1553
  ...getSchemaUtils(baseSchema)
1276
1554
  };
1277
1555
  }
1556
+ async function validateAndTransformArray(value, transformItem) {
1557
+ if (!Array.isArray(value)) {
1558
+ return {
1559
+ ok: false,
1560
+ errors: [
1561
+ {
1562
+ message: "Not a list",
1563
+ path: []
1564
+ }
1565
+ ]
1566
+ };
1567
+ }
1568
+ const maybeValidItems = await Promise.all(value.map((item) => transformItem(item)));
1569
+ return maybeValidItems.reduce(
1570
+ (acc, item, index) => {
1571
+ if (acc.ok && item.ok) {
1572
+ return {
1573
+ ok: true,
1574
+ value: [...acc.value, item.value]
1575
+ };
1576
+ }
1577
+ const errors = [];
1578
+ if (!acc.ok) {
1579
+ errors.push(...acc.errors);
1580
+ }
1581
+ if (!item.ok) {
1582
+ errors.push(
1583
+ ...item.errors.map((error) => ({
1584
+ path: [`[${index}]`, ...error.path],
1585
+ message: error.message
1586
+ }))
1587
+ );
1588
+ }
1589
+ return {
1590
+ ok: false,
1591
+ errors
1592
+ };
1593
+ },
1594
+ { ok: true, value: [] }
1595
+ );
1596
+ }
1278
1597
  var init_list = __esm({
1279
1598
  "src/core/schemas/builders/list/list.ts"() {
1280
1599
  "use strict";
1600
+ init_Schema();
1281
1601
  init_schema_utils();
1282
1602
  }
1283
1603
  });
@@ -1291,13 +1611,32 @@ var init_list2 = __esm({
1291
1611
  });
1292
1612
 
1293
1613
  // src/core/schemas/builders/literals/stringLiteral.ts
1294
- function stringLiteral(_value) {
1295
- return createIdentitySchemaCreator()();
1614
+ function stringLiteral(literal) {
1615
+ const schemaCreator = createIdentitySchemaCreator(SchemaType.STRING_LITERAL, (value) => {
1616
+ if (value === literal) {
1617
+ return {
1618
+ ok: true,
1619
+ value: literal
1620
+ };
1621
+ } else {
1622
+ return {
1623
+ ok: false,
1624
+ errors: [
1625
+ {
1626
+ path: [],
1627
+ message: `Not equal to "${literal}"`
1628
+ }
1629
+ ]
1630
+ };
1631
+ }
1632
+ });
1633
+ return schemaCreator();
1296
1634
  }
1297
1635
  var init_stringLiteral = __esm({
1298
1636
  "src/core/schemas/builders/literals/stringLiteral.ts"() {
1299
1637
  "use strict";
1300
- init_identity2();
1638
+ init_Schema();
1639
+ init_createIdentitySchemaCreator();
1301
1640
  }
1302
1641
  });
1303
1642
 
@@ -1314,8 +1653,9 @@ var any;
1314
1653
  var init_any = __esm({
1315
1654
  "src/core/schemas/builders/primitives/any.ts"() {
1316
1655
  "use strict";
1317
- init_identity2();
1318
- any = createIdentitySchemaCreator();
1656
+ init_Schema();
1657
+ init_createIdentitySchemaCreator();
1658
+ any = createIdentitySchemaCreator(SchemaType.ANY, (value) => ({ ok: true, value }));
1319
1659
  }
1320
1660
  });
1321
1661
 
@@ -1324,8 +1664,26 @@ var boolean;
1324
1664
  var init_boolean = __esm({
1325
1665
  "src/core/schemas/builders/primitives/boolean.ts"() {
1326
1666
  "use strict";
1327
- init_identity2();
1328
- boolean = createIdentitySchemaCreator();
1667
+ init_Schema();
1668
+ init_createIdentitySchemaCreator();
1669
+ boolean = createIdentitySchemaCreator(SchemaType.BOOLEAN, (value) => {
1670
+ if (typeof value === "boolean") {
1671
+ return {
1672
+ ok: true,
1673
+ value
1674
+ };
1675
+ } else {
1676
+ return {
1677
+ ok: false,
1678
+ errors: [
1679
+ {
1680
+ path: [],
1681
+ message: "Not a boolean"
1682
+ }
1683
+ ]
1684
+ };
1685
+ }
1686
+ });
1329
1687
  }
1330
1688
  });
1331
1689
 
@@ -1334,8 +1692,26 @@ var number;
1334
1692
  var init_number = __esm({
1335
1693
  "src/core/schemas/builders/primitives/number.ts"() {
1336
1694
  "use strict";
1337
- init_identity2();
1338
- number = createIdentitySchemaCreator();
1695
+ init_Schema();
1696
+ init_createIdentitySchemaCreator();
1697
+ number = createIdentitySchemaCreator(SchemaType.NUMBER, (value) => {
1698
+ if (typeof value === "number") {
1699
+ return {
1700
+ ok: true,
1701
+ value
1702
+ };
1703
+ } else {
1704
+ return {
1705
+ ok: false,
1706
+ errors: [
1707
+ {
1708
+ path: [],
1709
+ message: "Not a number"
1710
+ }
1711
+ ]
1712
+ };
1713
+ }
1714
+ });
1339
1715
  }
1340
1716
  });
1341
1717
 
@@ -1344,8 +1720,26 @@ var string;
1344
1720
  var init_string = __esm({
1345
1721
  "src/core/schemas/builders/primitives/string.ts"() {
1346
1722
  "use strict";
1347
- init_identity2();
1348
- string = createIdentitySchemaCreator();
1723
+ init_Schema();
1724
+ init_createIdentitySchemaCreator();
1725
+ string = createIdentitySchemaCreator(SchemaType.STRING, (value) => {
1726
+ if (typeof value === "string") {
1727
+ return {
1728
+ ok: true,
1729
+ value
1730
+ };
1731
+ } else {
1732
+ return {
1733
+ ok: false,
1734
+ errors: [
1735
+ {
1736
+ path: [],
1737
+ message: "Not a string"
1738
+ }
1739
+ ]
1740
+ };
1741
+ }
1742
+ });
1349
1743
  }
1350
1744
  });
1351
1745
 
@@ -1354,8 +1748,9 @@ var unknown;
1354
1748
  var init_unknown = __esm({
1355
1749
  "src/core/schemas/builders/primitives/unknown.ts"() {
1356
1750
  "use strict";
1357
- init_identity2();
1358
- unknown = createIdentitySchemaCreator();
1751
+ init_Schema();
1752
+ init_createIdentitySchemaCreator();
1753
+ unknown = createIdentitySchemaCreator(SchemaType.UNKNOWN, (value) => ({ ok: true, value }));
1359
1754
  }
1360
1755
  });
1361
1756
 
@@ -1374,32 +1769,104 @@ var init_primitives = __esm({
1374
1769
  // src/core/schemas/builders/record/record.ts
1375
1770
  function record(keySchema, valueSchema) {
1376
1771
  const baseSchema = {
1377
- parse: (raw, opts) => {
1378
- return entries(raw).reduce(async (parsedPromise, [key, value]) => {
1379
- const parsed = await parsedPromise;
1380
- const parsedKey = await keySchema.parse(key, opts);
1381
- parsed[parsedKey] = await valueSchema.parse(value, opts);
1382
- return parsedPromise;
1383
- }, Promise.resolve({}));
1772
+ parse: async (raw, opts) => {
1773
+ return validateAndTransformRecord({
1774
+ value: raw,
1775
+ isKeyNumeric: await keySchema.getType() === SchemaType.NUMBER,
1776
+ transformKey: (key) => keySchema.parse(key, opts),
1777
+ transformValue: (value) => valueSchema.parse(value, opts)
1778
+ });
1384
1779
  },
1385
- json: (parsed, opts) => {
1386
- return entries(parsed).reduce(async (rawPromise, [key, value]) => {
1387
- const raw = await rawPromise;
1388
- const rawKey = await keySchema.json(key, opts);
1389
- raw[rawKey] = await valueSchema.json(value, opts);
1390
- return rawPromise;
1391
- }, Promise.resolve({}));
1392
- }
1780
+ json: async (parsed, opts) => {
1781
+ return validateAndTransformRecord({
1782
+ value: parsed,
1783
+ isKeyNumeric: await keySchema.getType() === SchemaType.NUMBER,
1784
+ transformKey: (key) => keySchema.json(key, opts),
1785
+ transformValue: (value) => valueSchema.json(value, opts)
1786
+ });
1787
+ },
1788
+ getType: () => SchemaType.RECORD
1393
1789
  };
1394
1790
  return {
1395
1791
  ...baseSchema,
1396
1792
  ...getSchemaUtils(baseSchema)
1397
1793
  };
1398
1794
  }
1795
+ async function validateAndTransformRecord({
1796
+ value,
1797
+ isKeyNumeric,
1798
+ transformKey,
1799
+ transformValue
1800
+ }) {
1801
+ if (!isPlainObject(value)) {
1802
+ return {
1803
+ ok: false,
1804
+ errors: [
1805
+ {
1806
+ path: [],
1807
+ message: NOT_AN_OBJECT_ERROR_MESSAGE
1808
+ }
1809
+ ]
1810
+ };
1811
+ }
1812
+ return entries(value).reduce(
1813
+ async (accPromise, [stringKey, value2]) => {
1814
+ if (value2 == null) {
1815
+ return accPromise;
1816
+ }
1817
+ const acc = await accPromise;
1818
+ let key = stringKey;
1819
+ if (isKeyNumeric) {
1820
+ const numberKey = stringKey.length > 0 ? Number(stringKey) : NaN;
1821
+ if (!isNaN(numberKey)) {
1822
+ key = numberKey;
1823
+ }
1824
+ }
1825
+ const transformedKey = await transformKey(key);
1826
+ const transformedValue = await transformValue(value2);
1827
+ if (acc.ok && transformedKey.ok && transformedValue.ok) {
1828
+ return {
1829
+ ok: true,
1830
+ value: {
1831
+ ...acc.value,
1832
+ [transformedKey.value]: transformedValue.value
1833
+ }
1834
+ };
1835
+ }
1836
+ const errors = [];
1837
+ if (!acc.ok) {
1838
+ errors.push(...acc.errors);
1839
+ }
1840
+ if (!transformedKey.ok) {
1841
+ errors.push(
1842
+ ...transformedKey.errors.map((error) => ({
1843
+ path: [`${key} (key)`, ...error.path],
1844
+ message: error.message
1845
+ }))
1846
+ );
1847
+ }
1848
+ if (!transformedValue.ok) {
1849
+ errors.push(
1850
+ ...transformedValue.errors.map((error) => ({
1851
+ path: [stringKey, ...error.path],
1852
+ message: error.message
1853
+ }))
1854
+ );
1855
+ }
1856
+ return {
1857
+ ok: false,
1858
+ errors
1859
+ };
1860
+ },
1861
+ Promise.resolve({ ok: true, value: {} })
1862
+ );
1863
+ }
1399
1864
  var init_record = __esm({
1400
1865
  "src/core/schemas/builders/record/record.ts"() {
1401
1866
  "use strict";
1867
+ init_Schema();
1402
1868
  init_entries();
1869
+ init_isPlainObject();
1403
1870
  init_schema_utils();
1404
1871
  }
1405
1872
  });
@@ -1414,9 +1881,35 @@ var init_record2 = __esm({
1414
1881
 
1415
1882
  // src/core/schemas/builders/set/set.ts
1416
1883
  function set(schema) {
1884
+ const listSchema = list(schema);
1417
1885
  const baseSchema = {
1418
- parse: async (raw, opts) => new Set(await Promise.all(raw.map((item) => schema.parse(item, opts)))),
1419
- json: (parsed, opts) => Promise.all([...parsed].map((item) => schema.json(item, opts)))
1886
+ parse: async (raw, opts) => {
1887
+ const parsedList = await listSchema.parse(raw, opts);
1888
+ if (parsedList.ok) {
1889
+ return {
1890
+ ok: true,
1891
+ value: new Set(parsedList.value)
1892
+ };
1893
+ } else {
1894
+ return parsedList;
1895
+ }
1896
+ },
1897
+ json: async (parsed, opts) => {
1898
+ if (!(parsed instanceof Set)) {
1899
+ return {
1900
+ ok: false,
1901
+ errors: [
1902
+ {
1903
+ path: [],
1904
+ message: "Not a Set"
1905
+ }
1906
+ ]
1907
+ };
1908
+ }
1909
+ const jsonList = await listSchema.json([...parsed], opts);
1910
+ return jsonList;
1911
+ },
1912
+ getType: () => SchemaType.SET
1420
1913
  };
1421
1914
  return {
1422
1915
  ...baseSchema,
@@ -1426,6 +1919,8 @@ function set(schema) {
1426
1919
  var init_set = __esm({
1427
1920
  "src/core/schemas/builders/set/set.ts"() {
1428
1921
  "use strict";
1922
+ init_Schema();
1923
+ init_list2();
1429
1924
  init_schema_utils();
1430
1925
  }
1431
1926
  });
@@ -1455,36 +1950,31 @@ var init_discriminant = __esm({
1455
1950
  function union(discriminant2, union2) {
1456
1951
  const rawDiscriminant = typeof discriminant2 === "string" ? discriminant2 : discriminant2.rawDiscriminant;
1457
1952
  const parsedDiscriminant = typeof discriminant2 === "string" ? discriminant2 : discriminant2.parsedDiscriminant;
1953
+ const discriminantValueSchema = enum_(keys(union2));
1458
1954
  const baseSchema = {
1459
- ...OBJECT_LIKE_BRAND,
1460
1955
  parse: async (raw, opts) => {
1461
- const { [rawDiscriminant]: discriminantValue, ...additionalProperties } = raw;
1462
- const additionalPropertySchemas = union2[discriminantValue];
1463
- if (additionalPropertySchemas == null) {
1464
- return {
1465
- ...additionalProperties,
1466
- [parsedDiscriminant]: discriminantValue
1467
- };
1468
- }
1469
- return {
1470
- ...await additionalPropertySchemas.parse(additionalProperties, opts),
1471
- [parsedDiscriminant]: discriminantValue
1472
- };
1956
+ return transformAndValidateUnion(
1957
+ raw,
1958
+ rawDiscriminant,
1959
+ parsedDiscriminant,
1960
+ (discriminantValue) => discriminantValueSchema.parse(discriminantValue, opts),
1961
+ (discriminantValue) => union2[discriminantValue],
1962
+ opts?.allowUnknownKeys ?? false,
1963
+ (additionalProperties, additionalPropertiesSchema) => additionalPropertiesSchema.parse(additionalProperties, opts)
1964
+ );
1473
1965
  },
1474
1966
  json: async (parsed, opts) => {
1475
- const { [parsedDiscriminant]: discriminantValue, ...additionalProperties } = parsed;
1476
- const additionalPropertySchemas = union2[discriminantValue];
1477
- if (additionalPropertySchemas == null) {
1478
- return {
1479
- ...additionalProperties,
1480
- [rawDiscriminant]: discriminantValue
1481
- };
1482
- }
1483
- return {
1484
- ...await additionalPropertySchemas.json(additionalProperties, opts),
1485
- [rawDiscriminant]: discriminantValue
1486
- };
1487
- }
1967
+ return transformAndValidateUnion(
1968
+ parsed,
1969
+ parsedDiscriminant,
1970
+ rawDiscriminant,
1971
+ (discriminantValue) => discriminantValueSchema.json(discriminantValue, opts),
1972
+ (discriminantValue) => union2[discriminantValue],
1973
+ opts?.allowUnknownKeys ?? false,
1974
+ (additionalProperties, additionalPropertiesSchema) => additionalPropertiesSchema.json(additionalProperties, opts)
1975
+ );
1976
+ },
1977
+ getType: () => SchemaType.UNION
1488
1978
  };
1489
1979
  return {
1490
1980
  ...baseSchema,
@@ -1492,9 +1982,84 @@ function union(discriminant2, union2) {
1492
1982
  ...getObjectLikeUtils(baseSchema)
1493
1983
  };
1494
1984
  }
1985
+ async function transformAndValidateUnion(value, discriminant2, transformedDiscriminant, transformDiscriminantValue, getAdditionalPropertiesSchema, allowUnknownKeys, transformAdditionalProperties) {
1986
+ if (!isPlainObject(value)) {
1987
+ return {
1988
+ ok: false,
1989
+ errors: [
1990
+ {
1991
+ path: [],
1992
+ message: NOT_AN_OBJECT_ERROR_MESSAGE
1993
+ }
1994
+ ]
1995
+ };
1996
+ }
1997
+ const { [discriminant2]: discriminantValue, ...additionalProperties } = value;
1998
+ if (discriminantValue == null) {
1999
+ return {
2000
+ ok: false,
2001
+ errors: [
2002
+ {
2003
+ path: [],
2004
+ message: `Missing discriminant ("${discriminant2}")`
2005
+ }
2006
+ ]
2007
+ };
2008
+ }
2009
+ const transformedDiscriminantValue = await transformDiscriminantValue(discriminantValue);
2010
+ if (!transformedDiscriminantValue.ok) {
2011
+ return {
2012
+ ok: false,
2013
+ errors: transformedDiscriminantValue.errors.map((error) => ({
2014
+ path: [discriminant2, ...error.path],
2015
+ message: error.message
2016
+ }))
2017
+ };
2018
+ }
2019
+ const additionalPropertiesSchema = getAdditionalPropertiesSchema(transformedDiscriminantValue.value);
2020
+ if (additionalPropertiesSchema == null) {
2021
+ if (allowUnknownKeys) {
2022
+ return {
2023
+ ok: true,
2024
+ value: {
2025
+ [transformedDiscriminant]: transformedDiscriminantValue.value,
2026
+ ...additionalProperties
2027
+ }
2028
+ };
2029
+ } else {
2030
+ return {
2031
+ ok: false,
2032
+ errors: [
2033
+ {
2034
+ path: [discriminant2],
2035
+ message: "Unrecognized discriminant value"
2036
+ }
2037
+ ]
2038
+ };
2039
+ }
2040
+ }
2041
+ const transformedAdditionalProperties = await transformAdditionalProperties(
2042
+ additionalProperties,
2043
+ additionalPropertiesSchema
2044
+ );
2045
+ if (!transformedAdditionalProperties.ok) {
2046
+ return transformedAdditionalProperties;
2047
+ }
2048
+ return {
2049
+ ok: true,
2050
+ value: {
2051
+ [transformedDiscriminant]: discriminantValue,
2052
+ ...transformedAdditionalProperties.value
2053
+ }
2054
+ };
2055
+ }
1495
2056
  var init_union = __esm({
1496
2057
  "src/core/schemas/builders/union/union.ts"() {
1497
2058
  "use strict";
2059
+ init_Schema();
2060
+ init_isPlainObject();
2061
+ init_keys();
2062
+ init_enum2();
1498
2063
  init_object_like();
1499
2064
  init_schema_utils();
1500
2065
  }
@@ -1515,7 +2080,6 @@ var init_builders = __esm({
1515
2080
  "use strict";
1516
2081
  init_date2();
1517
2082
  init_enum2();
1518
- init_identity2();
1519
2083
  init_lazy2();
1520
2084
  init_list2();
1521
2085
  init_literals();
@@ -1532,18 +2096,16 @@ var init_builders = __esm({
1532
2096
  // src/core/schemas/index.ts
1533
2097
  var schemas_exports = {};
1534
2098
  __export(schemas_exports, {
1535
- OBJECT_LIKE_BRAND: () => OBJECT_LIKE_BRAND,
1536
- OPTIONAL_BRAND: () => OPTIONAL_BRAND,
2099
+ JsonError: () => JsonError,
2100
+ ParseError: () => ParseError,
1537
2101
  any: () => any,
1538
2102
  boolean: () => boolean,
1539
- createIdentitySchemaCreator: () => createIdentitySchemaCreator,
1540
2103
  date: () => date,
1541
2104
  discriminant: () => discriminant,
1542
2105
  enum_: () => enum_,
1543
2106
  getObjectLikeUtils: () => getObjectLikeUtils,
1544
2107
  getObjectUtils: () => getObjectUtils,
1545
2108
  getSchemaUtils: () => getSchemaUtils,
1546
- identity: () => identity,
1547
2109
  isProperty: () => isProperty,
1548
2110
  lazy: () => lazy,
1549
2111
  lazyObject: () => lazyObject,
@@ -1559,12 +2121,13 @@ __export(schemas_exports, {
1559
2121
  transform: () => transform,
1560
2122
  union: () => union,
1561
2123
  unknown: () => unknown,
1562
- withProperties: () => withProperties
2124
+ withParsedProperties: () => withParsedProperties
1563
2125
  });
1564
2126
  var init_schemas = __esm({
1565
2127
  "src/core/schemas/index.ts"() {
1566
2128
  "use strict";
1567
2129
  init_builders();
2130
+ init_Schema();
1568
2131
  }
1569
2132
  });
1570
2133
 
@@ -3654,7 +4217,7 @@ var require_utils = __commonJS({
3654
4217
  function isObject(val) {
3655
4218
  return val !== null && typeof val === "object";
3656
4219
  }
3657
- function isPlainObject(val) {
4220
+ function isPlainObject2(val) {
3658
4221
  if (kindOf(val) !== "object") {
3659
4222
  return false;
3660
4223
  }
@@ -3707,9 +4270,9 @@ var require_utils = __commonJS({
3707
4270
  function merge() {
3708
4271
  var result = {};
3709
4272
  function assignValue(val, key) {
3710
- if (isPlainObject(result[key]) && isPlainObject(val)) {
4273
+ if (isPlainObject2(result[key]) && isPlainObject2(val)) {
3711
4274
  result[key] = merge(result[key], val);
3712
- } else if (isPlainObject(val)) {
4275
+ } else if (isPlainObject2(val)) {
3713
4276
  result[key] = merge({}, val);
3714
4277
  } else if (isArray(val)) {
3715
4278
  result[key] = val.slice();
@@ -3798,7 +4361,7 @@ var require_utils = __commonJS({
3798
4361
  isString,
3799
4362
  isNumber,
3800
4363
  isObject,
3801
- isPlainObject,
4364
+ isPlainObject: isPlainObject2,
3802
4365
  isUndefined,
3803
4366
  isDate,
3804
4367
  isFile,
@@ -5111,7 +5674,7 @@ var init_Fetcher = __esm({
5111
5674
  transitional: {
5112
5675
  clarifyTimeoutError: true
5113
5676
  },
5114
- withCredentials: true
5677
+ withCredentials: args.withCredentials
5115
5678
  });
5116
5679
  let body;
5117
5680
  if (response.data != null && response.data.length > 0) {
@@ -5139,7 +5702,6 @@ var init_Fetcher = __esm({
5139
5702
  error: {
5140
5703
  reason: "status-code",
5141
5704
  statusCode: response.status,
5142
- rawBody: response.data,
5143
5705
  body
5144
5706
  }
5145
5707
  };
@@ -5274,8 +5836,8 @@ var init_OrganizationId2 = __esm({
5274
5836
  init_src();
5275
5837
  init_core();
5276
5838
  OrganizationId2 = schemas_exports.string().transform({
5277
- parse: api_exports.OrganizationId,
5278
- json: (value) => value
5839
+ transform: api_exports.OrganizationId,
5840
+ untransform: (value) => value
5279
5841
  });
5280
5842
  }
5281
5843
  });
@@ -5288,14 +5850,14 @@ var init_UserId2 = __esm({
5288
5850
  init_src();
5289
5851
  init_core();
5290
5852
  UserId2 = schemas_exports.string().transform({
5291
- parse: api_exports.UserId,
5292
- json: (value) => value
5853
+ transform: api_exports.UserId,
5854
+ untransform: (value) => value
5293
5855
  });
5294
5856
  }
5295
5857
  });
5296
5858
 
5297
5859
  // src/serialization/resources/commons/types/index.ts
5298
- var init_types7 = __esm({
5860
+ var init_types5 = __esm({
5299
5861
  "src/serialization/resources/commons/types/index.ts"() {
5300
5862
  "use strict";
5301
5863
  init_OrganizationId2();
@@ -5312,7 +5874,7 @@ __export(commons_exports2, {
5312
5874
  var init_commons2 = __esm({
5313
5875
  "src/serialization/resources/commons/index.ts"() {
5314
5876
  "use strict";
5315
- init_types7();
5877
+ init_types5();
5316
5878
  }
5317
5879
  });
5318
5880
 
@@ -5330,7 +5892,7 @@ var init_Organization2 = __esm({
5330
5892
  });
5331
5893
 
5332
5894
  // src/serialization/resources/organization/types/index.ts
5333
- var init_types8 = __esm({
5895
+ var init_types6 = __esm({
5334
5896
  "src/serialization/resources/organization/types/index.ts"() {
5335
5897
  "use strict";
5336
5898
  init_Organization2();
@@ -5340,24 +5902,19 @@ var init_types8 = __esm({
5340
5902
  // src/serialization/resources/organization/client/create.ts
5341
5903
  var create_exports2 = {};
5342
5904
  __export(create_exports2, {
5343
- Error: () => Error13,
5344
- Request: () => Request
5905
+ Error: () => Error13
5345
5906
  });
5346
- var Request, Error13;
5907
+ var Error13;
5347
5908
  var init_create2 = __esm({
5348
5909
  "src/serialization/resources/organization/client/create.ts"() {
5349
5910
  "use strict";
5350
5911
  init_src();
5351
5912
  init_core();
5352
- Request = schemas_exports.object({
5353
- organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
5354
- artifactReadRequiresToken: schemas_exports.boolean().optional()
5355
- });
5356
5913
  Error13 = schemas_exports.union("error", {
5357
5914
  UnauthorizedError: schemas_exports.object({}),
5358
5915
  OrganizationAlreadyExistsError: schemas_exports.object({})
5359
5916
  }).transform({
5360
- parse: (value) => {
5917
+ transform: (value) => {
5361
5918
  switch (value.error) {
5362
5919
  case "UnauthorizedError":
5363
5920
  return api_exports.organization.create.Error.unauthorizedError();
@@ -5365,7 +5922,7 @@ var init_create2 = __esm({
5365
5922
  return api_exports.organization.create.Error.organizationAlreadyExistsError();
5366
5923
  }
5367
5924
  },
5368
- json: (value) => value
5925
+ untransform: ({ _visit, ...value }) => value
5369
5926
  });
5370
5927
  }
5371
5928
  });
@@ -5373,28 +5930,24 @@ var init_create2 = __esm({
5373
5930
  // src/serialization/resources/organization/client/update.ts
5374
5931
  var update_exports2 = {};
5375
5932
  __export(update_exports2, {
5376
- Error: () => Error14,
5377
- Request: () => Request2
5933
+ Error: () => Error14
5378
5934
  });
5379
- var Request2, Error14;
5935
+ var Error14;
5380
5936
  var init_update2 = __esm({
5381
5937
  "src/serialization/resources/organization/client/update.ts"() {
5382
5938
  "use strict";
5383
5939
  init_src();
5384
5940
  init_core();
5385
- Request2 = schemas_exports.object({
5386
- artifactReadRequiresToken: schemas_exports.boolean()
5387
- });
5388
5941
  Error14 = schemas_exports.union("error", {
5389
5942
  UnauthorizedError: schemas_exports.object({})
5390
5943
  }).transform({
5391
- parse: (value) => {
5944
+ transform: (value) => {
5392
5945
  switch (value.error) {
5393
5946
  case "UnauthorizedError":
5394
5947
  return api_exports.organization.update.Error.unauthorizedError();
5395
5948
  }
5396
5949
  },
5397
- json: (value) => value
5950
+ untransform: ({ _visit, ...value }) => value
5398
5951
  });
5399
5952
  }
5400
5953
  });
@@ -5402,26 +5955,24 @@ var init_update2 = __esm({
5402
5955
  // src/serialization/resources/organization/client/get.ts
5403
5956
  var get_exports2 = {};
5404
5957
  __export(get_exports2, {
5405
- Error: () => Error15,
5406
- Response: () => Response
5958
+ Error: () => Error15
5407
5959
  });
5408
- var Response, Error15;
5960
+ var Error15;
5409
5961
  var init_get2 = __esm({
5410
5962
  "src/serialization/resources/organization/client/get.ts"() {
5411
5963
  "use strict";
5412
5964
  init_src();
5413
5965
  init_core();
5414
- Response = schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).Organization);
5415
5966
  Error15 = schemas_exports.union("error", {
5416
5967
  UnauthorizedError: schemas_exports.object({})
5417
5968
  }).transform({
5418
- parse: (value) => {
5969
+ transform: (value) => {
5419
5970
  switch (value.error) {
5420
5971
  case "UnauthorizedError":
5421
5972
  return api_exports.organization.get.Error.unauthorizedError();
5422
5973
  }
5423
5974
  },
5424
- json: (value) => value
5975
+ untransform: ({ _visit, ...value }) => value
5425
5976
  });
5426
5977
  }
5427
5978
  });
@@ -5429,40 +5980,38 @@ var init_get2 = __esm({
5429
5980
  // src/serialization/resources/organization/client/isMember.ts
5430
5981
  var isMember_exports2 = {};
5431
5982
  __export(isMember_exports2, {
5432
- Response: () => Response2
5983
+ Response: () => Response
5433
5984
  });
5434
- var Response2;
5985
+ var Response;
5435
5986
  var init_isMember2 = __esm({
5436
5987
  "src/serialization/resources/organization/client/isMember.ts"() {
5437
5988
  "use strict";
5438
5989
  init_core();
5439
- Response2 = schemas_exports.boolean();
5990
+ Response = schemas_exports.boolean();
5440
5991
  }
5441
5992
  });
5442
5993
 
5443
5994
  // src/serialization/resources/organization/client/getMyOrganizationFromScopedToken.ts
5444
5995
  var getMyOrganizationFromScopedToken_exports2 = {};
5445
5996
  __export(getMyOrganizationFromScopedToken_exports2, {
5446
- Error: () => Error16,
5447
- Response: () => Response3
5997
+ Error: () => Error16
5448
5998
  });
5449
- var Response3, Error16;
5999
+ var Error16;
5450
6000
  var init_getMyOrganizationFromScopedToken2 = __esm({
5451
6001
  "src/serialization/resources/organization/client/getMyOrganizationFromScopedToken.ts"() {
5452
6002
  "use strict";
5453
6003
  init_src();
5454
6004
  init_core();
5455
- Response3 = schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).Organization);
5456
6005
  Error16 = schemas_exports.union("error", {
5457
6006
  UnauthorizedError: schemas_exports.object({})
5458
6007
  }).transform({
5459
- parse: (value) => {
6008
+ transform: (value) => {
5460
6009
  switch (value.error) {
5461
6010
  case "UnauthorizedError":
5462
6011
  return api_exports.organization.getMyOrganizationFromScopedToken.Error.unauthorizedError();
5463
6012
  }
5464
6013
  },
5465
- json: (value) => value
6014
+ untransform: ({ _visit, ...value }) => value
5466
6015
  });
5467
6016
  }
5468
6017
  });
@@ -5470,24 +6019,19 @@ var init_getMyOrganizationFromScopedToken2 = __esm({
5470
6019
  // src/serialization/resources/organization/client/addUser.ts
5471
6020
  var addUser_exports2 = {};
5472
6021
  __export(addUser_exports2, {
5473
- Error: () => Error17,
5474
- Request: () => Request3
6022
+ Error: () => Error17
5475
6023
  });
5476
- var Request3, Error17;
6024
+ var Error17;
5477
6025
  var init_addUser2 = __esm({
5478
6026
  "src/serialization/resources/organization/client/addUser.ts"() {
5479
6027
  "use strict";
5480
6028
  init_src();
5481
6029
  init_core();
5482
- Request3 = schemas_exports.object({
5483
- userId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).UserId),
5484
- orgId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId)
5485
- });
5486
6030
  Error17 = schemas_exports.union("error", {
5487
6031
  UnauthorizedError: schemas_exports.object({}),
5488
6032
  UserIdDoesNotExistError: schemas_exports.object({})
5489
6033
  }).transform({
5490
- parse: (value) => {
6034
+ transform: (value) => {
5491
6035
  switch (value.error) {
5492
6036
  case "UnauthorizedError":
5493
6037
  return api_exports.organization.addUser.Error.unauthorizedError();
@@ -5495,11 +6039,59 @@ var init_addUser2 = __esm({
5495
6039
  return api_exports.organization.addUser.Error.userIdDoesNotExistError();
5496
6040
  }
5497
6041
  },
5498
- json: (value) => value
6042
+ untransform: ({ _visit, ...value }) => value
6043
+ });
6044
+ }
6045
+ });
6046
+
6047
+ // src/serialization/resources/organization/client/requests/CreateOrganizationRequest.ts
6048
+ var CreateOrganizationRequest;
6049
+ var init_CreateOrganizationRequest = __esm({
6050
+ "src/serialization/resources/organization/client/requests/CreateOrganizationRequest.ts"() {
6051
+ "use strict";
6052
+ init_core();
6053
+ CreateOrganizationRequest = schemas_exports.object({
6054
+ organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
6055
+ artifactReadRequiresToken: schemas_exports.boolean().optional()
6056
+ });
6057
+ }
6058
+ });
6059
+
6060
+ // src/serialization/resources/organization/client/requests/UpdateOrganizationRequest.ts
6061
+ var UpdateOrganizationRequest;
6062
+ var init_UpdateOrganizationRequest = __esm({
6063
+ "src/serialization/resources/organization/client/requests/UpdateOrganizationRequest.ts"() {
6064
+ "use strict";
6065
+ init_core();
6066
+ UpdateOrganizationRequest = schemas_exports.object({
6067
+ artifactReadRequiresToken: schemas_exports.boolean()
6068
+ });
6069
+ }
6070
+ });
6071
+
6072
+ // src/serialization/resources/organization/client/requests/AddUserToOrgRequest.ts
6073
+ var AddUserToOrgRequest;
6074
+ var init_AddUserToOrgRequest = __esm({
6075
+ "src/serialization/resources/organization/client/requests/AddUserToOrgRequest.ts"() {
6076
+ "use strict";
6077
+ init_core();
6078
+ AddUserToOrgRequest = schemas_exports.object({
6079
+ userId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).UserId),
6080
+ orgId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId)
5499
6081
  });
5500
6082
  }
5501
6083
  });
5502
6084
 
6085
+ // src/serialization/resources/organization/client/requests/index.ts
6086
+ var init_requests4 = __esm({
6087
+ "src/serialization/resources/organization/client/requests/index.ts"() {
6088
+ "use strict";
6089
+ init_CreateOrganizationRequest();
6090
+ init_UpdateOrganizationRequest();
6091
+ init_AddUserToOrgRequest();
6092
+ }
6093
+ });
6094
+
5503
6095
  // src/serialization/resources/organization/client/index.ts
5504
6096
  var init_client4 = __esm({
5505
6097
  "src/serialization/resources/organization/client/index.ts"() {
@@ -5510,13 +6102,17 @@ var init_client4 = __esm({
5510
6102
  init_isMember2();
5511
6103
  init_getMyOrganizationFromScopedToken2();
5512
6104
  init_addUser2();
6105
+ init_requests4();
5513
6106
  }
5514
6107
  });
5515
6108
 
5516
6109
  // src/serialization/resources/organization/index.ts
5517
6110
  var organization_exports2 = {};
5518
6111
  __export(organization_exports2, {
6112
+ AddUserToOrgRequest: () => AddUserToOrgRequest,
6113
+ CreateOrganizationRequest: () => CreateOrganizationRequest,
5519
6114
  Organization: () => Organization,
6115
+ UpdateOrganizationRequest: () => UpdateOrganizationRequest,
5520
6116
  addUser: () => addUser_exports2,
5521
6117
  create: () => create_exports2,
5522
6118
  get: () => get_exports2,
@@ -5527,7 +6123,7 @@ __export(organization_exports2, {
5527
6123
  var init_organization2 = __esm({
5528
6124
  "src/serialization/resources/organization/index.ts"() {
5529
6125
  "use strict";
5530
- init_types8();
6126
+ init_types6();
5531
6127
  init_client4();
5532
6128
  }
5533
6129
  });
@@ -5581,7 +6177,7 @@ var init_RegistryToken2 = __esm({
5581
6177
  npm: schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).NpmRegistryToken),
5582
6178
  maven: schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).MavenRegistryToken)
5583
6179
  }).transform({
5584
- parse: (value) => {
6180
+ transform: (value) => {
5585
6181
  switch (value.type) {
5586
6182
  case "npm":
5587
6183
  return api_exports.RegistryToken.npm(value);
@@ -5591,13 +6187,13 @@ var init_RegistryToken2 = __esm({
5591
6187
  return api_exports.RegistryToken._unknown(value);
5592
6188
  }
5593
6189
  },
5594
- json: (value) => value
6190
+ untransform: ({ _visit, ...value }) => value
5595
6191
  });
5596
6192
  }
5597
6193
  });
5598
6194
 
5599
6195
  // src/serialization/resources/registry/types/index.ts
5600
- var init_types9 = __esm({
6196
+ var init_types7 = __esm({
5601
6197
  "src/serialization/resources/registry/types/index.ts"() {
5602
6198
  "use strict";
5603
6199
  init_RegistryTokens2();
@@ -5610,25 +6206,19 @@ var init_types9 = __esm({
5610
6206
  // src/serialization/resources/registry/client/generateRegistryTokens.ts
5611
6207
  var generateRegistryTokens_exports2 = {};
5612
6208
  __export(generateRegistryTokens_exports2, {
5613
- Error: () => Error18,
5614
- Request: () => Request4,
5615
- Response: () => Response4
6209
+ Error: () => Error18
5616
6210
  });
5617
- var Request4, Response4, Error18;
6211
+ var Error18;
5618
6212
  var init_generateRegistryTokens2 = __esm({
5619
6213
  "src/serialization/resources/registry/client/generateRegistryTokens.ts"() {
5620
6214
  "use strict";
5621
6215
  init_src();
5622
6216
  init_core();
5623
- Request4 = schemas_exports.object({
5624
- organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId)
5625
- });
5626
- Response4 = schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).RegistryTokens);
5627
6217
  Error18 = schemas_exports.union("error", {
5628
6218
  UnauthorizedError: schemas_exports.object({}),
5629
6219
  OrganizationNotFoundError: schemas_exports.object({})
5630
6220
  }).transform({
5631
- parse: (value) => {
6221
+ transform: (value) => {
5632
6222
  switch (value.error) {
5633
6223
  case "UnauthorizedError":
5634
6224
  return api_exports.registry.generateRegistryTokens.Error.unauthorizedError();
@@ -5636,7 +6226,7 @@ var init_generateRegistryTokens2 = __esm({
5636
6226
  return api_exports.registry.generateRegistryTokens.Error.organizationNotFoundError();
5637
6227
  }
5638
6228
  },
5639
- json: (value) => value
6229
+ untransform: ({ _visit, ...value }) => value
5640
6230
  });
5641
6231
  }
5642
6232
  });
@@ -5645,25 +6235,20 @@ var init_generateRegistryTokens2 = __esm({
5645
6235
  var hasRegistryPermission_exports2 = {};
5646
6236
  __export(hasRegistryPermission_exports2, {
5647
6237
  Error: () => Error19,
5648
- Request: () => Request5,
5649
- Response: () => Response5
6238
+ Response: () => Response2
5650
6239
  });
5651
- var Request5, Response5, Error19;
6240
+ var Response2, Error19;
5652
6241
  var init_hasRegistryPermission2 = __esm({
5653
6242
  "src/serialization/resources/registry/client/hasRegistryPermission.ts"() {
5654
6243
  "use strict";
5655
- init_src();
5656
6244
  init_core();
5657
- Request5 = schemas_exports.object({
5658
- organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
5659
- token: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).RegistryToken).optional()
5660
- });
5661
- Response5 = schemas_exports.boolean();
6245
+ init_src();
6246
+ Response2 = schemas_exports.boolean();
5662
6247
  Error19 = schemas_exports.union("error", {
5663
6248
  UnauthorizedError: schemas_exports.object({}),
5664
6249
  OrganizationNotFoundError: schemas_exports.object({})
5665
6250
  }).transform({
5666
- parse: (value) => {
6251
+ transform: (value) => {
5667
6252
  switch (value.error) {
5668
6253
  case "UnauthorizedError":
5669
6254
  return api_exports.registry.hasRegistryPermission.Error.unauthorizedError();
@@ -5671,7 +6256,7 @@ var init_hasRegistryPermission2 = __esm({
5671
6256
  return api_exports.registry.hasRegistryPermission.Error.organizationNotFoundError();
5672
6257
  }
5673
6258
  },
5674
- json: (value) => value
6259
+ untransform: ({ _visit, ...value }) => value
5675
6260
  });
5676
6261
  }
5677
6262
  });
@@ -5679,24 +6264,19 @@ var init_hasRegistryPermission2 = __esm({
5679
6264
  // src/serialization/resources/registry/client/revokeToken.ts
5680
6265
  var revokeToken_exports2 = {};
5681
6266
  __export(revokeToken_exports2, {
5682
- Error: () => Error20,
5683
- Request: () => Request6
6267
+ Error: () => Error20
5684
6268
  });
5685
- var Request6, Error20;
6269
+ var Error20;
5686
6270
  var init_revokeToken2 = __esm({
5687
6271
  "src/serialization/resources/registry/client/revokeToken.ts"() {
5688
6272
  "use strict";
5689
6273
  init_src();
5690
6274
  init_core();
5691
- Request6 = schemas_exports.object({
5692
- organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
5693
- token: schemas_exports.string()
5694
- });
5695
6275
  Error20 = schemas_exports.union("error", {
5696
6276
  UnauthorizedError: schemas_exports.object({}),
5697
6277
  OrganizationNotFoundError: schemas_exports.object({})
5698
6278
  }).transform({
5699
- parse: (value) => {
6279
+ transform: (value) => {
5700
6280
  switch (value.error) {
5701
6281
  case "UnauthorizedError":
5702
6282
  return api_exports.registry.revokeToken.Error.unauthorizedError();
@@ -5704,11 +6284,59 @@ var init_revokeToken2 = __esm({
5704
6284
  return api_exports.registry.revokeToken.Error.organizationNotFoundError();
5705
6285
  }
5706
6286
  },
5707
- json: (value) => value
6287
+ untransform: ({ _visit, ...value }) => value
5708
6288
  });
5709
6289
  }
5710
6290
  });
5711
6291
 
6292
+ // src/serialization/resources/registry/client/requests/GenerateRegistryTokensRequest.ts
6293
+ var GenerateRegistryTokensRequest;
6294
+ var init_GenerateRegistryTokensRequest = __esm({
6295
+ "src/serialization/resources/registry/client/requests/GenerateRegistryTokensRequest.ts"() {
6296
+ "use strict";
6297
+ init_core();
6298
+ GenerateRegistryTokensRequest = schemas_exports.object({
6299
+ organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId)
6300
+ });
6301
+ }
6302
+ });
6303
+
6304
+ // src/serialization/resources/registry/client/requests/CheckRegistryPermissionRequest.ts
6305
+ var CheckRegistryPermissionRequest;
6306
+ var init_CheckRegistryPermissionRequest = __esm({
6307
+ "src/serialization/resources/registry/client/requests/CheckRegistryPermissionRequest.ts"() {
6308
+ "use strict";
6309
+ init_core();
6310
+ CheckRegistryPermissionRequest = schemas_exports.object({
6311
+ organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
6312
+ token: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).RegistryToken).optional()
6313
+ });
6314
+ }
6315
+ });
6316
+
6317
+ // src/serialization/resources/registry/client/requests/RevokeTokenRequest.ts
6318
+ var RevokeTokenRequest;
6319
+ var init_RevokeTokenRequest = __esm({
6320
+ "src/serialization/resources/registry/client/requests/RevokeTokenRequest.ts"() {
6321
+ "use strict";
6322
+ init_core();
6323
+ RevokeTokenRequest = schemas_exports.object({
6324
+ organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
6325
+ token: schemas_exports.string()
6326
+ });
6327
+ }
6328
+ });
6329
+
6330
+ // src/serialization/resources/registry/client/requests/index.ts
6331
+ var init_requests5 = __esm({
6332
+ "src/serialization/resources/registry/client/requests/index.ts"() {
6333
+ "use strict";
6334
+ init_GenerateRegistryTokensRequest();
6335
+ init_CheckRegistryPermissionRequest();
6336
+ init_RevokeTokenRequest();
6337
+ }
6338
+ });
6339
+
5712
6340
  // src/serialization/resources/registry/client/index.ts
5713
6341
  var init_client5 = __esm({
5714
6342
  "src/serialization/resources/registry/client/index.ts"() {
@@ -5716,16 +6344,20 @@ var init_client5 = __esm({
5716
6344
  init_generateRegistryTokens2();
5717
6345
  init_hasRegistryPermission2();
5718
6346
  init_revokeToken2();
6347
+ init_requests5();
5719
6348
  }
5720
6349
  });
5721
6350
 
5722
6351
  // src/serialization/resources/registry/index.ts
5723
6352
  var registry_exports2 = {};
5724
6353
  __export(registry_exports2, {
6354
+ CheckRegistryPermissionRequest: () => CheckRegistryPermissionRequest,
6355
+ GenerateRegistryTokensRequest: () => GenerateRegistryTokensRequest,
5725
6356
  MavenRegistryToken: () => MavenRegistryToken,
5726
6357
  NpmRegistryToken: () => NpmRegistryToken,
5727
6358
  RegistryToken: () => RegistryToken2,
5728
6359
  RegistryTokens: () => RegistryTokens,
6360
+ RevokeTokenRequest: () => RevokeTokenRequest,
5729
6361
  generateRegistryTokens: () => generateRegistryTokens_exports2,
5730
6362
  hasRegistryPermission: () => hasRegistryPermission_exports2,
5731
6363
  revokeToken: () => revokeToken_exports2
@@ -5733,7 +6365,7 @@ __export(registry_exports2, {
5733
6365
  var init_registry2 = __esm({
5734
6366
  "src/serialization/resources/registry/index.ts"() {
5735
6367
  "use strict";
5736
- init_types9();
6368
+ init_types7();
5737
6369
  init_client5();
5738
6370
  }
5739
6371
  });
@@ -5771,7 +6403,7 @@ var init_OrganizationsPage2 = __esm({
5771
6403
  });
5772
6404
 
5773
6405
  // src/serialization/resources/user/types/index.ts
5774
- var init_types10 = __esm({
6406
+ var init_types8 = __esm({
5775
6407
  "src/serialization/resources/user/types/index.ts"() {
5776
6408
  "use strict";
5777
6409
  init_User2();
@@ -5779,56 +6411,16 @@ var init_types10 = __esm({
5779
6411
  }
5780
6412
  });
5781
6413
 
5782
- // src/serialization/resources/user/client/getMyself.ts
5783
- var getMyself_exports2 = {};
5784
- __export(getMyself_exports2, {
5785
- Response: () => Response6
5786
- });
5787
- var Response6;
5788
- var init_getMyself2 = __esm({
5789
- "src/serialization/resources/user/client/getMyself.ts"() {
5790
- "use strict";
5791
- init_core();
5792
- Response6 = schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).User);
5793
- }
5794
- });
5795
-
5796
- // src/serialization/resources/user/client/getMyOrganizations.ts
5797
- var getMyOrganizations_exports2 = {};
5798
- __export(getMyOrganizations_exports2, {
5799
- Response: () => Response7
5800
- });
5801
- var Response7;
5802
- var init_getMyOrganizations2 = __esm({
5803
- "src/serialization/resources/user/client/getMyOrganizations.ts"() {
5804
- "use strict";
5805
- init_core();
5806
- Response7 = schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationsPage);
5807
- }
5808
- });
5809
-
5810
- // src/serialization/resources/user/client/index.ts
5811
- var init_client6 = __esm({
5812
- "src/serialization/resources/user/client/index.ts"() {
5813
- "use strict";
5814
- init_getMyself2();
5815
- init_getMyOrganizations2();
5816
- }
5817
- });
5818
-
5819
6414
  // src/serialization/resources/user/index.ts
5820
6415
  var user_exports2 = {};
5821
6416
  __export(user_exports2, {
5822
6417
  OrganizationsPage: () => OrganizationsPage,
5823
- User: () => User,
5824
- getMyOrganizations: () => getMyOrganizations_exports2,
5825
- getMyself: () => getMyself_exports2
6418
+ User: () => User
5826
6419
  });
5827
6420
  var init_user2 = __esm({
5828
6421
  "src/serialization/resources/user/index.ts"() {
5829
6422
  "use strict";
5830
- init_types10();
5831
- init_client6();
6423
+ init_types8();
5832
6424
  }
5833
6425
  });
5834
6426
 
@@ -5837,19 +6429,25 @@ var init_resources2 = __esm({
5837
6429
  "src/serialization/resources/index.ts"() {
5838
6430
  "use strict";
5839
6431
  init_commons2();
5840
- init_types7();
6432
+ init_types5();
5841
6433
  init_organization2();
5842
- init_types8();
6434
+ init_types6();
5843
6435
  init_registry2();
5844
- init_types9();
6436
+ init_types7();
5845
6437
  init_user2();
5846
- init_types10();
6438
+ init_types8();
6439
+ init_requests4();
6440
+ init_requests5();
5847
6441
  }
5848
6442
  });
5849
6443
 
5850
6444
  // src/serialization/index.ts
5851
6445
  var serialization_exports = {};
5852
6446
  __export(serialization_exports, {
6447
+ AddUserToOrgRequest: () => AddUserToOrgRequest,
6448
+ CheckRegistryPermissionRequest: () => CheckRegistryPermissionRequest,
6449
+ CreateOrganizationRequest: () => CreateOrganizationRequest,
6450
+ GenerateRegistryTokensRequest: () => GenerateRegistryTokensRequest,
5853
6451
  MavenRegistryToken: () => MavenRegistryToken,
5854
6452
  NpmRegistryToken: () => NpmRegistryToken,
5855
6453
  Organization: () => Organization,
@@ -5857,6 +6455,8 @@ __export(serialization_exports, {
5857
6455
  OrganizationsPage: () => OrganizationsPage,
5858
6456
  RegistryToken: () => RegistryToken2,
5859
6457
  RegistryTokens: () => RegistryTokens,
6458
+ RevokeTokenRequest: () => RevokeTokenRequest,
6459
+ UpdateOrganizationRequest: () => UpdateOrganizationRequest,
5860
6460
  User: () => User,
5861
6461
  UserId: () => UserId2,
5862
6462
  commons: () => commons_exports2,
@@ -5891,10 +6491,7 @@ var init_Client = __esm({
5891
6491
  headers: {
5892
6492
  Authorization: BearerToken.toAuthorizationHeader(await Supplier.get(this.options.token))
5893
6493
  },
5894
- body: await organization_exports2.create.Request.json({
5895
- organizationId: request.organizationId,
5896
- artifactReadRequiresToken: request.artifactReadRequiresToken
5897
- })
6494
+ body: await CreateOrganizationRequest.jsonOrThrow(request)
5898
6495
  });
5899
6496
  if (_response.ok) {
5900
6497
  return {
@@ -5908,8 +6505,9 @@ var init_Client = __esm({
5908
6505
  case "OrganizationAlreadyExistsError":
5909
6506
  return {
5910
6507
  ok: false,
5911
- error: await organization_exports2.create.Error.parse(
5912
- _response.error.body
6508
+ error: await organization_exports2.create.Error.parseOrThrow(
6509
+ _response.error.body,
6510
+ { allowUnknownKeys: true }
5913
6511
  )
5914
6512
  };
5915
6513
  }
@@ -5921,14 +6519,15 @@ var init_Client = __esm({
5921
6519
  }
5922
6520
  async update(orgId, request) {
5923
6521
  const _response = await fetcher({
5924
- url: (0, import_url_join.default)(this.options.environment, `/organizations/${orgId}/update`),
6522
+ url: (0, import_url_join.default)(
6523
+ this.options.environment,
6524
+ `/organizations/${await OrganizationId2.jsonOrThrow(orgId)}/update`
6525
+ ),
5925
6526
  method: "POST",
5926
6527
  headers: {
5927
6528
  Authorization: BearerToken.toAuthorizationHeader(await Supplier.get(this.options.token))
5928
6529
  },
5929
- body: await organization_exports2.update.Request.json({
5930
- artifactReadRequiresToken: request.artifactReadRequiresToken
5931
- })
6530
+ body: await UpdateOrganizationRequest.jsonOrThrow(request)
5932
6531
  });
5933
6532
  if (_response.ok) {
5934
6533
  return {
@@ -5941,8 +6540,9 @@ var init_Client = __esm({
5941
6540
  case "UnauthorizedError":
5942
6541
  return {
5943
6542
  ok: false,
5944
- error: await organization_exports2.update.Error.parse(
5945
- _response.error.body
6543
+ error: await organization_exports2.update.Error.parseOrThrow(
6544
+ _response.error.body,
6545
+ { allowUnknownKeys: true }
5946
6546
  )
5947
6547
  };
5948
6548
  }
@@ -5954,7 +6554,10 @@ var init_Client = __esm({
5954
6554
  }
5955
6555
  async get(orgId) {
5956
6556
  const _response = await fetcher({
5957
- url: (0, import_url_join.default)(this.options.environment, `/organizations/${orgId}`),
6557
+ url: (0, import_url_join.default)(
6558
+ this.options.environment,
6559
+ `/organizations/${await OrganizationId2.jsonOrThrow(orgId)}`
6560
+ ),
5958
6561
  method: "GET",
5959
6562
  headers: {
5960
6563
  Authorization: BearerToken.toAuthorizationHeader(await Supplier.get(this.options.token))
@@ -5963,9 +6566,9 @@ var init_Client = __esm({
5963
6566
  if (_response.ok) {
5964
6567
  return {
5965
6568
  ok: true,
5966
- body: await organization_exports2.get.Response.parse(
5967
- _response.body
5968
- )
6569
+ body: await Organization.parseOrThrow(_response.body, {
6570
+ allowUnknownKeys: true
6571
+ })
5969
6572
  };
5970
6573
  }
5971
6574
  if (_response.error.reason === "status-code") {
@@ -5973,8 +6576,9 @@ var init_Client = __esm({
5973
6576
  case "UnauthorizedError":
5974
6577
  return {
5975
6578
  ok: false,
5976
- error: await organization_exports2.get.Error.parse(
5977
- _response.error.body
6579
+ error: await organization_exports2.get.Error.parseOrThrow(
6580
+ _response.error.body,
6581
+ { allowUnknownKeys: true }
5978
6582
  )
5979
6583
  };
5980
6584
  }
@@ -5986,7 +6590,10 @@ var init_Client = __esm({
5986
6590
  }
5987
6591
  async isMember(organizationId) {
5988
6592
  const _response = await fetcher({
5989
- url: (0, import_url_join.default)(this.options.environment, `/organizations/belongs-to-organization/${organizationId}`),
6593
+ url: (0, import_url_join.default)(
6594
+ this.options.environment,
6595
+ `/organizations/belongs-to-organization/${await OrganizationId2.jsonOrThrow(organizationId)}`
6596
+ ),
5990
6597
  method: "POST",
5991
6598
  headers: {
5992
6599
  Authorization: BearerToken.toAuthorizationHeader(await Supplier.get(this.options.token))
@@ -5995,8 +6602,9 @@ var init_Client = __esm({
5995
6602
  if (_response.ok) {
5996
6603
  return {
5997
6604
  ok: true,
5998
- body: await organization_exports2.isMember.Response.parse(
5999
- _response.body
6605
+ body: await organization_exports2.isMember.Response.parseOrThrow(
6606
+ _response.body,
6607
+ { allowUnknownKeys: true }
6000
6608
  )
6001
6609
  };
6002
6610
  }
@@ -6019,9 +6627,9 @@ var init_Client = __esm({
6019
6627
  if (_response.ok) {
6020
6628
  return {
6021
6629
  ok: true,
6022
- body: await organization_exports2.getMyOrganizationFromScopedToken.Response.parse(
6023
- _response.body
6024
- )
6630
+ body: await Organization.parseOrThrow(_response.body, {
6631
+ allowUnknownKeys: true
6632
+ })
6025
6633
  };
6026
6634
  }
6027
6635
  if (_response.error.reason === "status-code") {
@@ -6029,8 +6637,9 @@ var init_Client = __esm({
6029
6637
  case "UnauthorizedError":
6030
6638
  return {
6031
6639
  ok: false,
6032
- error: await organization_exports2.getMyOrganizationFromScopedToken.Error.parse(
6033
- _response.error.body
6640
+ error: await organization_exports2.getMyOrganizationFromScopedToken.Error.parseOrThrow(
6641
+ _response.error.body,
6642
+ { allowUnknownKeys: true }
6034
6643
  )
6035
6644
  };
6036
6645
  }
@@ -6047,10 +6656,7 @@ var init_Client = __esm({
6047
6656
  headers: {
6048
6657
  Authorization: BearerToken.toAuthorizationHeader(await Supplier.get(this.options.token))
6049
6658
  },
6050
- body: await organization_exports2.addUser.Request.json({
6051
- userId: request.userId,
6052
- orgId: request.orgId
6053
- })
6659
+ body: await AddUserToOrgRequest.jsonOrThrow(request)
6054
6660
  });
6055
6661
  if (_response.ok) {
6056
6662
  return {
@@ -6064,8 +6670,9 @@ var init_Client = __esm({
6064
6670
  case "UserIdDoesNotExistError":
6065
6671
  return {
6066
6672
  ok: false,
6067
- error: await organization_exports2.addUser.Error.parse(
6068
- _response.error.body
6673
+ error: await organization_exports2.addUser.Error.parseOrThrow(
6674
+ _response.error.body,
6675
+ { allowUnknownKeys: true }
6069
6676
  )
6070
6677
  };
6071
6678
  }
@@ -6099,16 +6706,14 @@ var init_Client2 = __esm({
6099
6706
  headers: {
6100
6707
  Authorization: BearerToken.toAuthorizationHeader(await Supplier.get(this.options.token))
6101
6708
  },
6102
- body: await registry_exports2.generateRegistryTokens.Request.json({
6103
- organizationId: request.organizationId
6104
- })
6709
+ body: await GenerateRegistryTokensRequest.jsonOrThrow(request)
6105
6710
  });
6106
6711
  if (_response.ok) {
6107
6712
  return {
6108
6713
  ok: true,
6109
- body: await registry_exports2.generateRegistryTokens.Response.parse(
6110
- _response.body
6111
- )
6714
+ body: await RegistryTokens.parseOrThrow(_response.body, {
6715
+ allowUnknownKeys: true
6716
+ })
6112
6717
  };
6113
6718
  }
6114
6719
  if (_response.error.reason === "status-code") {
@@ -6117,8 +6722,9 @@ var init_Client2 = __esm({
6117
6722
  case "OrganizationNotFoundError":
6118
6723
  return {
6119
6724
  ok: false,
6120
- error: await registry_exports2.generateRegistryTokens.Error.parse(
6121
- _response.error.body
6725
+ error: await registry_exports2.generateRegistryTokens.Error.parseOrThrow(
6726
+ _response.error.body,
6727
+ { allowUnknownKeys: true }
6122
6728
  )
6123
6729
  };
6124
6730
  }
@@ -6135,16 +6741,14 @@ var init_Client2 = __esm({
6135
6741
  headers: {
6136
6742
  Authorization: BearerToken.toAuthorizationHeader(await Supplier.get(this.options.token))
6137
6743
  },
6138
- body: await registry_exports2.hasRegistryPermission.Request.json({
6139
- organizationId: request.organizationId,
6140
- token: request.token
6141
- })
6744
+ body: await CheckRegistryPermissionRequest.jsonOrThrow(request)
6142
6745
  });
6143
6746
  if (_response.ok) {
6144
6747
  return {
6145
6748
  ok: true,
6146
- body: await registry_exports2.hasRegistryPermission.Response.parse(
6147
- _response.body
6749
+ body: await registry_exports2.hasRegistryPermission.Response.parseOrThrow(
6750
+ _response.body,
6751
+ { allowUnknownKeys: true }
6148
6752
  )
6149
6753
  };
6150
6754
  }
@@ -6154,8 +6758,9 @@ var init_Client2 = __esm({
6154
6758
  case "OrganizationNotFoundError":
6155
6759
  return {
6156
6760
  ok: false,
6157
- error: await registry_exports2.hasRegistryPermission.Error.parse(
6158
- _response.error.body
6761
+ error: await registry_exports2.hasRegistryPermission.Error.parseOrThrow(
6762
+ _response.error.body,
6763
+ { allowUnknownKeys: true }
6159
6764
  )
6160
6765
  };
6161
6766
  }
@@ -6172,10 +6777,7 @@ var init_Client2 = __esm({
6172
6777
  headers: {
6173
6778
  Authorization: BearerToken.toAuthorizationHeader(await Supplier.get(this.options.token))
6174
6779
  },
6175
- body: await registry_exports2.revokeToken.Request.json({
6176
- organizationId: request.organizationId,
6177
- token: request.token
6178
- })
6780
+ body: await RevokeTokenRequest.jsonOrThrow(request)
6179
6781
  });
6180
6782
  if (_response.ok) {
6181
6783
  return {
@@ -6189,8 +6791,9 @@ var init_Client2 = __esm({
6189
6791
  case "OrganizationNotFoundError":
6190
6792
  return {
6191
6793
  ok: false,
6192
- error: await registry_exports2.revokeToken.Error.parse(
6193
- _response.error.body
6794
+ error: await registry_exports2.revokeToken.Error.parseOrThrow(
6795
+ _response.error.body,
6796
+ { allowUnknownKeys: true }
6194
6797
  )
6195
6798
  };
6196
6799
  }
@@ -6228,9 +6831,9 @@ var init_Client3 = __esm({
6228
6831
  if (_response.ok) {
6229
6832
  return {
6230
6833
  ok: true,
6231
- body: await user_exports2.getMyself.Response.parse(
6232
- _response.body
6233
- )
6834
+ body: await User.parseOrThrow(_response.body, {
6835
+ allowUnknownKeys: true
6836
+ })
6234
6837
  };
6235
6838
  }
6236
6839
  return {
@@ -6239,8 +6842,9 @@ var init_Client3 = __esm({
6239
6842
  };
6240
6843
  }
6241
6844
  async getMyOrganizations(request) {
6845
+ const { pageId } = request;
6242
6846
  const _queryParams = new URLSearchParams();
6243
- _queryParams.append("pageId", request.pageId.toString());
6847
+ _queryParams.append("pageId", pageId.toString());
6244
6848
  const _response = await fetcher({
6245
6849
  url: (0, import_url_join3.default)(this.options.environment, "/users/organizations"),
6246
6850
  method: "GET",
@@ -6252,8 +6856,9 @@ var init_Client3 = __esm({
6252
6856
  if (_response.ok) {
6253
6857
  return {
6254
6858
  ok: true,
6255
- body: await user_exports2.getMyOrganizations.Response.parse(
6256
- _response.body
6859
+ body: await OrganizationsPage.parseOrThrow(
6860
+ _response.body,
6861
+ { allowUnknownKeys: true }
6257
6862
  )
6258
6863
  };
6259
6864
  }