@stackshift-cloud/sdk 1.2.0 → 1.3.1
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/README.md +21 -0
- package/dist/ai-credits.d.ts +78 -0
- package/dist/ai-credits.js +15 -0
- package/dist/assets-dam-types.d.ts +35 -1
- package/dist/assets-dam.d.ts +11 -1
- package/dist/assets-dam.js +5 -0
- package/dist/assets-platform-types.d.ts +19 -2
- package/dist/client.d.ts +2 -0
- package/dist/client.js +3 -0
- package/dist/generated/assets-contract.d.ts +286 -1
- package/dist/generated/assets-contract.js +57 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.js +3 -0
- package/dist/mail-advanced-types.d.ts +11 -0
- package/dist/mail-billing.d.ts +4 -0
- package/dist/mail-marketing.d.ts +9 -2
- package/dist/s2-upload.d.ts +22 -0
- package/dist/s2-upload.js +49 -0
- package/dist/s2.d.ts +34 -0
- package/dist/s2.js +31 -0
- package/dist/types.d.ts +12 -0
- package/dist/upload-controller.d.ts +2 -0
- package/dist/upload-controller.js +41 -18
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -34,6 +34,27 @@ Set your API key:
|
|
|
34
34
|
STACKSHIFT_API_KEY=sk_live_xxx
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
+
## AI credits
|
|
38
|
+
|
|
39
|
+
AI credits are account-scoped. Inspect the balance and usage, create a top-up checkout, or choose managed billing versus your own provider key:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { StackShift } from '@stackshift-cloud/sdk'
|
|
43
|
+
|
|
44
|
+
const stackshift = new StackShift()
|
|
45
|
+
const balance = await stackshift.aiCredits.balance()
|
|
46
|
+
const usage = await stackshift.aiCredits.usage({ product: 'assets', limit: 25 })
|
|
47
|
+
const quote = await stackshift.aiCredits.quote(1_000, 'USD')
|
|
48
|
+
const checkout = await stackshift.aiCredits.checkout({
|
|
49
|
+
quote_id: quote.id,
|
|
50
|
+
idempotency_key: crypto.randomUUID(),
|
|
51
|
+
provider: 'paystack',
|
|
52
|
+
})
|
|
53
|
+
await stackshift.aiCredits.setFunding('assets', 'managed')
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Keep account API keys and checkout creation on your server. An Assets space ID does not change which billing account these methods use.
|
|
57
|
+
|
|
37
58
|
## Send email
|
|
38
59
|
|
|
39
60
|
```ts
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { StackShift } from './client.js';
|
|
2
|
+
export interface AICreditGrant {
|
|
3
|
+
id: string;
|
|
4
|
+
kind: string;
|
|
5
|
+
source: string;
|
|
6
|
+
policy_revision: number;
|
|
7
|
+
amount_microcredits: number;
|
|
8
|
+
remaining_microcredits: number;
|
|
9
|
+
available_at: string;
|
|
10
|
+
expires_at: string | null;
|
|
11
|
+
}
|
|
12
|
+
export interface AICreditBalance {
|
|
13
|
+
available_microcredits: number;
|
|
14
|
+
monthly_microcredits: number;
|
|
15
|
+
purchased_microcredits: number;
|
|
16
|
+
reserved_microcredits: number;
|
|
17
|
+
shortfall_microcredits: number;
|
|
18
|
+
next_reset: string;
|
|
19
|
+
grants: AICreditGrant[];
|
|
20
|
+
}
|
|
21
|
+
export interface AICreditUsage {
|
|
22
|
+
id: string;
|
|
23
|
+
operation_key: string;
|
|
24
|
+
product: string;
|
|
25
|
+
feature: string;
|
|
26
|
+
user_id: string;
|
|
27
|
+
project_id?: string;
|
|
28
|
+
space_id?: string;
|
|
29
|
+
parent_task_id?: string;
|
|
30
|
+
funding_mode: string;
|
|
31
|
+
state: string;
|
|
32
|
+
created_at: string;
|
|
33
|
+
reserved_microcredits: number;
|
|
34
|
+
used_microcredits: number;
|
|
35
|
+
returned_microcredits: number;
|
|
36
|
+
}
|
|
37
|
+
export interface AICreditUsagePage {
|
|
38
|
+
items: AICreditUsage[];
|
|
39
|
+
totals_microcredits: Record<string, number>;
|
|
40
|
+
}
|
|
41
|
+
export interface AICreditQuote {
|
|
42
|
+
id: string;
|
|
43
|
+
catalog_revision: number;
|
|
44
|
+
credit_microcredits: number;
|
|
45
|
+
amount_minor: number;
|
|
46
|
+
currency: string;
|
|
47
|
+
expires_at: string;
|
|
48
|
+
}
|
|
49
|
+
export interface AICreditCheckout {
|
|
50
|
+
reference: string;
|
|
51
|
+
status: string;
|
|
52
|
+
authorization_url?: string;
|
|
53
|
+
}
|
|
54
|
+
export type AIFundingPreferences = Record<'assets' | 'agents' | 'workflows', 'managed' | 'byok'>;
|
|
55
|
+
export declare class AICreditsClient {
|
|
56
|
+
private readonly client;
|
|
57
|
+
constructor(client: StackShift);
|
|
58
|
+
balance(): Promise<AICreditBalance>;
|
|
59
|
+
usage(filters?: {
|
|
60
|
+
product?: string;
|
|
61
|
+
user?: string;
|
|
62
|
+
project?: string;
|
|
63
|
+
space?: string;
|
|
64
|
+
from?: string;
|
|
65
|
+
until?: string;
|
|
66
|
+
before_time?: string;
|
|
67
|
+
before_id?: string;
|
|
68
|
+
limit?: number;
|
|
69
|
+
}): Promise<AICreditUsagePage>;
|
|
70
|
+
quote(credits: number, currency: 'USD' | 'NGN'): Promise<AICreditQuote>;
|
|
71
|
+
checkout(input: {
|
|
72
|
+
quote_id: string;
|
|
73
|
+
idempotency_key: string;
|
|
74
|
+
provider: string;
|
|
75
|
+
}): Promise<AICreditCheckout>;
|
|
76
|
+
funding(): Promise<AIFundingPreferences>;
|
|
77
|
+
setFunding(product: 'assets' | 'agents' | 'workflows', mode: 'managed' | 'byok'): Promise<AIFundingPreferences>;
|
|
78
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export class AICreditsClient {
|
|
2
|
+
client;
|
|
3
|
+
constructor(client) {
|
|
4
|
+
this.client = client;
|
|
5
|
+
}
|
|
6
|
+
balance() { return this.client.request('/billing/ai-credits', { method: 'GET' }); }
|
|
7
|
+
usage(filters = {}) {
|
|
8
|
+
const query = new URLSearchParams(Object.entries(filters).filter(([, v]) => v !== undefined).map(([k, v]) => [k, String(v)]));
|
|
9
|
+
return this.client.request(`/billing/ai-credits/usage?${query}`, { method: 'GET' });
|
|
10
|
+
}
|
|
11
|
+
quote(credits, currency) { return this.client.request('/billing/ai-credits/top-ups/quote', { method: 'POST', body: { credits, currency } }); }
|
|
12
|
+
checkout(input) { return this.client.request('/billing/ai-credits/top-ups/checkout', { method: 'POST', body: input }); }
|
|
13
|
+
funding() { return this.client.request('/billing/ai-credits/funding', { method: 'GET' }); }
|
|
14
|
+
setFunding(product, mode) { return this.client.request('/billing/ai-credits/funding', { method: 'PUT', body: { product, mode } }); }
|
|
15
|
+
}
|
|
@@ -129,6 +129,36 @@ export interface AssetModelPackage {
|
|
|
129
129
|
report: Record<string, unknown>;
|
|
130
130
|
updated_at: string;
|
|
131
131
|
}
|
|
132
|
+
export interface AssetModelTextureOverride {
|
|
133
|
+
texture_index: number;
|
|
134
|
+
asset_id: string;
|
|
135
|
+
version_id: string;
|
|
136
|
+
checksum_sha256: string;
|
|
137
|
+
}
|
|
138
|
+
export interface AssetModelVariant {
|
|
139
|
+
id: string;
|
|
140
|
+
asset_id: string;
|
|
141
|
+
source_version_id: string;
|
|
142
|
+
source_checksum_sha256: string;
|
|
143
|
+
name: string;
|
|
144
|
+
swatch: {
|
|
145
|
+
label: string;
|
|
146
|
+
color: string;
|
|
147
|
+
};
|
|
148
|
+
texture_overrides: AssetModelTextureOverride[];
|
|
149
|
+
revision: number;
|
|
150
|
+
}
|
|
151
|
+
export interface AssetModelVariantInput {
|
|
152
|
+
name: string;
|
|
153
|
+
source_version_id: string;
|
|
154
|
+
source_checksum_sha256: string;
|
|
155
|
+
swatch: {
|
|
156
|
+
label: string;
|
|
157
|
+
color: string;
|
|
158
|
+
};
|
|
159
|
+
texture_overrides: AssetModelTextureOverride[];
|
|
160
|
+
expected_revision?: number;
|
|
161
|
+
}
|
|
132
162
|
export interface AssetGalleryEntryInput {
|
|
133
163
|
publication_id: string;
|
|
134
164
|
fallback_publication_id?: string;
|
|
@@ -170,12 +200,14 @@ export interface AssetRenderRecipe {
|
|
|
170
200
|
background: string;
|
|
171
201
|
size: 512 | 1024;
|
|
172
202
|
}
|
|
173
|
-
export type AssetRenderOutput = 'proof' | 'poster' | 'spin' | 'turntable';
|
|
203
|
+
export type AssetRenderOutput = 'proof' | 'poster' | 'spin' | 'turntable' | 'model' | 'usdz';
|
|
174
204
|
export interface AssetRenderInput {
|
|
175
205
|
version_id: string;
|
|
176
206
|
source_checksum: string;
|
|
177
207
|
recipe: AssetRenderRecipe;
|
|
178
208
|
outputs: AssetRenderOutput[];
|
|
209
|
+
variant_id?: string;
|
|
210
|
+
variant_revision?: number;
|
|
179
211
|
}
|
|
180
212
|
export interface AssetRenderEstimate {
|
|
181
213
|
units: number;
|
|
@@ -197,6 +229,8 @@ export interface AssetRenderSet {
|
|
|
197
229
|
source_checksum: string;
|
|
198
230
|
recipe: AssetRenderRecipe;
|
|
199
231
|
requested: AssetRenderOutput[];
|
|
232
|
+
variant_id?: string;
|
|
233
|
+
variant_revision?: number;
|
|
200
234
|
status: 'queued' | 'processing' | 'ready' | 'failed';
|
|
201
235
|
can_retry: boolean;
|
|
202
236
|
units: number;
|
package/dist/assets-dam.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { StackShift } from './client.js';
|
|
2
2
|
import type { AssetJobSubmission } from './types.js';
|
|
3
3
|
import type { AssetRenderInput, AssetRenderEstimate, AssetRenderSubmission, AssetRenderingInfo } from './assets-dam-types.js';
|
|
4
|
-
import type { AssetAction, AssetSpaceAccess, AssetCollaborator, AssetMetadataSchema, AssetMetadataField, AssetBucketGovernance, AssetPublication, AssetPublicationInput, AssetPublicationStatus, AssetPublicationDelivery, AssetMediaReference, AssetPickerCapability, AssetPickerCapabilityInput, AssetModelPackage, AssetGallery, AssetGalleryEntryInput, AssetGalleryDelivery } from './assets-dam-types.js';
|
|
4
|
+
import type { AssetAction, AssetSpaceAccess, AssetCollaborator, AssetMetadataSchema, AssetMetadataField, AssetBucketGovernance, AssetPublication, AssetPublicationInput, AssetPublicationStatus, AssetPublicationDelivery, AssetMediaReference, AssetPickerCapability, AssetPickerCapabilityInput, AssetModelPackage, AssetModelVariant, AssetModelVariantInput, AssetGallery, AssetGalleryEntryInput, AssetGalleryDelivery } from './assets-dam-types.js';
|
|
5
5
|
export declare class AssetDAMClient {
|
|
6
6
|
private readonly client;
|
|
7
7
|
constructor(client: StackShift);
|
|
@@ -62,6 +62,10 @@ export declare class AssetDAMClient {
|
|
|
62
62
|
transitionPublication(id: string, revision: number, action: 'submit' | 'approve' | 'request-changes' | 'publish' | 'withdraw', note?: string): Promise<AssetPublication>;
|
|
63
63
|
resolvePublication(id: string, preview?: boolean): Promise<AssetPublicationDelivery>;
|
|
64
64
|
resolvePublicationAR(id: string): Promise<AssetPublicationDelivery>;
|
|
65
|
+
createPublicationARHandoff(id: string): Promise<{
|
|
66
|
+
handoff_url: string;
|
|
67
|
+
expires_at: string;
|
|
68
|
+
}>;
|
|
65
69
|
createPickerCapability(input: AssetPickerCapabilityInput): Promise<{
|
|
66
70
|
token: string;
|
|
67
71
|
capability: AssetPickerCapability;
|
|
@@ -78,6 +82,12 @@ export declare class AssetDAMClient {
|
|
|
78
82
|
estimateRender(assetId: string, revision: number, input: AssetRenderInput): Promise<AssetRenderEstimate>;
|
|
79
83
|
renderProduct(assetId: string, revision: number, idempotencyKey: string, input: AssetRenderInput, maximumUnits: number): Promise<AssetRenderSubmission>;
|
|
80
84
|
processModel(assetId: string, revision: number, idempotencyKey: string): Promise<AssetJobSubmission>;
|
|
85
|
+
modelVariants(assetId: string): Promise<AssetModelVariant[]>;
|
|
86
|
+
createModelVariant(assetId: string, revision: number, input: AssetModelVariantInput): Promise<AssetModelVariant>;
|
|
87
|
+
updateModelVariant(assetId: string, variantId: string, revision: number, input: AssetModelVariantInput): Promise<AssetModelVariant>;
|
|
88
|
+
deleteModelVariant(assetId: string, variantId: string, assetRevision: number, variantRevision: number): Promise<{
|
|
89
|
+
deleted: boolean;
|
|
90
|
+
}>;
|
|
81
91
|
galleries(cursor?: string): Promise<{
|
|
82
92
|
galleries: AssetGallery[];
|
|
83
93
|
next_cursor: string;
|
package/dist/assets-dam.js
CHANGED
|
@@ -32,12 +32,17 @@ export class AssetDAMClient {
|
|
|
32
32
|
transitionPublication(id, revision, action, note = '') { return this.client.request(`${path('publications', id)}/${action}`, { method: 'POST', headers: revisionHeaders(revision), body: { note } }); }
|
|
33
33
|
resolvePublication(id, preview = false) { return this.client.request(`${path('publications', id)}/${preview ? 'preview' : 'resolve'}`); }
|
|
34
34
|
resolvePublicationAR(id) { return this.client.request(`${path('publications', id)}/ar`, { method: 'POST' }); }
|
|
35
|
+
createPublicationARHandoff(id) { return this.client.request(`${path('publications', id)}/ar-handoff`, { method: 'POST' }); }
|
|
35
36
|
createPickerCapability(input) { return this.client.request('/assets/picker-capabilities', { method: 'POST', body: input }); }
|
|
36
37
|
revokePickerCapability(id) { return this.client.request(path('picker-capabilities', id), { method: 'DELETE' }); }
|
|
37
38
|
models(assetId) { return this.client.request(`/assets/${encodeURIComponent(assetId)}/models`); }
|
|
38
39
|
estimateRender(assetId, revision, input) { return this.client.request(`/assets/${encodeURIComponent(assetId)}/models`, { method: 'POST', headers: revisionHeaders(revision), body: { ...input, operation: 'estimate' } }); }
|
|
39
40
|
renderProduct(assetId, revision, idempotencyKey, input, maximumUnits) { return this.client.request(`/assets/${encodeURIComponent(assetId)}/models`, { method: 'POST', headers: { ...revisionHeaders(revision), 'Idempotency-Key': idempotencyKey }, body: { ...input, operation: 'render', maximum_units: maximumUnits } }); }
|
|
40
41
|
processModel(assetId, revision, idempotencyKey) { return this.client.request(`/assets/${encodeURIComponent(assetId)}/models`, { method: 'POST', headers: { ...revisionHeaders(revision), 'Idempotency-Key': idempotencyKey } }); }
|
|
42
|
+
modelVariants(assetId) { return this.client.request(`/assets/${encodeURIComponent(assetId)}/model-variants`); }
|
|
43
|
+
createModelVariant(assetId, revision, input) { return this.client.request(`/assets/${encodeURIComponent(assetId)}/model-variants`, { method: 'POST', headers: revisionHeaders(revision), body: input }); }
|
|
44
|
+
updateModelVariant(assetId, variantId, revision, input) { return this.client.request(`/assets/${encodeURIComponent(assetId)}/model-variants/${encodeURIComponent(variantId)}`, { method: 'PUT', headers: revisionHeaders(revision), body: input }); }
|
|
45
|
+
deleteModelVariant(assetId, variantId, assetRevision, variantRevision) { return this.client.request(`/assets/${encodeURIComponent(assetId)}/model-variants/${encodeURIComponent(variantId)}?revision=${variantRevision}`, { method: 'DELETE', headers: revisionHeaders(assetRevision) }); }
|
|
41
46
|
galleries(cursor) { return this.client.request(`/assets/galleries${cursor ? '?cursor=' + encodeURIComponent(cursor) : ''}`); }
|
|
42
47
|
createGallery(input) { return this.client.request('/assets/galleries', { method: 'POST', body: input }); }
|
|
43
48
|
updateGallery(id, revision, input) { return this.client.request(path('galleries', id), { method: 'PUT', headers: revisionHeaders(revision), body: input }); }
|
|
@@ -209,10 +209,27 @@ export interface AssetTextExtractionInput {
|
|
|
209
209
|
language?: string;
|
|
210
210
|
options?: Record<string, JsonValue>;
|
|
211
211
|
}
|
|
212
|
-
export
|
|
212
|
+
export interface AssetMigrationReconciliation {
|
|
213
|
+
discovered: number;
|
|
214
|
+
imported: number;
|
|
215
|
+
skipped: number;
|
|
216
|
+
failed: number;
|
|
217
|
+
canceled: number;
|
|
218
|
+
unresolved: number;
|
|
219
|
+
mapped: number;
|
|
220
|
+
verified_checksums: number;
|
|
221
|
+
missing_checksums: number;
|
|
222
|
+
warnings: Record<string, number>;
|
|
223
|
+
inventory_reconciled: boolean;
|
|
224
|
+
delivery_verified: boolean;
|
|
225
|
+
cutover_ready: boolean;
|
|
226
|
+
next_actions: string[];
|
|
227
|
+
}
|
|
228
|
+
export interface AssetMigrationReport {
|
|
213
229
|
migration: AssetMigration;
|
|
214
230
|
items: AssetMigrationItem[];
|
|
215
|
-
|
|
231
|
+
reconciliation?: AssetMigrationReconciliation;
|
|
232
|
+
}
|
|
216
233
|
export type AssetCapabilityUploadResult = Asset;
|
|
217
234
|
export type AssetStorageBucket = AssetBucket;
|
|
218
235
|
export {};
|
package/dist/client.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { AICreditsClient } from './ai-credits.js';
|
|
1
2
|
import { AssetsClient } from './assets.js';
|
|
2
3
|
import { MailClient } from './mail.js';
|
|
3
4
|
import { ProjectsClient } from './projects.js';
|
|
4
5
|
import { WorkloadSecurityClient } from './workload-security.js';
|
|
5
6
|
import type { StackShiftOptions } from './types.js';
|
|
6
7
|
export declare class StackShift {
|
|
8
|
+
readonly aiCredits: AICreditsClient;
|
|
7
9
|
readonly assetSpaceId?: string;
|
|
8
10
|
readonly apiKey: string;
|
|
9
11
|
readonly baseUrl: string;
|
package/dist/client.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AICreditsClient } from './ai-credits.js';
|
|
1
2
|
import { AssetsClient } from './assets.js';
|
|
2
3
|
import { MailClient } from './mail.js';
|
|
3
4
|
import { ProjectsClient } from './projects.js';
|
|
@@ -6,6 +7,7 @@ const defaultBaseUrl = 'https://api.stackshift.cloud/api/v1';
|
|
|
6
7
|
const defaultMailBaseUrl = 'https://api.stackshift.cloud/v1';
|
|
7
8
|
const defaultCdnBaseUrl = 'https://cdn.stackshift.cloud';
|
|
8
9
|
export class StackShift {
|
|
10
|
+
aiCredits;
|
|
9
11
|
assetSpaceId;
|
|
10
12
|
apiKey;
|
|
11
13
|
baseUrl;
|
|
@@ -27,6 +29,7 @@ export class StackShift {
|
|
|
27
29
|
this.mailBaseUrl = (options.mailBaseUrl ?? defaultMailBaseUrl).replace(/\/$/, '');
|
|
28
30
|
this.cdnBaseUrl = (options.cdnBaseUrl ?? defaultCdnBaseUrl).replace(/\/$/, '');
|
|
29
31
|
this.fetcher = options.fetch ?? fetch;
|
|
32
|
+
this.aiCredits = new AICreditsClient(this);
|
|
30
33
|
this.projects = new ProjectsClient(this);
|
|
31
34
|
this.assets = new AssetsClient(this);
|
|
32
35
|
this.mail = new MailClient(this);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type AssetOperationId = 'putAssetAICredential' | 'deleteAssetAICredential' | 'openAssetAIOutput' | 'getVideoWorkspace' | 'processVideoVersion' | 'createVideoPlaybackSession' | 'revokeVideoPlaybackSession' | 'reviewVideoVersion' | 'listVideoCaptions' | 'addVideoCaption' | 'removeVideoCaption' | 'getVideoAnalytics' | 'createPublicVideoPlaybackSession' | 'renewVideoPlaybackSession' | 'recordVideoPlaybackEvents' | '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' | 'listAssetSpaces' | 'listAssetCollaborators' | 'inviteAssetCollaborator' | 'updateAssetCollaborator' | 'revokeAssetCollaborator' | 'acceptAssetInvitation' | 'listAssetMetadataSchemas' | 'createAssetMetadataSchema' | 'updateAssetMetadataSchema' | 'publishAssetMetadataSchema' | 'getAssetBucketGovernance' | 'updateAssetBucketGovernance' | 'getAssetMetadataEditor' | 'listAssetPublications' | 'createAssetPublication' | 'updateAssetPublication' | 'transitionAssetPublication' | 'resolveAssetPublication' | 'listAssetPublicationRenditions' | 'previewAssetPublication' | 'migrateAssetBucketGovernance' | 'createAssetPickerCapability' | 'revokeAssetPickerCapability' | 'listAssetModels' | 'processAssetModel' | 'resolveAssetPublicationAR' | 'listAssetGalleries' | 'createAssetGallery' | 'updateAssetGallery' | 'transitionAssetGallery' | 'resolveAssetGallery' | 'resolveAssetGalleryAR' | 'searchAssetPicker' | 'selectAssetPicker';
|
|
1
|
+
export type AssetOperationId = 'putAssetAICredential' | 'deleteAssetAICredential' | 'openAssetAIOutput' | 'getVideoWorkspace' | 'processVideoVersion' | 'createVideoPlaybackSession' | 'revokeVideoPlaybackSession' | 'reviewVideoVersion' | 'listVideoCaptions' | 'addVideoCaption' | 'removeVideoCaption' | 'getVideoAnalytics' | 'createPublicVideoPlaybackSession' | 'openPublicPlayerMedia' | 'renewVideoPlaybackSession' | 'recordVideoPlaybackEvents' | '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' | 'listAssetSpaces' | 'listAssetCollaborators' | 'inviteAssetCollaborator' | 'updateAssetCollaborator' | 'revokeAssetCollaborator' | 'acceptAssetInvitation' | 'listAssetMetadataSchemas' | 'createAssetMetadataSchema' | 'updateAssetMetadataSchema' | 'publishAssetMetadataSchema' | 'getAssetBucketGovernance' | 'updateAssetBucketGovernance' | 'getAssetMetadataEditor' | 'listAssetPublications' | 'createAssetPublication' | 'updateAssetPublication' | 'transitionAssetPublication' | 'resolveAssetPublication' | 'listAssetPublicationRenditions' | 'previewAssetPublication' | 'migrateAssetBucketGovernance' | 'createAssetPickerCapability' | 'revokeAssetPickerCapability' | 'listAssetModels' | 'processAssetModel' | 'listAssetModelVariants' | 'createAssetModelVariant' | 'updateAssetModelVariant' | 'deleteAssetModelVariant' | 'resolveAssetPublicationAR' | 'createAssetPublicationARHandoff' | 'resolveAssetPublicationARHandoff' | 'listAssetGalleries' | 'createAssetGallery' | 'updateAssetGallery' | 'transitionAssetGallery' | 'resolveAssetGallery' | 'resolveAssetGalleryAR' | 'searchAssetPicker' | 'selectAssetPicker' | 'listAssetPortals' | 'createAssetPortal' | 'updateAssetPortal' | 'actOnAssetPortal' | 'listAssetProofs' | 'createAssetProof' | 'getAssetProof' | 'updateAssetProof' | 'decideAssetProof' | 'commentOnAssetProof' | 'inviteAssetProofGuest' | 'listAssetGuestGrants' | 'revokeAssetGuestGrant' | 'getAssetInsights' | 'setAssetInsightsTimezone' | 'listAssetPlayerProfiles' | 'createAssetPlayerProfile' | 'getAssetPlayerProfile' | 'updateAssetPlayerProfile' | 'archiveAssetPlayerProfile' | 'getAssetPlayerAssociation' | 'setAssetPlayerAssociation' | 'moveAssetFolder' | 'listAssetFolders' | 'createAssetFolder' | 'deleteAssetFolder' | 'listAssetSamples' | 'previewAssetSample' | 'copyAssetSample' | 'getAssetCapabilities' | 'listAssetModerationReviews' | 'submitAssetModerationReviews' | 'getAssetModerationReviews' | 'listAssetIntegrations' | 'createAssetIntegration' | 'deleteAssetIntegration' | 'getCurrentAssetIntegration' | 'connectCurrentAssetIntegration' | 'disconnectCurrentAssetIntegration' | 'testAssetWebhook' | 'estimateAssetGeneration' | 'listAssetGenerations' | 'retryAssetGeneration' | 'cancelAssetGeneration' | 'previewAsset' | 'previewAssetStudio' | 'saveAssetStudioOutput' | 'signAssetStudioOutput' | 'getAssetStudioOutput' | 'publishAssetTransformation';
|
|
2
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;
|
|
@@ -71,6 +71,11 @@ export declare const assetContractOperations: readonly [{
|
|
|
71
71
|
readonly method: "POST";
|
|
72
72
|
readonly path: "/playback/assets/{assetID}/sessions";
|
|
73
73
|
readonly scope: "assets:read";
|
|
74
|
+
}, {
|
|
75
|
+
readonly id: "openPublicPlayerMedia";
|
|
76
|
+
readonly method: "GET";
|
|
77
|
+
readonly path: "/playback/media/{kind}";
|
|
78
|
+
readonly scope: "assets:read";
|
|
74
79
|
}, {
|
|
75
80
|
readonly id: "renewVideoPlaybackSession";
|
|
76
81
|
readonly method: "POST";
|
|
@@ -791,11 +796,41 @@ export declare const assetContractOperations: readonly [{
|
|
|
791
796
|
readonly method: "POST";
|
|
792
797
|
readonly path: "/api/v1/assets/{assetID}/models";
|
|
793
798
|
readonly scope: "assets:process";
|
|
799
|
+
}, {
|
|
800
|
+
readonly id: "listAssetModelVariants";
|
|
801
|
+
readonly method: "GET";
|
|
802
|
+
readonly path: "/api/v1/assets/{assetID}/model-variants";
|
|
803
|
+
readonly scope: "assets:read";
|
|
804
|
+
}, {
|
|
805
|
+
readonly id: "createAssetModelVariant";
|
|
806
|
+
readonly method: "POST";
|
|
807
|
+
readonly path: "/api/v1/assets/{assetID}/model-variants";
|
|
808
|
+
readonly scope: "assets:process";
|
|
809
|
+
}, {
|
|
810
|
+
readonly id: "updateAssetModelVariant";
|
|
811
|
+
readonly method: "PUT";
|
|
812
|
+
readonly path: "/api/v1/assets/{assetID}/model-variants/{variantID}";
|
|
813
|
+
readonly scope: "assets:process";
|
|
814
|
+
}, {
|
|
815
|
+
readonly id: "deleteAssetModelVariant";
|
|
816
|
+
readonly method: "DELETE";
|
|
817
|
+
readonly path: "/api/v1/assets/{assetID}/model-variants/{variantID}";
|
|
818
|
+
readonly scope: "assets:process";
|
|
794
819
|
}, {
|
|
795
820
|
readonly id: "resolveAssetPublicationAR";
|
|
796
821
|
readonly method: "POST";
|
|
797
822
|
readonly path: "/api/v1/assets/publications/{publicationID}/ar";
|
|
798
823
|
readonly scope: "assets:read";
|
|
824
|
+
}, {
|
|
825
|
+
readonly id: "createAssetPublicationARHandoff";
|
|
826
|
+
readonly method: "POST";
|
|
827
|
+
readonly path: "/api/v1/assets/publications/{publicationID}/ar-handoff";
|
|
828
|
+
readonly scope: "assets:read";
|
|
829
|
+
}, {
|
|
830
|
+
readonly id: "resolveAssetPublicationARHandoff";
|
|
831
|
+
readonly method: "GET";
|
|
832
|
+
readonly path: "/assets/ar-handoff/{token}";
|
|
833
|
+
readonly scope: "assets:read";
|
|
799
834
|
}, {
|
|
800
835
|
readonly id: "listAssetGalleries";
|
|
801
836
|
readonly method: "GET";
|
|
@@ -836,4 +871,254 @@ export declare const assetContractOperations: readonly [{
|
|
|
836
871
|
readonly method: "POST";
|
|
837
872
|
readonly path: "/assets/picker/select";
|
|
838
873
|
readonly scope: "assets:read";
|
|
874
|
+
}, {
|
|
875
|
+
readonly id: "listAssetPortals";
|
|
876
|
+
readonly method: "GET";
|
|
877
|
+
readonly path: "/api/v1/assets/portals";
|
|
878
|
+
readonly scope: "assets:read";
|
|
879
|
+
}, {
|
|
880
|
+
readonly id: "createAssetPortal";
|
|
881
|
+
readonly method: "POST";
|
|
882
|
+
readonly path: "/api/v1/assets/portals";
|
|
883
|
+
readonly scope: "assets:write";
|
|
884
|
+
}, {
|
|
885
|
+
readonly id: "updateAssetPortal";
|
|
886
|
+
readonly method: "PUT";
|
|
887
|
+
readonly path: "/api/v1/assets/portals/{portalID}";
|
|
888
|
+
readonly scope: "assets:write";
|
|
889
|
+
}, {
|
|
890
|
+
readonly id: "actOnAssetPortal";
|
|
891
|
+
readonly method: "POST";
|
|
892
|
+
readonly path: "/api/v1/assets/portals/{portalID}/{action}";
|
|
893
|
+
readonly scope: "assets:publish";
|
|
894
|
+
}, {
|
|
895
|
+
readonly id: "listAssetProofs";
|
|
896
|
+
readonly method: "GET";
|
|
897
|
+
readonly path: "/api/v1/assets/proofs";
|
|
898
|
+
readonly scope: "assets:read";
|
|
899
|
+
}, {
|
|
900
|
+
readonly id: "createAssetProof";
|
|
901
|
+
readonly method: "POST";
|
|
902
|
+
readonly path: "/api/v1/assets/proofs";
|
|
903
|
+
readonly scope: "assets:write";
|
|
904
|
+
}, {
|
|
905
|
+
readonly id: "getAssetProof";
|
|
906
|
+
readonly method: "GET";
|
|
907
|
+
readonly path: "/api/v1/assets/proofs/{proofID}";
|
|
908
|
+
readonly scope: "assets:read";
|
|
909
|
+
}, {
|
|
910
|
+
readonly id: "updateAssetProof";
|
|
911
|
+
readonly method: "PUT";
|
|
912
|
+
readonly path: "/api/v1/assets/proofs/{proofID}";
|
|
913
|
+
readonly scope: "assets:write";
|
|
914
|
+
}, {
|
|
915
|
+
readonly id: "decideAssetProof";
|
|
916
|
+
readonly method: "POST";
|
|
917
|
+
readonly path: "/api/v1/assets/proofs/{proofID}/decisions";
|
|
918
|
+
readonly scope: "assets:admin";
|
|
919
|
+
}, {
|
|
920
|
+
readonly id: "commentOnAssetProof";
|
|
921
|
+
readonly method: "POST";
|
|
922
|
+
readonly path: "/api/v1/assets/proofs/{proofID}/comments";
|
|
923
|
+
readonly scope: "assets:write";
|
|
924
|
+
}, {
|
|
925
|
+
readonly id: "inviteAssetProofGuest";
|
|
926
|
+
readonly method: "POST";
|
|
927
|
+
readonly path: "/api/v1/assets/proofs/{proofID}/invitations";
|
|
928
|
+
readonly scope: "assets:admin";
|
|
929
|
+
}, {
|
|
930
|
+
readonly id: "listAssetGuestGrants";
|
|
931
|
+
readonly method: "GET";
|
|
932
|
+
readonly path: "/api/v1/assets/guest-grants";
|
|
933
|
+
readonly scope: "assets:admin";
|
|
934
|
+
}, {
|
|
935
|
+
readonly id: "revokeAssetGuestGrant";
|
|
936
|
+
readonly method: "DELETE";
|
|
937
|
+
readonly path: "/api/v1/assets/guest-grants/{grantID}";
|
|
938
|
+
readonly scope: "assets:admin";
|
|
939
|
+
}, {
|
|
940
|
+
readonly id: "getAssetInsights";
|
|
941
|
+
readonly method: "GET";
|
|
942
|
+
readonly path: "/api/v1/assets/insights";
|
|
943
|
+
readonly scope: "assets:read";
|
|
944
|
+
}, {
|
|
945
|
+
readonly id: "setAssetInsightsTimezone";
|
|
946
|
+
readonly method: "PUT";
|
|
947
|
+
readonly path: "/api/v1/assets/insights";
|
|
948
|
+
readonly scope: "assets:write";
|
|
949
|
+
}, {
|
|
950
|
+
readonly id: "listAssetPlayerProfiles";
|
|
951
|
+
readonly method: "GET";
|
|
952
|
+
readonly path: "/api/v1/assets/player-profiles";
|
|
953
|
+
readonly scope: "assets:read";
|
|
954
|
+
}, {
|
|
955
|
+
readonly id: "createAssetPlayerProfile";
|
|
956
|
+
readonly method: "POST";
|
|
957
|
+
readonly path: "/api/v1/assets/player-profiles";
|
|
958
|
+
readonly scope: "assets:write";
|
|
959
|
+
}, {
|
|
960
|
+
readonly id: "getAssetPlayerProfile";
|
|
961
|
+
readonly method: "GET";
|
|
962
|
+
readonly path: "/api/v1/assets/player-profiles/{profileID}";
|
|
963
|
+
readonly scope: "assets:read";
|
|
964
|
+
}, {
|
|
965
|
+
readonly id: "updateAssetPlayerProfile";
|
|
966
|
+
readonly method: "PUT";
|
|
967
|
+
readonly path: "/api/v1/assets/player-profiles/{profileID}";
|
|
968
|
+
readonly scope: "assets:write";
|
|
969
|
+
}, {
|
|
970
|
+
readonly id: "archiveAssetPlayerProfile";
|
|
971
|
+
readonly method: "DELETE";
|
|
972
|
+
readonly path: "/api/v1/assets/player-profiles/{profileID}";
|
|
973
|
+
readonly scope: "assets:write";
|
|
974
|
+
}, {
|
|
975
|
+
readonly id: "getAssetPlayerAssociation";
|
|
976
|
+
readonly method: "GET";
|
|
977
|
+
readonly path: "/api/v1/assets/{assetID}/player-profile";
|
|
978
|
+
readonly scope: "assets:read";
|
|
979
|
+
}, {
|
|
980
|
+
readonly id: "setAssetPlayerAssociation";
|
|
981
|
+
readonly method: "PUT";
|
|
982
|
+
readonly path: "/api/v1/assets/{assetID}/player-profile";
|
|
983
|
+
readonly scope: "assets:write";
|
|
984
|
+
}, {
|
|
985
|
+
readonly id: "moveAssetFolder";
|
|
986
|
+
readonly method: "POST";
|
|
987
|
+
readonly path: "/api/v1/assets/folders/move";
|
|
988
|
+
readonly scope: "assets:write";
|
|
989
|
+
}, {
|
|
990
|
+
readonly id: "listAssetFolders";
|
|
991
|
+
readonly method: "GET";
|
|
992
|
+
readonly path: "/api/v1/assets/folders";
|
|
993
|
+
readonly scope: "assets:read";
|
|
994
|
+
}, {
|
|
995
|
+
readonly id: "createAssetFolder";
|
|
996
|
+
readonly method: "POST";
|
|
997
|
+
readonly path: "/api/v1/assets/folders";
|
|
998
|
+
readonly scope: "assets:write";
|
|
999
|
+
}, {
|
|
1000
|
+
readonly id: "deleteAssetFolder";
|
|
1001
|
+
readonly method: "DELETE";
|
|
1002
|
+
readonly path: "/api/v1/assets/folders";
|
|
1003
|
+
readonly scope: "assets:write";
|
|
1004
|
+
}, {
|
|
1005
|
+
readonly id: "listAssetSamples";
|
|
1006
|
+
readonly method: "GET";
|
|
1007
|
+
readonly path: "/api/v1/assets/samples";
|
|
1008
|
+
readonly scope: "assets:read";
|
|
1009
|
+
}, {
|
|
1010
|
+
readonly id: "previewAssetSample";
|
|
1011
|
+
readonly method: "GET";
|
|
1012
|
+
readonly path: "/api/v1/assets/samples/{sampleID}/preview";
|
|
1013
|
+
readonly scope: "assets:read";
|
|
1014
|
+
}, {
|
|
1015
|
+
readonly id: "copyAssetSample";
|
|
1016
|
+
readonly method: "POST";
|
|
1017
|
+
readonly path: "/api/v1/assets/samples/{sampleID}/copy";
|
|
1018
|
+
readonly scope: "assets:write";
|
|
1019
|
+
}, {
|
|
1020
|
+
readonly id: "getAssetCapabilities";
|
|
1021
|
+
readonly method: "GET";
|
|
1022
|
+
readonly path: "/api/v1/assets/capabilities";
|
|
1023
|
+
readonly scope: "assets:read";
|
|
1024
|
+
}, {
|
|
1025
|
+
readonly id: "listAssetModerationReviews";
|
|
1026
|
+
readonly method: "GET";
|
|
1027
|
+
readonly path: "/api/v1/assets/moderation-reviews";
|
|
1028
|
+
readonly scope: "assets:read";
|
|
1029
|
+
}, {
|
|
1030
|
+
readonly id: "submitAssetModerationReviews";
|
|
1031
|
+
readonly method: "POST";
|
|
1032
|
+
readonly path: "/api/v1/assets/moderation-reviews";
|
|
1033
|
+
readonly scope: "assets:admin";
|
|
1034
|
+
}, {
|
|
1035
|
+
readonly id: "getAssetModerationReviews";
|
|
1036
|
+
readonly method: "GET";
|
|
1037
|
+
readonly path: "/api/v1/assets/moderation-reviews/{assetID}";
|
|
1038
|
+
readonly scope: "assets:read";
|
|
1039
|
+
}, {
|
|
1040
|
+
readonly id: "listAssetIntegrations";
|
|
1041
|
+
readonly method: "GET";
|
|
1042
|
+
readonly path: "/api/v1/assets/integrations";
|
|
1043
|
+
readonly scope: "assets:admin";
|
|
1044
|
+
}, {
|
|
1045
|
+
readonly id: "createAssetIntegration";
|
|
1046
|
+
readonly method: "POST";
|
|
1047
|
+
readonly path: "/api/v1/assets/integrations";
|
|
1048
|
+
readonly scope: "assets:admin";
|
|
1049
|
+
}, {
|
|
1050
|
+
readonly id: "deleteAssetIntegration";
|
|
1051
|
+
readonly method: "DELETE";
|
|
1052
|
+
readonly path: "/api/v1/assets/integrations/{integrationID}";
|
|
1053
|
+
readonly scope: "assets:admin";
|
|
1054
|
+
}, {
|
|
1055
|
+
readonly id: "getCurrentAssetIntegration";
|
|
1056
|
+
readonly method: "GET";
|
|
1057
|
+
readonly path: "/api/v1/assets/integrations/current";
|
|
1058
|
+
readonly scope: "assets:read";
|
|
1059
|
+
}, {
|
|
1060
|
+
readonly id: "connectCurrentAssetIntegration";
|
|
1061
|
+
readonly method: "POST";
|
|
1062
|
+
readonly path: "/api/v1/assets/integrations/current";
|
|
1063
|
+
readonly scope: "assets:read";
|
|
1064
|
+
}, {
|
|
1065
|
+
readonly id: "disconnectCurrentAssetIntegration";
|
|
1066
|
+
readonly method: "DELETE";
|
|
1067
|
+
readonly path: "/api/v1/assets/integrations/current";
|
|
1068
|
+
readonly scope: "assets:read";
|
|
1069
|
+
}, {
|
|
1070
|
+
readonly id: "testAssetWebhook";
|
|
1071
|
+
readonly method: "POST";
|
|
1072
|
+
readonly path: "/api/v1/assets/webhooks/{webhookID}/test";
|
|
1073
|
+
readonly scope: "assets:write";
|
|
1074
|
+
}, {
|
|
1075
|
+
readonly id: "estimateAssetGeneration";
|
|
1076
|
+
readonly method: "POST";
|
|
1077
|
+
readonly path: "/api/v1/assets/generations/estimate";
|
|
1078
|
+
readonly scope: "assets:generate";
|
|
1079
|
+
}, {
|
|
1080
|
+
readonly id: "listAssetGenerations";
|
|
1081
|
+
readonly method: "GET";
|
|
1082
|
+
readonly path: "/api/v1/assets/generations";
|
|
1083
|
+
readonly scope: "assets:read";
|
|
1084
|
+
}, {
|
|
1085
|
+
readonly id: "retryAssetGeneration";
|
|
1086
|
+
readonly method: "POST";
|
|
1087
|
+
readonly path: "/api/v1/assets/generations/{requestID}/retry";
|
|
1088
|
+
readonly scope: "assets:generate";
|
|
1089
|
+
}, {
|
|
1090
|
+
readonly id: "cancelAssetGeneration";
|
|
1091
|
+
readonly method: "POST";
|
|
1092
|
+
readonly path: "/api/v1/assets/generations/{requestID}/cancel";
|
|
1093
|
+
readonly scope: "assets:generate";
|
|
1094
|
+
}, {
|
|
1095
|
+
readonly id: "previewAsset";
|
|
1096
|
+
readonly method: "GET";
|
|
1097
|
+
readonly path: "/api/v1/assets/{assetID}/preview";
|
|
1098
|
+
readonly scope: "assets:read";
|
|
1099
|
+
}, {
|
|
1100
|
+
readonly id: "previewAssetStudio";
|
|
1101
|
+
readonly method: "POST";
|
|
1102
|
+
readonly path: "/api/v1/assets/{assetID}/studio/preview";
|
|
1103
|
+
readonly scope: "assets:write";
|
|
1104
|
+
}, {
|
|
1105
|
+
readonly id: "saveAssetStudioOutput";
|
|
1106
|
+
readonly method: "POST";
|
|
1107
|
+
readonly path: "/api/v1/assets/{assetID}/derivatives/{outputID}/save";
|
|
1108
|
+
readonly scope: "assets:write";
|
|
1109
|
+
}, {
|
|
1110
|
+
readonly id: "signAssetStudioOutput";
|
|
1111
|
+
readonly method: "POST";
|
|
1112
|
+
readonly path: "/api/v1/assets/{assetID}/derivatives/{outputID}/signed-url";
|
|
1113
|
+
readonly scope: "assets:write";
|
|
1114
|
+
}, {
|
|
1115
|
+
readonly id: "getAssetStudioOutput";
|
|
1116
|
+
readonly method: "GET";
|
|
1117
|
+
readonly path: "/api/v1/assets/{assetID}/derivatives/{outputID}";
|
|
1118
|
+
readonly scope: "assets:read";
|
|
1119
|
+
}, {
|
|
1120
|
+
readonly id: "publishAssetTransformation";
|
|
1121
|
+
readonly method: "POST";
|
|
1122
|
+
readonly path: "/api/v1/assets/transformations/{name}/publish";
|
|
1123
|
+
readonly scope: "assets:write";
|
|
839
1124
|
}];
|
|
@@ -12,6 +12,7 @@ export const assetContractOperations = [
|
|
|
12
12
|
{ id: 'removeVideoCaption', method: 'DELETE', path: '/api/v1/assets/{assetID}/versions/{versionID}/video/captions/{captionID}', scope: 'assets:write' },
|
|
13
13
|
{ id: 'getVideoAnalytics', method: 'GET', path: '/api/v1/assets/{assetID}/video/analytics', scope: 'assets:read' },
|
|
14
14
|
{ id: 'createPublicVideoPlaybackSession', method: 'POST', path: '/playback/assets/{assetID}/sessions', scope: 'assets:read' },
|
|
15
|
+
{ id: 'openPublicPlayerMedia', method: 'GET', path: '/playback/media/{kind}', scope: 'assets:read' },
|
|
15
16
|
{ id: 'renewVideoPlaybackSession', method: 'POST', path: '/playback/sessions/renew', scope: 'assets:read' },
|
|
16
17
|
{ id: 'recordVideoPlaybackEvents', method: 'POST', path: '/playback/events', scope: 'assets:read' },
|
|
17
18
|
{ id: 'uploadAsset', method: 'POST', path: '/api/v1/assets/upload', scope: 'assets:write' },
|
|
@@ -156,7 +157,13 @@ export const assetContractOperations = [
|
|
|
156
157
|
{ id: 'revokeAssetPickerCapability', method: 'DELETE', path: '/api/v1/assets/picker-capabilities/{capabilityID}', scope: 'assets:read' },
|
|
157
158
|
{ id: 'listAssetModels', method: 'GET', path: '/api/v1/assets/{assetID}/models', scope: 'assets:read' },
|
|
158
159
|
{ id: 'processAssetModel', method: 'POST', path: '/api/v1/assets/{assetID}/models', scope: 'assets:process' },
|
|
160
|
+
{ id: 'listAssetModelVariants', method: 'GET', path: '/api/v1/assets/{assetID}/model-variants', scope: 'assets:read' },
|
|
161
|
+
{ id: 'createAssetModelVariant', method: 'POST', path: '/api/v1/assets/{assetID}/model-variants', scope: 'assets:process' },
|
|
162
|
+
{ id: 'updateAssetModelVariant', method: 'PUT', path: '/api/v1/assets/{assetID}/model-variants/{variantID}', scope: 'assets:process' },
|
|
163
|
+
{ id: 'deleteAssetModelVariant', method: 'DELETE', path: '/api/v1/assets/{assetID}/model-variants/{variantID}', scope: 'assets:process' },
|
|
159
164
|
{ id: 'resolveAssetPublicationAR', method: 'POST', path: '/api/v1/assets/publications/{publicationID}/ar', scope: 'assets:read' },
|
|
165
|
+
{ id: 'createAssetPublicationARHandoff', method: 'POST', path: '/api/v1/assets/publications/{publicationID}/ar-handoff', scope: 'assets:read' },
|
|
166
|
+
{ id: 'resolveAssetPublicationARHandoff', method: 'GET', path: '/assets/ar-handoff/{token}', scope: 'assets:read' },
|
|
160
167
|
{ id: 'listAssetGalleries', method: 'GET', path: '/api/v1/assets/galleries', scope: 'assets:read' },
|
|
161
168
|
{ id: 'createAssetGallery', method: 'POST', path: '/api/v1/assets/galleries', scope: 'assets:write' },
|
|
162
169
|
{ id: 'updateAssetGallery', method: 'PUT', path: '/api/v1/assets/galleries/{galleryID}', scope: 'assets:write' },
|
|
@@ -165,4 +172,54 @@ export const assetContractOperations = [
|
|
|
165
172
|
{ id: 'resolveAssetGalleryAR', method: 'POST', path: '/api/v1/assets/galleries/{galleryID}/ar', scope: 'assets:read' },
|
|
166
173
|
{ id: 'searchAssetPicker', method: 'POST', path: '/assets/picker/search', scope: 'assets:read' },
|
|
167
174
|
{ id: 'selectAssetPicker', method: 'POST', path: '/assets/picker/select', scope: 'assets:read' },
|
|
175
|
+
{ id: 'listAssetPortals', method: 'GET', path: '/api/v1/assets/portals', scope: 'assets:read' },
|
|
176
|
+
{ id: 'createAssetPortal', method: 'POST', path: '/api/v1/assets/portals', scope: 'assets:write' },
|
|
177
|
+
{ id: 'updateAssetPortal', method: 'PUT', path: '/api/v1/assets/portals/{portalID}', scope: 'assets:write' },
|
|
178
|
+
{ id: 'actOnAssetPortal', method: 'POST', path: '/api/v1/assets/portals/{portalID}/{action}', scope: 'assets:publish' },
|
|
179
|
+
{ id: 'listAssetProofs', method: 'GET', path: '/api/v1/assets/proofs', scope: 'assets:read' },
|
|
180
|
+
{ id: 'createAssetProof', method: 'POST', path: '/api/v1/assets/proofs', scope: 'assets:write' },
|
|
181
|
+
{ id: 'getAssetProof', method: 'GET', path: '/api/v1/assets/proofs/{proofID}', scope: 'assets:read' },
|
|
182
|
+
{ id: 'updateAssetProof', method: 'PUT', path: '/api/v1/assets/proofs/{proofID}', scope: 'assets:write' },
|
|
183
|
+
{ id: 'decideAssetProof', method: 'POST', path: '/api/v1/assets/proofs/{proofID}/decisions', scope: 'assets:admin' },
|
|
184
|
+
{ id: 'commentOnAssetProof', method: 'POST', path: '/api/v1/assets/proofs/{proofID}/comments', scope: 'assets:write' },
|
|
185
|
+
{ id: 'inviteAssetProofGuest', method: 'POST', path: '/api/v1/assets/proofs/{proofID}/invitations', scope: 'assets:admin' },
|
|
186
|
+
{ id: 'listAssetGuestGrants', method: 'GET', path: '/api/v1/assets/guest-grants', scope: 'assets:admin' },
|
|
187
|
+
{ id: 'revokeAssetGuestGrant', method: 'DELETE', path: '/api/v1/assets/guest-grants/{grantID}', scope: 'assets:admin' },
|
|
188
|
+
{ id: 'getAssetInsights', method: 'GET', path: '/api/v1/assets/insights', scope: 'assets:read' },
|
|
189
|
+
{ id: 'setAssetInsightsTimezone', method: 'PUT', path: '/api/v1/assets/insights', scope: 'assets:write' },
|
|
190
|
+
{ id: 'listAssetPlayerProfiles', method: 'GET', path: '/api/v1/assets/player-profiles', scope: 'assets:read' },
|
|
191
|
+
{ id: 'createAssetPlayerProfile', method: 'POST', path: '/api/v1/assets/player-profiles', scope: 'assets:write' },
|
|
192
|
+
{ id: 'getAssetPlayerProfile', method: 'GET', path: '/api/v1/assets/player-profiles/{profileID}', scope: 'assets:read' },
|
|
193
|
+
{ id: 'updateAssetPlayerProfile', method: 'PUT', path: '/api/v1/assets/player-profiles/{profileID}', scope: 'assets:write' },
|
|
194
|
+
{ id: 'archiveAssetPlayerProfile', method: 'DELETE', path: '/api/v1/assets/player-profiles/{profileID}', scope: 'assets:write' },
|
|
195
|
+
{ id: 'getAssetPlayerAssociation', method: 'GET', path: '/api/v1/assets/{assetID}/player-profile', scope: 'assets:read' },
|
|
196
|
+
{ id: 'setAssetPlayerAssociation', method: 'PUT', path: '/api/v1/assets/{assetID}/player-profile', scope: 'assets:write' },
|
|
197
|
+
{ id: 'moveAssetFolder', method: 'POST', path: '/api/v1/assets/folders/move', scope: 'assets:write' },
|
|
198
|
+
{ id: 'listAssetFolders', method: 'GET', path: '/api/v1/assets/folders', scope: 'assets:read' },
|
|
199
|
+
{ id: 'createAssetFolder', method: 'POST', path: '/api/v1/assets/folders', scope: 'assets:write' },
|
|
200
|
+
{ id: 'deleteAssetFolder', method: 'DELETE', path: '/api/v1/assets/folders', scope: 'assets:write' },
|
|
201
|
+
{ id: 'listAssetSamples', method: 'GET', path: '/api/v1/assets/samples', scope: 'assets:read' },
|
|
202
|
+
{ id: 'previewAssetSample', method: 'GET', path: '/api/v1/assets/samples/{sampleID}/preview', scope: 'assets:read' },
|
|
203
|
+
{ id: 'copyAssetSample', method: 'POST', path: '/api/v1/assets/samples/{sampleID}/copy', scope: 'assets:write' },
|
|
204
|
+
{ id: 'getAssetCapabilities', method: 'GET', path: '/api/v1/assets/capabilities', scope: 'assets:read' },
|
|
205
|
+
{ id: 'listAssetModerationReviews', method: 'GET', path: '/api/v1/assets/moderation-reviews', scope: 'assets:read' },
|
|
206
|
+
{ id: 'submitAssetModerationReviews', method: 'POST', path: '/api/v1/assets/moderation-reviews', scope: 'assets:admin' },
|
|
207
|
+
{ id: 'getAssetModerationReviews', method: 'GET', path: '/api/v1/assets/moderation-reviews/{assetID}', scope: 'assets:read' },
|
|
208
|
+
{ id: 'listAssetIntegrations', method: 'GET', path: '/api/v1/assets/integrations', scope: 'assets:admin' },
|
|
209
|
+
{ id: 'createAssetIntegration', method: 'POST', path: '/api/v1/assets/integrations', scope: 'assets:admin' },
|
|
210
|
+
{ id: 'deleteAssetIntegration', method: 'DELETE', path: '/api/v1/assets/integrations/{integrationID}', scope: 'assets:admin' },
|
|
211
|
+
{ id: 'getCurrentAssetIntegration', method: 'GET', path: '/api/v1/assets/integrations/current', scope: 'assets:read' },
|
|
212
|
+
{ id: 'connectCurrentAssetIntegration', method: 'POST', path: '/api/v1/assets/integrations/current', scope: 'assets:read' },
|
|
213
|
+
{ id: 'disconnectCurrentAssetIntegration', method: 'DELETE', path: '/api/v1/assets/integrations/current', scope: 'assets:read' },
|
|
214
|
+
{ id: 'testAssetWebhook', method: 'POST', path: '/api/v1/assets/webhooks/{webhookID}/test', scope: 'assets:write' },
|
|
215
|
+
{ id: 'estimateAssetGeneration', method: 'POST', path: '/api/v1/assets/generations/estimate', scope: 'assets:generate' },
|
|
216
|
+
{ id: 'listAssetGenerations', method: 'GET', path: '/api/v1/assets/generations', scope: 'assets:read' },
|
|
217
|
+
{ id: 'retryAssetGeneration', method: 'POST', path: '/api/v1/assets/generations/{requestID}/retry', scope: 'assets:generate' },
|
|
218
|
+
{ id: 'cancelAssetGeneration', method: 'POST', path: '/api/v1/assets/generations/{requestID}/cancel', scope: 'assets:generate' },
|
|
219
|
+
{ id: 'previewAsset', method: 'GET', path: '/api/v1/assets/{assetID}/preview', scope: 'assets:read' },
|
|
220
|
+
{ id: 'previewAssetStudio', method: 'POST', path: '/api/v1/assets/{assetID}/studio/preview', scope: 'assets:write' },
|
|
221
|
+
{ id: 'saveAssetStudioOutput', method: 'POST', path: '/api/v1/assets/{assetID}/derivatives/{outputID}/save', scope: 'assets:write' },
|
|
222
|
+
{ id: 'signAssetStudioOutput', method: 'POST', path: '/api/v1/assets/{assetID}/derivatives/{outputID}/signed-url', scope: 'assets:write' },
|
|
223
|
+
{ id: 'getAssetStudioOutput', method: 'GET', path: '/api/v1/assets/{assetID}/derivatives/{outputID}', scope: 'assets:read' },
|
|
224
|
+
{ id: 'publishAssetTransformation', method: 'POST', path: '/api/v1/assets/transformations/{name}/publish', scope: 'assets:write' },
|
|
168
225
|
];
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ export type * from './asset-media-v2.js';
|
|
|
6
6
|
export { AssetConnectionsClient, AssetMigrationsClient, AssetStorageClient, AssetTextClient, AssetUploadCapabilitiesClient } from './assets-platform.js';
|
|
7
7
|
export type * from './assets-platform-types.js';
|
|
8
8
|
export { ChunkedUploadController, UploadResumeInvalidError, putBlob, sha256Blob } from './upload-controller.js';
|
|
9
|
+
export { S2UploadsClient } from './s2.js';
|
|
10
|
+
export type { S2Object } from './s2.js';
|
|
11
|
+
export { S2Uploader, createS2ResumeStore } from './s2-upload.js';
|
|
12
|
+
export type { S2UploadBackend } from './s2-upload.js';
|
|
9
13
|
export type { ChunkUploadCallbacks, ChunkUploadRequest, ChunkUploadSession, ChunkUploadTransport, ChunkedUploadOptions, UploadProgress, UploadResumeRecord, UploadResumeStore, UploadedPart } from './upload-controller.js';
|
|
10
14
|
export { createResponsiveImage, namedResponsiveSource, uploadBrowserFile } from './assets-framework.js';
|
|
11
15
|
export type { ArtDirectionSource, ResponsiveImageDescriptor, ResponsiveImageOptions } from './assets-framework.js';
|
|
@@ -26,7 +30,7 @@ export type { MailSendTemplateInput, MailSendTemplateResponse, MailTemplate, Mai
|
|
|
26
30
|
export type { MailEvent, MailEventListOptions, MailEventListResult, MailEventType, MailTimelineItem, MailWebhook, MailWebhookCreateInput, MailWebhookCreateResponse, MailWebhookDelivery, MailWebhookDeliveryAttempt, MailWebhookDeliveryDetail, MailWebhookDeliveryListOptions, MailWebhookListOptions, MailWebhookListResult, MailWebhookUpdateInput, MailWebhookReplay, MailWebhookReplayInput, } from './mail-webhook-types.js';
|
|
27
31
|
export type { MailMessageStream, MailMessageStreamCreateInput, MailMessageStreamListResult } from './mail-streams.js';
|
|
28
32
|
export type { MailDomainReputation, MailLimits, MailManualReviewStatus, MailReputation, MailReputationEvent, MailReputationEventListOptions, MailReputationEventListResult, MailReputationEventSeverity, MailReputationStatus, MailReputationTier, MailReputationWorkspace, } from './mail-reputation-types.js';
|
|
29
|
-
export type { MailAnalytics, MailAnalyticsInput, MailAttachmentInput, MailBatch, MailBatchItem, MailBatchSendInput, MailBatchTemplateInput, MailInboundDomain, MailInboundMessage, MailScheduledCreateInput, MailScheduledMessage, } from './mail-advanced-types.js';
|
|
33
|
+
export type { MailAnalytics, MailAnalyticsRateCohort, MailAnalyticsInput, MailAttachmentInput, MailBatch, MailBatchItem, MailBatchSendInput, MailBatchTemplateInput, MailInboundDomain, MailInboundMessage, MailScheduledCreateInput, MailScheduledMessage, } from './mail-advanced-types.js';
|
|
30
34
|
export { AssetVideoClient } from './assets-video.js';
|
|
31
35
|
export type * from './assets-video-types.js';
|
|
32
36
|
export * from './mail-tracking.js';
|
|
@@ -39,3 +43,5 @@ export * from './mail-brands.js';
|
|
|
39
43
|
export * from './mail-billing.js';
|
|
40
44
|
export * from './mail-migration.js';
|
|
41
45
|
export * from './mail-marketing.js';
|
|
46
|
+
export { AICreditsClient } from './ai-credits.js';
|
|
47
|
+
export type * from './ai-credits.js';
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,8 @@ export { AssetsClient, assetTransformOptions, assetTransformPresets, assetTransf
|
|
|
3
3
|
export { AssetWorkflowsClient } from './asset-workflows.js';
|
|
4
4
|
export { AssetConnectionsClient, AssetMigrationsClient, AssetStorageClient, AssetTextClient, AssetUploadCapabilitiesClient } from './assets-platform.js';
|
|
5
5
|
export { ChunkedUploadController, UploadResumeInvalidError, putBlob, sha256Blob } from './upload-controller.js';
|
|
6
|
+
export { S2UploadsClient } from './s2.js';
|
|
7
|
+
export { S2Uploader, createS2ResumeStore } from './s2-upload.js';
|
|
6
8
|
export { createResponsiveImage, namedResponsiveSource, uploadBrowserFile } from './assets-framework.js';
|
|
7
9
|
export { assetContractOperations } from './generated/assets-contract.js';
|
|
8
10
|
export { MailBouncesClient, MailClient, MailDomainsClient, MailEventsClient, MailLimitsClient, MailMessagesClient, MailScheduledClient, MailBatchClient, MailInboundClient, MailAnalyticsClient, MailOtpChallengesClient, MailOtpClient, MailReputationClient, MailReputationEventsClient, MailSuppressionsClient, MailTemplatesClient, MailWebhooksClient, MailStreamsClient, MailAudiencesClient, MailCampaignsClient, } from './mail.js';
|
|
@@ -16,3 +18,4 @@ export * from './mail-brands.js';
|
|
|
16
18
|
export * from './mail-billing.js';
|
|
17
19
|
export * from './mail-migration.js';
|
|
18
20
|
export * from './mail-marketing.js';
|
|
21
|
+
export { AICreditsClient } from './ai-credits.js';
|
|
@@ -107,7 +107,18 @@ export interface MailAnalyticsInput {
|
|
|
107
107
|
template?: string;
|
|
108
108
|
event?: string;
|
|
109
109
|
}
|
|
110
|
+
export interface MailAnalyticsRateCohort {
|
|
111
|
+
basis: 'recipient_created_at';
|
|
112
|
+
asOf: string;
|
|
113
|
+
queued: number;
|
|
114
|
+
mtaAccepted: number;
|
|
115
|
+
delivered: number;
|
|
116
|
+
bounced: number;
|
|
117
|
+
failed: number;
|
|
118
|
+
}
|
|
110
119
|
export interface MailAnalytics {
|
|
120
|
+
rateCohort?: MailAnalyticsRateCohort;
|
|
121
|
+
previousRateCohort?: MailAnalyticsRateCohort;
|
|
111
122
|
summary: Record<string, number>;
|
|
112
123
|
series: Array<Record<string, number | string>>;
|
|
113
124
|
}
|
package/dist/mail-billing.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { StackShift } from './client.js';
|
|
2
2
|
import type { MailMode } from './mail-simulation.js';
|
|
3
3
|
export interface MailBillingSummary {
|
|
4
|
+
catalogId?: string;
|
|
5
|
+
planSlug?: string;
|
|
6
|
+
monthlyPriceKobo?: number;
|
|
7
|
+
overageAllowed?: boolean;
|
|
4
8
|
reconciliationRequired: boolean;
|
|
5
9
|
active: boolean;
|
|
6
10
|
mode: MailMode;
|
package/dist/mail-marketing.d.ts
CHANGED
|
@@ -56,12 +56,19 @@ export declare class MailFormsClient {
|
|
|
56
56
|
data: MailSignupForm[];
|
|
57
57
|
}>;
|
|
58
58
|
}
|
|
59
|
+
export interface MailSegmentCondition {
|
|
60
|
+
field: string;
|
|
61
|
+
operator: 'equals' | 'not_equals' | 'contains' | 'exists';
|
|
62
|
+
value?: string;
|
|
63
|
+
}
|
|
59
64
|
export interface MailSegmentInput {
|
|
65
|
+
match?: 'all' | 'any';
|
|
66
|
+
conditions?: MailSegmentCondition[];
|
|
60
67
|
audienceId: string;
|
|
61
68
|
name: string;
|
|
62
69
|
description?: string;
|
|
63
|
-
field
|
|
64
|
-
operator
|
|
70
|
+
field?: string;
|
|
71
|
+
operator?: string;
|
|
65
72
|
value?: string;
|
|
66
73
|
}
|
|
67
74
|
export interface MailSegment extends MailSegmentInput {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ChunkUploadRequest, ChunkUploadSession, ChunkedUploadOptions, UploadedPart, UploadResumeStore } from './upload-controller.js';
|
|
2
|
+
export interface S2UploadBackend<TResult> {
|
|
3
|
+
create(input: ChunkUploadRequest & {
|
|
4
|
+
size: number;
|
|
5
|
+
}): Promise<ChunkUploadSession>;
|
|
6
|
+
resume(context: string): Promise<ChunkUploadSession>;
|
|
7
|
+
signPart(session: ChunkUploadSession, part: UploadedPart): Promise<{
|
|
8
|
+
url: string;
|
|
9
|
+
headers?: Record<string, string>;
|
|
10
|
+
}>;
|
|
11
|
+
complete(session: ChunkUploadSession): Promise<TResult>;
|
|
12
|
+
cancel(session: ChunkUploadSession): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
/** Bind these callbacks to authenticated application-server routes. Never put permanent S3 credentials in a browser. */
|
|
15
|
+
export declare class S2Uploader<TResult> {
|
|
16
|
+
private readonly controller;
|
|
17
|
+
constructor(backend: S2UploadBackend<TResult>, store?: UploadResumeStore);
|
|
18
|
+
upload(file: Blob, request: ChunkUploadRequest, options?: ChunkedUploadOptions): Promise<TResult>;
|
|
19
|
+
cancel(resumeKey: string): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
/** Use an account-specific namespace, and clear it on logout. Stored sessions contain temporary upload capabilities. */
|
|
22
|
+
export declare function createS2ResumeStore(storage: Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>, namespace: string): UploadResumeStore;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ChunkedUploadController, putBlob } from './upload-controller.js';
|
|
2
|
+
/** Bind these callbacks to authenticated application-server routes. Never put permanent S3 credentials in a browser. */
|
|
3
|
+
export class S2Uploader {
|
|
4
|
+
controller;
|
|
5
|
+
constructor(backend, store) {
|
|
6
|
+
this.controller = new ChunkedUploadController({
|
|
7
|
+
create: (file, request) => backend.create({ ...request, size: file.size }),
|
|
8
|
+
resume: (context) => backend.resume(context),
|
|
9
|
+
uploadPart: async (session, partNumber, chunk, checksumSHA256, callbacks) => {
|
|
10
|
+
const signed = await backend.signPart(session, { partNumber, size: chunk.size, checksumSHA256 });
|
|
11
|
+
await putBlob(signed.url, chunk, callbacks, signed.headers);
|
|
12
|
+
},
|
|
13
|
+
complete: (session) => backend.complete(session),
|
|
14
|
+
cancel: (session) => backend.cancel(session),
|
|
15
|
+
}, store);
|
|
16
|
+
}
|
|
17
|
+
upload(file, request, options = {}) {
|
|
18
|
+
if (file.size === 0)
|
|
19
|
+
return Promise.reject(new Error('Use a single presigned PUT for an empty object'));
|
|
20
|
+
return this.controller.upload(file, request, { ...options, requireMatchingFile: true });
|
|
21
|
+
}
|
|
22
|
+
cancel(resumeKey) { return this.controller.cancel(resumeKey); }
|
|
23
|
+
}
|
|
24
|
+
/** Use an account-specific namespace, and clear it on logout. Stored sessions contain temporary upload capabilities. */
|
|
25
|
+
export function createS2ResumeStore(storage, namespace) {
|
|
26
|
+
if (!namespace.trim())
|
|
27
|
+
throw new Error('An account-specific upload namespace is required');
|
|
28
|
+
const key = (value) => `stackshift:s2:${encodeURIComponent(namespace)}:${encodeURIComponent(value)}`;
|
|
29
|
+
return {
|
|
30
|
+
async get(value) {
|
|
31
|
+
const raw = storage.getItem(key(value));
|
|
32
|
+
if (raw === null)
|
|
33
|
+
return undefined;
|
|
34
|
+
let record;
|
|
35
|
+
try {
|
|
36
|
+
record = JSON.parse(raw);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
throw new Error('Saved upload state is unreadable; clear it before starting again');
|
|
40
|
+
}
|
|
41
|
+
if (!record || record.key !== value || typeof record.fingerprint !== 'string' || !record.session?.id) {
|
|
42
|
+
throw new Error('Saved upload state is invalid; clear it before starting again');
|
|
43
|
+
}
|
|
44
|
+
return record;
|
|
45
|
+
},
|
|
46
|
+
async set(record) { storage.setItem(key(record.key), JSON.stringify(record)); },
|
|
47
|
+
async delete(value) { storage.removeItem(key(value)); },
|
|
48
|
+
};
|
|
49
|
+
}
|
package/dist/s2.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { StackShift } from './client.js';
|
|
2
|
+
import type { S2UploadBackend } from './s2-upload.js';
|
|
3
|
+
import type { ChunkUploadSession, UploadedPart } from './upload-controller.js';
|
|
4
|
+
export interface S2Object {
|
|
5
|
+
id: string;
|
|
6
|
+
version_id: string;
|
|
7
|
+
bucket_id: string;
|
|
8
|
+
key: string;
|
|
9
|
+
size: number;
|
|
10
|
+
etag: string;
|
|
11
|
+
checksum_sha256: string;
|
|
12
|
+
content_type: string;
|
|
13
|
+
}
|
|
14
|
+
/** Server-side adapter. Authorize the application's user and destination before forwarding browser requests. */
|
|
15
|
+
export declare class S2UploadsClient implements S2UploadBackend<S2Object> {
|
|
16
|
+
private readonly client;
|
|
17
|
+
private readonly path;
|
|
18
|
+
constructor(client: StackShift, bucketID: string);
|
|
19
|
+
create(input: {
|
|
20
|
+
key: string;
|
|
21
|
+
size: number;
|
|
22
|
+
mimeType: string;
|
|
23
|
+
}): Promise<ChunkUploadSession>;
|
|
24
|
+
resume(context: string): Promise<ChunkUploadSession>;
|
|
25
|
+
signPart(session: ChunkUploadSession, part: UploadedPart): Promise<{
|
|
26
|
+
url: string;
|
|
27
|
+
headers: {
|
|
28
|
+
[k: string]: string;
|
|
29
|
+
};
|
|
30
|
+
}>;
|
|
31
|
+
complete(session: ChunkUploadSession): Promise<S2Object>;
|
|
32
|
+
cancel(session: ChunkUploadSession): Promise<void>;
|
|
33
|
+
private action;
|
|
34
|
+
}
|
package/dist/s2.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Server-side adapter. Authorize the application's user and destination before forwarding browser requests. */
|
|
2
|
+
export class S2UploadsClient {
|
|
3
|
+
client;
|
|
4
|
+
path;
|
|
5
|
+
constructor(client, bucketID) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
if (!bucketID)
|
|
8
|
+
throw new Error('A bucket ID is required');
|
|
9
|
+
this.path = `/buckets/${encodeURIComponent(bucketID)}/uploads`;
|
|
10
|
+
}
|
|
11
|
+
create(input) {
|
|
12
|
+
return this.client.request(this.path, { method: 'POST', body: input });
|
|
13
|
+
}
|
|
14
|
+
resume(context) {
|
|
15
|
+
return this.action('resume', context);
|
|
16
|
+
}
|
|
17
|
+
async signPart(session, part) {
|
|
18
|
+
const result = await this.action('sign-part', session.uploadToken, part);
|
|
19
|
+
const headers = Object.fromEntries(Object.entries(result.headers ?? {}).map(([name, values]) => [name, values.join(', ')]));
|
|
20
|
+
return { url: result.url, headers };
|
|
21
|
+
}
|
|
22
|
+
complete(session) {
|
|
23
|
+
return this.action('complete', session.uploadToken);
|
|
24
|
+
}
|
|
25
|
+
async cancel(session) {
|
|
26
|
+
await this.action('cancel', session.uploadToken);
|
|
27
|
+
}
|
|
28
|
+
action(action, token, part) {
|
|
29
|
+
return this.client.request(`${this.path}/actions`, { method: 'POST', body: { action, token, part } });
|
|
30
|
+
}
|
|
31
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -197,6 +197,18 @@ export interface ProjectListOptions {
|
|
|
197
197
|
perPage?: number;
|
|
198
198
|
}
|
|
199
199
|
export interface Asset {
|
|
200
|
+
readiness?: {
|
|
201
|
+
state: "ready" | "processing" | "blocked" | "unknown";
|
|
202
|
+
stages: Array<{
|
|
203
|
+
id: string;
|
|
204
|
+
status: string;
|
|
205
|
+
}>;
|
|
206
|
+
actions: Record<"preview" | "download" | "edit" | "publish", {
|
|
207
|
+
state: "ready" | "blocked" | "unknown";
|
|
208
|
+
code: string;
|
|
209
|
+
message: string;
|
|
210
|
+
}>;
|
|
211
|
+
};
|
|
200
212
|
id: string;
|
|
201
213
|
bucket: string;
|
|
202
214
|
key: string;
|
|
@@ -9,6 +9,7 @@ export interface UploadedPart {
|
|
|
9
9
|
checksumSHA256?: string;
|
|
10
10
|
}
|
|
11
11
|
export interface ChunkUploadSession {
|
|
12
|
+
completionPending?: boolean;
|
|
12
13
|
id: string;
|
|
13
14
|
uploadToken: string;
|
|
14
15
|
expiresAt: string;
|
|
@@ -52,6 +53,7 @@ export interface ChunkedUploadOptions extends ChunkUploadCallbacks {
|
|
|
52
53
|
concurrency?: number;
|
|
53
54
|
retryAttempts?: number;
|
|
54
55
|
cancelOnAbort?: boolean;
|
|
56
|
+
requireMatchingFile?: boolean;
|
|
55
57
|
}
|
|
56
58
|
export declare class UploadResumeInvalidError extends Error {
|
|
57
59
|
constructor(message?: string);
|
|
@@ -16,13 +16,13 @@ export class ChunkedUploadController {
|
|
|
16
16
|
throwIfAborted(options.signal);
|
|
17
17
|
const resumeKey = options.resumeKey;
|
|
18
18
|
const fingerprint = fileFingerprint(file, request);
|
|
19
|
-
let session = await this.restore(resumeKey, fingerprint);
|
|
19
|
+
let session = await this.restore(resumeKey, fingerprint, options.requireMatchingFile);
|
|
20
20
|
if (!session)
|
|
21
21
|
session = await this.transport.create(file, request);
|
|
22
22
|
validateSession(session, file.size);
|
|
23
23
|
options.onSession?.(session);
|
|
24
24
|
await this.persist(resumeKey, fingerprint, session);
|
|
25
|
-
const completed = await verifiedCompletedParts(file, session);
|
|
25
|
+
const completed = await verifiedCompletedParts(file, session, options.requireMatchingFile);
|
|
26
26
|
const loadedByPart = new Map(completed);
|
|
27
27
|
const tasks = [];
|
|
28
28
|
for (let offset = 0, partNumber = 1; offset < file.size; offset += session.partSize, partNumber += 1) {
|
|
@@ -37,8 +37,9 @@ export class ChunkedUploadController {
|
|
|
37
37
|
const concurrency = boundedInteger(options.concurrency, 4, 1, 8);
|
|
38
38
|
const attempts = boundedInteger(options.retryAttempts, 4, 1, 8);
|
|
39
39
|
let next = 0;
|
|
40
|
+
let workerFailed = false;
|
|
40
41
|
const worker = async () => {
|
|
41
|
-
while (next < tasks.length) {
|
|
42
|
+
while (!workerFailed && next < tasks.length) {
|
|
42
43
|
throwIfAborted(options.signal);
|
|
43
44
|
const task = tasks[next++];
|
|
44
45
|
const checksum = await sha256Blob(task.chunk);
|
|
@@ -61,7 +62,16 @@ export class ChunkedUploadController {
|
|
|
61
62
|
}
|
|
62
63
|
};
|
|
63
64
|
try {
|
|
64
|
-
await Promise.
|
|
65
|
+
const workers = await Promise.allSettled(Array.from({ length: Math.min(concurrency, tasks.length || 1) }, () => worker().catch((error) => {
|
|
66
|
+
workerFailed = true;
|
|
67
|
+
throw error;
|
|
68
|
+
})));
|
|
69
|
+
const failed = workers.find((result) => result.status === 'rejected');
|
|
70
|
+
if (failed?.status === 'rejected')
|
|
71
|
+
throw failed.reason;
|
|
72
|
+
throwIfAborted(options.signal);
|
|
73
|
+
session.completionPending = true;
|
|
74
|
+
await this.persist(resumeKey, fingerprint, session);
|
|
65
75
|
const result = await retryWithBackoff(() => this.transport.complete(session), attempts, options.signal);
|
|
66
76
|
if (resumeKey)
|
|
67
77
|
await this.store?.delete(resumeKey);
|
|
@@ -69,9 +79,12 @@ export class ChunkedUploadController {
|
|
|
69
79
|
}
|
|
70
80
|
catch (error) {
|
|
71
81
|
if (isAbortError(error) && options.cancelOnAbort) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
82
|
+
try {
|
|
83
|
+
await this.transport.cancel(session);
|
|
84
|
+
if (resumeKey)
|
|
85
|
+
await this.store?.delete(resumeKey);
|
|
86
|
+
}
|
|
87
|
+
catch { /* Retain recovery state when remote cancellation is uncertain. */ }
|
|
75
88
|
}
|
|
76
89
|
throw error;
|
|
77
90
|
}
|
|
@@ -80,19 +93,24 @@ export class ChunkedUploadController {
|
|
|
80
93
|
const record = await this.store?.get(resumeKey);
|
|
81
94
|
if (!record)
|
|
82
95
|
return;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
finally {
|
|
87
|
-
await this.store?.delete(resumeKey);
|
|
88
|
-
}
|
|
96
|
+
await this.transport.cancel(record.session);
|
|
97
|
+
await this.store?.delete(resumeKey);
|
|
89
98
|
}
|
|
90
|
-
async restore(resumeKey, fingerprint) {
|
|
99
|
+
async restore(resumeKey, fingerprint, requireMatchingFile = false) {
|
|
91
100
|
if (!resumeKey || !this.store)
|
|
92
101
|
return undefined;
|
|
93
102
|
const record = await this.store.get(resumeKey);
|
|
94
103
|
if (!record)
|
|
95
104
|
return undefined;
|
|
105
|
+
if (record.fingerprint !== fingerprint && requireMatchingFile) {
|
|
106
|
+
throw new Error('Reselect the original file to resume this upload, or cancel the saved upload first');
|
|
107
|
+
}
|
|
108
|
+
if (record.fingerprint === fingerprint && record.session.completionPending) {
|
|
109
|
+
if (Date.parse(record.session.expiresAt) <= Date.now()) {
|
|
110
|
+
throw new Error('Completion is uncertain and its recovery window expired; verify the destination before clearing saved state');
|
|
111
|
+
}
|
|
112
|
+
return record.session;
|
|
113
|
+
}
|
|
96
114
|
if (record.fingerprint !== fingerprint || Date.parse(record.session.expiresAt) <= Date.now()) {
|
|
97
115
|
await this.transport.cancel(record.session).catch(() => undefined);
|
|
98
116
|
await this.store.delete(resumeKey);
|
|
@@ -117,7 +135,7 @@ export class ChunkedUploadController {
|
|
|
117
135
|
session: { ...session, parts: session.parts.map((part) => ({ ...part })) },
|
|
118
136
|
updatedAt: new Date().toISOString(),
|
|
119
137
|
};
|
|
120
|
-
this.persistence = this.persistence.then(() => this.store.set(record));
|
|
138
|
+
this.persistence = this.persistence.catch(() => undefined).then(() => this.store.set(record));
|
|
121
139
|
return this.persistence;
|
|
122
140
|
}
|
|
123
141
|
}
|
|
@@ -154,9 +172,10 @@ export async function sha256Blob(blob) {
|
|
|
154
172
|
return [...new Uint8Array(digest)].map((byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
155
173
|
}
|
|
156
174
|
function validateSession(session, size) {
|
|
157
|
-
if (!session.id || !session.uploadToken || session.partSize <= 0
|
|
175
|
+
if (!session.id || !session.uploadToken || !Number.isSafeInteger(session.partSize) || session.partSize <= 0 ||
|
|
176
|
+
!Number.isSafeInteger(session.maxBytes) || session.maxBytes < 0 || !Array.isArray(session.parts))
|
|
158
177
|
throw new Error('Upload session is incomplete');
|
|
159
|
-
if (Date.parse(session.expiresAt) <= Date.now())
|
|
178
|
+
if (!Number.isFinite(Date.parse(session.expiresAt)) || Date.parse(session.expiresAt) <= Date.now())
|
|
160
179
|
throw new Error('Upload session has expired');
|
|
161
180
|
if (size > session.maxBytes)
|
|
162
181
|
throw new Error(`File exceeds upload limit of ${session.maxBytes} bytes`);
|
|
@@ -167,7 +186,7 @@ function expectedPartSize(fileSize, partSize, partNumber) {
|
|
|
167
186
|
return -1;
|
|
168
187
|
return Math.min(partSize, fileSize - offset);
|
|
169
188
|
}
|
|
170
|
-
async function verifiedCompletedParts(file, session) {
|
|
189
|
+
async function verifiedCompletedParts(file, session, requireMatchingFile = false) {
|
|
171
190
|
const completed = new Map();
|
|
172
191
|
for (const part of session.parts) {
|
|
173
192
|
const expectedSize = expectedPartSize(file.size, session.partSize, part.partNumber);
|
|
@@ -178,6 +197,9 @@ async function verifiedCompletedParts(file, session) {
|
|
|
178
197
|
if (checksum.toLowerCase() === part.checksumSHA256.toLowerCase()) {
|
|
179
198
|
completed.set(part.partNumber, part.size);
|
|
180
199
|
}
|
|
200
|
+
else if (requireMatchingFile) {
|
|
201
|
+
throw new Error('The selected file differs from an uploaded part; reselect the original file or cancel this upload');
|
|
202
|
+
}
|
|
181
203
|
}
|
|
182
204
|
return completed;
|
|
183
205
|
}
|
|
@@ -195,6 +217,7 @@ function boundedInteger(value, fallback, minimum, maximum) {
|
|
|
195
217
|
async function retryWithBackoff(operation, attempts, signal) {
|
|
196
218
|
let lastError;
|
|
197
219
|
for (let attempt = 0; attempt < attempts; attempt += 1) {
|
|
220
|
+
throwIfAborted(signal);
|
|
198
221
|
try {
|
|
199
222
|
return await operation();
|
|
200
223
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackshift-cloud/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
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-simulation.test.mjs && node test/mail-platform.test.mjs && node test/mail-webhooks.test.mjs && node test/mail-advanced.test.mjs && node test/mail-tracking.test.mjs && node test/mail-subscribers.test.mjs && node test/mail-exports.test.mjs && node test/mail-diagnostics.test.mjs && node test/assets.test.mjs && node test/assets-platform.test.mjs && node test/assets-video.test.mjs && node test/assets-dam.test.mjs"
|
|
20
|
+
"test": "npm run build && node test/mail.test.mjs && node test/mail-simulation.test.mjs && node test/mail-platform.test.mjs && node test/mail-webhooks.test.mjs && node test/mail-advanced.test.mjs && node test/mail-tracking.test.mjs && node test/mail-subscribers.test.mjs && node test/mail-exports.test.mjs && node test/mail-diagnostics.test.mjs && node test/assets.test.mjs && node test/assets-platform.test.mjs && node test/assets-video.test.mjs && node test/assets-dam.test.mjs && node test/ai-credits.test.mjs && node --test test/s2-upload.test.mjs"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"typescript": "^5.4.0"
|