@stackshift-cloud/sdk 1.3.1 → 1.4.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.
@@ -0,0 +1,358 @@
1
+ import type { StackShift } from './client.js';
2
+ export type MailboxDomainStatus = 'pending' | 'receiving' | 'mx_lost' | 'disabled';
3
+ export type MailboxStatus = 'active' | 'suspended' | 'pending' | 'deleted';
4
+ export type MailboxKind = 'person' | 'shared';
5
+ export type MailboxPlanSlug = 'basic' | 'pro';
6
+ export type MailboxRouteTargetKind = 'mailbox' | 'group' | 'app' | 'support' | 'forward' | 'reject';
7
+ export interface MailboxRouteTarget {
8
+ kind: MailboxRouteTargetKind;
9
+ mailboxId?: string;
10
+ groupId?: string;
11
+ webhookUrl?: string;
12
+ supportChannelId?: string;
13
+ forwardTo?: string;
14
+ }
15
+ export interface MailboxDnsRecord {
16
+ type: string;
17
+ name: string;
18
+ value: string;
19
+ priority?: number;
20
+ status: string;
21
+ required: boolean;
22
+ explanation?: string;
23
+ }
24
+ export interface MailboxDomain {
25
+ id: string;
26
+ workspaceId: string;
27
+ domain: string;
28
+ status: MailboxDomainStatus;
29
+ mxVerifiedAt?: string;
30
+ catchAll?: MailboxRouteTarget;
31
+ retentionDays?: number;
32
+ addonStorageUnits: number;
33
+ quotaPoolBytes: number;
34
+ usedBytes: number;
35
+ verificationToken: string;
36
+ revision: number;
37
+ createdAt: string;
38
+ updatedAt: string;
39
+ records: MailboxDnsRecord[];
40
+ foundMx: string | null;
41
+ dns: {
42
+ cloudflareConnected: boolean;
43
+ lastApplied: {
44
+ at: string;
45
+ byName: string;
46
+ recordCount: number;
47
+ } | null;
48
+ };
49
+ }
50
+ export interface MailboxDomainUpdateInput {
51
+ catchAll?: MailboxRouteTarget | null;
52
+ retentionDays?: number | null;
53
+ addonStorageUnits?: number;
54
+ }
55
+ export interface MailboxInvitation {
56
+ email: string;
57
+ expiresAt: string;
58
+ expired: boolean;
59
+ }
60
+ export interface Mailbox {
61
+ id: string;
62
+ workspaceId: string;
63
+ domainId: string;
64
+ localPart: string;
65
+ address: string;
66
+ displayName: string;
67
+ kind: MailboxKind;
68
+ ownerUserId?: string;
69
+ quotaBytes: number;
70
+ usedBytes: number;
71
+ plan: MailboxPlanSlug;
72
+ status: MailboxStatus;
73
+ aiEnabled: boolean;
74
+ revision: number;
75
+ createdAt: string;
76
+ updatedAt: string;
77
+ invitation: MailboxInvitation | null;
78
+ aiMicrocreditsThisMonth: number | null;
79
+ }
80
+ export interface MailboxCreateInput {
81
+ domainId: string;
82
+ localPart: string;
83
+ displayName?: string;
84
+ kind?: MailboxKind;
85
+ ownerUserId?: string;
86
+ ownerEmail?: string;
87
+ plan?: MailboxPlanSlug;
88
+ quotaBytes?: number;
89
+ aiEnabled?: boolean;
90
+ }
91
+ export interface MailboxUpdateInput {
92
+ displayName?: string;
93
+ quotaBytes?: number;
94
+ aiEnabled?: boolean;
95
+ plan?: MailboxPlanSlug;
96
+ }
97
+ export interface MailboxMember {
98
+ mailboxId: string;
99
+ userId: string;
100
+ role: 'owner' | 'member';
101
+ createdAt: string;
102
+ }
103
+ export interface MailboxAppPassword {
104
+ id: string;
105
+ mailboxId: string;
106
+ label: string;
107
+ lastUsedAt?: string;
108
+ createdAt: string;
109
+ revokedAt?: string;
110
+ }
111
+ export interface MailboxAppPasswordCreated extends MailboxAppPassword {
112
+ secret: string;
113
+ }
114
+ export interface MailboxDevice {
115
+ id: string;
116
+ kind: 'app_password' | 'web';
117
+ label: string;
118
+ lastUsedAt: string | null;
119
+ createdAt: string;
120
+ }
121
+ export interface MailboxPasswordReset {
122
+ password: string;
123
+ appliedNow: boolean;
124
+ }
125
+ export interface MailboxProfileLink {
126
+ url: string;
127
+ expiresAt: string;
128
+ }
129
+ export interface MailboxPlan {
130
+ slug: MailboxPlanSlug;
131
+ quotaBytes: number;
132
+ monthlyPriceKobo: number;
133
+ }
134
+ export interface MailboxPricing {
135
+ plans: MailboxPlan[];
136
+ addonUnitBytes: number;
137
+ addonPriceKobo: number;
138
+ pricesArePlaceholders: boolean;
139
+ }
140
+ export interface MailboxClientEndpoint {
141
+ host: string;
142
+ port: number;
143
+ security: string;
144
+ }
145
+ export interface MailboxClientSettings {
146
+ incoming: MailboxClientEndpoint | null;
147
+ outgoing: MailboxClientEndpoint | null;
148
+ }
149
+ export interface MailboxUsage {
150
+ mailboxLimit: number;
151
+ mailboxesUsed: number;
152
+ ai: {
153
+ availableMicrocredits: number;
154
+ usedThisMonthMicrocredits: number;
155
+ nextReset: string;
156
+ } | null;
157
+ }
158
+ export interface MailboxAlias {
159
+ id: string;
160
+ mailboxId: string;
161
+ address: string;
162
+ sendAs: boolean;
163
+ createdAt: string;
164
+ }
165
+ export interface MailboxAliasCreateInput {
166
+ mailboxId: string;
167
+ localPart: string;
168
+ domainId?: string;
169
+ sendAs?: boolean;
170
+ }
171
+ export interface MailboxGroup {
172
+ id: string;
173
+ domainId: string;
174
+ address: string;
175
+ displayName: string;
176
+ memberIds: string[];
177
+ moderatorId?: string;
178
+ revision: number;
179
+ createdAt: string;
180
+ updatedAt: string;
181
+ }
182
+ export interface MailboxGroupCreateInput {
183
+ domainId: string;
184
+ localPart: string;
185
+ displayName?: string;
186
+ memberIds?: string[];
187
+ moderatorId?: string;
188
+ }
189
+ export interface MailboxGroupUpdateInput {
190
+ displayName?: string;
191
+ moderatorId?: string | null;
192
+ memberIds?: string[];
193
+ }
194
+ export interface MailboxRoute {
195
+ id: string;
196
+ domainId: string;
197
+ pattern: string;
198
+ priority: number;
199
+ targets: MailboxRouteTarget[];
200
+ revision: number;
201
+ createdAt: string;
202
+ updatedAt: string;
203
+ }
204
+ export interface MailboxRouteCreateInput {
205
+ domainId: string;
206
+ pattern: string;
207
+ priority?: number;
208
+ targets: MailboxRouteTarget[];
209
+ }
210
+ export interface MailboxRouteUpdateInput {
211
+ priority?: number;
212
+ targets?: MailboxRouteTarget[];
213
+ }
214
+ export interface MailboxAppHealthIssue {
215
+ routeId: string;
216
+ address: string;
217
+ since: string;
218
+ undeliveredCount: number;
219
+ holderName: string | null;
220
+ url: string;
221
+ lastError: string;
222
+ endpointId: string;
223
+ }
224
+ export type MailboxImportSource = 'google' | 'microsoft' | 'stackshift-hosting' | 'imap';
225
+ export interface MailboxImportAccountInput {
226
+ mailboxId: string;
227
+ username: string;
228
+ password: string;
229
+ }
230
+ export interface MailboxImportStartInput {
231
+ domainId: string;
232
+ source: MailboxImportSource;
233
+ host?: string;
234
+ port?: number;
235
+ accounts: MailboxImportAccountInput[];
236
+ }
237
+ export interface MailboxImportMailbox {
238
+ mailboxId: string;
239
+ address: string;
240
+ sourceUsername: string;
241
+ state: 'pending' | 'copying' | 'copied' | 'refused' | 'skipped' | 'failed' | 'cancelled';
242
+ totalEmails: number;
243
+ copiedEmails: number;
244
+ totalBytes: number;
245
+ copiedBytes: number;
246
+ minutesLeft: number | null;
247
+ message: string | null;
248
+ }
249
+ export interface MailboxImport {
250
+ id: string;
251
+ domainId: string;
252
+ domain: string;
253
+ source: MailboxImportSource;
254
+ sourceLabel: string;
255
+ host: string;
256
+ createdAt: string;
257
+ updatedAt: string;
258
+ stage: 'copy' | 'switch' | 'done' | 'cancelled';
259
+ switch: {
260
+ requestedFor: string | null;
261
+ scheduledAt: string | null;
262
+ switchedAt: string | null;
263
+ };
264
+ mailboxes: MailboxImportMailbox[];
265
+ }
266
+ interface MailboxList<T> {
267
+ data: T[];
268
+ }
269
+ export declare class MailboxDomainsClient {
270
+ private readonly client;
271
+ constructor(client: StackShift);
272
+ create(domain: string): Promise<MailboxDomain>;
273
+ list(): Promise<MailboxList<MailboxDomain>>;
274
+ get(domainId: string): Promise<MailboxDomain>;
275
+ update(domainId: string, input: MailboxDomainUpdateInput): Promise<MailboxDomain>;
276
+ verify(domainId: string): Promise<MailboxDomain>;
277
+ applyDns(domainId: string): Promise<MailboxDomain>;
278
+ dnsApplications(domainId: string): Promise<MailboxList<Record<string, unknown>>>;
279
+ delete(domainId: string): Promise<void>;
280
+ }
281
+ export declare class MailboxesClient {
282
+ private readonly client;
283
+ constructor(client: StackShift);
284
+ plans(): Promise<MailboxPricing>;
285
+ clientSettings(): Promise<MailboxClientSettings>;
286
+ usage(): Promise<MailboxUsage>;
287
+ create(input: MailboxCreateInput): Promise<Mailbox>;
288
+ list(options?: {
289
+ domainId?: string;
290
+ }): Promise<MailboxList<Mailbox>>;
291
+ get(mailboxId: string): Promise<Mailbox>;
292
+ update(mailboxId: string, input: MailboxUpdateInput): Promise<Mailbox>;
293
+ delete(mailboxId: string): Promise<void>;
294
+ suspend(mailboxId: string): Promise<Mailbox>;
295
+ resume(mailboxId: string): Promise<Mailbox>;
296
+ resendInvitation(mailboxId: string): Promise<Mailbox>;
297
+ resetPassword(mailboxId: string): Promise<MailboxPasswordReset>;
298
+ createProfileLink(mailboxId: string): Promise<MailboxProfileLink>;
299
+ listDevices(mailboxId: string): Promise<MailboxList<MailboxDevice>>;
300
+ revokeDevice(mailboxId: string, kind: MailboxDevice['kind'], deviceId: string): Promise<void>;
301
+ listMembers(mailboxId: string): Promise<MailboxList<MailboxMember>>;
302
+ addMember(mailboxId: string, userId: string): Promise<MailboxMember>;
303
+ removeMember(mailboxId: string, userId: string): Promise<void>;
304
+ listAppPasswords(mailboxId: string): Promise<MailboxList<MailboxAppPassword>>;
305
+ createAppPassword(mailboxId: string, label: string): Promise<MailboxAppPasswordCreated>;
306
+ revokeAppPassword(mailboxId: string, passwordId: string): Promise<void>;
307
+ }
308
+ export declare class MailboxAliasesClient {
309
+ private readonly client;
310
+ constructor(client: StackShift);
311
+ create(input: MailboxAliasCreateInput): Promise<MailboxAlias>;
312
+ list(options?: {
313
+ mailboxId?: string;
314
+ }): Promise<MailboxList<MailboxAlias>>;
315
+ update(aliasId: string, input: {
316
+ sendAs: boolean;
317
+ }): Promise<MailboxAlias>;
318
+ delete(aliasId: string): Promise<void>;
319
+ }
320
+ export declare class MailboxGroupsClient {
321
+ private readonly client;
322
+ constructor(client: StackShift);
323
+ create(input: MailboxGroupCreateInput): Promise<MailboxGroup>;
324
+ list(options?: {
325
+ domainId?: string;
326
+ }): Promise<MailboxList<MailboxGroup>>;
327
+ get(groupId: string): Promise<MailboxGroup>;
328
+ update(groupId: string, input: MailboxGroupUpdateInput): Promise<MailboxGroup>;
329
+ delete(groupId: string): Promise<void>;
330
+ }
331
+ export declare class MailboxRoutesClient {
332
+ private readonly client;
333
+ constructor(client: StackShift);
334
+ create(input: MailboxRouteCreateInput): Promise<MailboxRoute>;
335
+ list(options?: {
336
+ domainId?: string;
337
+ }): Promise<MailboxList<MailboxRoute>>;
338
+ get(routeId: string): Promise<MailboxRoute>;
339
+ update(routeId: string, input: MailboxRouteUpdateInput): Promise<MailboxRoute>;
340
+ delete(routeId: string): Promise<void>;
341
+ appHealth(domainId: string): Promise<{
342
+ issue: MailboxAppHealthIssue | null;
343
+ }>;
344
+ retryDeliveries(routeId: string): Promise<{
345
+ retried: number;
346
+ }>;
347
+ }
348
+ export declare class MailboxImportsClient {
349
+ private readonly client;
350
+ constructor(client: StackShift);
351
+ start(input: MailboxImportStartInput): Promise<MailboxImport>;
352
+ list(): Promise<MailboxList<MailboxImport>>;
353
+ get(importId: string): Promise<MailboxImport>;
354
+ cancel(importId: string): Promise<MailboxImport>;
355
+ skip(importId: string, mailboxId: string): Promise<MailboxImport>;
356
+ switch(importId: string, when: 'now' | 'tonight'): Promise<MailboxImport>;
357
+ }
358
+ export {};
@@ -0,0 +1,202 @@
1
+ function path(...parts) {
2
+ return parts.map(encodeURIComponent).join('/');
3
+ }
4
+ function query(params) {
5
+ const search = new URLSearchParams();
6
+ for (const [key, value] of Object.entries(params)) {
7
+ if (value !== undefined) {
8
+ search.append(key, value);
9
+ }
10
+ }
11
+ const suffix = search.toString();
12
+ return suffix ? `?${suffix}` : '';
13
+ }
14
+ export class MailboxDomainsClient {
15
+ client;
16
+ constructor(client) {
17
+ this.client = client;
18
+ }
19
+ create(domain) {
20
+ return this.client.mailRequest('/mail/mailbox-domains', { method: 'POST', body: { domain } });
21
+ }
22
+ list() {
23
+ return this.client.mailRequest('/mail/mailbox-domains');
24
+ }
25
+ get(domainId) {
26
+ return this.client.mailRequest(`/mail/mailbox-domains/${path(domainId)}`);
27
+ }
28
+ update(domainId, input) {
29
+ return this.client.mailRequest(`/mail/mailbox-domains/${path(domainId)}`, { method: 'PATCH', body: input });
30
+ }
31
+ verify(domainId) {
32
+ return this.client.mailRequest(`/mail/mailbox-domains/${path(domainId)}/verify`, { method: 'POST' });
33
+ }
34
+ applyDns(domainId) {
35
+ return this.client.mailRequest(`/mail/mailbox-domains/${path(domainId)}/dns/apply`, { method: 'POST' });
36
+ }
37
+ dnsApplications(domainId) {
38
+ return this.client.mailRequest(`/mail/mailbox-domains/${path(domainId)}/dns/applications`);
39
+ }
40
+ delete(domainId) {
41
+ return this.client.mailRequest(`/mail/mailbox-domains/${path(domainId)}`, { method: 'DELETE' });
42
+ }
43
+ }
44
+ export class MailboxesClient {
45
+ client;
46
+ constructor(client) {
47
+ this.client = client;
48
+ }
49
+ plans() {
50
+ return this.client.mailRequest('/mail/mailbox-plans');
51
+ }
52
+ clientSettings() {
53
+ return this.client.mailRequest('/mail/mailbox-client-settings');
54
+ }
55
+ usage() {
56
+ return this.client.mailRequest('/mail/mailbox-usage');
57
+ }
58
+ create(input) {
59
+ return this.client.mailRequest('/mail/mailboxes', { method: 'POST', body: input });
60
+ }
61
+ list(options = {}) {
62
+ return this.client.mailRequest(`/mail/mailboxes${query({ domainId: options.domainId })}`);
63
+ }
64
+ get(mailboxId) {
65
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}`);
66
+ }
67
+ update(mailboxId, input) {
68
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}`, { method: 'PATCH', body: input });
69
+ }
70
+ delete(mailboxId) {
71
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}`, { method: 'DELETE' });
72
+ }
73
+ suspend(mailboxId) {
74
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/suspend`, { method: 'POST' });
75
+ }
76
+ resume(mailboxId) {
77
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/resume`, { method: 'POST' });
78
+ }
79
+ resendInvitation(mailboxId) {
80
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/invitation/resend`, { method: 'POST' });
81
+ }
82
+ resetPassword(mailboxId) {
83
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/password-reset`, { method: 'POST' });
84
+ }
85
+ createProfileLink(mailboxId) {
86
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/mobileconfig`, { method: 'POST' });
87
+ }
88
+ listDevices(mailboxId) {
89
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/devices`);
90
+ }
91
+ revokeDevice(mailboxId, kind, deviceId) {
92
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/devices/${path(kind, deviceId)}`, { method: 'DELETE' });
93
+ }
94
+ listMembers(mailboxId) {
95
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/members`);
96
+ }
97
+ addMember(mailboxId, userId) {
98
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/members`, { method: 'POST', body: { userId } });
99
+ }
100
+ removeMember(mailboxId, userId) {
101
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/members/${path(userId)}`, { method: 'DELETE' });
102
+ }
103
+ listAppPasswords(mailboxId) {
104
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/app-passwords`);
105
+ }
106
+ createAppPassword(mailboxId, label) {
107
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/app-passwords`, { method: 'POST', body: { label } });
108
+ }
109
+ revokeAppPassword(mailboxId, passwordId) {
110
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/app-passwords/${path(passwordId)}`, { method: 'DELETE' });
111
+ }
112
+ }
113
+ export class MailboxAliasesClient {
114
+ client;
115
+ constructor(client) {
116
+ this.client = client;
117
+ }
118
+ create(input) {
119
+ return this.client.mailRequest('/mail/aliases', { method: 'POST', body: input });
120
+ }
121
+ list(options = {}) {
122
+ return this.client.mailRequest(`/mail/aliases${query({ mailboxId: options.mailboxId })}`);
123
+ }
124
+ update(aliasId, input) {
125
+ return this.client.mailRequest(`/mail/aliases/${path(aliasId)}`, { method: 'PATCH', body: input });
126
+ }
127
+ delete(aliasId) {
128
+ return this.client.mailRequest(`/mail/aliases/${path(aliasId)}`, { method: 'DELETE' });
129
+ }
130
+ }
131
+ export class MailboxGroupsClient {
132
+ client;
133
+ constructor(client) {
134
+ this.client = client;
135
+ }
136
+ create(input) {
137
+ return this.client.mailRequest('/mail/groups', { method: 'POST', body: input });
138
+ }
139
+ list(options = {}) {
140
+ return this.client.mailRequest(`/mail/groups${query({ domainId: options.domainId })}`);
141
+ }
142
+ get(groupId) {
143
+ return this.client.mailRequest(`/mail/groups/${path(groupId)}`);
144
+ }
145
+ update(groupId, input) {
146
+ return this.client.mailRequest(`/mail/groups/${path(groupId)}`, { method: 'PATCH', body: input });
147
+ }
148
+ delete(groupId) {
149
+ return this.client.mailRequest(`/mail/groups/${path(groupId)}`, { method: 'DELETE' });
150
+ }
151
+ }
152
+ export class MailboxRoutesClient {
153
+ client;
154
+ constructor(client) {
155
+ this.client = client;
156
+ }
157
+ create(input) {
158
+ return this.client.mailRequest('/mail/routes', { method: 'POST', body: input });
159
+ }
160
+ list(options = {}) {
161
+ return this.client.mailRequest(`/mail/routes${query({ domainId: options.domainId })}`);
162
+ }
163
+ get(routeId) {
164
+ return this.client.mailRequest(`/mail/routes/${path(routeId)}`);
165
+ }
166
+ update(routeId, input) {
167
+ return this.client.mailRequest(`/mail/routes/${path(routeId)}`, { method: 'PATCH', body: input });
168
+ }
169
+ delete(routeId) {
170
+ return this.client.mailRequest(`/mail/routes/${path(routeId)}`, { method: 'DELETE' });
171
+ }
172
+ appHealth(domainId) {
173
+ return this.client.mailRequest(`/mail/routes/app-health${query({ domainId })}`);
174
+ }
175
+ retryDeliveries(routeId) {
176
+ return this.client.mailRequest(`/mail/routes/${path(routeId)}/retry-deliveries`, { method: 'POST' });
177
+ }
178
+ }
179
+ export class MailboxImportsClient {
180
+ client;
181
+ constructor(client) {
182
+ this.client = client;
183
+ }
184
+ start(input) {
185
+ return this.client.mailRequest('/mail/mailbox-imports', { method: 'POST', body: input });
186
+ }
187
+ list() {
188
+ return this.client.mailRequest('/mail/mailbox-imports');
189
+ }
190
+ get(importId) {
191
+ return this.client.mailRequest(`/mail/mailbox-imports/${path(importId)}`);
192
+ }
193
+ cancel(importId) {
194
+ return this.client.mailRequest(`/mail/mailbox-imports/${path(importId)}/cancel`, { method: 'POST' });
195
+ }
196
+ skip(importId, mailboxId) {
197
+ return this.client.mailRequest(`/mail/mailbox-imports/${path(importId)}/mailboxes/${path(mailboxId)}/skip`, { method: 'POST' });
198
+ }
199
+ switch(importId, when) {
200
+ return this.client.mailRequest(`/mail/mailbox-imports/${path(importId)}/switch`, { method: 'POST', body: { when } });
201
+ }
202
+ }
package/dist/mail.d.ts CHANGED
@@ -19,6 +19,8 @@ import { MailAudiencesClient, MailCampaignsClient } from './mail-campaigns.js';
19
19
  export { MailAudiencesClient, MailCampaignsClient } from './mail-campaigns.js';
20
20
  import { MailExportsClient } from './mail-exports.js';
21
21
  export { MailExportsClient } from './mail-exports.js';
22
+ import { MailboxAliasesClient, MailboxDomainsClient, MailboxGroupsClient, MailboxImportsClient, MailboxRoutesClient, MailboxesClient } from './mail-mailboxes.js';
23
+ export { MailboxAliasesClient, MailboxDomainsClient, MailboxGroupsClient, MailboxImportsClient, MailboxRoutesClient, MailboxesClient } from './mail-mailboxes.js';
22
24
  import type { MailTemplateDiagnosticInput, MailTemplateDiagnosticResult } from './mail-diagnostics.js';
23
25
  export declare class MailClient {
24
26
  private readonly client;
@@ -41,6 +43,12 @@ export declare class MailClient {
41
43
  readonly audiences: MailAudiencesClient;
42
44
  readonly campaigns: MailCampaignsClient;
43
45
  readonly exports: MailExportsClient;
46
+ readonly mailboxDomains: MailboxDomainsClient;
47
+ readonly mailboxes: MailboxesClient;
48
+ readonly aliases: MailboxAliasesClient;
49
+ readonly groups: MailboxGroupsClient;
50
+ readonly routes: MailboxRoutesClient;
51
+ readonly mailboxImports: MailboxImportsClient;
44
52
  readonly limits: MailLimitsClient;
45
53
  readonly reputation: MailReputationClient;
46
54
  readonly scheduled: MailScheduledClient;
package/dist/mail.js CHANGED
@@ -13,6 +13,8 @@ import { MailAudiencesClient, MailCampaignsClient } from './mail-campaigns.js';
13
13
  export { MailAudiencesClient, MailCampaignsClient } from './mail-campaigns.js';
14
14
  import { MailExportsClient } from './mail-exports.js';
15
15
  export { MailExportsClient } from './mail-exports.js';
16
+ import { MailboxAliasesClient, MailboxDomainsClient, MailboxGroupsClient, MailboxImportsClient, MailboxRoutesClient, MailboxesClient } from './mail-mailboxes.js';
17
+ export { MailboxAliasesClient, MailboxDomainsClient, MailboxGroupsClient, MailboxImportsClient, MailboxRoutesClient, MailboxesClient } from './mail-mailboxes.js';
16
18
  export class MailClient {
17
19
  client;
18
20
  automations;
@@ -34,6 +36,12 @@ export class MailClient {
34
36
  audiences;
35
37
  campaigns;
36
38
  exports;
39
+ mailboxDomains;
40
+ mailboxes;
41
+ aliases;
42
+ groups;
43
+ routes;
44
+ mailboxImports;
37
45
  limits;
38
46
  reputation;
39
47
  scheduled;
@@ -61,6 +69,12 @@ export class MailClient {
61
69
  this.audiences = new MailAudiencesClient(client);
62
70
  this.campaigns = new MailCampaignsClient(client);
63
71
  this.exports = new MailExportsClient(client);
72
+ this.mailboxDomains = new MailboxDomainsClient(client);
73
+ this.mailboxes = new MailboxesClient(client);
74
+ this.aliases = new MailboxAliasesClient(client);
75
+ this.groups = new MailboxGroupsClient(client);
76
+ this.routes = new MailboxRoutesClient(client);
77
+ this.mailboxImports = new MailboxImportsClient(client);
64
78
  this.limits = new MailLimitsClient(client);
65
79
  this.reputation = new MailReputationClient(client);
66
80
  this.scheduled = new MailScheduledClient(client);
@@ -0,0 +1,3 @@
1
+ import type { SupportActionDescriptor } from './support-action-types.js';
2
+ /** Validate action declarations locally; server registration and destination checks remain authoritative. */
3
+ export declare function validateSupportActionCatalog(version: string, actions: SupportActionDescriptor[]): void;
@@ -0,0 +1,40 @@
1
+ import { actionCheck } from './support-actions.js';
2
+ const reserved = new Set(['customer', 'customer_id', 'external_customer_id', 'external_id', 'contact_id', 'workspace_id', 'environment_id', 'inbox_id', 'conversation_id', 'installation_id', 'tenant_id', 'user_id', 'organization_id', 'authorization', 'scope', 'identity', 'credentials', 'secret', 'token']);
3
+ function endpoint(value) {
4
+ if (!value || value.length > 2048)
5
+ return false;
6
+ try {
7
+ const url = new URL(value);
8
+ return url.protocol === 'https:' && !!url.hostname && !url.username && !url.password && !url.search && !url.hash && !value.includes('?') && !value.includes('#');
9
+ }
10
+ catch {
11
+ return false;
12
+ }
13
+ }
14
+ function fields(schema, input) {
15
+ actionCheck(schema && typeof schema === 'object' && !Array.isArray(schema) && Object.keys(schema).length <= 32, 'invalid_catalog');
16
+ for (const [name, field] of Object.entries(schema)) {
17
+ actionCheck(/^[a-z][a-z0-9_]{0,63}$/.test(name) && (!input || (!reserved.has(name) && !/^(customer_|tenant_|auth_)/.test(name))), 'invalid_catalog');
18
+ actionCheck(field && typeof field.required === 'boolean' && Object.keys(field).every(k => ['type', 'required', 'max_length', 'minimum', 'maximum', 'enum'].includes(k)), 'invalid_catalog');
19
+ if (field.type === 'string')
20
+ actionCheck(Number.isInteger(field.max_length) && field.max_length >= 1 && field.max_length <= 16000 && field.minimum === undefined && field.maximum === undefined && (!field.enum || (Array.isArray(field.enum) && field.enum.length <= 64 && new Set(field.enum).size === field.enum.length && field.enum.every(v => typeof v === 'string' && [...v].length <= field.max_length))), 'invalid_catalog');
21
+ else if (field.type === 'number' || field.type === 'integer')
22
+ actionCheck(!field.max_length && !field.enum?.length && [field.minimum, field.maximum].every(n => n === undefined || (Number.isFinite(n) && (field.type !== 'integer' || Number.isSafeInteger(n)))) && (field.minimum === undefined || field.maximum === undefined || field.minimum <= field.maximum), 'invalid_catalog');
23
+ else
24
+ actionCheck(field.type === 'boolean' && !field.max_length && !field.enum?.length && field.minimum === undefined && field.maximum === undefined, 'invalid_catalog');
25
+ }
26
+ }
27
+ /** Validate action declarations locally; server registration and destination checks remain authoritative. */
28
+ export function validateSupportActionCatalog(version, actions) {
29
+ actionCheck(typeof version === 'string' && version.length <= 32 && /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/.test(version) && Array.isArray(actions) && actions.length >= 1 && actions.length <= 32, 'invalid_catalog');
30
+ const names = new Set();
31
+ for (const action of actions) {
32
+ actionCheck(/^[a-z][a-z0-9_.]{0,79}$/.test(action.name) && !names.has(action.name) && action.version === version && action.identity_required === true && ['read', 'bounded_write', 'customer_change', 'financial', 'security'].includes(action.risk) && typeof action.idempotency_supported === 'boolean' && typeof action.safe_retry === 'boolean' && Number.isInteger(action.timeout_seconds) && action.timeout_seconds >= 1 && action.timeout_seconds <= 30 && endpoint(action.endpoint), 'invalid_catalog');
33
+ actionCheck((action.risk === 'read' || (action.idempotency_supported && endpoint(action.reconciliation_endpoint) && !!action.verification_operation)) && (!action.safe_retry || action.idempotency_supported) && (!action.reconciliation_endpoint || endpoint(action.reconciliation_endpoint)), 'invalid_catalog');
34
+ fields(action.input, true);
35
+ fields(action.output, false);
36
+ names.add(action.name);
37
+ }
38
+ for (const action of actions)
39
+ actionCheck(!action.verification_operation || actions.some(a => a.name === action.verification_operation && a.risk === 'read'), 'invalid_catalog');
40
+ }
@@ -0,0 +1,20 @@
1
+ import type { SupportActionReceipt, SupportActionRequest, SupportActionVerification } from './support-action-types.js';
2
+ export interface SupportActionClaim {
3
+ state: 'acquired' | 'completed' | 'running' | 'unknown' | 'conflict';
4
+ fence?: string;
5
+ response?: Uint8Array;
6
+ }
7
+ export interface SupportActionDurableStore {
8
+ claim(namespace: 'delivery' | 'execution', key: string, digest: string): Promise<SupportActionClaim>;
9
+ complete(namespace: 'delivery' | 'execution', key: string, fence: string, response: Uint8Array, unknown?: boolean): Promise<void>;
10
+ }
11
+ export type SupportActionHandler = (request: SupportActionRequest) => Promise<Pick<SupportActionReceipt, 'state' | 'result' | 'error_code'>>;
12
+ export declare function receiveSupportAction(raw: Uint8Array, headers: Record<string, string>, options: {
13
+ verification: SupportActionVerification;
14
+ store: SupportActionDurableStore;
15
+ execute: SupportActionHandler;
16
+ reconcile: SupportActionHandler;
17
+ }): Promise<{
18
+ body: Uint8Array<ArrayBufferLike>;
19
+ headers: Record<string, string>;
20
+ }>;