@ai-sdk/provider-utils 4.0.21 → 4.0.23
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 +12 -0
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -3
- package/src/load-api-key.ts +1 -1
- package/src/load-setting.ts +1 -1
- package/src/validate-download-url.ts +7 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/provider-utils",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.23",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -69,9 +69,7 @@
|
|
|
69
69
|
"build": "pnpm clean && tsup --tsconfig tsconfig.build.json",
|
|
70
70
|
"build:watch": "pnpm clean && tsup --watch",
|
|
71
71
|
"clean": "del-cli dist *.tsbuildinfo",
|
|
72
|
-
"lint": "eslint \"./**/*.ts*\"",
|
|
73
72
|
"type-check": "tsc --build",
|
|
74
|
-
"prettier-check": "prettier --check \"./**/*.ts*\"",
|
|
75
73
|
"test": "pnpm test:node && pnpm test:edge",
|
|
76
74
|
"test:update": "pnpm test:node -u",
|
|
77
75
|
"test:watch": "vitest --config vitest.node.config.js",
|
package/src/load-api-key.ts
CHANGED
|
@@ -23,7 +23,7 @@ export function loadApiKey({
|
|
|
23
23
|
|
|
24
24
|
if (typeof process === 'undefined') {
|
|
25
25
|
throw new LoadAPIKeyError({
|
|
26
|
-
message: `${description} API key is missing. Pass it using the '${apiKeyParameterName}' parameter. Environment variables
|
|
26
|
+
message: `${description} API key is missing. Pass it using the '${apiKeyParameterName}' parameter. Environment variables are not supported in this environment.`,
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
|
package/src/load-setting.ts
CHANGED
|
@@ -35,7 +35,7 @@ export function loadSetting({
|
|
|
35
35
|
message:
|
|
36
36
|
`${description} setting is missing. ` +
|
|
37
37
|
`Pass it using the '${settingName}' parameter. ` +
|
|
38
|
-
`Environment variables
|
|
38
|
+
`Environment variables are not supported in this environment.`,
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -18,11 +18,16 @@ export function validateDownloadUrl(url: string): void {
|
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
//
|
|
21
|
+
// data: URLs are inline content, so they do not trigger a network fetch or SSRF risk.
|
|
22
|
+
if (parsed.protocol === 'data:') {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Only allow http and https network protocols
|
|
22
27
|
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
|
|
23
28
|
throw new DownloadError({
|
|
24
29
|
url,
|
|
25
|
-
message: `URL scheme must be http or
|
|
30
|
+
message: `URL scheme must be http, https, or data, got ${parsed.protocol}`,
|
|
26
31
|
});
|
|
27
32
|
}
|
|
28
33
|
|