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