@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
package/dist/client.js CHANGED
@@ -30,10 +30,22 @@ export class StackShift {
30
30
  async request(path, init = {}) {
31
31
  return this.requestFrom(this.baseUrl, path, init);
32
32
  }
33
+ requestRaw(path, init = {}) {
34
+ return this.fetchFrom(this.baseUrl, path, init);
35
+ }
33
36
  async mailRequest(path, init = {}) {
34
37
  return this.requestFrom(this.mailBaseUrl, path, init);
35
38
  }
36
39
  async requestFrom(baseUrl, path, init) {
40
+ const response = await this.fetchFrom(baseUrl, path, init);
41
+ const raw = await response.text();
42
+ const parsed = raw ? JSON.parse(raw) : null;
43
+ if (parsed && typeof parsed === 'object' && 'success' in parsed && 'data' in parsed) {
44
+ return parsed.data;
45
+ }
46
+ return parsed;
47
+ }
48
+ async fetchFrom(baseUrl, path, init) {
37
49
  const isFormData = typeof FormData !== 'undefined' && init.body instanceof FormData;
38
50
  const response = await this.fetcher(`${baseUrl}${path}`, {
39
51
  method: init.method ?? 'GET',
@@ -44,16 +56,13 @@ export class StackShift {
44
56
  }),
45
57
  body: (init.body === undefined ? undefined : isFormData ? init.body : JSON.stringify(stripUndefined(init.body))),
46
58
  });
47
- const raw = await response.text();
48
- const parsed = raw ? JSON.parse(raw) : null;
49
59
  if (!response.ok) {
60
+ const raw = await response.text();
61
+ const parsed = raw ? JSON.parse(raw) : null;
50
62
  const apiError = parsed?.error && typeof parsed.error === 'object' ? parsed.error : undefined;
51
63
  throw new StackShiftAPIError(apiError?.message ?? parsed?.message ?? parsed?.error ?? `StackShift API request failed with ${response.status}`, response.status, apiError?.code, apiError?.details);
52
64
  }
53
- if (parsed && typeof parsed === 'object' && 'success' in parsed && 'data' in parsed) {
54
- return parsed.data;
55
- }
56
- return parsed;
65
+ return response;
57
66
  }
58
67
  }
59
68
  export class StackShiftAPIError extends Error {
@@ -1,5 +1,5 @@
1
- export type AssetOperationId = 'uploadAsset' | 'createUploadSession' | 'getUploadSession' | 'completeUploadSession' | 'cancelUploadSession' | 'createSignedUploadUrl' | 'createBucket' | 'listBuckets' | 'updateBucket' | 'deleteBucket' | 'getContentPolicy' | 'updateContentPolicy' | 'upsertTransformation' | 'listTransformations' | 'deleteTransformation' | 'createLifecycleRule' | 'listLifecycleRules' | 'deleteLifecycleRule' | 'createDomain' | 'listDomains' | 'verifyDomain' | 'deleteDomain' | 'getAnalytics' | 'getUsageSummary' | 'listEvents' | 'createWebhook' | 'listWebhooks' | 'deleteWebhook' | 'listWebhookDeliveries' | 'retryWebhookDelivery' | 'bulkAssets' | 'listCollections' | 'createCollection' | 'updateCollection' | 'deleteCollection' | 'listSavedSearches' | 'createSavedSearch' | 'updateSavedSearch' | 'deleteSavedSearch' | 'getAIConfig' | 'updateAIConfig' | 'getJob' | 'cancelJob' | 'listAssets' | 'getAsset' | 'patchAsset' | 'getAssetAI' | 'analyzeAsset' | 'moderateAsset' | 'getTranscript' | 'transcribeAsset' | 'smartCropAsset' | 'removeAssetBackground' | 'listAssetVersions' | 'createAssetBranch' | 'restoreAssetVersion' | 'promoteAssetBranch' | 'deleteAsset' | 'replaceAsset' | 'createSignedAssetUrl' | 'createSignedTransformUrl' | 'setAssetTags' | 'patchAssetMetadata' | 'purgeAsset';
2
- export type AssetAPIScope = 'assets:read' | 'assets:write' | 'assets:process' | 'assets:admin';
1
+ export type AssetOperationId = 'uploadAsset' | 'createUploadSession' | 'getUploadSession' | 'completeUploadSession' | 'cancelUploadSession' | 'createSignedUploadUrl' | 'createBucket' | 'listBuckets' | 'updateBucket' | 'deleteBucket' | 'configureBucketStorage' | 'startBucketRelocation' | 'createAssetConnection' | 'listAssetConnections' | 'getAssetConnection' | 'updateAssetConnection' | 'verifyAssetConnection' | 'deleteAssetConnection' | 'listOwnedS2Buckets' | 'createOwnedS2Bucket' | 'startAssetMigration' | 'listAssetMigrations' | 'getAssetMigration' | 'cancelAssetMigration' | 'retryAssetMigrationItem' | 'downloadAssetMigrationReport' | 'createAssetUploadCapability' | 'getContentPolicy' | 'updateContentPolicy' | 'upsertTransformation' | 'listTransformations' | 'materializeAssetTransform' | 'listAssetDerivatives' | 'generateAsset' | 'getAssetAutomation' | 'assetMCP' | 'getAssetWorkflowCatalog' | 'listAssetWorkflows' | 'createAssetWorkflow' | 'getAssetWorkflow' | 'updateAssetWorkflowDraft' | 'validateAssetWorkflow' | 'publishAssetWorkflow' | 'activateAssetWorkflow' | 'startAssetWorkflowRun' | 'listAssetWorkflowVersions' | 'listAssetWorkflowRuns' | 'getAssetWorkflowRun' | 'cancelAssetWorkflowRun' | 'retryAssetWorkflowRun' | 'listAssetWorkflowApprovals' | 'approveAssetWorkflow' | 'rejectAssetWorkflow' | 'listAssetWorkflowConnections' | 'createAssetWorkflowConnection' | 'rotateAssetWorkflowConnectionCredential' | 'rotateAssetWorkflowInboundHook' | 'receiveAssetWorkflowInboundHook' | 'deleteTransformation' | 'createLifecycleRule' | 'listLifecycleRules' | 'deleteLifecycleRule' | 'createDomain' | 'listDomains' | 'verifyDomain' | 'deleteDomain' | 'getAnalytics' | 'getUsageSummary' | 'listEvents' | 'createWebhook' | 'listWebhooks' | 'deleteWebhook' | 'listWebhookDeliveries' | 'retryWebhookDelivery' | 'bulkAssets' | 'listCollections' | 'createCollection' | 'updateCollection' | 'deleteCollection' | 'listSavedSearches' | 'createSavedSearch' | 'updateSavedSearch' | 'deleteSavedSearch' | 'getAIConfig' | 'updateAIConfig' | 'getJob' | 'cancelJob' | 'listAssets' | 'getAsset' | 'startAssetTextExtraction' | 'getAssetTextExtraction' | 'retryAssetTextExtraction' | 'patchAsset' | 'getAssetAI' | 'analyzeAsset' | 'moderateAsset' | 'getTranscript' | 'transcribeAsset' | 'smartCropAsset' | 'removeAssetBackground' | 'listAssetVersions' | 'createAssetBranch' | 'restoreAssetVersion' | 'promoteAssetBranch' | 'deleteAsset' | 'replaceAsset' | 'createSignedAssetUrl' | 'createSignedTransformUrl' | 'setAssetTags' | 'patchAssetMetadata' | 'purgeAsset' | 'widgetCreateUploadSession' | 'widgetGetUploadSession' | 'widgetUploadPart' | 'widgetCompleteUploadSession' | 'widgetCancelUploadSession' | 'widgetIngestRemoteUrl';
2
+ export type AssetAPIScope = 'assets:read' | 'assets:write' | 'assets:process' | 'assets:generate' | 'assets:publish' | 'assets:admin' | 'assets:any';
3
3
  export interface AssetContractOperation {
4
4
  readonly id: AssetOperationId;
5
5
  readonly method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
@@ -56,6 +56,91 @@ export declare const assetContractOperations: readonly [{
56
56
  readonly method: "DELETE";
57
57
  readonly path: "/api/v1/assets/buckets/{bucketID}";
58
58
  readonly scope: "assets:admin";
59
+ }, {
60
+ readonly id: "configureBucketStorage";
61
+ readonly method: "PUT";
62
+ readonly path: "/api/v1/assets/buckets/{bucketID}/storage";
63
+ readonly scope: "assets:write";
64
+ }, {
65
+ readonly id: "startBucketRelocation";
66
+ readonly method: "POST";
67
+ readonly path: "/api/v1/assets/buckets/{bucketID}/relocations";
68
+ readonly scope: "assets:process";
69
+ }, {
70
+ readonly id: "createAssetConnection";
71
+ readonly method: "POST";
72
+ readonly path: "/api/v1/assets/connections";
73
+ readonly scope: "assets:admin";
74
+ }, {
75
+ readonly id: "listAssetConnections";
76
+ readonly method: "GET";
77
+ readonly path: "/api/v1/assets/connections";
78
+ readonly scope: "assets:read";
79
+ }, {
80
+ readonly id: "getAssetConnection";
81
+ readonly method: "GET";
82
+ readonly path: "/api/v1/assets/connections/{connectionID}";
83
+ readonly scope: "assets:read";
84
+ }, {
85
+ readonly id: "updateAssetConnection";
86
+ readonly method: "PATCH";
87
+ readonly path: "/api/v1/assets/connections/{connectionID}";
88
+ readonly scope: "assets:admin";
89
+ }, {
90
+ readonly id: "verifyAssetConnection";
91
+ readonly method: "POST";
92
+ readonly path: "/api/v1/assets/connections/{connectionID}/verify";
93
+ readonly scope: "assets:admin";
94
+ }, {
95
+ readonly id: "deleteAssetConnection";
96
+ readonly method: "DELETE";
97
+ readonly path: "/api/v1/assets/connections/{connectionID}";
98
+ readonly scope: "assets:admin";
99
+ }, {
100
+ readonly id: "listOwnedS2Buckets";
101
+ readonly method: "GET";
102
+ readonly path: "/api/v1/assets/s2-buckets";
103
+ readonly scope: "assets:read";
104
+ }, {
105
+ readonly id: "createOwnedS2Bucket";
106
+ readonly method: "POST";
107
+ readonly path: "/api/v1/assets/s2-buckets";
108
+ readonly scope: "assets:admin";
109
+ }, {
110
+ readonly id: "startAssetMigration";
111
+ readonly method: "POST";
112
+ readonly path: "/api/v1/assets/migrations";
113
+ readonly scope: "assets:process";
114
+ }, {
115
+ readonly id: "listAssetMigrations";
116
+ readonly method: "GET";
117
+ readonly path: "/api/v1/assets/migrations";
118
+ readonly scope: "assets:read";
119
+ }, {
120
+ readonly id: "getAssetMigration";
121
+ readonly method: "GET";
122
+ readonly path: "/api/v1/assets/migrations/{migrationID}";
123
+ readonly scope: "assets:read";
124
+ }, {
125
+ readonly id: "cancelAssetMigration";
126
+ readonly method: "POST";
127
+ readonly path: "/api/v1/assets/migrations/{migrationID}/cancel";
128
+ readonly scope: "assets:process";
129
+ }, {
130
+ readonly id: "retryAssetMigrationItem";
131
+ readonly method: "POST";
132
+ readonly path: "/api/v1/assets/migrations/{migrationID}/items/{itemID}/retry";
133
+ readonly scope: "assets:process";
134
+ }, {
135
+ readonly id: "downloadAssetMigrationReport";
136
+ readonly method: "GET";
137
+ readonly path: "/api/v1/assets/migrations/{migrationID}/report";
138
+ readonly scope: "assets:read";
139
+ }, {
140
+ readonly id: "createAssetUploadCapability";
141
+ readonly method: "POST";
142
+ readonly path: "/api/v1/assets/upload-capabilities";
143
+ readonly scope: "assets:write";
59
144
  }, {
60
145
  readonly id: "getContentPolicy";
61
146
  readonly method: "GET";
@@ -76,6 +161,141 @@ export declare const assetContractOperations: readonly [{
76
161
  readonly method: "GET";
77
162
  readonly path: "/api/v1/assets/transformations";
78
163
  readonly scope: "assets:read";
164
+ }, {
165
+ readonly id: "materializeAssetTransform";
166
+ readonly method: "POST";
167
+ readonly path: "/api/v1/assets/{assetID}/transforms";
168
+ readonly scope: "assets:process";
169
+ }, {
170
+ readonly id: "listAssetDerivatives";
171
+ readonly method: "GET";
172
+ readonly path: "/api/v1/assets/{assetID}/derivatives";
173
+ readonly scope: "assets:read";
174
+ }, {
175
+ readonly id: "generateAsset";
176
+ readonly method: "POST";
177
+ readonly path: "/api/v1/assets/generations";
178
+ readonly scope: "assets:generate";
179
+ }, {
180
+ readonly id: "getAssetAutomation";
181
+ readonly method: "GET";
182
+ readonly path: "/api/v1/assets/automation";
183
+ readonly scope: "assets:read";
184
+ }, {
185
+ readonly id: "assetMCP";
186
+ readonly method: "POST";
187
+ readonly path: "/api/v1/assets/mcp";
188
+ readonly scope: "assets:any";
189
+ }, {
190
+ readonly id: "getAssetWorkflowCatalog";
191
+ readonly method: "GET";
192
+ readonly path: "/api/v1/assets/workflows/catalog";
193
+ readonly scope: "assets:read";
194
+ }, {
195
+ readonly id: "listAssetWorkflows";
196
+ readonly method: "GET";
197
+ readonly path: "/api/v1/assets/workflows";
198
+ readonly scope: "assets:read";
199
+ }, {
200
+ readonly id: "createAssetWorkflow";
201
+ readonly method: "POST";
202
+ readonly path: "/api/v1/assets/workflows";
203
+ readonly scope: "assets:write";
204
+ }, {
205
+ readonly id: "getAssetWorkflow";
206
+ readonly method: "GET";
207
+ readonly path: "/api/v1/assets/workflows/{workflowId}";
208
+ readonly scope: "assets:read";
209
+ }, {
210
+ readonly id: "updateAssetWorkflowDraft";
211
+ readonly method: "PUT";
212
+ readonly path: "/api/v1/assets/workflows/{workflowId}/draft";
213
+ readonly scope: "assets:write";
214
+ }, {
215
+ readonly id: "validateAssetWorkflow";
216
+ readonly method: "POST";
217
+ readonly path: "/api/v1/assets/workflows/{workflowId}/validate";
218
+ readonly scope: "assets:write";
219
+ }, {
220
+ readonly id: "publishAssetWorkflow";
221
+ readonly method: "POST";
222
+ readonly path: "/api/v1/assets/workflows/{workflowId}/publish";
223
+ readonly scope: "assets:publish";
224
+ }, {
225
+ readonly id: "activateAssetWorkflow";
226
+ readonly method: "POST";
227
+ readonly path: "/api/v1/assets/workflows/{workflowId}/activate";
228
+ readonly scope: "assets:publish";
229
+ }, {
230
+ readonly id: "startAssetWorkflowRun";
231
+ readonly method: "POST";
232
+ readonly path: "/api/v1/assets/workflows/{workflowId}/run";
233
+ readonly scope: "assets:write";
234
+ }, {
235
+ readonly id: "listAssetWorkflowVersions";
236
+ readonly method: "GET";
237
+ readonly path: "/api/v1/assets/workflows/{workflowId}/versions";
238
+ readonly scope: "assets:read";
239
+ }, {
240
+ readonly id: "listAssetWorkflowRuns";
241
+ readonly method: "GET";
242
+ readonly path: "/api/v1/assets/workflows/{workflowId}/runs";
243
+ readonly scope: "assets:read";
244
+ }, {
245
+ readonly id: "getAssetWorkflowRun";
246
+ readonly method: "GET";
247
+ readonly path: "/api/v1/assets/workflows/runs/{runId}";
248
+ readonly scope: "assets:read";
249
+ }, {
250
+ readonly id: "cancelAssetWorkflowRun";
251
+ readonly method: "POST";
252
+ readonly path: "/api/v1/assets/workflows/runs/{runId}/cancel";
253
+ readonly scope: "assets:write";
254
+ }, {
255
+ readonly id: "retryAssetWorkflowRun";
256
+ readonly method: "POST";
257
+ readonly path: "/api/v1/assets/workflows/runs/{runId}/retry";
258
+ readonly scope: "assets:write";
259
+ }, {
260
+ readonly id: "listAssetWorkflowApprovals";
261
+ readonly method: "GET";
262
+ readonly path: "/api/v1/assets/workflows/approvals";
263
+ readonly scope: "assets:read";
264
+ }, {
265
+ readonly id: "approveAssetWorkflow";
266
+ readonly method: "POST";
267
+ readonly path: "/api/v1/assets/workflows/approvals/{approvalId}/approve";
268
+ readonly scope: "assets:publish";
269
+ }, {
270
+ readonly id: "rejectAssetWorkflow";
271
+ readonly method: "POST";
272
+ readonly path: "/api/v1/assets/workflows/approvals/{approvalId}/reject";
273
+ readonly scope: "assets:publish";
274
+ }, {
275
+ readonly id: "listAssetWorkflowConnections";
276
+ readonly method: "GET";
277
+ readonly path: "/api/v1/assets/workflows/connections";
278
+ readonly scope: "assets:read";
279
+ }, {
280
+ readonly id: "createAssetWorkflowConnection";
281
+ readonly method: "POST";
282
+ readonly path: "/api/v1/assets/workflows/connections";
283
+ readonly scope: "assets:admin";
284
+ }, {
285
+ readonly id: "rotateAssetWorkflowConnectionCredential";
286
+ readonly method: "POST";
287
+ readonly path: "/api/v1/assets/workflows/connections/{connectionId}/credential/rotate";
288
+ readonly scope: "assets:admin";
289
+ }, {
290
+ readonly id: "rotateAssetWorkflowInboundHook";
291
+ readonly method: "POST";
292
+ readonly path: "/api/v1/assets/workflows/{workflowId}/inbound-hook/rotate";
293
+ readonly scope: "assets:write";
294
+ }, {
295
+ readonly id: "receiveAssetWorkflowInboundHook";
296
+ readonly method: "POST";
297
+ readonly path: "/api/v1/assets/workflow-hooks/{token}";
298
+ readonly scope: "assets:any";
79
299
  }, {
80
300
  readonly id: "deleteTransformation";
81
301
  readonly method: "DELETE";
@@ -231,6 +451,21 @@ export declare const assetContractOperations: readonly [{
231
451
  readonly method: "GET";
232
452
  readonly path: "/api/v1/assets/{assetID}";
233
453
  readonly scope: "assets:read";
454
+ }, {
455
+ readonly id: "startAssetTextExtraction";
456
+ readonly method: "POST";
457
+ readonly path: "/api/v1/assets/{assetID}/text-extraction";
458
+ readonly scope: "assets:process";
459
+ }, {
460
+ readonly id: "getAssetTextExtraction";
461
+ readonly method: "GET";
462
+ readonly path: "/api/v1/assets/{assetID}/text-extraction";
463
+ readonly scope: "assets:read";
464
+ }, {
465
+ readonly id: "retryAssetTextExtraction";
466
+ readonly method: "POST";
467
+ readonly path: "/api/v1/assets/text-extractions/{extractionID}/retry";
468
+ readonly scope: "assets:process";
234
469
  }, {
235
470
  readonly id: "patchAsset";
236
471
  readonly method: "PATCH";
@@ -326,4 +561,34 @@ export declare const assetContractOperations: readonly [{
326
561
  readonly method: "POST";
327
562
  readonly path: "/api/v1/assets/{assetID}/purge";
328
563
  readonly scope: "assets:admin";
564
+ }, {
565
+ readonly id: "widgetCreateUploadSession";
566
+ readonly method: "POST";
567
+ readonly path: "/assets/widget/sessions";
568
+ readonly scope: "assets:write";
569
+ }, {
570
+ readonly id: "widgetGetUploadSession";
571
+ readonly method: "GET";
572
+ readonly path: "/assets/widget/sessions/current";
573
+ readonly scope: "assets:write";
574
+ }, {
575
+ readonly id: "widgetUploadPart";
576
+ readonly method: "PUT";
577
+ readonly path: "/assets/widget/uploads/{sessionToken}/parts/{partNumber}";
578
+ readonly scope: "assets:write";
579
+ }, {
580
+ readonly id: "widgetCompleteUploadSession";
581
+ readonly method: "POST";
582
+ readonly path: "/assets/widget/sessions/current/complete";
583
+ readonly scope: "assets:write";
584
+ }, {
585
+ readonly id: "widgetCancelUploadSession";
586
+ readonly method: "DELETE";
587
+ readonly path: "/assets/widget/sessions/current";
588
+ readonly scope: "assets:write";
589
+ }, {
590
+ readonly id: "widgetIngestRemoteUrl";
591
+ readonly method: "POST";
592
+ readonly path: "/assets/widget/remote-url";
593
+ readonly scope: "assets:write";
329
594
  }];
@@ -9,10 +9,54 @@ export const assetContractOperations = [
9
9
  { id: 'listBuckets', method: 'GET', path: '/api/v1/assets/buckets', scope: 'assets:read' },
10
10
  { id: 'updateBucket', method: 'PUT', path: '/api/v1/assets/buckets/{bucketID}', scope: 'assets:admin' },
11
11
  { id: 'deleteBucket', method: 'DELETE', path: '/api/v1/assets/buckets/{bucketID}', scope: 'assets:admin' },
12
+ { id: 'configureBucketStorage', method: 'PUT', path: '/api/v1/assets/buckets/{bucketID}/storage', scope: 'assets:write' },
13
+ { id: 'startBucketRelocation', method: 'POST', path: '/api/v1/assets/buckets/{bucketID}/relocations', scope: 'assets:process' },
14
+ { id: 'createAssetConnection', method: 'POST', path: '/api/v1/assets/connections', scope: 'assets:admin' },
15
+ { id: 'listAssetConnections', method: 'GET', path: '/api/v1/assets/connections', scope: 'assets:read' },
16
+ { id: 'getAssetConnection', method: 'GET', path: '/api/v1/assets/connections/{connectionID}', scope: 'assets:read' },
17
+ { id: 'updateAssetConnection', method: 'PATCH', path: '/api/v1/assets/connections/{connectionID}', scope: 'assets:admin' },
18
+ { id: 'verifyAssetConnection', method: 'POST', path: '/api/v1/assets/connections/{connectionID}/verify', scope: 'assets:admin' },
19
+ { id: 'deleteAssetConnection', method: 'DELETE', path: '/api/v1/assets/connections/{connectionID}', scope: 'assets:admin' },
20
+ { id: 'listOwnedS2Buckets', method: 'GET', path: '/api/v1/assets/s2-buckets', scope: 'assets:read' },
21
+ { id: 'createOwnedS2Bucket', method: 'POST', path: '/api/v1/assets/s2-buckets', scope: 'assets:admin' },
22
+ { id: 'startAssetMigration', method: 'POST', path: '/api/v1/assets/migrations', scope: 'assets:process' },
23
+ { id: 'listAssetMigrations', method: 'GET', path: '/api/v1/assets/migrations', scope: 'assets:read' },
24
+ { id: 'getAssetMigration', method: 'GET', path: '/api/v1/assets/migrations/{migrationID}', scope: 'assets:read' },
25
+ { id: 'cancelAssetMigration', method: 'POST', path: '/api/v1/assets/migrations/{migrationID}/cancel', scope: 'assets:process' },
26
+ { id: 'retryAssetMigrationItem', method: 'POST', path: '/api/v1/assets/migrations/{migrationID}/items/{itemID}/retry', scope: 'assets:process' },
27
+ { id: 'downloadAssetMigrationReport', method: 'GET', path: '/api/v1/assets/migrations/{migrationID}/report', scope: 'assets:read' },
28
+ { id: 'createAssetUploadCapability', method: 'POST', path: '/api/v1/assets/upload-capabilities', scope: 'assets:write' },
12
29
  { id: 'getContentPolicy', method: 'GET', path: '/api/v1/assets/policy', scope: 'assets:read' },
13
30
  { id: 'updateContentPolicy', method: 'PUT', path: '/api/v1/assets/policy', scope: 'assets:admin' },
14
31
  { id: 'upsertTransformation', method: 'POST', path: '/api/v1/assets/transformations', scope: 'assets:process' },
15
32
  { id: 'listTransformations', method: 'GET', path: '/api/v1/assets/transformations', scope: 'assets:read' },
33
+ { id: 'materializeAssetTransform', method: 'POST', path: '/api/v1/assets/{assetID}/transforms', scope: 'assets:process' },
34
+ { id: 'listAssetDerivatives', method: 'GET', path: '/api/v1/assets/{assetID}/derivatives', scope: 'assets:read' },
35
+ { id: 'generateAsset', method: 'POST', path: '/api/v1/assets/generations', scope: 'assets:generate' },
36
+ { id: 'getAssetAutomation', method: 'GET', path: '/api/v1/assets/automation', scope: 'assets:read' },
37
+ { id: 'assetMCP', method: 'POST', path: '/api/v1/assets/mcp', scope: 'assets:any' },
38
+ { id: 'getAssetWorkflowCatalog', method: 'GET', path: '/api/v1/assets/workflows/catalog', scope: 'assets:read' },
39
+ { id: 'listAssetWorkflows', method: 'GET', path: '/api/v1/assets/workflows', scope: 'assets:read' },
40
+ { id: 'createAssetWorkflow', method: 'POST', path: '/api/v1/assets/workflows', scope: 'assets:write' },
41
+ { id: 'getAssetWorkflow', method: 'GET', path: '/api/v1/assets/workflows/{workflowId}', scope: 'assets:read' },
42
+ { id: 'updateAssetWorkflowDraft', method: 'PUT', path: '/api/v1/assets/workflows/{workflowId}/draft', scope: 'assets:write' },
43
+ { id: 'validateAssetWorkflow', method: 'POST', path: '/api/v1/assets/workflows/{workflowId}/validate', scope: 'assets:write' },
44
+ { id: 'publishAssetWorkflow', method: 'POST', path: '/api/v1/assets/workflows/{workflowId}/publish', scope: 'assets:publish' },
45
+ { id: 'activateAssetWorkflow', method: 'POST', path: '/api/v1/assets/workflows/{workflowId}/activate', scope: 'assets:publish' },
46
+ { id: 'startAssetWorkflowRun', method: 'POST', path: '/api/v1/assets/workflows/{workflowId}/run', scope: 'assets:write' },
47
+ { id: 'listAssetWorkflowVersions', method: 'GET', path: '/api/v1/assets/workflows/{workflowId}/versions', scope: 'assets:read' },
48
+ { id: 'listAssetWorkflowRuns', method: 'GET', path: '/api/v1/assets/workflows/{workflowId}/runs', scope: 'assets:read' },
49
+ { id: 'getAssetWorkflowRun', method: 'GET', path: '/api/v1/assets/workflows/runs/{runId}', scope: 'assets:read' },
50
+ { id: 'cancelAssetWorkflowRun', method: 'POST', path: '/api/v1/assets/workflows/runs/{runId}/cancel', scope: 'assets:write' },
51
+ { id: 'retryAssetWorkflowRun', method: 'POST', path: '/api/v1/assets/workflows/runs/{runId}/retry', scope: 'assets:write' },
52
+ { id: 'listAssetWorkflowApprovals', method: 'GET', path: '/api/v1/assets/workflows/approvals', scope: 'assets:read' },
53
+ { id: 'approveAssetWorkflow', method: 'POST', path: '/api/v1/assets/workflows/approvals/{approvalId}/approve', scope: 'assets:publish' },
54
+ { id: 'rejectAssetWorkflow', method: 'POST', path: '/api/v1/assets/workflows/approvals/{approvalId}/reject', scope: 'assets:publish' },
55
+ { id: 'listAssetWorkflowConnections', method: 'GET', path: '/api/v1/assets/workflows/connections', scope: 'assets:read' },
56
+ { id: 'createAssetWorkflowConnection', method: 'POST', path: '/api/v1/assets/workflows/connections', scope: 'assets:admin' },
57
+ { id: 'rotateAssetWorkflowConnectionCredential', method: 'POST', path: '/api/v1/assets/workflows/connections/{connectionId}/credential/rotate', scope: 'assets:admin' },
58
+ { id: 'rotateAssetWorkflowInboundHook', method: 'POST', path: '/api/v1/assets/workflows/{workflowId}/inbound-hook/rotate', scope: 'assets:write' },
59
+ { id: 'receiveAssetWorkflowInboundHook', method: 'POST', path: '/api/v1/assets/workflow-hooks/{token}', scope: 'assets:any' },
16
60
  { id: 'deleteTransformation', method: 'DELETE', path: '/api/v1/assets/transformations/{name}', scope: 'assets:process' },
17
61
  { id: 'createLifecycleRule', method: 'POST', path: '/api/v1/assets/lifecycle-rules', scope: 'assets:admin' },
18
62
  { id: 'listLifecycleRules', method: 'GET', path: '/api/v1/assets/lifecycle-rules', scope: 'assets:read' },
@@ -44,6 +88,9 @@ export const assetContractOperations = [
44
88
  { id: 'cancelJob', method: 'POST', path: '/api/v1/assets/jobs/{jobID}/cancel', scope: 'assets:process' },
45
89
  { id: 'listAssets', method: 'GET', path: '/api/v1/assets', scope: 'assets:read' },
46
90
  { id: 'getAsset', method: 'GET', path: '/api/v1/assets/{assetID}', scope: 'assets:read' },
91
+ { id: 'startAssetTextExtraction', method: 'POST', path: '/api/v1/assets/{assetID}/text-extraction', scope: 'assets:process' },
92
+ { id: 'getAssetTextExtraction', method: 'GET', path: '/api/v1/assets/{assetID}/text-extraction', scope: 'assets:read' },
93
+ { id: 'retryAssetTextExtraction', method: 'POST', path: '/api/v1/assets/text-extractions/{extractionID}/retry', scope: 'assets:process' },
47
94
  { id: 'patchAsset', method: 'PATCH', path: '/api/v1/assets/{assetID}', scope: 'assets:write' },
48
95
  { id: 'getAssetAI', method: 'GET', path: '/api/v1/assets/{assetID}/ai', scope: 'assets:read' },
49
96
  { id: 'analyzeAsset', method: 'POST', path: '/api/v1/assets/{assetID}/ai/analyze', scope: 'assets:process' },
@@ -63,4 +110,10 @@ export const assetContractOperations = [
63
110
  { id: 'setAssetTags', method: 'PUT', path: '/api/v1/assets/{assetID}/tags', scope: 'assets:write' },
64
111
  { id: 'patchAssetMetadata', method: 'PATCH', path: '/api/v1/assets/{assetID}/metadata', scope: 'assets:write' },
65
112
  { id: 'purgeAsset', method: 'POST', path: '/api/v1/assets/{assetID}/purge', scope: 'assets:admin' },
113
+ { id: 'widgetCreateUploadSession', method: 'POST', path: '/assets/widget/sessions', scope: 'assets:write' },
114
+ { id: 'widgetGetUploadSession', method: 'GET', path: '/assets/widget/sessions/current', scope: 'assets:write' },
115
+ { id: 'widgetUploadPart', method: 'PUT', path: '/assets/widget/uploads/{sessionToken}/parts/{partNumber}', scope: 'assets:write' },
116
+ { id: 'widgetCompleteUploadSession', method: 'POST', path: '/assets/widget/sessions/current/complete', scope: 'assets:write' },
117
+ { id: 'widgetCancelUploadSession', method: 'DELETE', path: '/assets/widget/sessions/current', scope: 'assets:write' },
118
+ { id: 'widgetIngestRemoteUrl', method: 'POST', path: '/assets/widget/remote-url', scope: 'assets:write' },
66
119
  ];
package/dist/index.d.ts CHANGED
@@ -1,15 +1,27 @@
1
1
  export { StackShift, StackShiftAPIError } from './client.js';
2
2
  export { AssetsClient, assetTransformOptions, assetTransformPresets, assetTransformSpec, getAssetTransformPreset } from './assets.js';
3
+ export { AssetWorkflowsClient } from './asset-workflows.js';
4
+ export type * from './asset-workflows.js';
5
+ export type * from './asset-media-v2.js';
6
+ export { AssetConnectionsClient, AssetMigrationsClient, AssetStorageClient, AssetTextClient, AssetUploadCapabilitiesClient } from './assets-platform.js';
7
+ export type * from './assets-platform-types.js';
8
+ export { ChunkedUploadController, UploadResumeInvalidError, putBlob, sha256Blob } from './upload-controller.js';
9
+ export type { ChunkUploadCallbacks, ChunkUploadRequest, ChunkUploadSession, ChunkUploadTransport, ChunkedUploadOptions, UploadProgress, UploadResumeRecord, UploadResumeStore, UploadedPart } from './upload-controller.js';
3
10
  export { createResponsiveImage, namedResponsiveSource, uploadBrowserFile } from './assets-framework.js';
4
11
  export type { ArtDirectionSource, ResponsiveImageDescriptor, ResponsiveImageOptions } from './assets-framework.js';
5
12
  export { assetContractOperations } from './generated/assets-contract.js';
6
13
  export type { AssetAPIScope, AssetContractOperation, AssetOperationId } from './generated/assets-contract.js';
7
- export { MailBouncesClient, MailClient, MailDomainsClient, MailEventsClient, MailLimitsClient, MailMessagesClient, MailScheduledClient, MailBatchClient, MailInboundClient, MailAnalyticsClient, MailOtpChallengesClient, MailOtpClient, MailReputationClient, MailReputationEventsClient, MailSuppressionsClient, MailTemplatesClient, MailWebhooksClient, } from './mail.js';
14
+ export { MailBouncesClient, MailClient, MailDomainsClient, MailEventsClient, MailLimitsClient, MailMessagesClient, MailScheduledClient, MailBatchClient, MailInboundClient, MailAnalyticsClient, MailOtpChallengesClient, MailOtpClient, MailReputationClient, MailReputationEventsClient, MailSuppressionsClient, MailTemplatesClient, MailWebhooksClient, MailStreamsClient, MailAudiencesClient, MailCampaignsClient, } from './mail.js';
15
+ export type { MailAudience, MailAudienceMember, MailAudienceMemberImport, MailCampaign } from './mail-campaigns.js';
16
+ export { MailExportsClient } from './mail-exports.js';
17
+ export type { MailExport, MailExportCreateInput } from './mail-exports.js';
18
+ export type { MailDiagnosticFinding, MailTemplateDiagnosticInput, MailTemplateDiagnosticResult } from './mail-diagnostics.js';
8
19
  export { ProjectsClient } from './projects.js';
9
- export type { Asset, AssetAIAnnotation, AssetAIInfo, AssetCollection, AssetListOptions, AssetListResult, AssetModerationResult, AssetSavedSearch, AssetSignedUploadUrl, AssetSignedUploadUrlOptions, AssetSignedUrl, AssetSignedUrlOptions, AssetTranscript, AssetTransformOptions, AssetTransformPreset, AssetTransformPresetCategory, AssetUploadOptions, AssetVisibility, AssetVersion, JsonValue, MailAddress, MailAddressInput, MailDnsRecord, MailDomain, MailDomainListResult, MailDomainStatus, MailIdempotencyStatus, MailLog, MailMessage, MailMessageListOptions, MailMessageListResult, MailMessageSummary, MailRecordStatus, MailSendAttempt, MailSendInput, MailSendResponse, MailStatus, Project, ProjectListOptions, StackShiftOptions, } from './types.js';
10
- export type { MailBounce, MailBounceListOptions, MailBounceListResult, MailBounceType, MailSuppression, MailSuppressionCreateInput, MailSuppressionListOptions, MailSuppressionListResult, MailSuppressionReason, MailSuppressionSource, } from './mail-phase4-types.js';
20
+ export type { Asset, AssetAIAnnotation, AssetAIInfo, AssetCollection, AssetListOptions, AssetListResult, AssetModerationResult, AssetSavedSearch, AssetSignedUploadUrl, AssetSignedUploadUrlOptions, AssetSignedUrl, AssetSignedUrlOptions, AssetTranscript, AssetTransformOptions, AssetTransformPreset, AssetTransformPresetCategory, AssetUploadOptions, AssetVisibility, AssetVersion, JsonValue, MailAddress, MailAddressInput, MailDnsRecord, MailDomain, MailDomainListResult, MailDomainStatus, MailIdempotencyStatus, MailLog, MailMessage, MailMessageListOptions, MailMessageListResult, MailMessageSummary, MailRecordStatus, MailSendAttempt, MailSendInput, MailSendResponse, MailStatus, MailRecipient, MailRecipientStatus, MailRecipientSummary, Project, ProjectListOptions, StackShiftOptions, } from './types.js';
21
+ export type { MailBounce, MailBounceListOptions, MailBounceListResult, MailBounceType, MailSuppression, MailSuppressionCreateInput, MailSuppressionListOptions, MailSuppressionListResult, MailSuppressionReason, MailSuppressionSource, } from './mail-delivery-types.js';
11
22
  export type { MailOtpChallenge, MailOtpChallengeListOptions, MailOtpChallengeListResult, MailOtpSendInput, MailOtpSendResponse, MailOtpStatus, MailOtpVerifyInput, MailOtpVerifyResponse, } from './mail-otp-types.js';
12
23
  export type { MailSendTemplateInput, MailSendTemplateResponse, MailTemplate, MailTemplateCreateInput, MailTemplateDetail, MailTemplateListOptions, MailTemplateListResult, MailTemplatePreview, MailTemplatePreviewInput, MailTemplateStatus, MailTemplateTestSendInput, MailTemplateTestSendResponse, MailTemplateUpdateInput, MailTemplateVersion, } from './mail-template-types.js';
13
- export type { MailEvent, MailEventListOptions, MailEventListResult, MailEventType, MailTimelineItem, MailWebhook, MailWebhookCreateInput, MailWebhookCreateResponse, MailWebhookDelivery, MailWebhookDeliveryAttempt, MailWebhookDeliveryDetail, MailWebhookDeliveryListOptions, MailWebhookListOptions, MailWebhookListResult, MailWebhookUpdateInput, } from './mail-webhook-types.js';
24
+ export type { MailEvent, MailEventListOptions, MailEventListResult, MailEventType, MailTimelineItem, MailWebhook, MailWebhookCreateInput, MailWebhookCreateResponse, MailWebhookDelivery, MailWebhookDeliveryAttempt, MailWebhookDeliveryDetail, MailWebhookDeliveryListOptions, MailWebhookListOptions, MailWebhookListResult, MailWebhookUpdateInput, MailWebhookReplay, MailWebhookReplayInput, } from './mail-webhook-types.js';
25
+ export type { MailMessageStream, MailMessageStreamCreateInput, MailMessageStreamListResult } from './mail-streams.js';
14
26
  export type { MailDomainReputation, MailLimits, MailManualReviewStatus, MailReputation, MailReputationEvent, MailReputationEventListOptions, MailReputationEventListResult, MailReputationEventSeverity, MailReputationStatus, MailReputationTier, MailReputationWorkspace, } from './mail-reputation-types.js';
15
- export type { MailAnalytics, MailAnalyticsInput, MailAttachmentInput, MailBatch, MailBatchSendInput, MailBatchTemplateInput, MailInboundDomain, MailInboundMessage, MailScheduledCreateInput, MailScheduledMessage, } from './mail-advanced-types.js';
27
+ export type { MailAnalytics, MailAnalyticsInput, MailAttachmentInput, MailBatch, MailBatchItem, MailBatchSendInput, MailBatchTemplateInput, MailInboundDomain, MailInboundMessage, MailScheduledCreateInput, MailScheduledMessage, } from './mail-advanced-types.js';
package/dist/index.js CHANGED
@@ -1,6 +1,10 @@
1
1
  export { StackShift, StackShiftAPIError } from './client.js';
2
2
  export { AssetsClient, assetTransformOptions, assetTransformPresets, assetTransformSpec, getAssetTransformPreset } from './assets.js';
3
+ export { AssetWorkflowsClient } from './asset-workflows.js';
4
+ export { AssetConnectionsClient, AssetMigrationsClient, AssetStorageClient, AssetTextClient, AssetUploadCapabilitiesClient } from './assets-platform.js';
5
+ export { ChunkedUploadController, UploadResumeInvalidError, putBlob, sha256Blob } from './upload-controller.js';
3
6
  export { createResponsiveImage, namedResponsiveSource, uploadBrowserFile } from './assets-framework.js';
4
7
  export { assetContractOperations } from './generated/assets-contract.js';
5
- export { MailBouncesClient, MailClient, MailDomainsClient, MailEventsClient, MailLimitsClient, MailMessagesClient, MailScheduledClient, MailBatchClient, MailInboundClient, MailAnalyticsClient, MailOtpChallengesClient, MailOtpClient, MailReputationClient, MailReputationEventsClient, MailSuppressionsClient, MailTemplatesClient, MailWebhooksClient, } from './mail.js';
8
+ export { MailBouncesClient, MailClient, MailDomainsClient, MailEventsClient, MailLimitsClient, MailMessagesClient, MailScheduledClient, MailBatchClient, MailInboundClient, MailAnalyticsClient, MailOtpChallengesClient, MailOtpClient, MailReputationClient, MailReputationEventsClient, MailSuppressionsClient, MailTemplatesClient, MailWebhooksClient, MailStreamsClient, MailAudiencesClient, MailCampaignsClient, } from './mail.js';
9
+ export { MailExportsClient } from './mail-exports.js';
6
10
  export { ProjectsClient } from './projects.js';
@@ -1,10 +1,12 @@
1
- import type { JsonValue, MailAddress, MailAddressInput, MailSendInput, MailSendResponse } from './types.js';
1
+ import type { JsonValue, MailAddress, MailAddressInput, MailRecipient, MailSendInput, MailSendResponse } from './types.js';
2
2
  import type { MailSendTemplateInput } from './mail-template-types.js';
3
3
  export interface MailAttachmentInput {
4
4
  assetId?: string;
5
5
  uploadId?: string;
6
6
  filename: string;
7
7
  contentType?: string;
8
+ disposition?: 'attachment' | 'inline';
9
+ contentId?: string;
8
10
  }
9
11
  export interface MailScheduledCreateInput {
10
12
  sendAt: string;
@@ -16,15 +18,18 @@ export interface MailScheduledCreateInput {
16
18
  data?: Record<string, JsonValue>;
17
19
  idempotencyKey?: string;
18
20
  attachments?: MailAttachmentInput[];
21
+ headers?: Record<string, string>;
22
+ tags?: Record<string, string>;
23
+ stream?: string;
19
24
  }
20
25
  export interface MailScheduledMessage {
21
26
  id: string;
22
- status: 'scheduled' | 'queued' | 'sent' | 'canceled' | 'failed';
27
+ status: 'scheduled' | 'queued' | 'dispatched' | 'canceled' | 'failed';
23
28
  sendAt: string;
24
29
  messageId?: string | null;
25
30
  createdAt?: string;
26
31
  canceledAt?: string | null;
27
- sentAt?: string | null;
32
+ dispatchedAt?: string | null;
28
33
  }
29
34
  export interface MailBatchSendInput {
30
35
  from: string | MailAddress;
@@ -39,11 +44,28 @@ export interface MailBatchTemplateInput {
39
44
  data?: Record<string, JsonValue>;
40
45
  idempotencyKey?: string;
41
46
  }>;
47
+ headers?: Record<string, string>;
48
+ tags?: Record<string, string>;
49
+ stream?: string;
42
50
  }
43
51
  export interface MailBatch {
44
52
  id: string;
45
53
  status: 'queued' | 'processing' | 'completed' | 'failed';
46
54
  messageCount: number;
55
+ queuedCount: number;
56
+ acceptedCount: number;
57
+ failedCount: number;
58
+ suppressedCount: number;
59
+ }
60
+ export interface MailBatchItem {
61
+ id: string;
62
+ batchId: string;
63
+ messageId?: string | null;
64
+ recipientEmail: string;
65
+ status: 'queued' | 'sending' | 'accepted' | 'failed' | 'suppressed';
66
+ errorCode?: string | null;
67
+ errorMessage?: string | null;
68
+ recipients: MailRecipient[];
47
69
  }
48
70
  export interface MailInboundDomain {
49
71
  id: string;
@@ -1,5 +1,5 @@
1
1
  import type { StackShift } from './client.js';
2
- import type { MailAnalytics, MailAnalyticsInput, MailBatch, MailBatchSendInput, MailBatchTemplateInput, MailInboundDomain, MailInboundMessage, MailScheduledCreateInput, MailScheduledMessage } from './mail-advanced-types.js';
2
+ import type { MailAnalytics, MailAnalyticsInput, MailBatch, MailBatchItem, MailBatchSendInput, MailBatchTemplateInput, MailInboundDomain, MailInboundMessage, MailScheduledCreateInput, MailScheduledMessage } from './mail-advanced-types.js';
3
3
  export declare class MailScheduledClient {
4
4
  private readonly client;
5
5
  constructor(client: StackShift);
@@ -15,6 +15,13 @@ export declare class MailBatchClient {
15
15
  constructor(client: StackShift);
16
16
  send(input: MailBatchSendInput): Promise<MailBatch>;
17
17
  sendTemplate(input: MailBatchTemplateInput): Promise<MailBatch>;
18
+ list(): Promise<{
19
+ data: MailBatch[];
20
+ }>;
21
+ get(id: string): Promise<MailBatch>;
22
+ items(id: string): Promise<{
23
+ data: MailBatchItem[];
24
+ }>;
18
25
  }
19
26
  export declare class MailInboundClient {
20
27
  readonly domains: MailInboundDomainsClient;
@@ -27,6 +27,15 @@ export class MailBatchClient {
27
27
  sendTemplate(input) {
28
28
  return this.client.mailRequest('/mail/batch-template', { method: 'POST', body: input });
29
29
  }
30
+ list() {
31
+ return this.client.mailRequest('/mail/batches');
32
+ }
33
+ get(id) {
34
+ return this.client.mailRequest(`/mail/batches/${encodeURIComponent(id)}`);
35
+ }
36
+ items(id) {
37
+ return this.client.mailRequest(`/mail/batches/${encodeURIComponent(id)}/items`);
38
+ }
30
39
  }
31
40
  export class MailInboundClient {
32
41
  domains;