@theholocron/vercel-client 1.22.0 → 1.23.0

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/README.md CHANGED
@@ -63,6 +63,16 @@ const fnDeployment = await vercel.deployments.create({
63
63
 
64
64
  // Poll deployment status
65
65
  const status = await vercel.deployments.get(deployment.id);
66
+
67
+ // List a project's custom domains
68
+ const { domains } = await vercel.domains.list("project-id");
69
+
70
+ // Add a custom domain — the CNAME target is generated per-project by
71
+ // Vercel, not a fixed well-known host; always read it from the response
72
+ const added = await vercel.domains.add("project-id", "sentinel.example.com");
73
+ if (!added.verified) {
74
+ console.log(added.verification); // [{ type: "CNAME", domain, value }]
75
+ }
66
76
  ```
67
77
 
68
78
  ## Status
package/dist/index.d.mts CHANGED
@@ -54,6 +54,36 @@ interface VercelCreateDeploymentInput {
54
54
  target?: VercelDeploymentTarget;
55
55
  }
56
56
  //#endregion
57
+ //#region src/domains/domains.d.ts
58
+ interface VercelDomain {
59
+ name: string;
60
+ apexName: string;
61
+ verified: boolean;
62
+ }
63
+ interface VercelDomainsResponse {
64
+ domains: VercelDomain[];
65
+ }
66
+ /**
67
+ * One DNS verification challenge — complete any one of these (usually
68
+ * just one is returned) to prove ownership. `type: "CNAME"` means
69
+ * `domain` needs a CNAME record pointing at `value`; `type: "TXT"`
70
+ * means a TXT record on `domain` with content `value`. The CNAME
71
+ * target is generated per-project by Vercel, not a fixed well-known
72
+ * host — always read it from this response, never hardcode it.
73
+ */
74
+ interface VercelDomainVerification {
75
+ type: string;
76
+ domain: string;
77
+ value: string;
78
+ reason: string;
79
+ }
80
+ interface VercelAddDomainResult {
81
+ name: string;
82
+ apexName: string;
83
+ verified: boolean;
84
+ verification?: VercelDomainVerification[];
85
+ }
86
+ //#endregion
57
87
  //#region src/env/env.d.ts
58
88
  type VercelEnvTarget = "production" | "preview" | "development";
59
89
  interface VercelEnvVar {
@@ -113,6 +143,10 @@ declare function createVercelClient(opts: VercelClientOptions): {
113
143
  create: (input: VercelCreateDeploymentInput) => Promise<VercelDeployment>;
114
144
  get: (deploymentId: string) => Promise<VercelDeployment>;
115
145
  };
146
+ domains: {
147
+ list: (projectId: string) => Promise<VercelDomainsResponse>;
148
+ add: (projectId: string, name: string) => Promise<VercelAddDomainResult>;
149
+ };
116
150
  env: {
117
151
  list: (projectId: string) => Promise<VercelEnvVarsResponse>;
118
152
  set: (projectId: string, target: VercelEnvTarget, name: string, value: string) => Promise<VercelEnvVar>;
@@ -129,4 +163,4 @@ declare function createVercelClient(opts: VercelClientOptions): {
129
163
  };
130
164
  type VercelClient = ReturnType<typeof createVercelClient>;
131
165
  //#endregion
132
- export { VercelClient, type VercelClientOptions, type VercelCreateDeploymentInput, type VercelCreateProjectInput, type VercelDeployFile, type VercelDeployment, type VercelDeploymentState, type VercelDeploymentTarget, type VercelEnvTarget, type VercelEnvVar, type VercelEnvVarsResponse, type VercelProject, type VercelProjectLink, type VercelProjectsResponse, type VercelTriggerDeploymentInput, type VercelUpdateProjectInput, type VercelUser, type VercelUserResponse, createVercelClient };
166
+ export { type VercelAddDomainResult, VercelClient, type VercelClientOptions, type VercelCreateDeploymentInput, type VercelCreateProjectInput, type VercelDeployFile, type VercelDeployment, type VercelDeploymentState, type VercelDeploymentTarget, type VercelDomain, type VercelDomainVerification, type VercelDomainsResponse, type VercelEnvTarget, type VercelEnvVar, type VercelEnvVarsResponse, type VercelProject, type VercelProjectLink, type VercelProjectsResponse, type VercelTriggerDeploymentInput, type VercelUpdateProjectInput, type VercelUser, type VercelUserResponse, createVercelClient };
package/dist/index.mjs CHANGED
@@ -37,6 +37,17 @@ function deployments(rest) {
37
37
  };
38
38
  }
39
39
  //#endregion
40
+ //#region src/domains/domains.ts
41
+ function domains(rest) {
42
+ return {
43
+ list: (projectId) => rest.request(`/v9/projects/${encodeURIComponent(projectId)}/domains`),
44
+ add: (projectId, name) => rest.request(`/v10/projects/${encodeURIComponent(projectId)}/domains`, {
45
+ method: "POST",
46
+ body: { name }
47
+ })
48
+ };
49
+ }
50
+ //#endregion
40
51
  //#region src/env/env.ts
41
52
  function env(rest) {
42
53
  return {
@@ -109,6 +120,7 @@ function createVercelClient(opts) {
109
120
  const rest = createVercelRestClient(opts);
110
121
  return {
111
122
  deployments: deployments(rest),
123
+ domains: domains(rest),
112
124
  env: env(rest),
113
125
  projects: projects(rest),
114
126
  user: user(rest)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/vercel-client",
3
- "version": "1.22.0",
3
+ "version": "1.23.0",
4
4
  "description": "A TypeScript client for the Vercel API",
5
5
  "keywords": [
6
6
  "vercel",
@@ -33,7 +33,7 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@theholocron/observability": "^0.3.0",
36
- "@theholocron/http-client": "^1.22.0"
36
+ "@theholocron/http-client": "^1.23.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@theholocron/cli": "5.0.0-alpha.3",