@ai-sdk/provider-utils 3.0.43 → 3.0.44
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 +8 -0
- package/dist/index.d.mts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +58 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -740,7 +740,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
740
740
|
}
|
|
741
741
|
|
|
742
742
|
// src/version.ts
|
|
743
|
-
var VERSION = true ? "3.0.
|
|
743
|
+
var VERSION = true ? "3.0.44" : "0.0.0-test";
|
|
744
744
|
|
|
745
745
|
// src/get-from-api.ts
|
|
746
746
|
var getOriginalFetch = () => globalThis.fetch;
|
|
@@ -3288,7 +3288,11 @@ var { btoa, atob } = globalThis;
|
|
|
3288
3288
|
function convertBase64ToUint8Array(base64String) {
|
|
3289
3289
|
const base64Url = base64String.replace(/-/g, "+").replace(/_/g, "/");
|
|
3290
3290
|
const latin1string = atob(base64Url);
|
|
3291
|
-
|
|
3291
|
+
const bytes = new Uint8Array(latin1string.length);
|
|
3292
|
+
for (let i = 0; i < latin1string.length; i++) {
|
|
3293
|
+
bytes[i] = latin1string.charCodeAt(i);
|
|
3294
|
+
}
|
|
3295
|
+
return bytes;
|
|
3292
3296
|
}
|
|
3293
3297
|
function convertUint8ArrayToBase64(array) {
|
|
3294
3298
|
var _a2;
|
|
@@ -3306,8 +3310,30 @@ function convertUint8ArrayToBase64(array) {
|
|
|
3306
3310
|
}
|
|
3307
3311
|
return btoa(chunks.join(""));
|
|
3308
3312
|
}
|
|
3313
|
+
var typedArrayTag = Object.getOwnPropertyDescriptor(
|
|
3314
|
+
Object.getPrototypeOf(Uint8Array.prototype),
|
|
3315
|
+
Symbol.toStringTag
|
|
3316
|
+
).get;
|
|
3317
|
+
var arrayBufferByteLength = Object.getOwnPropertyDescriptor(
|
|
3318
|
+
ArrayBuffer.prototype,
|
|
3319
|
+
"byteLength"
|
|
3320
|
+
).get;
|
|
3321
|
+
function isUint8Array(value) {
|
|
3322
|
+
return ArrayBuffer.isView(value) && typedArrayTag.call(value) === "Uint8Array";
|
|
3323
|
+
}
|
|
3324
|
+
function isArrayBuffer(value) {
|
|
3325
|
+
if (typeof value !== "object" || value === null || !("byteLength" in value)) {
|
|
3326
|
+
return false;
|
|
3327
|
+
}
|
|
3328
|
+
try {
|
|
3329
|
+
arrayBufferByteLength.call(value);
|
|
3330
|
+
return true;
|
|
3331
|
+
} catch (e) {
|
|
3332
|
+
return false;
|
|
3333
|
+
}
|
|
3334
|
+
}
|
|
3309
3335
|
function convertToBase64(value) {
|
|
3310
|
-
return value
|
|
3336
|
+
return isUint8Array(value) ? convertUint8ArrayToBase64(value) : value;
|
|
3311
3337
|
}
|
|
3312
3338
|
|
|
3313
3339
|
// src/without-trailing-slash.ts
|
|
@@ -3344,6 +3370,27 @@ export * from "@standard-schema/spec";
|
|
|
3344
3370
|
import {
|
|
3345
3371
|
EventSourceParserStream as EventSourceParserStream2
|
|
3346
3372
|
} from "eventsource-parser/stream";
|
|
3373
|
+
|
|
3374
|
+
// src/stringify-with-bigint-and-cycles.ts
|
|
3375
|
+
function stringifyWithBigIntAndCycles(value) {
|
|
3376
|
+
const ancestors = [];
|
|
3377
|
+
return JSON.stringify(value, function(_key, value2) {
|
|
3378
|
+
if (typeof value2 === "bigint") {
|
|
3379
|
+
return value2.toString();
|
|
3380
|
+
}
|
|
3381
|
+
if (typeof value2 !== "object" || value2 === null) {
|
|
3382
|
+
return value2;
|
|
3383
|
+
}
|
|
3384
|
+
while (ancestors.length > 0 && ancestors.at(-1) !== this) {
|
|
3385
|
+
ancestors.pop();
|
|
3386
|
+
}
|
|
3387
|
+
if (ancestors.includes(value2)) {
|
|
3388
|
+
return "[Circular]";
|
|
3389
|
+
}
|
|
3390
|
+
ancestors.push(value2);
|
|
3391
|
+
return value2;
|
|
3392
|
+
});
|
|
3393
|
+
}
|
|
3347
3394
|
export {
|
|
3348
3395
|
DEFAULT_MAX_DOWNLOAD_SIZE,
|
|
3349
3396
|
DelayedPromise,
|
|
@@ -3382,9 +3429,11 @@ export {
|
|
|
3382
3429
|
getRuntimeEnvironmentUserAgent,
|
|
3383
3430
|
injectJsonInstructionIntoMessages,
|
|
3384
3431
|
isAbortError,
|
|
3432
|
+
isArrayBuffer,
|
|
3385
3433
|
isBrowserRuntime,
|
|
3386
3434
|
isParsableJson,
|
|
3387
3435
|
isSameOrigin,
|
|
3436
|
+
isUint8Array,
|
|
3388
3437
|
isUrlSupported,
|
|
3389
3438
|
isValidator,
|
|
3390
3439
|
jsonSchema,
|
|
@@ -3406,7 +3455,9 @@ export {
|
|
|
3406
3455
|
resolve,
|
|
3407
3456
|
safeParseJSON,
|
|
3408
3457
|
safeValidateTypes,
|
|
3458
|
+
secureJsonParse,
|
|
3409
3459
|
standardSchemaValidator,
|
|
3460
|
+
stringifyWithBigIntAndCycles,
|
|
3410
3461
|
tool,
|
|
3411
3462
|
validateDownloadUrl,
|
|
3412
3463
|
validateTypes,
|