@stackshift-cloud/sdk 0.1.4 → 1.1.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.
Files changed (39) hide show
  1. package/README.md +63 -3
  2. package/dist/asset-media-v2.d.ts +65 -0
  3. package/dist/asset-workflows.d.ts +269 -0
  4. package/dist/asset-workflows.js +69 -0
  5. package/dist/assets-platform-types.d.ts +218 -0
  6. package/dist/assets-platform-types.js +1 -0
  7. package/dist/assets-platform.d.ts +55 -0
  8. package/dist/assets-platform.js +90 -0
  9. package/dist/assets.d.ts +16 -0
  10. package/dist/assets.js +74 -130
  11. package/dist/client.d.ts +6 -0
  12. package/dist/client.js +15 -6
  13. package/dist/generated/assets-contract.d.ts +267 -2
  14. package/dist/generated/assets-contract.js +53 -0
  15. package/dist/index.d.ts +17 -5
  16. package/dist/index.js +5 -1
  17. package/dist/mail-advanced-types.d.ts +25 -3
  18. package/dist/mail-advanced.d.ts +8 -1
  19. package/dist/mail-advanced.js +9 -0
  20. package/dist/mail-campaigns.d.ts +76 -0
  21. package/dist/mail-campaigns.js +42 -0
  22. package/dist/mail-delivery-types.js +1 -0
  23. package/dist/mail-diagnostics.d.ts +23 -0
  24. package/dist/mail-diagnostics.js +1 -0
  25. package/dist/mail-events-webhooks.d.ts +3 -2
  26. package/dist/mail-events-webhooks.js +10 -2
  27. package/dist/mail-exports.d.ts +32 -0
  28. package/dist/mail-exports.js +18 -0
  29. package/dist/mail-streams.d.ts +27 -0
  30. package/dist/mail-streams.js +12 -0
  31. package/dist/mail-webhook-types.d.ts +12 -1
  32. package/dist/mail.d.ts +14 -2
  33. package/dist/mail.js +22 -2
  34. package/dist/types.d.ts +56 -3
  35. package/dist/upload-controller.d.ts +70 -0
  36. package/dist/upload-controller.js +223 -0
  37. package/package.json +2 -2
  38. /package/dist/{mail-phase4-types.js → asset-media-v2.js} +0 -0
  39. /package/dist/{mail-phase4-types.d.ts → mail-delivery-types.d.ts} +0 -0
@@ -0,0 +1,76 @@
1
+ import type { StackShift } from './client.js';
2
+ export interface MailAudience {
3
+ id: string;
4
+ workspaceId: string;
5
+ name: string;
6
+ description?: string;
7
+ status: 'active' | 'archived';
8
+ memberCount: number;
9
+ createdAt: string;
10
+ updatedAt: string;
11
+ }
12
+ export interface MailAudienceMember {
13
+ id: string;
14
+ audienceId: string;
15
+ email: string;
16
+ name?: string;
17
+ status: 'subscribed' | 'unsubscribed' | 'complained' | 'hard_bounced';
18
+ consentSource: string;
19
+ consentAt: string;
20
+ consentIp?: string;
21
+ }
22
+ export interface MailAudienceMemberImport {
23
+ email: string;
24
+ name?: string;
25
+ consentSource: string;
26
+ consentAt: string;
27
+ consentIp?: string;
28
+ }
29
+ export interface MailCampaign {
30
+ id: string;
31
+ audienceId: string;
32
+ batchId?: string;
33
+ name: string;
34
+ template: string;
35
+ versionId?: string;
36
+ from: string;
37
+ status: 'draft' | 'processing' | 'queued' | 'completed' | 'failed';
38
+ createdAt: string;
39
+ updatedAt: string;
40
+ queuedAt?: string;
41
+ }
42
+ export declare class MailAudiencesClient {
43
+ private readonly client;
44
+ constructor(client: StackShift);
45
+ create(input: {
46
+ name: string;
47
+ description?: string;
48
+ }): Promise<MailAudience>;
49
+ list(): Promise<{
50
+ data: MailAudience[];
51
+ }>;
52
+ get(id: string): Promise<MailAudience>;
53
+ members(id: string): Promise<{
54
+ data: MailAudienceMember[];
55
+ }>;
56
+ import(id: string, members: MailAudienceMemberImport[]): Promise<{
57
+ imported: number;
58
+ skipped: number;
59
+ }>;
60
+ }
61
+ export declare class MailCampaignsClient {
62
+ private readonly client;
63
+ constructor(client: StackShift);
64
+ create(input: {
65
+ name: string;
66
+ audienceId: string;
67
+ template: string;
68
+ versionId?: string;
69
+ from: string;
70
+ }): Promise<MailCampaign>;
71
+ list(): Promise<{
72
+ data: MailCampaign[];
73
+ }>;
74
+ get(id: string): Promise<MailCampaign>;
75
+ send(id: string): Promise<MailCampaign>;
76
+ }
@@ -0,0 +1,42 @@
1
+ export class MailAudiencesClient {
2
+ client;
3
+ constructor(client) {
4
+ this.client = client;
5
+ }
6
+ create(input) {
7
+ return this.client.mailRequest('/mail/audiences', { method: 'POST', body: input });
8
+ }
9
+ list() {
10
+ return this.client.mailRequest('/mail/audiences');
11
+ }
12
+ get(id) {
13
+ return this.client.mailRequest(`/mail/audiences/${encodeURIComponent(id)}`);
14
+ }
15
+ members(id) {
16
+ return this.client.mailRequest(`/mail/audiences/${encodeURIComponent(id)}/members`);
17
+ }
18
+ import(id, members) {
19
+ return this.client.mailRequest(`/mail/audiences/${encodeURIComponent(id)}/imports`, {
20
+ method: 'POST',
21
+ body: { members },
22
+ });
23
+ }
24
+ }
25
+ export class MailCampaignsClient {
26
+ client;
27
+ constructor(client) {
28
+ this.client = client;
29
+ }
30
+ create(input) {
31
+ return this.client.mailRequest('/mail/campaigns', { method: 'POST', body: input });
32
+ }
33
+ list() {
34
+ return this.client.mailRequest('/mail/campaigns');
35
+ }
36
+ get(id) {
37
+ return this.client.mailRequest(`/mail/campaigns/${encodeURIComponent(id)}`);
38
+ }
39
+ send(id) {
40
+ return this.client.mailRequest(`/mail/campaigns/${encodeURIComponent(id)}/send`, { method: 'POST' });
41
+ }
42
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ export interface MailTemplateDiagnosticInput {
2
+ versionId?: string;
3
+ data?: Record<string, unknown>;
4
+ stream?: 'transactional' | 'broadcast';
5
+ }
6
+ export interface MailDiagnosticFinding {
7
+ code: string;
8
+ severity: 'info' | 'warning' | 'error';
9
+ field: string;
10
+ message: string;
11
+ recommendation: string;
12
+ }
13
+ export interface MailTemplateDiagnosticResult {
14
+ status: 'pass' | 'warning' | 'error';
15
+ stream: 'transactional' | 'broadcast';
16
+ subjectLength: number;
17
+ htmlBytes: number;
18
+ textBytes: number;
19
+ linkCount: number;
20
+ remoteImageCount: number;
21
+ missingAltCount: number;
22
+ findings: MailDiagnosticFinding[];
23
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  import type { StackShift } from './client.js';
2
- import type { MailEvent, MailEventListOptions, MailEventListResult, MailTimelineItem, MailWebhook, MailWebhookCreateInput, MailWebhookCreateResponse, MailWebhookDelivery, MailWebhookDeliveryDetail, MailWebhookDeliveryListOptions, MailWebhookListOptions, MailWebhookListResult, MailWebhookUpdateInput } from './mail-webhook-types.js';
2
+ import type { MailEvent, MailEventListOptions, MailEventListResult, MailTimelineItem, MailWebhook, MailWebhookCreateInput, MailWebhookCreateResponse, MailWebhookDelivery, MailWebhookDeliveryDetail, MailWebhookDeliveryListOptions, MailWebhookListOptions, MailWebhookListResult, MailWebhookReplay, MailWebhookReplayInput, MailWebhookUpdateInput } from './mail-webhook-types.js';
3
3
  export declare class MailEventsClient {
4
4
  private readonly client;
5
5
  constructor(client: StackShift);
@@ -23,6 +23,7 @@ export declare class MailWebhooksClient {
23
23
  }>;
24
24
  getDelivery(deliveryId: string): Promise<MailWebhookDeliveryDetail>;
25
25
  retryDelivery(deliveryId: string): Promise<MailWebhookDelivery>;
26
+ replay(webhookId: string, input: MailWebhookReplayInput): Promise<MailWebhookReplay>;
26
27
  verifySignature(input: {
27
28
  rawBody: string | Uint8Array;
28
29
  signatureHeader?: string | null;
@@ -38,6 +39,6 @@ export declare function verifyWebhookSignature(input: {
38
39
  secret: string;
39
40
  toleranceSeconds?: number;
40
41
  }): boolean;
41
- export declare function timeline(client: StackShift, messageId: string): Promise<{
42
+ export declare function timeline(client: StackShift, messageId: string, recipient?: string): Promise<{
42
43
  data: MailTimelineItem[];
43
44
  }>;
@@ -55,6 +55,13 @@ export class MailWebhooksClient {
55
55
  method: 'POST',
56
56
  });
57
57
  }
58
+ replay(webhookId, input) {
59
+ return this.client.mailRequest(`/mail/webhooks/${encodeURIComponent(webhookId)}/replay`, {
60
+ method: 'POST',
61
+ headers: { 'Idempotency-Key': input.idempotencyKey },
62
+ body: { eventIds: input.eventIds },
63
+ });
64
+ }
58
65
  verifySignature(input) {
59
66
  return verifyWebhookSignature(input);
60
67
  }
@@ -72,8 +79,9 @@ export function verifyWebhookSignature(input) {
72
79
  return false;
73
80
  return constantTimeEqual(actual, expected);
74
81
  }
75
- export function timeline(client, messageId) {
76
- return client.mailRequest(`/mail/messages/${encodeURIComponent(messageId)}/timeline`);
82
+ export function timeline(client, messageId, recipient) {
83
+ const query = recipient ? `?recipient=${encodeURIComponent(recipient)}` : '';
84
+ return client.mailRequest(`/mail/messages/${encodeURIComponent(messageId)}/timeline${query}`);
77
85
  }
78
86
  function queryString(options) {
79
87
  const query = new URLSearchParams();
@@ -0,0 +1,32 @@
1
+ import type { StackShift } from './client.js';
2
+ export interface MailExport {
3
+ id: string;
4
+ kind: 'recipient_delivery';
5
+ format: 'jsonl';
6
+ status: 'queued' | 'processing' | 'ready' | 'failed' | 'expired';
7
+ from: string;
8
+ to: string;
9
+ recordCount: number;
10
+ sizeBytes: number;
11
+ checksum?: string;
12
+ error?: string;
13
+ createdAt: string;
14
+ completedAt?: string;
15
+ expiresAt: string;
16
+ }
17
+ export interface MailExportCreateInput {
18
+ kind?: 'recipient_delivery';
19
+ format?: 'jsonl';
20
+ from?: string;
21
+ to?: string;
22
+ }
23
+ export declare class MailExportsClient {
24
+ private readonly client;
25
+ constructor(client: StackShift);
26
+ create(input?: MailExportCreateInput): Promise<MailExport>;
27
+ list(): Promise<{
28
+ data: MailExport[];
29
+ }>;
30
+ get(id: string): Promise<MailExport>;
31
+ downloadPath(id: string): string;
32
+ }
@@ -0,0 +1,18 @@
1
+ export class MailExportsClient {
2
+ client;
3
+ constructor(client) {
4
+ this.client = client;
5
+ }
6
+ create(input = {}) {
7
+ return this.client.mailRequest('/mail/exports', { method: 'POST', body: input });
8
+ }
9
+ list() {
10
+ return this.client.mailRequest('/mail/exports');
11
+ }
12
+ get(id) {
13
+ return this.client.mailRequest(`/mail/exports/${encodeURIComponent(id)}`);
14
+ }
15
+ downloadPath(id) {
16
+ return `/mail/exports/${encodeURIComponent(id)}/download`;
17
+ }
18
+ }
@@ -0,0 +1,27 @@
1
+ import type { StackShift } from './client.js';
2
+ export interface MailMessageStream {
3
+ id: string;
4
+ workspaceId: string;
5
+ name: string;
6
+ slug: string;
7
+ type: 'transactional' | 'broadcast';
8
+ status: 'active' | 'paused';
9
+ protected: boolean;
10
+ ipPoolId: string;
11
+ createdAt: string;
12
+ updatedAt: string;
13
+ }
14
+ export interface MailMessageStreamCreateInput {
15
+ name: string;
16
+ slug: string;
17
+ type: 'transactional' | 'broadcast';
18
+ }
19
+ export interface MailMessageStreamListResult {
20
+ data: MailMessageStream[];
21
+ }
22
+ export declare class MailStreamsClient {
23
+ private readonly client;
24
+ constructor(client: StackShift);
25
+ create(input: MailMessageStreamCreateInput): Promise<MailMessageStream>;
26
+ list(): Promise<MailMessageStreamListResult>;
27
+ }
@@ -0,0 +1,12 @@
1
+ export class MailStreamsClient {
2
+ client;
3
+ constructor(client) {
4
+ this.client = client;
5
+ }
6
+ create(input) {
7
+ return this.client.mailRequest('/mail/streams', { method: 'POST', body: input });
8
+ }
9
+ list() {
10
+ return this.client.mailRequest('/mail/streams');
11
+ }
12
+ }
@@ -1,5 +1,5 @@
1
1
  import type { JsonValue } from './types.js';
2
- export type MailEventType = 'mail.message.queued' | 'mail.message.sending' | 'mail.message.sent' | 'mail.message.deferred' | 'mail.message.failed' | 'mail.message.bounced' | 'mail.message.suppressed' | 'mail.suppression.created' | 'mail.suppression.deleted' | 'mail.otp.created' | 'mail.otp.sent' | 'mail.otp.verified' | 'mail.otp.failed_attempt' | 'mail.otp.failed' | 'mail.otp.expired' | 'mail.otp.canceled' | 'mail.template.created' | 'mail.template.updated' | 'mail.template.deleted' | 'mail.template.version.created' | 'mail.template.test_sent' | 'mail.domain.created' | 'mail.domain.verified' | 'mail.domain.failed' | 'mail.domain.deleted' | 'mail.webhook.created' | 'mail.webhook.updated' | 'mail.webhook.disabled' | 'mail.webhook.delivery.succeeded' | 'mail.webhook.delivery.failed';
2
+ export type MailEventType = 'mail.message.accepted' | 'mail.message.queued' | 'mail.message.sending' | 'mail.message.mta_accepted' | 'mail.delivery.delayed' | 'mail.delivery.delivered' | 'mail.message.failed' | 'mail.message.bounced' | 'mail.message.suppressed' | 'mail.message.complained' | 'mail.suppression.created' | 'mail.suppression.deleted' | 'mail.otp.created' | 'mail.otp.sent' | 'mail.otp.verified' | 'mail.otp.failed_attempt' | 'mail.otp.failed' | 'mail.otp.expired' | 'mail.otp.canceled' | 'mail.template.created' | 'mail.template.updated' | 'mail.template.deleted' | 'mail.template.version.created' | 'mail.template.test_queued' | 'mail.domain.created' | 'mail.domain.verified' | 'mail.domain.failed' | 'mail.domain.deleted' | 'mail.webhook.created' | 'mail.webhook.updated' | 'mail.webhook.disabled' | 'mail.webhook.delivery.succeeded' | 'mail.webhook.delivery.failed' | 'mail.audience.created' | 'mail.audience.members.imported' | 'mail.campaign.created' | 'mail.campaign.queued';
3
3
  export interface MailEvent {
4
4
  id: string;
5
5
  type: MailEventType | string;
@@ -89,6 +89,17 @@ export interface MailWebhookDeliveryAttempt {
89
89
  export interface MailWebhookDeliveryDetail extends MailWebhookDelivery {
90
90
  attempts: MailWebhookDeliveryAttempt[];
91
91
  }
92
+ export interface MailWebhookReplayInput {
93
+ eventIds: string[];
94
+ idempotencyKey: string;
95
+ }
96
+ export interface MailWebhookReplay {
97
+ id: string;
98
+ webhookId: string;
99
+ eventIds: string[];
100
+ deliveries: MailWebhookDelivery[];
101
+ createdAt: string;
102
+ }
92
103
  export interface MailWebhookDeliveryListOptions {
93
104
  status?: string;
94
105
  limit?: number;
package/dist/mail.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { StackShift } from './client.js';
2
2
  import type { MailLog, MailDomain, MailDomainListResult, MailMessage, MailMessageListOptions, MailMessageListResult, MailSendAttempt, MailSendInput, MailSendResponse } from './types.js';
3
- import type { MailBounce, MailBounceListOptions, MailBounceListResult, MailSuppression, MailSuppressionCreateInput, MailSuppressionListOptions, MailSuppressionListResult } from './mail-phase4-types.js';
3
+ import type { MailBounce, MailBounceListOptions, MailBounceListResult, MailSuppression, MailSuppressionCreateInput, MailSuppressionListOptions, MailSuppressionListResult } from './mail-delivery-types.js';
4
4
  import type { MailOtpChallenge, MailOtpChallengeListOptions, MailOtpChallengeListResult, MailOtpSendInput, MailOtpSendResponse, MailOtpVerifyInput, MailOtpVerifyResponse } from './mail-otp-types.js';
5
5
  import type { MailSendTemplateInput, MailSendTemplateResponse, MailTemplate, MailTemplateCreateInput, MailTemplateDetail, MailTemplateListOptions, MailTemplateListResult, MailTemplatePreview, MailTemplatePreviewInput, MailTemplateTestSendInput, MailTemplateTestSendResponse, MailTemplateUpdateInput, MailTemplateVersion } from './mail-template-types.js';
6
6
  import { MailAnalyticsClient, MailBatchClient, MailInboundClient, MailScheduledClient } from './mail-advanced.js';
@@ -8,6 +8,13 @@ export { MailAnalyticsClient, MailBatchClient, MailInboundClient, MailScheduledC
8
8
  import type { MailLimits, MailReputation, MailReputationEventListOptions, MailReputationEventListResult } from './mail-reputation-types.js';
9
9
  export { MailEventsClient, MailWebhooksClient, verifyWebhookSignature } from './mail-events-webhooks.js';
10
10
  import { MailEventsClient, MailWebhooksClient } from './mail-events-webhooks.js';
11
+ import { MailStreamsClient } from './mail-streams.js';
12
+ export { MailStreamsClient } from './mail-streams.js';
13
+ import { MailAudiencesClient, MailCampaignsClient } from './mail-campaigns.js';
14
+ export { MailAudiencesClient, MailCampaignsClient } from './mail-campaigns.js';
15
+ import { MailExportsClient } from './mail-exports.js';
16
+ export { MailExportsClient } from './mail-exports.js';
17
+ import type { MailTemplateDiagnosticInput, MailTemplateDiagnosticResult } from './mail-diagnostics.js';
11
18
  export declare class MailClient {
12
19
  private readonly client;
13
20
  readonly domains: MailDomainsClient;
@@ -18,6 +25,10 @@ export declare class MailClient {
18
25
  readonly templates: MailTemplatesClient;
19
26
  readonly events: MailEventsClient;
20
27
  readonly webhooks: MailWebhooksClient;
28
+ readonly streams: MailStreamsClient;
29
+ readonly audiences: MailAudiencesClient;
30
+ readonly campaigns: MailCampaignsClient;
31
+ readonly exports: MailExportsClient;
21
32
  readonly limits: MailLimitsClient;
22
33
  readonly reputation: MailReputationClient;
23
34
  readonly scheduled: MailScheduledClient;
@@ -58,6 +69,7 @@ export declare class MailTemplatesClient {
58
69
  getVersion(templateId: string, versionId: string): Promise<MailTemplateVersion>;
59
70
  activateVersion(templateId: string, versionId: string): Promise<MailTemplate>;
60
71
  preview(templateId: string, input: MailTemplatePreviewInput): Promise<MailTemplatePreview>;
72
+ diagnostics(templateId: string, input?: MailTemplateDiagnosticInput): Promise<MailTemplateDiagnosticResult>;
61
73
  testSend(templateId: string, input: MailTemplateTestSendInput): Promise<MailTemplateTestSendResponse>;
62
74
  }
63
75
  export declare class MailDomainsClient {
@@ -83,7 +95,7 @@ export declare class MailMessagesClient {
83
95
  bounces(messageId: string): Promise<{
84
96
  data: MailBounce[];
85
97
  }>;
86
- timeline(messageId: string): Promise<{
98
+ timeline(messageId: string, recipient?: string): Promise<{
87
99
  data: import("./mail-webhook-types.js").MailTimelineItem[];
88
100
  }>;
89
101
  }
package/dist/mail.js CHANGED
@@ -2,6 +2,12 @@ import { MailAnalyticsClient, MailBatchClient, MailInboundClient, MailScheduledC
2
2
  export { MailAnalyticsClient, MailBatchClient, MailInboundClient, MailScheduledClient } from './mail-advanced.js';
3
3
  export { MailEventsClient, MailWebhooksClient, verifyWebhookSignature } from './mail-events-webhooks.js';
4
4
  import { MailEventsClient, MailWebhooksClient, timeline } from './mail-events-webhooks.js';
5
+ import { MailStreamsClient } from './mail-streams.js';
6
+ export { MailStreamsClient } from './mail-streams.js';
7
+ import { MailAudiencesClient, MailCampaignsClient } from './mail-campaigns.js';
8
+ export { MailAudiencesClient, MailCampaignsClient } from './mail-campaigns.js';
9
+ import { MailExportsClient } from './mail-exports.js';
10
+ export { MailExportsClient } from './mail-exports.js';
5
11
  export class MailClient {
6
12
  client;
7
13
  domains;
@@ -12,6 +18,10 @@ export class MailClient {
12
18
  templates;
13
19
  events;
14
20
  webhooks;
21
+ streams;
22
+ audiences;
23
+ campaigns;
24
+ exports;
15
25
  limits;
16
26
  reputation;
17
27
  scheduled;
@@ -28,6 +38,10 @@ export class MailClient {
28
38
  this.templates = new MailTemplatesClient(client);
29
39
  this.events = new MailEventsClient(client);
30
40
  this.webhooks = new MailWebhooksClient(client);
41
+ this.streams = new MailStreamsClient(client);
42
+ this.audiences = new MailAudiencesClient(client);
43
+ this.campaigns = new MailCampaignsClient(client);
44
+ this.exports = new MailExportsClient(client);
31
45
  this.limits = new MailLimitsClient(client);
32
46
  this.reputation = new MailReputationClient(client);
33
47
  this.scheduled = new MailScheduledClient(client);
@@ -134,6 +148,12 @@ export class MailTemplatesClient {
134
148
  body: input,
135
149
  });
136
150
  }
151
+ diagnostics(templateId, input = {}) {
152
+ return this.client.mailRequest(`/mail/templates/${encodeURIComponent(templateId)}/diagnostics`, {
153
+ method: 'POST',
154
+ body: input,
155
+ });
156
+ }
137
157
  testSend(templateId, input) {
138
158
  return this.client.mailRequest(`/mail/templates/${encodeURIComponent(templateId)}/test-send`, {
139
159
  method: 'POST',
@@ -196,8 +216,8 @@ export class MailMessagesClient {
196
216
  bounces(messageId) {
197
217
  return this.client.mailRequest(`/mail/messages/${encodeURIComponent(messageId)}/bounces`);
198
218
  }
199
- timeline(messageId) {
200
- return timeline(this.client, messageId);
219
+ timeline(messageId, recipient) {
220
+ return timeline(this.client, messageId, recipient);
201
221
  }
202
222
  }
203
223
  export class MailSuppressionsClient {
package/dist/types.d.ts CHANGED
@@ -9,7 +9,8 @@ export interface StackShiftOptions {
9
9
  cdnBaseUrl?: string;
10
10
  fetch?: typeof fetch;
11
11
  }
12
- export type MailStatus = 'queued' | 'sending' | 'sent' | 'deferred' | 'failed' | 'bounced' | 'suppressed';
12
+ export type MailStatus = 'queued' | 'sending' | 'mta_accepted' | 'delayed' | 'delivered' | 'bounced' | 'failed' | 'suppressed' | 'complained' | 'partial';
13
+ export type MailRecipientStatus = Exclude<MailStatus, 'partial'>;
13
14
  export type MailIdempotencyStatus = 'created' | 'reused';
14
15
  export type MailDomainStatus = 'pending' | 'verified' | 'failed' | 'disabled';
15
16
  export type MailRecordStatus = 'missing' | 'pending' | 'verified' | 'failed';
@@ -58,7 +59,12 @@ export interface MailSendInput {
58
59
  uploadId?: string;
59
60
  filename: string;
60
61
  contentType?: string;
62
+ disposition?: 'attachment' | 'inline';
63
+ contentId?: string;
61
64
  }>;
65
+ headers?: Record<string, string>;
66
+ tags?: Record<string, string>;
67
+ stream?: string;
62
68
  }
63
69
  export interface MailSendResponse {
64
70
  id: string;
@@ -81,7 +87,7 @@ export interface MailMessage {
81
87
  createdAt: string;
82
88
  queuedAt?: string | null;
83
89
  sendingAt?: string | null;
84
- sentAt?: string | null;
90
+ mtaAcceptedAt?: string | null;
85
91
  failedAt?: string | null;
86
92
  bouncedAt?: string | null;
87
93
  suppressedAt?: string | null;
@@ -89,6 +95,47 @@ export interface MailMessage {
89
95
  bounceReason?: string | null;
90
96
  finalSmtpStatusCode?: string | null;
91
97
  finalSmtpResponse?: string | null;
98
+ recipients?: MailRecipient[];
99
+ recipientSummary?: MailRecipientSummary;
100
+ headers?: Record<string, string>;
101
+ tags?: Record<string, string>;
102
+ stream?: string;
103
+ streamType?: string;
104
+ }
105
+ export interface MailRecipient {
106
+ id: string;
107
+ messageId: string;
108
+ kind: 'to' | 'cc' | 'bcc';
109
+ email: string;
110
+ status: MailRecipientStatus;
111
+ rfcMessageId?: string | null;
112
+ postfixQueueId?: string | null;
113
+ remoteMx?: string | null;
114
+ provider?: string | null;
115
+ smtpStatus?: string | null;
116
+ enhancedStatus?: string | null;
117
+ smtpResponse?: string | null;
118
+ latencyMs?: number | null;
119
+ disposition?: string | null;
120
+ bounceCategory?: string | null;
121
+ suppressionAction?: string | null;
122
+ createdAt: string;
123
+ updatedAt: string;
124
+ mtaAcceptedAt?: string | null;
125
+ deliveredAt?: string | null;
126
+ bouncedAt?: string | null;
127
+ complainedAt?: string | null;
128
+ }
129
+ export interface MailRecipientSummary {
130
+ queued: number;
131
+ sending: number;
132
+ mtaAccepted: number;
133
+ delayed: number;
134
+ delivered: number;
135
+ bounced: number;
136
+ failed: number;
137
+ suppressed: number;
138
+ complained: number;
92
139
  }
93
140
  export interface MailMessageSummary {
94
141
  id: string;
@@ -98,7 +145,7 @@ export interface MailMessageSummary {
98
145
  status: MailStatus;
99
146
  createdAt: string;
100
147
  queuedAt?: string | null;
101
- sentAt?: string | null;
148
+ mtaAcceptedAt?: string | null;
102
149
  }
103
150
  export interface MailMessageListOptions {
104
151
  status?: MailStatus;
@@ -315,6 +362,12 @@ export interface AssetBucket {
315
362
  allowed_origins: string[];
316
363
  lifecycle_policy: Record<string, unknown>;
317
364
  custom_domain_id?: string;
365
+ storage_mode: 'managed' | 'byob' | 'stackshift_s2';
366
+ connection_id?: string;
367
+ s2_bucket_id?: string;
368
+ object_prefix: string;
369
+ derivative_prefix: string;
370
+ auto_extract_text: boolean;
318
371
  revision: number;
319
372
  created_at: string;
320
373
  updated_at: string;
@@ -0,0 +1,70 @@
1
+ export interface UploadProgress {
2
+ loaded: number;
3
+ total: number;
4
+ percent: number;
5
+ }
6
+ export interface UploadedPart {
7
+ partNumber: number;
8
+ size: number;
9
+ checksumSHA256?: string;
10
+ }
11
+ export interface ChunkUploadSession {
12
+ id: string;
13
+ uploadToken: string;
14
+ expiresAt: string;
15
+ maxBytes: number;
16
+ partSize: number;
17
+ parts: UploadedPart[];
18
+ resumeContext?: string;
19
+ }
20
+ export interface ChunkUploadRequest {
21
+ key: string;
22
+ fileName: string;
23
+ mimeType: string;
24
+ metadata?: Record<string, unknown>;
25
+ }
26
+ export interface ChunkUploadCallbacks {
27
+ signal?: AbortSignal;
28
+ onProgress?: (progress: UploadProgress) => void;
29
+ onPartProgress?: (partNumber: number, progress: UploadProgress) => void;
30
+ onSession?: (session: ChunkUploadSession) => void;
31
+ }
32
+ export interface ChunkUploadTransport<TResult> {
33
+ create(file: Blob, request: ChunkUploadRequest): Promise<ChunkUploadSession>;
34
+ resume(resumeContext: string): Promise<ChunkUploadSession>;
35
+ uploadPart(session: ChunkUploadSession, partNumber: number, chunk: Blob, checksum: string, callbacks: ChunkUploadCallbacks): Promise<void>;
36
+ complete(session: ChunkUploadSession): Promise<TResult>;
37
+ cancel(session: ChunkUploadSession): Promise<void>;
38
+ }
39
+ export interface UploadResumeRecord {
40
+ key: string;
41
+ fingerprint: string;
42
+ session: ChunkUploadSession;
43
+ updatedAt: string;
44
+ }
45
+ export interface UploadResumeStore {
46
+ get(key: string): Promise<UploadResumeRecord | undefined>;
47
+ set(record: UploadResumeRecord): Promise<void>;
48
+ delete(key: string): Promise<void>;
49
+ }
50
+ export interface ChunkedUploadOptions extends ChunkUploadCallbacks {
51
+ resumeKey?: string;
52
+ concurrency?: number;
53
+ retryAttempts?: number;
54
+ cancelOnAbort?: boolean;
55
+ }
56
+ export declare class UploadResumeInvalidError extends Error {
57
+ constructor(message?: string);
58
+ }
59
+ export declare class ChunkedUploadController<TResult> {
60
+ private readonly transport;
61
+ private readonly store?;
62
+ private persistence;
63
+ constructor(transport: ChunkUploadTransport<TResult>, store?: UploadResumeStore | undefined);
64
+ upload(file: Blob, request: ChunkUploadRequest, options?: ChunkedUploadOptions): Promise<TResult>;
65
+ cancel(resumeKey: string): Promise<void>;
66
+ private restore;
67
+ private persist;
68
+ }
69
+ export declare function putBlob(url: string, blob: Blob, callbacks?: ChunkUploadCallbacks, headers?: Record<string, string>, fetcher?: typeof fetch): Promise<void>;
70
+ export declare function sha256Blob(blob: Blob): Promise<string>;