@cloudflare/workers-types 4.20260228.0 → 4.20260301.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.
@@ -3848,6 +3848,12 @@ declare abstract class Performance {
3848
3848
  get timeOrigin(): number;
3849
3849
  /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
3850
3850
  now(): number;
3851
+ /**
3852
+ * The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
3853
+ *
3854
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
3855
+ */
3856
+ toJSON(): object;
3851
3857
  }
3852
3858
  // AI Search V2 API Error Interfaces
3853
3859
  interface AiSearchInternalError extends Error {}
@@ -9551,7 +9557,7 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
9551
9557
  * });
9552
9558
  * ```
9553
9559
  */
9554
- aiSearch: AiSearchAccountService;
9560
+ aiSearch(): AiSearchAccountService;
9555
9561
  /**
9556
9562
  * @deprecated AutoRAG has been replaced by AI Search.
9557
9563
  * Use `env.AI.aiSearch` instead for better API design and new features.
@@ -11256,6 +11262,86 @@ type ImageOutputOptions = {
11256
11262
  background?: string;
11257
11263
  anim?: boolean;
11258
11264
  };
11265
+ interface ImageMetadata {
11266
+ id: string;
11267
+ filename?: string;
11268
+ uploaded?: string;
11269
+ requireSignedURLs: boolean;
11270
+ meta?: Record<string, unknown>;
11271
+ variants: string[];
11272
+ draft?: boolean;
11273
+ creator?: string;
11274
+ }
11275
+ interface ImageUploadOptions {
11276
+ id?: string;
11277
+ filename?: string;
11278
+ requireSignedURLs?: boolean;
11279
+ metadata?: Record<string, unknown>;
11280
+ creator?: string;
11281
+ encoding?: "base64";
11282
+ }
11283
+ interface ImageUpdateOptions {
11284
+ requireSignedURLs?: boolean;
11285
+ metadata?: Record<string, unknown>;
11286
+ creator?: string;
11287
+ }
11288
+ interface ImageListOptions {
11289
+ limit?: number;
11290
+ cursor?: string;
11291
+ sortOrder?: "asc" | "desc";
11292
+ creator?: string;
11293
+ }
11294
+ interface ImageList {
11295
+ images: ImageMetadata[];
11296
+ cursor?: string;
11297
+ listComplete: boolean;
11298
+ }
11299
+ interface HostedImagesBinding {
11300
+ /**
11301
+ * Get detailed metadata for a hosted image
11302
+ * @param imageId The ID of the image (UUID or custom ID)
11303
+ * @returns Image metadata, or null if not found
11304
+ */
11305
+ details(imageId: string): Promise<ImageMetadata | null>;
11306
+ /**
11307
+ * Get the raw image data for a hosted image
11308
+ * @param imageId The ID of the image (UUID or custom ID)
11309
+ * @returns ReadableStream of image bytes, or null if not found
11310
+ */
11311
+ image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
11312
+ /**
11313
+ * Upload a new hosted image
11314
+ * @param image The image file to upload
11315
+ * @param options Upload configuration
11316
+ * @returns Metadata for the uploaded image
11317
+ * @throws {@link ImagesError} if upload fails
11318
+ */
11319
+ upload(
11320
+ image: ReadableStream<Uint8Array> | ArrayBuffer,
11321
+ options?: ImageUploadOptions,
11322
+ ): Promise<ImageMetadata>;
11323
+ /**
11324
+ * Update hosted image metadata
11325
+ * @param imageId The ID of the image
11326
+ * @param options Properties to update
11327
+ * @returns Updated image metadata
11328
+ * @throws {@link ImagesError} if update fails
11329
+ */
11330
+ update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
11331
+ /**
11332
+ * Delete a hosted image
11333
+ * @param imageId The ID of the image
11334
+ * @returns True if deleted, false if not found
11335
+ */
11336
+ delete(imageId: string): Promise<boolean>;
11337
+ /**
11338
+ * List hosted images with pagination
11339
+ * @param options List configuration
11340
+ * @returns List of images with pagination info
11341
+ * @throws {@link ImagesError} if list fails
11342
+ */
11343
+ list(options?: ImageListOptions): Promise<ImageList>;
11344
+ }
11259
11345
  interface ImagesBinding {
11260
11346
  /**
11261
11347
  * Get image metadata (type, width and height)
@@ -11275,6 +11361,10 @@ interface ImagesBinding {
11275
11361
  stream: ReadableStream<Uint8Array>,
11276
11362
  options?: ImageInputOptions,
11277
11363
  ): ImageTransformer;
11364
+ /**
11365
+ * Access hosted images CRUD operations
11366
+ */
11367
+ readonly hosted: HostedImagesBinding;
11278
11368
  }
11279
11369
  interface ImageTransformer {
11280
11370
  /**
@@ -11345,8 +11435,14 @@ interface MediaTransformer {
11345
11435
  * @returns A generator for producing the transformed media output
11346
11436
  */
11347
11437
  transform(
11348
- transform: MediaTransformationInputOptions,
11438
+ transform?: MediaTransformationInputOptions,
11349
11439
  ): MediaTransformationGenerator;
11440
+ /**
11441
+ * Generates the final media output with specified options.
11442
+ * @param output - Configuration for the output format and parameters
11443
+ * @returns The final transformation result containing the transformed media
11444
+ */
11445
+ output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
11350
11446
  }
11351
11447
  /**
11352
11448
  * Generator for producing media transformation results.
@@ -11358,7 +11454,7 @@ interface MediaTransformationGenerator {
11358
11454
  * @param output - Configuration for the output format and parameters
11359
11455
  * @returns The final transformation result containing the transformed media
11360
11456
  */
11361
- output(output: MediaTransformationOutputOptions): MediaTransformationResult;
11457
+ output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
11362
11458
  }
11363
11459
  /**
11364
11460
  * Result of a media transformation operation.
@@ -11367,19 +11463,19 @@ interface MediaTransformationGenerator {
11367
11463
  interface MediaTransformationResult {
11368
11464
  /**
11369
11465
  * Returns the transformed media as a readable stream of bytes.
11370
- * @returns A stream containing the transformed media data
11466
+ * @returns A promise containing a readable stream with the transformed media
11371
11467
  */
11372
- media(): ReadableStream<Uint8Array>;
11468
+ media(): Promise<ReadableStream<Uint8Array>>;
11373
11469
  /**
11374
11470
  * Returns the transformed media as an HTTP response object.
11375
- * @returns The transformed media as a Response, ready to store in cache or return to users
11471
+ * @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
11376
11472
  */
11377
- response(): Response;
11473
+ response(): Promise<Response>;
11378
11474
  /**
11379
11475
  * Returns the MIME type of the transformed media.
11380
- * @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
11476
+ * @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
11381
11477
  */
11382
- contentType(): string;
11478
+ contentType(): Promise<string>;
11383
11479
  }
11384
11480
  /**
11385
11481
  * Configuration options for transforming media input.
@@ -3857,6 +3857,12 @@ export declare abstract class Performance {
3857
3857
  get timeOrigin(): number;
3858
3858
  /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
3859
3859
  now(): number;
3860
+ /**
3861
+ * The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
3862
+ *
3863
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
3864
+ */
3865
+ toJSON(): object;
3860
3866
  }
3861
3867
  // AI Search V2 API Error Interfaces
3862
3868
  export interface AiSearchInternalError extends Error {}
@@ -9563,7 +9569,7 @@ export declare abstract class Ai<
9563
9569
  * });
9564
9570
  * ```
9565
9571
  */
9566
- aiSearch: AiSearchAccountService;
9572
+ aiSearch(): AiSearchAccountService;
9567
9573
  /**
9568
9574
  * @deprecated AutoRAG has been replaced by AI Search.
9569
9575
  * Use `env.AI.aiSearch` instead for better API design and new features.
@@ -11273,6 +11279,86 @@ export type ImageOutputOptions = {
11273
11279
  background?: string;
11274
11280
  anim?: boolean;
11275
11281
  };
11282
+ export interface ImageMetadata {
11283
+ id: string;
11284
+ filename?: string;
11285
+ uploaded?: string;
11286
+ requireSignedURLs: boolean;
11287
+ meta?: Record<string, unknown>;
11288
+ variants: string[];
11289
+ draft?: boolean;
11290
+ creator?: string;
11291
+ }
11292
+ export interface ImageUploadOptions {
11293
+ id?: string;
11294
+ filename?: string;
11295
+ requireSignedURLs?: boolean;
11296
+ metadata?: Record<string, unknown>;
11297
+ creator?: string;
11298
+ encoding?: "base64";
11299
+ }
11300
+ export interface ImageUpdateOptions {
11301
+ requireSignedURLs?: boolean;
11302
+ metadata?: Record<string, unknown>;
11303
+ creator?: string;
11304
+ }
11305
+ export interface ImageListOptions {
11306
+ limit?: number;
11307
+ cursor?: string;
11308
+ sortOrder?: "asc" | "desc";
11309
+ creator?: string;
11310
+ }
11311
+ export interface ImageList {
11312
+ images: ImageMetadata[];
11313
+ cursor?: string;
11314
+ listComplete: boolean;
11315
+ }
11316
+ export interface HostedImagesBinding {
11317
+ /**
11318
+ * Get detailed metadata for a hosted image
11319
+ * @param imageId The ID of the image (UUID or custom ID)
11320
+ * @returns Image metadata, or null if not found
11321
+ */
11322
+ details(imageId: string): Promise<ImageMetadata | null>;
11323
+ /**
11324
+ * Get the raw image data for a hosted image
11325
+ * @param imageId The ID of the image (UUID or custom ID)
11326
+ * @returns ReadableStream of image bytes, or null if not found
11327
+ */
11328
+ image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
11329
+ /**
11330
+ * Upload a new hosted image
11331
+ * @param image The image file to upload
11332
+ * @param options Upload configuration
11333
+ * @returns Metadata for the uploaded image
11334
+ * @throws {@link ImagesError} if upload fails
11335
+ */
11336
+ upload(
11337
+ image: ReadableStream<Uint8Array> | ArrayBuffer,
11338
+ options?: ImageUploadOptions,
11339
+ ): Promise<ImageMetadata>;
11340
+ /**
11341
+ * Update hosted image metadata
11342
+ * @param imageId The ID of the image
11343
+ * @param options Properties to update
11344
+ * @returns Updated image metadata
11345
+ * @throws {@link ImagesError} if update fails
11346
+ */
11347
+ update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
11348
+ /**
11349
+ * Delete a hosted image
11350
+ * @param imageId The ID of the image
11351
+ * @returns True if deleted, false if not found
11352
+ */
11353
+ delete(imageId: string): Promise<boolean>;
11354
+ /**
11355
+ * List hosted images with pagination
11356
+ * @param options List configuration
11357
+ * @returns List of images with pagination info
11358
+ * @throws {@link ImagesError} if list fails
11359
+ */
11360
+ list(options?: ImageListOptions): Promise<ImageList>;
11361
+ }
11276
11362
  export interface ImagesBinding {
11277
11363
  /**
11278
11364
  * Get image metadata (type, width and height)
@@ -11292,6 +11378,10 @@ export interface ImagesBinding {
11292
11378
  stream: ReadableStream<Uint8Array>,
11293
11379
  options?: ImageInputOptions,
11294
11380
  ): ImageTransformer;
11381
+ /**
11382
+ * Access hosted images CRUD operations
11383
+ */
11384
+ readonly hosted: HostedImagesBinding;
11295
11385
  }
11296
11386
  export interface ImageTransformer {
11297
11387
  /**
@@ -11362,8 +11452,14 @@ export interface MediaTransformer {
11362
11452
  * @returns A generator for producing the transformed media output
11363
11453
  */
11364
11454
  transform(
11365
- transform: MediaTransformationInputOptions,
11455
+ transform?: MediaTransformationInputOptions,
11366
11456
  ): MediaTransformationGenerator;
11457
+ /**
11458
+ * Generates the final media output with specified options.
11459
+ * @param output - Configuration for the output format and parameters
11460
+ * @returns The final transformation result containing the transformed media
11461
+ */
11462
+ output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
11367
11463
  }
11368
11464
  /**
11369
11465
  * Generator for producing media transformation results.
@@ -11375,7 +11471,7 @@ export interface MediaTransformationGenerator {
11375
11471
  * @param output - Configuration for the output format and parameters
11376
11472
  * @returns The final transformation result containing the transformed media
11377
11473
  */
11378
- output(output: MediaTransformationOutputOptions): MediaTransformationResult;
11474
+ output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
11379
11475
  }
11380
11476
  /**
11381
11477
  * Result of a media transformation operation.
@@ -11384,19 +11480,19 @@ export interface MediaTransformationGenerator {
11384
11480
  export interface MediaTransformationResult {
11385
11481
  /**
11386
11482
  * Returns the transformed media as a readable stream of bytes.
11387
- * @returns A stream containing the transformed media data
11483
+ * @returns A promise containing a readable stream with the transformed media
11388
11484
  */
11389
- media(): ReadableStream<Uint8Array>;
11485
+ media(): Promise<ReadableStream<Uint8Array>>;
11390
11486
  /**
11391
11487
  * Returns the transformed media as an HTTP response object.
11392
- * @returns The transformed media as a Response, ready to store in cache or return to users
11488
+ * @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
11393
11489
  */
11394
- response(): Response;
11490
+ response(): Promise<Response>;
11395
11491
  /**
11396
11492
  * Returns the MIME type of the transformed media.
11397
- * @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
11493
+ * @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
11398
11494
  */
11399
- contentType(): string;
11495
+ contentType(): Promise<string>;
11400
11496
  }
11401
11497
  /**
11402
11498
  * Configuration options for transforming media input.
@@ -3848,6 +3848,12 @@ declare abstract class Performance {
3848
3848
  get timeOrigin(): number;
3849
3849
  /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
3850
3850
  now(): number;
3851
+ /**
3852
+ * The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
3853
+ *
3854
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
3855
+ */
3856
+ toJSON(): object;
3851
3857
  }
3852
3858
  // AI Search V2 API Error Interfaces
3853
3859
  interface AiSearchInternalError extends Error {}
@@ -9551,7 +9557,7 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
9551
9557
  * });
9552
9558
  * ```
9553
9559
  */
9554
- aiSearch: AiSearchAccountService;
9560
+ aiSearch(): AiSearchAccountService;
9555
9561
  /**
9556
9562
  * @deprecated AutoRAG has been replaced by AI Search.
9557
9563
  * Use `env.AI.aiSearch` instead for better API design and new features.
@@ -11256,6 +11262,86 @@ type ImageOutputOptions = {
11256
11262
  background?: string;
11257
11263
  anim?: boolean;
11258
11264
  };
11265
+ interface ImageMetadata {
11266
+ id: string;
11267
+ filename?: string;
11268
+ uploaded?: string;
11269
+ requireSignedURLs: boolean;
11270
+ meta?: Record<string, unknown>;
11271
+ variants: string[];
11272
+ draft?: boolean;
11273
+ creator?: string;
11274
+ }
11275
+ interface ImageUploadOptions {
11276
+ id?: string;
11277
+ filename?: string;
11278
+ requireSignedURLs?: boolean;
11279
+ metadata?: Record<string, unknown>;
11280
+ creator?: string;
11281
+ encoding?: "base64";
11282
+ }
11283
+ interface ImageUpdateOptions {
11284
+ requireSignedURLs?: boolean;
11285
+ metadata?: Record<string, unknown>;
11286
+ creator?: string;
11287
+ }
11288
+ interface ImageListOptions {
11289
+ limit?: number;
11290
+ cursor?: string;
11291
+ sortOrder?: "asc" | "desc";
11292
+ creator?: string;
11293
+ }
11294
+ interface ImageList {
11295
+ images: ImageMetadata[];
11296
+ cursor?: string;
11297
+ listComplete: boolean;
11298
+ }
11299
+ interface HostedImagesBinding {
11300
+ /**
11301
+ * Get detailed metadata for a hosted image
11302
+ * @param imageId The ID of the image (UUID or custom ID)
11303
+ * @returns Image metadata, or null if not found
11304
+ */
11305
+ details(imageId: string): Promise<ImageMetadata | null>;
11306
+ /**
11307
+ * Get the raw image data for a hosted image
11308
+ * @param imageId The ID of the image (UUID or custom ID)
11309
+ * @returns ReadableStream of image bytes, or null if not found
11310
+ */
11311
+ image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
11312
+ /**
11313
+ * Upload a new hosted image
11314
+ * @param image The image file to upload
11315
+ * @param options Upload configuration
11316
+ * @returns Metadata for the uploaded image
11317
+ * @throws {@link ImagesError} if upload fails
11318
+ */
11319
+ upload(
11320
+ image: ReadableStream<Uint8Array> | ArrayBuffer,
11321
+ options?: ImageUploadOptions,
11322
+ ): Promise<ImageMetadata>;
11323
+ /**
11324
+ * Update hosted image metadata
11325
+ * @param imageId The ID of the image
11326
+ * @param options Properties to update
11327
+ * @returns Updated image metadata
11328
+ * @throws {@link ImagesError} if update fails
11329
+ */
11330
+ update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
11331
+ /**
11332
+ * Delete a hosted image
11333
+ * @param imageId The ID of the image
11334
+ * @returns True if deleted, false if not found
11335
+ */
11336
+ delete(imageId: string): Promise<boolean>;
11337
+ /**
11338
+ * List hosted images with pagination
11339
+ * @param options List configuration
11340
+ * @returns List of images with pagination info
11341
+ * @throws {@link ImagesError} if list fails
11342
+ */
11343
+ list(options?: ImageListOptions): Promise<ImageList>;
11344
+ }
11259
11345
  interface ImagesBinding {
11260
11346
  /**
11261
11347
  * Get image metadata (type, width and height)
@@ -11275,6 +11361,10 @@ interface ImagesBinding {
11275
11361
  stream: ReadableStream<Uint8Array>,
11276
11362
  options?: ImageInputOptions,
11277
11363
  ): ImageTransformer;
11364
+ /**
11365
+ * Access hosted images CRUD operations
11366
+ */
11367
+ readonly hosted: HostedImagesBinding;
11278
11368
  }
11279
11369
  interface ImageTransformer {
11280
11370
  /**
@@ -11345,8 +11435,14 @@ interface MediaTransformer {
11345
11435
  * @returns A generator for producing the transformed media output
11346
11436
  */
11347
11437
  transform(
11348
- transform: MediaTransformationInputOptions,
11438
+ transform?: MediaTransformationInputOptions,
11349
11439
  ): MediaTransformationGenerator;
11440
+ /**
11441
+ * Generates the final media output with specified options.
11442
+ * @param output - Configuration for the output format and parameters
11443
+ * @returns The final transformation result containing the transformed media
11444
+ */
11445
+ output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
11350
11446
  }
11351
11447
  /**
11352
11448
  * Generator for producing media transformation results.
@@ -11358,7 +11454,7 @@ interface MediaTransformationGenerator {
11358
11454
  * @param output - Configuration for the output format and parameters
11359
11455
  * @returns The final transformation result containing the transformed media
11360
11456
  */
11361
- output(output: MediaTransformationOutputOptions): MediaTransformationResult;
11457
+ output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
11362
11458
  }
11363
11459
  /**
11364
11460
  * Result of a media transformation operation.
@@ -11367,19 +11463,19 @@ interface MediaTransformationGenerator {
11367
11463
  interface MediaTransformationResult {
11368
11464
  /**
11369
11465
  * Returns the transformed media as a readable stream of bytes.
11370
- * @returns A stream containing the transformed media data
11466
+ * @returns A promise containing a readable stream with the transformed media
11371
11467
  */
11372
- media(): ReadableStream<Uint8Array>;
11468
+ media(): Promise<ReadableStream<Uint8Array>>;
11373
11469
  /**
11374
11470
  * Returns the transformed media as an HTTP response object.
11375
- * @returns The transformed media as a Response, ready to store in cache or return to users
11471
+ * @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
11376
11472
  */
11377
- response(): Response;
11473
+ response(): Promise<Response>;
11378
11474
  /**
11379
11475
  * Returns the MIME type of the transformed media.
11380
- * @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
11476
+ * @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
11381
11477
  */
11382
- contentType(): string;
11478
+ contentType(): Promise<string>;
11383
11479
  }
11384
11480
  /**
11385
11481
  * Configuration options for transforming media input.
@@ -3857,6 +3857,12 @@ export declare abstract class Performance {
3857
3857
  get timeOrigin(): number;
3858
3858
  /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
3859
3859
  now(): number;
3860
+ /**
3861
+ * The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
3862
+ *
3863
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
3864
+ */
3865
+ toJSON(): object;
3860
3866
  }
3861
3867
  // AI Search V2 API Error Interfaces
3862
3868
  export interface AiSearchInternalError extends Error {}
@@ -9563,7 +9569,7 @@ export declare abstract class Ai<
9563
9569
  * });
9564
9570
  * ```
9565
9571
  */
9566
- aiSearch: AiSearchAccountService;
9572
+ aiSearch(): AiSearchAccountService;
9567
9573
  /**
9568
9574
  * @deprecated AutoRAG has been replaced by AI Search.
9569
9575
  * Use `env.AI.aiSearch` instead for better API design and new features.
@@ -11273,6 +11279,86 @@ export type ImageOutputOptions = {
11273
11279
  background?: string;
11274
11280
  anim?: boolean;
11275
11281
  };
11282
+ export interface ImageMetadata {
11283
+ id: string;
11284
+ filename?: string;
11285
+ uploaded?: string;
11286
+ requireSignedURLs: boolean;
11287
+ meta?: Record<string, unknown>;
11288
+ variants: string[];
11289
+ draft?: boolean;
11290
+ creator?: string;
11291
+ }
11292
+ export interface ImageUploadOptions {
11293
+ id?: string;
11294
+ filename?: string;
11295
+ requireSignedURLs?: boolean;
11296
+ metadata?: Record<string, unknown>;
11297
+ creator?: string;
11298
+ encoding?: "base64";
11299
+ }
11300
+ export interface ImageUpdateOptions {
11301
+ requireSignedURLs?: boolean;
11302
+ metadata?: Record<string, unknown>;
11303
+ creator?: string;
11304
+ }
11305
+ export interface ImageListOptions {
11306
+ limit?: number;
11307
+ cursor?: string;
11308
+ sortOrder?: "asc" | "desc";
11309
+ creator?: string;
11310
+ }
11311
+ export interface ImageList {
11312
+ images: ImageMetadata[];
11313
+ cursor?: string;
11314
+ listComplete: boolean;
11315
+ }
11316
+ export interface HostedImagesBinding {
11317
+ /**
11318
+ * Get detailed metadata for a hosted image
11319
+ * @param imageId The ID of the image (UUID or custom ID)
11320
+ * @returns Image metadata, or null if not found
11321
+ */
11322
+ details(imageId: string): Promise<ImageMetadata | null>;
11323
+ /**
11324
+ * Get the raw image data for a hosted image
11325
+ * @param imageId The ID of the image (UUID or custom ID)
11326
+ * @returns ReadableStream of image bytes, or null if not found
11327
+ */
11328
+ image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
11329
+ /**
11330
+ * Upload a new hosted image
11331
+ * @param image The image file to upload
11332
+ * @param options Upload configuration
11333
+ * @returns Metadata for the uploaded image
11334
+ * @throws {@link ImagesError} if upload fails
11335
+ */
11336
+ upload(
11337
+ image: ReadableStream<Uint8Array> | ArrayBuffer,
11338
+ options?: ImageUploadOptions,
11339
+ ): Promise<ImageMetadata>;
11340
+ /**
11341
+ * Update hosted image metadata
11342
+ * @param imageId The ID of the image
11343
+ * @param options Properties to update
11344
+ * @returns Updated image metadata
11345
+ * @throws {@link ImagesError} if update fails
11346
+ */
11347
+ update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
11348
+ /**
11349
+ * Delete a hosted image
11350
+ * @param imageId The ID of the image
11351
+ * @returns True if deleted, false if not found
11352
+ */
11353
+ delete(imageId: string): Promise<boolean>;
11354
+ /**
11355
+ * List hosted images with pagination
11356
+ * @param options List configuration
11357
+ * @returns List of images with pagination info
11358
+ * @throws {@link ImagesError} if list fails
11359
+ */
11360
+ list(options?: ImageListOptions): Promise<ImageList>;
11361
+ }
11276
11362
  export interface ImagesBinding {
11277
11363
  /**
11278
11364
  * Get image metadata (type, width and height)
@@ -11292,6 +11378,10 @@ export interface ImagesBinding {
11292
11378
  stream: ReadableStream<Uint8Array>,
11293
11379
  options?: ImageInputOptions,
11294
11380
  ): ImageTransformer;
11381
+ /**
11382
+ * Access hosted images CRUD operations
11383
+ */
11384
+ readonly hosted: HostedImagesBinding;
11295
11385
  }
11296
11386
  export interface ImageTransformer {
11297
11387
  /**
@@ -11362,8 +11452,14 @@ export interface MediaTransformer {
11362
11452
  * @returns A generator for producing the transformed media output
11363
11453
  */
11364
11454
  transform(
11365
- transform: MediaTransformationInputOptions,
11455
+ transform?: MediaTransformationInputOptions,
11366
11456
  ): MediaTransformationGenerator;
11457
+ /**
11458
+ * Generates the final media output with specified options.
11459
+ * @param output - Configuration for the output format and parameters
11460
+ * @returns The final transformation result containing the transformed media
11461
+ */
11462
+ output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
11367
11463
  }
11368
11464
  /**
11369
11465
  * Generator for producing media transformation results.
@@ -11375,7 +11471,7 @@ export interface MediaTransformationGenerator {
11375
11471
  * @param output - Configuration for the output format and parameters
11376
11472
  * @returns The final transformation result containing the transformed media
11377
11473
  */
11378
- output(output: MediaTransformationOutputOptions): MediaTransformationResult;
11474
+ output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
11379
11475
  }
11380
11476
  /**
11381
11477
  * Result of a media transformation operation.
@@ -11384,19 +11480,19 @@ export interface MediaTransformationGenerator {
11384
11480
  export interface MediaTransformationResult {
11385
11481
  /**
11386
11482
  * Returns the transformed media as a readable stream of bytes.
11387
- * @returns A stream containing the transformed media data
11483
+ * @returns A promise containing a readable stream with the transformed media
11388
11484
  */
11389
- media(): ReadableStream<Uint8Array>;
11485
+ media(): Promise<ReadableStream<Uint8Array>>;
11390
11486
  /**
11391
11487
  * Returns the transformed media as an HTTP response object.
11392
- * @returns The transformed media as a Response, ready to store in cache or return to users
11488
+ * @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
11393
11489
  */
11394
- response(): Response;
11490
+ response(): Promise<Response>;
11395
11491
  /**
11396
11492
  * Returns the MIME type of the transformed media.
11397
- * @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
11493
+ * @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
11398
11494
  */
11399
- contentType(): string;
11495
+ contentType(): Promise<string>;
11400
11496
  }
11401
11497
  /**
11402
11498
  * Configuration options for transforming media input.