@ai-sdk/provider-utils 3.0.42 → 3.0.43

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
+ ## 3.0.43
4
+
5
+ ### Patch Changes
6
+
7
+ - a1a772f: 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
  ## 3.0.42
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -845,7 +845,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
845
845
  }
846
846
 
847
847
  // src/version.ts
848
- var VERSION = true ? "3.0.42" : "0.0.0-test";
848
+ var VERSION = true ? "3.0.43" : "0.0.0-test";
849
849
 
850
850
  // src/get-from-api.ts
851
851
  var getOriginalFetch = () => globalThis.fetch;
@@ -3387,6 +3387,14 @@ function convertBase64ToUint8Array(base64String) {
3387
3387
  return Uint8Array.from(latin1string, (byte) => byte.codePointAt(0));
3388
3388
  }
3389
3389
  function convertUint8ArrayToBase64(array) {
3390
+ var _a2;
3391
+ if (typeof ((_a2 = globalThis.Buffer) == null ? void 0 : _a2.from) === "function") {
3392
+ return globalThis.Buffer.from(
3393
+ array.buffer,
3394
+ array.byteOffset,
3395
+ array.byteLength
3396
+ ).toString("base64");
3397
+ }
3390
3398
  const chunks = [];
3391
3399
  const chunkSize = 4096;
3392
3400
  for (let i = 0; i < array.length; i += chunkSize) {