@ai-sdk/provider-utils 2.2.7 → 3.0.0-alpha.1

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.
package/dist/index.js CHANGED
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
21
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
22
  // If the importer is in node compatibility mode or this is not an ESM
22
23
  // file that has been converted to a CommonJS file using a Babel-
@@ -30,10 +31,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
31
  // src/index.ts
31
32
  var src_exports = {};
32
33
  __export(src_exports, {
34
+ asSchema: () => asSchema,
33
35
  asValidator: () => asValidator,
34
36
  combineHeaders: () => combineHeaders,
35
37
  convertAsyncIteratorToReadableStream: () => convertAsyncIteratorToReadableStream,
36
38
  convertBase64ToUint8Array: () => convertBase64ToUint8Array,
39
+ convertToBase64: () => convertToBase64,
37
40
  convertUint8ArrayToBase64: () => convertUint8ArrayToBase64,
38
41
  createBinaryResponseHandler: () => createBinaryResponseHandler,
39
42
  createEventSourceParserStream: () => createEventSourceParserStream,
@@ -50,11 +53,14 @@ __export(src_exports, {
50
53
  getFromApi: () => getFromApi,
51
54
  isAbortError: () => isAbortError,
52
55
  isParsableJson: () => isParsableJson,
56
+ isUrlSupported: () => isUrlSupported,
53
57
  isValidator: () => isValidator,
58
+ jsonSchema: () => jsonSchema,
54
59
  loadApiKey: () => loadApiKey,
55
60
  loadOptionalSetting: () => loadOptionalSetting,
56
61
  loadSetting: () => loadSetting,
57
62
  parseJSON: () => parseJSON,
63
+ parseJsonEventStream: () => parseJsonEventStream,
58
64
  parseProviderOptions: () => parseProviderOptions,
59
65
  postFormDataToApi: () => postFormDataToApi,
60
66
  postJsonToApi: () => postJsonToApi,
@@ -63,11 +69,12 @@ __export(src_exports, {
63
69
  resolve: () => resolve,
64
70
  safeParseJSON: () => safeParseJSON,
65
71
  safeValidateTypes: () => safeValidateTypes,
72
+ standardSchemaValidator: () => standardSchemaValidator,
66
73
  validateTypes: () => validateTypes,
67
74
  validator: () => validator,
68
75
  validatorSymbol: () => validatorSymbol,
69
76
  withoutTrailingSlash: () => withoutTrailingSlash,
70
- zodValidator: () => zodValidator
77
+ zodSchema: () => zodSchema
71
78
  });
72
79
  module.exports = __toCommonJS(src_exports);
73
80
 
@@ -198,7 +205,7 @@ function splitLines(buffer, chunk) {
198
205
  } else if (char === "\r") {
199
206
  lines.push(currentLine);
200
207
  currentLine = "";
201
- if (chunk[i + 1] === "\n") {
208
+ if (chunk[i] === "\n") {
202
209
  i++;
203
210
  }
204
211
  } else {
@@ -219,14 +226,20 @@ function extractResponseHeaders(response) {
219
226
 
220
227
  // src/generate-id.ts
221
228
  var import_provider = require("@ai-sdk/provider");
222
- var import_non_secure = require("nanoid/non-secure");
223
229
  var createIdGenerator = ({
224
230
  prefix,
225
- size: defaultSize = 16,
231
+ size = 16,
226
232
  alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
227
233
  separator = "-"
228
234
  } = {}) => {
229
- const generator = (0, import_non_secure.customAlphabet)(alphabet, defaultSize);
235
+ const generator = () => {
236
+ const alphabetLength = alphabet.length;
237
+ const chars = new Array(size);
238
+ for (let i = 0; i < size; i++) {
239
+ chars[i] = alphabet[Math.random() * alphabetLength | 0];
240
+ }
241
+ return chars.join("");
242
+ };
230
243
  if (prefix == null) {
231
244
  return generator;
232
245
  }
@@ -236,7 +249,7 @@ var createIdGenerator = ({
236
249
  message: `The separator "${separator}" must not be part of the alphabet "${alphabet}".`
237
250
  });
238
251
  }
239
- return (size) => `${prefix}${separator}${generator(size)}`;
252
+ return () => `${prefix}${separator}${generator()}`;
240
253
  };
241
254
  var generateId = createIdGenerator();
242
255
 
@@ -350,6 +363,20 @@ var getFromApi = async ({
350
363
  }
351
364
  };
352
365
 
366
+ // src/is-url-supported.ts
367
+ function isUrlSupported({
368
+ mediaType,
369
+ url,
370
+ supportedUrls
371
+ }) {
372
+ url = url.toLowerCase();
373
+ mediaType = mediaType.toLowerCase();
374
+ return Object.entries(supportedUrls).map(([key, value]) => {
375
+ const mediaType2 = key.toLowerCase();
376
+ return mediaType2 === "*" || mediaType2 === "*/*" ? { mediaTypePrefix: "", regexes: value } : { mediaTypePrefix: mediaType2.replace(/\*/, ""), regexes: value };
377
+ }).filter(({ mediaTypePrefix }) => mediaType.startsWith(mediaTypePrefix)).flatMap(({ regexes }) => regexes).some((pattern) => pattern.test(url));
378
+ }
379
+
353
380
  // src/load-api-key.ts
354
381
  var import_provider3 = require("@ai-sdk/provider");
355
382
  function loadApiKey({
@@ -439,13 +466,58 @@ function loadSetting({
439
466
  }
440
467
 
441
468
  // src/parse-json.ts
442
- var import_provider6 = require("@ai-sdk/provider");
443
- var import_secure_json_parse = __toESM(require("secure-json-parse"));
469
+ var import_provider7 = require("@ai-sdk/provider");
470
+
471
+ // src/secure-json-parse.ts
472
+ var suspectProtoRx = /"__proto__"\s*:/;
473
+ var suspectConstructorRx = /"constructor"\s*:/;
474
+ function _parse(text) {
475
+ const obj = JSON.parse(text);
476
+ if (obj === null || typeof obj !== "object") {
477
+ return obj;
478
+ }
479
+ if (suspectProtoRx.test(text) === false && suspectConstructorRx.test(text) === false) {
480
+ return obj;
481
+ }
482
+ return filter(obj);
483
+ }
484
+ function filter(obj) {
485
+ let next = [obj];
486
+ while (next.length) {
487
+ const nodes = next;
488
+ next = [];
489
+ for (const node of nodes) {
490
+ if (Object.prototype.hasOwnProperty.call(node, "__proto__")) {
491
+ throw new SyntaxError("Object contains forbidden prototype property");
492
+ }
493
+ if (Object.prototype.hasOwnProperty.call(node, "constructor") && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
494
+ throw new SyntaxError("Object contains forbidden prototype property");
495
+ }
496
+ for (const key in node) {
497
+ const value = node[key];
498
+ if (value && typeof value === "object") {
499
+ next.push(value);
500
+ }
501
+ }
502
+ }
503
+ }
504
+ return obj;
505
+ }
506
+ function secureJsonParse(text) {
507
+ const { stackTraceLimit } = Error;
508
+ Error.stackTraceLimit = 0;
509
+ try {
510
+ return _parse(text);
511
+ } finally {
512
+ Error.stackTraceLimit = stackTraceLimit;
513
+ }
514
+ }
444
515
 
445
516
  // src/validate-types.ts
446
- var import_provider5 = require("@ai-sdk/provider");
517
+ var import_provider6 = require("@ai-sdk/provider");
447
518
 
448
519
  // src/validator.ts
520
+ var import_provider5 = require("@ai-sdk/provider");
449
521
  var validatorSymbol = Symbol.for("vercel.ai.validator");
450
522
  function validator(validate) {
451
523
  return { [validatorSymbol]: true, validate };
@@ -454,99 +526,124 @@ function isValidator(value) {
454
526
  return typeof value === "object" && value !== null && validatorSymbol in value && value[validatorSymbol] === true && "validate" in value;
455
527
  }
456
528
  function asValidator(value) {
457
- return isValidator(value) ? value : zodValidator(value);
529
+ return isValidator(value) ? value : standardSchemaValidator(value);
458
530
  }
459
- function zodValidator(zodSchema) {
460
- return validator((value) => {
461
- const result = zodSchema.safeParse(value);
462
- return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
531
+ function standardSchemaValidator(standardSchema) {
532
+ return validator(async (value) => {
533
+ const result = await standardSchema["~standard"].validate(value);
534
+ return result.issues == null ? { success: true, value: result.value } : {
535
+ success: false,
536
+ error: new import_provider5.TypeValidationError({
537
+ value,
538
+ cause: result.issues
539
+ })
540
+ };
463
541
  });
464
542
  }
465
543
 
466
544
  // src/validate-types.ts
467
- function validateTypes({
545
+ async function validateTypes({
468
546
  value,
469
- schema: inputSchema
547
+ schema
470
548
  }) {
471
- const result = safeValidateTypes({ value, schema: inputSchema });
549
+ const result = await safeValidateTypes({ value, schema });
472
550
  if (!result.success) {
473
- throw import_provider5.TypeValidationError.wrap({ value, cause: result.error });
551
+ throw import_provider6.TypeValidationError.wrap({ value, cause: result.error });
474
552
  }
475
553
  return result.value;
476
554
  }
477
- function safeValidateTypes({
555
+ async function safeValidateTypes({
478
556
  value,
479
557
  schema
480
558
  }) {
481
559
  const validator2 = asValidator(schema);
482
560
  try {
483
561
  if (validator2.validate == null) {
484
- return { success: true, value };
562
+ return { success: true, value, rawValue: value };
485
563
  }
486
- const result = validator2.validate(value);
564
+ const result = await validator2.validate(value);
487
565
  if (result.success) {
488
- return result;
566
+ return { success: true, value: result.value, rawValue: value };
489
567
  }
490
568
  return {
491
569
  success: false,
492
- error: import_provider5.TypeValidationError.wrap({ value, cause: result.error })
570
+ error: import_provider6.TypeValidationError.wrap({ value, cause: result.error }),
571
+ rawValue: value
493
572
  };
494
573
  } catch (error) {
495
574
  return {
496
575
  success: false,
497
- error: import_provider5.TypeValidationError.wrap({ value, cause: error })
576
+ error: import_provider6.TypeValidationError.wrap({ value, cause: error }),
577
+ rawValue: value
498
578
  };
499
579
  }
500
580
  }
501
581
 
502
582
  // src/parse-json.ts
503
- function parseJSON({
583
+ async function parseJSON({
504
584
  text,
505
585
  schema
506
586
  }) {
507
587
  try {
508
- const value = import_secure_json_parse.default.parse(text);
588
+ const value = secureJsonParse(text);
509
589
  if (schema == null) {
510
590
  return value;
511
591
  }
512
592
  return validateTypes({ value, schema });
513
593
  } catch (error) {
514
- if (import_provider6.JSONParseError.isInstance(error) || import_provider6.TypeValidationError.isInstance(error)) {
594
+ if (import_provider7.JSONParseError.isInstance(error) || import_provider7.TypeValidationError.isInstance(error)) {
515
595
  throw error;
516
596
  }
517
- throw new import_provider6.JSONParseError({ text, cause: error });
597
+ throw new import_provider7.JSONParseError({ text, cause: error });
518
598
  }
519
599
  }
520
- function safeParseJSON({
600
+ async function safeParseJSON({
521
601
  text,
522
602
  schema
523
603
  }) {
524
604
  try {
525
- const value = import_secure_json_parse.default.parse(text);
605
+ const value = secureJsonParse(text);
526
606
  if (schema == null) {
527
607
  return { success: true, value, rawValue: value };
528
608
  }
529
- const validationResult = safeValidateTypes({ value, schema });
530
- return validationResult.success ? { ...validationResult, rawValue: value } : validationResult;
609
+ return await safeValidateTypes({ value, schema });
531
610
  } catch (error) {
532
611
  return {
533
612
  success: false,
534
- error: import_provider6.JSONParseError.isInstance(error) ? error : new import_provider6.JSONParseError({ text, cause: error })
613
+ error: import_provider7.JSONParseError.isInstance(error) ? error : new import_provider7.JSONParseError({ text, cause: error }),
614
+ rawValue: void 0
535
615
  };
536
616
  }
537
617
  }
538
618
  function isParsableJson(input) {
539
619
  try {
540
- import_secure_json_parse.default.parse(input);
620
+ secureJsonParse(input);
541
621
  return true;
542
622
  } catch (e) {
543
623
  return false;
544
624
  }
545
625
  }
546
626
 
627
+ // src/parse-json-event-stream.ts
628
+ function parseJsonEventStream({
629
+ stream,
630
+ schema
631
+ }) {
632
+ return stream.pipeThrough(new TextDecoderStream()).pipeThrough(createEventSourceParserStream()).pipeThrough(
633
+ new TransformStream({
634
+ async transform({ data }, controller) {
635
+ if (data === "[DONE]") {
636
+ return;
637
+ }
638
+ controller.enqueue(await safeParseJSON({ text: data, schema }));
639
+ }
640
+ })
641
+ );
642
+ }
643
+
547
644
  // src/parse-provider-options.ts
548
- var import_provider7 = require("@ai-sdk/provider");
549
- function parseProviderOptions({
645
+ var import_provider8 = require("@ai-sdk/provider");
646
+ async function parseProviderOptions({
550
647
  provider,
551
648
  providerOptions,
552
649
  schema
@@ -554,12 +651,12 @@ function parseProviderOptions({
554
651
  if ((providerOptions == null ? void 0 : providerOptions[provider]) == null) {
555
652
  return void 0;
556
653
  }
557
- const parsedProviderOptions = safeValidateTypes({
654
+ const parsedProviderOptions = await safeValidateTypes({
558
655
  value: providerOptions[provider],
559
656
  schema
560
657
  });
561
658
  if (!parsedProviderOptions.success) {
562
- throw new import_provider7.InvalidArgumentError({
659
+ throw new import_provider8.InvalidArgumentError({
563
660
  argument: "providerOptions",
564
661
  message: `invalid ${provider} provider options`,
565
662
  cause: parsedProviderOptions.error
@@ -569,7 +666,7 @@ function parseProviderOptions({
569
666
  }
570
667
 
571
668
  // src/post-to-api.ts
572
- var import_provider8 = require("@ai-sdk/provider");
669
+ var import_provider9 = require("@ai-sdk/provider");
573
670
  var getOriginalFetch2 = () => globalThis.fetch;
574
671
  var postJsonToApi = async ({
575
672
  url,
@@ -640,10 +737,10 @@ var postToApi = async ({
640
737
  requestBodyValues: body.values
641
738
  });
642
739
  } catch (error) {
643
- if (isAbortError(error) || import_provider8.APICallError.isInstance(error)) {
740
+ if (isAbortError(error) || import_provider9.APICallError.isInstance(error)) {
644
741
  throw error;
645
742
  }
646
- throw new import_provider8.APICallError({
743
+ throw new import_provider9.APICallError({
647
744
  message: "Failed to process error response",
648
745
  cause: error,
649
746
  statusCode: response.status,
@@ -662,11 +759,11 @@ var postToApi = async ({
662
759
  });
663
760
  } catch (error) {
664
761
  if (error instanceof Error) {
665
- if (isAbortError(error) || import_provider8.APICallError.isInstance(error)) {
762
+ if (isAbortError(error) || import_provider9.APICallError.isInstance(error)) {
666
763
  throw error;
667
764
  }
668
765
  }
669
- throw new import_provider8.APICallError({
766
+ throw new import_provider9.APICallError({
670
767
  message: "Failed to process successful response",
671
768
  cause: error,
672
769
  statusCode: response.status,
@@ -682,7 +779,7 @@ var postToApi = async ({
682
779
  if (error instanceof TypeError && error.message === "fetch failed") {
683
780
  const cause = error.cause;
684
781
  if (cause != null) {
685
- throw new import_provider8.APICallError({
782
+ throw new import_provider9.APICallError({
686
783
  message: `Cannot connect to API: ${cause.message}`,
687
784
  cause,
688
785
  url,
@@ -705,7 +802,7 @@ async function resolve(value) {
705
802
  }
706
803
 
707
804
  // src/response-handler.ts
708
- var import_provider9 = require("@ai-sdk/provider");
805
+ var import_provider10 = require("@ai-sdk/provider");
709
806
  var createJsonErrorResponseHandler = ({
710
807
  errorSchema,
711
808
  errorToMessage,
@@ -716,7 +813,7 @@ var createJsonErrorResponseHandler = ({
716
813
  if (responseBody.trim() === "") {
717
814
  return {
718
815
  responseHeaders,
719
- value: new import_provider9.APICallError({
816
+ value: new import_provider10.APICallError({
720
817
  message: response.statusText,
721
818
  url,
722
819
  requestBodyValues,
@@ -728,13 +825,13 @@ var createJsonErrorResponseHandler = ({
728
825
  };
729
826
  }
730
827
  try {
731
- const parsedError = parseJSON({
828
+ const parsedError = await parseJSON({
732
829
  text: responseBody,
733
830
  schema: errorSchema
734
831
  });
735
832
  return {
736
833
  responseHeaders,
737
- value: new import_provider9.APICallError({
834
+ value: new import_provider10.APICallError({
738
835
  message: errorToMessage(parsedError),
739
836
  url,
740
837
  requestBodyValues,
@@ -748,7 +845,7 @@ var createJsonErrorResponseHandler = ({
748
845
  } catch (parseError) {
749
846
  return {
750
847
  responseHeaders,
751
- value: new import_provider9.APICallError({
848
+ value: new import_provider10.APICallError({
752
849
  message: response.statusText,
753
850
  url,
754
851
  requestBodyValues,
@@ -763,41 +860,30 @@ var createJsonErrorResponseHandler = ({
763
860
  var createEventSourceResponseHandler = (chunkSchema) => async ({ response }) => {
764
861
  const responseHeaders = extractResponseHeaders(response);
765
862
  if (response.body == null) {
766
- throw new import_provider9.EmptyResponseBodyError({});
863
+ throw new import_provider10.EmptyResponseBodyError({});
767
864
  }
768
865
  return {
769
866
  responseHeaders,
770
- value: response.body.pipeThrough(new TextDecoderStream()).pipeThrough(createEventSourceParserStream()).pipeThrough(
771
- new TransformStream({
772
- transform({ data }, controller) {
773
- if (data === "[DONE]") {
774
- return;
775
- }
776
- controller.enqueue(
777
- safeParseJSON({
778
- text: data,
779
- schema: chunkSchema
780
- })
781
- );
782
- }
783
- })
784
- )
867
+ value: parseJsonEventStream({
868
+ stream: response.body,
869
+ schema: chunkSchema
870
+ })
785
871
  };
786
872
  };
787
873
  var createJsonStreamResponseHandler = (chunkSchema) => async ({ response }) => {
788
874
  const responseHeaders = extractResponseHeaders(response);
789
875
  if (response.body == null) {
790
- throw new import_provider9.EmptyResponseBodyError({});
876
+ throw new import_provider10.EmptyResponseBodyError({});
791
877
  }
792
878
  let buffer = "";
793
879
  return {
794
880
  responseHeaders,
795
881
  value: response.body.pipeThrough(new TextDecoderStream()).pipeThrough(
796
882
  new TransformStream({
797
- transform(chunkText, controller) {
883
+ async transform(chunkText, controller) {
798
884
  if (chunkText.endsWith("\n")) {
799
885
  controller.enqueue(
800
- safeParseJSON({
886
+ await safeParseJSON({
801
887
  text: buffer + chunkText,
802
888
  schema: chunkSchema
803
889
  })
@@ -813,13 +899,13 @@ var createJsonStreamResponseHandler = (chunkSchema) => async ({ response }) => {
813
899
  };
814
900
  var createJsonResponseHandler = (responseSchema) => async ({ response, url, requestBodyValues }) => {
815
901
  const responseBody = await response.text();
816
- const parsedResult = safeParseJSON({
902
+ const parsedResult = await safeParseJSON({
817
903
  text: responseBody,
818
904
  schema: responseSchema
819
905
  });
820
906
  const responseHeaders = extractResponseHeaders(response);
821
907
  if (!parsedResult.success) {
822
- throw new import_provider9.APICallError({
908
+ throw new import_provider10.APICallError({
823
909
  message: "Invalid JSON response",
824
910
  cause: parsedResult.error,
825
911
  statusCode: response.status,
@@ -838,7 +924,7 @@ var createJsonResponseHandler = (responseSchema) => async ({ response, url, requ
838
924
  var createBinaryResponseHandler = () => async ({ response, url, requestBodyValues }) => {
839
925
  const responseHeaders = extractResponseHeaders(response);
840
926
  if (!response.body) {
841
- throw new import_provider9.APICallError({
927
+ throw new import_provider10.APICallError({
842
928
  message: "Response body is empty",
843
929
  url,
844
930
  requestBodyValues,
@@ -854,7 +940,7 @@ var createBinaryResponseHandler = () => async ({ response, url, requestBodyValue
854
940
  value: new Uint8Array(buffer)
855
941
  };
856
942
  } catch (error) {
857
- throw new import_provider9.APICallError({
943
+ throw new import_provider10.APICallError({
858
944
  message: "Failed to read response as array buffer",
859
945
  url,
860
946
  requestBodyValues,
@@ -870,7 +956,7 @@ var createStatusCodeErrorResponseHandler = () => async ({ response, url, request
870
956
  const responseBody = await response.text();
871
957
  return {
872
958
  responseHeaders,
873
- value: new import_provider9.APICallError({
959
+ value: new import_provider10.APICallError({
874
960
  message: response.statusText,
875
961
  url,
876
962
  requestBodyValues,
@@ -881,6 +967,50 @@ var createStatusCodeErrorResponseHandler = () => async ({ response, url, request
881
967
  };
882
968
  };
883
969
 
970
+ // src/zod-schema.ts
971
+ var import_zod_to_json_schema = __toESM(require("zod-to-json-schema"));
972
+ function zodSchema(zodSchema2, options) {
973
+ var _a;
974
+ const useReferences = (_a = options == null ? void 0 : options.useReferences) != null ? _a : false;
975
+ return jsonSchema(
976
+ (0, import_zod_to_json_schema.default)(zodSchema2, {
977
+ $refStrategy: useReferences ? "root" : "none",
978
+ target: "jsonSchema7"
979
+ // note: openai mode breaks various gemini conversions
980
+ }),
981
+ {
982
+ validate: (value) => {
983
+ const result = zodSchema2.safeParse(value);
984
+ return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
985
+ }
986
+ }
987
+ );
988
+ }
989
+
990
+ // src/schema.ts
991
+ var schemaSymbol = Symbol.for("vercel.ai.schema");
992
+ function jsonSchema(jsonSchema2, {
993
+ validate
994
+ } = {}) {
995
+ return {
996
+ [schemaSymbol]: true,
997
+ _type: void 0,
998
+ // should never be used directly
999
+ [validatorSymbol]: true,
1000
+ jsonSchema: jsonSchema2,
1001
+ validate
1002
+ };
1003
+ }
1004
+ function isSchema(value) {
1005
+ return typeof value === "object" && value !== null && schemaSymbol in value && value[schemaSymbol] === true && "jsonSchema" in value && "validate" in value;
1006
+ }
1007
+ function asSchema(schema) {
1008
+ return schema == null ? jsonSchema({
1009
+ properties: {},
1010
+ additionalProperties: false
1011
+ }) : isSchema(schema) ? schema : zodSchema(schema);
1012
+ }
1013
+
884
1014
  // src/uint8-utils.ts
885
1015
  var { btoa, atob } = globalThis;
886
1016
  function convertBase64ToUint8Array(base64String) {
@@ -895,17 +1025,25 @@ function convertUint8ArrayToBase64(array) {
895
1025
  }
896
1026
  return btoa(latin1string);
897
1027
  }
1028
+ function convertToBase64(value) {
1029
+ return value instanceof Uint8Array ? convertUint8ArrayToBase64(value) : value;
1030
+ }
898
1031
 
899
1032
  // src/without-trailing-slash.ts
900
1033
  function withoutTrailingSlash(url) {
901
1034
  return url == null ? void 0 : url.replace(/\/$/, "");
902
1035
  }
1036
+
1037
+ // src/index.ts
1038
+ __reExport(src_exports, require("@standard-schema/spec"), module.exports);
903
1039
  // Annotate the CommonJS export names for ESM import in node:
904
1040
  0 && (module.exports = {
1041
+ asSchema,
905
1042
  asValidator,
906
1043
  combineHeaders,
907
1044
  convertAsyncIteratorToReadableStream,
908
1045
  convertBase64ToUint8Array,
1046
+ convertToBase64,
909
1047
  convertUint8ArrayToBase64,
910
1048
  createBinaryResponseHandler,
911
1049
  createEventSourceParserStream,
@@ -922,11 +1060,14 @@ function withoutTrailingSlash(url) {
922
1060
  getFromApi,
923
1061
  isAbortError,
924
1062
  isParsableJson,
1063
+ isUrlSupported,
925
1064
  isValidator,
1065
+ jsonSchema,
926
1066
  loadApiKey,
927
1067
  loadOptionalSetting,
928
1068
  loadSetting,
929
1069
  parseJSON,
1070
+ parseJsonEventStream,
930
1071
  parseProviderOptions,
931
1072
  postFormDataToApi,
932
1073
  postJsonToApi,
@@ -935,10 +1076,12 @@ function withoutTrailingSlash(url) {
935
1076
  resolve,
936
1077
  safeParseJSON,
937
1078
  safeValidateTypes,
1079
+ standardSchemaValidator,
938
1080
  validateTypes,
939
1081
  validator,
940
1082
  validatorSymbol,
941
1083
  withoutTrailingSlash,
942
- zodValidator
1084
+ zodSchema,
1085
+ ...require("@standard-schema/spec")
943
1086
  });
944
1087
  //# sourceMappingURL=index.js.map