@theholocron/vercel-client 1.58.0-alpha.1 → 1.58.0-alpha.10
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.d.mts +79 -1
- package/dist/index.mjs +1 -0
- package/package.json +16 -16
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import "@theholocron/http-client";
|
|
2
2
|
import { ErrorSink, Logger } from "@theholocron/observability/core";
|
|
3
|
+
/** Options for `createVercelClient()` and `createVercelRestClient()`. */
|
|
3
4
|
interface VercelClientOptions {
|
|
4
5
|
/** Vercel API token. */
|
|
5
6
|
token: string;
|
|
6
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Team ID — appended as `?teamId=` on every request. Omit for personal accounts.
|
|
9
|
+
* Required for team-owned resources (projects, deployments, env vars); without it, requests
|
|
10
|
+
* target personal account resources only. Find it in Vercel dashboard → Team Settings → General.
|
|
11
|
+
*/
|
|
7
12
|
teamId?: string;
|
|
8
13
|
/** Override base URL for testing. Defaults to https://api.vercel.com. */
|
|
9
14
|
baseUrl?: string;
|
|
@@ -14,21 +19,35 @@ interface VercelClientOptions {
|
|
|
14
19
|
/** Reports transport failures and unexpected 5xx. Defaults to a no-op. */
|
|
15
20
|
errors?: ErrorSink;
|
|
16
21
|
}
|
|
22
|
+
/** The lifecycle state of a Vercel deployment; `READY` means it is serving traffic. */
|
|
17
23
|
type VercelDeploymentState = "INITIALIZING" | "QUEUED" | "BUILDING" | "READY" | "ERROR" | "CANCELED";
|
|
24
|
+
/** The environment a deployment is built for. */
|
|
18
25
|
type VercelDeploymentTarget = "production" | "staging";
|
|
26
|
+
/** A Vercel deployment as the API returns it. */
|
|
19
27
|
interface VercelDeployment {
|
|
28
|
+
/** The deployment id. */
|
|
20
29
|
id: string;
|
|
30
|
+
/** The deployment's generated hostname, without a scheme. */
|
|
21
31
|
url: string;
|
|
32
|
+
/** Where the deployment is in its lifecycle. */
|
|
22
33
|
readyState: VercelDeploymentState;
|
|
34
|
+
/** The environment the deployment was built for; absent or `null` for a preview. */
|
|
23
35
|
target?: VercelDeploymentTarget | null;
|
|
36
|
+
/** Git metadata Vercel attaches to the deployment. */
|
|
24
37
|
meta?: {
|
|
38
|
+
/** The branch or ref the deployment was built from. */
|
|
25
39
|
githubCommitRef?: string;
|
|
26
40
|
};
|
|
27
41
|
}
|
|
42
|
+
/** Input for `deployments.trigger()`: deploy a branch of a linked GitHub repository. */
|
|
28
43
|
interface VercelTriggerDeploymentInput {
|
|
44
|
+
/** The Vercel project to deploy. */
|
|
29
45
|
projectName: string;
|
|
46
|
+
/** The Git branch (ref) to deploy. */
|
|
30
47
|
branch: string;
|
|
48
|
+
/** The numeric GitHub repository id. */
|
|
31
49
|
repoId: number;
|
|
50
|
+
/** The environment to deploy to; omitted, Vercel decides. */
|
|
32
51
|
target?: VercelDeploymentTarget;
|
|
33
52
|
}
|
|
34
53
|
/** One file for `deployments.create()` — content is sent inline, base64-encoded. */
|
|
@@ -38,8 +57,11 @@ interface VercelDeployFile {
|
|
|
38
57
|
/** File content, plain text — base64-encoded by `create()` before the request goes out. */
|
|
39
58
|
content: string;
|
|
40
59
|
}
|
|
60
|
+
/** Input for `deployments.create()`: deploy source files without a Git repository. */
|
|
41
61
|
interface VercelCreateDeploymentInput {
|
|
62
|
+
/** The Vercel project to deploy to. */
|
|
42
63
|
projectName: string;
|
|
64
|
+
/** The files that make up the deployment. */
|
|
43
65
|
files: VercelDeployFile[];
|
|
44
66
|
/**
|
|
45
67
|
* `projectSettings.framework`. `null` (the default) deploys with no
|
|
@@ -48,14 +70,21 @@ interface VercelCreateDeploymentInput {
|
|
|
48
70
|
* later deployments inherit it unless overridden here again.
|
|
49
71
|
*/
|
|
50
72
|
framework?: string | null;
|
|
73
|
+
/** The environment to deploy to; omitted, Vercel decides. */
|
|
51
74
|
target?: VercelDeploymentTarget;
|
|
52
75
|
}
|
|
76
|
+
/** A domain attached to a Vercel project. */
|
|
53
77
|
interface VercelDomain {
|
|
78
|
+
/** The domain name. */
|
|
54
79
|
name: string;
|
|
80
|
+
/** The domain's apex (registrable) name. */
|
|
55
81
|
apexName: string;
|
|
82
|
+
/** Whether Vercel has verified ownership of the domain. */
|
|
56
83
|
verified: boolean;
|
|
57
84
|
}
|
|
85
|
+
/** The response of `domains.list()`. */
|
|
58
86
|
interface VercelDomainsResponse {
|
|
87
|
+
/** The domains attached to the project. */
|
|
59
88
|
domains: VercelDomain[];
|
|
60
89
|
}
|
|
61
90
|
/**
|
|
@@ -67,20 +96,31 @@ interface VercelDomainsResponse {
|
|
|
67
96
|
* host — always read it from this response, never hardcode it.
|
|
68
97
|
*/
|
|
69
98
|
interface VercelDomainVerification {
|
|
99
|
+
/** The record type to create: `CNAME` or `TXT`. */
|
|
70
100
|
type: string;
|
|
101
|
+
/** The name the record goes on. */
|
|
71
102
|
domain: string;
|
|
103
|
+
/** The record content. */
|
|
72
104
|
value: string;
|
|
105
|
+
/** Why Vercel asks for this record. */
|
|
73
106
|
reason: string;
|
|
74
107
|
}
|
|
108
|
+
/** The response of `domains.add()`. */
|
|
75
109
|
interface VercelAddDomainResult {
|
|
110
|
+
/** The domain name. */
|
|
76
111
|
name: string;
|
|
112
|
+
/** The domain's apex (registrable) name. */
|
|
77
113
|
apexName: string;
|
|
114
|
+
/** Whether ownership is already verified; when `false`, `verification` lists what to do. */
|
|
78
115
|
verified: boolean;
|
|
116
|
+
/** The challenges to complete to verify ownership; absent when already verified. */
|
|
79
117
|
verification?: VercelDomainVerification[];
|
|
80
118
|
}
|
|
81
119
|
/** One ranked CNAME/IPv4 recommendation — `rank: 1` is the preferred value. */
|
|
82
120
|
interface VercelDomainConfigRecommendation<T> {
|
|
121
|
+
/** The preference order; `1` is the preferred value. */
|
|
83
122
|
rank: number;
|
|
123
|
+
/** The recommended value. */
|
|
84
124
|
value: T;
|
|
85
125
|
}
|
|
86
126
|
/**
|
|
@@ -102,52 +142,89 @@ interface VercelDomainConfig {
|
|
|
102
142
|
/** Recommended A-record IPv4(s) for an apex domain, ranked. */
|
|
103
143
|
recommendedIPv4: VercelDomainConfigRecommendation<string[]>[];
|
|
104
144
|
}
|
|
145
|
+
/** An environment a variable applies to. */
|
|
105
146
|
type VercelEnvTarget = "production" | "preview" | "development";
|
|
147
|
+
/** An environment variable on a project, as the API lists it. */
|
|
106
148
|
interface VercelEnvVar {
|
|
149
|
+
/** The variable's id. */
|
|
107
150
|
id: string;
|
|
151
|
+
/** The variable's name. */
|
|
108
152
|
key: string;
|
|
153
|
+
/** The environments the variable applies to. */
|
|
109
154
|
target: VercelEnvTarget[];
|
|
110
155
|
}
|
|
156
|
+
/** The response of `env.list()`. */
|
|
111
157
|
interface VercelEnvVarsResponse {
|
|
158
|
+
/** The project's environment variables. */
|
|
112
159
|
envs: VercelEnvVar[];
|
|
113
160
|
}
|
|
161
|
+
/** The Git repository a project is linked to. */
|
|
114
162
|
interface VercelProjectLink {
|
|
163
|
+
/** The Git provider, e.g. `github`. */
|
|
115
164
|
type?: string;
|
|
165
|
+
/** The provider's numeric repository id. */
|
|
116
166
|
repoId?: number;
|
|
167
|
+
/** The repository name. */
|
|
117
168
|
repo?: string;
|
|
169
|
+
/** The organization or user that owns the repository. */
|
|
118
170
|
org?: string;
|
|
119
171
|
}
|
|
172
|
+
/** A Vercel project as the API returns it. */
|
|
120
173
|
interface VercelProject {
|
|
174
|
+
/** The project id. */
|
|
121
175
|
id: string;
|
|
176
|
+
/** The project name. */
|
|
122
177
|
name: string;
|
|
178
|
+
/** The framework preset, or `null` for none. */
|
|
123
179
|
framework?: string | null;
|
|
180
|
+
/** The directory in the repository the project builds from, or `null` for the root. */
|
|
124
181
|
rootDirectory?: string | null;
|
|
182
|
+
/** The linked Git repository, or `null` when there is none. */
|
|
125
183
|
link?: VercelProjectLink | null;
|
|
126
184
|
}
|
|
185
|
+
/** The response of `projects.list()`. */
|
|
127
186
|
interface VercelProjectsResponse {
|
|
187
|
+
/** The projects the token can see. */
|
|
128
188
|
projects: VercelProject[];
|
|
129
189
|
}
|
|
190
|
+
/** Input for `projects.create()`. */
|
|
130
191
|
interface VercelCreateProjectInput {
|
|
192
|
+
/** The project name. */
|
|
131
193
|
name: string;
|
|
194
|
+
/** The framework preset; omitted, none is sent. */
|
|
132
195
|
framework?: string;
|
|
196
|
+
/** A GitHub repository (`owner/name`) to link the project to. */
|
|
133
197
|
repo?: string;
|
|
198
|
+
/** The directory in the repository the project builds from. */
|
|
134
199
|
rootDirectory?: string;
|
|
135
200
|
}
|
|
201
|
+
/** Input for `projects.update()`; only the fields given are sent. */
|
|
136
202
|
interface VercelUpdateProjectInput {
|
|
203
|
+
/** Turn preview deployments off (`true`) or on (`false`). */
|
|
137
204
|
previewDeploymentsDisabled?: boolean;
|
|
205
|
+
/** Git integration settings for the project. */
|
|
138
206
|
gitProviderOptions?: {
|
|
207
|
+
/** Whether (or when) Vercel creates deployments for pushes to the linked repository. */
|
|
139
208
|
createDeployments?: boolean | string;
|
|
140
209
|
};
|
|
141
210
|
}
|
|
211
|
+
/** The authenticated Vercel user. */
|
|
142
212
|
interface VercelUser {
|
|
213
|
+
/** The user id. */
|
|
143
214
|
id?: string;
|
|
215
|
+
/** The user's username. */
|
|
144
216
|
username?: string;
|
|
217
|
+
/** The user's email address. */
|
|
145
218
|
email?: string;
|
|
219
|
+
/** The user's display name. */
|
|
146
220
|
name?: string;
|
|
147
221
|
}
|
|
222
|
+
/** The response of `user.get()`. */
|
|
148
223
|
interface VercelUserResponse {
|
|
224
|
+
/** The authenticated user. */
|
|
149
225
|
user?: VercelUser;
|
|
150
226
|
}
|
|
227
|
+
/** Create a Vercel client with `deployments`, `domains`, `env`, `projects` and `user` groups, all sharing one REST client built from `opts`. */
|
|
151
228
|
export declare function createVercelClient(opts: VercelClientOptions): {
|
|
152
229
|
deployments: {
|
|
153
230
|
trigger: (input: VercelTriggerDeploymentInput) => Promise<VercelDeployment>;
|
|
@@ -173,5 +250,6 @@ export declare function createVercelClient(opts: VercelClientOptions): {
|
|
|
173
250
|
get: () => Promise<VercelUserResponse>;
|
|
174
251
|
};
|
|
175
252
|
};
|
|
253
|
+
/** The client `createVercelClient()` returns. */
|
|
176
254
|
export type VercelClient = ReturnType<typeof createVercelClient>;
|
|
177
255
|
export type { VercelAddDomainResult, VercelClientOptions, VercelCreateDeploymentInput, VercelCreateProjectInput, VercelDeployFile, VercelDeployment, VercelDeploymentState, VercelDeploymentTarget, VercelDomain, VercelDomainConfig, VercelDomainConfigRecommendation, VercelDomainVerification, VercelDomainsResponse, VercelEnvTarget, VercelEnvVar, VercelEnvVarsResponse, VercelProject, VercelProjectLink, VercelProjectsResponse, VercelTriggerDeploymentInput, VercelUpdateProjectInput, VercelUser, VercelUserResponse };
|
package/dist/index.mjs
CHANGED
|
@@ -118,6 +118,7 @@ function createVercelRestClient(opts) {
|
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
120
|
// src/index.ts
|
|
121
|
+
/** Create a Vercel client with `deployments`, `domains`, `env`, `projects` and `user` groups, all sharing one REST client built from `opts`. */
|
|
121
122
|
function createVercelClient(opts) {
|
|
122
123
|
const rest = createVercelRestClient(opts);
|
|
123
124
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/vercel-client",
|
|
3
|
-
"version": "1.58.0-alpha.
|
|
3
|
+
"version": "1.58.0-alpha.10",
|
|
4
4
|
"description": "A TypeScript client for the Vercel API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vercel",
|
|
@@ -32,23 +32,23 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@theholocron/http-client": "^1.58.0-alpha.
|
|
36
|
-
"@theholocron/observability": "^0.
|
|
35
|
+
"@theholocron/http-client": "^1.58.0-alpha.10",
|
|
36
|
+
"@theholocron/observability": "^0.7.0-alpha.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "^26",
|
|
40
40
|
"@vitest/coverage-v8": "^5.0.5",
|
|
41
|
-
"@vitest/eslint-plugin": "^1.6.
|
|
42
|
-
"eslint": "^10.
|
|
43
|
-
"eslint-plugin-n": "^18.
|
|
44
|
-
"globals": "^17.
|
|
45
|
-
"tsdown": "^0.23.
|
|
41
|
+
"@vitest/eslint-plugin": "^1.6.28",
|
|
42
|
+
"eslint": "^10.14.0",
|
|
43
|
+
"eslint-plugin-n": "^18.5.0",
|
|
44
|
+
"globals": "^17.14.0",
|
|
45
|
+
"tsdown": "^0.23.4",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
47
|
"vitest": "^5.0.5",
|
|
48
|
-
"@theholocron/eslint-config": "^8.9.0-alpha.
|
|
49
|
-
"@theholocron/tsdown-config": "^8.9.0-alpha.
|
|
50
|
-
"@theholocron/tsconfig": "^8.9.0-alpha.
|
|
51
|
-
"@theholocron/vitest-config": "^8.9.0-alpha.
|
|
48
|
+
"@theholocron/eslint-config": "^8.9.0-alpha.8",
|
|
49
|
+
"@theholocron/tsdown-config": "^8.9.0-alpha.8",
|
|
50
|
+
"@theholocron/tsconfig": "^8.9.0-alpha.8",
|
|
51
|
+
"@theholocron/vitest-config": "^8.9.0-alpha.8"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22.0.0"
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
|
-
"
|
|
61
|
-
"
|
|
60
|
+
"build": "tsdown && node ../scripts/check-bundle-size.mjs",
|
|
61
|
+
"lint:code": "eslint .",
|
|
62
|
+
"test:unit": "vitest run --coverage",
|
|
62
63
|
"test:watch": "vitest",
|
|
63
|
-
"
|
|
64
|
-
"verification.unitTests": "vitest run"
|
|
64
|
+
"typecheck": "tsc --noEmit"
|
|
65
65
|
}
|
|
66
66
|
}
|