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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/core.d.ts +1 -0
  2. package/dist/browser/cjs/core.js +702 -167
  3. package/dist/browser/cjs/index.js +996 -391
  4. package/dist/browser/cjs/serialization.js +930 -329
  5. package/dist/browser/esm/core.js +702 -167
  6. package/dist/browser/esm/index.js +996 -391
  7. package/dist/browser/esm/serialization.js +936 -329
  8. package/dist/node/core.js +702 -167
  9. package/dist/node/index.js +996 -391
  10. package/dist/node/serialization.js +1002 -391
  11. package/package.json +2 -2
  12. package/serialization.d.ts +1 -0
  13. package/types/api/resources/organization/client/Client.d.ts +6 -6
  14. package/types/api/resources/organization/client/addUser.d.ts +0 -1
  15. package/types/api/resources/organization/client/create.d.ts +0 -1
  16. package/types/api/resources/organization/client/get.d.ts +0 -1
  17. package/types/api/resources/organization/client/getMyOrganizationFromScopedToken.d.ts +0 -1
  18. package/types/api/resources/organization/client/isMember.d.ts +0 -1
  19. package/types/api/resources/organization/client/update.d.ts +0 -1
  20. package/types/api/resources/registry/client/Client.d.ts +3 -3
  21. package/types/api/resources/registry/client/generateRegistryTokens.d.ts +0 -1
  22. package/types/api/resources/registry/client/hasRegistryPermission.d.ts +0 -1
  23. package/types/api/resources/registry/client/revokeToken.d.ts +0 -1
  24. package/types/api/resources/user/client/Client.d.ts +2 -2
  25. package/types/api/resources/user/client/getMyOrganizations.d.ts +0 -1
  26. package/types/api/resources/user/client/getMyself.d.ts +0 -1
  27. package/types/core/fetcher/Fetcher.d.ts +1 -1
  28. package/types/core/schemas/Schema.d.ts +35 -7
  29. package/types/core/schemas/builders/enum/enum.d.ts +1 -1
  30. package/types/core/schemas/builders/index.d.ts +0 -1
  31. package/types/core/schemas/builders/literals/stringLiteral.d.ts +1 -1
  32. package/types/core/schemas/builders/object/types.d.ts +5 -4
  33. package/types/core/schemas/builders/object-like/getObjectLikeUtils.d.ts +4 -3
  34. package/types/core/schemas/builders/object-like/index.d.ts +2 -2
  35. package/types/core/schemas/builders/object-like/types.d.ts +2 -8
  36. package/types/core/schemas/builders/primitives/any.d.ts +1 -1
  37. package/types/core/schemas/builders/primitives/boolean.d.ts +1 -1
  38. package/types/core/schemas/builders/primitives/number.d.ts +1 -1
  39. package/types/core/schemas/builders/primitives/string.d.ts +1 -1
  40. package/types/core/schemas/builders/primitives/unknown.d.ts +1 -1
  41. package/types/core/schemas/builders/record/index.d.ts +1 -0
  42. package/types/core/schemas/builders/record/record.d.ts +2 -1
  43. package/types/core/schemas/builders/record/types.d.ts +5 -0
  44. package/types/core/schemas/builders/schema-utils/JsonError.d.ts +5 -0
  45. package/types/core/schemas/builders/schema-utils/ParseError.d.ts +5 -0
  46. package/types/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +11 -6
  47. package/types/core/schemas/builders/schema-utils/index.d.ts +2 -1
  48. package/types/core/schemas/builders/schema-utils/stringifyValidationErrors.d.ts +2 -0
  49. package/types/core/schemas/utils/MaybePromise.d.ts +1 -0
  50. package/types/core/schemas/utils/OptionalRecord.d.ts +1 -0
  51. package/types/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +3 -3
  52. package/types/core/schemas/utils/createIdentitySchemaCreator.d.ts +2 -0
  53. package/types/core/schemas/utils/isPlainObject.d.ts +2 -0
  54. package/types/serialization/resources/index.d.ts +2 -0
  55. package/types/serialization/resources/organization/client/addUser.d.ts +0 -7
  56. package/types/serialization/resources/organization/client/create.d.ts +0 -7
  57. package/types/serialization/resources/organization/client/get.d.ts +0 -4
  58. package/types/serialization/resources/organization/client/getMyOrganizationFromScopedToken.d.ts +0 -4
  59. package/types/serialization/resources/organization/client/index.d.ts +1 -0
  60. package/types/serialization/resources/organization/client/requests/AddUserToOrgRequest.d.ts +13 -0
  61. package/types/serialization/resources/organization/client/requests/CreateOrganizationRequest.d.ts +13 -0
  62. package/types/serialization/resources/organization/client/requests/UpdateOrganizationRequest.d.ts +12 -0
  63. package/types/serialization/resources/organization/client/requests/index.d.ts +3 -0
  64. package/types/serialization/resources/organization/client/update.d.ts +0 -6
  65. package/types/serialization/resources/registry/client/generateRegistryTokens.d.ts +0 -10
  66. package/types/serialization/resources/registry/client/hasRegistryPermission.d.ts +1 -8
  67. package/types/serialization/resources/registry/client/index.d.ts +1 -0
  68. package/types/serialization/resources/registry/client/requests/CheckRegistryPermissionRequest.d.ts +13 -0
  69. package/types/serialization/resources/registry/client/requests/GenerateRegistryTokensRequest.d.ts +12 -0
  70. package/types/serialization/resources/registry/client/requests/RevokeTokenRequest.d.ts +13 -0
  71. package/types/serialization/resources/registry/client/requests/index.d.ts +3 -0
  72. package/types/serialization/resources/registry/client/revokeToken.d.ts +0 -7
  73. package/types/serialization/resources/user/index.d.ts +0 -1
  74. package/types/core/schemas/builders/identity/createIdentitySchemaCreator.d.ts +0 -2
  75. package/types/core/schemas/builders/identity/identity.d.ts +0 -2
  76. package/types/core/schemas/builders/identity/index.d.ts +0 -2
  77. package/types/core/schemas/builders/schema-utils/types.d.ts +0 -7
  78. package/types/serialization/resources/user/client/getMyOrganizations.d.ts +0 -10
  79. package/types/serialization/resources/user/client/getMyself.d.ts +0 -10
  80. package/types/serialization/resources/user/client/index.d.ts +0 -2
@@ -792,12 +792,72 @@ var init_api = __esm({
792
792
  }
793
793
  });
794
794
 
795
- // src/core/schemas/builders/schema-utils/types.ts
796
- var OPTIONAL_BRAND;
797
- var init_types5 = __esm({
798
- "src/core/schemas/builders/schema-utils/types.ts"() {
795
+ // src/core/schemas/Schema.ts
796
+ var SchemaType;
797
+ var init_Schema = __esm({
798
+ "src/core/schemas/Schema.ts"() {
799
+ "use strict";
800
+ SchemaType = {
801
+ DATE: "date",
802
+ ENUM: "enum",
803
+ LIST: "list",
804
+ STRING_LITERAL: "stringLiteral",
805
+ OBJECT: "object",
806
+ ANY: "any",
807
+ BOOLEAN: "boolean",
808
+ NUMBER: "number",
809
+ STRING: "string",
810
+ UNKNOWN: "unknown",
811
+ RECORD: "record",
812
+ SET: "set",
813
+ UNION: "union",
814
+ OPTIONAL: "optional"
815
+ };
816
+ }
817
+ });
818
+
819
+ // src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts
820
+ function stringifyValidationError(error) {
821
+ if (error.path.length === 0) {
822
+ return error.message;
823
+ }
824
+ return `${error.path.join(" -> ")}: ${error.message}`;
825
+ }
826
+ var init_stringifyValidationErrors = __esm({
827
+ "src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts"() {
828
+ "use strict";
829
+ }
830
+ });
831
+
832
+ // src/core/schemas/builders/schema-utils/JsonError.ts
833
+ var JsonError;
834
+ var init_JsonError = __esm({
835
+ "src/core/schemas/builders/schema-utils/JsonError.ts"() {
836
+ "use strict";
837
+ init_stringifyValidationErrors();
838
+ JsonError = class extends Error {
839
+ constructor(errors) {
840
+ super(errors.map(stringifyValidationError).join("; "));
841
+ this.errors = errors;
842
+ Object.setPrototypeOf(this, JsonError.prototype);
843
+ }
844
+ };
845
+ }
846
+ });
847
+
848
+ // src/core/schemas/builders/schema-utils/ParseError.ts
849
+ var ParseError;
850
+ var init_ParseError = __esm({
851
+ "src/core/schemas/builders/schema-utils/ParseError.ts"() {
799
852
  "use strict";
800
- OPTIONAL_BRAND = void 0;
853
+ init_stringifyValidationErrors();
854
+ ParseError = class extends Error {
855
+ constructor(errors) {
856
+ super(errors.map(stringifyValidationError).join("; "));
857
+ this.errors = errors;
858
+ Object.setPrototypeOf(this, ParseError.prototype);
859
+ }
860
+ };
801
861
  }
802
862
  });
803
863
 
@@ -805,16 +865,46 @@ var init_types5 = __esm({
805
865
  function getSchemaUtils(schema) {
806
866
  return {
807
867
  optional: () => optional(schema),
808
- transform: (transformer) => transform(schema, transformer)
868
+ transform: (transformer) => transform(schema, transformer),
869
+ parseOrThrow: async (raw, opts) => {
870
+ const parsed = await schema.parse(raw, opts);
871
+ if (parsed.ok) {
872
+ return parsed.value;
873
+ }
874
+ throw new ParseError(parsed.errors);
875
+ },
876
+ jsonOrThrow: async (parsed, opts) => {
877
+ const raw = await schema.json(parsed, opts);
878
+ if (raw.ok) {
879
+ return raw.value;
880
+ }
881
+ throw new JsonError(raw.errors);
882
+ }
809
883
  };
810
884
  }
811
885
  function optional(schema) {
812
886
  const baseSchema = {
813
- parse: (raw, opts) => raw != null ? schema.parse(raw, opts) : void 0,
814
- json: (parsed, opts) => parsed != null ? schema.json(parsed, opts) : void 0
887
+ parse: (raw, opts) => {
888
+ if (raw == null) {
889
+ return {
890
+ ok: true,
891
+ value: void 0
892
+ };
893
+ }
894
+ return schema.parse(raw, opts);
895
+ },
896
+ json: (parsed, opts) => {
897
+ if (parsed == null) {
898
+ return {
899
+ ok: true,
900
+ value: null
901
+ };
902
+ }
903
+ return schema.json(parsed, opts);
904
+ },
905
+ getType: () => SchemaType.OPTIONAL
815
906
  };
816
907
  return {
817
- ...OPTIONAL_BRAND,
818
908
  ...baseSchema,
819
909
  ...getSchemaUtils(baseSchema)
820
910
  };
@@ -822,13 +912,20 @@ function optional(schema) {
822
912
  function transform(schema, transformer) {
823
913
  const baseSchema = {
824
914
  parse: async (raw, opts) => {
825
- const postTransformParsed = await schema.parse(raw, opts);
826
- return transformer.parse(postTransformParsed, opts);
915
+ const parsed = await schema.parse(raw, opts);
916
+ if (!parsed.ok) {
917
+ return parsed;
918
+ }
919
+ return {
920
+ ok: true,
921
+ value: transformer.transform(parsed.value)
922
+ };
827
923
  },
828
- json: async (parsed, opts) => {
829
- const preTransformParsed = await transformer.json(parsed, opts);
830
- return schema.json(preTransformParsed, opts);
831
- }
924
+ json: async (transformed, opts) => {
925
+ const parsed = await transformer.untransform(transformed);
926
+ return schema.json(parsed, opts);
927
+ },
928
+ getType: () => schema.getType()
832
929
  };
833
930
  return {
834
931
  ...baseSchema,
@@ -838,7 +935,9 @@ function transform(schema, transformer) {
838
935
  var init_getSchemaUtils = __esm({
839
936
  "src/core/schemas/builders/schema-utils/getSchemaUtils.ts"() {
840
937
  "use strict";
841
- init_types5();
938
+ init_Schema();
939
+ init_JsonError();
940
+ init_ParseError();
842
941
  }
843
942
  });
844
943
 
@@ -847,25 +946,64 @@ var init_schema_utils = __esm({
847
946
  "src/core/schemas/builders/schema-utils/index.ts"() {
848
947
  "use strict";
849
948
  init_getSchemaUtils();
850
- init_types5();
949
+ init_JsonError();
950
+ init_ParseError();
851
951
  }
852
952
  });
853
953
 
854
954
  // src/core/schemas/builders/date/date.ts
855
955
  function date() {
856
956
  const baseSchema = {
857
- parse: (raw) => new Date(raw),
858
- json: (date2) => date2.toISOString()
957
+ parse: (raw) => {
958
+ if (typeof raw === "string" && ISO_8601_REGEX.test(raw)) {
959
+ return {
960
+ ok: true,
961
+ value: new Date(raw)
962
+ };
963
+ } else {
964
+ return {
965
+ ok: false,
966
+ errors: [
967
+ {
968
+ path: [],
969
+ message: "Not an ISO 8601 date string"
970
+ }
971
+ ]
972
+ };
973
+ }
974
+ },
975
+ json: (date2) => {
976
+ if (date2 instanceof Date) {
977
+ return {
978
+ ok: true,
979
+ value: date2.toISOString()
980
+ };
981
+ } else {
982
+ return {
983
+ ok: false,
984
+ errors: [
985
+ {
986
+ path: [],
987
+ message: "Not a Date object"
988
+ }
989
+ ]
990
+ };
991
+ }
992
+ },
993
+ getType: () => SchemaType.DATE
859
994
  };
860
995
  return {
861
996
  ...baseSchema,
862
997
  ...getSchemaUtils(baseSchema)
863
998
  };
864
999
  }
1000
+ var ISO_8601_REGEX;
865
1001
  var init_date = __esm({
866
1002
  "src/core/schemas/builders/date/date.ts"() {
867
1003
  "use strict";
1004
+ init_Schema();
868
1005
  init_schema_utils();
1006
+ ISO_8601_REGEX = /^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;
869
1007
  }
870
1008
  });
871
1009
 
@@ -877,52 +1015,55 @@ var init_date2 = __esm({
877
1015
  }
878
1016
  });
879
1017
 
880
- // src/core/schemas/builders/identity/identity.ts
881
- function identity() {
882
- const baseSchema = {
883
- parse: (raw) => raw,
884
- json: (parsed) => parsed
885
- };
886
- return {
887
- ...baseSchema,
888
- ...getSchemaUtils(baseSchema)
1018
+ // src/core/schemas/utils/createIdentitySchemaCreator.ts
1019
+ function createIdentitySchemaCreator(schemaType, validate) {
1020
+ return () => {
1021
+ const baseSchema = {
1022
+ parse: validate,
1023
+ json: validate,
1024
+ getType: () => schemaType
1025
+ };
1026
+ return {
1027
+ ...baseSchema,
1028
+ ...getSchemaUtils(baseSchema)
1029
+ };
889
1030
  };
890
1031
  }
891
- var init_identity = __esm({
892
- "src/core/schemas/builders/identity/identity.ts"() {
893
- "use strict";
894
- init_schema_utils();
895
- }
896
- });
897
-
898
- // src/core/schemas/builders/identity/createIdentitySchemaCreator.ts
899
- function createIdentitySchemaCreator() {
900
- return () => identity();
901
- }
902
1032
  var init_createIdentitySchemaCreator = __esm({
903
- "src/core/schemas/builders/identity/createIdentitySchemaCreator.ts"() {
904
- "use strict";
905
- init_identity();
906
- }
907
- });
908
-
909
- // src/core/schemas/builders/identity/index.ts
910
- var init_identity2 = __esm({
911
- "src/core/schemas/builders/identity/index.ts"() {
1033
+ "src/core/schemas/utils/createIdentitySchemaCreator.ts"() {
912
1034
  "use strict";
913
- init_createIdentitySchemaCreator();
914
- init_identity();
1035
+ init_schema_utils();
915
1036
  }
916
1037
  });
917
1038
 
918
1039
  // src/core/schemas/builders/enum/enum.ts
919
- function enum_(_values) {
920
- return createIdentitySchemaCreator()();
1040
+ function enum_(values) {
1041
+ const validValues = new Set(values);
1042
+ const schemaCreator = createIdentitySchemaCreator(SchemaType.ENUM, (value, { allowUnknownKeys = false } = {}) => {
1043
+ if (typeof value === "string" && (validValues.has(value) || allowUnknownKeys)) {
1044
+ return {
1045
+ ok: true,
1046
+ value
1047
+ };
1048
+ } else {
1049
+ return {
1050
+ ok: false,
1051
+ errors: [
1052
+ {
1053
+ path: [],
1054
+ message: "Not one of the allowed values"
1055
+ }
1056
+ ]
1057
+ };
1058
+ }
1059
+ });
1060
+ return schemaCreator();
921
1061
  }
922
1062
  var init_enum = __esm({
923
1063
  "src/core/schemas/builders/enum/enum.ts"() {
924
1064
  "use strict";
925
- init_identity2();
1065
+ init_Schema();
1066
+ init_createIdentitySchemaCreator();
926
1067
  }
927
1068
  });
928
1069
 
@@ -944,8 +1085,9 @@ function lazy(getter) {
944
1085
  }
945
1086
  function constructLazyBaseSchema(getter) {
946
1087
  return {
947
- parse: async (raw) => (await getMemoizedSchema(getter)).parse(raw),
948
- json: async (parsed) => (await getMemoizedSchema(getter)).json(parsed)
1088
+ parse: async (raw, opts) => (await getMemoizedSchema(getter)).parse(raw, opts),
1089
+ json: async (parsed, opts) => (await getMemoizedSchema(getter)).json(parsed, opts),
1090
+ getType: async () => (await getMemoizedSchema(getter)).getType()
949
1091
  };
950
1092
  }
951
1093
  async function getMemoizedSchema(getter) {
@@ -988,6 +1130,28 @@ var init_filterObject = __esm({
988
1130
  }
989
1131
  });
990
1132
 
1133
+ // src/core/schemas/utils/isPlainObject.ts
1134
+ function isPlainObject(value) {
1135
+ if (typeof value !== "object" || value === null) {
1136
+ return false;
1137
+ }
1138
+ if (Object.getPrototypeOf(value) === null) {
1139
+ return true;
1140
+ }
1141
+ let proto = value;
1142
+ while (Object.getPrototypeOf(proto) !== null) {
1143
+ proto = Object.getPrototypeOf(proto);
1144
+ }
1145
+ return Object.getPrototypeOf(value) === proto;
1146
+ }
1147
+ var NOT_AN_OBJECT_ERROR_MESSAGE;
1148
+ var init_isPlainObject = __esm({
1149
+ "src/core/schemas/utils/isPlainObject.ts"() {
1150
+ "use strict";
1151
+ NOT_AN_OBJECT_ERROR_MESSAGE = "Not an object";
1152
+ }
1153
+ });
1154
+
991
1155
  // src/core/schemas/utils/keys.ts
992
1156
  function keys(object2) {
993
1157
  return Object.keys(object2);
@@ -1016,53 +1180,56 @@ var init_partition = __esm({
1016
1180
  }
1017
1181
  });
1018
1182
 
1019
- // src/core/schemas/builders/object-like/types.ts
1020
- var OBJECT_LIKE_BRAND;
1021
- var init_types6 = __esm({
1022
- "src/core/schemas/builders/object-like/types.ts"() {
1023
- "use strict";
1024
- OBJECT_LIKE_BRAND = void 0;
1025
- }
1026
- });
1027
-
1028
1183
  // src/core/schemas/builders/object-like/getObjectLikeUtils.ts
1029
1184
  function getObjectLikeUtils(schema) {
1030
1185
  return {
1031
- withProperties: (properties) => withProperties(schema, properties)
1186
+ withParsedProperties: (properties) => withParsedProperties(schema, properties)
1032
1187
  };
1033
1188
  }
1034
- function withProperties(objectLike, properties) {
1189
+ function withParsedProperties(objectLike, properties) {
1035
1190
  const objectSchema = {
1036
- ...OBJECT_LIKE_BRAND,
1037
1191
  parse: async (raw, opts) => {
1038
1192
  const parsedObject = await objectLike.parse(raw, opts);
1193
+ if (!parsedObject.ok) {
1194
+ return parsedObject;
1195
+ }
1039
1196
  const additionalProperties = Object.entries(properties).reduce(
1040
1197
  (processed, [key, value]) => {
1041
1198
  return {
1042
1199
  ...processed,
1043
- [key]: typeof value === "function" ? value(parsedObject) : value
1200
+ [key]: typeof value === "function" ? value(parsedObject.value) : value
1044
1201
  };
1045
1202
  },
1046
1203
  {}
1047
1204
  );
1048
1205
  return {
1049
- ...parsedObject,
1050
- ...additionalProperties
1206
+ ok: true,
1207
+ value: {
1208
+ ...parsedObject.value,
1209
+ ...additionalProperties
1210
+ }
1051
1211
  };
1052
1212
  },
1053
1213
  json: (parsed, opts) => {
1214
+ if (!isPlainObject(parsed)) {
1215
+ return {
1216
+ ok: false,
1217
+ errors: [
1218
+ {
1219
+ path: [],
1220
+ message: NOT_AN_OBJECT_ERROR_MESSAGE
1221
+ }
1222
+ ]
1223
+ };
1224
+ }
1054
1225
  const addedPropertyKeys = new Set(Object.keys(properties));
1055
- const parsedWithoutAddedProperties = Object.entries(parsed).reduce(
1056
- (filtered, [key, value]) => {
1057
- if (!addedPropertyKeys.has(key)) {
1058
- filtered[key] = value;
1059
- }
1060
- return filtered;
1061
- },
1062
- {}
1226
+ const parsedWithoutAddedProperties = filterObject(
1227
+ parsed,
1228
+ Object.keys(parsed).filter((key) => !addedPropertyKeys.has(key))
1063
1229
  );
1064
1230
  return objectLike.json(parsedWithoutAddedProperties, opts);
1065
- }
1231
+ },
1232
+ getType: () => objectLike.getType()
1066
1233
  };
1067
1234
  return {
1068
1235
  ...objectSchema,
@@ -1073,8 +1240,9 @@ function withProperties(objectLike, properties) {
1073
1240
  var init_getObjectLikeUtils = __esm({
1074
1241
  "src/core/schemas/builders/object-like/getObjectLikeUtils.ts"() {
1075
1242
  "use strict";
1243
+ init_filterObject();
1244
+ init_isPlainObject();
1076
1245
  init_schema_utils();
1077
- init_types6();
1078
1246
  }
1079
1247
  });
1080
1248
 
@@ -1083,7 +1251,6 @@ var init_object_like = __esm({
1083
1251
  "src/core/schemas/builders/object-like/index.ts"() {
1084
1252
  "use strict";
1085
1253
  init_getObjectLikeUtils();
1086
- init_types6();
1087
1254
  }
1088
1255
  });
1089
1256
 
@@ -1107,54 +1274,76 @@ var init_property = __esm({
1107
1274
  // src/core/schemas/builders/object/object.ts
1108
1275
  function object(schemas) {
1109
1276
  const baseSchema = {
1110
- ...OBJECT_LIKE_BRAND,
1111
1277
  _getRawProperties: () => Promise.resolve(
1112
1278
  Object.entries(schemas).map(
1113
1279
  ([parsedKey, propertySchema]) => isProperty(propertySchema) ? propertySchema.rawKey : parsedKey
1114
1280
  )
1115
1281
  ),
1116
1282
  _getParsedProperties: () => Promise.resolve(keys(schemas)),
1117
- parse: async (raw, { skipUnknownKeysOnParse = false } = {}) => {
1283
+ parse: async (raw, opts) => {
1118
1284
  const rawKeyToProperty = {};
1285
+ const requiredKeys = [];
1119
1286
  for (const [parsedKey, schemaOrObjectProperty] of entries(schemas)) {
1120
1287
  const rawKey = isProperty(schemaOrObjectProperty) ? schemaOrObjectProperty.rawKey : parsedKey;
1288
+ const valueSchema = isProperty(schemaOrObjectProperty) ? schemaOrObjectProperty.valueSchema : schemaOrObjectProperty;
1121
1289
  const property2 = {
1122
1290
  rawKey,
1123
1291
  parsedKey,
1124
- valueSchema: isProperty(schemaOrObjectProperty) ? schemaOrObjectProperty.valueSchema : schemaOrObjectProperty
1292
+ valueSchema
1125
1293
  };
1126
1294
  rawKeyToProperty[rawKey] = property2;
1127
- }
1128
- const parsed = {};
1129
- for (const [rawKey, rawPropertyValue] of Object.entries(raw)) {
1130
- const property2 = rawKeyToProperty[rawKey];
1131
- if (property2 != null) {
1132
- const value = await property2.valueSchema.parse(rawPropertyValue);
1133
- parsed[property2.parsedKey] = value;
1134
- } else if (!skipUnknownKeysOnParse && rawPropertyValue != null) {
1135
- parsed[rawKey] = rawPropertyValue;
1295
+ if (await valueSchema.getType() !== "optional") {
1296
+ requiredKeys.push(rawKey);
1136
1297
  }
1137
1298
  }
1138
- return parsed;
1139
- },
1140
- json: async (parsed, { includeUnknownKeysOnJson = false } = {}) => {
1141
- const raw = {};
1142
- for (const [parsedKey, parsedPropertyValue] of entries(parsed)) {
1143
- const schemaOrObjectProperty = schemas[parsedKey];
1144
- if (schemaOrObjectProperty != null) {
1145
- if (isProperty(schemaOrObjectProperty)) {
1146
- const value = await schemaOrObjectProperty.valueSchema.json(parsedPropertyValue);
1147
- raw[schemaOrObjectProperty.rawKey] = value;
1148
- } else {
1149
- const value = await schemaOrObjectProperty.json(parsedPropertyValue);
1150
- raw[parsedKey] = value;
1299
+ return validateAndTransformObject({
1300
+ value: raw,
1301
+ requiredKeys,
1302
+ getProperty: (rawKey) => {
1303
+ const property2 = rawKeyToProperty[rawKey];
1304
+ if (property2 == null) {
1305
+ return void 0;
1151
1306
  }
1152
- } else if (includeUnknownKeysOnJson && parsedPropertyValue != null) {
1153
- raw[parsedKey] = parsedPropertyValue;
1307
+ return {
1308
+ transformedKey: property2.parsedKey,
1309
+ transform: (propertyValue) => property2.valueSchema.parse(propertyValue, opts)
1310
+ };
1311
+ },
1312
+ allowUnknownKeys: opts?.allowUnknownKeys ?? false
1313
+ });
1314
+ },
1315
+ json: async (parsed, opts) => {
1316
+ const requiredKeys = [];
1317
+ for (const [parsedKey, schemaOrObjectProperty] of entries(schemas)) {
1318
+ const valueSchema = isProperty(schemaOrObjectProperty) ? schemaOrObjectProperty.valueSchema : schemaOrObjectProperty;
1319
+ if (await valueSchema.getType() !== "optional") {
1320
+ requiredKeys.push(parsedKey);
1154
1321
  }
1155
1322
  }
1156
- return raw;
1157
- }
1323
+ return validateAndTransformObject({
1324
+ value: parsed,
1325
+ requiredKeys,
1326
+ getProperty: (parsedKey) => {
1327
+ const property2 = schemas[parsedKey];
1328
+ if (property2 == null) {
1329
+ return void 0;
1330
+ }
1331
+ if (isProperty(property2)) {
1332
+ return {
1333
+ transformedKey: property2.rawKey,
1334
+ transform: (propertyValue) => property2.valueSchema.json(propertyValue, opts)
1335
+ };
1336
+ } else {
1337
+ return {
1338
+ transformedKey: parsedKey,
1339
+ transform: (propertyValue) => property2.json(propertyValue, opts)
1340
+ };
1341
+ }
1342
+ },
1343
+ allowUnknownKeys: opts?.allowUnknownKeys ?? false
1344
+ });
1345
+ },
1346
+ getType: () => SchemaType.OBJECT
1158
1347
  };
1159
1348
  return {
1160
1349
  ...baseSchema,
@@ -1163,11 +1352,72 @@ function object(schemas) {
1163
1352
  ...getObjectUtils(baseSchema)
1164
1353
  };
1165
1354
  }
1355
+ async function validateAndTransformObject({
1356
+ value,
1357
+ requiredKeys,
1358
+ getProperty,
1359
+ allowUnknownKeys
1360
+ }) {
1361
+ if (!isPlainObject(value)) {
1362
+ return {
1363
+ ok: false,
1364
+ errors: [
1365
+ {
1366
+ path: [],
1367
+ message: NOT_AN_OBJECT_ERROR_MESSAGE
1368
+ }
1369
+ ]
1370
+ };
1371
+ }
1372
+ const missingRequiredKeys = new Set(requiredKeys);
1373
+ const errors = [];
1374
+ const transformed = {};
1375
+ for (const [preTransformedKey, preTransformedItemValue] of Object.entries(value)) {
1376
+ const property2 = getProperty(preTransformedKey);
1377
+ if (property2 != null) {
1378
+ missingRequiredKeys.delete(preTransformedKey);
1379
+ const value2 = await property2.transform(preTransformedItemValue);
1380
+ if (value2.ok) {
1381
+ transformed[property2.transformedKey] = value2.value;
1382
+ } else {
1383
+ errors.push(
1384
+ ...value2.errors.map((error) => ({
1385
+ path: [preTransformedKey, ...error.path],
1386
+ message: error.message
1387
+ }))
1388
+ );
1389
+ }
1390
+ } else if (allowUnknownKeys) {
1391
+ transformed[preTransformedKey] = preTransformedItemValue;
1392
+ } else {
1393
+ errors.push({
1394
+ path: [preTransformedKey],
1395
+ message: `Unrecognized key "${preTransformedKey}"`
1396
+ });
1397
+ }
1398
+ }
1399
+ errors.push(
1400
+ ...requiredKeys.filter((key) => missingRequiredKeys.has(key)).map((key) => ({
1401
+ path: [],
1402
+ message: `Missing required key "${key}"`
1403
+ }))
1404
+ );
1405
+ if (errors.length === 0) {
1406
+ return {
1407
+ ok: true,
1408
+ value: transformed
1409
+ };
1410
+ } else {
1411
+ return {
1412
+ ok: false,
1413
+ errors
1414
+ };
1415
+ }
1416
+ }
1166
1417
  function getObjectUtils(schema) {
1167
1418
  return {
1168
1419
  extend: (extension) => {
1169
1420
  const baseSchema = {
1170
- ...OBJECT_LIKE_BRAND,
1171
1421
  _getParsedProperties: async () => [
1172
1422
  ...await schema._getParsedProperties(),
1173
1423
  ...await extension._getParsedProperties()
@@ -1177,27 +1427,22 @@ function getObjectUtils(schema) {
1177
1427
  ...await extension._getRawProperties()
1178
1428
  ],
1179
1429
  parse: async (raw, opts) => {
1180
- const rawExtensionPropertiesSet = new Set(await extension._getRawProperties());
1181
- const [extensionProperties, otherProperties] = partition(
1182
- keys(raw),
1183
- (key) => rawExtensionPropertiesSet.has(key)
1184
- );
1185
- return {
1186
- ...await schema.parse(filterObject(raw, otherProperties), opts),
1187
- ...await extension.parse(filterObject(raw, extensionProperties), opts)
1188
- };
1430
+ return validateAndTransformExtendedObject({
1431
+ extensionKeys: await extension._getRawProperties(),
1432
+ value: raw,
1433
+ transformBase: (rawBase) => schema.parse(rawBase, opts),
1434
+ transformExtension: (rawExtension) => extension.parse(rawExtension, opts)
1435
+ });
1189
1436
  },
1190
1437
  json: async (parsed, opts) => {
1191
- const parsedExtensionPropertiesSet = new Set(await extension._getParsedProperties());
1192
- const [extensionProperties, otherProperties] = partition(
1193
- keys(parsed),
1194
- (key) => parsedExtensionPropertiesSet.has(key)
1195
- );
1196
- return {
1197
- ...await schema.json(filterObject(parsed, otherProperties), opts),
1198
- ...await extension.json(filterObject(parsed, extensionProperties), opts)
1199
- };
1200
- }
1438
+ return validateAndTransformExtendedObject({
1439
+ extensionKeys: await extension._getParsedProperties(),
1440
+ value: parsed,
1441
+ transformBase: (parsedBase) => schema.json(parsedBase, opts),
1442
+ transformExtension: (parsedExtension) => extension.json(parsedExtension, opts)
1443
+ });
1444
+ },
1445
+ getType: () => SchemaType.OBJECT
1201
1446
  };
1202
1447
  return {
1203
1448
  ...baseSchema,
@@ -1208,11 +1453,44 @@ function getObjectUtils(schema) {
1208
1453
  }
1209
1454
  };
1210
1455
  }
1456
+ async function validateAndTransformExtendedObject({
1457
+ extensionKeys,
1458
+ value,
1459
+ transformBase,
1460
+ transformExtension
1461
+ }) {
1462
+ const extensionPropertiesSet = new Set(extensionKeys);
1463
+ const [extensionProperties, baseProperties] = partition(
1464
+ keys(value),
1465
+ (key) => extensionPropertiesSet.has(key)
1466
+ );
1467
+ const transformedBase = await transformBase(filterObject(value, baseProperties));
1468
+ const transformedExtension = await transformExtension(filterObject(value, extensionProperties));
1469
+ if (transformedBase.ok && transformedExtension.ok) {
1470
+ return {
1471
+ ok: true,
1472
+ value: {
1473
+ ...transformedBase.value,
1474
+ ...transformedExtension.value
1475
+ }
1476
+ };
1477
+ } else {
1478
+ return {
1479
+ ok: false,
1480
+ errors: [
1481
+ ...transformedBase.ok ? [] : transformedBase.errors,
1482
+ ...transformedExtension.ok ? [] : transformedExtension.errors
1483
+ ]
1484
+ };
1485
+ }
1486
+ }
1211
1487
  var init_object = __esm({
1212
1488
  "src/core/schemas/builders/object/object.ts"() {
1213
1489
  "use strict";
1490
+ init_Schema();
1214
1491
  init_entries();
1215
1492
  init_filterObject();
1493
+ init_isPlainObject();
1216
1494
  init_keys();
1217
1495
  init_partition();
1218
1496
  init_object_like();
@@ -1233,7 +1511,6 @@ var init_object2 = __esm({
1233
1511
  // src/core/schemas/builders/lazy/lazyObject.ts
1234
1512
  function lazyObject(getter) {
1235
1513
  const baseSchema = {
1236
- ...OBJECT_LIKE_BRAND,
1237
1514
  ...constructLazyBaseSchema(getter),
1238
1515
  _getRawProperties: async () => (await getMemoizedSchema(getter))._getRawProperties(),
1239
1516
  _getParsedProperties: async () => (await getMemoizedSchema(getter))._getParsedProperties()
@@ -1267,17 +1544,60 @@ var init_lazy2 = __esm({
1267
1544
  // src/core/schemas/builders/list/list.ts
1268
1545
  function list(schema) {
1269
1546
  const baseSchema = {
1270
- parse: (raw, opts) => Promise.all(raw.map((item) => schema.parse(item, opts))),
1271
- json: (parsed, opts) => Promise.all(parsed.map((item) => schema.json(item, opts)))
1547
+ parse: async (raw, opts) => validateAndTransformArray(raw, (item) => schema.parse(item, opts)),
1548
+ json: (parsed, opts) => validateAndTransformArray(parsed, (item) => schema.json(item, opts)),
1549
+ getType: () => SchemaType.LIST
1272
1550
  };
1273
1551
  return {
1274
1552
  ...baseSchema,
1275
1553
  ...getSchemaUtils(baseSchema)
1276
1554
  };
1277
1555
  }
1556
+ async function validateAndTransformArray(value, transformItem) {
1557
+ if (!Array.isArray(value)) {
1558
+ return {
1559
+ ok: false,
1560
+ errors: [
1561
+ {
1562
+ message: "Not a list",
1563
+ path: []
1564
+ }
1565
+ ]
1566
+ };
1567
+ }
1568
+ const maybeValidItems = await Promise.all(value.map((item) => transformItem(item)));
1569
+ return maybeValidItems.reduce(
1570
+ (acc, item, index) => {
1571
+ if (acc.ok && item.ok) {
1572
+ return {
1573
+ ok: true,
1574
+ value: [...acc.value, item.value]
1575
+ };
1576
+ }
1577
+ const errors = [];
1578
+ if (!acc.ok) {
1579
+ errors.push(...acc.errors);
1580
+ }
1581
+ if (!item.ok) {
1582
+ errors.push(
1583
+ ...item.errors.map((error) => ({
1584
+ path: [`[${index}]`, ...error.path],
1585
+ message: error.message
1586
+ }))
1587
+ );
1588
+ }
1589
+ return {
1590
+ ok: false,
1591
+ errors
1592
+ };
1593
+ },
1594
+ { ok: true, value: [] }
1595
+ );
1596
+ }
1278
1597
  var init_list = __esm({
1279
1598
  "src/core/schemas/builders/list/list.ts"() {
1280
1599
  "use strict";
1600
+ init_Schema();
1281
1601
  init_schema_utils();
1282
1602
  }
1283
1603
  });
@@ -1291,13 +1611,32 @@ var init_list2 = __esm({
1291
1611
  });
1292
1612
 
1293
1613
  // src/core/schemas/builders/literals/stringLiteral.ts
1294
- function stringLiteral(_value) {
1295
- return createIdentitySchemaCreator()();
1614
+ function stringLiteral(literal) {
1615
+ const schemaCreator = createIdentitySchemaCreator(SchemaType.STRING_LITERAL, (value) => {
1616
+ if (value === literal) {
1617
+ return {
1618
+ ok: true,
1619
+ value: literal
1620
+ };
1621
+ } else {
1622
+ return {
1623
+ ok: false,
1624
+ errors: [
1625
+ {
1626
+ path: [],
1627
+ message: `Not equal to "${literal}"`
1628
+ }
1629
+ ]
1630
+ };
1631
+ }
1632
+ });
1633
+ return schemaCreator();
1296
1634
  }
1297
1635
  var init_stringLiteral = __esm({
1298
1636
  "src/core/schemas/builders/literals/stringLiteral.ts"() {
1299
1637
  "use strict";
1300
- init_identity2();
1638
+ init_Schema();
1639
+ init_createIdentitySchemaCreator();
1301
1640
  }
1302
1641
  });
1303
1642
 
@@ -1314,8 +1653,9 @@ var any;
1314
1653
  var init_any = __esm({
1315
1654
  "src/core/schemas/builders/primitives/any.ts"() {
1316
1655
  "use strict";
1317
- init_identity2();
1318
- any = createIdentitySchemaCreator();
1656
+ init_Schema();
1657
+ init_createIdentitySchemaCreator();
1658
+ any = createIdentitySchemaCreator(SchemaType.ANY, (value) => ({ ok: true, value }));
1319
1659
  }
1320
1660
  });
1321
1661
 
@@ -1324,8 +1664,26 @@ var boolean;
1324
1664
  var init_boolean = __esm({
1325
1665
  "src/core/schemas/builders/primitives/boolean.ts"() {
1326
1666
  "use strict";
1327
- init_identity2();
1328
- boolean = createIdentitySchemaCreator();
1667
+ init_Schema();
1668
+ init_createIdentitySchemaCreator();
1669
+ boolean = createIdentitySchemaCreator(SchemaType.BOOLEAN, (value) => {
1670
+ if (typeof value === "boolean") {
1671
+ return {
1672
+ ok: true,
1673
+ value
1674
+ };
1675
+ } else {
1676
+ return {
1677
+ ok: false,
1678
+ errors: [
1679
+ {
1680
+ path: [],
1681
+ message: "Not a boolean"
1682
+ }
1683
+ ]
1684
+ };
1685
+ }
1686
+ });
1329
1687
  }
1330
1688
  });
1331
1689
 
@@ -1334,8 +1692,26 @@ var number;
1334
1692
  var init_number = __esm({
1335
1693
  "src/core/schemas/builders/primitives/number.ts"() {
1336
1694
  "use strict";
1337
- init_identity2();
1338
- number = createIdentitySchemaCreator();
1695
+ init_Schema();
1696
+ init_createIdentitySchemaCreator();
1697
+ number = createIdentitySchemaCreator(SchemaType.NUMBER, (value) => {
1698
+ if (typeof value === "number") {
1699
+ return {
1700
+ ok: true,
1701
+ value
1702
+ };
1703
+ } else {
1704
+ return {
1705
+ ok: false,
1706
+ errors: [
1707
+ {
1708
+ path: [],
1709
+ message: "Not a number"
1710
+ }
1711
+ ]
1712
+ };
1713
+ }
1714
+ });
1339
1715
  }
1340
1716
  });
1341
1717
 
@@ -1344,8 +1720,26 @@ var string;
1344
1720
  var init_string = __esm({
1345
1721
  "src/core/schemas/builders/primitives/string.ts"() {
1346
1722
  "use strict";
1347
- init_identity2();
1348
- string = createIdentitySchemaCreator();
1723
+ init_Schema();
1724
+ init_createIdentitySchemaCreator();
1725
+ string = createIdentitySchemaCreator(SchemaType.STRING, (value) => {
1726
+ if (typeof value === "string") {
1727
+ return {
1728
+ ok: true,
1729
+ value
1730
+ };
1731
+ } else {
1732
+ return {
1733
+ ok: false,
1734
+ errors: [
1735
+ {
1736
+ path: [],
1737
+ message: "Not a string"
1738
+ }
1739
+ ]
1740
+ };
1741
+ }
1742
+ });
1349
1743
  }
1350
1744
  });
1351
1745
 
@@ -1354,8 +1748,9 @@ var unknown;
1354
1748
  var init_unknown = __esm({
1355
1749
  "src/core/schemas/builders/primitives/unknown.ts"() {
1356
1750
  "use strict";
1357
- init_identity2();
1358
- unknown = createIdentitySchemaCreator();
1751
+ init_Schema();
1752
+ init_createIdentitySchemaCreator();
1753
+ unknown = createIdentitySchemaCreator(SchemaType.UNKNOWN, (value) => ({ ok: true, value }));
1359
1754
  }
1360
1755
  });
1361
1756
 
@@ -1374,32 +1769,104 @@ var init_primitives = __esm({
1374
1769
  // src/core/schemas/builders/record/record.ts
1375
1770
  function record(keySchema, valueSchema) {
1376
1771
  const baseSchema = {
1377
- parse: (raw, opts) => {
1378
- return entries(raw).reduce(async (parsedPromise, [key, value]) => {
1379
- const parsed = await parsedPromise;
1380
- const parsedKey = await keySchema.parse(key, opts);
1381
- parsed[parsedKey] = await valueSchema.parse(value, opts);
1382
- return parsedPromise;
1383
- }, Promise.resolve({}));
1772
+ parse: async (raw, opts) => {
1773
+ return validateAndTransformRecord({
1774
+ value: raw,
1775
+ isKeyNumeric: await keySchema.getType() === SchemaType.NUMBER,
1776
+ transformKey: (key) => keySchema.parse(key, opts),
1777
+ transformValue: (value) => valueSchema.parse(value, opts)
1778
+ });
1384
1779
  },
1385
- json: (parsed, opts) => {
1386
- return entries(parsed).reduce(async (rawPromise, [key, value]) => {
1387
- const raw = await rawPromise;
1388
- const rawKey = await keySchema.json(key, opts);
1389
- raw[rawKey] = await valueSchema.json(value, opts);
1390
- return rawPromise;
1391
- }, Promise.resolve({}));
1392
- }
1780
+ json: async (parsed, opts) => {
1781
+ return validateAndTransformRecord({
1782
+ value: parsed,
1783
+ isKeyNumeric: await keySchema.getType() === SchemaType.NUMBER,
1784
+ transformKey: (key) => keySchema.json(key, opts),
1785
+ transformValue: (value) => valueSchema.json(value, opts)
1786
+ });
1787
+ },
1788
+ getType: () => SchemaType.RECORD
1393
1789
  };
1394
1790
  return {
1395
1791
  ...baseSchema,
1396
1792
  ...getSchemaUtils(baseSchema)
1397
1793
  };
1398
1794
  }
1795
+ async function validateAndTransformRecord({
1796
+ value,
1797
+ isKeyNumeric,
1798
+ transformKey,
1799
+ transformValue
1800
+ }) {
1801
+ if (!isPlainObject(value)) {
1802
+ return {
1803
+ ok: false,
1804
+ errors: [
1805
+ {
1806
+ path: [],
1807
+ message: NOT_AN_OBJECT_ERROR_MESSAGE
1808
+ }
1809
+ ]
1810
+ };
1811
+ }
1812
+ return entries(value).reduce(
1813
+ async (accPromise, [stringKey, value2]) => {
1814
+ if (value2 == null) {
1815
+ return accPromise;
1816
+ }
1817
+ const acc = await accPromise;
1818
+ let key = stringKey;
1819
+ if (isKeyNumeric) {
1820
+ const numberKey = stringKey.length > 0 ? Number(stringKey) : NaN;
1821
+ if (!isNaN(numberKey)) {
1822
+ key = numberKey;
1823
+ }
1824
+ }
1825
+ const transformedKey = await transformKey(key);
1826
+ const transformedValue = await transformValue(value2);
1827
+ if (acc.ok && transformedKey.ok && transformedValue.ok) {
1828
+ return {
1829
+ ok: true,
1830
+ value: {
1831
+ ...acc.value,
1832
+ [transformedKey.value]: transformedValue.value
1833
+ }
1834
+ };
1835
+ }
1836
+ const errors = [];
1837
+ if (!acc.ok) {
1838
+ errors.push(...acc.errors);
1839
+ }
1840
+ if (!transformedKey.ok) {
1841
+ errors.push(
1842
+ ...transformedKey.errors.map((error) => ({
1843
+ path: [`${key} (key)`, ...error.path],
1844
+ message: error.message
1845
+ }))
1846
+ );
1847
+ }
1848
+ if (!transformedValue.ok) {
1849
+ errors.push(
1850
+ ...transformedValue.errors.map((error) => ({
1851
+ path: [stringKey, ...error.path],
1852
+ message: error.message
1853
+ }))
1854
+ );
1855
+ }
1856
+ return {
1857
+ ok: false,
1858
+ errors
1859
+ };
1860
+ },
1861
+ Promise.resolve({ ok: true, value: {} })
1862
+ );
1863
+ }
1399
1864
  var init_record = __esm({
1400
1865
  "src/core/schemas/builders/record/record.ts"() {
1401
1866
  "use strict";
1867
+ init_Schema();
1402
1868
  init_entries();
1869
+ init_isPlainObject();
1403
1870
  init_schema_utils();
1404
1871
  }
1405
1872
  });
@@ -1414,9 +1881,35 @@ var init_record2 = __esm({
1414
1881
 
1415
1882
  // src/core/schemas/builders/set/set.ts
1416
1883
  function set(schema) {
1884
+ const listSchema = list(schema);
1417
1885
  const baseSchema = {
1418
- parse: async (raw, opts) => new Set(await Promise.all(raw.map((item) => schema.parse(item, opts)))),
1419
- json: (parsed, opts) => Promise.all([...parsed].map((item) => schema.json(item, opts)))
1886
+ parse: async (raw, opts) => {
1887
+ const parsedList = await listSchema.parse(raw, opts);
1888
+ if (parsedList.ok) {
1889
+ return {
1890
+ ok: true,
1891
+ value: new Set(parsedList.value)
1892
+ };
1893
+ } else {
1894
+ return parsedList;
1895
+ }
1896
+ },
1897
+ json: async (parsed, opts) => {
1898
+ if (!(parsed instanceof Set)) {
1899
+ return {
1900
+ ok: false,
1901
+ errors: [
1902
+ {
1903
+ path: [],
1904
+ message: "Not a Set"
1905
+ }
1906
+ ]
1907
+ };
1908
+ }
1909
+ const jsonList = await listSchema.json([...parsed], opts);
1910
+ return jsonList;
1911
+ },
1912
+ getType: () => SchemaType.SET
1420
1913
  };
1421
1914
  return {
1422
1915
  ...baseSchema,
@@ -1426,6 +1919,8 @@ function set(schema) {
1426
1919
  var init_set = __esm({
1427
1920
  "src/core/schemas/builders/set/set.ts"() {
1428
1921
  "use strict";
1922
+ init_Schema();
1923
+ init_list2();
1429
1924
  init_schema_utils();
1430
1925
  }
1431
1926
  });
@@ -1455,36 +1950,31 @@ var init_discriminant = __esm({
1455
1950
  function union(discriminant2, union2) {
1456
1951
  const rawDiscriminant = typeof discriminant2 === "string" ? discriminant2 : discriminant2.rawDiscriminant;
1457
1952
  const parsedDiscriminant = typeof discriminant2 === "string" ? discriminant2 : discriminant2.parsedDiscriminant;
1953
+ const discriminantValueSchema = enum_(keys(union2));
1458
1954
  const baseSchema = {
1459
- ...OBJECT_LIKE_BRAND,
1460
1955
  parse: async (raw, opts) => {
1461
- const { [rawDiscriminant]: discriminantValue, ...additionalProperties } = raw;
1462
- const additionalPropertySchemas = union2[discriminantValue];
1463
- if (additionalPropertySchemas == null) {
1464
- return {
1465
- ...additionalProperties,
1466
- [parsedDiscriminant]: discriminantValue
1467
- };
1468
- }
1469
- return {
1470
- ...await additionalPropertySchemas.parse(additionalProperties, opts),
1471
- [parsedDiscriminant]: discriminantValue
1472
- };
1956
+ return transformAndValidateUnion(
1957
+ raw,
1958
+ rawDiscriminant,
1959
+ parsedDiscriminant,
1960
+ (discriminantValue) => discriminantValueSchema.parse(discriminantValue, opts),
1961
+ (discriminantValue) => union2[discriminantValue],
1962
+ opts?.allowUnknownKeys ?? false,
1963
+ (additionalProperties, additionalPropertiesSchema) => additionalPropertiesSchema.parse(additionalProperties, opts)
1964
+ );
1473
1965
  },
1474
1966
  json: async (parsed, opts) => {
1475
- const { [parsedDiscriminant]: discriminantValue, ...additionalProperties } = parsed;
1476
- const additionalPropertySchemas = union2[discriminantValue];
1477
- if (additionalPropertySchemas == null) {
1478
- return {
1479
- ...additionalProperties,
1480
- [rawDiscriminant]: discriminantValue
1481
- };
1482
- }
1483
- return {
1484
- ...await additionalPropertySchemas.json(additionalProperties, opts),
1485
- [rawDiscriminant]: discriminantValue
1486
- };
1487
- }
1967
+ return transformAndValidateUnion(
1968
+ parsed,
1969
+ parsedDiscriminant,
1970
+ rawDiscriminant,
1971
+ (discriminantValue) => discriminantValueSchema.json(discriminantValue, opts),
1972
+ (discriminantValue) => union2[discriminantValue],
1973
+ opts?.allowUnknownKeys ?? false,
1974
+ (additionalProperties, additionalPropertiesSchema) => additionalPropertiesSchema.json(additionalProperties, opts)
1975
+ );
1976
+ },
1977
+ getType: () => SchemaType.UNION
1488
1978
  };
1489
1979
  return {
1490
1980
  ...baseSchema,
@@ -1492,9 +1982,84 @@ function union(discriminant2, union2) {
1492
1982
  ...getObjectLikeUtils(baseSchema)
1493
1983
  };
1494
1984
  }
1985
+ async function transformAndValidateUnion(value, discriminant2, transformedDiscriminant, transformDiscriminantValue, getAdditionalPropertiesSchema, allowUnknownKeys, transformAdditionalProperties) {
1986
+ if (!isPlainObject(value)) {
1987
+ return {
1988
+ ok: false,
1989
+ errors: [
1990
+ {
1991
+ path: [],
1992
+ message: NOT_AN_OBJECT_ERROR_MESSAGE
1993
+ }
1994
+ ]
1995
+ };
1996
+ }
1997
+ const { [discriminant2]: discriminantValue, ...additionalProperties } = value;
1998
+ if (discriminantValue == null) {
1999
+ return {
2000
+ ok: false,
2001
+ errors: [
2002
+ {
2003
+ path: [],
2004
+ message: `Missing discriminant ("${discriminant2}")`
2005
+ }
2006
+ ]
2007
+ };
2008
+ }
2009
+ const transformedDiscriminantValue = await transformDiscriminantValue(discriminantValue);
2010
+ if (!transformedDiscriminantValue.ok) {
2011
+ return {
2012
+ ok: false,
2013
+ errors: transformedDiscriminantValue.errors.map((error) => ({
2014
+ path: [discriminant2, ...error.path],
2015
+ message: error.message
2016
+ }))
2017
+ };
2018
+ }
2019
+ const additionalPropertiesSchema = getAdditionalPropertiesSchema(transformedDiscriminantValue.value);
2020
+ if (additionalPropertiesSchema == null) {
2021
+ if (allowUnknownKeys) {
2022
+ return {
2023
+ ok: true,
2024
+ value: {
2025
+ [transformedDiscriminant]: transformedDiscriminantValue.value,
2026
+ ...additionalProperties
2027
+ }
2028
+ };
2029
+ } else {
2030
+ return {
2031
+ ok: false,
2032
+ errors: [
2033
+ {
2034
+ path: [discriminant2],
2035
+ message: "Unrecognized discriminant value"
2036
+ }
2037
+ ]
2038
+ };
2039
+ }
2040
+ }
2041
+ const transformedAdditionalProperties = await transformAdditionalProperties(
2042
+ additionalProperties,
2043
+ additionalPropertiesSchema
2044
+ );
2045
+ if (!transformedAdditionalProperties.ok) {
2046
+ return transformedAdditionalProperties;
2047
+ }
2048
+ return {
2049
+ ok: true,
2050
+ value: {
2051
+ [transformedDiscriminant]: discriminantValue,
2052
+ ...transformedAdditionalProperties.value
2053
+ }
2054
+ };
2055
+ }
1495
2056
  var init_union = __esm({
1496
2057
  "src/core/schemas/builders/union/union.ts"() {
1497
2058
  "use strict";
2059
+ init_Schema();
2060
+ init_isPlainObject();
2061
+ init_keys();
2062
+ init_enum2();
1498
2063
  init_object_like();
1499
2064
  init_schema_utils();
1500
2065
  }
@@ -1515,7 +2080,6 @@ var init_builders = __esm({
1515
2080
  "use strict";
1516
2081
  init_date2();
1517
2082
  init_enum2();
1518
- init_identity2();
1519
2083
  init_lazy2();
1520
2084
  init_list2();
1521
2085
  init_literals();
@@ -1532,18 +2096,16 @@ var init_builders = __esm({
1532
2096
  // src/core/schemas/index.ts
1533
2097
  var schemas_exports = {};
1534
2098
  __export(schemas_exports, {
1535
- OBJECT_LIKE_BRAND: () => OBJECT_LIKE_BRAND,
1536
- OPTIONAL_BRAND: () => OPTIONAL_BRAND,
2099
+ JsonError: () => JsonError,
2100
+ ParseError: () => ParseError,
1537
2101
  any: () => any,
1538
2102
  boolean: () => boolean,
1539
- createIdentitySchemaCreator: () => createIdentitySchemaCreator,
1540
2103
  date: () => date,
1541
2104
  discriminant: () => discriminant,
1542
2105
  enum_: () => enum_,
1543
2106
  getObjectLikeUtils: () => getObjectLikeUtils,
1544
2107
  getObjectUtils: () => getObjectUtils,
1545
2108
  getSchemaUtils: () => getSchemaUtils,
1546
- identity: () => identity,
1547
2109
  isProperty: () => isProperty,
1548
2110
  lazy: () => lazy,
1549
2111
  lazyObject: () => lazyObject,
@@ -1559,12 +2121,13 @@ __export(schemas_exports, {
1559
2121
  transform: () => transform,
1560
2122
  union: () => union,
1561
2123
  unknown: () => unknown,
1562
- withProperties: () => withProperties
2124
+ withParsedProperties: () => withParsedProperties
1563
2125
  });
1564
2126
  var init_schemas = __esm({
1565
2127
  "src/core/schemas/index.ts"() {
1566
2128
  "use strict";
1567
2129
  init_builders();
2130
+ init_Schema();
1568
2131
  }
1569
2132
  });
1570
2133
 
@@ -3641,7 +4204,7 @@ var require_utils = __commonJS({
3641
4204
  function isObject(val) {
3642
4205
  return val !== null && typeof val === "object";
3643
4206
  }
3644
- function isPlainObject(val) {
4207
+ function isPlainObject2(val) {
3645
4208
  if (kindOf(val) !== "object") {
3646
4209
  return false;
3647
4210
  }
@@ -3694,9 +4257,9 @@ var require_utils = __commonJS({
3694
4257
  function merge() {
3695
4258
  var result = {};
3696
4259
  function assignValue(val, key) {
3697
- if (isPlainObject(result[key]) && isPlainObject(val)) {
4260
+ if (isPlainObject2(result[key]) && isPlainObject2(val)) {
3698
4261
  result[key] = merge(result[key], val);
3699
- } else if (isPlainObject(val)) {
4262
+ } else if (isPlainObject2(val)) {
3700
4263
  result[key] = merge({}, val);
3701
4264
  } else if (isArray(val)) {
3702
4265
  result[key] = val.slice();
@@ -3785,7 +4348,7 @@ var require_utils = __commonJS({
3785
4348
  isString,
3786
4349
  isNumber,
3787
4350
  isObject,
3788
- isPlainObject,
4351
+ isPlainObject: isPlainObject2,
3789
4352
  isUndefined,
3790
4353
  isDate,
3791
4354
  isFile,
@@ -5231,8 +5794,8 @@ var init_OrganizationId2 = __esm({
5231
5794
  init_src();
5232
5795
  init_core();
5233
5796
  OrganizationId2 = schemas_exports.string().transform({
5234
- parse: api_exports.OrganizationId,
5235
- json: (value) => value
5797
+ transform: api_exports.OrganizationId,
5798
+ untransform: (value) => value
5236
5799
  });
5237
5800
  }
5238
5801
  });
@@ -5245,14 +5808,14 @@ var init_UserId2 = __esm({
5245
5808
  init_src();
5246
5809
  init_core();
5247
5810
  UserId2 = schemas_exports.string().transform({
5248
- parse: api_exports.UserId,
5249
- json: (value) => value
5811
+ transform: api_exports.UserId,
5812
+ untransform: (value) => value
5250
5813
  });
5251
5814
  }
5252
5815
  });
5253
5816
 
5254
5817
  // src/serialization/resources/commons/types/index.ts
5255
- var init_types7 = __esm({
5818
+ var init_types5 = __esm({
5256
5819
  "src/serialization/resources/commons/types/index.ts"() {
5257
5820
  "use strict";
5258
5821
  init_OrganizationId2();
@@ -5269,7 +5832,7 @@ __export(commons_exports2, {
5269
5832
  var init_commons2 = __esm({
5270
5833
  "src/serialization/resources/commons/index.ts"() {
5271
5834
  "use strict";
5272
- init_types7();
5835
+ init_types5();
5273
5836
  }
5274
5837
  });
5275
5838
 
@@ -5287,7 +5850,7 @@ var init_Organization2 = __esm({
5287
5850
  });
5288
5851
 
5289
5852
  // src/serialization/resources/organization/types/index.ts
5290
- var init_types8 = __esm({
5853
+ var init_types6 = __esm({
5291
5854
  "src/serialization/resources/organization/types/index.ts"() {
5292
5855
  "use strict";
5293
5856
  init_Organization2();
@@ -5297,24 +5860,19 @@ var init_types8 = __esm({
5297
5860
  // src/serialization/resources/organization/client/create.ts
5298
5861
  var create_exports2 = {};
5299
5862
  __export(create_exports2, {
5300
- Error: () => Error13,
5301
- Request: () => Request
5863
+ Error: () => Error13
5302
5864
  });
5303
- var Request, Error13;
5865
+ var Error13;
5304
5866
  var init_create2 = __esm({
5305
5867
  "src/serialization/resources/organization/client/create.ts"() {
5306
5868
  "use strict";
5307
5869
  init_src();
5308
5870
  init_core();
5309
- Request = schemas_exports.object({
5310
- organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
5311
- artifactReadRequiresToken: schemas_exports.boolean().optional()
5312
- });
5313
5871
  Error13 = schemas_exports.union("error", {
5314
5872
  UnauthorizedError: schemas_exports.object({}),
5315
5873
  OrganizationAlreadyExistsError: schemas_exports.object({})
5316
5874
  }).transform({
5317
- parse: (value) => {
5875
+ transform: (value) => {
5318
5876
  switch (value.error) {
5319
5877
  case "UnauthorizedError":
5320
5878
  return api_exports.organization.create.Error.unauthorizedError();
@@ -5322,7 +5880,7 @@ var init_create2 = __esm({
5322
5880
  return api_exports.organization.create.Error.organizationAlreadyExistsError();
5323
5881
  }
5324
5882
  },
5325
- json: (value) => value
5883
+ untransform: ({ _visit, ...value }) => value
5326
5884
  });
5327
5885
  }
5328
5886
  });
@@ -5330,28 +5888,24 @@ var init_create2 = __esm({
5330
5888
  // src/serialization/resources/organization/client/update.ts
5331
5889
  var update_exports2 = {};
5332
5890
  __export(update_exports2, {
5333
- Error: () => Error14,
5334
- Request: () => Request2
5891
+ Error: () => Error14
5335
5892
  });
5336
- var Request2, Error14;
5893
+ var Error14;
5337
5894
  var init_update2 = __esm({
5338
5895
  "src/serialization/resources/organization/client/update.ts"() {
5339
5896
  "use strict";
5340
5897
  init_src();
5341
5898
  init_core();
5342
- Request2 = schemas_exports.object({
5343
- artifactReadRequiresToken: schemas_exports.boolean()
5344
- });
5345
5899
  Error14 = schemas_exports.union("error", {
5346
5900
  UnauthorizedError: schemas_exports.object({})
5347
5901
  }).transform({
5348
- parse: (value) => {
5902
+ transform: (value) => {
5349
5903
  switch (value.error) {
5350
5904
  case "UnauthorizedError":
5351
5905
  return api_exports.organization.update.Error.unauthorizedError();
5352
5906
  }
5353
5907
  },
5354
- json: (value) => value
5908
+ untransform: ({ _visit, ...value }) => value
5355
5909
  });
5356
5910
  }
5357
5911
  });
@@ -5359,26 +5913,24 @@ var init_update2 = __esm({
5359
5913
  // src/serialization/resources/organization/client/get.ts
5360
5914
  var get_exports2 = {};
5361
5915
  __export(get_exports2, {
5362
- Error: () => Error15,
5363
- Response: () => Response
5916
+ Error: () => Error15
5364
5917
  });
5365
- var Response, Error15;
5918
+ var Error15;
5366
5919
  var init_get2 = __esm({
5367
5920
  "src/serialization/resources/organization/client/get.ts"() {
5368
5921
  "use strict";
5369
5922
  init_src();
5370
5923
  init_core();
5371
- Response = schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).Organization);
5372
5924
  Error15 = schemas_exports.union("error", {
5373
5925
  UnauthorizedError: schemas_exports.object({})
5374
5926
  }).transform({
5375
- parse: (value) => {
5927
+ transform: (value) => {
5376
5928
  switch (value.error) {
5377
5929
  case "UnauthorizedError":
5378
5930
  return api_exports.organization.get.Error.unauthorizedError();
5379
5931
  }
5380
5932
  },
5381
- json: (value) => value
5933
+ untransform: ({ _visit, ...value }) => value
5382
5934
  });
5383
5935
  }
5384
5936
  });
@@ -5386,40 +5938,38 @@ var init_get2 = __esm({
5386
5938
  // src/serialization/resources/organization/client/isMember.ts
5387
5939
  var isMember_exports2 = {};
5388
5940
  __export(isMember_exports2, {
5389
- Response: () => Response2
5941
+ Response: () => Response
5390
5942
  });
5391
- var Response2;
5943
+ var Response;
5392
5944
  var init_isMember2 = __esm({
5393
5945
  "src/serialization/resources/organization/client/isMember.ts"() {
5394
5946
  "use strict";
5395
5947
  init_core();
5396
- Response2 = schemas_exports.boolean();
5948
+ Response = schemas_exports.boolean();
5397
5949
  }
5398
5950
  });
5399
5951
 
5400
5952
  // src/serialization/resources/organization/client/getMyOrganizationFromScopedToken.ts
5401
5953
  var getMyOrganizationFromScopedToken_exports2 = {};
5402
5954
  __export(getMyOrganizationFromScopedToken_exports2, {
5403
- Error: () => Error16,
5404
- Response: () => Response3
5955
+ Error: () => Error16
5405
5956
  });
5406
- var Response3, Error16;
5957
+ var Error16;
5407
5958
  var init_getMyOrganizationFromScopedToken2 = __esm({
5408
5959
  "src/serialization/resources/organization/client/getMyOrganizationFromScopedToken.ts"() {
5409
5960
  "use strict";
5410
5961
  init_src();
5411
5962
  init_core();
5412
- Response3 = schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).Organization);
5413
5963
  Error16 = schemas_exports.union("error", {
5414
5964
  UnauthorizedError: schemas_exports.object({})
5415
5965
  }).transform({
5416
- parse: (value) => {
5966
+ transform: (value) => {
5417
5967
  switch (value.error) {
5418
5968
  case "UnauthorizedError":
5419
5969
  return api_exports.organization.getMyOrganizationFromScopedToken.Error.unauthorizedError();
5420
5970
  }
5421
5971
  },
5422
- json: (value) => value
5972
+ untransform: ({ _visit, ...value }) => value
5423
5973
  });
5424
5974
  }
5425
5975
  });
@@ -5427,24 +5977,19 @@ var init_getMyOrganizationFromScopedToken2 = __esm({
5427
5977
  // src/serialization/resources/organization/client/addUser.ts
5428
5978
  var addUser_exports2 = {};
5429
5979
  __export(addUser_exports2, {
5430
- Error: () => Error17,
5431
- Request: () => Request3
5980
+ Error: () => Error17
5432
5981
  });
5433
- var Request3, Error17;
5982
+ var Error17;
5434
5983
  var init_addUser2 = __esm({
5435
5984
  "src/serialization/resources/organization/client/addUser.ts"() {
5436
5985
  "use strict";
5437
5986
  init_src();
5438
5987
  init_core();
5439
- Request3 = schemas_exports.object({
5440
- userId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).UserId),
5441
- orgId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId)
5442
- });
5443
5988
  Error17 = schemas_exports.union("error", {
5444
5989
  UnauthorizedError: schemas_exports.object({}),
5445
5990
  UserIdDoesNotExistError: schemas_exports.object({})
5446
5991
  }).transform({
5447
- parse: (value) => {
5992
+ transform: (value) => {
5448
5993
  switch (value.error) {
5449
5994
  case "UnauthorizedError":
5450
5995
  return api_exports.organization.addUser.Error.unauthorizedError();
@@ -5452,11 +5997,59 @@ var init_addUser2 = __esm({
5452
5997
  return api_exports.organization.addUser.Error.userIdDoesNotExistError();
5453
5998
  }
5454
5999
  },
5455
- json: (value) => value
6000
+ untransform: ({ _visit, ...value }) => value
6001
+ });
6002
+ }
6003
+ });
6004
+
6005
+ // src/serialization/resources/organization/client/requests/CreateOrganizationRequest.ts
6006
+ var CreateOrganizationRequest;
6007
+ var init_CreateOrganizationRequest = __esm({
6008
+ "src/serialization/resources/organization/client/requests/CreateOrganizationRequest.ts"() {
6009
+ "use strict";
6010
+ init_core();
6011
+ CreateOrganizationRequest = schemas_exports.object({
6012
+ organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
6013
+ artifactReadRequiresToken: schemas_exports.boolean().optional()
6014
+ });
6015
+ }
6016
+ });
6017
+
6018
+ // src/serialization/resources/organization/client/requests/UpdateOrganizationRequest.ts
6019
+ var UpdateOrganizationRequest;
6020
+ var init_UpdateOrganizationRequest = __esm({
6021
+ "src/serialization/resources/organization/client/requests/UpdateOrganizationRequest.ts"() {
6022
+ "use strict";
6023
+ init_core();
6024
+ UpdateOrganizationRequest = schemas_exports.object({
6025
+ artifactReadRequiresToken: schemas_exports.boolean()
6026
+ });
6027
+ }
6028
+ });
6029
+
6030
+ // src/serialization/resources/organization/client/requests/AddUserToOrgRequest.ts
6031
+ var AddUserToOrgRequest;
6032
+ var init_AddUserToOrgRequest = __esm({
6033
+ "src/serialization/resources/organization/client/requests/AddUserToOrgRequest.ts"() {
6034
+ "use strict";
6035
+ init_core();
6036
+ AddUserToOrgRequest = schemas_exports.object({
6037
+ userId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).UserId),
6038
+ orgId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId)
5456
6039
  });
5457
6040
  }
5458
6041
  });
5459
6042
 
6043
+ // src/serialization/resources/organization/client/requests/index.ts
6044
+ var init_requests4 = __esm({
6045
+ "src/serialization/resources/organization/client/requests/index.ts"() {
6046
+ "use strict";
6047
+ init_CreateOrganizationRequest();
6048
+ init_UpdateOrganizationRequest();
6049
+ init_AddUserToOrgRequest();
6050
+ }
6051
+ });
6052
+
5460
6053
  // src/serialization/resources/organization/client/index.ts
5461
6054
  var init_client4 = __esm({
5462
6055
  "src/serialization/resources/organization/client/index.ts"() {
@@ -5467,13 +6060,17 @@ var init_client4 = __esm({
5467
6060
  init_isMember2();
5468
6061
  init_getMyOrganizationFromScopedToken2();
5469
6062
  init_addUser2();
6063
+ init_requests4();
5470
6064
  }
5471
6065
  });
5472
6066
 
5473
6067
  // src/serialization/resources/organization/index.ts
5474
6068
  var organization_exports2 = {};
5475
6069
  __export(organization_exports2, {
6070
+ AddUserToOrgRequest: () => AddUserToOrgRequest,
6071
+ CreateOrganizationRequest: () => CreateOrganizationRequest,
5476
6072
  Organization: () => Organization,
6073
+ UpdateOrganizationRequest: () => UpdateOrganizationRequest,
5477
6074
  addUser: () => addUser_exports2,
5478
6075
  create: () => create_exports2,
5479
6076
  get: () => get_exports2,
@@ -5484,7 +6081,7 @@ __export(organization_exports2, {
5484
6081
  var init_organization2 = __esm({
5485
6082
  "src/serialization/resources/organization/index.ts"() {
5486
6083
  "use strict";
5487
- init_types8();
6084
+ init_types6();
5488
6085
  init_client4();
5489
6086
  }
5490
6087
  });
@@ -5538,7 +6135,7 @@ var init_RegistryToken2 = __esm({
5538
6135
  npm: schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).NpmRegistryToken),
5539
6136
  maven: schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).MavenRegistryToken)
5540
6137
  }).transform({
5541
- parse: (value) => {
6138
+ transform: (value) => {
5542
6139
  switch (value.type) {
5543
6140
  case "npm":
5544
6141
  return api_exports.RegistryToken.npm(value);
@@ -5548,13 +6145,13 @@ var init_RegistryToken2 = __esm({
5548
6145
  return api_exports.RegistryToken._unknown(value);
5549
6146
  }
5550
6147
  },
5551
- json: (value) => value
6148
+ untransform: ({ _visit, ...value }) => value
5552
6149
  });
5553
6150
  }
5554
6151
  });
5555
6152
 
5556
6153
  // src/serialization/resources/registry/types/index.ts
5557
- var init_types9 = __esm({
6154
+ var init_types7 = __esm({
5558
6155
  "src/serialization/resources/registry/types/index.ts"() {
5559
6156
  "use strict";
5560
6157
  init_RegistryTokens2();
@@ -5567,25 +6164,19 @@ var init_types9 = __esm({
5567
6164
  // src/serialization/resources/registry/client/generateRegistryTokens.ts
5568
6165
  var generateRegistryTokens_exports2 = {};
5569
6166
  __export(generateRegistryTokens_exports2, {
5570
- Error: () => Error18,
5571
- Request: () => Request4,
5572
- Response: () => Response4
6167
+ Error: () => Error18
5573
6168
  });
5574
- var Request4, Response4, Error18;
6169
+ var Error18;
5575
6170
  var init_generateRegistryTokens2 = __esm({
5576
6171
  "src/serialization/resources/registry/client/generateRegistryTokens.ts"() {
5577
6172
  "use strict";
5578
6173
  init_src();
5579
6174
  init_core();
5580
- Request4 = schemas_exports.object({
5581
- organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId)
5582
- });
5583
- Response4 = schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).RegistryTokens);
5584
6175
  Error18 = schemas_exports.union("error", {
5585
6176
  UnauthorizedError: schemas_exports.object({}),
5586
6177
  OrganizationNotFoundError: schemas_exports.object({})
5587
6178
  }).transform({
5588
- parse: (value) => {
6179
+ transform: (value) => {
5589
6180
  switch (value.error) {
5590
6181
  case "UnauthorizedError":
5591
6182
  return api_exports.registry.generateRegistryTokens.Error.unauthorizedError();
@@ -5593,7 +6184,7 @@ var init_generateRegistryTokens2 = __esm({
5593
6184
  return api_exports.registry.generateRegistryTokens.Error.organizationNotFoundError();
5594
6185
  }
5595
6186
  },
5596
- json: (value) => value
6187
+ untransform: ({ _visit, ...value }) => value
5597
6188
  });
5598
6189
  }
5599
6190
  });
@@ -5602,25 +6193,20 @@ var init_generateRegistryTokens2 = __esm({
5602
6193
  var hasRegistryPermission_exports2 = {};
5603
6194
  __export(hasRegistryPermission_exports2, {
5604
6195
  Error: () => Error19,
5605
- Request: () => Request5,
5606
- Response: () => Response5
6196
+ Response: () => Response2
5607
6197
  });
5608
- var Request5, Response5, Error19;
6198
+ var Response2, Error19;
5609
6199
  var init_hasRegistryPermission2 = __esm({
5610
6200
  "src/serialization/resources/registry/client/hasRegistryPermission.ts"() {
5611
6201
  "use strict";
5612
- init_src();
5613
6202
  init_core();
5614
- Request5 = schemas_exports.object({
5615
- organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
5616
- token: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).RegistryToken).optional()
5617
- });
5618
- Response5 = schemas_exports.boolean();
6203
+ init_src();
6204
+ Response2 = schemas_exports.boolean();
5619
6205
  Error19 = schemas_exports.union("error", {
5620
6206
  UnauthorizedError: schemas_exports.object({}),
5621
6207
  OrganizationNotFoundError: schemas_exports.object({})
5622
6208
  }).transform({
5623
- parse: (value) => {
6209
+ transform: (value) => {
5624
6210
  switch (value.error) {
5625
6211
  case "UnauthorizedError":
5626
6212
  return api_exports.registry.hasRegistryPermission.Error.unauthorizedError();
@@ -5628,7 +6214,7 @@ var init_hasRegistryPermission2 = __esm({
5628
6214
  return api_exports.registry.hasRegistryPermission.Error.organizationNotFoundError();
5629
6215
  }
5630
6216
  },
5631
- json: (value) => value
6217
+ untransform: ({ _visit, ...value }) => value
5632
6218
  });
5633
6219
  }
5634
6220
  });
@@ -5636,24 +6222,19 @@ var init_hasRegistryPermission2 = __esm({
5636
6222
  // src/serialization/resources/registry/client/revokeToken.ts
5637
6223
  var revokeToken_exports2 = {};
5638
6224
  __export(revokeToken_exports2, {
5639
- Error: () => Error20,
5640
- Request: () => Request6
6225
+ Error: () => Error20
5641
6226
  });
5642
- var Request6, Error20;
6227
+ var Error20;
5643
6228
  var init_revokeToken2 = __esm({
5644
6229
  "src/serialization/resources/registry/client/revokeToken.ts"() {
5645
6230
  "use strict";
5646
6231
  init_src();
5647
6232
  init_core();
5648
- Request6 = schemas_exports.object({
5649
- organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
5650
- token: schemas_exports.string()
5651
- });
5652
6233
  Error20 = schemas_exports.union("error", {
5653
6234
  UnauthorizedError: schemas_exports.object({}),
5654
6235
  OrganizationNotFoundError: schemas_exports.object({})
5655
6236
  }).transform({
5656
- parse: (value) => {
6237
+ transform: (value) => {
5657
6238
  switch (value.error) {
5658
6239
  case "UnauthorizedError":
5659
6240
  return api_exports.registry.revokeToken.Error.unauthorizedError();
@@ -5661,11 +6242,59 @@ var init_revokeToken2 = __esm({
5661
6242
  return api_exports.registry.revokeToken.Error.organizationNotFoundError();
5662
6243
  }
5663
6244
  },
5664
- json: (value) => value
6245
+ untransform: ({ _visit, ...value }) => value
6246
+ });
6247
+ }
6248
+ });
6249
+
6250
+ // src/serialization/resources/registry/client/requests/GenerateRegistryTokensRequest.ts
6251
+ var GenerateRegistryTokensRequest;
6252
+ var init_GenerateRegistryTokensRequest = __esm({
6253
+ "src/serialization/resources/registry/client/requests/GenerateRegistryTokensRequest.ts"() {
6254
+ "use strict";
6255
+ init_core();
6256
+ GenerateRegistryTokensRequest = schemas_exports.object({
6257
+ organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId)
5665
6258
  });
5666
6259
  }
5667
6260
  });
5668
6261
 
6262
+ // src/serialization/resources/registry/client/requests/CheckRegistryPermissionRequest.ts
6263
+ var CheckRegistryPermissionRequest;
6264
+ var init_CheckRegistryPermissionRequest = __esm({
6265
+ "src/serialization/resources/registry/client/requests/CheckRegistryPermissionRequest.ts"() {
6266
+ "use strict";
6267
+ init_core();
6268
+ CheckRegistryPermissionRequest = schemas_exports.object({
6269
+ organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
6270
+ token: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).RegistryToken).optional()
6271
+ });
6272
+ }
6273
+ });
6274
+
6275
+ // src/serialization/resources/registry/client/requests/RevokeTokenRequest.ts
6276
+ var RevokeTokenRequest;
6277
+ var init_RevokeTokenRequest = __esm({
6278
+ "src/serialization/resources/registry/client/requests/RevokeTokenRequest.ts"() {
6279
+ "use strict";
6280
+ init_core();
6281
+ RevokeTokenRequest = schemas_exports.object({
6282
+ organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
6283
+ token: schemas_exports.string()
6284
+ });
6285
+ }
6286
+ });
6287
+
6288
+ // src/serialization/resources/registry/client/requests/index.ts
6289
+ var init_requests5 = __esm({
6290
+ "src/serialization/resources/registry/client/requests/index.ts"() {
6291
+ "use strict";
6292
+ init_GenerateRegistryTokensRequest();
6293
+ init_CheckRegistryPermissionRequest();
6294
+ init_RevokeTokenRequest();
6295
+ }
6296
+ });
6297
+
5669
6298
  // src/serialization/resources/registry/client/index.ts
5670
6299
  var init_client5 = __esm({
5671
6300
  "src/serialization/resources/registry/client/index.ts"() {
@@ -5673,16 +6302,20 @@ var init_client5 = __esm({
5673
6302
  init_generateRegistryTokens2();
5674
6303
  init_hasRegistryPermission2();
5675
6304
  init_revokeToken2();
6305
+ init_requests5();
5676
6306
  }
5677
6307
  });
5678
6308
 
5679
6309
  // src/serialization/resources/registry/index.ts
5680
6310
  var registry_exports2 = {};
5681
6311
  __export(registry_exports2, {
6312
+ CheckRegistryPermissionRequest: () => CheckRegistryPermissionRequest,
6313
+ GenerateRegistryTokensRequest: () => GenerateRegistryTokensRequest,
5682
6314
  MavenRegistryToken: () => MavenRegistryToken,
5683
6315
  NpmRegistryToken: () => NpmRegistryToken,
5684
6316
  RegistryToken: () => RegistryToken2,
5685
6317
  RegistryTokens: () => RegistryTokens,
6318
+ RevokeTokenRequest: () => RevokeTokenRequest,
5686
6319
  generateRegistryTokens: () => generateRegistryTokens_exports2,
5687
6320
  hasRegistryPermission: () => hasRegistryPermission_exports2,
5688
6321
  revokeToken: () => revokeToken_exports2
@@ -5690,7 +6323,7 @@ __export(registry_exports2, {
5690
6323
  var init_registry2 = __esm({
5691
6324
  "src/serialization/resources/registry/index.ts"() {
5692
6325
  "use strict";
5693
- init_types9();
6326
+ init_types7();
5694
6327
  init_client5();
5695
6328
  }
5696
6329
  });
@@ -5728,7 +6361,7 @@ var init_OrganizationsPage2 = __esm({
5728
6361
  });
5729
6362
 
5730
6363
  // src/serialization/resources/user/types/index.ts
5731
- var init_types10 = __esm({
6364
+ var init_types8 = __esm({
5732
6365
  "src/serialization/resources/user/types/index.ts"() {
5733
6366
  "use strict";
5734
6367
  init_User2();
@@ -5736,56 +6369,16 @@ var init_types10 = __esm({
5736
6369
  }
5737
6370
  });
5738
6371
 
5739
- // src/serialization/resources/user/client/getMyself.ts
5740
- var getMyself_exports2 = {};
5741
- __export(getMyself_exports2, {
5742
- Response: () => Response6
5743
- });
5744
- var Response6;
5745
- var init_getMyself2 = __esm({
5746
- "src/serialization/resources/user/client/getMyself.ts"() {
5747
- "use strict";
5748
- init_core();
5749
- Response6 = schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).User);
5750
- }
5751
- });
5752
-
5753
- // src/serialization/resources/user/client/getMyOrganizations.ts
5754
- var getMyOrganizations_exports2 = {};
5755
- __export(getMyOrganizations_exports2, {
5756
- Response: () => Response7
5757
- });
5758
- var Response7;
5759
- var init_getMyOrganizations2 = __esm({
5760
- "src/serialization/resources/user/client/getMyOrganizations.ts"() {
5761
- "use strict";
5762
- init_core();
5763
- Response7 = schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationsPage);
5764
- }
5765
- });
5766
-
5767
- // src/serialization/resources/user/client/index.ts
5768
- var init_client6 = __esm({
5769
- "src/serialization/resources/user/client/index.ts"() {
5770
- "use strict";
5771
- init_getMyself2();
5772
- init_getMyOrganizations2();
5773
- }
5774
- });
5775
-
5776
6372
  // src/serialization/resources/user/index.ts
5777
6373
  var user_exports2 = {};
5778
6374
  __export(user_exports2, {
5779
6375
  OrganizationsPage: () => OrganizationsPage,
5780
- User: () => User,
5781
- getMyOrganizations: () => getMyOrganizations_exports2,
5782
- getMyself: () => getMyself_exports2
6376
+ User: () => User
5783
6377
  });
5784
6378
  var init_user2 = __esm({
5785
6379
  "src/serialization/resources/user/index.ts"() {
5786
6380
  "use strict";
5787
- init_types10();
5788
- init_client6();
6381
+ init_types8();
5789
6382
  }
5790
6383
  });
5791
6384
 
@@ -5794,19 +6387,25 @@ var init_resources2 = __esm({
5794
6387
  "src/serialization/resources/index.ts"() {
5795
6388
  "use strict";
5796
6389
  init_commons2();
5797
- init_types7();
6390
+ init_types5();
5798
6391
  init_organization2();
5799
- init_types8();
6392
+ init_types6();
5800
6393
  init_registry2();
5801
- init_types9();
6394
+ init_types7();
5802
6395
  init_user2();
5803
- init_types10();
6396
+ init_types8();
6397
+ init_requests4();
6398
+ init_requests5();
5804
6399
  }
5805
6400
  });
5806
6401
 
5807
6402
  // src/serialization/index.ts
5808
6403
  var serialization_exports = {};
5809
6404
  __export(serialization_exports, {
6405
+ AddUserToOrgRequest: () => AddUserToOrgRequest,
6406
+ CheckRegistryPermissionRequest: () => CheckRegistryPermissionRequest,
6407
+ CreateOrganizationRequest: () => CreateOrganizationRequest,
6408
+ GenerateRegistryTokensRequest: () => GenerateRegistryTokensRequest,
5810
6409
  MavenRegistryToken: () => MavenRegistryToken,
5811
6410
  NpmRegistryToken: () => NpmRegistryToken,
5812
6411
  Organization: () => Organization,
@@ -5814,6 +6413,8 @@ __export(serialization_exports, {
5814
6413
  OrganizationsPage: () => OrganizationsPage,
5815
6414
  RegistryToken: () => RegistryToken2,
5816
6415
  RegistryTokens: () => RegistryTokens,
6416
+ RevokeTokenRequest: () => RevokeTokenRequest,
6417
+ UpdateOrganizationRequest: () => UpdateOrganizationRequest,
5817
6418
  User: () => User,
5818
6419
  UserId: () => UserId2,
5819
6420
  commons: () => commons_exports2,