v0-sdk 0.5.0 → 0.5.1
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/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2,11 +2,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
2
2
|
|
|
3
3
|
function createFetcher(config = {}) {
|
|
4
4
|
const baseUrl = config.baseUrl || 'https://api.v0.dev/v1';
|
|
5
|
-
const apiKey = config.apiKey || process.env.V0_API_KEY;
|
|
6
|
-
if (!apiKey) {
|
|
7
|
-
throw new Error('API key is required. Provide it via config.apiKey or V0_API_KEY environment variable');
|
|
8
|
-
}
|
|
9
5
|
return async function fetcher(url, method, params = {}) {
|
|
6
|
+
const apiKey = config.apiKey || process.env.V0_API_KEY;
|
|
7
|
+
if (!apiKey) {
|
|
8
|
+
throw new Error('API key is required. Provide it via config.apiKey or V0_API_KEY environment variable');
|
|
9
|
+
}
|
|
10
10
|
const queryString = params.query ? '?' + new URLSearchParams(params.query).toString() : '';
|
|
11
11
|
const finalUrl = baseUrl + url + queryString;
|
|
12
12
|
const hasBody = method !== 'GET' && params.body;
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
function createFetcher(config = {}) {
|
|
2
2
|
const baseUrl = config.baseUrl || 'https://api.v0.dev/v1';
|
|
3
|
-
const apiKey = config.apiKey || process.env.V0_API_KEY;
|
|
4
|
-
if (!apiKey) {
|
|
5
|
-
throw new Error('API key is required. Provide it via config.apiKey or V0_API_KEY environment variable');
|
|
6
|
-
}
|
|
7
3
|
return async function fetcher(url, method, params = {}) {
|
|
4
|
+
const apiKey = config.apiKey || process.env.V0_API_KEY;
|
|
5
|
+
if (!apiKey) {
|
|
6
|
+
throw new Error('API key is required. Provide it via config.apiKey or V0_API_KEY environment variable');
|
|
7
|
+
}
|
|
8
8
|
const queryString = params.query ? '?' + new URLSearchParams(params.query).toString() : '';
|
|
9
9
|
const finalUrl = baseUrl + url + queryString;
|
|
10
10
|
const hasBody = method !== 'GET' && params.body;
|