@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;
1137
- },
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;
1146
- } else {
1147
- const value = await schemaOrObjectProperty.json(parsedPropertyValue);
1148
- raw[parsedKey] = value;
1297
+ return validateAndTransformObject({
1298
+ value: raw,
1299
+ requiredKeys,
1300
+ getProperty: (rawKey) => {
1301
+ const property2 = rawKeyToProperty[rawKey];
1302
+ if (property2 == null) {
1303
+ return void 0;
1149
1304
  }
1150
- } else if (includeUnknownKeysOnJson && parsedPropertyValue != null) {
1151
- raw[parsedKey] = parsedPropertyValue;
1305
+ return {
1306
+ transformedKey: property2.parsedKey,
1307
+ transform: (propertyValue) => property2.valueSchema.parse(propertyValue, opts)
1308
+ };
1309
+ },
1310
+ allowUnknownKeys: opts?.allowUnknownKeys ?? false
1311
+ });
1312
+ },
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);
1152
1319
  }
1153
1320
  }
1154
- return raw;
1155
- }
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
+ };
1334
+ } else {
1335
+ return {
1336
+ transformedKey: parsedKey,
1337
+ transform: (propertyValue) => property2.json(propertyValue, opts)
1338
+ };
1339
+ }
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
 
@@ -3639,7 +4202,7 @@ var require_utils = __commonJS({
3639
4202
  function isObject(val) {
3640
4203
  return val !== null && typeof val === "object";
3641
4204
  }
3642
- function isPlainObject(val) {
4205
+ function isPlainObject2(val) {
3643
4206
  if (kindOf(val) !== "object") {
3644
4207
  return false;
3645
4208
  }
@@ -3692,9 +4255,9 @@ var require_utils = __commonJS({
3692
4255
  function merge() {
3693
4256
  var result = {};
3694
4257
  function assignValue(val, key) {
3695
- if (isPlainObject(result[key]) && isPlainObject(val)) {
4258
+ if (isPlainObject2(result[key]) && isPlainObject2(val)) {
3696
4259
  result[key] = merge(result[key], val);
3697
- } else if (isPlainObject(val)) {
4260
+ } else if (isPlainObject2(val)) {
3698
4261
  result[key] = merge({}, val);
3699
4262
  } else if (isArray(val)) {
3700
4263
  result[key] = val.slice();
@@ -3783,7 +4346,7 @@ var require_utils = __commonJS({
3783
4346
  isString,
3784
4347
  isNumber,
3785
4348
  isObject,
3786
- isPlainObject,
4349
+ isPlainObject: isPlainObject2,
3787
4350
  isUndefined,
3788
4351
  isDate,
3789
4352
  isFile,
@@ -5229,8 +5792,8 @@ var init_OrganizationId2 = __esm({
5229
5792
  init_src();
5230
5793
  init_core();
5231
5794
  OrganizationId2 = schemas_exports.string().transform({
5232
- parse: api_exports.OrganizationId,
5233
- json: (value) => value
5795
+ transform: api_exports.OrganizationId,
5796
+ untransform: (value) => value
5234
5797
  });
5235
5798
  }
5236
5799
  });
@@ -5243,14 +5806,14 @@ var init_UserId2 = __esm({
5243
5806
  init_src();
5244
5807
  init_core();
5245
5808
  UserId2 = schemas_exports.string().transform({
5246
- parse: api_exports.UserId,
5247
- json: (value) => value
5809
+ transform: api_exports.UserId,
5810
+ untransform: (value) => value
5248
5811
  });
5249
5812
  }
5250
5813
  });
5251
5814
 
5252
5815
  // src/serialization/resources/commons/types/index.ts
5253
- var init_types7 = __esm({
5816
+ var init_types5 = __esm({
5254
5817
  "src/serialization/resources/commons/types/index.ts"() {
5255
5818
  "use strict";
5256
5819
  init_OrganizationId2();
@@ -5267,7 +5830,7 @@ __export(commons_exports2, {
5267
5830
  var init_commons2 = __esm({
5268
5831
  "src/serialization/resources/commons/index.ts"() {
5269
5832
  "use strict";
5270
- init_types7();
5833
+ init_types5();
5271
5834
  }
5272
5835
  });
5273
5836
 
@@ -5285,7 +5848,7 @@ var init_Organization2 = __esm({
5285
5848
  });
5286
5849
 
5287
5850
  // src/serialization/resources/organization/types/index.ts
5288
- var init_types8 = __esm({
5851
+ var init_types6 = __esm({
5289
5852
  "src/serialization/resources/organization/types/index.ts"() {
5290
5853
  "use strict";
5291
5854
  init_Organization2();
@@ -5295,24 +5858,19 @@ var init_types8 = __esm({
5295
5858
  // src/serialization/resources/organization/client/create.ts
5296
5859
  var create_exports2 = {};
5297
5860
  __export(create_exports2, {
5298
- Error: () => Error13,
5299
- Request: () => Request
5861
+ Error: () => Error13
5300
5862
  });
5301
- var Request, Error13;
5863
+ var Error13;
5302
5864
  var init_create2 = __esm({
5303
5865
  "src/serialization/resources/organization/client/create.ts"() {
5304
5866
  "use strict";
5305
5867
  init_src();
5306
5868
  init_core();
5307
- Request = schemas_exports.object({
5308
- organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
5309
- artifactReadRequiresToken: schemas_exports.boolean().optional()
5310
- });
5311
5869
  Error13 = schemas_exports.union("error", {
5312
5870
  UnauthorizedError: schemas_exports.object({}),
5313
5871
  OrganizationAlreadyExistsError: schemas_exports.object({})
5314
5872
  }).transform({
5315
- parse: (value) => {
5873
+ transform: (value) => {
5316
5874
  switch (value.error) {
5317
5875
  case "UnauthorizedError":
5318
5876
  return api_exports.organization.create.Error.unauthorizedError();
@@ -5320,7 +5878,7 @@ var init_create2 = __esm({
5320
5878
  return api_exports.organization.create.Error.organizationAlreadyExistsError();
5321
5879
  }
5322
5880
  },
5323
- json: (value) => value
5881
+ untransform: ({ _visit, ...value }) => value
5324
5882
  });
5325
5883
  }
5326
5884
  });
@@ -5328,28 +5886,24 @@ var init_create2 = __esm({
5328
5886
  // src/serialization/resources/organization/client/update.ts
5329
5887
  var update_exports2 = {};
5330
5888
  __export(update_exports2, {
5331
- Error: () => Error14,
5332
- Request: () => Request2
5889
+ Error: () => Error14
5333
5890
  });
5334
- var Request2, Error14;
5891
+ var Error14;
5335
5892
  var init_update2 = __esm({
5336
5893
  "src/serialization/resources/organization/client/update.ts"() {
5337
5894
  "use strict";
5338
5895
  init_src();
5339
5896
  init_core();
5340
- Request2 = schemas_exports.object({
5341
- artifactReadRequiresToken: schemas_exports.boolean()
5342
- });
5343
5897
  Error14 = schemas_exports.union("error", {
5344
5898
  UnauthorizedError: schemas_exports.object({})
5345
5899
  }).transform({
5346
- parse: (value) => {
5900
+ transform: (value) => {
5347
5901
  switch (value.error) {
5348
5902
  case "UnauthorizedError":
5349
5903
  return api_exports.organization.update.Error.unauthorizedError();
5350
5904
  }
5351
5905
  },
5352
- json: (value) => value
5906
+ untransform: ({ _visit, ...value }) => value
5353
5907
  });
5354
5908
  }
5355
5909
  });
@@ -5357,26 +5911,24 @@ var init_update2 = __esm({
5357
5911
  // src/serialization/resources/organization/client/get.ts
5358
5912
  var get_exports2 = {};
5359
5913
  __export(get_exports2, {
5360
- Error: () => Error15,
5361
- Response: () => Response
5914
+ Error: () => Error15
5362
5915
  });
5363
- var Response, Error15;
5916
+ var Error15;
5364
5917
  var init_get2 = __esm({
5365
5918
  "src/serialization/resources/organization/client/get.ts"() {
5366
5919
  "use strict";
5367
5920
  init_src();
5368
5921
  init_core();
5369
- Response = schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).Organization);
5370
5922
  Error15 = schemas_exports.union("error", {
5371
5923
  UnauthorizedError: schemas_exports.object({})
5372
5924
  }).transform({
5373
- parse: (value) => {
5925
+ transform: (value) => {
5374
5926
  switch (value.error) {
5375
5927
  case "UnauthorizedError":
5376
5928
  return api_exports.organization.get.Error.unauthorizedError();
5377
5929
  }
5378
5930
  },
5379
- json: (value) => value
5931
+ untransform: ({ _visit, ...value }) => value
5380
5932
  });
5381
5933
  }
5382
5934
  });
@@ -5384,40 +5936,38 @@ var init_get2 = __esm({
5384
5936
  // src/serialization/resources/organization/client/isMember.ts
5385
5937
  var isMember_exports2 = {};
5386
5938
  __export(isMember_exports2, {
5387
- Response: () => Response2
5939
+ Response: () => Response
5388
5940
  });
5389
- var Response2;
5941
+ var Response;
5390
5942
  var init_isMember2 = __esm({
5391
5943
  "src/serialization/resources/organization/client/isMember.ts"() {
5392
5944
  "use strict";
5393
5945
  init_core();
5394
- Response2 = schemas_exports.boolean();
5946
+ Response = schemas_exports.boolean();
5395
5947
  }
5396
5948
  });
5397
5949
 
5398
5950
  // src/serialization/resources/organization/client/getMyOrganizationFromScopedToken.ts
5399
5951
  var getMyOrganizationFromScopedToken_exports2 = {};
5400
5952
  __export(getMyOrganizationFromScopedToken_exports2, {
5401
- Error: () => Error16,
5402
- Response: () => Response3
5953
+ Error: () => Error16
5403
5954
  });
5404
- var Response3, Error16;
5955
+ var Error16;
5405
5956
  var init_getMyOrganizationFromScopedToken2 = __esm({
5406
5957
  "src/serialization/resources/organization/client/getMyOrganizationFromScopedToken.ts"() {
5407
5958
  "use strict";
5408
5959
  init_src();
5409
5960
  init_core();
5410
- Response3 = schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).Organization);
5411
5961
  Error16 = schemas_exports.union("error", {
5412
5962
  UnauthorizedError: schemas_exports.object({})
5413
5963
  }).transform({
5414
- parse: (value) => {
5964
+ transform: (value) => {
5415
5965
  switch (value.error) {
5416
5966
  case "UnauthorizedError":
5417
5967
  return api_exports.organization.getMyOrganizationFromScopedToken.Error.unauthorizedError();
5418
5968
  }
5419
5969
  },
5420
- json: (value) => value
5970
+ untransform: ({ _visit, ...value }) => value
5421
5971
  });
5422
5972
  }
5423
5973
  });
@@ -5425,24 +5975,19 @@ var init_getMyOrganizationFromScopedToken2 = __esm({
5425
5975
  // src/serialization/resources/organization/client/addUser.ts
5426
5976
  var addUser_exports2 = {};
5427
5977
  __export(addUser_exports2, {
5428
- Error: () => Error17,
5429
- Request: () => Request3
5978
+ Error: () => Error17
5430
5979
  });
5431
- var Request3, Error17;
5980
+ var Error17;
5432
5981
  var init_addUser2 = __esm({
5433
5982
  "src/serialization/resources/organization/client/addUser.ts"() {
5434
5983
  "use strict";
5435
5984
  init_src();
5436
5985
  init_core();
5437
- Request3 = schemas_exports.object({
5438
- userId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).UserId),
5439
- orgId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId)
5440
- });
5441
5986
  Error17 = schemas_exports.union("error", {
5442
5987
  UnauthorizedError: schemas_exports.object({}),
5443
5988
  UserIdDoesNotExistError: schemas_exports.object({})
5444
5989
  }).transform({
5445
- parse: (value) => {
5990
+ transform: (value) => {
5446
5991
  switch (value.error) {
5447
5992
  case "UnauthorizedError":
5448
5993
  return api_exports.organization.addUser.Error.unauthorizedError();
@@ -5450,11 +5995,59 @@ var init_addUser2 = __esm({
5450
5995
  return api_exports.organization.addUser.Error.userIdDoesNotExistError();
5451
5996
  }
5452
5997
  },
5453
- json: (value) => value
5998
+ untransform: ({ _visit, ...value }) => value
5999
+ });
6000
+ }
6001
+ });
6002
+
6003
+ // src/serialization/resources/organization/client/requests/CreateOrganizationRequest.ts
6004
+ var CreateOrganizationRequest;
6005
+ var init_CreateOrganizationRequest = __esm({
6006
+ "src/serialization/resources/organization/client/requests/CreateOrganizationRequest.ts"() {
6007
+ "use strict";
6008
+ init_core();
6009
+ CreateOrganizationRequest = schemas_exports.object({
6010
+ organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
6011
+ artifactReadRequiresToken: schemas_exports.boolean().optional()
6012
+ });
6013
+ }
6014
+ });
6015
+
6016
+ // src/serialization/resources/organization/client/requests/UpdateOrganizationRequest.ts
6017
+ var UpdateOrganizationRequest;
6018
+ var init_UpdateOrganizationRequest = __esm({
6019
+ "src/serialization/resources/organization/client/requests/UpdateOrganizationRequest.ts"() {
6020
+ "use strict";
6021
+ init_core();
6022
+ UpdateOrganizationRequest = schemas_exports.object({
6023
+ artifactReadRequiresToken: schemas_exports.boolean()
6024
+ });
6025
+ }
6026
+ });
6027
+
6028
+ // src/serialization/resources/organization/client/requests/AddUserToOrgRequest.ts
6029
+ var AddUserToOrgRequest;
6030
+ var init_AddUserToOrgRequest = __esm({
6031
+ "src/serialization/resources/organization/client/requests/AddUserToOrgRequest.ts"() {
6032
+ "use strict";
6033
+ init_core();
6034
+ AddUserToOrgRequest = schemas_exports.object({
6035
+ userId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).UserId),
6036
+ orgId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId)
5454
6037
  });
5455
6038
  }
5456
6039
  });
5457
6040
 
6041
+ // src/serialization/resources/organization/client/requests/index.ts
6042
+ var init_requests4 = __esm({
6043
+ "src/serialization/resources/organization/client/requests/index.ts"() {
6044
+ "use strict";
6045
+ init_CreateOrganizationRequest();
6046
+ init_UpdateOrganizationRequest();
6047
+ init_AddUserToOrgRequest();
6048
+ }
6049
+ });
6050
+
5458
6051
  // src/serialization/resources/organization/client/index.ts
5459
6052
  var init_client4 = __esm({
5460
6053
  "src/serialization/resources/organization/client/index.ts"() {
@@ -5465,13 +6058,17 @@ var init_client4 = __esm({
5465
6058
  init_isMember2();
5466
6059
  init_getMyOrganizationFromScopedToken2();
5467
6060
  init_addUser2();
6061
+ init_requests4();
5468
6062
  }
5469
6063
  });
5470
6064
 
5471
6065
  // src/serialization/resources/organization/index.ts
5472
6066
  var organization_exports2 = {};
5473
6067
  __export(organization_exports2, {
6068
+ AddUserToOrgRequest: () => AddUserToOrgRequest,
6069
+ CreateOrganizationRequest: () => CreateOrganizationRequest,
5474
6070
  Organization: () => Organization,
6071
+ UpdateOrganizationRequest: () => UpdateOrganizationRequest,
5475
6072
  addUser: () => addUser_exports2,
5476
6073
  create: () => create_exports2,
5477
6074
  get: () => get_exports2,
@@ -5482,7 +6079,7 @@ __export(organization_exports2, {
5482
6079
  var init_organization2 = __esm({
5483
6080
  "src/serialization/resources/organization/index.ts"() {
5484
6081
  "use strict";
5485
- init_types8();
6082
+ init_types6();
5486
6083
  init_client4();
5487
6084
  }
5488
6085
  });
@@ -5536,7 +6133,7 @@ var init_RegistryToken2 = __esm({
5536
6133
  npm: schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).NpmRegistryToken),
5537
6134
  maven: schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).MavenRegistryToken)
5538
6135
  }).transform({
5539
- parse: (value) => {
6136
+ transform: (value) => {
5540
6137
  switch (value.type) {
5541
6138
  case "npm":
5542
6139
  return api_exports.RegistryToken.npm(value);
@@ -5546,13 +6143,13 @@ var init_RegistryToken2 = __esm({
5546
6143
  return api_exports.RegistryToken._unknown(value);
5547
6144
  }
5548
6145
  },
5549
- json: (value) => value
6146
+ untransform: ({ _visit, ...value }) => value
5550
6147
  });
5551
6148
  }
5552
6149
  });
5553
6150
 
5554
6151
  // src/serialization/resources/registry/types/index.ts
5555
- var init_types9 = __esm({
6152
+ var init_types7 = __esm({
5556
6153
  "src/serialization/resources/registry/types/index.ts"() {
5557
6154
  "use strict";
5558
6155
  init_RegistryTokens2();
@@ -5565,25 +6162,19 @@ var init_types9 = __esm({
5565
6162
  // src/serialization/resources/registry/client/generateRegistryTokens.ts
5566
6163
  var generateRegistryTokens_exports2 = {};
5567
6164
  __export(generateRegistryTokens_exports2, {
5568
- Error: () => Error18,
5569
- Request: () => Request4,
5570
- Response: () => Response4
6165
+ Error: () => Error18
5571
6166
  });
5572
- var Request4, Response4, Error18;
6167
+ var Error18;
5573
6168
  var init_generateRegistryTokens2 = __esm({
5574
6169
  "src/serialization/resources/registry/client/generateRegistryTokens.ts"() {
5575
6170
  "use strict";
5576
6171
  init_src();
5577
6172
  init_core();
5578
- Request4 = schemas_exports.object({
5579
- organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId)
5580
- });
5581
- Response4 = schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).RegistryTokens);
5582
6173
  Error18 = schemas_exports.union("error", {
5583
6174
  UnauthorizedError: schemas_exports.object({}),
5584
6175
  OrganizationNotFoundError: schemas_exports.object({})
5585
6176
  }).transform({
5586
- parse: (value) => {
6177
+ transform: (value) => {
5587
6178
  switch (value.error) {
5588
6179
  case "UnauthorizedError":
5589
6180
  return api_exports.registry.generateRegistryTokens.Error.unauthorizedError();
@@ -5591,7 +6182,7 @@ var init_generateRegistryTokens2 = __esm({
5591
6182
  return api_exports.registry.generateRegistryTokens.Error.organizationNotFoundError();
5592
6183
  }
5593
6184
  },
5594
- json: (value) => value
6185
+ untransform: ({ _visit, ...value }) => value
5595
6186
  });
5596
6187
  }
5597
6188
  });
@@ -5600,25 +6191,20 @@ var init_generateRegistryTokens2 = __esm({
5600
6191
  var hasRegistryPermission_exports2 = {};
5601
6192
  __export(hasRegistryPermission_exports2, {
5602
6193
  Error: () => Error19,
5603
- Request: () => Request5,
5604
- Response: () => Response5
6194
+ Response: () => Response2
5605
6195
  });
5606
- var Request5, Response5, Error19;
6196
+ var Response2, Error19;
5607
6197
  var init_hasRegistryPermission2 = __esm({
5608
6198
  "src/serialization/resources/registry/client/hasRegistryPermission.ts"() {
5609
6199
  "use strict";
5610
- init_src();
5611
6200
  init_core();
5612
- Request5 = schemas_exports.object({
5613
- organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
5614
- token: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).RegistryToken).optional()
5615
- });
5616
- Response5 = schemas_exports.boolean();
6201
+ init_src();
6202
+ Response2 = schemas_exports.boolean();
5617
6203
  Error19 = schemas_exports.union("error", {
5618
6204
  UnauthorizedError: schemas_exports.object({}),
5619
6205
  OrganizationNotFoundError: schemas_exports.object({})
5620
6206
  }).transform({
5621
- parse: (value) => {
6207
+ transform: (value) => {
5622
6208
  switch (value.error) {
5623
6209
  case "UnauthorizedError":
5624
6210
  return api_exports.registry.hasRegistryPermission.Error.unauthorizedError();
@@ -5626,7 +6212,7 @@ var init_hasRegistryPermission2 = __esm({
5626
6212
  return api_exports.registry.hasRegistryPermission.Error.organizationNotFoundError();
5627
6213
  }
5628
6214
  },
5629
- json: (value) => value
6215
+ untransform: ({ _visit, ...value }) => value
5630
6216
  });
5631
6217
  }
5632
6218
  });
@@ -5634,24 +6220,19 @@ var init_hasRegistryPermission2 = __esm({
5634
6220
  // src/serialization/resources/registry/client/revokeToken.ts
5635
6221
  var revokeToken_exports2 = {};
5636
6222
  __export(revokeToken_exports2, {
5637
- Error: () => Error20,
5638
- Request: () => Request6
6223
+ Error: () => Error20
5639
6224
  });
5640
- var Request6, Error20;
6225
+ var Error20;
5641
6226
  var init_revokeToken2 = __esm({
5642
6227
  "src/serialization/resources/registry/client/revokeToken.ts"() {
5643
6228
  "use strict";
5644
6229
  init_src();
5645
6230
  init_core();
5646
- Request6 = schemas_exports.object({
5647
- organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
5648
- token: schemas_exports.string()
5649
- });
5650
6231
  Error20 = schemas_exports.union("error", {
5651
6232
  UnauthorizedError: schemas_exports.object({}),
5652
6233
  OrganizationNotFoundError: schemas_exports.object({})
5653
6234
  }).transform({
5654
- parse: (value) => {
6235
+ transform: (value) => {
5655
6236
  switch (value.error) {
5656
6237
  case "UnauthorizedError":
5657
6238
  return api_exports.registry.revokeToken.Error.unauthorizedError();
@@ -5659,11 +6240,59 @@ var init_revokeToken2 = __esm({
5659
6240
  return api_exports.registry.revokeToken.Error.organizationNotFoundError();
5660
6241
  }
5661
6242
  },
5662
- json: (value) => value
6243
+ untransform: ({ _visit, ...value }) => value
6244
+ });
6245
+ }
6246
+ });
6247
+
6248
+ // src/serialization/resources/registry/client/requests/GenerateRegistryTokensRequest.ts
6249
+ var GenerateRegistryTokensRequest;
6250
+ var init_GenerateRegistryTokensRequest = __esm({
6251
+ "src/serialization/resources/registry/client/requests/GenerateRegistryTokensRequest.ts"() {
6252
+ "use strict";
6253
+ init_core();
6254
+ GenerateRegistryTokensRequest = schemas_exports.object({
6255
+ organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId)
5663
6256
  });
5664
6257
  }
5665
6258
  });
5666
6259
 
6260
+ // src/serialization/resources/registry/client/requests/CheckRegistryPermissionRequest.ts
6261
+ var CheckRegistryPermissionRequest;
6262
+ var init_CheckRegistryPermissionRequest = __esm({
6263
+ "src/serialization/resources/registry/client/requests/CheckRegistryPermissionRequest.ts"() {
6264
+ "use strict";
6265
+ init_core();
6266
+ CheckRegistryPermissionRequest = schemas_exports.object({
6267
+ organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
6268
+ token: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).RegistryToken).optional()
6269
+ });
6270
+ }
6271
+ });
6272
+
6273
+ // src/serialization/resources/registry/client/requests/RevokeTokenRequest.ts
6274
+ var RevokeTokenRequest;
6275
+ var init_RevokeTokenRequest = __esm({
6276
+ "src/serialization/resources/registry/client/requests/RevokeTokenRequest.ts"() {
6277
+ "use strict";
6278
+ init_core();
6279
+ RevokeTokenRequest = schemas_exports.object({
6280
+ organizationId: schemas_exports.lazy(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationId),
6281
+ token: schemas_exports.string()
6282
+ });
6283
+ }
6284
+ });
6285
+
6286
+ // src/serialization/resources/registry/client/requests/index.ts
6287
+ var init_requests5 = __esm({
6288
+ "src/serialization/resources/registry/client/requests/index.ts"() {
6289
+ "use strict";
6290
+ init_GenerateRegistryTokensRequest();
6291
+ init_CheckRegistryPermissionRequest();
6292
+ init_RevokeTokenRequest();
6293
+ }
6294
+ });
6295
+
5667
6296
  // src/serialization/resources/registry/client/index.ts
5668
6297
  var init_client5 = __esm({
5669
6298
  "src/serialization/resources/registry/client/index.ts"() {
@@ -5671,16 +6300,20 @@ var init_client5 = __esm({
5671
6300
  init_generateRegistryTokens2();
5672
6301
  init_hasRegistryPermission2();
5673
6302
  init_revokeToken2();
6303
+ init_requests5();
5674
6304
  }
5675
6305
  });
5676
6306
 
5677
6307
  // src/serialization/resources/registry/index.ts
5678
6308
  var registry_exports2 = {};
5679
6309
  __export(registry_exports2, {
6310
+ CheckRegistryPermissionRequest: () => CheckRegistryPermissionRequest,
6311
+ GenerateRegistryTokensRequest: () => GenerateRegistryTokensRequest,
5680
6312
  MavenRegistryToken: () => MavenRegistryToken,
5681
6313
  NpmRegistryToken: () => NpmRegistryToken,
5682
6314
  RegistryToken: () => RegistryToken2,
5683
6315
  RegistryTokens: () => RegistryTokens,
6316
+ RevokeTokenRequest: () => RevokeTokenRequest,
5684
6317
  generateRegistryTokens: () => generateRegistryTokens_exports2,
5685
6318
  hasRegistryPermission: () => hasRegistryPermission_exports2,
5686
6319
  revokeToken: () => revokeToken_exports2
@@ -5688,7 +6321,7 @@ __export(registry_exports2, {
5688
6321
  var init_registry2 = __esm({
5689
6322
  "src/serialization/resources/registry/index.ts"() {
5690
6323
  "use strict";
5691
- init_types9();
6324
+ init_types7();
5692
6325
  init_client5();
5693
6326
  }
5694
6327
  });
@@ -5726,7 +6359,7 @@ var init_OrganizationsPage2 = __esm({
5726
6359
  });
5727
6360
 
5728
6361
  // src/serialization/resources/user/types/index.ts
5729
- var init_types10 = __esm({
6362
+ var init_types8 = __esm({
5730
6363
  "src/serialization/resources/user/types/index.ts"() {
5731
6364
  "use strict";
5732
6365
  init_User2();
@@ -5734,56 +6367,16 @@ var init_types10 = __esm({
5734
6367
  }
5735
6368
  });
5736
6369
 
5737
- // src/serialization/resources/user/client/getMyself.ts
5738
- var getMyself_exports2 = {};
5739
- __export(getMyself_exports2, {
5740
- Response: () => Response6
5741
- });
5742
- var Response6;
5743
- var init_getMyself2 = __esm({
5744
- "src/serialization/resources/user/client/getMyself.ts"() {
5745
- "use strict";
5746
- init_core();
5747
- Response6 = schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).User);
5748
- }
5749
- });
5750
-
5751
- // src/serialization/resources/user/client/getMyOrganizations.ts
5752
- var getMyOrganizations_exports2 = {};
5753
- __export(getMyOrganizations_exports2, {
5754
- Response: () => Response7
5755
- });
5756
- var Response7;
5757
- var init_getMyOrganizations2 = __esm({
5758
- "src/serialization/resources/user/client/getMyOrganizations.ts"() {
5759
- "use strict";
5760
- init_core();
5761
- Response7 = schemas_exports.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization(), serialization_exports))).OrganizationsPage);
5762
- }
5763
- });
5764
-
5765
- // src/serialization/resources/user/client/index.ts
5766
- var init_client6 = __esm({
5767
- "src/serialization/resources/user/client/index.ts"() {
5768
- "use strict";
5769
- init_getMyself2();
5770
- init_getMyOrganizations2();
5771
- }
5772
- });
5773
-
5774
6370
  // src/serialization/resources/user/index.ts
5775
6371
  var user_exports2 = {};
5776
6372
  __export(user_exports2, {
5777
6373
  OrganizationsPage: () => OrganizationsPage,
5778
- User: () => User,
5779
- getMyOrganizations: () => getMyOrganizations_exports2,
5780
- getMyself: () => getMyself_exports2
6374
+ User: () => User
5781
6375
  });
5782
6376
  var init_user2 = __esm({
5783
6377
  "src/serialization/resources/user/index.ts"() {
5784
6378
  "use strict";
5785
- init_types10();
5786
- init_client6();
6379
+ init_types8();
5787
6380
  }
5788
6381
  });
5789
6382
 
@@ -5792,19 +6385,25 @@ var init_resources2 = __esm({
5792
6385
  "src/serialization/resources/index.ts"() {
5793
6386
  "use strict";
5794
6387
  init_commons2();
5795
- init_types7();
6388
+ init_types5();
5796
6389
  init_organization2();
5797
- init_types8();
6390
+ init_types6();
5798
6391
  init_registry2();
5799
- init_types9();
6392
+ init_types7();
5800
6393
  init_user2();
5801
- init_types10();
6394
+ init_types8();
6395
+ init_requests4();
6396
+ init_requests5();
5802
6397
  }
5803
6398
  });
5804
6399
 
5805
6400
  // src/serialization/index.ts
5806
6401
  var serialization_exports = {};
5807
6402
  __export(serialization_exports, {
6403
+ AddUserToOrgRequest: () => AddUserToOrgRequest,
6404
+ CheckRegistryPermissionRequest: () => CheckRegistryPermissionRequest,
6405
+ CreateOrganizationRequest: () => CreateOrganizationRequest,
6406
+ GenerateRegistryTokensRequest: () => GenerateRegistryTokensRequest,
5808
6407
  MavenRegistryToken: () => MavenRegistryToken,
5809
6408
  NpmRegistryToken: () => NpmRegistryToken,
5810
6409
  Organization: () => Organization,
@@ -5812,6 +6411,8 @@ __export(serialization_exports, {
5812
6411
  OrganizationsPage: () => OrganizationsPage,
5813
6412
  RegistryToken: () => RegistryToken2,
5814
6413
  RegistryTokens: () => RegistryTokens,
6414
+ RevokeTokenRequest: () => RevokeTokenRequest,
6415
+ UpdateOrganizationRequest: () => UpdateOrganizationRequest,
5815
6416
  User: () => User,
5816
6417
  UserId: () => UserId2,
5817
6418
  commons: () => commons_exports2,
@@ -5826,6 +6427,10 @@ var init_serialization = __esm({
5826
6427
  });
5827
6428
  init_serialization();
5828
6429
  export {
6430
+ AddUserToOrgRequest,
6431
+ CheckRegistryPermissionRequest,
6432
+ CreateOrganizationRequest,
6433
+ GenerateRegistryTokensRequest,
5829
6434
  MavenRegistryToken,
5830
6435
  NpmRegistryToken,
5831
6436
  Organization,
@@ -5833,6 +6438,8 @@ export {
5833
6438
  OrganizationsPage,
5834
6439
  RegistryToken2 as RegistryToken,
5835
6440
  RegistryTokens,
6441
+ RevokeTokenRequest,
6442
+ UpdateOrganizationRequest,
5836
6443
  User,
5837
6444
  UserId2 as UserId,
5838
6445
  commons_exports2 as commons,