@ai-sdk/provider-utils 4.0.61 → 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 +13 -0
- package/dist/index.d.mts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/encode-path-segment.ts +15 -0
- package/src/index.ts +1 -0
- package/src/uint8-utils.ts +8 -0
- package/src/validate-download-url.ts +3 -2
package/dist/index.mjs
CHANGED
|
@@ -168,6 +168,14 @@ function convertBase64ToUint8Array(base64String) {
|
|
|
168
168
|
return Uint8Array.from(latin1string, (byte) => byte.codePointAt(0));
|
|
169
169
|
}
|
|
170
170
|
function convertUint8ArrayToBase64(array) {
|
|
171
|
+
var _a2;
|
|
172
|
+
if (typeof ((_a2 = globalThis.Buffer) == null ? void 0 : _a2.from) === "function") {
|
|
173
|
+
return globalThis.Buffer.from(
|
|
174
|
+
array.buffer,
|
|
175
|
+
array.byteOffset,
|
|
176
|
+
array.byteLength
|
|
177
|
+
).toString("base64");
|
|
178
|
+
}
|
|
171
179
|
const chunks = [];
|
|
172
180
|
const chunkSize = 4096;
|
|
173
181
|
for (let i = 0; i < array.length; i += chunkSize) {
|
|
@@ -284,7 +292,7 @@ function validateDownloadUrl(url) {
|
|
|
284
292
|
message: `URL must have a hostname`
|
|
285
293
|
});
|
|
286
294
|
}
|
|
287
|
-
if (hostname === "localhost" || hostname.endsWith(".local") || hostname.endsWith(".localhost")) {
|
|
295
|
+
if (hostname === "localhost" || hostname.endsWith(".local") || hostname.endsWith(".localhost") || hostname.endsWith(".internal")) {
|
|
288
296
|
throw new DownloadError({
|
|
289
297
|
url,
|
|
290
298
|
message: `URL with hostname ${hostname} is not allowed`
|
|
@@ -739,6 +747,12 @@ var createIdGenerator = ({
|
|
|
739
747
|
};
|
|
740
748
|
var generateId = createIdGenerator();
|
|
741
749
|
|
|
750
|
+
// src/encode-path-segment.ts
|
|
751
|
+
function encodePathSegment(value) {
|
|
752
|
+
const encodedValue = encodeURIComponent(value);
|
|
753
|
+
return encodedValue === "." ? "%252E" : encodedValue === ".." ? "%252E%252E" : encodedValue;
|
|
754
|
+
}
|
|
755
|
+
|
|
742
756
|
// src/get-error-message.ts
|
|
743
757
|
function getErrorMessage(error) {
|
|
744
758
|
if (error == null) {
|
|
@@ -893,7 +907,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
893
907
|
}
|
|
894
908
|
|
|
895
909
|
// src/version.ts
|
|
896
|
-
var VERSION = true ? "4.0.
|
|
910
|
+
var VERSION = true ? "4.0.63" : "0.0.0-test";
|
|
897
911
|
|
|
898
912
|
// src/get-from-api.ts
|
|
899
913
|
var getOriginalFetch = () => globalThis.fetch;
|
|
@@ -3581,6 +3595,7 @@ export {
|
|
|
3581
3595
|
delay,
|
|
3582
3596
|
downloadBlob,
|
|
3583
3597
|
dynamicTool,
|
|
3598
|
+
encodePathSegment,
|
|
3584
3599
|
executeTool,
|
|
3585
3600
|
extractResponseHeaders,
|
|
3586
3601
|
fetchWithValidatedEndpoint,
|