@ai-sdk/provider-utils 4.0.62 → 4.0.63

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/provider-utils
2
2
 
3
+ ## 4.0.63
4
+
5
+ ### Patch Changes
6
+
7
+ - 28252da: use native Buffer base64 encoding when available. encoding a `Uint8Array` backed by a detached `ArrayBuffer` now throws a `TypeError` in runtimes with `Buffer` instead of returning an empty string
8
+
3
9
  ## 4.0.62
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -275,6 +275,14 @@ function convertBase64ToUint8Array(base64String) {
275
275
  return Uint8Array.from(latin1string, (byte) => byte.codePointAt(0));
276
276
  }
277
277
  function convertUint8ArrayToBase64(array) {
278
+ var _a2;
279
+ if (typeof ((_a2 = globalThis.Buffer) == null ? void 0 : _a2.from) === "function") {
280
+ return globalThis.Buffer.from(
281
+ array.buffer,
282
+ array.byteOffset,
283
+ array.byteLength
284
+ ).toString("base64");
285
+ }
278
286
  const chunks = [];
279
287
  const chunkSize = 4096;
280
288
  for (let i = 0; i < array.length; i += chunkSize) {
@@ -1006,7 +1014,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
1006
1014
  }
1007
1015
 
1008
1016
  // src/version.ts
1009
- var VERSION = true ? "4.0.62" : "0.0.0-test";
1017
+ var VERSION = true ? "4.0.63" : "0.0.0-test";
1010
1018
 
1011
1019
  // src/get-from-api.ts
1012
1020
  var getOriginalFetch = () => globalThis.fetch;