vercel-api-js 1.0.1 → 1.0.2
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 +4495 -0
- package/dist/index.d.cts +42176 -0
- package/dist/index.d.mts +41456 -998
- package/dist/index.d.ts +41456 -998
- package/dist/index.mjs +4488 -5
- package/dist/mcp.cjs +4946 -0
- package/dist/mcp.d.cts +5 -0
- package/dist/mcp.d.mts +5 -1
- package/dist/mcp.d.ts +5 -1
- package/dist/mcp.mjs +4944 -1
- package/dist/shared/vercel-api-js.BaOSBqhR.cjs +6795 -0
- package/dist/shared/vercel-api-js.BnRX1F13.mjs +6510 -0
- package/dist/shared/vercel-api-js.C9s64N79.d.cts +35 -0
- package/dist/shared/vercel-api-js.C9s64N79.d.mts +35 -0
- package/dist/shared/vercel-api-js.C9s64N79.d.ts +35 -0
- package/package.json +25 -18
- package/dist/client.d.mts +0 -228
- package/dist/client.d.ts +0 -228
- package/dist/client.js +0 -75
- package/dist/client.mjs +0 -68
- package/dist/generated/components.d.mts +0 -2600
- package/dist/generated/components.d.ts +0 -2600
- package/dist/generated/components.js +0 -3579
- package/dist/generated/components.mjs +0 -3395
- package/dist/generated/mcp.d.mts +0 -2061
- package/dist/generated/mcp.d.ts +0 -2061
- package/dist/generated/mcp.js +0 -4692
- package/dist/generated/mcp.mjs +0 -4508
- package/dist/generated/schemas.d.mts +0 -19403
- package/dist/generated/schemas.d.ts +0 -19403
- package/dist/generated/schemas.js +0 -7619
- package/dist/generated/schemas.mjs +0 -7589
- package/dist/generated/types.d.mts +0 -15009
- package/dist/generated/types.d.ts +0 -15009
- package/dist/generated/types.js +0 -951
- package/dist/generated/types.mjs +0 -946
- package/dist/index.js +0 -49
- package/dist/mcp.js +0 -5
- package/dist/utils/fetch.d.mts +0 -18
- package/dist/utils/fetch.d.ts +0 -18
- package/dist/utils/fetch.js +0 -8
- package/dist/utils/fetch.mjs +0 -5
- package/dist/utils/fetcher.d.mts +0 -21
- package/dist/utils/fetcher.d.ts +0 -21
- package/dist/utils/fetcher.js +0 -69
- package/dist/utils/fetcher.mjs +0 -66
- package/dist/utils/lang.d.mts +0 -1
- package/dist/utils/lang.d.ts +0 -1
- package/dist/utils/lang.js +0 -9
- package/dist/utils/lang.mjs +0 -6
- package/dist/utils/mcp.d.mts +0 -1
- package/dist/utils/mcp.d.ts +0 -1
- package/dist/utils/mcp.js +0 -2
- package/dist/utils/mcp.mjs +0 -1
- package/dist/utils/types.d.mts +0 -3
- package/dist/utils/types.d.ts +0 -3
- package/dist/utils/types.js +0 -2
- package/dist/utils/types.mjs +0 -1
package/dist/index.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.Types = exports.Schemas = exports.Helpers = exports.Fetchers = void 0;
|
|
40
|
-
const Components = __importStar(require("./generated/components.js"));
|
|
41
|
-
const Schemas = __importStar(require("./generated/schemas.js"));
|
|
42
|
-
exports.Schemas = Schemas;
|
|
43
|
-
const Types = __importStar(require("./generated/types.js"));
|
|
44
|
-
exports.Types = Types;
|
|
45
|
-
const { operationsByPath, operationsByTag, tagDictionary, ...Fetchers } = Components;
|
|
46
|
-
exports.Fetchers = Fetchers;
|
|
47
|
-
const Helpers = { operationsByPath, operationsByTag, tagDictionary };
|
|
48
|
-
exports.Helpers = Helpers;
|
|
49
|
-
__exportStar(require("./client.js"), exports);
|
package/dist/mcp.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initMcpTools = void 0;
|
|
4
|
-
var mcp_1 = require("./generated/mcp.js");
|
|
5
|
-
Object.defineProperty(exports, "initMcpTools", { enumerable: true, get: function () { return mcp_1.initMcpTools; } });
|
package/dist/utils/fetch.d.mts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type RequestInit = {
|
|
2
|
-
body?: string | FormData | undefined;
|
|
3
|
-
headers?: Record<string, string> | undefined;
|
|
4
|
-
method?: string | undefined;
|
|
5
|
-
signal?: any | undefined;
|
|
6
|
-
};
|
|
7
|
-
export type Response = {
|
|
8
|
-
ok: boolean;
|
|
9
|
-
status: number;
|
|
10
|
-
url: string;
|
|
11
|
-
json(): Promise<any>;
|
|
12
|
-
text(): Promise<string>;
|
|
13
|
-
headers?: {
|
|
14
|
-
get(name: string): string | null;
|
|
15
|
-
} | undefined;
|
|
16
|
-
};
|
|
17
|
-
export type FetchImpl = (url: string, init?: RequestInit) => Promise<Response>;
|
|
18
|
-
export declare function formEncoded<T extends Record<string, string>>(data: T): string;
|
package/dist/utils/fetch.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type RequestInit = {
|
|
2
|
-
body?: string | FormData | undefined;
|
|
3
|
-
headers?: Record<string, string> | undefined;
|
|
4
|
-
method?: string | undefined;
|
|
5
|
-
signal?: any | undefined;
|
|
6
|
-
};
|
|
7
|
-
export type Response = {
|
|
8
|
-
ok: boolean;
|
|
9
|
-
status: number;
|
|
10
|
-
url: string;
|
|
11
|
-
json(): Promise<any>;
|
|
12
|
-
text(): Promise<string>;
|
|
13
|
-
headers?: {
|
|
14
|
-
get(name: string): string | null;
|
|
15
|
-
} | undefined;
|
|
16
|
-
};
|
|
17
|
-
export type FetchImpl = (url: string, init?: RequestInit) => Promise<Response>;
|
|
18
|
-
export declare function formEncoded<T extends Record<string, string>>(data: T): string;
|
package/dist/utils/fetch.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formEncoded = formEncoded;
|
|
4
|
-
function formEncoded(data) {
|
|
5
|
-
return Object.entries(data)
|
|
6
|
-
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
|
|
7
|
-
.join('&');
|
|
8
|
-
}
|
package/dist/utils/fetch.mjs
DELETED
package/dist/utils/fetcher.d.mts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { FetchImpl } from "./fetch.mjs";
|
|
2
|
-
export type FetcherConfig = {
|
|
3
|
-
token?: string | null;
|
|
4
|
-
fetchImpl?: FetchImpl;
|
|
5
|
-
headers?: Record<string, any>;
|
|
6
|
-
};
|
|
7
|
-
export type ErrorWrapper<TError> = TError | {
|
|
8
|
-
status: 'unknown';
|
|
9
|
-
payload: string;
|
|
10
|
-
};
|
|
11
|
-
export type FetcherOptions<TBody, THeaders, TQueryParams, TPathParams> = {
|
|
12
|
-
url: string;
|
|
13
|
-
method: string;
|
|
14
|
-
body?: TBody | undefined;
|
|
15
|
-
headers?: THeaders | undefined;
|
|
16
|
-
queryParams?: TQueryParams | undefined;
|
|
17
|
-
pathParams?: TPathParams | undefined;
|
|
18
|
-
signal?: AbortSignal | undefined;
|
|
19
|
-
} & FetcherConfig;
|
|
20
|
-
export declare function client<TData, TError, TBody, THeaders, TQueryParams, TPathParams>({ url, method, body, headers, queryParams, signal, token, fetchImpl }: FetcherOptions<TBody, THeaders, TQueryParams, TPathParams>): Promise<TData>;
|
|
21
|
-
export default client;
|
package/dist/utils/fetcher.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { FetchImpl } from "./fetch.js";
|
|
2
|
-
export type FetcherConfig = {
|
|
3
|
-
token?: string | null;
|
|
4
|
-
fetchImpl?: FetchImpl;
|
|
5
|
-
headers?: Record<string, any>;
|
|
6
|
-
};
|
|
7
|
-
export type ErrorWrapper<TError> = TError | {
|
|
8
|
-
status: 'unknown';
|
|
9
|
-
payload: string;
|
|
10
|
-
};
|
|
11
|
-
export type FetcherOptions<TBody, THeaders, TQueryParams, TPathParams> = {
|
|
12
|
-
url: string;
|
|
13
|
-
method: string;
|
|
14
|
-
body?: TBody | undefined;
|
|
15
|
-
headers?: THeaders | undefined;
|
|
16
|
-
queryParams?: TQueryParams | undefined;
|
|
17
|
-
pathParams?: TPathParams | undefined;
|
|
18
|
-
signal?: AbortSignal | undefined;
|
|
19
|
-
} & FetcherConfig;
|
|
20
|
-
export declare function client<TData, TError, TBody, THeaders, TQueryParams, TPathParams>({ url, method, body, headers, queryParams, signal, token, fetchImpl }: FetcherOptions<TBody, THeaders, TQueryParams, TPathParams>): Promise<TData>;
|
|
21
|
-
export default client;
|
package/dist/utils/fetcher.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.client = client;
|
|
4
|
-
const lang_1 = require("./lang.js");
|
|
5
|
-
const baseUrl = 'https://api.vercel.com';
|
|
6
|
-
async function client({ url, method, body, headers, queryParams, signal, token = null, fetchImpl = fetch }) {
|
|
7
|
-
try {
|
|
8
|
-
const requestHeaders = (0, lang_1.compactObject)({
|
|
9
|
-
'Content-Type': 'application/json',
|
|
10
|
-
Authorization: token ? `Bearer ${token}` : undefined,
|
|
11
|
-
...headers
|
|
12
|
-
});
|
|
13
|
-
/**
|
|
14
|
-
* As the fetch API is being used, when multipart/form-data is specified
|
|
15
|
-
* the Content-Type header must be deleted so that the browser can set
|
|
16
|
-
* the correct boundary.
|
|
17
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects#sending_files_using_a_formdata_object
|
|
18
|
-
*/
|
|
19
|
-
if (requestHeaders['Content-Type']?.toLowerCase().includes('multipart/form-data')) {
|
|
20
|
-
delete requestHeaders['Content-Type'];
|
|
21
|
-
}
|
|
22
|
-
const payload = body instanceof FormData
|
|
23
|
-
? body
|
|
24
|
-
: requestHeaders['Content-Type'] === 'application/json'
|
|
25
|
-
? JSON.stringify(body)
|
|
26
|
-
: body;
|
|
27
|
-
const fullUrl = `${baseUrl}${resolveUrl(url, queryParams)}`;
|
|
28
|
-
const response = await fetchImpl(fullUrl, {
|
|
29
|
-
signal,
|
|
30
|
-
method: method.toUpperCase(),
|
|
31
|
-
body: payload,
|
|
32
|
-
headers: requestHeaders
|
|
33
|
-
});
|
|
34
|
-
if (!response.ok) {
|
|
35
|
-
let error;
|
|
36
|
-
try {
|
|
37
|
-
error = await response.json();
|
|
38
|
-
}
|
|
39
|
-
catch (e) {
|
|
40
|
-
error = {
|
|
41
|
-
status: 'unknown',
|
|
42
|
-
payload: e instanceof Error ? `Unexpected error (${e.message})` : 'Unexpected error'
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
throw error;
|
|
46
|
-
}
|
|
47
|
-
if (response.headers?.get('content-type')?.includes('json')) {
|
|
48
|
-
return await response.json();
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
// if it is not a json response, assume it is a blob and cast it to TData
|
|
52
|
-
return (await response.text());
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
catch (e) {
|
|
56
|
-
const errorObject = {
|
|
57
|
-
name: 'unknown',
|
|
58
|
-
message: e?.message ? `${e?.message}` : 'Network error'
|
|
59
|
-
};
|
|
60
|
-
throw errorObject;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
const resolveUrl = (url, queryParams = {}) => {
|
|
64
|
-
let query = new URLSearchParams(queryParams).toString();
|
|
65
|
-
if (query)
|
|
66
|
-
query = `?${query}`;
|
|
67
|
-
return url + query;
|
|
68
|
-
};
|
|
69
|
-
exports.default = client;
|
package/dist/utils/fetcher.mjs
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { compactObject } from "./lang.mjs";
|
|
2
|
-
const baseUrl = 'https://api.vercel.com';
|
|
3
|
-
export async function client({ url, method, body, headers, queryParams, signal, token = null, fetchImpl = fetch }) {
|
|
4
|
-
try {
|
|
5
|
-
const requestHeaders = compactObject({
|
|
6
|
-
'Content-Type': 'application/json',
|
|
7
|
-
Authorization: token ? `Bearer ${token}` : undefined,
|
|
8
|
-
...headers
|
|
9
|
-
});
|
|
10
|
-
/**
|
|
11
|
-
* As the fetch API is being used, when multipart/form-data is specified
|
|
12
|
-
* the Content-Type header must be deleted so that the browser can set
|
|
13
|
-
* the correct boundary.
|
|
14
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects#sending_files_using_a_formdata_object
|
|
15
|
-
*/
|
|
16
|
-
if (requestHeaders['Content-Type']?.toLowerCase().includes('multipart/form-data')) {
|
|
17
|
-
delete requestHeaders['Content-Type'];
|
|
18
|
-
}
|
|
19
|
-
const payload = body instanceof FormData
|
|
20
|
-
? body
|
|
21
|
-
: requestHeaders['Content-Type'] === 'application/json'
|
|
22
|
-
? JSON.stringify(body)
|
|
23
|
-
: body;
|
|
24
|
-
const fullUrl = `${baseUrl}${resolveUrl(url, queryParams)}`;
|
|
25
|
-
const response = await fetchImpl(fullUrl, {
|
|
26
|
-
signal,
|
|
27
|
-
method: method.toUpperCase(),
|
|
28
|
-
body: payload,
|
|
29
|
-
headers: requestHeaders
|
|
30
|
-
});
|
|
31
|
-
if (!response.ok) {
|
|
32
|
-
let error;
|
|
33
|
-
try {
|
|
34
|
-
error = await response.json();
|
|
35
|
-
}
|
|
36
|
-
catch (e) {
|
|
37
|
-
error = {
|
|
38
|
-
status: 'unknown',
|
|
39
|
-
payload: e instanceof Error ? `Unexpected error (${e.message})` : 'Unexpected error'
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
throw error;
|
|
43
|
-
}
|
|
44
|
-
if (response.headers?.get('content-type')?.includes('json')) {
|
|
45
|
-
return await response.json();
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
// if it is not a json response, assume it is a blob and cast it to TData
|
|
49
|
-
return (await response.text());
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
catch (e) {
|
|
53
|
-
const errorObject = {
|
|
54
|
-
name: 'unknown',
|
|
55
|
-
message: e?.message ? `${e?.message}` : 'Network error'
|
|
56
|
-
};
|
|
57
|
-
throw errorObject;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
const resolveUrl = (url, queryParams = {}) => {
|
|
61
|
-
let query = new URLSearchParams(queryParams).toString();
|
|
62
|
-
if (query)
|
|
63
|
-
query = `?${query}`;
|
|
64
|
-
return url + query;
|
|
65
|
-
};
|
|
66
|
-
export default client;
|
package/dist/utils/lang.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function compactObject<T>(obj: Record<string, T | null | undefined>): Record<string, T>;
|
package/dist/utils/lang.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function compactObject<T>(obj: Record<string, T | null | undefined>): Record<string, T>;
|
package/dist/utils/lang.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.compactObject = compactObject;
|
|
4
|
-
function notEmpty(value) {
|
|
5
|
-
return value !== null && value !== undefined;
|
|
6
|
-
}
|
|
7
|
-
function compactObject(obj) {
|
|
8
|
-
return Object.fromEntries(Object.entries(obj).filter(([, value]) => notEmpty(value)));
|
|
9
|
-
}
|
package/dist/utils/lang.mjs
DELETED
package/dist/utils/mcp.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
package/dist/utils/mcp.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
package/dist/utils/mcp.js
DELETED
package/dist/utils/mcp.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/utils/types.d.mts
DELETED
package/dist/utils/types.d.ts
DELETED
package/dist/utils/types.js
DELETED
package/dist/utils/types.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|