@stackshift-cloud/sdk 0.1.1 → 0.1.2

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/types.d.ts CHANGED
@@ -5,8 +5,129 @@ export type AssetVisibility = 'public' | 'private';
5
5
  export interface StackShiftOptions {
6
6
  apiKey?: string;
7
7
  baseUrl?: string;
8
+ mailBaseUrl?: string;
9
+ cdnBaseUrl?: string;
8
10
  fetch?: typeof fetch;
9
11
  }
12
+ export type MailStatus = 'queued' | 'sending' | 'sent' | 'deferred' | 'failed' | 'bounced' | 'suppressed';
13
+ export type MailIdempotencyStatus = 'created' | 'reused';
14
+ export type MailDomainStatus = 'pending' | 'verified' | 'failed' | 'disabled';
15
+ export type MailRecordStatus = 'missing' | 'pending' | 'verified' | 'failed';
16
+ export interface MailDnsRecord {
17
+ type: 'TXT' | 'CNAME' | 'MX' | string;
18
+ name: string;
19
+ value: string;
20
+ status: MailRecordStatus;
21
+ required: boolean;
22
+ explanation?: string;
23
+ }
24
+ export interface MailDomain {
25
+ id: string;
26
+ domain: string;
27
+ status: MailDomainStatus;
28
+ spfStatus: MailRecordStatus;
29
+ dkimStatus: MailRecordStatus;
30
+ dmarcStatus: MailRecordStatus;
31
+ returnPathStatus: MailRecordStatus;
32
+ records?: MailDnsRecord[];
33
+ createdAt: string;
34
+ verifiedAt?: string | null;
35
+ lastCheckedAt?: string | null;
36
+ }
37
+ export interface MailDomainListResult {
38
+ data: MailDomain[];
39
+ nextCursor?: string | null;
40
+ }
41
+ export interface MailAddress {
42
+ email: string;
43
+ name?: string;
44
+ }
45
+ export type MailAddressInput = string | MailAddress | Array<string | MailAddress>;
46
+ export interface MailSendInput {
47
+ from: string | MailAddress;
48
+ to: MailAddressInput;
49
+ cc?: MailAddressInput;
50
+ bcc?: MailAddressInput;
51
+ replyTo?: string | MailAddress;
52
+ subject: string;
53
+ html?: string;
54
+ text?: string;
55
+ idempotencyKey?: string;
56
+ attachments?: Array<{
57
+ assetId?: string;
58
+ uploadId?: string;
59
+ filename: string;
60
+ contentType?: string;
61
+ }>;
62
+ }
63
+ export interface MailSendResponse {
64
+ id: string;
65
+ status: MailStatus;
66
+ idempotencyStatus: MailIdempotencyStatus;
67
+ }
68
+ export interface MailMessage {
69
+ id: string;
70
+ from: MailAddress;
71
+ to: string[];
72
+ cc: string[];
73
+ bcc: string[];
74
+ replyTo?: string | null;
75
+ subject: string;
76
+ html?: string | null;
77
+ text?: string | null;
78
+ status: MailStatus;
79
+ errorCode?: string | null;
80
+ errorMessage?: string | null;
81
+ createdAt: string;
82
+ queuedAt?: string | null;
83
+ sendingAt?: string | null;
84
+ sentAt?: string | null;
85
+ failedAt?: string | null;
86
+ bouncedAt?: string | null;
87
+ suppressedAt?: string | null;
88
+ bounceType?: 'hard' | 'soft' | null;
89
+ bounceReason?: string | null;
90
+ finalSmtpStatusCode?: string | null;
91
+ finalSmtpResponse?: string | null;
92
+ }
93
+ export interface MailMessageSummary {
94
+ id: string;
95
+ from: string;
96
+ to: string[];
97
+ subject: string;
98
+ status: MailStatus;
99
+ createdAt: string;
100
+ queuedAt?: string | null;
101
+ sentAt?: string | null;
102
+ }
103
+ export interface MailMessageListOptions {
104
+ status?: MailStatus;
105
+ limit?: number;
106
+ cursor?: string;
107
+ to?: string;
108
+ from?: string;
109
+ }
110
+ export interface MailMessageListResult {
111
+ data: MailMessageSummary[];
112
+ nextCursor?: string | null;
113
+ }
114
+ export interface MailSendAttempt {
115
+ id: string;
116
+ attemptNumber: number;
117
+ status: 'started' | 'accepted_by_mta' | 'deferred' | 'failed';
118
+ mtaQueueId?: string | null;
119
+ smtpStatusCode?: string | null;
120
+ smtpResponse?: string | null;
121
+ startedAt: string;
122
+ completedAt?: string | null;
123
+ }
124
+ export interface MailLog {
125
+ level: 'info' | 'warn' | 'error' | string;
126
+ event: string;
127
+ message: string;
128
+ metadata?: JsonValue;
129
+ createdAt: string;
130
+ }
10
131
  export interface Project {
11
132
  id: string;
12
133
  name: string;
@@ -30,12 +151,94 @@ export interface Asset {
30
151
  visibility: AssetVisibility;
31
152
  status: 'uploading' | 'available' | 'deleted' | 'failed';
32
153
  replication_status: 'pending' | 'replicated' | 'degraded' | 'failed';
154
+ scan_status?: 'pending' | 'clean' | 'infected' | 'failed' | 'skipped';
155
+ scan_result?: string;
156
+ quarantine_status?: 'none' | 'infected' | 'policy';
157
+ video_status?: 'none' | 'pending' | 'processing' | 'ready' | 'failed' | 'skipped';
158
+ ai_status?: 'pending' | 'processing' | 'ready' | 'failed' | 'skipped';
159
+ moderation_status?: 'pending' | 'processing' | 'clean' | 'flagged' | 'quarantined' | 'failed';
160
+ moderation_reason?: string;
161
+ current_version_id?: string;
162
+ default_branch?: string;
33
163
  metadata?: Record<string, JsonValue>;
34
164
  cache_control?: string;
165
+ tags?: string[];
166
+ video?: AssetVideoInfo;
167
+ ai?: AssetAIInfo;
35
168
  url?: string;
36
169
  created_at: string;
37
170
  updated_at: string;
38
171
  }
172
+ export interface AssetAIInfo {
173
+ annotation?: AssetAIAnnotation;
174
+ moderation?: AssetModerationResult;
175
+ transcript?: AssetTranscript;
176
+ }
177
+ export interface AssetAIAnnotation {
178
+ provider: string;
179
+ model: string;
180
+ status: string;
181
+ caption?: string;
182
+ alt_text?: string;
183
+ tags: string[];
184
+ objects: string[];
185
+ colors: string[];
186
+ raw?: JsonValue;
187
+ }
188
+ export interface AssetModerationResult {
189
+ id: string;
190
+ provider: string;
191
+ model: string;
192
+ status: string;
193
+ flagged: boolean;
194
+ categories: Record<string, boolean>;
195
+ category_scores: Record<string, number>;
196
+ reason?: string;
197
+ created_at: string;
198
+ }
199
+ export interface AssetTranscript {
200
+ provider: string;
201
+ model: string;
202
+ status: string;
203
+ language?: string;
204
+ text?: string;
205
+ segments?: JsonValue[];
206
+ }
207
+ export interface AssetVersion {
208
+ id: string;
209
+ asset_id: string;
210
+ branch: string;
211
+ version_number: number;
212
+ parent_version_id?: string;
213
+ original_name: string;
214
+ mime_type: string;
215
+ size: number;
216
+ checksum_sha256: string;
217
+ metadata?: Record<string, JsonValue>;
218
+ cache_control?: string;
219
+ created_at: string;
220
+ }
221
+ export interface AssetCollection {
222
+ id: string;
223
+ name: string;
224
+ description?: string;
225
+ asset_ids?: string[];
226
+ created_at: string;
227
+ updated_at: string;
228
+ }
229
+ export interface AssetSavedSearch {
230
+ id: string;
231
+ name: string;
232
+ filters: Record<string, JsonValue>;
233
+ created_at: string;
234
+ updated_at: string;
235
+ }
236
+ export interface AssetVideoInfo {
237
+ metadata?: Record<string, JsonValue>;
238
+ outputs?: Array<Record<string, JsonValue>>;
239
+ hls_url?: string;
240
+ poster_url?: string;
241
+ }
39
242
  export interface AssetUploadOptions {
40
243
  bucket?: string;
41
244
  key?: string;
@@ -48,6 +251,12 @@ export interface AssetListOptions {
48
251
  bucket?: string;
49
252
  prefix?: string;
50
253
  visibility?: AssetVisibility;
254
+ query?: string;
255
+ tag?: string;
256
+ mimeType?: string;
257
+ type?: string;
258
+ folder?: string;
259
+ checksum?: string;
51
260
  limit?: number;
52
261
  cursor?: string;
53
262
  }
@@ -65,13 +274,83 @@ export interface AssetSignedUrl {
65
274
  expires_at: string;
66
275
  }
67
276
  export interface AssetSignedUploadUrlOptions extends AssetUploadOptions {
277
+ mode?: 'single' | 'chunked';
278
+ fileName?: string;
279
+ fileSize?: number;
280
+ mimeType?: string;
281
+ checksumSHA256?: string;
282
+ partSize?: number;
68
283
  expiresIn?: string;
69
284
  maxBytes?: number;
70
285
  }
71
286
  export interface AssetSignedUploadUrl {
72
287
  upload_session_id: string;
288
+ session_id?: string;
289
+ mode?: 'single' | 'chunked';
73
290
  url: string;
74
291
  method: 'PUT';
75
292
  expires_at: string;
76
293
  max_bytes: number;
294
+ part_size?: number;
295
+ parts?: AssetChunkUploadPart[];
296
+ }
297
+ export interface AssetChunkUploadPart {
298
+ part_number: number;
299
+ size: number;
300
+ checksum_sha256: string;
301
+ created_at: string;
302
+ }
303
+ export interface AssetUploadProgressCallbacks {
304
+ onProgress?: (progress: {
305
+ loaded: number;
306
+ total: number;
307
+ percent: number;
308
+ }) => void;
309
+ onPartProgress?: (part: number, progress: {
310
+ loaded: number;
311
+ total: number;
312
+ percent: number;
313
+ }) => void;
314
+ }
315
+ export interface AssetUsageSummary {
316
+ total_assets: number;
317
+ total_bytes: number;
318
+ by_bucket: Record<string, number>;
319
+ by_mime_family: Record<string, number>;
320
+ by_visibility: Record<string, number>;
321
+ duplicate_groups: Array<{
322
+ checksum_sha256: string;
323
+ asset_count: number;
324
+ total_bytes: number;
325
+ }>;
326
+ }
327
+ export interface AssetContentPolicy {
328
+ allowed_mime_types: string[];
329
+ max_image_bytes: number;
330
+ max_video_bytes: number;
331
+ max_other_bytes: number;
332
+ require_scan: boolean;
333
+ }
334
+ export type AssetTransformCrop = 'fit' | 'fill';
335
+ export type AssetTransformFormat = 'auto' | 'webp' | 'avif' | 'jpeg' | 'jpg' | 'png';
336
+ export type AssetTransformQuality = 'auto' | number;
337
+ export interface AssetTransformOptions {
338
+ width?: number;
339
+ height?: number;
340
+ crop?: AssetTransformCrop;
341
+ format?: AssetTransformFormat;
342
+ quality?: AssetTransformQuality;
343
+ }
344
+ export interface AssetNamedTransformInput extends AssetTransformOptions {
345
+ name: string;
346
+ }
347
+ export interface AssetSignedTransformOptions extends AssetTransformOptions {
348
+ expiresIn?: string;
349
+ }
350
+ export type AssetTransformPresetCategory = 'responsive-web' | 'social' | 'product' | 'avatar-profile' | 'performance' | 'email-docs';
351
+ export interface AssetTransformPreset extends AssetTransformOptions {
352
+ id: string;
353
+ name: string;
354
+ category: AssetTransformPresetCategory;
355
+ description: string;
77
356
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackshift-cloud/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Official JavaScript and TypeScript SDK for StackShift.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -16,7 +16,8 @@
16
16
  "README.md"
17
17
  ],
18
18
  "scripts": {
19
- "build": "tsc -p tsconfig.json"
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
21
  },
21
22
  "devDependencies": {
22
23
  "typescript": "^5.4.0"