@stackshift-cloud/sdk 1.0.0 → 1.2.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 (53) hide show
  1. package/README.md +117 -0
  2. package/dist/asset-media-v2.d.ts +65 -0
  3. package/dist/asset-media-v2.js +1 -0
  4. package/dist/asset-workflows.d.ts +269 -0
  5. package/dist/asset-workflows.js +69 -0
  6. package/dist/assets-dam-types.d.ts +225 -0
  7. package/dist/assets-dam-types.js +1 -0
  8. package/dist/assets-dam.d.ts +96 -0
  9. package/dist/assets-dam.js +47 -0
  10. package/dist/assets-platform-types.d.ts +218 -0
  11. package/dist/assets-platform-types.js +1 -0
  12. package/dist/assets-platform.d.ts +55 -0
  13. package/dist/assets-platform.js +90 -0
  14. package/dist/assets-video-types.d.ts +116 -0
  15. package/dist/assets-video-types.js +1 -0
  16. package/dist/assets-video.d.ts +25 -0
  17. package/dist/assets-video.js +19 -0
  18. package/dist/assets.d.ts +21 -1
  19. package/dist/assets.js +85 -132
  20. package/dist/client.d.ts +10 -0
  21. package/dist/client.js +26 -6
  22. package/dist/generated/assets-contract.d.ts +512 -2
  23. package/dist/generated/assets-contract.js +102 -0
  24. package/dist/index.d.ts +21 -0
  25. package/dist/index.js +11 -0
  26. package/dist/mail-advanced-types.d.ts +9 -0
  27. package/dist/mail-billing.d.ts +34 -0
  28. package/dist/mail-billing.js +7 -0
  29. package/dist/mail-brands.d.ts +35 -0
  30. package/dist/mail-brands.js +17 -0
  31. package/dist/mail-campaigns.d.ts +72 -10
  32. package/dist/mail-campaigns.js +25 -2
  33. package/dist/mail-marketing.d.ts +84 -0
  34. package/dist/mail-marketing.js +24 -0
  35. package/dist/mail-migration.d.ts +16 -0
  36. package/dist/mail-migration.js +10 -0
  37. package/dist/mail-otp-types.d.ts +4 -0
  38. package/dist/mail-simulation.d.ts +4 -0
  39. package/dist/mail-simulation.js +1 -0
  40. package/dist/mail-subscribers.d.ts +39 -0
  41. package/dist/mail-subscribers.js +1 -0
  42. package/dist/mail-template-types.d.ts +8 -0
  43. package/dist/mail-tracking.d.ts +59 -0
  44. package/dist/mail-tracking.js +14 -0
  45. package/dist/mail-webhook-types.d.ts +4 -1
  46. package/dist/mail.d.ts +12 -0
  47. package/dist/mail.js +19 -0
  48. package/dist/types.d.ts +19 -0
  49. package/dist/upload-controller.d.ts +70 -0
  50. package/dist/upload-controller.js +223 -0
  51. package/dist/workload-security.d.ts +172 -0
  52. package/dist/workload-security.js +50 -0
  53. package/package.json +2 -2
@@ -0,0 +1,16 @@
1
+ import type { StackShift } from './client.js';
2
+ export interface MailMigrationChecklist {
3
+ domain: string;
4
+ provider: string;
5
+ completed: string[];
6
+ revision: number;
7
+ updatedAt?: string;
8
+ }
9
+ export declare class MailMigrationClient {
10
+ private readonly client;
11
+ constructor(client: StackShift);
12
+ audit(domain: string, selectors?: string[]): Promise<Record<string, unknown>>;
13
+ plan(domain: string, provider: string, selectors?: string[]): Promise<Record<string, unknown>>;
14
+ checklist(domain: string, provider: string): Promise<MailMigrationChecklist>;
15
+ saveChecklist(input: MailMigrationChecklist): Promise<MailMigrationChecklist>;
16
+ }
@@ -0,0 +1,10 @@
1
+ export class MailMigrationClient {
2
+ client;
3
+ constructor(client) {
4
+ this.client = client;
5
+ }
6
+ audit(domain, selectors = []) { return this.client.request(`/mail/audit?${new URLSearchParams({ domain, selectors: selectors.join(',') })}`); }
7
+ plan(domain, provider, selectors = []) { return this.client.request(`/mail/migration-plan?${new URLSearchParams({ domain, provider, selectors: selectors.join(',') })}`); }
8
+ checklist(domain, provider) { return this.client.mailRequest(`/mail/migration/checklist?${new URLSearchParams({ domain, provider })}`); }
9
+ saveChecklist(input) { return this.client.mailRequest('/mail/migration/checklist', { method: 'PUT', body: { domain: input.domain, provider: input.provider, completed: input.completed, revision: input.revision } }); }
10
+ }
@@ -1,6 +1,8 @@
1
+ import type { MailMode, MailSimulationOptions } from './mail-simulation.js';
1
2
  import type { JsonValue } from './types.js';
2
3
  export type MailOtpStatus = 'pending' | 'verified' | 'expired' | 'failed' | 'canceled';
3
4
  export interface MailOtpSendInput {
5
+ simulation?: MailSimulationOptions;
4
6
  to: string;
5
7
  purpose: string;
6
8
  from?: string;
@@ -25,6 +27,7 @@ export interface MailOtpChallengeListOptions {
25
27
  cursor?: string;
26
28
  }
27
29
  export interface MailOtpChallenge {
30
+ mode?: MailMode;
28
31
  id: string;
29
32
  to: string;
30
33
  purpose: string;
@@ -46,6 +49,7 @@ export interface MailOtpChallengeListResult {
46
49
  nextCursor?: string | null;
47
50
  }
48
51
  export interface MailOtpSendResponse {
52
+ mode?: MailMode;
49
53
  id: string;
50
54
  to: string;
51
55
  purpose: string;
@@ -0,0 +1,4 @@
1
+ export type MailMode = 'live' | 'test';
2
+ export interface MailSimulationOptions {
3
+ scenario: 'delivered' | 'bounced' | 'complained' | 'delayed';
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,39 @@
1
+ export type MailImportMode = 'recorded_consent' | 'confirmation';
2
+ export interface MailImportRow {
3
+ row: number;
4
+ email: string;
5
+ outcome: 'imported' | 'updated' | 'invalid' | 'skipped';
6
+ code: string;
7
+ reason: string;
8
+ status?: string;
9
+ }
10
+ export interface MailImportResult {
11
+ imported: number;
12
+ skipped: number;
13
+ summary: {
14
+ imported: number;
15
+ updated: number;
16
+ invalid: number;
17
+ skipped: number;
18
+ pending: number;
19
+ };
20
+ rows: MailImportRow[];
21
+ preview: boolean;
22
+ }
23
+ export interface MailSendingDomainHealth {
24
+ state: 'healthy' | 'suspect' | 'degraded';
25
+ lastResult: 'verified' | 'failed' | 'indeterminate' | 'unknown';
26
+ lastCheckedAt: string | null;
27
+ lastSuccessAt: string | null;
28
+ nextCheckAt: string;
29
+ degradedAt: string | null;
30
+ issues: {
31
+ type?: string;
32
+ record: string;
33
+ name: string;
34
+ expected: string;
35
+ observed: string[];
36
+ status: string;
37
+ scope: 'customer' | 'platform';
38
+ }[];
39
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,5 @@
1
+ import type { MailMode, MailSimulationOptions } from './mail-simulation.js';
2
+ import type { MailTrackingOptions } from './mail-tracking.js';
1
3
  import type { JsonValue, MailAddressInput, MailIdempotencyStatus, MailStatus } from './types.js';
2
4
  export type MailTemplateStatus = 'active' | 'archived' | 'deleted';
3
5
  export interface MailTemplateCreateInput {
@@ -22,6 +24,7 @@ export interface MailTemplateListOptions {
22
24
  search?: string;
23
25
  }
24
26
  export interface MailTemplate {
27
+ mode?: MailMode;
25
28
  id: string;
26
29
  name: string;
27
30
  slug: string;
@@ -61,16 +64,20 @@ export interface MailTemplatePreviewInput {
61
64
  versionId?: string;
62
65
  }
63
66
  export interface MailTemplateTestSendInput {
67
+ simulation?: MailSimulationOptions;
64
68
  to: MailAddressInput;
65
69
  from?: MailAddressInput;
66
70
  data: Record<string, JsonValue>;
67
71
  versionId?: string;
68
72
  }
69
73
  export interface MailTemplateTestSendResponse {
74
+ mode?: MailMode;
70
75
  messageId: string;
71
76
  status: MailStatus;
72
77
  }
73
78
  export interface MailSendTemplateInput {
79
+ simulation?: MailSimulationOptions;
80
+ tracking?: MailTrackingOptions;
74
81
  template: string;
75
82
  versionId?: string;
76
83
  to: MailAddressInput;
@@ -88,6 +95,7 @@ export interface MailSendTemplateInput {
88
95
  }>;
89
96
  }
90
97
  export interface MailSendTemplateResponse {
98
+ mode?: MailMode;
91
99
  id: string;
92
100
  status: MailStatus;
93
101
  templateId: string;
@@ -0,0 +1,59 @@
1
+ import type { StackShift } from './client.js';
2
+ export interface MailTrackingOptions {
3
+ opens?: boolean;
4
+ clicks?: boolean;
5
+ }
6
+ export interface MailTrackingSettings {
7
+ opens: boolean;
8
+ clicks: boolean;
9
+ }
10
+ export interface MailEngagementCount {
11
+ kind: 'open' | 'click';
12
+ variant: string;
13
+ link?: string;
14
+ total: number;
15
+ unique: number;
16
+ suspectedAutomated: number;
17
+ firstAt?: string;
18
+ lastAt?: string;
19
+ }
20
+ export interface MailEngagementReport {
21
+ counts: MailEngagementCount[];
22
+ openEligible: number;
23
+ clickEligible: number;
24
+ openEngagedDelivered: number;
25
+ clickEngagedDelivered: number;
26
+ openDelivered: number;
27
+ clickDelivered: number;
28
+ scope: 'message' | 'recipient';
29
+ retentionDays: number;
30
+ }
31
+ export interface MailTrackingDomain {
32
+ id: string;
33
+ domainId: string;
34
+ hostname: string;
35
+ ownershipToken: string;
36
+ enabled: boolean;
37
+ status: 'pending' | 'provisioning' | 'active' | 'degraded' | 'revoked';
38
+ checkedAt?: string;
39
+ dnsValidUntil?: string;
40
+ }
41
+ export declare class MailTrackingClient {
42
+ private readonly client;
43
+ constructor(client: StackShift);
44
+ settings(): Promise<{
45
+ settings: MailTrackingSettings;
46
+ available: boolean;
47
+ }>;
48
+ updateSettings(input: MailTrackingSettings): Promise<MailTrackingSettings>;
49
+ message(id: string): Promise<MailEngagementReport>;
50
+ campaign(id: string): Promise<MailEngagementReport>;
51
+ domains(): Promise<{
52
+ data: MailTrackingDomain[];
53
+ target: string;
54
+ available: boolean;
55
+ }>;
56
+ createDomain(domainId: string, hostname: string): Promise<MailTrackingDomain>;
57
+ verifyDomain(id: string): Promise<MailTrackingDomain>;
58
+ updateDomain(id: string, enabled: boolean, revoke?: boolean): Promise<void>;
59
+ }
@@ -0,0 +1,14 @@
1
+ export class MailTrackingClient {
2
+ client;
3
+ constructor(client) {
4
+ this.client = client;
5
+ }
6
+ settings() { return this.client.mailRequest('/mail/tracking/settings'); }
7
+ updateSettings(input) { return this.client.mailRequest('/mail/tracking/settings', { method: 'PUT', body: input }); }
8
+ message(id) { return this.client.mailRequest(`/mail/messages/${encodeURIComponent(id)}/engagement`); }
9
+ campaign(id) { return this.client.mailRequest(`/mail/campaigns/${encodeURIComponent(id)}/engagement`); }
10
+ domains() { return this.client.mailRequest('/mail/tracking/domains'); }
11
+ createDomain(domainId, hostname) { return this.client.mailRequest('/mail/tracking/domains', { method: 'POST', body: { domainId, hostname } }); }
12
+ verifyDomain(id) { return this.client.mailRequest(`/mail/tracking/domains/${encodeURIComponent(id)}/verify`, { method: 'POST' }); }
13
+ updateDomain(id, enabled, revoke = false) { return this.client.mailRequest(`/mail/tracking/domains/${encodeURIComponent(id)}`, { method: 'PUT', body: { enabled, revoke } }); }
14
+ }
@@ -1,6 +1,8 @@
1
+ import type { MailMode } from './mail-simulation.js';
1
2
  import type { JsonValue } from './types.js';
2
- export type MailEventType = 'mail.message.accepted' | 'mail.message.queued' | 'mail.message.sending' | 'mail.message.mta_accepted' | 'mail.delivery.delayed' | 'mail.delivery.delivered' | 'mail.message.failed' | 'mail.message.bounced' | 'mail.message.suppressed' | 'mail.message.complained' | 'mail.suppression.created' | 'mail.suppression.deleted' | 'mail.otp.created' | 'mail.otp.sent' | 'mail.otp.verified' | 'mail.otp.failed_attempt' | 'mail.otp.failed' | 'mail.otp.expired' | 'mail.otp.canceled' | 'mail.template.created' | 'mail.template.updated' | 'mail.template.deleted' | 'mail.template.version.created' | 'mail.template.test_queued' | 'mail.domain.created' | 'mail.domain.verified' | 'mail.domain.failed' | 'mail.domain.deleted' | 'mail.webhook.created' | 'mail.webhook.updated' | 'mail.webhook.disabled' | 'mail.webhook.delivery.succeeded' | 'mail.webhook.delivery.failed' | 'mail.audience.created' | 'mail.audience.members.imported' | 'mail.campaign.created' | 'mail.campaign.queued';
3
+ export type MailEventType = 'mail.message.opened' | 'mail.message.clicked' | 'mail.message.accepted' | 'mail.message.queued' | 'mail.message.sending' | 'mail.message.mta_accepted' | 'mail.delivery.delayed' | 'mail.delivery.delivered' | 'mail.message.failed' | 'mail.message.bounced' | 'mail.message.suppressed' | 'mail.message.complained' | 'mail.suppression.created' | 'mail.suppression.deleted' | 'mail.otp.created' | 'mail.otp.sent' | 'mail.otp.verified' | 'mail.otp.failed_attempt' | 'mail.otp.failed' | 'mail.otp.expired' | 'mail.otp.canceled' | 'mail.template.created' | 'mail.template.updated' | 'mail.template.deleted' | 'mail.template.version.created' | 'mail.template.test_queued' | 'mail.domain.created' | 'mail.domain.verified' | 'mail.domain.failed' | 'mail.domain.deleted' | 'mail.webhook.created' | 'mail.webhook.updated' | 'mail.webhook.disabled' | 'mail.webhook.delivery.succeeded' | 'mail.webhook.delivery.failed' | 'mail.audience.created' | 'mail.audience.members.imported' | 'mail.campaign.created' | 'mail.campaign.queued';
3
4
  export interface MailEvent {
5
+ mode?: MailMode;
4
6
  id: string;
5
7
  type: MailEventType | string;
6
8
  resourceType?: string | null;
@@ -64,6 +66,7 @@ export interface MailWebhookListResult {
64
66
  nextCursor?: string | null;
65
67
  }
66
68
  export interface MailWebhookDelivery {
69
+ mode?: MailMode;
67
70
  id: string;
68
71
  endpointId: string;
69
72
  eventId: string;
package/dist/mail.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ import { MailAutomationsClient, MailFormsClient, MailSegmentsClient } from './mail-marketing.js';
2
+ import { MailBillingClient } from './mail-billing.js';
3
+ import { MailMigrationClient } from './mail-migration.js';
4
+ import { MailBrandsClient } from './mail-brands.js';
5
+ import { MailTrackingClient } from './mail-tracking.js';
1
6
  import type { StackShift } from './client.js';
2
7
  import type { MailLog, MailDomain, MailDomainListResult, MailMessage, MailMessageListOptions, MailMessageListResult, MailSendAttempt, MailSendInput, MailSendResponse } from './types.js';
3
8
  import type { MailBounce, MailBounceListOptions, MailBounceListResult, MailSuppression, MailSuppressionCreateInput, MailSuppressionListOptions, MailSuppressionListResult } from './mail-delivery-types.js';
@@ -17,6 +22,10 @@ export { MailExportsClient } from './mail-exports.js';
17
22
  import type { MailTemplateDiagnosticInput, MailTemplateDiagnosticResult } from './mail-diagnostics.js';
18
23
  export declare class MailClient {
19
24
  private readonly client;
25
+ readonly automations: MailAutomationsClient;
26
+ readonly forms: MailFormsClient;
27
+ readonly segments: MailSegmentsClient;
28
+ readonly tracking: MailTrackingClient;
20
29
  readonly domains: MailDomainsClient;
21
30
  readonly messages: MailMessagesClient;
22
31
  readonly suppressions: MailSuppressionsClient;
@@ -26,6 +35,9 @@ export declare class MailClient {
26
35
  readonly events: MailEventsClient;
27
36
  readonly webhooks: MailWebhooksClient;
28
37
  readonly streams: MailStreamsClient;
38
+ readonly billing: MailBillingClient;
39
+ readonly migration: MailMigrationClient;
40
+ readonly brands: MailBrandsClient;
29
41
  readonly audiences: MailAudiencesClient;
30
42
  readonly campaigns: MailCampaignsClient;
31
43
  readonly exports: MailExportsClient;
package/dist/mail.js CHANGED
@@ -1,3 +1,8 @@
1
+ import { MailAutomationsClient, MailFormsClient, MailSegmentsClient } from './mail-marketing.js';
2
+ import { MailBillingClient } from './mail-billing.js';
3
+ import { MailMigrationClient } from './mail-migration.js';
4
+ import { MailBrandsClient } from './mail-brands.js';
5
+ import { MailTrackingClient } from './mail-tracking.js';
1
6
  import { MailAnalyticsClient, MailBatchClient, MailInboundClient, MailScheduledClient } from './mail-advanced.js';
2
7
  export { MailAnalyticsClient, MailBatchClient, MailInboundClient, MailScheduledClient } from './mail-advanced.js';
3
8
  export { MailEventsClient, MailWebhooksClient, verifyWebhookSignature } from './mail-events-webhooks.js';
@@ -10,6 +15,10 @@ import { MailExportsClient } from './mail-exports.js';
10
15
  export { MailExportsClient } from './mail-exports.js';
11
16
  export class MailClient {
12
17
  client;
18
+ automations;
19
+ forms;
20
+ segments;
21
+ tracking;
13
22
  domains;
14
23
  messages;
15
24
  suppressions;
@@ -19,6 +28,9 @@ export class MailClient {
19
28
  events;
20
29
  webhooks;
21
30
  streams;
31
+ billing;
32
+ migration;
33
+ brands;
22
34
  audiences;
23
35
  campaigns;
24
36
  exports;
@@ -30,6 +42,7 @@ export class MailClient {
30
42
  analytics;
31
43
  constructor(client) {
32
44
  this.client = client;
45
+ this.tracking = new MailTrackingClient(client);
33
46
  this.domains = new MailDomainsClient(client);
34
47
  this.messages = new MailMessagesClient(client);
35
48
  this.suppressions = new MailSuppressionsClient(client);
@@ -39,6 +52,12 @@ export class MailClient {
39
52
  this.events = new MailEventsClient(client);
40
53
  this.webhooks = new MailWebhooksClient(client);
41
54
  this.streams = new MailStreamsClient(client);
55
+ this.billing = new MailBillingClient(client);
56
+ this.automations = new MailAutomationsClient(client);
57
+ this.forms = new MailFormsClient(client);
58
+ this.segments = new MailSegmentsClient(client);
59
+ this.migration = new MailMigrationClient(client);
60
+ this.brands = new MailBrandsClient(client);
42
61
  this.audiences = new MailAudiencesClient(client);
43
62
  this.campaigns = new MailCampaignsClient(client);
44
63
  this.exports = new MailExportsClient(client);
package/dist/types.d.ts CHANGED
@@ -1,8 +1,11 @@
1
+ import type { MailMode, MailSimulationOptions } from './mail-simulation.js';
2
+ import type { MailTrackingOptions } from './mail-tracking.js';
1
3
  export type JsonValue = string | number | boolean | null | JsonValue[] | {
2
4
  [key: string]: JsonValue;
3
5
  };
4
6
  export type AssetVisibility = 'public' | 'private';
5
7
  export interface StackShiftOptions {
8
+ assetSpaceId?: string;
6
9
  apiKey?: string;
7
10
  baseUrl?: string;
8
11
  mailBaseUrl?: string;
@@ -23,6 +26,7 @@ export interface MailDnsRecord {
23
26
  explanation?: string;
24
27
  }
25
28
  export interface MailDomain {
29
+ health?: import('./mail-subscribers.js').MailSendingDomainHealth;
26
30
  id: string;
27
31
  domain: string;
28
32
  status: MailDomainStatus;
@@ -45,6 +49,8 @@ export interface MailAddress {
45
49
  }
46
50
  export type MailAddressInput = string | MailAddress | Array<string | MailAddress>;
47
51
  export interface MailSendInput {
52
+ simulation?: MailSimulationOptions;
53
+ tracking?: MailTrackingOptions;
48
54
  from: string | MailAddress;
49
55
  to: MailAddressInput;
50
56
  cc?: MailAddressInput;
@@ -67,11 +73,13 @@ export interface MailSendInput {
67
73
  stream?: string;
68
74
  }
69
75
  export interface MailSendResponse {
76
+ mode?: MailMode;
70
77
  id: string;
71
78
  status: MailStatus;
72
79
  idempotencyStatus: MailIdempotencyStatus;
73
80
  }
74
81
  export interface MailMessage {
82
+ mode?: MailMode;
75
83
  id: string;
76
84
  from: MailAddress;
77
85
  to: string[];
@@ -138,6 +146,7 @@ export interface MailRecipientSummary {
138
146
  complained: number;
139
147
  }
140
148
  export interface MailMessageSummary {
149
+ mode?: MailMode;
141
150
  id: string;
142
151
  from: string;
143
152
  to: string[];
@@ -269,6 +278,7 @@ export interface AssetVersion {
269
278
  created_at: string;
270
279
  }
271
280
  export interface AssetCollection {
281
+ revision: number;
272
282
  id: string;
273
283
  name: string;
274
284
  description?: string;
@@ -298,6 +308,9 @@ export interface AssetUploadOptions {
298
308
  metadata?: Record<string, JsonValue>;
299
309
  }
300
310
  export interface AssetListOptions {
311
+ collectionId?: string;
312
+ duplicates?: boolean;
313
+ security?: 'all' | 'clean' | 'pending' | 'failed';
301
314
  bucket?: string;
302
315
  prefix?: string;
303
316
  visibility?: AssetVisibility;
@@ -362,6 +375,12 @@ export interface AssetBucket {
362
375
  allowed_origins: string[];
363
376
  lifecycle_policy: Record<string, unknown>;
364
377
  custom_domain_id?: string;
378
+ storage_mode: 'managed' | 'byob' | 'stackshift_s2';
379
+ connection_id?: string;
380
+ s2_bucket_id?: string;
381
+ object_prefix: string;
382
+ derivative_prefix: string;
383
+ auto_extract_text: boolean;
365
384
  revision: number;
366
385
  created_at: string;
367
386
  updated_at: string;
@@ -0,0 +1,70 @@
1
+ export interface UploadProgress {
2
+ loaded: number;
3
+ total: number;
4
+ percent: number;
5
+ }
6
+ export interface UploadedPart {
7
+ partNumber: number;
8
+ size: number;
9
+ checksumSHA256?: string;
10
+ }
11
+ export interface ChunkUploadSession {
12
+ id: string;
13
+ uploadToken: string;
14
+ expiresAt: string;
15
+ maxBytes: number;
16
+ partSize: number;
17
+ parts: UploadedPart[];
18
+ resumeContext?: string;
19
+ }
20
+ export interface ChunkUploadRequest {
21
+ key: string;
22
+ fileName: string;
23
+ mimeType: string;
24
+ metadata?: Record<string, unknown>;
25
+ }
26
+ export interface ChunkUploadCallbacks {
27
+ signal?: AbortSignal;
28
+ onProgress?: (progress: UploadProgress) => void;
29
+ onPartProgress?: (partNumber: number, progress: UploadProgress) => void;
30
+ onSession?: (session: ChunkUploadSession) => void;
31
+ }
32
+ export interface ChunkUploadTransport<TResult> {
33
+ create(file: Blob, request: ChunkUploadRequest): Promise<ChunkUploadSession>;
34
+ resume(resumeContext: string): Promise<ChunkUploadSession>;
35
+ uploadPart(session: ChunkUploadSession, partNumber: number, chunk: Blob, checksum: string, callbacks: ChunkUploadCallbacks): Promise<void>;
36
+ complete(session: ChunkUploadSession): Promise<TResult>;
37
+ cancel(session: ChunkUploadSession): Promise<void>;
38
+ }
39
+ export interface UploadResumeRecord {
40
+ key: string;
41
+ fingerprint: string;
42
+ session: ChunkUploadSession;
43
+ updatedAt: string;
44
+ }
45
+ export interface UploadResumeStore {
46
+ get(key: string): Promise<UploadResumeRecord | undefined>;
47
+ set(record: UploadResumeRecord): Promise<void>;
48
+ delete(key: string): Promise<void>;
49
+ }
50
+ export interface ChunkedUploadOptions extends ChunkUploadCallbacks {
51
+ resumeKey?: string;
52
+ concurrency?: number;
53
+ retryAttempts?: number;
54
+ cancelOnAbort?: boolean;
55
+ }
56
+ export declare class UploadResumeInvalidError extends Error {
57
+ constructor(message?: string);
58
+ }
59
+ export declare class ChunkedUploadController<TResult> {
60
+ private readonly transport;
61
+ private readonly store?;
62
+ private persistence;
63
+ constructor(transport: ChunkUploadTransport<TResult>, store?: UploadResumeStore | undefined);
64
+ upload(file: Blob, request: ChunkUploadRequest, options?: ChunkedUploadOptions): Promise<TResult>;
65
+ cancel(resumeKey: string): Promise<void>;
66
+ private restore;
67
+ private persist;
68
+ }
69
+ export declare function putBlob(url: string, blob: Blob, callbacks?: ChunkUploadCallbacks, headers?: Record<string, string>, fetcher?: typeof fetch): Promise<void>;
70
+ export declare function sha256Blob(blob: Blob): Promise<string>;