vercel-api-js 1.0.0 → 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.
Files changed (49) hide show
  1. package/dist/index.cjs +4495 -0
  2. package/dist/index.d.cts +42176 -0
  3. package/dist/index.d.mts +41626 -1168
  4. package/dist/index.d.ts +41626 -1168
  5. package/dist/index.mjs +4488 -5
  6. package/dist/mcp.cjs +4946 -0
  7. package/dist/mcp.d.cts +5 -0
  8. package/dist/mcp.d.mts +5 -0
  9. package/dist/mcp.d.ts +5 -0
  10. package/dist/mcp.mjs +4944 -0
  11. package/dist/shared/vercel-api-js.BaOSBqhR.cjs +6795 -0
  12. package/dist/shared/vercel-api-js.BnRX1F13.mjs +6510 -0
  13. package/dist/shared/vercel-api-js.C9s64N79.d.cts +35 -0
  14. package/dist/shared/vercel-api-js.C9s64N79.d.mts +35 -0
  15. package/dist/shared/vercel-api-js.C9s64N79.d.ts +35 -0
  16. package/package.json +29 -12
  17. package/dist/client.d.mts +0 -228
  18. package/dist/client.d.ts +0 -228
  19. package/dist/client.js +0 -75
  20. package/dist/client.mjs +0 -68
  21. package/dist/generated/components.d.mts +0 -2600
  22. package/dist/generated/components.d.ts +0 -2600
  23. package/dist/generated/components.js +0 -3309
  24. package/dist/generated/components.mjs +0 -3125
  25. package/dist/generated/schemas.d.mts +0 -6536
  26. package/dist/generated/schemas.d.ts +0 -6536
  27. package/dist/generated/schemas.js +0 -7107
  28. package/dist/generated/schemas.mjs +0 -7077
  29. package/dist/generated/types.d.mts +0 -15000
  30. package/dist/generated/types.d.ts +0 -15000
  31. package/dist/generated/types.js +0 -950
  32. package/dist/generated/types.mjs +0 -945
  33. package/dist/index.js +0 -49
  34. package/dist/utils/fetch.d.mts +0 -18
  35. package/dist/utils/fetch.d.ts +0 -18
  36. package/dist/utils/fetch.js +0 -8
  37. package/dist/utils/fetch.mjs +0 -5
  38. package/dist/utils/fetcher.d.mts +0 -22
  39. package/dist/utils/fetcher.d.ts +0 -22
  40. package/dist/utils/fetcher.js +0 -68
  41. package/dist/utils/fetcher.mjs +0 -65
  42. package/dist/utils/lang.d.mts +0 -1
  43. package/dist/utils/lang.d.ts +0 -1
  44. package/dist/utils/lang.js +0 -9
  45. package/dist/utils/lang.mjs +0 -6
  46. package/dist/utils/types.d.mts +0 -3
  47. package/dist/utils/types.d.ts +0 -3
  48. package/dist/utils/types.js +0 -2
  49. 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);
@@ -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;
@@ -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;
@@ -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
- }
@@ -1,5 +0,0 @@
1
- export function formEncoded(data) {
2
- return Object.entries(data)
3
- .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
4
- .join('&');
5
- }
@@ -1,22 +0,0 @@
1
- import { FetchImpl } from "./fetch.mjs";
2
- export type FetcherConfig = {
3
- baseUrl?: string;
4
- token?: string | null;
5
- fetchImpl?: FetchImpl;
6
- headers?: Record<string, any>;
7
- };
8
- export type ErrorWrapper<TError> = TError | {
9
- status: 'unknown';
10
- payload: string;
11
- };
12
- export type FetcherOptions<TBody, THeaders, TQueryParams, TPathParams> = {
13
- url: string;
14
- method: string;
15
- body?: TBody | undefined;
16
- headers?: THeaders | undefined;
17
- queryParams?: TQueryParams | undefined;
18
- pathParams?: TPathParams | undefined;
19
- signal?: AbortSignal | undefined;
20
- } & FetcherConfig;
21
- export declare function client<TData, TError, TBody, THeaders, TQueryParams, TPathParams>({ url, method, body, headers, queryParams, signal, token, baseUrl, fetchImpl }: FetcherOptions<TBody, THeaders, TQueryParams, TPathParams>): Promise<TData>;
22
- export default client;
@@ -1,22 +0,0 @@
1
- import { FetchImpl } from "./fetch.js";
2
- export type FetcherConfig = {
3
- baseUrl?: string;
4
- token?: string | null;
5
- fetchImpl?: FetchImpl;
6
- headers?: Record<string, any>;
7
- };
8
- export type ErrorWrapper<TError> = TError | {
9
- status: 'unknown';
10
- payload: string;
11
- };
12
- export type FetcherOptions<TBody, THeaders, TQueryParams, TPathParams> = {
13
- url: string;
14
- method: string;
15
- body?: TBody | undefined;
16
- headers?: THeaders | undefined;
17
- queryParams?: TQueryParams | undefined;
18
- pathParams?: TPathParams | undefined;
19
- signal?: AbortSignal | undefined;
20
- } & FetcherConfig;
21
- export declare function client<TData, TError, TBody, THeaders, TQueryParams, TPathParams>({ url, method, body, headers, queryParams, signal, token, baseUrl, fetchImpl }: FetcherOptions<TBody, THeaders, TQueryParams, TPathParams>): Promise<TData>;
22
- export default client;
@@ -1,68 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.client = client;
4
- const lang_1 = require("./lang.js");
5
- async function client({ url, method, body, headers, queryParams, signal, token = null, baseUrl = '', fetchImpl = fetch }) {
6
- try {
7
- const requestHeaders = (0, lang_1.compactObject)({
8
- 'Content-Type': 'application/json',
9
- Authorization: token ? `Bearer ${token}` : undefined,
10
- ...headers
11
- });
12
- /**
13
- * As the fetch API is being used, when multipart/form-data is specified
14
- * the Content-Type header must be deleted so that the browser can set
15
- * the correct boundary.
16
- * https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects#sending_files_using_a_formdata_object
17
- */
18
- if (requestHeaders['Content-Type']?.toLowerCase().includes('multipart/form-data')) {
19
- delete requestHeaders['Content-Type'];
20
- }
21
- const payload = body instanceof FormData
22
- ? body
23
- : requestHeaders['Content-Type'] === 'application/json'
24
- ? JSON.stringify(body)
25
- : body;
26
- const fullUrl = `${baseUrl}${resolveUrl(url, queryParams)}`;
27
- const response = await fetchImpl(fullUrl, {
28
- signal,
29
- method: method.toUpperCase(),
30
- body: payload,
31
- headers: requestHeaders
32
- });
33
- if (!response.ok) {
34
- let error;
35
- try {
36
- error = await response.json();
37
- }
38
- catch (e) {
39
- error = {
40
- status: 'unknown',
41
- payload: e instanceof Error ? `Unexpected error (${e.message})` : 'Unexpected error'
42
- };
43
- }
44
- throw error;
45
- }
46
- if (response.headers?.get('content-type')?.includes('json')) {
47
- return await response.json();
48
- }
49
- else {
50
- // if it is not a json response, assume it is a blob and cast it to TData
51
- return (await response.text());
52
- }
53
- }
54
- catch (e) {
55
- const errorObject = {
56
- name: 'unknown',
57
- message: e?.message ? `${e?.message}` : 'Network error'
58
- };
59
- throw errorObject;
60
- }
61
- }
62
- const resolveUrl = (url, queryParams = {}) => {
63
- let query = new URLSearchParams(queryParams).toString();
64
- if (query)
65
- query = `?${query}`;
66
- return url + query;
67
- };
68
- exports.default = client;
@@ -1,65 +0,0 @@
1
- import { compactObject } from "./lang.mjs";
2
- export async function client({ url, method, body, headers, queryParams, signal, token = null, baseUrl = '', fetchImpl = fetch }) {
3
- try {
4
- const requestHeaders = compactObject({
5
- 'Content-Type': 'application/json',
6
- Authorization: token ? `Bearer ${token}` : undefined,
7
- ...headers
8
- });
9
- /**
10
- * As the fetch API is being used, when multipart/form-data is specified
11
- * the Content-Type header must be deleted so that the browser can set
12
- * the correct boundary.
13
- * https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects#sending_files_using_a_formdata_object
14
- */
15
- if (requestHeaders['Content-Type']?.toLowerCase().includes('multipart/form-data')) {
16
- delete requestHeaders['Content-Type'];
17
- }
18
- const payload = body instanceof FormData
19
- ? body
20
- : requestHeaders['Content-Type'] === 'application/json'
21
- ? JSON.stringify(body)
22
- : body;
23
- const fullUrl = `${baseUrl}${resolveUrl(url, queryParams)}`;
24
- const response = await fetchImpl(fullUrl, {
25
- signal,
26
- method: method.toUpperCase(),
27
- body: payload,
28
- headers: requestHeaders
29
- });
30
- if (!response.ok) {
31
- let error;
32
- try {
33
- error = await response.json();
34
- }
35
- catch (e) {
36
- error = {
37
- status: 'unknown',
38
- payload: e instanceof Error ? `Unexpected error (${e.message})` : 'Unexpected error'
39
- };
40
- }
41
- throw error;
42
- }
43
- if (response.headers?.get('content-type')?.includes('json')) {
44
- return await response.json();
45
- }
46
- else {
47
- // if it is not a json response, assume it is a blob and cast it to TData
48
- return (await response.text());
49
- }
50
- }
51
- catch (e) {
52
- const errorObject = {
53
- name: 'unknown',
54
- message: e?.message ? `${e?.message}` : 'Network error'
55
- };
56
- throw errorObject;
57
- }
58
- }
59
- const resolveUrl = (url, queryParams = {}) => {
60
- let query = new URLSearchParams(queryParams).toString();
61
- if (query)
62
- query = `?${query}`;
63
- return url + query;
64
- };
65
- export default client;
@@ -1 +0,0 @@
1
- export declare function compactObject<T>(obj: Record<string, T | null | undefined>): Record<string, T>;
@@ -1 +0,0 @@
1
- export declare function compactObject<T>(obj: Record<string, T | null | undefined>): Record<string, T>;
@@ -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
- }
@@ -1,6 +0,0 @@
1
- function notEmpty(value) {
2
- return value !== null && value !== undefined;
3
- }
4
- export function compactObject(obj) {
5
- return Object.fromEntries(Object.entries(obj).filter(([, value]) => notEmpty(value)));
6
- }
@@ -1,3 +0,0 @@
1
- export type RequiredKeys<T> = {
2
- [K in keyof T]-?: {} extends Pick<T, K> ? never : K;
3
- }[keyof T];
@@ -1,3 +0,0 @@
1
- export type RequiredKeys<T> = {
2
- [K in keyof T]-?: {} extends Pick<T, K> ? never : K;
3
- }[keyof T];
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +0,0 @@
1
- export {};