@cosmoner/sdk 1.7.1 → 1.8.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/dist/index.mjs CHANGED
@@ -53,6 +53,24 @@ var AppsService = class {
53
53
  async list(params = {}) {
54
54
  return this.transport.request("GET", this.basePath(params.projectId));
55
55
  }
56
+ /**
57
+ * Fetches one app by id, with its full configuration.
58
+ *
59
+ * Environment variables marked secret come back masked; any other
60
+ * variable's value is returned as stored.
61
+ */
62
+ async get(appId, params = {}) {
63
+ if (!appId) throw new Error("appId is required");
64
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/${appId}`);
65
+ }
66
+ /** Fetches the most recent lines of an app's build or runtime log. */
67
+ async logs(appId, params) {
68
+ if (!appId) throw new Error("appId is required");
69
+ if (params?.type !== "BUILD" && params?.type !== "RUN") throw new Error('type must be "BUILD" or "RUN"');
70
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/${appId}/logs`, {
71
+ query: { type: params.type }
72
+ });
73
+ }
56
74
  /**
57
75
  * Starts deploying an image app and returns the deployment without waiting.
58
76
  *
@@ -112,6 +130,85 @@ var AppsService = class {
112
130
  }
113
131
  };
114
132
 
133
+ // src/services/buckets.ts
134
+ var BucketsService = class {
135
+ constructor(transport, config) {
136
+ this.transport = transport;
137
+ this.config = config;
138
+ }
139
+ /** Lists every bucket in the project. */
140
+ async list(params = {}) {
141
+ return this.transport.request(
142
+ "GET",
143
+ `/v1/projects/${resolveProjectId(this.config, params.projectId)}/storage/object-storage`
144
+ );
145
+ }
146
+ };
147
+
148
+ // src/services/databases.ts
149
+ var DatabasesService = class {
150
+ constructor(transport, config) {
151
+ this.transport = transport;
152
+ this.config = config;
153
+ }
154
+ /** Builds the collection route for the resolved project. */
155
+ basePath(projectId) {
156
+ return `/v1/projects/${resolveProjectId(this.config, projectId)}/databases`;
157
+ }
158
+ /** Lists every database in the project, of every kind, newest first. */
159
+ async list(params = {}) {
160
+ return this.transport.request("GET", this.basePath(params.projectId));
161
+ }
162
+ /** Lists the project's dedicated databases. */
163
+ async listDedicated(params = {}) {
164
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/dedicated`);
165
+ }
166
+ /**
167
+ * Fetches one dedicated database. Its `connectionUri` carries the password;
168
+ * see {@link DedicatedDatabaseDetail}.
169
+ */
170
+ async getDedicated(databaseId, params = {}) {
171
+ if (!databaseId) throw new Error("databaseId is required");
172
+ return this.transport.request(
173
+ "GET",
174
+ `${this.basePath(params.projectId)}/dedicated/${databaseId}`
175
+ );
176
+ }
177
+ /** Lists the project's databases on the shared cluster. */
178
+ async listShared(params = {}) {
179
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/shared`);
180
+ }
181
+ /** Fetches one database on the shared cluster. */
182
+ async getShared(tenantId, params = {}) {
183
+ if (!tenantId) throw new Error("tenantId is required");
184
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/shared/${tenantId}`);
185
+ }
186
+ };
187
+
188
+ // src/services/domains.ts
189
+ var DomainsService = class {
190
+ constructor(transport, config) {
191
+ this.transport = transport;
192
+ this.config = config;
193
+ }
194
+ /** Builds the collection route for the resolved project. */
195
+ basePath(projectId) {
196
+ return `/v1/projects/${resolveProjectId(this.config, projectId)}/domains`;
197
+ }
198
+ /** Lists every domain in the project, with its DNS records. */
199
+ async list(params = {}) {
200
+ return this.transport.request("GET", this.basePath(params.projectId));
201
+ }
202
+ /** Fetches one domain by id or by name, e.g. `example.com`. */
203
+ async get(domain, params = {}) {
204
+ if (!domain) throw new Error("domain is required");
205
+ return this.transport.request(
206
+ "GET",
207
+ `${this.basePath(params.projectId)}/${encodeURIComponent(domain)}`
208
+ );
209
+ }
210
+ };
211
+
115
212
  // src/services/email.ts
116
213
  var EmailService = class {
117
214
  constructor(transport, config) {
@@ -146,6 +243,23 @@ var EmailService = class {
146
243
  }
147
244
  );
148
245
  }
246
+ /** Lists the project's sending domains, with their SMTP credentials and DNS records. */
247
+ // eslint-disable-next-line require-await -- kept `async` like every method here, so callers get one promise contract.
248
+ async listDomains(params = {}) {
249
+ return this.transport.request(
250
+ "GET",
251
+ `/v1/projects/${resolveProjectId(this.config, params.projectId)}/email`
252
+ );
253
+ }
254
+ /** Fetches one sending domain by its id (not its domain name). */
255
+ // eslint-disable-next-line require-await -- `async` makes the validation below reject rather than throw synchronously.
256
+ async getDomain(emailDomainId, params = {}) {
257
+ if (!emailDomainId) throw new Error("emailDomainId is required");
258
+ return this.transport.request(
259
+ "GET",
260
+ `/v1/projects/${resolveProjectId(this.config, params.projectId)}/email/${emailDomainId}`
261
+ );
262
+ }
149
263
  };
150
264
 
151
265
  // src/services/hosting.ts
@@ -180,6 +294,103 @@ var HostingService = class {
180
294
  }
181
295
  };
182
296
 
297
+ // src/services/iam.ts
298
+ var IamService = class {
299
+ constructor(transport, config) {
300
+ this.transport = transport;
301
+ this.config = config;
302
+ }
303
+ /** Builds the collection route for the resolved project. */
304
+ basePath(projectId) {
305
+ return `/v1/projects/${resolveProjectId(this.config, projectId)}/iam`;
306
+ }
307
+ /** Lists every access credential in the project, newest first. */
308
+ async list(params = {}) {
309
+ return this.transport.request("GET", this.basePath(params.projectId));
310
+ }
311
+ /** Fetches one credential by its IAM user name. */
312
+ async get(iamUserName, params = {}) {
313
+ if (!iamUserName) throw new Error("iamUserName is required");
314
+ return this.transport.request(
315
+ "GET",
316
+ `${this.basePath(params.projectId)}/${encodeURIComponent(iamUserName)}`
317
+ );
318
+ }
319
+ };
320
+
321
+ // src/services/members.ts
322
+ var MembersService = class {
323
+ constructor(transport, config) {
324
+ this.transport = transport;
325
+ this.config = config;
326
+ }
327
+ /** Lists the project's members and pending invitations. */
328
+ async list(params = {}) {
329
+ return this.transport.request(
330
+ "GET",
331
+ `/v1/projects/${resolveProjectId(this.config, params.projectId)}/members`
332
+ );
333
+ }
334
+ };
335
+
336
+ // src/services/projects.ts
337
+ var ProjectsService = class {
338
+ constructor(transport) {
339
+ this.transport = transport;
340
+ }
341
+ /** Lists every project the credential can reach, newest first. */
342
+ async list() {
343
+ return this.transport.request("GET", "/v1/projects");
344
+ }
345
+ /** Fetches one project by id or slug. */
346
+ async get(project) {
347
+ if (!project) throw new Error("project is required");
348
+ return this.transport.request("GET", `/v1/projects/${encodeURIComponent(project)}`);
349
+ }
350
+ };
351
+
352
+ // src/services/redis.ts
353
+ var RedisService = class {
354
+ constructor(transport, config) {
355
+ this.transport = transport;
356
+ this.config = config;
357
+ }
358
+ /** Builds the collection route for the resolved project. */
359
+ basePath(projectId) {
360
+ return `/v1/projects/${resolveProjectId(this.config, projectId)}/redis`;
361
+ }
362
+ /** Lists every Redis database in the project that has not been terminated. */
363
+ async list(params = {}) {
364
+ return this.transport.request("GET", this.basePath(params.projectId));
365
+ }
366
+ /** Fetches one Redis database, with its password; see {@link RedisDatabaseDetail}. */
367
+ async get(redisId, params = {}) {
368
+ if (!redisId) throw new Error("redisId is required");
369
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/${redisId}`);
370
+ }
371
+ };
372
+
373
+ // src/services/registries.ts
374
+ var RegistriesService = class {
375
+ constructor(transport, config) {
376
+ this.transport = transport;
377
+ this.config = config;
378
+ }
379
+ /** Builds the collection route for the resolved project. */
380
+ basePath(projectId) {
381
+ return `/v1/projects/${resolveProjectId(this.config, projectId)}/storage/container-registry`;
382
+ }
383
+ /** Lists every registry in the project, with its repositories. */
384
+ async list(params = {}) {
385
+ return this.transport.request("GET", this.basePath(params.projectId));
386
+ }
387
+ /** Fetches one registry, with its repositories. */
388
+ async get(registryId, params = {}) {
389
+ if (!registryId) throw new Error("registryId is required");
390
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/${registryId}`);
391
+ }
392
+ };
393
+
183
394
  // src/services/project-config.ts
184
395
  var PROJECT_ENVIRONMENTS = [
185
396
  "default",
@@ -286,6 +497,42 @@ var SecretsService = class {
286
497
  }
287
498
  };
288
499
 
500
+ // src/services/servers.ts
501
+ var ServersService = class {
502
+ constructor(transport, config) {
503
+ this.transport = transport;
504
+ this.config = config;
505
+ }
506
+ /** Builds the collection route for the resolved project. */
507
+ basePath(projectId) {
508
+ return `/v1/projects/${resolveProjectId(this.config, projectId)}/servers`;
509
+ }
510
+ /** Lists every server in the project that has not been terminated. */
511
+ async list(params = {}) {
512
+ return this.transport.request("GET", this.basePath(params.projectId));
513
+ }
514
+ /** Fetches one server, with the SSH keys installed on it. */
515
+ async get(serverId, params = {}) {
516
+ if (!serverId) throw new Error("serverId is required");
517
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/${serverId}`);
518
+ }
519
+ };
520
+
521
+ // src/services/ssh-keys.ts
522
+ var SshKeysService = class {
523
+ constructor(transport, config) {
524
+ this.transport = transport;
525
+ this.config = config;
526
+ }
527
+ /** Lists every SSH key in the project. */
528
+ async list(params = {}) {
529
+ return this.transport.request(
530
+ "GET",
531
+ `/v1/projects/${resolveProjectId(this.config, params.projectId)}/ssh-keys`
532
+ );
533
+ }
534
+ };
535
+
289
536
  // src/services/variables.ts
290
537
  var VariablesService = class {
291
538
  constructor(transport, config) {
@@ -732,7 +979,7 @@ function sleep(ms) {
732
979
  }
733
980
 
734
981
  // src/version.ts
735
- var VERSION = "1.7.1";
982
+ var VERSION = "1.8.0";
736
983
  var USER_AGENT = `cosmoner-node/${VERSION}`;
737
984
 
738
985
  // src/transport.ts
@@ -856,9 +1103,19 @@ var Cosmoner = class {
856
1103
  this.maxRetries = this.config.maxRetries;
857
1104
  this.transport = new Transport(this.config);
858
1105
  this.apps = new AppsService(this.transport, this.config);
1106
+ this.buckets = new BucketsService(this.transport, this.config);
1107
+ this.databases = new DatabasesService(this.transport, this.config);
1108
+ this.domains = new DomainsService(this.transport, this.config);
859
1109
  this.email = new EmailService(this.transport, this.config);
860
1110
  this.hosting = new HostingService(this.transport, this.config);
1111
+ this.iam = new IamService(this.transport, this.config);
1112
+ this.members = new MembersService(this.transport, this.config);
1113
+ this.projects = new ProjectsService(this.transport);
1114
+ this.redis = new RedisService(this.transport, this.config);
1115
+ this.registries = new RegistriesService(this.transport, this.config);
861
1116
  this.secrets = new SecretsService(this.transport, this.config);
1117
+ this.servers = new ServersService(this.transport, this.config);
1118
+ this.sshKeys = new SshKeysService(this.transport, this.config);
862
1119
  this.variables = new VariablesService(this.transport, this.config);
863
1120
  this.webhooks = new WebhooksService(this.transport, this.config);
864
1121
  }
@@ -1201,6 +1458,7 @@ export {
1201
1458
  APP_SCHEMA_URL,
1202
1459
  AppsService,
1203
1460
  AuthenticationError,
1461
+ BucketsService,
1204
1462
  ConflictError,
1205
1463
  Cosmoner,
1206
1464
  CosmonerConnectionError,
@@ -1214,18 +1472,27 @@ export {
1214
1472
  DEPLOYMENT_FILE_PATHS,
1215
1473
  DEPLOYMENT_KEY_ORDER,
1216
1474
  DEPLOYMENT_VERSION,
1475
+ DatabasesService,
1476
+ DomainsService,
1217
1477
  EVENT_TYPE_HEADER,
1218
1478
  EmailService,
1219
1479
  FINISHED_DEPLOYMENT_PHASES,
1220
1480
  HostingService,
1481
+ IamService,
1221
1482
  InsufficientScopeError,
1222
1483
  MAX_DEPLOYMENT_BYTES,
1484
+ MembersService,
1223
1485
  NotFoundError,
1224
1486
  PROJECT_ENVIRONMENTS,
1487
+ ProjectsService,
1225
1488
  RateLimitError,
1489
+ RedisService,
1490
+ RegistriesService,
1226
1491
  SIGNATURE_HEADER,
1227
1492
  SecretsService,
1228
1493
  ServerError,
1494
+ ServersService,
1495
+ SshKeysService,
1229
1496
  VERSION,
1230
1497
  ValidationError,
1231
1498
  VariablesService,
@@ -71,7 +71,22 @@ interface Envelope<T> {
71
71
  success: true;
72
72
  data: T;
73
73
  }
74
+ /** Which log stream `logs()` reads: the image build, or the running app. */
75
+ export type AppLogType = "BUILD" | "RUN";
76
+ /** Arguments accepted by `client.apps.logs()`. */
77
+ export interface AppLogsParams extends ProjectScopedParams {
78
+ type: AppLogType;
79
+ }
80
+ /** One line of an app's log. */
81
+ export interface AppLogLine {
82
+ message: string;
83
+ timestamp: string;
84
+ }
74
85
  export type ListAppsResponse = Envelope<App[]>;
86
+ export type GetAppResponse = Envelope<App>;
87
+ export type AppLogsResponse = Envelope<{
88
+ lines: AppLogLine[];
89
+ }>;
75
90
  export type DeployAppResponse = Envelope<AppDeployment>;
76
91
  export type GetDeploymentResponse = Envelope<AppDeployment>;
77
92
  /** App lookup and image deploy operations for a project. */
@@ -83,6 +98,15 @@ export declare class AppsService {
83
98
  private basePath;
84
99
  /** Lists every app in the project, newest first. */
85
100
  list(params?: ProjectScopedParams): Promise<ListAppsResponse>;
101
+ /**
102
+ * Fetches one app by id, with its full configuration.
103
+ *
104
+ * Environment variables marked secret come back masked; any other
105
+ * variable's value is returned as stored.
106
+ */
107
+ get(appId: string, params?: ProjectScopedParams): Promise<GetAppResponse>;
108
+ /** Fetches the most recent lines of an app's build or runtime log. */
109
+ logs(appId: string, params: AppLogsParams): Promise<AppLogsResponse>;
86
110
  /**
87
111
  * Starts deploying an image app and returns the deployment without waiting.
88
112
  *
@@ -0,0 +1,37 @@
1
+ /** Buckets service namespace — a project's object storage buckets. */
2
+ import { type ResolvedConfig } from "../config";
3
+ import type { Transport } from "../transport";
4
+ /** A bucket as the API lists it. Its access keys are never part of a listing. */
5
+ export interface Bucket {
6
+ id: string;
7
+ name: string;
8
+ provider: string;
9
+ region: string;
10
+ endpoint: string | null;
11
+ publicAccess: boolean;
12
+ versioning: boolean;
13
+ status: "CREATING" | "ACTIVE" | "SUSPENDED" | "DELETING";
14
+ tier: string;
15
+ cdnEnabled: boolean;
16
+ cdnDomain: string | null;
17
+ createdAt: string;
18
+ }
19
+ /** Options accepted by every method, for working across projects. */
20
+ export interface ProjectScopedParams {
21
+ /** Overrides the client-level default project for this call. */
22
+ projectId?: string;
23
+ }
24
+ interface Envelope<T> {
25
+ success: true;
26
+ data: T;
27
+ }
28
+ export type ListBucketsResponse = Envelope<Bucket[]>;
29
+ /** Read operations on a project's buckets. The API has no single-bucket read. */
30
+ export declare class BucketsService {
31
+ private readonly transport;
32
+ private readonly config;
33
+ constructor(transport: Transport, config: ResolvedConfig);
34
+ /** Lists every bucket in the project. */
35
+ list(params?: ProjectScopedParams): Promise<ListBucketsResponse>;
36
+ }
37
+ export {};
@@ -0,0 +1,106 @@
1
+ /** Databases service namespace — a project's dedicated and shared databases. */
2
+ import { type ResolvedConfig } from "../config";
3
+ import type { Transport } from "../transport";
4
+ /** One database of any kind, as the project overview lists it. */
5
+ export interface DatabaseSummary {
6
+ kind: "DEDICATED" | "LEGACY_POOLED";
7
+ id: string;
8
+ name: string;
9
+ engine: string;
10
+ version: string | null;
11
+ region: string;
12
+ status: string;
13
+ /** The size of a dedicated database, or the tier of a shared one. */
14
+ plan: string;
15
+ createdAt: string;
16
+ dedicated?: {
17
+ numNodes: number;
18
+ storageGb: number | null;
19
+ };
20
+ pooled?: {
21
+ maxConnections: number;
22
+ storageLimitMb: number;
23
+ };
24
+ }
25
+ /** A dedicated database. The API returns more; the rest are present at runtime. */
26
+ export interface DedicatedDatabase {
27
+ id: string;
28
+ name: string;
29
+ engine: string;
30
+ version: string | null;
31
+ provider: string;
32
+ region: string;
33
+ size: string;
34
+ numNodes: number;
35
+ storageGb: number | null;
36
+ status: string;
37
+ host: string | null;
38
+ port: number | null;
39
+ defaultDb: string | null;
40
+ defaultUser: string | null;
41
+ createdAt: string;
42
+ }
43
+ /** A dedicated database read on its own. */
44
+ export interface DedicatedDatabaseDetail extends DedicatedDatabase {
45
+ /**
46
+ * A full connection URI, **including the password**. Always present once
47
+ * the database is online, and readable with only `databases:read`, so
48
+ * guard the key accordingly.
49
+ */
50
+ connectionUri: string | null;
51
+ }
52
+ /** A database on the shared cluster. No password is ever returned for one. */
53
+ export interface SharedDatabase {
54
+ id: string;
55
+ clusterId: string;
56
+ clusterName: string;
57
+ dbName: string;
58
+ dbUser: string;
59
+ host: string;
60
+ port: number;
61
+ region: string;
62
+ poolName: string | null;
63
+ poolPort: number | null;
64
+ poolMode: string;
65
+ status: string;
66
+ tier: string;
67
+ maxConnections: number;
68
+ storageLimitMb: number;
69
+ createdAt: string;
70
+ }
71
+ /** Options accepted by every method, for working across projects. */
72
+ export interface ProjectScopedParams {
73
+ /** Overrides the client-level default project for this call. */
74
+ projectId?: string;
75
+ }
76
+ interface Envelope<T> {
77
+ success: true;
78
+ data: T;
79
+ }
80
+ export type ListDatabasesResponse = Envelope<DatabaseSummary[]>;
81
+ export type ListDedicatedDatabasesResponse = Envelope<DedicatedDatabase[]>;
82
+ export type GetDedicatedDatabaseResponse = Envelope<DedicatedDatabaseDetail>;
83
+ export type ListSharedDatabasesResponse = Envelope<SharedDatabase[]>;
84
+ export type GetSharedDatabaseResponse = Envelope<SharedDatabase>;
85
+ /** Read operations on a project's databases. */
86
+ export declare class DatabasesService {
87
+ private readonly transport;
88
+ private readonly config;
89
+ constructor(transport: Transport, config: ResolvedConfig);
90
+ /** Builds the collection route for the resolved project. */
91
+ private basePath;
92
+ /** Lists every database in the project, of every kind, newest first. */
93
+ list(params?: ProjectScopedParams): Promise<ListDatabasesResponse>;
94
+ /** Lists the project's dedicated databases. */
95
+ listDedicated(params?: ProjectScopedParams): Promise<ListDedicatedDatabasesResponse>;
96
+ /**
97
+ * Fetches one dedicated database. Its `connectionUri` carries the password;
98
+ * see {@link DedicatedDatabaseDetail}.
99
+ */
100
+ getDedicated(databaseId: string, params?: ProjectScopedParams): Promise<GetDedicatedDatabaseResponse>;
101
+ /** Lists the project's databases on the shared cluster. */
102
+ listShared(params?: ProjectScopedParams): Promise<ListSharedDatabasesResponse>;
103
+ /** Fetches one database on the shared cluster. */
104
+ getShared(tenantId: string, params?: ProjectScopedParams): Promise<GetSharedDatabaseResponse>;
105
+ }
106
+ export {};
@@ -0,0 +1,54 @@
1
+ /** Domains service namespace — a project's domains and their DNS records. */
2
+ import { type ResolvedConfig } from "../config";
3
+ import type { Transport } from "../transport";
4
+ /** One DNS record on a domain. */
5
+ export interface DnsRecord {
6
+ id: string;
7
+ type: string;
8
+ name: string;
9
+ value: string;
10
+ ttl: number;
11
+ priority: number | null;
12
+ }
13
+ /** A domain as the API lists it. The API returns more; the rest are present at runtime. */
14
+ export interface Domain {
15
+ id: string;
16
+ name: string;
17
+ type: "PURCHASED" | "MIGRATED" | "EXTERNAL";
18
+ status: string;
19
+ registrar: string | null;
20
+ expiresAt: string | null;
21
+ autoRenew: boolean;
22
+ dnsRecords: DnsRecord[];
23
+ /** The TXT record that proves ownership of an external domain; null otherwise. */
24
+ verificationRecord: {
25
+ type: "TXT";
26
+ name: string;
27
+ value: string;
28
+ } | null;
29
+ createdAt: string;
30
+ }
31
+ /** Options accepted by every method, for working across projects. */
32
+ export interface ProjectScopedParams {
33
+ /** Overrides the client-level default project for this call. */
34
+ projectId?: string;
35
+ }
36
+ interface Envelope<T> {
37
+ success: true;
38
+ data: T;
39
+ }
40
+ export type ListDomainsResponse = Envelope<Domain[]>;
41
+ export type GetDomainResponse = Envelope<Domain>;
42
+ /** Read operations on a project's domains. */
43
+ export declare class DomainsService {
44
+ private readonly transport;
45
+ private readonly config;
46
+ constructor(transport: Transport, config: ResolvedConfig);
47
+ /** Builds the collection route for the resolved project. */
48
+ private basePath;
49
+ /** Lists every domain in the project, with its DNS records. */
50
+ list(params?: ProjectScopedParams): Promise<ListDomainsResponse>;
51
+ /** Fetches one domain by id or by name, e.g. `example.com`. */
52
+ get(domain: string, params?: ProjectScopedParams): Promise<GetDomainResponse>;
53
+ }
54
+ export {};
@@ -19,6 +19,58 @@ export interface SendEmailResponse {
19
19
  messageId: string;
20
20
  };
21
21
  }
22
+ /** A project's sending domain. SMTP passwords and the DKIM private key are never returned. */
23
+ export interface EmailDomain {
24
+ id: string;
25
+ domainId: string;
26
+ status: "DNS_PENDING" | "ACTIVE" | "SUSPENDED";
27
+ verifiedAt: string | null;
28
+ domain: {
29
+ id: string;
30
+ name: string;
31
+ status: string;
32
+ type: string;
33
+ };
34
+ credentials: Array<{
35
+ id: string;
36
+ label: string;
37
+ fromAddress: string | null;
38
+ smtpUsername: string;
39
+ sentCount: number;
40
+ lastUsedAt: string | null;
41
+ }>;
42
+ /** The records to publish before the domain can send. */
43
+ dnsRecords: Array<{
44
+ type: "TXT";
45
+ name: string;
46
+ value: string;
47
+ purpose: "DKIM" | "SPF" | "DMARC";
48
+ description: string;
49
+ }>;
50
+ createdAt: string;
51
+ }
52
+ /** A sending domain read on its own, with whether it can send yet. */
53
+ export interface EmailDomainDetail extends EmailDomain {
54
+ sending: {
55
+ identity: "VERIFIED" | "PENDING" | "FAILED" | "MISSING" | null;
56
+ billingRequired: boolean;
57
+ };
58
+ }
59
+ /** Options accepted by the domain reads, for working across projects. */
60
+ export interface ProjectScopedParams {
61
+ /** Overrides the client-level default project for this call. */
62
+ projectId?: string;
63
+ }
64
+ /** Envelope returned by `client.email.listDomains()`. */
65
+ export interface ListEmailDomainsResponse {
66
+ success: true;
67
+ data: EmailDomain[];
68
+ }
69
+ /** Envelope returned by `client.email.getDomain()`. */
70
+ export interface GetEmailDomainResponse {
71
+ success: true;
72
+ data: EmailDomainDetail;
73
+ }
22
74
  /** Email operations for a project. */
23
75
  export declare class EmailService {
24
76
  private readonly transport;
@@ -30,4 +82,8 @@ export declare class EmailService {
30
82
  * At least one of `html` or `text` is required.
31
83
  */
32
84
  send(params: SendEmailParams): Promise<SendEmailResponse>;
85
+ /** Lists the project's sending domains, with their SMTP credentials and DNS records. */
86
+ listDomains(params?: ProjectScopedParams): Promise<ListEmailDomainsResponse>;
87
+ /** Fetches one sending domain by its id (not its domain name). */
88
+ getDomain(emailDomainId: string, params?: ProjectScopedParams): Promise<GetEmailDomainResponse>;
33
89
  }