@theholocron/vercel-client 1.58.0-alpha.2 → 1.58.0-alpha.27

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 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
- /** Team ID — appended as `?teamId=` on every request. Omit for personal accounts. */
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,27 @@ interface VercelCreateDeploymentInput {
48
70
  * later deployments inherit it unless overridden here again.
49
71
  */
50
72
  framework?: string | null;
73
+ /**
74
+ * `projectSettings.installCommand`. Sent explicitly because a deployment made from uploaded
75
+ * files takes its install command from the project's settings, not from an uploaded
76
+ * `vercel.json`; omitted, the project's own setting applies.
77
+ */
78
+ installCommand?: string;
79
+ /** The environment to deploy to; omitted, Vercel decides. */
51
80
  target?: VercelDeploymentTarget;
52
81
  }
82
+ /** A domain attached to a Vercel project. */
53
83
  interface VercelDomain {
84
+ /** The domain name. */
54
85
  name: string;
86
+ /** The domain's apex (registrable) name. */
55
87
  apexName: string;
88
+ /** Whether Vercel has verified ownership of the domain. */
56
89
  verified: boolean;
57
90
  }
91
+ /** The response of `domains.list()`. */
58
92
  interface VercelDomainsResponse {
93
+ /** The domains attached to the project. */
59
94
  domains: VercelDomain[];
60
95
  }
61
96
  /**
@@ -67,20 +102,31 @@ interface VercelDomainsResponse {
67
102
  * host — always read it from this response, never hardcode it.
68
103
  */
69
104
  interface VercelDomainVerification {
105
+ /** The record type to create: `CNAME` or `TXT`. */
70
106
  type: string;
107
+ /** The name the record goes on. */
71
108
  domain: string;
109
+ /** The record content. */
72
110
  value: string;
111
+ /** Why Vercel asks for this record. */
73
112
  reason: string;
74
113
  }
114
+ /** The response of `domains.add()`. */
75
115
  interface VercelAddDomainResult {
116
+ /** The domain name. */
76
117
  name: string;
118
+ /** The domain's apex (registrable) name. */
77
119
  apexName: string;
120
+ /** Whether ownership is already verified; when `false`, `verification` lists what to do. */
78
121
  verified: boolean;
122
+ /** The challenges to complete to verify ownership; absent when already verified. */
79
123
  verification?: VercelDomainVerification[];
80
124
  }
81
125
  /** One ranked CNAME/IPv4 recommendation — `rank: 1` is the preferred value. */
82
126
  interface VercelDomainConfigRecommendation<T> {
127
+ /** The preference order; `1` is the preferred value. */
83
128
  rank: number;
129
+ /** The recommended value. */
84
130
  value: T;
85
131
  }
86
132
  /**
@@ -102,52 +148,89 @@ interface VercelDomainConfig {
102
148
  /** Recommended A-record IPv4(s) for an apex domain, ranked. */
103
149
  recommendedIPv4: VercelDomainConfigRecommendation<string[]>[];
104
150
  }
151
+ /** An environment a variable applies to. */
105
152
  type VercelEnvTarget = "production" | "preview" | "development";
153
+ /** An environment variable on a project, as the API lists it. */
106
154
  interface VercelEnvVar {
155
+ /** The variable's id. */
107
156
  id: string;
157
+ /** The variable's name. */
108
158
  key: string;
159
+ /** The environments the variable applies to. */
109
160
  target: VercelEnvTarget[];
110
161
  }
162
+ /** The response of `env.list()`. */
111
163
  interface VercelEnvVarsResponse {
164
+ /** The project's environment variables. */
112
165
  envs: VercelEnvVar[];
113
166
  }
167
+ /** The Git repository a project is linked to. */
114
168
  interface VercelProjectLink {
169
+ /** The Git provider, e.g. `github`. */
115
170
  type?: string;
171
+ /** The provider's numeric repository id. */
116
172
  repoId?: number;
173
+ /** The repository name. */
117
174
  repo?: string;
175
+ /** The organization or user that owns the repository. */
118
176
  org?: string;
119
177
  }
178
+ /** A Vercel project as the API returns it. */
120
179
  interface VercelProject {
180
+ /** The project id. */
121
181
  id: string;
182
+ /** The project name. */
122
183
  name: string;
184
+ /** The framework preset, or `null` for none. */
123
185
  framework?: string | null;
186
+ /** The directory in the repository the project builds from, or `null` for the root. */
124
187
  rootDirectory?: string | null;
188
+ /** The linked Git repository, or `null` when there is none. */
125
189
  link?: VercelProjectLink | null;
126
190
  }
191
+ /** The response of `projects.list()`. */
127
192
  interface VercelProjectsResponse {
193
+ /** The projects the token can see. */
128
194
  projects: VercelProject[];
129
195
  }
196
+ /** Input for `projects.create()`. */
130
197
  interface VercelCreateProjectInput {
198
+ /** The project name. */
131
199
  name: string;
200
+ /** The framework preset; omitted, none is sent. */
132
201
  framework?: string;
202
+ /** A GitHub repository (`owner/name`) to link the project to. */
133
203
  repo?: string;
204
+ /** The directory in the repository the project builds from. */
134
205
  rootDirectory?: string;
135
206
  }
207
+ /** Input for `projects.update()`; only the fields given are sent. */
136
208
  interface VercelUpdateProjectInput {
209
+ /** Turn preview deployments off (`true`) or on (`false`). */
137
210
  previewDeploymentsDisabled?: boolean;
211
+ /** Git integration settings for the project. */
138
212
  gitProviderOptions?: {
213
+ /** Whether (or when) Vercel creates deployments for pushes to the linked repository. */
139
214
  createDeployments?: boolean | string;
140
215
  };
141
216
  }
217
+ /** The authenticated Vercel user. */
142
218
  interface VercelUser {
219
+ /** The user id. */
143
220
  id?: string;
221
+ /** The user's username. */
144
222
  username?: string;
223
+ /** The user's email address. */
145
224
  email?: string;
225
+ /** The user's display name. */
146
226
  name?: string;
147
227
  }
228
+ /** The response of `user.get()`. */
148
229
  interface VercelUserResponse {
230
+ /** The authenticated user. */
149
231
  user?: VercelUser;
150
232
  }
233
+ /** Create a Vercel client with `deployments`, `domains`, `env`, `projects` and `user` groups, all sharing one REST client built from `opts`. */
151
234
  export declare function createVercelClient(opts: VercelClientOptions): {
152
235
  deployments: {
153
236
  trigger: (input: VercelTriggerDeploymentInput) => Promise<VercelDeployment>;
@@ -173,5 +256,6 @@ export declare function createVercelClient(opts: VercelClientOptions): {
173
256
  get: () => Promise<VercelUserResponse>;
174
257
  };
175
258
  };
259
+ /** The client `createVercelClient()` returns. */
176
260
  export type VercelClient = ReturnType<typeof createVercelClient>;
177
261
  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
@@ -29,7 +29,10 @@ function deployments(rest) {
29
29
  data: Buffer.from(f.content, "utf8").toString("base64"),
30
30
  encoding: "base64"
31
31
  })),
32
- projectSettings: { framework: input.framework ?? null },
32
+ projectSettings: {
33
+ framework: input.framework ?? null,
34
+ ...input.installCommand ? { installCommand: input.installCommand } : {}
35
+ },
33
36
  ...input.target ? { target: input.target } : {}
34
37
  }
35
38
  }),
@@ -118,6 +121,7 @@ function createVercelRestClient(opts) {
118
121
  });
119
122
  }
120
123
  // src/index.ts
124
+ /** Create a Vercel client with `deployments`, `domains`, `env`, `projects` and `user` groups, all sharing one REST client built from `opts`. */
121
125
  function createVercelClient(opts) {
122
126
  const rest = createVercelRestClient(opts);
123
127
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/vercel-client",
3
- "version": "1.58.0-alpha.2",
3
+ "version": "1.58.0-alpha.27",
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.2",
36
- "@theholocron/observability": "^0.6.1-alpha.1"
35
+ "@theholocron/http-client": "^1.58.0-alpha.27",
36
+ "@theholocron/observability": "^0.7.0-alpha.3"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/node": "^26",
40
- "@vitest/coverage-v8": "^5.0.5",
41
- "@vitest/eslint-plugin": "^1.6.27",
42
- "eslint": "^10.8.1",
43
- "eslint-plugin-n": "^18.3.0",
44
- "globals": "^17.11.0",
45
- "tsdown": "^0.23.3",
40
+ "@vitest/coverage-v8": "^5.1.0",
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.5",
46
46
  "typescript": "^5.9.3",
47
- "vitest": "^5.0.5",
48
- "@theholocron/eslint-config": "^8.9.0-alpha.3",
49
- "@theholocron/tsconfig": "^8.9.0-alpha.3",
50
- "@theholocron/tsdown-config": "^8.9.0-alpha.3",
51
- "@theholocron/vitest-config": "^8.9.0-alpha.3"
47
+ "vitest": "^5.1.0",
48
+ "@theholocron/eslint-config": "^8.9.0-alpha.15",
49
+ "@theholocron/tsconfig": "^8.9.0-alpha.15",
50
+ "@theholocron/vitest-config": "^8.9.0-alpha.15",
51
+ "@theholocron/tsdown-config": "^8.9.0-alpha.15"
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
- "delivery.build": "tsdown && node ../scripts/check-bundle-size.mjs",
61
- "sourceQuality.staticAnalysis": "eslint .",
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
- "verification.typeSafety": "tsc --noEmit",
64
- "verification.unitTests": "vitest run"
64
+ "typecheck": "tsc --noEmit"
65
65
  }
66
66
  }