@workers-community/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.
Files changed (3) hide show
  1. package/index.d.ts +59 -27
  2. package/index.ts +59 -27
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -3769,12 +3769,43 @@ interface Container {
3769
3769
  setInactivityTimeout(durationMs: number | bigint): Promise<void>;
3770
3770
  interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
3771
3771
  interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
3772
+ snapshotDirectory(
3773
+ options: ContainerDirectorySnapshotOptions,
3774
+ ): Promise<ContainerDirectorySnapshot>;
3775
+ snapshotContainer(
3776
+ options: ContainerSnapshotOptions,
3777
+ ): Promise<ContainerSnapshot>;
3778
+ interceptOutboundHttps(addr: string, binding: Fetcher): Promise<void>;
3779
+ }
3780
+ interface ContainerDirectorySnapshot {
3781
+ id: string;
3782
+ size: number;
3783
+ dir: string;
3784
+ name?: string;
3785
+ }
3786
+ interface ContainerDirectorySnapshotOptions {
3787
+ dir: string;
3788
+ name?: string;
3789
+ }
3790
+ interface ContainerDirectorySnapshotRestoreParams {
3791
+ snapshot: ContainerDirectorySnapshot;
3792
+ mountPoint?: string;
3793
+ }
3794
+ interface ContainerSnapshot {
3795
+ id: string;
3796
+ size: number;
3797
+ name?: string;
3798
+ }
3799
+ interface ContainerSnapshotOptions {
3800
+ name?: string;
3772
3801
  }
3773
3802
  interface ContainerStartupOptions {
3774
3803
  entrypoint?: string[];
3775
3804
  enableInternet: boolean;
3776
3805
  env?: Record<string, string>;
3777
3806
  labels?: Record<string, string>;
3807
+ directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
3808
+ containerSnapshot?: ContainerSnapshot;
3778
3809
  }
3779
3810
  /**
3780
3811
  * 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.
@@ -12166,19 +12197,37 @@ interface ImageList {
12166
12197
  cursor?: string;
12167
12198
  listComplete: boolean;
12168
12199
  }
12169
- interface HostedImagesBinding {
12200
+ interface ImageHandle {
12170
12201
  /**
12171
- * Get detailed metadata for a hosted image
12172
- * @param imageId The ID of the image (UUID or custom ID)
12202
+ * Get metadata for a hosted image
12173
12203
  * @returns Image metadata, or null if not found
12174
12204
  */
12175
- details(imageId: string): Promise<ImageMetadata | null>;
12205
+ details(): Promise<ImageMetadata | null>;
12176
12206
  /**
12177
12207
  * Get the raw image data for a hosted image
12178
- * @param imageId The ID of the image (UUID or custom ID)
12179
12208
  * @returns ReadableStream of image bytes, or null if not found
12180
12209
  */
12181
- image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
12210
+ bytes(): Promise<ReadableStream<Uint8Array> | null>;
12211
+ /**
12212
+ * Update hosted image metadata
12213
+ * @param options Properties to update
12214
+ * @returns Updated image metadata
12215
+ * @throws {@link ImagesError} if update fails
12216
+ */
12217
+ update(options: ImageUpdateOptions): Promise<ImageMetadata>;
12218
+ /**
12219
+ * Delete a hosted image
12220
+ * @returns True if deleted, false if not found
12221
+ */
12222
+ delete(): Promise<boolean>;
12223
+ }
12224
+ interface HostedImagesBinding {
12225
+ /**
12226
+ * Get a handle for a hosted image
12227
+ * @param imageId The ID of the image (UUID or custom ID)
12228
+ * @returns A handle for per-image operations
12229
+ */
12230
+ image(imageId: string): ImageHandle;
12182
12231
  /**
12183
12232
  * Upload a new hosted image
12184
12233
  * @param image The image file to upload
@@ -12190,20 +12239,6 @@ interface HostedImagesBinding {
12190
12239
  image: ReadableStream<Uint8Array> | ArrayBuffer,
12191
12240
  options?: ImageUploadOptions,
12192
12241
  ): Promise<ImageMetadata>;
12193
- /**
12194
- * Update hosted image metadata
12195
- * @param imageId The ID of the image
12196
- * @param options Properties to update
12197
- * @returns Updated image metadata
12198
- * @throws {@link ImagesError} if update fails
12199
- */
12200
- update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
12201
- /**
12202
- * Delete a hosted image
12203
- * @param imageId The ID of the image
12204
- * @returns True if deleted, false if not found
12205
- */
12206
- delete(imageId: string): Promise<boolean>;
12207
12242
  /**
12208
12243
  * List hosted images with pagination
12209
12244
  * @param options List configuration
@@ -13279,14 +13314,13 @@ interface StreamScopedCaptions {
13279
13314
  * Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.
13280
13315
  * One caption or subtitle file per language is allowed.
13281
13316
  * @param language The BCP 47 language tag for the caption or subtitle.
13282
- * @param file The caption or subtitle file to upload.
13317
+ * @param input The caption or subtitle stream to upload.
13283
13318
  * @returns The created caption entry.
13284
13319
  * @throws {NotFoundError} if the video is not found
13285
13320
  * @throws {BadRequestError} if the language or file is invalid
13286
- * @throws {MaxFileSizeError} if the file size is too large
13287
13321
  * @throws {InternalError} if an unexpected error occurs
13288
13322
  */
13289
- upload(language: string, file: File): Promise<StreamCaption>;
13323
+ upload(language: string, input: ReadableStream): Promise<StreamCaption>;
13290
13324
  /**
13291
13325
  * Generate captions or subtitles for the provided language via AI.
13292
13326
  * @param language The BCP 47 language tag to generate.
@@ -13362,17 +13396,16 @@ interface StreamVideos {
13362
13396
  interface StreamWatermarks {
13363
13397
  /**
13364
13398
  * Generate a new watermark profile
13365
- * @param file The image file to upload
13399
+ * @param input The image stream to upload
13366
13400
  * @param params The watermark creation parameters.
13367
13401
  * @returns The created watermark profile.
13368
13402
  * @throws {BadRequestError} if the parameters are invalid
13369
13403
  * @throws {InvalidURLError} if the URL is invalid
13370
- * @throws {MaxFileSizeError} if the file size is too large
13371
13404
  * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
13372
13405
  * @throws {InternalError} if an unexpected error occurs
13373
13406
  */
13374
13407
  generate(
13375
- file: File,
13408
+ input: ReadableStream,
13376
13409
  params: StreamWatermarkCreateParams,
13377
13410
  ): Promise<StreamWatermark>;
13378
13411
  /**
@@ -13382,7 +13415,6 @@ interface StreamWatermarks {
13382
13415
  * @returns The created watermark profile.
13383
13416
  * @throws {BadRequestError} if the parameters are invalid
13384
13417
  * @throws {InvalidURLError} if the URL is invalid
13385
- * @throws {MaxFileSizeError} if the file size is too large
13386
13418
  * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
13387
13419
  * @throws {InternalError} if an unexpected error occurs
13388
13420
  */
package/index.ts CHANGED
@@ -3775,12 +3775,43 @@ export interface Container {
3775
3775
  setInactivityTimeout(durationMs: number | bigint): Promise<void>;
3776
3776
  interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
3777
3777
  interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
3778
+ snapshotDirectory(
3779
+ options: ContainerDirectorySnapshotOptions,
3780
+ ): Promise<ContainerDirectorySnapshot>;
3781
+ snapshotContainer(
3782
+ options: ContainerSnapshotOptions,
3783
+ ): Promise<ContainerSnapshot>;
3784
+ interceptOutboundHttps(addr: string, binding: Fetcher): Promise<void>;
3785
+ }
3786
+ export interface ContainerDirectorySnapshot {
3787
+ id: string;
3788
+ size: number;
3789
+ dir: string;
3790
+ name?: string;
3791
+ }
3792
+ export interface ContainerDirectorySnapshotOptions {
3793
+ dir: string;
3794
+ name?: string;
3795
+ }
3796
+ export interface ContainerDirectorySnapshotRestoreParams {
3797
+ snapshot: ContainerDirectorySnapshot;
3798
+ mountPoint?: string;
3799
+ }
3800
+ export interface ContainerSnapshot {
3801
+ id: string;
3802
+ size: number;
3803
+ name?: string;
3804
+ }
3805
+ export interface ContainerSnapshotOptions {
3806
+ name?: string;
3778
3807
  }
3779
3808
  export interface ContainerStartupOptions {
3780
3809
  entrypoint?: string[];
3781
3810
  enableInternet: boolean;
3782
3811
  env?: Record<string, string>;
3783
3812
  labels?: Record<string, string>;
3813
+ directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
3814
+ containerSnapshot?: ContainerSnapshot;
3784
3815
  }
3785
3816
  /**
3786
3817
  * 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.
@@ -12182,19 +12213,37 @@ export interface ImageList {
12182
12213
  cursor?: string;
12183
12214
  listComplete: boolean;
12184
12215
  }
12185
- export interface HostedImagesBinding {
12216
+ export interface ImageHandle {
12186
12217
  /**
12187
- * Get detailed metadata for a hosted image
12188
- * @param imageId The ID of the image (UUID or custom ID)
12218
+ * Get metadata for a hosted image
12189
12219
  * @returns Image metadata, or null if not found
12190
12220
  */
12191
- details(imageId: string): Promise<ImageMetadata | null>;
12221
+ details(): Promise<ImageMetadata | null>;
12192
12222
  /**
12193
12223
  * Get the raw image data for a hosted image
12194
- * @param imageId The ID of the image (UUID or custom ID)
12195
12224
  * @returns ReadableStream of image bytes, or null if not found
12196
12225
  */
12197
- image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
12226
+ bytes(): Promise<ReadableStream<Uint8Array> | null>;
12227
+ /**
12228
+ * Update hosted image metadata
12229
+ * @param options Properties to update
12230
+ * @returns Updated image metadata
12231
+ * @throws {@link ImagesError} if update fails
12232
+ */
12233
+ update(options: ImageUpdateOptions): Promise<ImageMetadata>;
12234
+ /**
12235
+ * Delete a hosted image
12236
+ * @returns True if deleted, false if not found
12237
+ */
12238
+ delete(): Promise<boolean>;
12239
+ }
12240
+ export interface HostedImagesBinding {
12241
+ /**
12242
+ * Get a handle for a hosted image
12243
+ * @param imageId The ID of the image (UUID or custom ID)
12244
+ * @returns A handle for per-image operations
12245
+ */
12246
+ image(imageId: string): ImageHandle;
12198
12247
  /**
12199
12248
  * Upload a new hosted image
12200
12249
  * @param image The image file to upload
@@ -12206,20 +12255,6 @@ export interface HostedImagesBinding {
12206
12255
  image: ReadableStream<Uint8Array> | ArrayBuffer,
12207
12256
  options?: ImageUploadOptions,
12208
12257
  ): Promise<ImageMetadata>;
12209
- /**
12210
- * Update hosted image metadata
12211
- * @param imageId The ID of the image
12212
- * @param options Properties to update
12213
- * @returns Updated image metadata
12214
- * @throws {@link ImagesError} if update fails
12215
- */
12216
- update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
12217
- /**
12218
- * Delete a hosted image
12219
- * @param imageId The ID of the image
12220
- * @returns True if deleted, false if not found
12221
- */
12222
- delete(imageId: string): Promise<boolean>;
12223
12258
  /**
12224
12259
  * List hosted images with pagination
12225
12260
  * @param options List configuration
@@ -13236,14 +13271,13 @@ export interface StreamScopedCaptions {
13236
13271
  * Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.
13237
13272
  * One caption or subtitle file per language is allowed.
13238
13273
  * @param language The BCP 47 language tag for the caption or subtitle.
13239
- * @param file The caption or subtitle file to upload.
13274
+ * @param input The caption or subtitle stream to upload.
13240
13275
  * @returns The created caption entry.
13241
13276
  * @throws {NotFoundError} if the video is not found
13242
13277
  * @throws {BadRequestError} if the language or file is invalid
13243
- * @throws {MaxFileSizeError} if the file size is too large
13244
13278
  * @throws {InternalError} if an unexpected error occurs
13245
13279
  */
13246
- upload(language: string, file: File): Promise<StreamCaption>;
13280
+ upload(language: string, input: ReadableStream): Promise<StreamCaption>;
13247
13281
  /**
13248
13282
  * Generate captions or subtitles for the provided language via AI.
13249
13283
  * @param language The BCP 47 language tag to generate.
@@ -13319,17 +13353,16 @@ export interface StreamVideos {
13319
13353
  export interface StreamWatermarks {
13320
13354
  /**
13321
13355
  * Generate a new watermark profile
13322
- * @param file The image file to upload
13356
+ * @param input The image stream to upload
13323
13357
  * @param params The watermark creation parameters.
13324
13358
  * @returns The created watermark profile.
13325
13359
  * @throws {BadRequestError} if the parameters are invalid
13326
13360
  * @throws {InvalidURLError} if the URL is invalid
13327
- * @throws {MaxFileSizeError} if the file size is too large
13328
13361
  * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
13329
13362
  * @throws {InternalError} if an unexpected error occurs
13330
13363
  */
13331
13364
  generate(
13332
- file: File,
13365
+ input: ReadableStream,
13333
13366
  params: StreamWatermarkCreateParams,
13334
13367
  ): Promise<StreamWatermark>;
13335
13368
  /**
@@ -13339,7 +13372,6 @@ export interface StreamWatermarks {
13339
13372
  * @returns The created watermark profile.
13340
13373
  * @throws {BadRequestError} if the parameters are invalid
13341
13374
  * @throws {InvalidURLError} if the URL is invalid
13342
- * @throws {MaxFileSizeError} if the file size is too large
13343
13375
  * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
13344
13376
  * @throws {InternalError} if an unexpected error occurs
13345
13377
  */
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "author": "Workers Community",
9
9
  "license": "MIT OR Apache-2.0",
10
- "version": "4.20260331.1",
10
+ "version": "4.20260402.1",
11
11
  "exports": {
12
12
  ".": {
13
13
  "types": "./index.d.ts",