@stackshift-cloud/sdk 0.1.3 → 1.0.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,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,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;
@@ -149,12 +196,13 @@ export interface Asset {
149
196
  size: number;
150
197
  checksum_sha256: string;
151
198
  visibility: AssetVisibility;
152
- status: 'uploading' | 'available' | 'deleted' | 'failed';
199
+ status: 'processing' | 'ready' | 'quarantined' | 'failed' | 'deleting' | 'deleted';
153
200
  replication_status: 'pending' | 'replicated' | 'degraded' | 'failed';
154
201
  scan_status?: 'pending' | 'clean' | 'infected' | 'failed' | 'skipped';
155
202
  scan_result?: string;
156
203
  quarantine_status?: 'none' | 'infected' | 'policy';
157
204
  video_status?: 'none' | 'pending' | 'processing' | 'ready' | 'failed' | 'skipped';
205
+ video_progress_percent?: number;
158
206
  ai_status?: 'pending' | 'processing' | 'ready' | 'failed' | 'skipped';
159
207
  moderation_status?: 'pending' | 'processing' | 'clean' | 'flagged' | 'quarantined' | 'failed';
160
208
  moderation_reason?: string;
@@ -166,6 +214,8 @@ export interface Asset {
166
214
  video?: AssetVideoInfo;
167
215
  ai?: AssetAIInfo;
168
216
  url?: string;
217
+ generation: number;
218
+ revision: number;
169
219
  created_at: string;
170
220
  updated_at: string;
171
221
  }
@@ -257,6 +307,13 @@ export interface AssetListOptions {
257
307
  type?: string;
258
308
  folder?: string;
259
309
  checksum?: string;
310
+ status?: Asset['status'];
311
+ scanStatus?: string;
312
+ replicationStatus?: string;
313
+ moderationStatus?: string;
314
+ quarantineStatus?: string;
315
+ sort?: 'created_at' | 'updated_at' | 'size' | 'key' | 'original_name' | 'mime_type';
316
+ direction?: 'asc' | 'desc';
260
317
  limit?: number;
261
318
  cursor?: string;
262
319
  }
@@ -282,6 +339,55 @@ export interface AssetSignedUploadUrlOptions extends AssetUploadOptions {
282
339
  partSize?: number;
283
340
  expiresIn?: string;
284
341
  maxBytes?: number;
342
+ idempotencyKey?: string;
343
+ /** Resume an existing multipart upload instead of creating another session. */
344
+ uploadSessionId?: string;
345
+ /** Multipart worker count. Defaults to 4 and is capped at 8. */
346
+ concurrency?: number;
347
+ /** Attempts per multipart request. Defaults to 4 and is capped at 8. */
348
+ retryAttempts?: number;
349
+ }
350
+ export interface AssetBucket {
351
+ id: string;
352
+ name: string;
353
+ default_visibility: AssetVisibility;
354
+ cache_control?: string;
355
+ versioning: boolean;
356
+ retention_days: number;
357
+ max_object_bytes?: number;
358
+ allowed_mime_types: string[];
359
+ home_region: string;
360
+ replication_policy: 'global-3';
361
+ cors_origins: string[];
362
+ allowed_origins: string[];
363
+ lifecycle_policy: Record<string, unknown>;
364
+ custom_domain_id?: string;
365
+ revision: number;
366
+ created_at: string;
367
+ updated_at: string;
368
+ }
369
+ export interface AssetBucketInput {
370
+ name?: string;
371
+ default_visibility?: AssetVisibility;
372
+ cache_control?: string;
373
+ versioning?: boolean;
374
+ retention_days?: number;
375
+ max_object_bytes?: number;
376
+ allowed_mime_types?: string[];
377
+ home_region?: string;
378
+ replication_policy?: 'global-3';
379
+ cors_origins?: string[];
380
+ allowed_origins?: string[];
381
+ lifecycle_policy?: Record<string, unknown>;
382
+ custom_domain_id?: string;
383
+ }
384
+ export interface AssetPatchInput {
385
+ bucket?: string;
386
+ key?: string;
387
+ original_name?: string;
388
+ cache_control?: string;
389
+ clear_cache_control?: boolean;
390
+ visibility?: AssetVisibility;
285
391
  }
286
392
  export interface AssetSignedUploadUrl {
287
393
  upload_session_id: string;
@@ -311,10 +417,24 @@ export interface AssetUploadProgressCallbacks {
311
417
  total: number;
312
418
  percent: number;
313
419
  }) => void;
420
+ /** Cancels in-flight browser requests and the server-side upload session. */
421
+ signal?: AbortSignal;
314
422
  }
315
423
  export interface AssetUsageSummary {
316
424
  total_assets: number;
317
425
  total_bytes: number;
426
+ period_ingress_bytes: number;
427
+ period_egress_bytes: number;
428
+ period_origin_bytes: number;
429
+ period_verification_bytes: number;
430
+ period_transform_count: number;
431
+ period_ai_requests: number;
432
+ period_logical_storage_byte_hours: number;
433
+ period_physical_storage_byte_hours: number;
434
+ period_derived_storage_byte_hours: number;
435
+ period_transform_compute_ms: number;
436
+ period_video_input_seconds: number;
437
+ period_ai_cost_micros: number;
318
438
  by_bucket: Record<string, number>;
319
439
  by_mime_family: Record<string, number>;
320
440
  by_visibility: Record<string, number>;
@@ -324,6 +444,97 @@ export interface AssetUsageSummary {
324
444
  total_bytes: number;
325
445
  }>;
326
446
  }
447
+ export interface AssetJobSubmission {
448
+ job_id: string;
449
+ status: string;
450
+ status_url: string;
451
+ }
452
+ export interface AssetJob {
453
+ id: string;
454
+ job_name: string;
455
+ status: string;
456
+ progress_percent: number;
457
+ phase: 'queued' | 'processing' | 'waiting' | 'ready' | 'failed' | 'cancelled' | string;
458
+ attempt: number;
459
+ max_attempts: number;
460
+ created_at: string;
461
+ started_at?: string;
462
+ completed_at?: string;
463
+ error?: string;
464
+ }
465
+ export interface AssetAIPolicy {
466
+ enabled_actions: Array<'analyze' | 'transcribe' | 'smart_crop' | 'background_remove'>;
467
+ monthly_spend_cap_micros: number;
468
+ revision: number;
469
+ }
470
+ export interface AssetAIAccountConfig {
471
+ provider: string;
472
+ configured: boolean;
473
+ actions: string[];
474
+ policy: AssetAIPolicy;
475
+ monthly_spend_used_micros: number;
476
+ }
477
+ export interface AssetLifecycleRule {
478
+ id: string;
479
+ name: string;
480
+ prefix?: string;
481
+ action: 'delete' | 'expire_versions';
482
+ age_days: number;
483
+ enabled: boolean;
484
+ created_at: string;
485
+ updated_at: string;
486
+ last_run_at?: string;
487
+ last_error?: string;
488
+ }
489
+ export interface AssetCustomDomain {
490
+ id: string;
491
+ domain: string;
492
+ status: string;
493
+ verification_name: string;
494
+ verification_value: string;
495
+ last_error?: string;
496
+ provider_domain_id?: string;
497
+ certificate_id?: string;
498
+ created_at: string;
499
+ updated_at: string;
500
+ verified_at?: string;
501
+ }
502
+ export interface AssetEvent {
503
+ id: string;
504
+ asset_id?: string;
505
+ type: string;
506
+ data: Record<string, unknown>;
507
+ created_at: string;
508
+ }
509
+ export interface AssetWebhook {
510
+ id: string;
511
+ url: string;
512
+ event_types: string[];
513
+ status: 'active' | 'disabled';
514
+ failure_count: number;
515
+ last_success_at?: string;
516
+ last_failure_at?: string;
517
+ disabled_at?: string;
518
+ created_by: string;
519
+ created_at: string;
520
+ updated_at: string;
521
+ }
522
+ export interface AssetWebhookDelivery {
523
+ id: string;
524
+ webhook_id: string;
525
+ event_id: string;
526
+ event_type: string;
527
+ payload: Record<string, unknown>;
528
+ status: 'pending' | 'delivering' | 'succeeded' | 'failed';
529
+ attempt_count: number;
530
+ next_attempt_at: string;
531
+ status_code?: number;
532
+ response_snippet?: string;
533
+ error_message?: string;
534
+ created_at: string;
535
+ updated_at: string;
536
+ delivered_at?: string;
537
+ }
327
538
  export interface AssetContentPolicy {
328
539
  allowed_mime_types: string[];
329
540
  max_image_bytes: number;
@@ -340,6 +551,8 @@ export interface AssetTransformOptions {
340
551
  crop?: AssetTransformCrop;
341
552
  format?: AssetTransformFormat;
342
553
  quality?: AssetTransformQuality;
554
+ gravity?: 'centre' | 'attention' | 'entropy';
555
+ animation?: 'first' | 'reject';
343
556
  }
344
557
  export interface AssetNamedTransformInput extends AssetTransformOptions {
345
558
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackshift-cloud/sdk",
3
- "version": "0.1.3",
3
+ "version": "1.0.0",
4
4
  "description": "Official JavaScript and TypeScript SDK for StackShift.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,7 +17,7 @@
17
17
  ],
18
18
  "scripts": {
19
19
  "build": "tsc -p tsconfig.json",
20
- "test": "npm run build && node test/mail.test.mjs && node test/mail-webhooks.test.mjs && node test/mail-advanced.test.mjs && node test/assets.test.mjs"
20
+ "test": "npm run build && node test/mail.test.mjs && node test/mail-webhooks.test.mjs && node test/mail-advanced.test.mjs && node test/mail-exports.test.mjs && node test/mail-diagnostics.test.mjs && node test/assets.test.mjs"
21
21
  },
22
22
  "devDependencies": {
23
23
  "typescript": "^5.4.0"