@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
@@ -810,12 +810,72 @@ var init_api = __esm({
810
810
  }
811
811
  });
812
812
 
813
- // src/core/schemas/builders/schema-utils/types.ts
814
- var OPTIONAL_BRAND;
815
- var init_types5 = __esm({
816
- "src/core/schemas/builders/schema-utils/types.ts"() {
813
+ // src/core/schemas/Schema.ts
814
+ var SchemaType;
815
+ var init_Schema = __esm({
816
+ "src/core/schemas/Schema.ts"() {
817
+ "use strict";
818
+ SchemaType = {
819
+ DATE: "date",
820
+ ENUM: "enum",
821
+ LIST: "list",
822
+ STRING_LITERAL: "stringLiteral",
823
+ OBJECT: "object",
824
+ ANY: "any",
825
+ BOOLEAN: "boolean",
826
+ NUMBER: "number",
827
+ STRING: "string",
828
+ UNKNOWN: "unknown",
829
+ RECORD: "record",
830
+ SET: "set",
831
+ UNION: "union",
832
+ OPTIONAL: "optional"
833
+ };
834
+ }
835
+ });
836
+
837
+ // src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts
838
+ function stringifyValidationError(error) {
839
+ if (error.path.length === 0) {
840
+ return error.message;
841
+ }
842
+ return `${error.path.join(" -> ")}: ${error.message}`;
843
+ }
844
+ var init_stringifyValidationErrors = __esm({
845
+ "src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts"() {
846
+ "use strict";
847
+ }
848
+ });
849
+
850
+ // src/core/schemas/builders/schema-utils/JsonError.ts
851
+ var JsonError;
852
+ var init_JsonError = __esm({
853
+ "src/core/schemas/builders/schema-utils/JsonError.ts"() {
854
+ "use strict";
855
+ init_stringifyValidationErrors();
856
+ JsonError = class extends Error {
857
+ constructor(errors) {
858
+ super(errors.map(stringifyValidationError).join("; "));
859
+ this.errors = errors;
860
+ Object.setPrototypeOf(this, JsonError.prototype);
861
+ }
862
+ };
863
+ }
864
+ });
865
+
866
+ // src/core/schemas/builders/schema-utils/ParseError.ts
867
+ var ParseError;
868
+ var init_ParseError = __esm({
869
+ "src/core/schemas/builders/schema-utils/ParseError.ts"() {
817
870
  "use strict";
818
- OPTIONAL_BRAND = void 0;
871
+ init_stringifyValidationErrors();
872
+ ParseError = class extends Error {
873
+ constructor(errors) {
874
+ super(errors.map(stringifyValidationError).join("; "));
875
+ this.errors = errors;
876
+ Object.setPrototypeOf(this, ParseError.prototype);
877
+ }
878
+ };
819
879
  }
820
880
  });
821
881
 
@@ -823,16 +883,46 @@ var init_types5 = __esm({
823
883
  function getSchemaUtils(schema) {
824
884
  return {
825
885
  optional: () => optional(schema),
826
- transform: (transformer) => transform(schema, transformer)
886
+ transform: (transformer) => transform(schema, transformer),
887
+ parseOrThrow: async (raw, opts) => {
888
+ const parsed = await schema.parse(raw, opts);
889
+ if (parsed.ok) {
890
+ return parsed.value;
891
+ }
892
+ throw new ParseError(parsed.errors);
893
+ },
894
+ jsonOrThrow: async (parsed, opts) => {
895
+ const raw = await schema.json(parsed, opts);
896
+ if (raw.ok) {
897
+ return raw.value;
898
+ }
899
+ throw new JsonError(raw.errors);
900
+ }
827
901
  };
828
902
  }
829
903
  function optional(schema) {
830
904
  const baseSchema = {
831
- parse: (raw, opts) => raw != null ? schema.parse(raw, opts) : void 0,
832
- json: (parsed, opts) => parsed != null ? schema.json(parsed, opts) : void 0
905
+ parse: (raw, opts) => {
906
+ if (raw == null) {
907
+ return {
908
+ ok: true,
909
+ value: void 0
910
+ };
911
+ }
912
+ return schema.parse(raw, opts);
913
+ },
914
+ json: (parsed, opts) => {
915
+ if (parsed == null) {
916
+ return {
917
+ ok: true,
918
+ value: null
919
+ };
920
+ }
921
+ return schema.json(parsed, opts);
922
+ },
923
+ getType: () => SchemaType.OPTIONAL
833
924
  };
834
925
  return {
835
- ...OPTIONAL_BRAND,
836
926
  ...baseSchema,
837
927
  ...getSchemaUtils(baseSchema)
838
928
  };
@@ -840,13 +930,20 @@ function optional(schema) {
840
930
  function transform(schema, transformer) {
841
931
  const baseSchema = {
842
932
  parse: async (raw, opts) => {
843
- const postTransformParsed = await schema.parse(raw, opts);
844
- return transformer.parse(postTransformParsed, opts);
933
+ const parsed = await schema.parse(raw, opts);
934
+ if (!parsed.ok) {
935
+ return parsed;
936
+ }
937
+ return {
938
+ ok: true,
939
+ value: transformer.transform(parsed.value)
940
+ };
845
941
  },
846
- json: async (parsed, opts) => {
847
- const preTransformParsed = await transformer.json(parsed, opts);
848
- return schema.json(preTransformParsed, opts);
849
- }
942
+ json: async (transformed, opts) => {
943
+ const parsed = await transformer.untransform(transformed);
944
+ return schema.json(parsed, opts);
945
+ },
946
+ getType: () => schema.getType()
850
947
  };
851
948
  return {
852
949
  ...baseSchema,
@@ -856,7 +953,9 @@ function transform(schema, transformer) {
856
953
  var init_getSchemaUtils = __esm({
857
954
  "src/core/schemas/builders/schema-utils/getSchemaUtils.ts"() {
858
955
  "use strict";
859
- init_types5();
956
+ init_Schema();
957
+ init_JsonError();
958
+ init_ParseError();
860
959
  }
861
960
  });
862
961
 
@@ -865,25 +964,64 @@ var init_schema_utils = __esm({
865
964
  "src/core/schemas/builders/schema-utils/index.ts"() {
866
965
  "use strict";
867
966
  init_getSchemaUtils();
868
- init_types5();
967
+ init_JsonError();
968
+ init_ParseError();
869
969
  }
870
970
  });
871
971
 
872
972
  // src/core/schemas/builders/date/date.ts
873
973
  function date() {
874
974
  const baseSchema = {
875
- parse: (raw) => new Date(raw),
876
- json: (date2) => date2.toISOString()
975
+ parse: (raw) => {
976
+ if (typeof raw === "string" && ISO_8601_REGEX.test(raw)) {
977
+ return {
978
+ ok: true,
979
+ value: new Date(raw)
980
+ };
981
+ } else {
982
+ return {
983
+ ok: false,
984
+ errors: [
985
+ {
986
+ path: [],
987
+ message: "Not an ISO 8601 date string"
988
+ }
989
+ ]
990
+ };
991
+ }
992
+ },
993
+ json: (date2) => {
994
+ if (date2 instanceof Date) {
995
+ return {
996
+ ok: true,
997
+ value: date2.toISOString()
998
+ };
999
+ } else {
1000
+ return {
1001
+ ok: false,
1002
+ errors: [
1003
+ {
1004
+ path: [],
1005
+ message: "Not a Date object"
1006
+ }
1007
+ ]
1008
+ };
1009
+ }
1010
+ },
1011
+ getType: () => SchemaType.DATE
877
1012
  };
878
1013
  return {
879
1014
  ...baseSchema,
880
1015
  ...getSchemaUtils(baseSchema)
881
1016
  };
882
1017
  }
1018
+ var ISO_8601_REGEX;
883
1019
  var init_date = __esm({
884
1020
  "src/core/schemas/builders/date/date.ts"() {
885
1021
  "use strict";
1022
+ init_Schema();
886
1023
  init_schema_utils();
1024
+ 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)?)?)?)?$/;
887
1025
  }
888
1026
  });
889
1027
 
@@ -895,52 +1033,55 @@ var init_date2 = __esm({
895
1033
  }
896
1034
  });
897
1035
 
898
- // src/core/schemas/builders/identity/identity.ts
899
- function identity() {
900
- const baseSchema = {
901
- parse: (raw) => raw,
902
- json: (parsed) => parsed
903
- };
904
- return {
905
- ...baseSchema,
906
- ...getSchemaUtils(baseSchema)
1036
+ // src/core/schemas/utils/createIdentitySchemaCreator.ts
1037
+ function createIdentitySchemaCreator(schemaType, validate) {
1038
+ return () => {
1039
+ const baseSchema = {
1040
+ parse: validate,
1041
+ json: validate,
1042
+ getType: () => schemaType
1043
+ };
1044
+ return {
1045
+ ...baseSchema,
1046
+ ...getSchemaUtils(baseSchema)
1047
+ };
907
1048
  };
908
1049
  }
909
- var init_identity = __esm({
910
- "src/core/schemas/builders/identity/identity.ts"() {
911
- "use strict";
912
- init_schema_utils();
913
- }
914
- });
915
-
916
- // src/core/schemas/builders/identity/createIdentitySchemaCreator.ts
917
- function createIdentitySchemaCreator() {
918
- return () => identity();
919
- }
920
1050
  var init_createIdentitySchemaCreator = __esm({
921
- "src/core/schemas/builders/identity/createIdentitySchemaCreator.ts"() {
922
- "use strict";
923
- init_identity();
924
- }
925
- });
926
-
927
- // src/core/schemas/builders/identity/index.ts
928
- var init_identity2 = __esm({
929
- "src/core/schemas/builders/identity/index.ts"() {
1051
+ "src/core/schemas/utils/createIdentitySchemaCreator.ts"() {
930
1052
  "use strict";
931
- init_createIdentitySchemaCreator();
932
- init_identity();
1053
+ init_schema_utils();
933
1054
  }
934
1055
  });
935
1056
 
936
1057
  // src/core/schemas/builders/enum/enum.ts
937
- function enum_(_values) {
938
- return createIdentitySchemaCreator()();
1058
+ function enum_(values) {
1059
+ const validValues = new Set(values);
1060
+ const schemaCreator = createIdentitySchemaCreator(SchemaType.ENUM, (value, { allowUnknownKeys = false } = {}) => {
1061
+ if (typeof value === "string" && (validValues.has(value) || allowUnknownKeys)) {
1062
+ return {
1063
+ ok: true,
1064
+ value
1065
+ };
1066
+ } else {
1067
+ return {
1068
+ ok: false,
1069
+ errors: [
1070
+ {
1071
+ path: [],
1072
+ message: "Not one of the allowed values"
1073
+ }
1074
+ ]
1075
+ };
1076
+ }
1077
+ });
1078
+ return schemaCreator();
939
1079
  }
940
1080
  var init_enum = __esm({
941
1081
  "src/core/schemas/builders/enum/enum.ts"() {
942
1082
  "use strict";
943
- init_identity2();
1083
+ init_Schema();
1084
+ init_createIdentitySchemaCreator();
944
1085
  }
945
1086
  });
946
1087
 
@@ -962,8 +1103,9 @@ function lazy(getter) {
962
1103
  }
963
1104
  function constructLazyBaseSchema(getter) {
964
1105
  return {
965
- parse: async (raw) => (await getMemoizedSchema(getter)).parse(raw),
966
- json: async (parsed) => (await getMemoizedSchema(getter)).json(parsed)
1106
+ parse: async (raw, opts) => (await getMemoizedSchema(getter)).parse(raw, opts),
1107
+ json: async (parsed, opts) => (await getMemoizedSchema(getter)).json(parsed, opts),
1108
+ getType: async () => (await getMemoizedSchema(getter)).getType()
967
1109
  };
968
1110
  }
969
1111
  async function getMemoizedSchema(getter) {
@@ -1006,6 +1148,28 @@ var init_filterObject = __esm({
1006
1148
  }
1007
1149
  });
1008
1150
 
1151
+ // src/core/schemas/utils/isPlainObject.ts
1152
+ function isPlainObject(value) {
1153
+ if (typeof value !== "object" || value === null) {
1154
+ return false;
1155
+ }
1156
+ if (Object.getPrototypeOf(value) === null) {
1157
+ return true;
1158
+ }
1159
+ let proto = value;
1160
+ while (Object.getPrototypeOf(proto) !== null) {
1161
+ proto = Object.getPrototypeOf(proto);
1162
+ }
1163
+ return Object.getPrototypeOf(value) === proto;
1164
+ }
1165
+ var NOT_AN_OBJECT_ERROR_MESSAGE;
1166
+ var init_isPlainObject = __esm({
1167
+ "src/core/schemas/utils/isPlainObject.ts"() {
1168
+ "use strict";
1169
+ NOT_AN_OBJECT_ERROR_MESSAGE = "Not an object";
1170
+ }
1171
+ });
1172
+
1009
1173
  // src/core/schemas/utils/keys.ts
1010
1174
  function keys(object2) {
1011
1175
  return Object.keys(object2);
@@ -1034,53 +1198,56 @@ var init_partition = __esm({
1034
1198
  }
1035
1199
  });
1036
1200
 
1037
- // src/core/schemas/builders/object-like/types.ts
1038
- var OBJECT_LIKE_BRAND;
1039
- var init_types6 = __esm({
1040
- "src/core/schemas/builders/object-like/types.ts"() {
1041
- "use strict";
1042
- OBJECT_LIKE_BRAND = void 0;
1043
- }
1044
- });
1045
-
1046
1201
  // src/core/schemas/builders/object-like/getObjectLikeUtils.ts
1047
1202
  function getObjectLikeUtils(schema) {
1048
1203
  return {
1049
- withProperties: (properties) => withProperties(schema, properties)
1204
+ withParsedProperties: (properties) => withParsedProperties(schema, properties)
1050
1205
  };
1051
1206
  }
1052
- function withProperties(objectLike, properties) {
1207
+ function withParsedProperties(objectLike, properties) {
1053
1208
  const objectSchema = {
1054
- ...OBJECT_LIKE_BRAND,
1055
1209
  parse: async (raw, opts) => {
1056
1210
  const parsedObject = await objectLike.parse(raw, opts);
1211
+ if (!parsedObject.ok) {
1212
+ return parsedObject;
1213
+ }
1057
1214
  const additionalProperties = Object.entries(properties).reduce(
1058
1215
  (processed, [key, value]) => {
1059
1216
  return {
1060
1217
  ...processed,
1061
- [key]: typeof value === "function" ? value(parsedObject) : value
1218
+ [key]: typeof value === "function" ? value(parsedObject.value) : value
1062
1219
  };
1063
1220
  },
1064
1221
  {}
1065
1222
  );
1066
1223
  return {
1067
- ...parsedObject,
1068
- ...additionalProperties
1224
+ ok: true,
1225
+ value: {
1226
+ ...parsedObject.value,
1227
+ ...additionalProperties
1228
+ }
1069
1229
  };
1070
1230
  },
1071
1231
  json: (parsed, opts) => {
1232
+ if (!isPlainObject(parsed)) {
1233
+ return {
1234
+ ok: false,
1235
+ errors: [
1236
+ {
1237
+ path: [],
1238
+ message: NOT_AN_OBJECT_ERROR_MESSAGE
1239
+ }
1240
+ ]
1241
+ };
1242
+ }
1072
1243
  const addedPropertyKeys = new Set(Object.keys(properties));
1073
- const parsedWithoutAddedProperties = Object.entries(parsed).reduce(
1074
- (filtered, [key, value]) => {
1075
- if (!addedPropertyKeys.has(key)) {
1076
- filtered[key] = value;
1077
- }
1078
- return filtered;
1079
- },
1080
- {}
1244
+ const parsedWithoutAddedProperties = filterObject(
1245
+ parsed,
1246
+ Object.keys(parsed).filter((key) => !addedPropertyKeys.has(key))
1081
1247
  );
1082
1248
  return objectLike.json(parsedWithoutAddedProperties, opts);
1083
- }
1249
+ },
1250
+ getType: () => objectLike.getType()
1084
1251
  };
1085
1252
  return {
1086
1253
  ...objectSchema,
@@ -1091,8 +1258,9 @@ function withProperties(objectLike, properties) {
1091
1258
  var init_getObjectLikeUtils = __esm({
1092
1259
  "src/core/schemas/builders/object-like/getObjectLikeUtils.ts"() {
1093
1260
  "use strict";
1261
+ init_filterObject();
1262
+ init_isPlainObject();
1094
1263
  init_schema_utils();
1095
- init_types6();
1096
1264
  }
1097
1265
  });
1098
1266
 
@@ -1101,7 +1269,6 @@ var init_object_like = __esm({
1101
1269
  "src/core/schemas/builders/object-like/index.ts"() {
1102
1270
  "use strict";
1103
1271
  init_getObjectLikeUtils();
1104
- init_types6();
1105
1272
  }
1106
1273
  });
1107
1274
 
@@ -1125,54 +1292,76 @@ var init_property = __esm({
1125
1292
  // src/core/schemas/builders/object/object.ts
1126
1293
  function object(schemas) {
1127
1294
  const baseSchema = {
1128
- ...OBJECT_LIKE_BRAND,
1129
1295
  _getRawProperties: () => Promise.resolve(
1130
1296
  Object.entries(schemas).map(
1131
1297
  ([parsedKey, propertySchema]) => isProperty(propertySchema) ? propertySchema.rawKey : parsedKey
1132
1298
  )
1133
1299
  ),
1134
1300
  _getParsedProperties: () => Promise.resolve(keys(schemas)),
1135
- parse: async (raw, { skipUnknownKeysOnParse = false } = {}) => {
1301
+ parse: async (raw, opts) => {
1136
1302
  const rawKeyToProperty = {};
1303
+ const requiredKeys = [];
1137
1304
  for (const [parsedKey, schemaOrObjectProperty] of entries(schemas)) {
1138
1305
  const rawKey = isProperty(schemaOrObjectProperty) ? schemaOrObjectProperty.rawKey : parsedKey;
1306
+ const valueSchema = isProperty(schemaOrObjectProperty) ? schemaOrObjectProperty.valueSchema : schemaOrObjectProperty;
1139
1307
  const property2 = {
1140
1308
  rawKey,
1141
1309
  parsedKey,
1142
- valueSchema: isProperty(schemaOrObjectProperty) ? schemaOrObjectProperty.valueSchema : schemaOrObjectProperty
1310
+ valueSchema
1143
1311
  };
1144
1312
  rawKeyToProperty[rawKey] = property2;
1145
- }
1146
- const parsed = {};
1147
- for (const [rawKey, rawPropertyValue] of Object.entries(raw)) {
1148
- const property2 = rawKeyToProperty[rawKey];
1149
- if (property2 != null) {
1150
- const value = await property2.valueSchema.parse(rawPropertyValue);
1151
- parsed[property2.parsedKey] = value;
1152
- } else if (!skipUnknownKeysOnParse && rawPropertyValue != null) {
1153
- parsed[rawKey] = rawPropertyValue;
1313
+ if (await valueSchema.getType() !== "optional") {
1314
+ requiredKeys.push(rawKey);
1154
1315
  }
1155
1316
  }
1156
- return parsed;
1317
+ return validateAndTransformObject({
1318
+ value: raw,
1319
+ requiredKeys,
1320
+ getProperty: (rawKey) => {
1321
+ const property2 = rawKeyToProperty[rawKey];
1322
+ if (property2 == null) {
1323
+ return void 0;
1324
+ }
1325
+ return {
1326
+ transformedKey: property2.parsedKey,
1327
+ transform: (propertyValue) => property2.valueSchema.parse(propertyValue, opts)
1328
+ };
1329
+ },
1330
+ allowUnknownKeys: (opts == null ? void 0 : opts.allowUnknownKeys) ?? false
1331
+ });
1157
1332
  },
1158
- json: async (parsed, { includeUnknownKeysOnJson = false } = {}) => {
1159
- const raw = {};
1160
- for (const [parsedKey, parsedPropertyValue] of entries(parsed)) {
1161
- const schemaOrObjectProperty = schemas[parsedKey];
1162
- if (schemaOrObjectProperty != null) {
1163
- if (isProperty(schemaOrObjectProperty)) {
1164
- const value = await schemaOrObjectProperty.valueSchema.json(parsedPropertyValue);
1165
- raw[schemaOrObjectProperty.rawKey] = value;
1333
+ json: async (parsed, opts) => {
1334
+ const requiredKeys = [];
1335
+ for (const [parsedKey, schemaOrObjectProperty] of entries(schemas)) {
1336
+ const valueSchema = isProperty(schemaOrObjectProperty) ? schemaOrObjectProperty.valueSchema : schemaOrObjectProperty;
1337
+ if (await valueSchema.getType() !== "optional") {
1338
+ requiredKeys.push(parsedKey);
1339
+ }
1340
+ }
1341
+ return validateAndTransformObject({
1342
+ value: parsed,
1343
+ requiredKeys,
1344
+ getProperty: (parsedKey) => {
1345
+ const property2 = schemas[parsedKey];
1346
+ if (property2 == null) {
1347
+ return void 0;
1348
+ }
1349
+ if (isProperty(property2)) {
1350
+ return {
1351
+ transformedKey: property2.rawKey,
1352
+ transform: (propertyValue) => property2.valueSchema.json(propertyValue, opts)
1353
+ };
1166
1354
  } else {
1167
- const value = await schemaOrObjectProperty.json(parsedPropertyValue);
1168
- raw[parsedKey] = value;
1355
+ return {
1356
+ transformedKey: parsedKey,
1357
+ transform: (propertyValue) => property2.json(propertyValue, opts)
1358
+ };
1169
1359
  }
1170
- } else if (includeUnknownKeysOnJson && parsedPropertyValue != null) {
1171
- raw[parsedKey] = parsedPropertyValue;
1172
- }
1173
- }
1174
- return raw;
1175
- }
1360
+ },
1361
+ allowUnknownKeys: (opts == null ? void 0 : opts.allowUnknownKeys) ?? false
1362
+ });
1363
+ },
1364
+ getType: () => SchemaType.OBJECT
1176
1365
  };
1177
1366
  return {
1178
1367
  ...baseSchema,
@@ -1181,11 +1370,72 @@ function object(schemas) {
1181
1370
  ...getObjectUtils(baseSchema)
1182
1371
  };
1183
1372
  }
1373
+ async function validateAndTransformObject({
1374
+ value,
1375
+ requiredKeys,
1376
+ getProperty,
1377
+ allowUnknownKeys
1378
+ }) {
1379
+ if (!isPlainObject(value)) {
1380
+ return {
1381
+ ok: false,
1382
+ errors: [
1383
+ {
1384
+ path: [],
1385
+ message: NOT_AN_OBJECT_ERROR_MESSAGE
1386
+ }
1387
+ ]
1388
+ };
1389
+ }
1390
+ const missingRequiredKeys = new Set(requiredKeys);
1391
+ const errors = [];
1392
+ const transformed = {};
1393
+ for (const [preTransformedKey, preTransformedItemValue] of Object.entries(value)) {
1394
+ const property2 = getProperty(preTransformedKey);
1395
+ if (property2 != null) {
1396
+ missingRequiredKeys.delete(preTransformedKey);
1397
+ const value2 = await property2.transform(preTransformedItemValue);
1398
+ if (value2.ok) {
1399
+ transformed[property2.transformedKey] = value2.value;
1400
+ } else {
1401
+ errors.push(
1402
+ ...value2.errors.map((error) => ({
1403
+ path: [preTransformedKey, ...error.path],
1404
+ message: error.message
1405
+ }))
1406
+ );
1407
+ }
1408
+ } else if (allowUnknownKeys) {
1409
+ transformed[preTransformedKey] = preTransformedItemValue;
1410
+ } else {
1411
+ errors.push({
1412
+ path: [preTransformedKey],
1413
+ message: `Unrecognized key "${preTransformedKey}"`
1414
+ });
1415
+ }
1416
+ }
1417
+ errors.push(
1418
+ ...requiredKeys.filter((key) => missingRequiredKeys.has(key)).map((key) => ({
1419
+ path: [],
1420
+ message: `Missing required key "${key}"`
1421
+ }))
1422
+ );
1423
+ if (errors.length === 0) {
1424
+ return {
1425
+ ok: true,
1426
+ value: transformed
1427
+ };
1428
+ } else {
1429
+ return {
1430
+ ok: false,
1431
+ errors
1432
+ };
1433
+ }
1434
+ }
1184
1435
  function getObjectUtils(schema) {
1185
1436
  return {
1186
1437
  extend: (extension) => {
1187
1438
  const baseSchema = {
1188
- ...OBJECT_LIKE_BRAND,
1189
1439
  _getParsedProperties: async () => [
1190
1440
  ...await schema._getParsedProperties(),
1191
1441
  ...await extension._getParsedProperties()
@@ -1195,27 +1445,22 @@ function getObjectUtils(schema) {
1195
1445
  ...await extension._getRawProperties()
1196
1446
  ],
1197
1447
  parse: async (raw, opts) => {
1198
- const rawExtensionPropertiesSet = new Set(await extension._getRawProperties());
1199
- const [extensionProperties, otherProperties] = partition(
1200
- keys(raw),
1201
- (key) => rawExtensionPropertiesSet.has(key)
1202
- );
1203
- return {
1204
- ...await schema.parse(filterObject(raw, otherProperties), opts),
1205
- ...await extension.parse(filterObject(raw, extensionProperties), opts)
1206
- };
1448
+ return validateAndTransformExtendedObject({
1449
+ extensionKeys: await extension._getRawProperties(),
1450
+ value: raw,
1451
+ transformBase: (rawBase) => schema.parse(rawBase, opts),
1452
+ transformExtension: (rawExtension) => extension.parse(rawExtension, opts)
1453
+ });
1207
1454
  },
1208
1455
  json: async (parsed, opts) => {
1209
- const parsedExtensionPropertiesSet = new Set(await extension._getParsedProperties());
1210
- const [extensionProperties, otherProperties] = partition(
1211
- keys(parsed),
1212
- (key) => parsedExtensionPropertiesSet.has(key)
1213
- );
1214
- return {
1215
- ...await schema.json(filterObject(parsed, otherProperties), opts),
1216
- ...await extension.json(filterObject(parsed, extensionProperties), opts)
1217
- };
1218
- }
1456
+ return validateAndTransformExtendedObject({
1457
+ extensionKeys: await extension._getParsedProperties(),
1458
+ value: parsed,
1459
+ transformBase: (parsedBase) => schema.json(parsedBase, opts),
1460
+ transformExtension: (parsedExtension) => extension.json(parsedExtension, opts)
1461
+ });
1462
+ },
1463
+ getType: () => SchemaType.OBJECT
1219
1464
  };
1220
1465
  return {
1221
1466
  ...baseSchema,
@@ -1226,11 +1471,44 @@ function getObjectUtils(schema) {
1226
1471
  }
1227
1472
  };
1228
1473
  }
1474
+ async function validateAndTransformExtendedObject({
1475
+ extensionKeys,
1476
+ value,
1477
+ transformBase,
1478
+ transformExtension
1479
+ }) {
1480
+ const extensionPropertiesSet = new Set(extensionKeys);
1481
+ const [extensionProperties, baseProperties] = partition(
1482
+ keys(value),
1483
+ (key) => extensionPropertiesSet.has(key)
1484
+ );
1485
+ const transformedBase = await transformBase(filterObject(value, baseProperties));
1486
+ const transformedExtension = await transformExtension(filterObject(value, extensionProperties));
1487
+ if (transformedBase.ok && transformedExtension.ok) {
1488
+ return {
1489
+ ok: true,
1490
+ value: {
1491
+ ...transformedBase.value,
1492
+ ...transformedExtension.value
1493
+ }
1494
+ };
1495
+ } else {
1496
+ return {
1497
+ ok: false,
1498
+ errors: [
1499
+ ...transformedBase.ok ? [] : transformedBase.errors,
1500
+ ...transformedExtension.ok ? [] : transformedExtension.errors
1501
+ ]
1502
+ };
1503
+ }
1504
+ }
1229
1505
  var init_object = __esm({
1230
1506
  "src/core/schemas/builders/object/object.ts"() {
1231
1507
  "use strict";
1508
+ init_Schema();
1232
1509
  init_entries();
1233
1510
  init_filterObject();
1511
+ init_isPlainObject();
1234
1512
  init_keys();
1235
1513
  init_partition();
1236
1514
  init_object_like();
@@ -1251,7 +1529,6 @@ var init_object2 = __esm({
1251
1529
  // src/core/schemas/builders/lazy/lazyObject.ts
1252
1530
  function lazyObject(getter) {
1253
1531
  const baseSchema = {
1254
- ...OBJECT_LIKE_BRAND,
1255
1532
  ...constructLazyBaseSchema(getter),
1256
1533
  _getRawProperties: async () => (await getMemoizedSchema(getter))._getRawProperties(),
1257
1534
  _getParsedProperties: async () => (await getMemoizedSchema(getter))._getParsedProperties()
@@ -1285,17 +1562,60 @@ var init_lazy2 = __esm({
1285
1562
  // src/core/schemas/builders/list/list.ts
1286
1563
  function list(schema) {
1287
1564
  const baseSchema = {
1288
- parse: (raw, opts) => Promise.all(raw.map((item) => schema.parse(item, opts))),
1289
- json: (parsed, opts) => Promise.all(parsed.map((item) => schema.json(item, opts)))
1565
+ parse: async (raw, opts) => validateAndTransformArray(raw, (item) => schema.parse(item, opts)),
1566
+ json: (parsed, opts) => validateAndTransformArray(parsed, (item) => schema.json(item, opts)),
1567
+ getType: () => SchemaType.LIST
1290
1568
  };
1291
1569
  return {
1292
1570
  ...baseSchema,
1293
1571
  ...getSchemaUtils(baseSchema)
1294
1572
  };
1295
1573
  }
1574
+ async function validateAndTransformArray(value, transformItem) {
1575
+ if (!Array.isArray(value)) {
1576
+ return {
1577
+ ok: false,
1578
+ errors: [
1579
+ {
1580
+ message: "Not a list",
1581
+ path: []
1582
+ }
1583
+ ]
1584
+ };
1585
+ }
1586
+ const maybeValidItems = await Promise.all(value.map((item) => transformItem(item)));
1587
+ return maybeValidItems.reduce(
1588
+ (acc, item, index) => {
1589
+ if (acc.ok && item.ok) {
1590
+ return {
1591
+ ok: true,
1592
+ value: [...acc.value, item.value]
1593
+ };
1594
+ }
1595
+ const errors = [];
1596
+ if (!acc.ok) {
1597
+ errors.push(...acc.errors);
1598
+ }
1599
+ if (!item.ok) {
1600
+ errors.push(
1601
+ ...item.errors.map((error) => ({
1602
+ path: [`[${index}]`, ...error.path],
1603
+ message: error.message
1604
+ }))
1605
+ );
1606
+ }
1607
+ return {
1608
+ ok: false,
1609
+ errors
1610
+ };
1611
+ },
1612
+ { ok: true, value: [] }
1613
+ );
1614
+ }
1296
1615
  var init_list = __esm({
1297
1616
  "src/core/schemas/builders/list/list.ts"() {
1298
1617
  "use strict";
1618
+ init_Schema();
1299
1619
  init_schema_utils();
1300
1620
  }
1301
1621
  });
@@ -1309,13 +1629,32 @@ var init_list2 = __esm({
1309
1629
  });
1310
1630
 
1311
1631
  // src/core/schemas/builders/literals/stringLiteral.ts
1312
- function stringLiteral(_value) {
1313
- return createIdentitySchemaCreator()();
1632
+ function stringLiteral(literal) {
1633
+ const schemaCreator = createIdentitySchemaCreator(SchemaType.STRING_LITERAL, (value) => {
1634
+ if (value === literal) {
1635
+ return {
1636
+ ok: true,
1637
+ value: literal
1638
+ };
1639
+ } else {
1640
+ return {
1641
+ ok: false,
1642
+ errors: [
1643
+ {
1644
+ path: [],
1645
+ message: `Not equal to "${literal}"`
1646
+ }
1647
+ ]
1648
+ };
1649
+ }
1650
+ });
1651
+ return schemaCreator();
1314
1652
  }
1315
1653
  var init_stringLiteral = __esm({
1316
1654
  "src/core/schemas/builders/literals/stringLiteral.ts"() {
1317
1655
  "use strict";
1318
- init_identity2();
1656
+ init_Schema();
1657
+ init_createIdentitySchemaCreator();
1319
1658
  }
1320
1659
  });
1321
1660
 
@@ -1332,8 +1671,9 @@ var any;
1332
1671
  var init_any = __esm({
1333
1672
  "src/core/schemas/builders/primitives/any.ts"() {
1334
1673
  "use strict";
1335
- init_identity2();
1336
- any = createIdentitySchemaCreator();
1674
+ init_Schema();
1675
+ init_createIdentitySchemaCreator();
1676
+ any = createIdentitySchemaCreator(SchemaType.ANY, (value) => ({ ok: true, value }));
1337
1677
  }
1338
1678
  });
1339
1679
 
@@ -1342,8 +1682,26 @@ var boolean;
1342
1682
  var init_boolean = __esm({
1343
1683
  "src/core/schemas/builders/primitives/boolean.ts"() {
1344
1684
  "use strict";
1345
- init_identity2();
1346
- boolean = createIdentitySchemaCreator();
1685
+ init_Schema();
1686
+ init_createIdentitySchemaCreator();
1687
+ boolean = createIdentitySchemaCreator(SchemaType.BOOLEAN, (value) => {
1688
+ if (typeof value === "boolean") {
1689
+ return {
1690
+ ok: true,
1691
+ value
1692
+ };
1693
+ } else {
1694
+ return {
1695
+ ok: false,
1696
+ errors: [
1697
+ {
1698
+ path: [],
1699
+ message: "Not a boolean"
1700
+ }
1701
+ ]
1702
+ };
1703
+ }
1704
+ });
1347
1705
  }
1348
1706
  });
1349
1707
 
@@ -1352,8 +1710,26 @@ var number;
1352
1710
  var init_number = __esm({
1353
1711
  "src/core/schemas/builders/primitives/number.ts"() {
1354
1712
  "use strict";
1355
- init_identity2();
1356
- number = createIdentitySchemaCreator();
1713
+ init_Schema();
1714
+ init_createIdentitySchemaCreator();
1715
+ number = createIdentitySchemaCreator(SchemaType.NUMBER, (value) => {
1716
+ if (typeof value === "number") {
1717
+ return {
1718
+ ok: true,
1719
+ value
1720
+ };
1721
+ } else {
1722
+ return {
1723
+ ok: false,
1724
+ errors: [
1725
+ {
1726
+ path: [],
1727
+ message: "Not a number"
1728
+ }
1729
+ ]
1730
+ };
1731
+ }
1732
+ });
1357
1733
  }
1358
1734
  });
1359
1735
 
@@ -1362,8 +1738,26 @@ var string;
1362
1738
  var init_string = __esm({
1363
1739
  "src/core/schemas/builders/primitives/string.ts"() {
1364
1740
  "use strict";
1365
- init_identity2();
1366
- string = createIdentitySchemaCreator();
1741
+ init_Schema();
1742
+ init_createIdentitySchemaCreator();
1743
+ string = createIdentitySchemaCreator(SchemaType.STRING, (value) => {
1744
+ if (typeof value === "string") {
1745
+ return {
1746
+ ok: true,
1747
+ value
1748
+ };
1749
+ } else {
1750
+ return {
1751
+ ok: false,
1752
+ errors: [
1753
+ {
1754
+ path: [],
1755
+ message: "Not a string"
1756
+ }
1757
+ ]
1758
+ };
1759
+ }
1760
+ });
1367
1761
  }
1368
1762
  });
1369
1763
 
@@ -1372,8 +1766,9 @@ var unknown;
1372
1766
  var init_unknown = __esm({
1373
1767
  "src/core/schemas/builders/primitives/unknown.ts"() {
1374
1768
  "use strict";
1375
- init_identity2();
1376
- unknown = createIdentitySchemaCreator();
1769
+ init_Schema();
1770
+ init_createIdentitySchemaCreator();
1771
+ unknown = createIdentitySchemaCreator(SchemaType.UNKNOWN, (value) => ({ ok: true, value }));
1377
1772
  }
1378
1773
  });
1379
1774
 
@@ -1392,32 +1787,104 @@ var init_primitives = __esm({
1392
1787
  // src/core/schemas/builders/record/record.ts
1393
1788
  function record(keySchema, valueSchema) {
1394
1789
  const baseSchema = {
1395
- parse: (raw, opts) => {
1396
- return entries(raw).reduce(async (parsedPromise, [key, value]) => {
1397
- const parsed = await parsedPromise;
1398
- const parsedKey = await keySchema.parse(key, opts);
1399
- parsed[parsedKey] = await valueSchema.parse(value, opts);
1400
- return parsedPromise;
1401
- }, Promise.resolve({}));
1790
+ parse: async (raw, opts) => {
1791
+ return validateAndTransformRecord({
1792
+ value: raw,
1793
+ isKeyNumeric: await keySchema.getType() === SchemaType.NUMBER,
1794
+ transformKey: (key) => keySchema.parse(key, opts),
1795
+ transformValue: (value) => valueSchema.parse(value, opts)
1796
+ });
1402
1797
  },
1403
- json: (parsed, opts) => {
1404
- return entries(parsed).reduce(async (rawPromise, [key, value]) => {
1405
- const raw = await rawPromise;
1406
- const rawKey = await keySchema.json(key, opts);
1407
- raw[rawKey] = await valueSchema.json(value, opts);
1408
- return rawPromise;
1409
- }, Promise.resolve({}));
1410
- }
1798
+ json: async (parsed, opts) => {
1799
+ return validateAndTransformRecord({
1800
+ value: parsed,
1801
+ isKeyNumeric: await keySchema.getType() === SchemaType.NUMBER,
1802
+ transformKey: (key) => keySchema.json(key, opts),
1803
+ transformValue: (value) => valueSchema.json(value, opts)
1804
+ });
1805
+ },
1806
+ getType: () => SchemaType.RECORD
1411
1807
  };
1412
1808
  return {
1413
1809
  ...baseSchema,
1414
1810
  ...getSchemaUtils(baseSchema)
1415
1811
  };
1416
1812
  }
1813
+ async function validateAndTransformRecord({
1814
+ value,
1815
+ isKeyNumeric,
1816
+ transformKey,
1817
+ transformValue
1818
+ }) {
1819
+ if (!isPlainObject(value)) {
1820
+ return {
1821
+ ok: false,
1822
+ errors: [
1823
+ {
1824
+ path: [],
1825
+ message: NOT_AN_OBJECT_ERROR_MESSAGE
1826
+ }
1827
+ ]
1828
+ };
1829
+ }
1830
+ return entries(value).reduce(
1831
+ async (accPromise, [stringKey, value2]) => {
1832
+ if (value2 == null) {
1833
+ return accPromise;
1834
+ }
1835
+ const acc = await accPromise;
1836
+ let key = stringKey;
1837
+ if (isKeyNumeric) {
1838
+ const numberKey = stringKey.length > 0 ? Number(stringKey) : NaN;
1839
+ if (!isNaN(numberKey)) {
1840
+ key = numberKey;
1841
+ }
1842
+ }
1843
+ const transformedKey = await transformKey(key);
1844
+ const transformedValue = await transformValue(value2);
1845
+ if (acc.ok && transformedKey.ok && transformedValue.ok) {
1846
+ return {
1847
+ ok: true,
1848
+ value: {
1849
+ ...acc.value,
1850
+ [transformedKey.value]: transformedValue.value
1851
+ }
1852
+ };
1853
+ }
1854
+ const errors = [];
1855
+ if (!acc.ok) {
1856
+ errors.push(...acc.errors);
1857
+ }
1858
+ if (!transformedKey.ok) {
1859
+ errors.push(
1860
+ ...transformedKey.errors.map((error) => ({
1861
+ path: [`${key} (key)`, ...error.path],
1862
+ message: error.message
1863
+ }))
1864
+ );
1865
+ }
1866
+ if (!transformedValue.ok) {
1867
+ errors.push(
1868
+ ...transformedValue.errors.map((error) => ({
1869
+ path: [stringKey, ...error.path],
1870
+ message: error.message
1871
+ }))
1872
+ );
1873
+ }
1874
+ return {
1875
+ ok: false,
1876
+ errors
1877
+ };
1878
+ },
1879
+ Promise.resolve({ ok: true, value: {} })
1880
+ );
1881
+ }
1417
1882
  var init_record = __esm({
1418
1883
  "src/core/schemas/builders/record/record.ts"() {
1419
1884
  "use strict";
1885
+ init_Schema();
1420
1886
  init_entries();
1887
+ init_isPlainObject();
1421
1888
  init_schema_utils();
1422
1889
  }
1423
1890
  });
@@ -1432,9 +1899,35 @@ var init_record2 = __esm({
1432
1899
 
1433
1900
  // src/core/schemas/builders/set/set.ts
1434
1901
  function set(schema) {
1902
+ const listSchema = list(schema);
1435
1903
  const baseSchema = {
1436
- parse: async (raw, opts) => new Set(await Promise.all(raw.map((item) => schema.parse(item, opts)))),
1437
- json: (parsed, opts) => Promise.all([...parsed].map((item) => schema.json(item, opts)))
1904
+ parse: async (raw, opts) => {
1905
+ const parsedList = await listSchema.parse(raw, opts);
1906
+ if (parsedList.ok) {
1907
+ return {
1908
+ ok: true,
1909
+ value: new Set(parsedList.value)
1910
+ };
1911
+ } else {
1912
+ return parsedList;
1913
+ }
1914
+ },
1915
+ json: async (parsed, opts) => {
1916
+ if (!(parsed instanceof Set)) {
1917
+ return {
1918
+ ok: false,
1919
+ errors: [
1920
+ {
1921
+ path: [],
1922
+ message: "Not a Set"
1923
+ }
1924
+ ]
1925
+ };
1926
+ }
1927
+ const jsonList = await listSchema.json([...parsed], opts);
1928
+ return jsonList;
1929
+ },
1930
+ getType: () => SchemaType.SET
1438
1931
  };
1439
1932
  return {
1440
1933
  ...baseSchema,
@@ -1444,6 +1937,8 @@ function set(schema) {
1444
1937
  var init_set = __esm({
1445
1938
  "src/core/schemas/builders/set/set.ts"() {
1446
1939
  "use strict";
1940
+ init_Schema();
1941
+ init_list2();
1447
1942
  init_schema_utils();
1448
1943
  }
1449
1944
  });
@@ -1473,36 +1968,31 @@ var init_discriminant = __esm({
1473
1968
  function union(discriminant2, union2) {
1474
1969
  const rawDiscriminant = typeof discriminant2 === "string" ? discriminant2 : discriminant2.rawDiscriminant;
1475
1970
  const parsedDiscriminant = typeof discriminant2 === "string" ? discriminant2 : discriminant2.parsedDiscriminant;
1971
+ const discriminantValueSchema = enum_(keys(union2));
1476
1972
  const baseSchema = {
1477
- ...OBJECT_LIKE_BRAND,
1478
1973
  parse: async (raw, opts) => {
1479
- const { [rawDiscriminant]: discriminantValue, ...additionalProperties } = raw;
1480
- const additionalPropertySchemas = union2[discriminantValue];
1481
- if (additionalPropertySchemas == null) {
1482
- return {
1483
- ...additionalProperties,
1484
- [parsedDiscriminant]: discriminantValue
1485
- };
1486
- }
1487
- return {
1488
- ...await additionalPropertySchemas.parse(additionalProperties, opts),
1489
- [parsedDiscriminant]: discriminantValue
1490
- };
1974
+ return transformAndValidateUnion(
1975
+ raw,
1976
+ rawDiscriminant,
1977
+ parsedDiscriminant,
1978
+ (discriminantValue) => discriminantValueSchema.parse(discriminantValue, opts),
1979
+ (discriminantValue) => union2[discriminantValue],
1980
+ (opts == null ? void 0 : opts.allowUnknownKeys) ?? false,
1981
+ (additionalProperties, additionalPropertiesSchema) => additionalPropertiesSchema.parse(additionalProperties, opts)
1982
+ );
1491
1983
  },
1492
1984
  json: async (parsed, opts) => {
1493
- const { [parsedDiscriminant]: discriminantValue, ...additionalProperties } = parsed;
1494
- const additionalPropertySchemas = union2[discriminantValue];
1495
- if (additionalPropertySchemas == null) {
1496
- return {
1497
- ...additionalProperties,
1498
- [rawDiscriminant]: discriminantValue
1499
- };
1500
- }
1501
- return {
1502
- ...await additionalPropertySchemas.json(additionalProperties, opts),
1503
- [rawDiscriminant]: discriminantValue
1504
- };
1505
- }
1985
+ return transformAndValidateUnion(
1986
+ parsed,
1987
+ parsedDiscriminant,
1988
+ rawDiscriminant,
1989
+ (discriminantValue) => discriminantValueSchema.json(discriminantValue, opts),
1990
+ (discriminantValue) => union2[discriminantValue],
1991
+ (opts == null ? void 0 : opts.allowUnknownKeys) ?? false,
1992
+ (additionalProperties, additionalPropertiesSchema) => additionalPropertiesSchema.json(additionalProperties, opts)
1993
+ );
1994
+ },
1995
+ getType: () => SchemaType.UNION
1506
1996
  };
1507
1997
  return {
1508
1998
  ...baseSchema,
@@ -1510,9 +2000,84 @@ function union(discriminant2, union2) {
1510
2000
  ...getObjectLikeUtils(baseSchema)
1511
2001
  };
1512
2002
  }
2003
+ async function transformAndValidateUnion(value, discriminant2, transformedDiscriminant, transformDiscriminantValue, getAdditionalPropertiesSchema, allowUnknownKeys, transformAdditionalProperties) {
2004
+ if (!isPlainObject(value)) {
2005
+ return {
2006
+ ok: false,
2007
+ errors: [
2008
+ {
2009
+ path: [],
2010
+ message: NOT_AN_OBJECT_ERROR_MESSAGE
2011
+ }
2012
+ ]
2013
+ };
2014
+ }
2015
+ const { [discriminant2]: discriminantValue, ...additionalProperties } = value;
2016
+ if (discriminantValue == null) {
2017
+ return {
2018
+ ok: false,
2019
+ errors: [
2020
+ {
2021
+ path: [],
2022
+ message: `Missing discriminant ("${discriminant2}")`
2023
+ }
2024
+ ]
2025
+ };
2026
+ }
2027
+ const transformedDiscriminantValue = await transformDiscriminantValue(discriminantValue);
2028
+ if (!transformedDiscriminantValue.ok) {
2029
+ return {
2030
+ ok: false,
2031
+ errors: transformedDiscriminantValue.errors.map((error) => ({
2032
+ path: [discriminant2, ...error.path],
2033
+ message: error.message
2034
+ }))
2035
+ };
2036
+ }
2037
+ const additionalPropertiesSchema = getAdditionalPropertiesSchema(transformedDiscriminantValue.value);
2038
+ if (additionalPropertiesSchema == null) {
2039
+ if (allowUnknownKeys) {
2040
+ return {
2041
+ ok: true,
2042
+ value: {
2043
+ [transformedDiscriminant]: transformedDiscriminantValue.value,
2044
+ ...additionalProperties
2045
+ }
2046
+ };
2047
+ } else {
2048
+ return {
2049
+ ok: false,
2050
+ errors: [
2051
+ {
2052
+ path: [discriminant2],
2053
+ message: "Unrecognized discriminant value"
2054
+ }
2055
+ ]
2056
+ };
2057
+ }
2058
+ }
2059
+ const transformedAdditionalProperties = await transformAdditionalProperties(
2060
+ additionalProperties,
2061
+ additionalPropertiesSchema
2062
+ );
2063
+ if (!transformedAdditionalProperties.ok) {
2064
+ return transformedAdditionalProperties;
2065
+ }
2066
+ return {
2067
+ ok: true,
2068
+ value: {
2069
+ [transformedDiscriminant]: discriminantValue,
2070
+ ...transformedAdditionalProperties.value
2071
+ }
2072
+ };
2073
+ }
1513
2074
  var init_union = __esm({
1514
2075
  "src/core/schemas/builders/union/union.ts"() {
1515
2076
  "use strict";
2077
+ init_Schema();
2078
+ init_isPlainObject();
2079
+ init_keys();
2080
+ init_enum2();
1516
2081
  init_object_like();
1517
2082
  init_schema_utils();
1518
2083
  }
@@ -1533,7 +2098,6 @@ var init_builders = __esm({
1533
2098
  "use strict";
1534
2099
  init_date2();
1535
2100
  init_enum2();
1536
- init_identity2();
1537
2101
  init_lazy2();
1538
2102
  init_list2();
1539
2103
  init_literals();
@@ -1550,18 +2114,16 @@ var init_builders = __esm({
1550
2114
  // src/core/schemas/index.ts
1551
2115
  var schemas_exports = {};
1552
2116
  __export(schemas_exports, {
1553
- OBJECT_LIKE_BRAND: () => OBJECT_LIKE_BRAND,
1554
- OPTIONAL_BRAND: () => OPTIONAL_BRAND,
2117
+ JsonError: () => JsonError,
2118
+ ParseError: () => ParseError,
1555
2119
  any: () => any,
1556
2120
  boolean: () => boolean,
1557
- createIdentitySchemaCreator: () => createIdentitySchemaCreator,
1558
2121
  date: () => date,
1559
2122
  discriminant: () => discriminant,
1560
2123
  enum_: () => enum_,
1561
2124
  getObjectLikeUtils: () => getObjectLikeUtils,
1562
2125
  getObjectUtils: () => getObjectUtils,
1563
2126
  getSchemaUtils: () => getSchemaUtils,
1564
- identity: () => identity,
1565
2127
  isProperty: () => isProperty,
1566
2128
  lazy: () => lazy,
1567
2129
  lazyObject: () => lazyObject,
@@ -1577,12 +2139,13 @@ __export(schemas_exports, {
1577
2139
  transform: () => transform,
1578
2140
  union: () => union,
1579
2141
  unknown: () => unknown,
1580
- withProperties: () => withProperties
2142
+ withParsedProperties: () => withParsedProperties
1581
2143
  });
1582
2144
  var init_schemas = __esm({
1583
2145
  "src/core/schemas/index.ts"() {
1584
2146
  "use strict";
1585
2147
  init_builders();
2148
+ init_Schema();
1586
2149
  }
1587
2150
  });
1588
2151
 
@@ -1792,7 +2355,7 @@ var require_utils = __commonJS({
1792
2355
  function isObject(val) {
1793
2356
  return val !== null && typeof val === "object";
1794
2357
  }
1795
- function isPlainObject(val) {
2358
+ function isPlainObject2(val) {
1796
2359
  if (kindOf(val) !== "object") {
1797
2360
  return false;
1798
2361
  }
@@ -1845,9 +2408,9 @@ var require_utils = __commonJS({
1845
2408
  function merge() {
1846
2409
  var result = {};
1847
2410
  function assignValue(val, key) {
1848
- if (isPlainObject(result[key]) && isPlainObject(val)) {
2411
+ if (isPlainObject2(result[key]) && isPlainObject2(val)) {
1849
2412
  result[key] = merge(result[key], val);
1850
- } else if (isPlainObject(val)) {
2413
+ } else if (isPlainObject2(val)) {
1851
2414
  result[key] = merge({}, val);
1852
2415
  } else if (isArray(val)) {
1853
2416
  result[key] = val.slice();
@@ -1936,7 +2499,7 @@ var require_utils = __commonJS({
1936
2499
  isString,
1937
2500
  isNumber,
1938
2501
  isObject,
1939
- isPlainObject,
2502
+ isPlainObject: isPlainObject2,
1940
2503
  isUndefined,
1941
2504
  isDate,
1942
2505
  isFile,
@@ -13473,7 +14036,7 @@ var init_Fetcher = __esm({
13473
14036
  transitional: {
13474
14037
  clarifyTimeoutError: true
13475
14038
  },
13476
- withCredentials: true
14039
+ withCredentials: args.withCredentials
13477
14040
  });
13478
14041
  let body;
13479
14042
  if (response.data != null && response.data.length > 0) {
@@ -13501,7 +14064,6 @@ var init_Fetcher = __esm({
13501
14064
  error: {
13502
14065
  reason: "status-code",
13503
14066
  statusCode: response.status,
13504
- rawBody: response.data,
13505
14067
  body
13506
14068
  }
13507
14069
  };
@@ -13636,8 +14198,8 @@ var init_OrganizationId2 = __esm({
13636
14198
  init_src();
13637
14199
  init_core();
13638
14200
  OrganizationId2 = schemas_exports.string().transform({
13639
- parse: api_exports.OrganizationId,
13640
- json: (value) => value
14201
+ transform: api_exports.OrganizationId,
14202
+ untransform: (value) => value
13641
14203
  });
13642
14204
  }
13643
14205
  });
@@ -13650,14 +14212,14 @@ var init_UserId2 = __esm({
13650
14212
  init_src();
13651
14213
  init_core();
13652
14214
  UserId2 = schemas_exports.string().transform({
13653
- parse: api_exports.UserId,
13654
- json: (value) => value
14215
+ transform: api_exports.UserId,
14216
+ untransform: (value) => value
13655
14217
  });
13656
14218
  }
13657
14219
  });
13658
14220
 
13659
14221
  // src/serialization/resources/commons/types/index.ts
13660
- var init_types7 = __esm({
14222
+ var init_types5 = __esm({
13661
14223
  "src/serialization/resources/commons/types/index.ts"() {
13662
14224
  "use strict";
13663
14225
  init_OrganizationId2();
@@ -13674,7 +14236,7 @@ __export(commons_exports2, {
13674
14236
  var init_commons2 = __esm({
13675
14237
  "src/serialization/resources/commons/index.ts"() {
13676
14238
  "use strict";
13677
- init_types7();
14239
+ init_types5();
13678
14240
  }
13679
14241
  });
13680
14242
 
@@ -13692,7 +14254,7 @@ var init_Organization2 = __esm({
13692
14254
  });
13693
14255
 
13694
14256
  // src/serialization/resources/organization/types/index.ts
13695
- var init_types8 = __esm({
14257
+ var init_types6 = __esm({
13696
14258
  "src/serialization/resources/organization/types/index.ts"() {
13697
14259
  "use strict";
13698
14260
  init_Organization2();
@@ -13702,24 +14264,19 @@ var init_types8 = __esm({
13702
14264
  // src/serialization/resources/organization/client/create.ts
13703
14265
  var create_exports2 = {};
13704
14266
  __export(create_exports2, {
13705
- Error: () => Error13,
13706
- Request: () => Request
14267
+ Error: () => Error13
13707
14268
  });
13708
- var Request, Error13;
14269
+ var Error13;
13709
14270
  var init_create2 = __esm({
13710
14271
  "src/serialization/resources/organization/client/create.ts"() {
13711
14272
  "use strict";
13712
14273
  init_src();
13713
14274
  init_core();
13714
- Request = schemas_exports.object({
13715
- organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
13716
- artifactReadRequiresToken: schemas_exports.boolean().optional()
13717
- });
13718
14275
  Error13 = schemas_exports.union("error", {
13719
14276
  UnauthorizedError: schemas_exports.object({}),
13720
14277
  OrganizationAlreadyExistsError: schemas_exports.object({})
13721
14278
  }).transform({
13722
- parse: (value) => {
14279
+ transform: (value) => {
13723
14280
  switch (value.error) {
13724
14281
  case "UnauthorizedError":
13725
14282
  return api_exports.organization.create.Error.unauthorizedError();
@@ -13727,7 +14284,7 @@ var init_create2 = __esm({
13727
14284
  return api_exports.organization.create.Error.organizationAlreadyExistsError();
13728
14285
  }
13729
14286
  },
13730
- json: (value) => value
14287
+ untransform: ({ _visit, ...value }) => value
13731
14288
  });
13732
14289
  }
13733
14290
  });
@@ -13735,28 +14292,24 @@ var init_create2 = __esm({
13735
14292
  // src/serialization/resources/organization/client/update.ts
13736
14293
  var update_exports2 = {};
13737
14294
  __export(update_exports2, {
13738
- Error: () => Error14,
13739
- Request: () => Request2
14295
+ Error: () => Error14
13740
14296
  });
13741
- var Request2, Error14;
14297
+ var Error14;
13742
14298
  var init_update2 = __esm({
13743
14299
  "src/serialization/resources/organization/client/update.ts"() {
13744
14300
  "use strict";
13745
14301
  init_src();
13746
14302
  init_core();
13747
- Request2 = schemas_exports.object({
13748
- artifactReadRequiresToken: schemas_exports.boolean()
13749
- });
13750
14303
  Error14 = schemas_exports.union("error", {
13751
14304
  UnauthorizedError: schemas_exports.object({})
13752
14305
  }).transform({
13753
- parse: (value) => {
14306
+ transform: (value) => {
13754
14307
  switch (value.error) {
13755
14308
  case "UnauthorizedError":
13756
14309
  return api_exports.organization.update.Error.unauthorizedError();
13757
14310
  }
13758
14311
  },
13759
- json: (value) => value
14312
+ untransform: ({ _visit, ...value }) => value
13760
14313
  });
13761
14314
  }
13762
14315
  });
@@ -13764,26 +14317,24 @@ var init_update2 = __esm({
13764
14317
  // src/serialization/resources/organization/client/get.ts
13765
14318
  var get_exports2 = {};
13766
14319
  __export(get_exports2, {
13767
- Error: () => Error15,
13768
- Response: () => Response
14320
+ Error: () => Error15
13769
14321
  });
13770
- var Response, Error15;
14322
+ var Error15;
13771
14323
  var init_get2 = __esm({
13772
14324
  "src/serialization/resources/organization/client/get.ts"() {
13773
14325
  "use strict";
13774
14326
  init_src();
13775
14327
  init_core();
13776
- Response = schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).Organization);
13777
14328
  Error15 = schemas_exports.union("error", {
13778
14329
  UnauthorizedError: schemas_exports.object({})
13779
14330
  }).transform({
13780
- parse: (value) => {
14331
+ transform: (value) => {
13781
14332
  switch (value.error) {
13782
14333
  case "UnauthorizedError":
13783
14334
  return api_exports.organization.get.Error.unauthorizedError();
13784
14335
  }
13785
14336
  },
13786
- json: (value) => value
14337
+ untransform: ({ _visit, ...value }) => value
13787
14338
  });
13788
14339
  }
13789
14340
  });
@@ -13791,40 +14342,38 @@ var init_get2 = __esm({
13791
14342
  // src/serialization/resources/organization/client/isMember.ts
13792
14343
  var isMember_exports2 = {};
13793
14344
  __export(isMember_exports2, {
13794
- Response: () => Response2
14345
+ Response: () => Response
13795
14346
  });
13796
- var Response2;
14347
+ var Response;
13797
14348
  var init_isMember2 = __esm({
13798
14349
  "src/serialization/resources/organization/client/isMember.ts"() {
13799
14350
  "use strict";
13800
14351
  init_core();
13801
- Response2 = schemas_exports.boolean();
14352
+ Response = schemas_exports.boolean();
13802
14353
  }
13803
14354
  });
13804
14355
 
13805
14356
  // src/serialization/resources/organization/client/getMyOrganizationFromScopedToken.ts
13806
14357
  var getMyOrganizationFromScopedToken_exports2 = {};
13807
14358
  __export(getMyOrganizationFromScopedToken_exports2, {
13808
- Error: () => Error16,
13809
- Response: () => Response3
14359
+ Error: () => Error16
13810
14360
  });
13811
- var Response3, Error16;
14361
+ var Error16;
13812
14362
  var init_getMyOrganizationFromScopedToken2 = __esm({
13813
14363
  "src/serialization/resources/organization/client/getMyOrganizationFromScopedToken.ts"() {
13814
14364
  "use strict";
13815
14365
  init_src();
13816
14366
  init_core();
13817
- Response3 = schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).Organization);
13818
14367
  Error16 = schemas_exports.union("error", {
13819
14368
  UnauthorizedError: schemas_exports.object({})
13820
14369
  }).transform({
13821
- parse: (value) => {
14370
+ transform: (value) => {
13822
14371
  switch (value.error) {
13823
14372
  case "UnauthorizedError":
13824
14373
  return api_exports.organization.getMyOrganizationFromScopedToken.Error.unauthorizedError();
13825
14374
  }
13826
14375
  },
13827
- json: (value) => value
14376
+ untransform: ({ _visit, ...value }) => value
13828
14377
  });
13829
14378
  }
13830
14379
  });
@@ -13832,24 +14381,19 @@ var init_getMyOrganizationFromScopedToken2 = __esm({
13832
14381
  // src/serialization/resources/organization/client/addUser.ts
13833
14382
  var addUser_exports2 = {};
13834
14383
  __export(addUser_exports2, {
13835
- Error: () => Error17,
13836
- Request: () => Request3
14384
+ Error: () => Error17
13837
14385
  });
13838
- var Request3, Error17;
14386
+ var Error17;
13839
14387
  var init_addUser2 = __esm({
13840
14388
  "src/serialization/resources/organization/client/addUser.ts"() {
13841
14389
  "use strict";
13842
14390
  init_src();
13843
14391
  init_core();
13844
- Request3 = schemas_exports.object({
13845
- userId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).UserId),
13846
- orgId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId)
13847
- });
13848
14392
  Error17 = schemas_exports.union("error", {
13849
14393
  UnauthorizedError: schemas_exports.object({}),
13850
14394
  UserIdDoesNotExistError: schemas_exports.object({})
13851
14395
  }).transform({
13852
- parse: (value) => {
14396
+ transform: (value) => {
13853
14397
  switch (value.error) {
13854
14398
  case "UnauthorizedError":
13855
14399
  return api_exports.organization.addUser.Error.unauthorizedError();
@@ -13857,11 +14401,59 @@ var init_addUser2 = __esm({
13857
14401
  return api_exports.organization.addUser.Error.userIdDoesNotExistError();
13858
14402
  }
13859
14403
  },
13860
- json: (value) => value
14404
+ untransform: ({ _visit, ...value }) => value
14405
+ });
14406
+ }
14407
+ });
14408
+
14409
+ // src/serialization/resources/organization/client/requests/CreateOrganizationRequest.ts
14410
+ var CreateOrganizationRequest;
14411
+ var init_CreateOrganizationRequest = __esm({
14412
+ "src/serialization/resources/organization/client/requests/CreateOrganizationRequest.ts"() {
14413
+ "use strict";
14414
+ init_core();
14415
+ CreateOrganizationRequest = schemas_exports.object({
14416
+ organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
14417
+ artifactReadRequiresToken: schemas_exports.boolean().optional()
14418
+ });
14419
+ }
14420
+ });
14421
+
14422
+ // src/serialization/resources/organization/client/requests/UpdateOrganizationRequest.ts
14423
+ var UpdateOrganizationRequest;
14424
+ var init_UpdateOrganizationRequest = __esm({
14425
+ "src/serialization/resources/organization/client/requests/UpdateOrganizationRequest.ts"() {
14426
+ "use strict";
14427
+ init_core();
14428
+ UpdateOrganizationRequest = schemas_exports.object({
14429
+ artifactReadRequiresToken: schemas_exports.boolean()
14430
+ });
14431
+ }
14432
+ });
14433
+
14434
+ // src/serialization/resources/organization/client/requests/AddUserToOrgRequest.ts
14435
+ var AddUserToOrgRequest;
14436
+ var init_AddUserToOrgRequest = __esm({
14437
+ "src/serialization/resources/organization/client/requests/AddUserToOrgRequest.ts"() {
14438
+ "use strict";
14439
+ init_core();
14440
+ AddUserToOrgRequest = schemas_exports.object({
14441
+ userId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).UserId),
14442
+ orgId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId)
13861
14443
  });
13862
14444
  }
13863
14445
  });
13864
14446
 
14447
+ // src/serialization/resources/organization/client/requests/index.ts
14448
+ var init_requests4 = __esm({
14449
+ "src/serialization/resources/organization/client/requests/index.ts"() {
14450
+ "use strict";
14451
+ init_CreateOrganizationRequest();
14452
+ init_UpdateOrganizationRequest();
14453
+ init_AddUserToOrgRequest();
14454
+ }
14455
+ });
14456
+
13865
14457
  // src/serialization/resources/organization/client/index.ts
13866
14458
  var init_client4 = __esm({
13867
14459
  "src/serialization/resources/organization/client/index.ts"() {
@@ -13872,13 +14464,17 @@ var init_client4 = __esm({
13872
14464
  init_isMember2();
13873
14465
  init_getMyOrganizationFromScopedToken2();
13874
14466
  init_addUser2();
14467
+ init_requests4();
13875
14468
  }
13876
14469
  });
13877
14470
 
13878
14471
  // src/serialization/resources/organization/index.ts
13879
14472
  var organization_exports2 = {};
13880
14473
  __export(organization_exports2, {
14474
+ AddUserToOrgRequest: () => AddUserToOrgRequest,
14475
+ CreateOrganizationRequest: () => CreateOrganizationRequest,
13881
14476
  Organization: () => Organization,
14477
+ UpdateOrganizationRequest: () => UpdateOrganizationRequest,
13882
14478
  addUser: () => addUser_exports2,
13883
14479
  create: () => create_exports2,
13884
14480
  get: () => get_exports2,
@@ -13889,7 +14485,7 @@ __export(organization_exports2, {
13889
14485
  var init_organization2 = __esm({
13890
14486
  "src/serialization/resources/organization/index.ts"() {
13891
14487
  "use strict";
13892
- init_types8();
14488
+ init_types6();
13893
14489
  init_client4();
13894
14490
  }
13895
14491
  });
@@ -13943,7 +14539,7 @@ var init_RegistryToken2 = __esm({
13943
14539
  npm: schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).NpmRegistryToken),
13944
14540
  maven: schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).MavenRegistryToken)
13945
14541
  }).transform({
13946
- parse: (value) => {
14542
+ transform: (value) => {
13947
14543
  switch (value.type) {
13948
14544
  case "npm":
13949
14545
  return api_exports.RegistryToken.npm(value);
@@ -13953,13 +14549,13 @@ var init_RegistryToken2 = __esm({
13953
14549
  return api_exports.RegistryToken._unknown(value);
13954
14550
  }
13955
14551
  },
13956
- json: (value) => value
14552
+ untransform: ({ _visit, ...value }) => value
13957
14553
  });
13958
14554
  }
13959
14555
  });
13960
14556
 
13961
14557
  // src/serialization/resources/registry/types/index.ts
13962
- var init_types9 = __esm({
14558
+ var init_types7 = __esm({
13963
14559
  "src/serialization/resources/registry/types/index.ts"() {
13964
14560
  "use strict";
13965
14561
  init_RegistryTokens2();
@@ -13972,25 +14568,19 @@ var init_types9 = __esm({
13972
14568
  // src/serialization/resources/registry/client/generateRegistryTokens.ts
13973
14569
  var generateRegistryTokens_exports2 = {};
13974
14570
  __export(generateRegistryTokens_exports2, {
13975
- Error: () => Error18,
13976
- Request: () => Request4,
13977
- Response: () => Response4
14571
+ Error: () => Error18
13978
14572
  });
13979
- var Request4, Response4, Error18;
14573
+ var Error18;
13980
14574
  var init_generateRegistryTokens2 = __esm({
13981
14575
  "src/serialization/resources/registry/client/generateRegistryTokens.ts"() {
13982
14576
  "use strict";
13983
14577
  init_src();
13984
14578
  init_core();
13985
- Request4 = schemas_exports.object({
13986
- organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId)
13987
- });
13988
- Response4 = schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).RegistryTokens);
13989
14579
  Error18 = schemas_exports.union("error", {
13990
14580
  UnauthorizedError: schemas_exports.object({}),
13991
14581
  OrganizationNotFoundError: schemas_exports.object({})
13992
14582
  }).transform({
13993
- parse: (value) => {
14583
+ transform: (value) => {
13994
14584
  switch (value.error) {
13995
14585
  case "UnauthorizedError":
13996
14586
  return api_exports.registry.generateRegistryTokens.Error.unauthorizedError();
@@ -13998,7 +14588,7 @@ var init_generateRegistryTokens2 = __esm({
13998
14588
  return api_exports.registry.generateRegistryTokens.Error.organizationNotFoundError();
13999
14589
  }
14000
14590
  },
14001
- json: (value) => value
14591
+ untransform: ({ _visit, ...value }) => value
14002
14592
  });
14003
14593
  }
14004
14594
  });
@@ -14007,25 +14597,20 @@ var init_generateRegistryTokens2 = __esm({
14007
14597
  var hasRegistryPermission_exports2 = {};
14008
14598
  __export(hasRegistryPermission_exports2, {
14009
14599
  Error: () => Error19,
14010
- Request: () => Request5,
14011
- Response: () => Response5
14600
+ Response: () => Response2
14012
14601
  });
14013
- var Request5, Response5, Error19;
14602
+ var Response2, Error19;
14014
14603
  var init_hasRegistryPermission2 = __esm({
14015
14604
  "src/serialization/resources/registry/client/hasRegistryPermission.ts"() {
14016
14605
  "use strict";
14017
- init_src();
14018
14606
  init_core();
14019
- Request5 = schemas_exports.object({
14020
- organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
14021
- token: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).RegistryToken).optional()
14022
- });
14023
- Response5 = schemas_exports.boolean();
14607
+ init_src();
14608
+ Response2 = schemas_exports.boolean();
14024
14609
  Error19 = schemas_exports.union("error", {
14025
14610
  UnauthorizedError: schemas_exports.object({}),
14026
14611
  OrganizationNotFoundError: schemas_exports.object({})
14027
14612
  }).transform({
14028
- parse: (value) => {
14613
+ transform: (value) => {
14029
14614
  switch (value.error) {
14030
14615
  case "UnauthorizedError":
14031
14616
  return api_exports.registry.hasRegistryPermission.Error.unauthorizedError();
@@ -14033,7 +14618,7 @@ var init_hasRegistryPermission2 = __esm({
14033
14618
  return api_exports.registry.hasRegistryPermission.Error.organizationNotFoundError();
14034
14619
  }
14035
14620
  },
14036
- json: (value) => value
14621
+ untransform: ({ _visit, ...value }) => value
14037
14622
  });
14038
14623
  }
14039
14624
  });
@@ -14041,24 +14626,19 @@ var init_hasRegistryPermission2 = __esm({
14041
14626
  // src/serialization/resources/registry/client/revokeToken.ts
14042
14627
  var revokeToken_exports2 = {};
14043
14628
  __export(revokeToken_exports2, {
14044
- Error: () => Error20,
14045
- Request: () => Request6
14629
+ Error: () => Error20
14046
14630
  });
14047
- var Request6, Error20;
14631
+ var Error20;
14048
14632
  var init_revokeToken2 = __esm({
14049
14633
  "src/serialization/resources/registry/client/revokeToken.ts"() {
14050
14634
  "use strict";
14051
14635
  init_src();
14052
14636
  init_core();
14053
- Request6 = schemas_exports.object({
14054
- organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
14055
- token: schemas_exports.string()
14056
- });
14057
14637
  Error20 = schemas_exports.union("error", {
14058
14638
  UnauthorizedError: schemas_exports.object({}),
14059
14639
  OrganizationNotFoundError: schemas_exports.object({})
14060
14640
  }).transform({
14061
- parse: (value) => {
14641
+ transform: (value) => {
14062
14642
  switch (value.error) {
14063
14643
  case "UnauthorizedError":
14064
14644
  return api_exports.registry.revokeToken.Error.unauthorizedError();
@@ -14066,11 +14646,59 @@ var init_revokeToken2 = __esm({
14066
14646
  return api_exports.registry.revokeToken.Error.organizationNotFoundError();
14067
14647
  }
14068
14648
  },
14069
- json: (value) => value
14649
+ untransform: ({ _visit, ...value }) => value
14070
14650
  });
14071
14651
  }
14072
14652
  });
14073
14653
 
14654
+ // src/serialization/resources/registry/client/requests/GenerateRegistryTokensRequest.ts
14655
+ var GenerateRegistryTokensRequest;
14656
+ var init_GenerateRegistryTokensRequest = __esm({
14657
+ "src/serialization/resources/registry/client/requests/GenerateRegistryTokensRequest.ts"() {
14658
+ "use strict";
14659
+ init_core();
14660
+ GenerateRegistryTokensRequest = schemas_exports.object({
14661
+ organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId)
14662
+ });
14663
+ }
14664
+ });
14665
+
14666
+ // src/serialization/resources/registry/client/requests/CheckRegistryPermissionRequest.ts
14667
+ var CheckRegistryPermissionRequest;
14668
+ var init_CheckRegistryPermissionRequest = __esm({
14669
+ "src/serialization/resources/registry/client/requests/CheckRegistryPermissionRequest.ts"() {
14670
+ "use strict";
14671
+ init_core();
14672
+ CheckRegistryPermissionRequest = schemas_exports.object({
14673
+ organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
14674
+ token: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).RegistryToken).optional()
14675
+ });
14676
+ }
14677
+ });
14678
+
14679
+ // src/serialization/resources/registry/client/requests/RevokeTokenRequest.ts
14680
+ var RevokeTokenRequest;
14681
+ var init_RevokeTokenRequest = __esm({
14682
+ "src/serialization/resources/registry/client/requests/RevokeTokenRequest.ts"() {
14683
+ "use strict";
14684
+ init_core();
14685
+ RevokeTokenRequest = schemas_exports.object({
14686
+ organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
14687
+ token: schemas_exports.string()
14688
+ });
14689
+ }
14690
+ });
14691
+
14692
+ // src/serialization/resources/registry/client/requests/index.ts
14693
+ var init_requests5 = __esm({
14694
+ "src/serialization/resources/registry/client/requests/index.ts"() {
14695
+ "use strict";
14696
+ init_GenerateRegistryTokensRequest();
14697
+ init_CheckRegistryPermissionRequest();
14698
+ init_RevokeTokenRequest();
14699
+ }
14700
+ });
14701
+
14074
14702
  // src/serialization/resources/registry/client/index.ts
14075
14703
  var init_client5 = __esm({
14076
14704
  "src/serialization/resources/registry/client/index.ts"() {
@@ -14078,16 +14706,20 @@ var init_client5 = __esm({
14078
14706
  init_generateRegistryTokens2();
14079
14707
  init_hasRegistryPermission2();
14080
14708
  init_revokeToken2();
14709
+ init_requests5();
14081
14710
  }
14082
14711
  });
14083
14712
 
14084
14713
  // src/serialization/resources/registry/index.ts
14085
14714
  var registry_exports2 = {};
14086
14715
  __export(registry_exports2, {
14716
+ CheckRegistryPermissionRequest: () => CheckRegistryPermissionRequest,
14717
+ GenerateRegistryTokensRequest: () => GenerateRegistryTokensRequest,
14087
14718
  MavenRegistryToken: () => MavenRegistryToken,
14088
14719
  NpmRegistryToken: () => NpmRegistryToken,
14089
14720
  RegistryToken: () => RegistryToken2,
14090
14721
  RegistryTokens: () => RegistryTokens,
14722
+ RevokeTokenRequest: () => RevokeTokenRequest,
14091
14723
  generateRegistryTokens: () => generateRegistryTokens_exports2,
14092
14724
  hasRegistryPermission: () => hasRegistryPermission_exports2,
14093
14725
  revokeToken: () => revokeToken_exports2
@@ -14095,7 +14727,7 @@ __export(registry_exports2, {
14095
14727
  var init_registry2 = __esm({
14096
14728
  "src/serialization/resources/registry/index.ts"() {
14097
14729
  "use strict";
14098
- init_types9();
14730
+ init_types7();
14099
14731
  init_client5();
14100
14732
  }
14101
14733
  });
@@ -14133,7 +14765,7 @@ var init_OrganizationsPage2 = __esm({
14133
14765
  });
14134
14766
 
14135
14767
  // src/serialization/resources/user/types/index.ts
14136
- var init_types10 = __esm({
14768
+ var init_types8 = __esm({
14137
14769
  "src/serialization/resources/user/types/index.ts"() {
14138
14770
  "use strict";
14139
14771
  init_User2();
@@ -14141,56 +14773,16 @@ var init_types10 = __esm({
14141
14773
  }
14142
14774
  });
14143
14775
 
14144
- // src/serialization/resources/user/client/getMyself.ts
14145
- var getMyself_exports2 = {};
14146
- __export(getMyself_exports2, {
14147
- Response: () => Response6
14148
- });
14149
- var Response6;
14150
- var init_getMyself2 = __esm({
14151
- "src/serialization/resources/user/client/getMyself.ts"() {
14152
- "use strict";
14153
- init_core();
14154
- Response6 = schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).User);
14155
- }
14156
- });
14157
-
14158
- // src/serialization/resources/user/client/getMyOrganizations.ts
14159
- var getMyOrganizations_exports2 = {};
14160
- __export(getMyOrganizations_exports2, {
14161
- Response: () => Response7
14162
- });
14163
- var Response7;
14164
- var init_getMyOrganizations2 = __esm({
14165
- "src/serialization/resources/user/client/getMyOrganizations.ts"() {
14166
- "use strict";
14167
- init_core();
14168
- Response7 = schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationsPage);
14169
- }
14170
- });
14171
-
14172
- // src/serialization/resources/user/client/index.ts
14173
- var init_client6 = __esm({
14174
- "src/serialization/resources/user/client/index.ts"() {
14175
- "use strict";
14176
- init_getMyself2();
14177
- init_getMyOrganizations2();
14178
- }
14179
- });
14180
-
14181
14776
  // src/serialization/resources/user/index.ts
14182
14777
  var user_exports2 = {};
14183
14778
  __export(user_exports2, {
14184
14779
  OrganizationsPage: () => OrganizationsPage,
14185
- User: () => User,
14186
- getMyOrganizations: () => getMyOrganizations_exports2,
14187
- getMyself: () => getMyself_exports2
14780
+ User: () => User
14188
14781
  });
14189
14782
  var init_user2 = __esm({
14190
14783
  "src/serialization/resources/user/index.ts"() {
14191
14784
  "use strict";
14192
- init_types10();
14193
- init_client6();
14785
+ init_types8();
14194
14786
  }
14195
14787
  });
14196
14788
 
@@ -14199,19 +14791,25 @@ var init_resources2 = __esm({
14199
14791
  "src/serialization/resources/index.ts"() {
14200
14792
  "use strict";
14201
14793
  init_commons2();
14202
- init_types7();
14794
+ init_types5();
14203
14795
  init_organization2();
14204
- init_types8();
14796
+ init_types6();
14205
14797
  init_registry2();
14206
- init_types9();
14798
+ init_types7();
14207
14799
  init_user2();
14208
- init_types10();
14800
+ init_types8();
14801
+ init_requests4();
14802
+ init_requests5();
14209
14803
  }
14210
14804
  });
14211
14805
 
14212
14806
  // src/serialization/index.ts
14213
14807
  var serialization_exports = {};
14214
14808
  __export(serialization_exports, {
14809
+ AddUserToOrgRequest: () => AddUserToOrgRequest,
14810
+ CheckRegistryPermissionRequest: () => CheckRegistryPermissionRequest,
14811
+ CreateOrganizationRequest: () => CreateOrganizationRequest,
14812
+ GenerateRegistryTokensRequest: () => GenerateRegistryTokensRequest,
14215
14813
  MavenRegistryToken: () => MavenRegistryToken,
14216
14814
  NpmRegistryToken: () => NpmRegistryToken,
14217
14815
  Organization: () => Organization,
@@ -14219,6 +14817,8 @@ __export(serialization_exports, {
14219
14817
  OrganizationsPage: () => OrganizationsPage,
14220
14818
  RegistryToken: () => RegistryToken2,
14221
14819
  RegistryTokens: () => RegistryTokens,
14820
+ RevokeTokenRequest: () => RevokeTokenRequest,
14821
+ UpdateOrganizationRequest: () => UpdateOrganizationRequest,
14222
14822
  User: () => User,
14223
14823
  UserId: () => UserId2,
14224
14824
  commons: () => commons_exports2,
@@ -14254,10 +14854,7 @@ var init_Client = __esm({
14254
14854
  headers: {
14255
14855
  Authorization: BearerToken.toAuthorizationHeader(await Supplier.get(this.options.token))
14256
14856
  },
14257
- body: await organization_exports2.create.Request.json({
14258
- organizationId: request.organizationId,
14259
- artifactReadRequiresToken: request.artifactReadRequiresToken
14260
- })
14857
+ body: await CreateOrganizationRequest.jsonOrThrow(request)
14261
14858
  });
14262
14859
  if (_response.ok) {
14263
14860
  return {
@@ -14271,8 +14868,9 @@ var init_Client = __esm({
14271
14868
  case "OrganizationAlreadyExistsError":
14272
14869
  return {
14273
14870
  ok: false,
14274
- error: await organization_exports2.create.Error.parse(
14275
- _response.error.body
14871
+ error: await organization_exports2.create.Error.parseOrThrow(
14872
+ _response.error.body,
14873
+ { allowUnknownKeys: true }
14276
14874
  )
14277
14875
  };
14278
14876
  }
@@ -14285,14 +14883,15 @@ var init_Client = __esm({
14285
14883
  async update(orgId, request) {
14286
14884
  var _a;
14287
14885
  const _response = await fetcher({
14288
- url: (0, import_url_join.default)(this.options.environment, `/organizations/${orgId}/update`),
14886
+ url: (0, import_url_join.default)(
14887
+ this.options.environment,
14888
+ `/organizations/${await OrganizationId2.jsonOrThrow(orgId)}/update`
14889
+ ),
14289
14890
  method: "POST",
14290
14891
  headers: {
14291
14892
  Authorization: BearerToken.toAuthorizationHeader(await Supplier.get(this.options.token))
14292
14893
  },
14293
- body: await organization_exports2.update.Request.json({
14294
- artifactReadRequiresToken: request.artifactReadRequiresToken
14295
- })
14894
+ body: await UpdateOrganizationRequest.jsonOrThrow(request)
14296
14895
  });
14297
14896
  if (_response.ok) {
14298
14897
  return {
@@ -14305,8 +14904,9 @@ var init_Client = __esm({
14305
14904
  case "UnauthorizedError":
14306
14905
  return {
14307
14906
  ok: false,
14308
- error: await organization_exports2.update.Error.parse(
14309
- _response.error.body
14907
+ error: await organization_exports2.update.Error.parseOrThrow(
14908
+ _response.error.body,
14909
+ { allowUnknownKeys: true }
14310
14910
  )
14311
14911
  };
14312
14912
  }
@@ -14319,7 +14919,10 @@ var init_Client = __esm({
14319
14919
  async get(orgId) {
14320
14920
  var _a;
14321
14921
  const _response = await fetcher({
14322
- url: (0, import_url_join.default)(this.options.environment, `/organizations/${orgId}`),
14922
+ url: (0, import_url_join.default)(
14923
+ this.options.environment,
14924
+ `/organizations/${await OrganizationId2.jsonOrThrow(orgId)}`
14925
+ ),
14323
14926
  method: "GET",
14324
14927
  headers: {
14325
14928
  Authorization: BearerToken.toAuthorizationHeader(await Supplier.get(this.options.token))
@@ -14328,9 +14931,9 @@ var init_Client = __esm({
14328
14931
  if (_response.ok) {
14329
14932
  return {
14330
14933
  ok: true,
14331
- body: await organization_exports2.get.Response.parse(
14332
- _response.body
14333
- )
14934
+ body: await Organization.parseOrThrow(_response.body, {
14935
+ allowUnknownKeys: true
14936
+ })
14334
14937
  };
14335
14938
  }
14336
14939
  if (_response.error.reason === "status-code") {
@@ -14338,8 +14941,9 @@ var init_Client = __esm({
14338
14941
  case "UnauthorizedError":
14339
14942
  return {
14340
14943
  ok: false,
14341
- error: await organization_exports2.get.Error.parse(
14342
- _response.error.body
14944
+ error: await organization_exports2.get.Error.parseOrThrow(
14945
+ _response.error.body,
14946
+ { allowUnknownKeys: true }
14343
14947
  )
14344
14948
  };
14345
14949
  }
@@ -14351,7 +14955,10 @@ var init_Client = __esm({
14351
14955
  }
14352
14956
  async isMember(organizationId) {
14353
14957
  const _response = await fetcher({
14354
- url: (0, import_url_join.default)(this.options.environment, `/organizations/belongs-to-organization/${organizationId}`),
14958
+ url: (0, import_url_join.default)(
14959
+ this.options.environment,
14960
+ `/organizations/belongs-to-organization/${await OrganizationId2.jsonOrThrow(organizationId)}`
14961
+ ),
14355
14962
  method: "POST",
14356
14963
  headers: {
14357
14964
  Authorization: BearerToken.toAuthorizationHeader(await Supplier.get(this.options.token))
@@ -14360,8 +14967,9 @@ var init_Client = __esm({
14360
14967
  if (_response.ok) {
14361
14968
  return {
14362
14969
  ok: true,
14363
- body: await organization_exports2.isMember.Response.parse(
14364
- _response.body
14970
+ body: await organization_exports2.isMember.Response.parseOrThrow(
14971
+ _response.body,
14972
+ { allowUnknownKeys: true }
14365
14973
  )
14366
14974
  };
14367
14975
  }
@@ -14385,9 +14993,9 @@ var init_Client = __esm({
14385
14993
  if (_response.ok) {
14386
14994
  return {
14387
14995
  ok: true,
14388
- body: await organization_exports2.getMyOrganizationFromScopedToken.Response.parse(
14389
- _response.body
14390
- )
14996
+ body: await Organization.parseOrThrow(_response.body, {
14997
+ allowUnknownKeys: true
14998
+ })
14391
14999
  };
14392
15000
  }
14393
15001
  if (_response.error.reason === "status-code") {
@@ -14395,8 +15003,9 @@ var init_Client = __esm({
14395
15003
  case "UnauthorizedError":
14396
15004
  return {
14397
15005
  ok: false,
14398
- error: await organization_exports2.getMyOrganizationFromScopedToken.Error.parse(
14399
- _response.error.body
15006
+ error: await organization_exports2.getMyOrganizationFromScopedToken.Error.parseOrThrow(
15007
+ _response.error.body,
15008
+ { allowUnknownKeys: true }
14400
15009
  )
14401
15010
  };
14402
15011
  }
@@ -14414,10 +15023,7 @@ var init_Client = __esm({
14414
15023
  headers: {
14415
15024
  Authorization: BearerToken.toAuthorizationHeader(await Supplier.get(this.options.token))
14416
15025
  },
14417
- body: await organization_exports2.addUser.Request.json({
14418
- userId: request.userId,
14419
- orgId: request.orgId
14420
- })
15026
+ body: await AddUserToOrgRequest.jsonOrThrow(request)
14421
15027
  });
14422
15028
  if (_response.ok) {
14423
15029
  return {
@@ -14431,8 +15037,9 @@ var init_Client = __esm({
14431
15037
  case "UserIdDoesNotExistError":
14432
15038
  return {
14433
15039
  ok: false,
14434
- error: await organization_exports2.addUser.Error.parse(
14435
- _response.error.body
15040
+ error: await organization_exports2.addUser.Error.parseOrThrow(
15041
+ _response.error.body,
15042
+ { allowUnknownKeys: true }
14436
15043
  )
14437
15044
  };
14438
15045
  }
@@ -14467,16 +15074,14 @@ var init_Client2 = __esm({
14467
15074
  headers: {
14468
15075
  Authorization: BearerToken.toAuthorizationHeader(await Supplier.get(this.options.token))
14469
15076
  },
14470
- body: await registry_exports2.generateRegistryTokens.Request.json({
14471
- organizationId: request.organizationId
14472
- })
15077
+ body: await GenerateRegistryTokensRequest.jsonOrThrow(request)
14473
15078
  });
14474
15079
  if (_response.ok) {
14475
15080
  return {
14476
15081
  ok: true,
14477
- body: await registry_exports2.generateRegistryTokens.Response.parse(
14478
- _response.body
14479
- )
15082
+ body: await RegistryTokens.parseOrThrow(_response.body, {
15083
+ allowUnknownKeys: true
15084
+ })
14480
15085
  };
14481
15086
  }
14482
15087
  if (_response.error.reason === "status-code") {
@@ -14485,8 +15090,9 @@ var init_Client2 = __esm({
14485
15090
  case "OrganizationNotFoundError":
14486
15091
  return {
14487
15092
  ok: false,
14488
- error: await registry_exports2.generateRegistryTokens.Error.parse(
14489
- _response.error.body
15093
+ error: await registry_exports2.generateRegistryTokens.Error.parseOrThrow(
15094
+ _response.error.body,
15095
+ { allowUnknownKeys: true }
14490
15096
  )
14491
15097
  };
14492
15098
  }
@@ -14504,16 +15110,14 @@ var init_Client2 = __esm({
14504
15110
  headers: {
14505
15111
  Authorization: BearerToken.toAuthorizationHeader(await Supplier.get(this.options.token))
14506
15112
  },
14507
- body: await registry_exports2.hasRegistryPermission.Request.json({
14508
- organizationId: request.organizationId,
14509
- token: request.token
14510
- })
15113
+ body: await CheckRegistryPermissionRequest.jsonOrThrow(request)
14511
15114
  });
14512
15115
  if (_response.ok) {
14513
15116
  return {
14514
15117
  ok: true,
14515
- body: await registry_exports2.hasRegistryPermission.Response.parse(
14516
- _response.body
15118
+ body: await registry_exports2.hasRegistryPermission.Response.parseOrThrow(
15119
+ _response.body,
15120
+ { allowUnknownKeys: true }
14517
15121
  )
14518
15122
  };
14519
15123
  }
@@ -14523,8 +15127,9 @@ var init_Client2 = __esm({
14523
15127
  case "OrganizationNotFoundError":
14524
15128
  return {
14525
15129
  ok: false,
14526
- error: await registry_exports2.hasRegistryPermission.Error.parse(
14527
- _response.error.body
15130
+ error: await registry_exports2.hasRegistryPermission.Error.parseOrThrow(
15131
+ _response.error.body,
15132
+ { allowUnknownKeys: true }
14528
15133
  )
14529
15134
  };
14530
15135
  }
@@ -14542,10 +15147,7 @@ var init_Client2 = __esm({
14542
15147
  headers: {
14543
15148
  Authorization: BearerToken.toAuthorizationHeader(await Supplier.get(this.options.token))
14544
15149
  },
14545
- body: await registry_exports2.revokeToken.Request.json({
14546
- organizationId: request.organizationId,
14547
- token: request.token
14548
- })
15150
+ body: await RevokeTokenRequest.jsonOrThrow(request)
14549
15151
  });
14550
15152
  if (_response.ok) {
14551
15153
  return {
@@ -14559,8 +15161,9 @@ var init_Client2 = __esm({
14559
15161
  case "OrganizationNotFoundError":
14560
15162
  return {
14561
15163
  ok: false,
14562
- error: await registry_exports2.revokeToken.Error.parse(
14563
- _response.error.body
15164
+ error: await registry_exports2.revokeToken.Error.parseOrThrow(
15165
+ _response.error.body,
15166
+ { allowUnknownKeys: true }
14564
15167
  )
14565
15168
  };
14566
15169
  }
@@ -14598,9 +15201,9 @@ var init_Client3 = __esm({
14598
15201
  if (_response.ok) {
14599
15202
  return {
14600
15203
  ok: true,
14601
- body: await user_exports2.getMyself.Response.parse(
14602
- _response.body
14603
- )
15204
+ body: await User.parseOrThrow(_response.body, {
15205
+ allowUnknownKeys: true
15206
+ })
14604
15207
  };
14605
15208
  }
14606
15209
  return {
@@ -14609,8 +15212,9 @@ var init_Client3 = __esm({
14609
15212
  };
14610
15213
  }
14611
15214
  async getMyOrganizations(request) {
15215
+ const { pageId } = request;
14612
15216
  const _queryParams = new URLSearchParams();
14613
- _queryParams.append("pageId", request.pageId.toString());
15217
+ _queryParams.append("pageId", pageId.toString());
14614
15218
  const _response = await fetcher({
14615
15219
  url: (0, import_url_join3.default)(this.options.environment, "/users/organizations"),
14616
15220
  method: "GET",
@@ -14622,8 +15226,9 @@ var init_Client3 = __esm({
14622
15226
  if (_response.ok) {
14623
15227
  return {
14624
15228
  ok: true,
14625
- body: await user_exports2.getMyOrganizations.Response.parse(
14626
- _response.body
15229
+ body: await OrganizationsPage.parseOrThrow(
15230
+ _response.body,
15231
+ { allowUnknownKeys: true }
14627
15232
  )
14628
15233
  };
14629
15234
  }