@theholocron/vercel-client 1.22.0 → 1.24.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,60 @@ 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
+ /** One ranked CNAME/IPv4 recommendation — `rank: 1` is the preferred value. */
87
+ interface VercelDomainConfigRecommendation<T> {
88
+ rank: number;
89
+ value: T;
90
+ }
91
+ /**
92
+ * DNS *routing* status for a domain — distinct from ownership (`verified`
93
+ * on `VercelDomain`/`VercelAddDomainResult`). A domain can be verified
94
+ * (Vercel trusts you own it) with no record actually pointing traffic at
95
+ * Vercel yet, e.g. re-adding a domain whose apex is already verified on
96
+ * this team short-circuits to `verified: true` with no `verification`
97
+ * challenge (`domains.add` returns 409, not a fresh challenge) — this is
98
+ * the only source for that domain's CNAME target in that case.
99
+ */
100
+ interface VercelDomainConfig {
101
+ /** How Vercel currently sees the domain resolving. `null` = not resolving to Vercel at all. */
102
+ configuredBy: "A" | "CNAME" | "http" | "dns-01" | null;
103
+ /** `false` once DNS is correctly configured and a TLS cert can be issued. */
104
+ misconfigured: boolean;
105
+ /** Recommended CNAME target(s) for a subdomain, ranked; `[0]` is preferred. Per-project, never a fixed host. */
106
+ recommendedCNAME: VercelDomainConfigRecommendation<string>[];
107
+ /** Recommended A-record IPv4(s) for an apex domain, ranked. */
108
+ recommendedIPv4: VercelDomainConfigRecommendation<string[]>[];
109
+ }
110
+ //#endregion
57
111
  //#region src/env/env.d.ts
58
112
  type VercelEnvTarget = "production" | "preview" | "development";
59
113
  interface VercelEnvVar {
@@ -113,6 +167,11 @@ declare function createVercelClient(opts: VercelClientOptions): {
113
167
  create: (input: VercelCreateDeploymentInput) => Promise<VercelDeployment>;
114
168
  get: (deploymentId: string) => Promise<VercelDeployment>;
115
169
  };
170
+ domains: {
171
+ list: (projectId: string) => Promise<VercelDomainsResponse>;
172
+ add: (projectId: string, name: string) => Promise<VercelAddDomainResult>;
173
+ config: (domain: string, projectIdOrName?: string) => Promise<VercelDomainConfig>;
174
+ };
116
175
  env: {
117
176
  list: (projectId: string) => Promise<VercelEnvVarsResponse>;
118
177
  set: (projectId: string, target: VercelEnvTarget, name: string, value: string) => Promise<VercelEnvVar>;
@@ -129,4 +188,4 @@ declare function createVercelClient(opts: VercelClientOptions): {
129
188
  };
130
189
  type VercelClient = ReturnType<typeof createVercelClient>;
131
190
  //#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 };
191
+ export { type VercelAddDomainResult, VercelClient, type VercelClientOptions, type VercelCreateDeploymentInput, type VercelCreateProjectInput, type VercelDeployFile, type VercelDeployment, type VercelDeploymentState, type VercelDeploymentTarget, type VercelDomain, type VercelDomainConfig, type VercelDomainConfigRecommendation, 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,25 @@ 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
+ * DNS routing status for `domain` — works regardless of whether the
50
+ * domain is already attached/verified on a project. `projectIdOrName`
51
+ * is optional per Vercel's docs ("use this when the domain is not yet
52
+ * associated with a project") but passed through when known to scope
53
+ * the recommendation to that project.
54
+ */
55
+ config: (domain, projectIdOrName) => rest.request(`/v6/domains/${encodeURIComponent(domain)}/config`, { query: projectIdOrName ? { projectIdOrName } : void 0 })
56
+ };
57
+ }
58
+ //#endregion
40
59
  //#region src/env/env.ts
41
60
  function env(rest) {
42
61
  return {
@@ -109,6 +128,7 @@ function createVercelClient(opts) {
109
128
  const rest = createVercelRestClient(opts);
110
129
  return {
111
130
  deployments: deployments(rest),
131
+ domains: domains(rest),
112
132
  env: env(rest),
113
133
  projects: projects(rest),
114
134
  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.24.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.24.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@theholocron/cli": "5.0.0-alpha.3",