@cloudflare/workers-types 4.20260331.1 → 4.20260402.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.
@@ -2409,7 +2409,7 @@ interface Queue<Body = unknown> {
2409
2409
  interface QueueSendMetrics {
2410
2410
  backlogCount: number;
2411
2411
  backlogBytes: number;
2412
- oldestMessageTimestamp: number;
2412
+ oldestMessageTimestamp?: Date;
2413
2413
  }
2414
2414
  interface QueueSendMetadata {
2415
2415
  metrics: QueueSendMetrics;
@@ -2420,7 +2420,7 @@ interface QueueSendResponse {
2420
2420
  interface QueueSendBatchMetrics {
2421
2421
  backlogCount: number;
2422
2422
  backlogBytes: number;
2423
- oldestMessageTimestamp: number;
2423
+ oldestMessageTimestamp?: Date;
2424
2424
  }
2425
2425
  interface QueueSendBatchMetadata {
2426
2426
  metrics: QueueSendBatchMetrics;
@@ -2443,12 +2443,12 @@ interface MessageSendRequest<Body = unknown> {
2443
2443
  interface QueueMetrics {
2444
2444
  backlogCount: number;
2445
2445
  backlogBytes: number;
2446
- oldestMessageTimestamp: number;
2446
+ oldestMessageTimestamp?: Date;
2447
2447
  }
2448
2448
  interface MessageBatchMetrics {
2449
2449
  backlogCount: number;
2450
2450
  backlogBytes: number;
2451
- oldestMessageTimestamp: number;
2451
+ oldestMessageTimestamp?: Date;
2452
2452
  }
2453
2453
  interface MessageBatchMetadata {
2454
2454
  metrics: MessageBatchMetrics;
@@ -3933,6 +3933,28 @@ interface EventSourceEventSourceInit {
3933
3933
  withCredentials?: boolean;
3934
3934
  fetcher?: Fetcher;
3935
3935
  }
3936
+ interface ExecOutput {
3937
+ readonly stdout: ArrayBuffer;
3938
+ readonly stderr: ArrayBuffer;
3939
+ readonly exitCode: number;
3940
+ }
3941
+ interface ContainerExecOptions {
3942
+ cwd?: string;
3943
+ env?: Record<string, string>;
3944
+ user?: string;
3945
+ stdin?: ReadableStream | "pipe";
3946
+ stdout?: "pipe" | "ignore";
3947
+ stderr?: "pipe" | "ignore" | "combined";
3948
+ }
3949
+ interface ExecProcess {
3950
+ readonly stdin: WritableStream | null;
3951
+ readonly stdout: ReadableStream | null;
3952
+ readonly stderr: ReadableStream | null;
3953
+ readonly pid: number;
3954
+ readonly exitCode: Promise<number>;
3955
+ output(): Promise<ExecOutput>;
3956
+ kill(signal?: number): void;
3957
+ }
3936
3958
  interface Container {
3937
3959
  get running(): boolean;
3938
3960
  start(options?: ContainerStartupOptions): void;
@@ -3943,13 +3965,14 @@ interface Container {
3943
3965
  setInactivityTimeout(durationMs: number | bigint): Promise<void>;
3944
3966
  interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
3945
3967
  interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
3946
- interceptOutboundHttps(addr: string, binding: Fetcher): Promise<void>;
3947
3968
  snapshotDirectory(
3948
3969
  options: ContainerDirectorySnapshotOptions,
3949
3970
  ): Promise<ContainerDirectorySnapshot>;
3950
3971
  snapshotContainer(
3951
3972
  options: ContainerSnapshotOptions,
3952
3973
  ): Promise<ContainerSnapshot>;
3974
+ interceptOutboundHttps(addr: string, binding: Fetcher): Promise<void>;
3975
+ exec(cmd: string[], options?: ContainerExecOptions): Promise<ExecProcess>;
3953
3976
  }
3954
3977
  interface ContainerDirectorySnapshot {
3955
3978
  id: string;
@@ -12924,19 +12947,37 @@ interface ImageList {
12924
12947
  cursor?: string;
12925
12948
  listComplete: boolean;
12926
12949
  }
12927
- interface HostedImagesBinding {
12950
+ interface ImageHandle {
12928
12951
  /**
12929
- * Get detailed metadata for a hosted image
12930
- * @param imageId The ID of the image (UUID or custom ID)
12952
+ * Get metadata for a hosted image
12931
12953
  * @returns Image metadata, or null if not found
12932
12954
  */
12933
- details(imageId: string): Promise<ImageMetadata | null>;
12955
+ details(): Promise<ImageMetadata | null>;
12934
12956
  /**
12935
12957
  * Get the raw image data for a hosted image
12936
- * @param imageId The ID of the image (UUID or custom ID)
12937
12958
  * @returns ReadableStream of image bytes, or null if not found
12938
12959
  */
12939
- image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
12960
+ bytes(): Promise<ReadableStream<Uint8Array> | null>;
12961
+ /**
12962
+ * Update hosted image metadata
12963
+ * @param options Properties to update
12964
+ * @returns Updated image metadata
12965
+ * @throws {@link ImagesError} if update fails
12966
+ */
12967
+ update(options: ImageUpdateOptions): Promise<ImageMetadata>;
12968
+ /**
12969
+ * Delete a hosted image
12970
+ * @returns True if deleted, false if not found
12971
+ */
12972
+ delete(): Promise<boolean>;
12973
+ }
12974
+ interface HostedImagesBinding {
12975
+ /**
12976
+ * Get a handle for a hosted image
12977
+ * @param imageId The ID of the image (UUID or custom ID)
12978
+ * @returns A handle for per-image operations
12979
+ */
12980
+ image(imageId: string): ImageHandle;
12940
12981
  /**
12941
12982
  * Upload a new hosted image
12942
12983
  * @param image The image file to upload
@@ -12948,20 +12989,6 @@ interface HostedImagesBinding {
12948
12989
  image: ReadableStream<Uint8Array> | ArrayBuffer,
12949
12990
  options?: ImageUploadOptions,
12950
12991
  ): Promise<ImageMetadata>;
12951
- /**
12952
- * Update hosted image metadata
12953
- * @param imageId The ID of the image
12954
- * @param options Properties to update
12955
- * @returns Updated image metadata
12956
- * @throws {@link ImagesError} if update fails
12957
- */
12958
- update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
12959
- /**
12960
- * Delete a hosted image
12961
- * @param imageId The ID of the image
12962
- * @returns True if deleted, false if not found
12963
- */
12964
- delete(imageId: string): Promise<boolean>;
12965
12992
  /**
12966
12993
  * List hosted images with pagination
12967
12994
  * @param options List configuration
@@ -14037,14 +14064,13 @@ interface StreamScopedCaptions {
14037
14064
  * Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.
14038
14065
  * One caption or subtitle file per language is allowed.
14039
14066
  * @param language The BCP 47 language tag for the caption or subtitle.
14040
- * @param file The caption or subtitle file to upload.
14067
+ * @param input The caption or subtitle stream to upload.
14041
14068
  * @returns The created caption entry.
14042
14069
  * @throws {NotFoundError} if the video is not found
14043
14070
  * @throws {BadRequestError} if the language or file is invalid
14044
- * @throws {MaxFileSizeError} if the file size is too large
14045
14071
  * @throws {InternalError} if an unexpected error occurs
14046
14072
  */
14047
- upload(language: string, file: File): Promise<StreamCaption>;
14073
+ upload(language: string, input: ReadableStream): Promise<StreamCaption>;
14048
14074
  /**
14049
14075
  * Generate captions or subtitles for the provided language via AI.
14050
14076
  * @param language The BCP 47 language tag to generate.
@@ -14120,17 +14146,16 @@ interface StreamVideos {
14120
14146
  interface StreamWatermarks {
14121
14147
  /**
14122
14148
  * Generate a new watermark profile
14123
- * @param file The image file to upload
14149
+ * @param input The image stream to upload
14124
14150
  * @param params The watermark creation parameters.
14125
14151
  * @returns The created watermark profile.
14126
14152
  * @throws {BadRequestError} if the parameters are invalid
14127
14153
  * @throws {InvalidURLError} if the URL is invalid
14128
- * @throws {MaxFileSizeError} if the file size is too large
14129
14154
  * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
14130
14155
  * @throws {InternalError} if an unexpected error occurs
14131
14156
  */
14132
14157
  generate(
14133
- file: File,
14158
+ input: ReadableStream,
14134
14159
  params: StreamWatermarkCreateParams,
14135
14160
  ): Promise<StreamWatermark>;
14136
14161
  /**
@@ -14140,7 +14165,6 @@ interface StreamWatermarks {
14140
14165
  * @returns The created watermark profile.
14141
14166
  * @throws {BadRequestError} if the parameters are invalid
14142
14167
  * @throws {InvalidURLError} if the URL is invalid
14143
- * @throws {MaxFileSizeError} if the file size is too large
14144
14168
  * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
14145
14169
  * @throws {InternalError} if an unexpected error occurs
14146
14170
  */
@@ -2412,7 +2412,7 @@ export interface Queue<Body = unknown> {
2412
2412
  export interface QueueSendMetrics {
2413
2413
  backlogCount: number;
2414
2414
  backlogBytes: number;
2415
- oldestMessageTimestamp: number;
2415
+ oldestMessageTimestamp?: Date;
2416
2416
  }
2417
2417
  export interface QueueSendMetadata {
2418
2418
  metrics: QueueSendMetrics;
@@ -2423,7 +2423,7 @@ export interface QueueSendResponse {
2423
2423
  export interface QueueSendBatchMetrics {
2424
2424
  backlogCount: number;
2425
2425
  backlogBytes: number;
2426
- oldestMessageTimestamp: number;
2426
+ oldestMessageTimestamp?: Date;
2427
2427
  }
2428
2428
  export interface QueueSendBatchMetadata {
2429
2429
  metrics: QueueSendBatchMetrics;
@@ -2446,12 +2446,12 @@ export interface MessageSendRequest<Body = unknown> {
2446
2446
  export interface QueueMetrics {
2447
2447
  backlogCount: number;
2448
2448
  backlogBytes: number;
2449
- oldestMessageTimestamp: number;
2449
+ oldestMessageTimestamp?: Date;
2450
2450
  }
2451
2451
  export interface MessageBatchMetrics {
2452
2452
  backlogCount: number;
2453
2453
  backlogBytes: number;
2454
- oldestMessageTimestamp: number;
2454
+ oldestMessageTimestamp?: Date;
2455
2455
  }
2456
2456
  export interface MessageBatchMetadata {
2457
2457
  metrics: MessageBatchMetrics;
@@ -3939,6 +3939,28 @@ export interface EventSourceEventSourceInit {
3939
3939
  withCredentials?: boolean;
3940
3940
  fetcher?: Fetcher;
3941
3941
  }
3942
+ export interface ExecOutput {
3943
+ readonly stdout: ArrayBuffer;
3944
+ readonly stderr: ArrayBuffer;
3945
+ readonly exitCode: number;
3946
+ }
3947
+ export interface ContainerExecOptions {
3948
+ cwd?: string;
3949
+ env?: Record<string, string>;
3950
+ user?: string;
3951
+ stdin?: ReadableStream | "pipe";
3952
+ stdout?: "pipe" | "ignore";
3953
+ stderr?: "pipe" | "ignore" | "combined";
3954
+ }
3955
+ export interface ExecProcess {
3956
+ readonly stdin: WritableStream | null;
3957
+ readonly stdout: ReadableStream | null;
3958
+ readonly stderr: ReadableStream | null;
3959
+ readonly pid: number;
3960
+ readonly exitCode: Promise<number>;
3961
+ output(): Promise<ExecOutput>;
3962
+ kill(signal?: number): void;
3963
+ }
3942
3964
  export interface Container {
3943
3965
  get running(): boolean;
3944
3966
  start(options?: ContainerStartupOptions): void;
@@ -3949,13 +3971,14 @@ export interface Container {
3949
3971
  setInactivityTimeout(durationMs: number | bigint): Promise<void>;
3950
3972
  interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
3951
3973
  interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
3952
- interceptOutboundHttps(addr: string, binding: Fetcher): Promise<void>;
3953
3974
  snapshotDirectory(
3954
3975
  options: ContainerDirectorySnapshotOptions,
3955
3976
  ): Promise<ContainerDirectorySnapshot>;
3956
3977
  snapshotContainer(
3957
3978
  options: ContainerSnapshotOptions,
3958
3979
  ): Promise<ContainerSnapshot>;
3980
+ interceptOutboundHttps(addr: string, binding: Fetcher): Promise<void>;
3981
+ exec(cmd: string[], options?: ContainerExecOptions): Promise<ExecProcess>;
3959
3982
  }
3960
3983
  export interface ContainerDirectorySnapshot {
3961
3984
  id: string;
@@ -12940,19 +12963,37 @@ export interface ImageList {
12940
12963
  cursor?: string;
12941
12964
  listComplete: boolean;
12942
12965
  }
12943
- export interface HostedImagesBinding {
12966
+ export interface ImageHandle {
12944
12967
  /**
12945
- * Get detailed metadata for a hosted image
12946
- * @param imageId The ID of the image (UUID or custom ID)
12968
+ * Get metadata for a hosted image
12947
12969
  * @returns Image metadata, or null if not found
12948
12970
  */
12949
- details(imageId: string): Promise<ImageMetadata | null>;
12971
+ details(): Promise<ImageMetadata | null>;
12950
12972
  /**
12951
12973
  * Get the raw image data for a hosted image
12952
- * @param imageId The ID of the image (UUID or custom ID)
12953
12974
  * @returns ReadableStream of image bytes, or null if not found
12954
12975
  */
12955
- image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
12976
+ bytes(): Promise<ReadableStream<Uint8Array> | null>;
12977
+ /**
12978
+ * Update hosted image metadata
12979
+ * @param options Properties to update
12980
+ * @returns Updated image metadata
12981
+ * @throws {@link ImagesError} if update fails
12982
+ */
12983
+ update(options: ImageUpdateOptions): Promise<ImageMetadata>;
12984
+ /**
12985
+ * Delete a hosted image
12986
+ * @returns True if deleted, false if not found
12987
+ */
12988
+ delete(): Promise<boolean>;
12989
+ }
12990
+ export interface HostedImagesBinding {
12991
+ /**
12992
+ * Get a handle for a hosted image
12993
+ * @param imageId The ID of the image (UUID or custom ID)
12994
+ * @returns A handle for per-image operations
12995
+ */
12996
+ image(imageId: string): ImageHandle;
12956
12997
  /**
12957
12998
  * Upload a new hosted image
12958
12999
  * @param image The image file to upload
@@ -12964,20 +13005,6 @@ export interface HostedImagesBinding {
12964
13005
  image: ReadableStream<Uint8Array> | ArrayBuffer,
12965
13006
  options?: ImageUploadOptions,
12966
13007
  ): Promise<ImageMetadata>;
12967
- /**
12968
- * Update hosted image metadata
12969
- * @param imageId The ID of the image
12970
- * @param options Properties to update
12971
- * @returns Updated image metadata
12972
- * @throws {@link ImagesError} if update fails
12973
- */
12974
- update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
12975
- /**
12976
- * Delete a hosted image
12977
- * @param imageId The ID of the image
12978
- * @returns True if deleted, false if not found
12979
- */
12980
- delete(imageId: string): Promise<boolean>;
12981
13008
  /**
12982
13009
  * List hosted images with pagination
12983
13010
  * @param options List configuration
@@ -13994,14 +14021,13 @@ export interface StreamScopedCaptions {
13994
14021
  * Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.
13995
14022
  * One caption or subtitle file per language is allowed.
13996
14023
  * @param language The BCP 47 language tag for the caption or subtitle.
13997
- * @param file The caption or subtitle file to upload.
14024
+ * @param input The caption or subtitle stream to upload.
13998
14025
  * @returns The created caption entry.
13999
14026
  * @throws {NotFoundError} if the video is not found
14000
14027
  * @throws {BadRequestError} if the language or file is invalid
14001
- * @throws {MaxFileSizeError} if the file size is too large
14002
14028
  * @throws {InternalError} if an unexpected error occurs
14003
14029
  */
14004
- upload(language: string, file: File): Promise<StreamCaption>;
14030
+ upload(language: string, input: ReadableStream): Promise<StreamCaption>;
14005
14031
  /**
14006
14032
  * Generate captions or subtitles for the provided language via AI.
14007
14033
  * @param language The BCP 47 language tag to generate.
@@ -14077,17 +14103,16 @@ export interface StreamVideos {
14077
14103
  export interface StreamWatermarks {
14078
14104
  /**
14079
14105
  * Generate a new watermark profile
14080
- * @param file The image file to upload
14106
+ * @param input The image stream to upload
14081
14107
  * @param params The watermark creation parameters.
14082
14108
  * @returns The created watermark profile.
14083
14109
  * @throws {BadRequestError} if the parameters are invalid
14084
14110
  * @throws {InvalidURLError} if the URL is invalid
14085
- * @throws {MaxFileSizeError} if the file size is too large
14086
14111
  * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
14087
14112
  * @throws {InternalError} if an unexpected error occurs
14088
14113
  */
14089
14114
  generate(
14090
- file: File,
14115
+ input: ReadableStream,
14091
14116
  params: StreamWatermarkCreateParams,
14092
14117
  ): Promise<StreamWatermark>;
14093
14118
  /**
@@ -14097,7 +14122,6 @@ export interface StreamWatermarks {
14097
14122
  * @returns The created watermark profile.
14098
14123
  * @throws {BadRequestError} if the parameters are invalid
14099
14124
  * @throws {InvalidURLError} if the URL is invalid
14100
- * @throws {MaxFileSizeError} if the file size is too large
14101
14125
  * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
14102
14126
  * @throws {InternalError} if an unexpected error occurs
14103
14127
  */
package/index.d.ts CHANGED
@@ -3662,12 +3662,43 @@ interface Container {
3662
3662
  setInactivityTimeout(durationMs: number | bigint): Promise<void>;
3663
3663
  interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
3664
3664
  interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
3665
+ snapshotDirectory(
3666
+ options: ContainerDirectorySnapshotOptions,
3667
+ ): Promise<ContainerDirectorySnapshot>;
3668
+ snapshotContainer(
3669
+ options: ContainerSnapshotOptions,
3670
+ ): Promise<ContainerSnapshot>;
3671
+ interceptOutboundHttps(addr: string, binding: Fetcher): Promise<void>;
3672
+ }
3673
+ interface ContainerDirectorySnapshot {
3674
+ id: string;
3675
+ size: number;
3676
+ dir: string;
3677
+ name?: string;
3678
+ }
3679
+ interface ContainerDirectorySnapshotOptions {
3680
+ dir: string;
3681
+ name?: string;
3682
+ }
3683
+ interface ContainerDirectorySnapshotRestoreParams {
3684
+ snapshot: ContainerDirectorySnapshot;
3685
+ mountPoint?: string;
3686
+ }
3687
+ interface ContainerSnapshot {
3688
+ id: string;
3689
+ size: number;
3690
+ name?: string;
3691
+ }
3692
+ interface ContainerSnapshotOptions {
3693
+ name?: string;
3665
3694
  }
3666
3695
  interface ContainerStartupOptions {
3667
3696
  entrypoint?: string[];
3668
3697
  enableInternet: boolean;
3669
3698
  env?: Record<string, string>;
3670
3699
  labels?: Record<string, string>;
3700
+ directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
3701
+ containerSnapshot?: ContainerSnapshot;
3671
3702
  }
3672
3703
  /**
3673
3704
  * The **`MessagePort`** interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.
@@ -12059,19 +12090,37 @@ interface ImageList {
12059
12090
  cursor?: string;
12060
12091
  listComplete: boolean;
12061
12092
  }
12062
- interface HostedImagesBinding {
12093
+ interface ImageHandle {
12063
12094
  /**
12064
- * Get detailed metadata for a hosted image
12065
- * @param imageId The ID of the image (UUID or custom ID)
12095
+ * Get metadata for a hosted image
12066
12096
  * @returns Image metadata, or null if not found
12067
12097
  */
12068
- details(imageId: string): Promise<ImageMetadata | null>;
12098
+ details(): Promise<ImageMetadata | null>;
12069
12099
  /**
12070
12100
  * Get the raw image data for a hosted image
12071
- * @param imageId The ID of the image (UUID or custom ID)
12072
12101
  * @returns ReadableStream of image bytes, or null if not found
12073
12102
  */
12074
- image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
12103
+ bytes(): Promise<ReadableStream<Uint8Array> | null>;
12104
+ /**
12105
+ * Update hosted image metadata
12106
+ * @param options Properties to update
12107
+ * @returns Updated image metadata
12108
+ * @throws {@link ImagesError} if update fails
12109
+ */
12110
+ update(options: ImageUpdateOptions): Promise<ImageMetadata>;
12111
+ /**
12112
+ * Delete a hosted image
12113
+ * @returns True if deleted, false if not found
12114
+ */
12115
+ delete(): Promise<boolean>;
12116
+ }
12117
+ interface HostedImagesBinding {
12118
+ /**
12119
+ * Get a handle for a hosted image
12120
+ * @param imageId The ID of the image (UUID or custom ID)
12121
+ * @returns A handle for per-image operations
12122
+ */
12123
+ image(imageId: string): ImageHandle;
12075
12124
  /**
12076
12125
  * Upload a new hosted image
12077
12126
  * @param image The image file to upload
@@ -12083,20 +12132,6 @@ interface HostedImagesBinding {
12083
12132
  image: ReadableStream<Uint8Array> | ArrayBuffer,
12084
12133
  options?: ImageUploadOptions,
12085
12134
  ): Promise<ImageMetadata>;
12086
- /**
12087
- * Update hosted image metadata
12088
- * @param imageId The ID of the image
12089
- * @param options Properties to update
12090
- * @returns Updated image metadata
12091
- * @throws {@link ImagesError} if update fails
12092
- */
12093
- update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
12094
- /**
12095
- * Delete a hosted image
12096
- * @param imageId The ID of the image
12097
- * @returns True if deleted, false if not found
12098
- */
12099
- delete(imageId: string): Promise<boolean>;
12100
12135
  /**
12101
12136
  * List hosted images with pagination
12102
12137
  * @param options List configuration
@@ -13172,14 +13207,13 @@ interface StreamScopedCaptions {
13172
13207
  * Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.
13173
13208
  * One caption or subtitle file per language is allowed.
13174
13209
  * @param language The BCP 47 language tag for the caption or subtitle.
13175
- * @param file The caption or subtitle file to upload.
13210
+ * @param input The caption or subtitle stream to upload.
13176
13211
  * @returns The created caption entry.
13177
13212
  * @throws {NotFoundError} if the video is not found
13178
13213
  * @throws {BadRequestError} if the language or file is invalid
13179
- * @throws {MaxFileSizeError} if the file size is too large
13180
13214
  * @throws {InternalError} if an unexpected error occurs
13181
13215
  */
13182
- upload(language: string, file: File): Promise<StreamCaption>;
13216
+ upload(language: string, input: ReadableStream): Promise<StreamCaption>;
13183
13217
  /**
13184
13218
  * Generate captions or subtitles for the provided language via AI.
13185
13219
  * @param language The BCP 47 language tag to generate.
@@ -13255,17 +13289,16 @@ interface StreamVideos {
13255
13289
  interface StreamWatermarks {
13256
13290
  /**
13257
13291
  * Generate a new watermark profile
13258
- * @param file The image file to upload
13292
+ * @param input The image stream to upload
13259
13293
  * @param params The watermark creation parameters.
13260
13294
  * @returns The created watermark profile.
13261
13295
  * @throws {BadRequestError} if the parameters are invalid
13262
13296
  * @throws {InvalidURLError} if the URL is invalid
13263
- * @throws {MaxFileSizeError} if the file size is too large
13264
13297
  * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
13265
13298
  * @throws {InternalError} if an unexpected error occurs
13266
13299
  */
13267
13300
  generate(
13268
- file: File,
13301
+ input: ReadableStream,
13269
13302
  params: StreamWatermarkCreateParams,
13270
13303
  ): Promise<StreamWatermark>;
13271
13304
  /**
@@ -13275,7 +13308,6 @@ interface StreamWatermarks {
13275
13308
  * @returns The created watermark profile.
13276
13309
  * @throws {BadRequestError} if the parameters are invalid
13277
13310
  * @throws {InvalidURLError} if the URL is invalid
13278
- * @throws {MaxFileSizeError} if the file size is too large
13279
13311
  * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
13280
13312
  * @throws {InternalError} if an unexpected error occurs
13281
13313
  */
package/index.ts CHANGED
@@ -3668,12 +3668,43 @@ export interface Container {
3668
3668
  setInactivityTimeout(durationMs: number | bigint): Promise<void>;
3669
3669
  interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
3670
3670
  interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
3671
+ snapshotDirectory(
3672
+ options: ContainerDirectorySnapshotOptions,
3673
+ ): Promise<ContainerDirectorySnapshot>;
3674
+ snapshotContainer(
3675
+ options: ContainerSnapshotOptions,
3676
+ ): Promise<ContainerSnapshot>;
3677
+ interceptOutboundHttps(addr: string, binding: Fetcher): Promise<void>;
3678
+ }
3679
+ export interface ContainerDirectorySnapshot {
3680
+ id: string;
3681
+ size: number;
3682
+ dir: string;
3683
+ name?: string;
3684
+ }
3685
+ export interface ContainerDirectorySnapshotOptions {
3686
+ dir: string;
3687
+ name?: string;
3688
+ }
3689
+ export interface ContainerDirectorySnapshotRestoreParams {
3690
+ snapshot: ContainerDirectorySnapshot;
3691
+ mountPoint?: string;
3692
+ }
3693
+ export interface ContainerSnapshot {
3694
+ id: string;
3695
+ size: number;
3696
+ name?: string;
3697
+ }
3698
+ export interface ContainerSnapshotOptions {
3699
+ name?: string;
3671
3700
  }
3672
3701
  export interface ContainerStartupOptions {
3673
3702
  entrypoint?: string[];
3674
3703
  enableInternet: boolean;
3675
3704
  env?: Record<string, string>;
3676
3705
  labels?: Record<string, string>;
3706
+ directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
3707
+ containerSnapshot?: ContainerSnapshot;
3677
3708
  }
3678
3709
  /**
3679
3710
  * The **`MessagePort`** interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.
@@ -12075,19 +12106,37 @@ export interface ImageList {
12075
12106
  cursor?: string;
12076
12107
  listComplete: boolean;
12077
12108
  }
12078
- export interface HostedImagesBinding {
12109
+ export interface ImageHandle {
12079
12110
  /**
12080
- * Get detailed metadata for a hosted image
12081
- * @param imageId The ID of the image (UUID or custom ID)
12111
+ * Get metadata for a hosted image
12082
12112
  * @returns Image metadata, or null if not found
12083
12113
  */
12084
- details(imageId: string): Promise<ImageMetadata | null>;
12114
+ details(): Promise<ImageMetadata | null>;
12085
12115
  /**
12086
12116
  * Get the raw image data for a hosted image
12087
- * @param imageId The ID of the image (UUID or custom ID)
12088
12117
  * @returns ReadableStream of image bytes, or null if not found
12089
12118
  */
12090
- image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
12119
+ bytes(): Promise<ReadableStream<Uint8Array> | null>;
12120
+ /**
12121
+ * Update hosted image metadata
12122
+ * @param options Properties to update
12123
+ * @returns Updated image metadata
12124
+ * @throws {@link ImagesError} if update fails
12125
+ */
12126
+ update(options: ImageUpdateOptions): Promise<ImageMetadata>;
12127
+ /**
12128
+ * Delete a hosted image
12129
+ * @returns True if deleted, false if not found
12130
+ */
12131
+ delete(): Promise<boolean>;
12132
+ }
12133
+ export interface HostedImagesBinding {
12134
+ /**
12135
+ * Get a handle for a hosted image
12136
+ * @param imageId The ID of the image (UUID or custom ID)
12137
+ * @returns A handle for per-image operations
12138
+ */
12139
+ image(imageId: string): ImageHandle;
12091
12140
  /**
12092
12141
  * Upload a new hosted image
12093
12142
  * @param image The image file to upload
@@ -12099,20 +12148,6 @@ export interface HostedImagesBinding {
12099
12148
  image: ReadableStream<Uint8Array> | ArrayBuffer,
12100
12149
  options?: ImageUploadOptions,
12101
12150
  ): Promise<ImageMetadata>;
12102
- /**
12103
- * Update hosted image metadata
12104
- * @param imageId The ID of the image
12105
- * @param options Properties to update
12106
- * @returns Updated image metadata
12107
- * @throws {@link ImagesError} if update fails
12108
- */
12109
- update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
12110
- /**
12111
- * Delete a hosted image
12112
- * @param imageId The ID of the image
12113
- * @returns True if deleted, false if not found
12114
- */
12115
- delete(imageId: string): Promise<boolean>;
12116
12151
  /**
12117
12152
  * List hosted images with pagination
12118
12153
  * @param options List configuration
@@ -13129,14 +13164,13 @@ export interface StreamScopedCaptions {
13129
13164
  * Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.
13130
13165
  * One caption or subtitle file per language is allowed.
13131
13166
  * @param language The BCP 47 language tag for the caption or subtitle.
13132
- * @param file The caption or subtitle file to upload.
13167
+ * @param input The caption or subtitle stream to upload.
13133
13168
  * @returns The created caption entry.
13134
13169
  * @throws {NotFoundError} if the video is not found
13135
13170
  * @throws {BadRequestError} if the language or file is invalid
13136
- * @throws {MaxFileSizeError} if the file size is too large
13137
13171
  * @throws {InternalError} if an unexpected error occurs
13138
13172
  */
13139
- upload(language: string, file: File): Promise<StreamCaption>;
13173
+ upload(language: string, input: ReadableStream): Promise<StreamCaption>;
13140
13174
  /**
13141
13175
  * Generate captions or subtitles for the provided language via AI.
13142
13176
  * @param language The BCP 47 language tag to generate.
@@ -13212,17 +13246,16 @@ export interface StreamVideos {
13212
13246
  export interface StreamWatermarks {
13213
13247
  /**
13214
13248
  * Generate a new watermark profile
13215
- * @param file The image file to upload
13249
+ * @param input The image stream to upload
13216
13250
  * @param params The watermark creation parameters.
13217
13251
  * @returns The created watermark profile.
13218
13252
  * @throws {BadRequestError} if the parameters are invalid
13219
13253
  * @throws {InvalidURLError} if the URL is invalid
13220
- * @throws {MaxFileSizeError} if the file size is too large
13221
13254
  * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
13222
13255
  * @throws {InternalError} if an unexpected error occurs
13223
13256
  */
13224
13257
  generate(
13225
- file: File,
13258
+ input: ReadableStream,
13226
13259
  params: StreamWatermarkCreateParams,
13227
13260
  ): Promise<StreamWatermark>;
13228
13261
  /**
@@ -13232,7 +13265,6 @@ export interface StreamWatermarks {
13232
13265
  * @returns The created watermark profile.
13233
13266
  * @throws {BadRequestError} if the parameters are invalid
13234
13267
  * @throws {InvalidURLError} if the URL is invalid
13235
- * @throws {MaxFileSizeError} if the file size is too large
13236
13268
  * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
13237
13269
  * @throws {InternalError} if an unexpected error occurs
13238
13270
  */