@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.
@@ -3741,6 +3741,12 @@ declare abstract class Performance {
3741
3741
  get timeOrigin(): number;
3742
3742
  /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
3743
3743
  now(): number;
3744
+ /**
3745
+ * The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
3746
+ *
3747
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
3748
+ */
3749
+ toJSON(): object;
3744
3750
  }
3745
3751
  // AI Search V2 API Error Interfaces
3746
3752
  interface AiSearchInternalError extends Error {}
@@ -9444,7 +9450,7 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
9444
9450
  * });
9445
9451
  * ```
9446
9452
  */
9447
- aiSearch: AiSearchAccountService;
9453
+ aiSearch(): AiSearchAccountService;
9448
9454
  /**
9449
9455
  * @deprecated AutoRAG has been replaced by AI Search.
9450
9456
  * Use `env.AI.aiSearch` instead for better API design and new features.
@@ -11149,6 +11155,86 @@ type ImageOutputOptions = {
11149
11155
  background?: string;
11150
11156
  anim?: boolean;
11151
11157
  };
11158
+ interface ImageMetadata {
11159
+ id: string;
11160
+ filename?: string;
11161
+ uploaded?: string;
11162
+ requireSignedURLs: boolean;
11163
+ meta?: Record<string, unknown>;
11164
+ variants: string[];
11165
+ draft?: boolean;
11166
+ creator?: string;
11167
+ }
11168
+ interface ImageUploadOptions {
11169
+ id?: string;
11170
+ filename?: string;
11171
+ requireSignedURLs?: boolean;
11172
+ metadata?: Record<string, unknown>;
11173
+ creator?: string;
11174
+ encoding?: "base64";
11175
+ }
11176
+ interface ImageUpdateOptions {
11177
+ requireSignedURLs?: boolean;
11178
+ metadata?: Record<string, unknown>;
11179
+ creator?: string;
11180
+ }
11181
+ interface ImageListOptions {
11182
+ limit?: number;
11183
+ cursor?: string;
11184
+ sortOrder?: "asc" | "desc";
11185
+ creator?: string;
11186
+ }
11187
+ interface ImageList {
11188
+ images: ImageMetadata[];
11189
+ cursor?: string;
11190
+ listComplete: boolean;
11191
+ }
11192
+ interface HostedImagesBinding {
11193
+ /**
11194
+ * Get detailed metadata for a hosted image
11195
+ * @param imageId The ID of the image (UUID or custom ID)
11196
+ * @returns Image metadata, or null if not found
11197
+ */
11198
+ details(imageId: string): Promise<ImageMetadata | null>;
11199
+ /**
11200
+ * Get the raw image data for a hosted image
11201
+ * @param imageId The ID of the image (UUID or custom ID)
11202
+ * @returns ReadableStream of image bytes, or null if not found
11203
+ */
11204
+ image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
11205
+ /**
11206
+ * Upload a new hosted image
11207
+ * @param image The image file to upload
11208
+ * @param options Upload configuration
11209
+ * @returns Metadata for the uploaded image
11210
+ * @throws {@link ImagesError} if upload fails
11211
+ */
11212
+ upload(
11213
+ image: ReadableStream<Uint8Array> | ArrayBuffer,
11214
+ options?: ImageUploadOptions,
11215
+ ): Promise<ImageMetadata>;
11216
+ /**
11217
+ * Update hosted image metadata
11218
+ * @param imageId The ID of the image
11219
+ * @param options Properties to update
11220
+ * @returns Updated image metadata
11221
+ * @throws {@link ImagesError} if update fails
11222
+ */
11223
+ update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
11224
+ /**
11225
+ * Delete a hosted image
11226
+ * @param imageId The ID of the image
11227
+ * @returns True if deleted, false if not found
11228
+ */
11229
+ delete(imageId: string): Promise<boolean>;
11230
+ /**
11231
+ * List hosted images with pagination
11232
+ * @param options List configuration
11233
+ * @returns List of images with pagination info
11234
+ * @throws {@link ImagesError} if list fails
11235
+ */
11236
+ list(options?: ImageListOptions): Promise<ImageList>;
11237
+ }
11152
11238
  interface ImagesBinding {
11153
11239
  /**
11154
11240
  * Get image metadata (type, width and height)
@@ -11168,6 +11254,10 @@ interface ImagesBinding {
11168
11254
  stream: ReadableStream<Uint8Array>,
11169
11255
  options?: ImageInputOptions,
11170
11256
  ): ImageTransformer;
11257
+ /**
11258
+ * Access hosted images CRUD operations
11259
+ */
11260
+ readonly hosted: HostedImagesBinding;
11171
11261
  }
11172
11262
  interface ImageTransformer {
11173
11263
  /**
@@ -11238,8 +11328,14 @@ interface MediaTransformer {
11238
11328
  * @returns A generator for producing the transformed media output
11239
11329
  */
11240
11330
  transform(
11241
- transform: MediaTransformationInputOptions,
11331
+ transform?: MediaTransformationInputOptions,
11242
11332
  ): MediaTransformationGenerator;
11333
+ /**
11334
+ * Generates the final media output with specified options.
11335
+ * @param output - Configuration for the output format and parameters
11336
+ * @returns The final transformation result containing the transformed media
11337
+ */
11338
+ output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
11243
11339
  }
11244
11340
  /**
11245
11341
  * Generator for producing media transformation results.
@@ -11251,7 +11347,7 @@ interface MediaTransformationGenerator {
11251
11347
  * @param output - Configuration for the output format and parameters
11252
11348
  * @returns The final transformation result containing the transformed media
11253
11349
  */
11254
- output(output: MediaTransformationOutputOptions): MediaTransformationResult;
11350
+ output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
11255
11351
  }
11256
11352
  /**
11257
11353
  * Result of a media transformation operation.
@@ -11260,19 +11356,19 @@ interface MediaTransformationGenerator {
11260
11356
  interface MediaTransformationResult {
11261
11357
  /**
11262
11358
  * Returns the transformed media as a readable stream of bytes.
11263
- * @returns A stream containing the transformed media data
11359
+ * @returns A promise containing a readable stream with the transformed media
11264
11360
  */
11265
- media(): ReadableStream<Uint8Array>;
11361
+ media(): Promise<ReadableStream<Uint8Array>>;
11266
11362
  /**
11267
11363
  * Returns the transformed media as an HTTP response object.
11268
- * @returns The transformed media as a Response, ready to store in cache or return to users
11364
+ * @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
11269
11365
  */
11270
- response(): Response;
11366
+ response(): Promise<Response>;
11271
11367
  /**
11272
11368
  * Returns the MIME type of the transformed media.
11273
- * @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
11369
+ * @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
11274
11370
  */
11275
- contentType(): string;
11371
+ contentType(): Promise<string>;
11276
11372
  }
11277
11373
  /**
11278
11374
  * Configuration options for transforming media input.
@@ -3750,6 +3750,12 @@ export declare abstract class Performance {
3750
3750
  get timeOrigin(): number;
3751
3751
  /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
3752
3752
  now(): number;
3753
+ /**
3754
+ * The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
3755
+ *
3756
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
3757
+ */
3758
+ toJSON(): object;
3753
3759
  }
3754
3760
  // AI Search V2 API Error Interfaces
3755
3761
  export interface AiSearchInternalError extends Error {}
@@ -9456,7 +9462,7 @@ export declare abstract class Ai<
9456
9462
  * });
9457
9463
  * ```
9458
9464
  */
9459
- aiSearch: AiSearchAccountService;
9465
+ aiSearch(): AiSearchAccountService;
9460
9466
  /**
9461
9467
  * @deprecated AutoRAG has been replaced by AI Search.
9462
9468
  * Use `env.AI.aiSearch` instead for better API design and new features.
@@ -11166,6 +11172,86 @@ export type ImageOutputOptions = {
11166
11172
  background?: string;
11167
11173
  anim?: boolean;
11168
11174
  };
11175
+ export interface ImageMetadata {
11176
+ id: string;
11177
+ filename?: string;
11178
+ uploaded?: string;
11179
+ requireSignedURLs: boolean;
11180
+ meta?: Record<string, unknown>;
11181
+ variants: string[];
11182
+ draft?: boolean;
11183
+ creator?: string;
11184
+ }
11185
+ export interface ImageUploadOptions {
11186
+ id?: string;
11187
+ filename?: string;
11188
+ requireSignedURLs?: boolean;
11189
+ metadata?: Record<string, unknown>;
11190
+ creator?: string;
11191
+ encoding?: "base64";
11192
+ }
11193
+ export interface ImageUpdateOptions {
11194
+ requireSignedURLs?: boolean;
11195
+ metadata?: Record<string, unknown>;
11196
+ creator?: string;
11197
+ }
11198
+ export interface ImageListOptions {
11199
+ limit?: number;
11200
+ cursor?: string;
11201
+ sortOrder?: "asc" | "desc";
11202
+ creator?: string;
11203
+ }
11204
+ export interface ImageList {
11205
+ images: ImageMetadata[];
11206
+ cursor?: string;
11207
+ listComplete: boolean;
11208
+ }
11209
+ export interface HostedImagesBinding {
11210
+ /**
11211
+ * Get detailed metadata for a hosted image
11212
+ * @param imageId The ID of the image (UUID or custom ID)
11213
+ * @returns Image metadata, or null if not found
11214
+ */
11215
+ details(imageId: string): Promise<ImageMetadata | null>;
11216
+ /**
11217
+ * Get the raw image data for a hosted image
11218
+ * @param imageId The ID of the image (UUID or custom ID)
11219
+ * @returns ReadableStream of image bytes, or null if not found
11220
+ */
11221
+ image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
11222
+ /**
11223
+ * Upload a new hosted image
11224
+ * @param image The image file to upload
11225
+ * @param options Upload configuration
11226
+ * @returns Metadata for the uploaded image
11227
+ * @throws {@link ImagesError} if upload fails
11228
+ */
11229
+ upload(
11230
+ image: ReadableStream<Uint8Array> | ArrayBuffer,
11231
+ options?: ImageUploadOptions,
11232
+ ): Promise<ImageMetadata>;
11233
+ /**
11234
+ * Update hosted image metadata
11235
+ * @param imageId The ID of the image
11236
+ * @param options Properties to update
11237
+ * @returns Updated image metadata
11238
+ * @throws {@link ImagesError} if update fails
11239
+ */
11240
+ update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
11241
+ /**
11242
+ * Delete a hosted image
11243
+ * @param imageId The ID of the image
11244
+ * @returns True if deleted, false if not found
11245
+ */
11246
+ delete(imageId: string): Promise<boolean>;
11247
+ /**
11248
+ * List hosted images with pagination
11249
+ * @param options List configuration
11250
+ * @returns List of images with pagination info
11251
+ * @throws {@link ImagesError} if list fails
11252
+ */
11253
+ list(options?: ImageListOptions): Promise<ImageList>;
11254
+ }
11169
11255
  export interface ImagesBinding {
11170
11256
  /**
11171
11257
  * Get image metadata (type, width and height)
@@ -11185,6 +11271,10 @@ export interface ImagesBinding {
11185
11271
  stream: ReadableStream<Uint8Array>,
11186
11272
  options?: ImageInputOptions,
11187
11273
  ): ImageTransformer;
11274
+ /**
11275
+ * Access hosted images CRUD operations
11276
+ */
11277
+ readonly hosted: HostedImagesBinding;
11188
11278
  }
11189
11279
  export interface ImageTransformer {
11190
11280
  /**
@@ -11255,8 +11345,14 @@ export interface MediaTransformer {
11255
11345
  * @returns A generator for producing the transformed media output
11256
11346
  */
11257
11347
  transform(
11258
- transform: MediaTransformationInputOptions,
11348
+ transform?: MediaTransformationInputOptions,
11259
11349
  ): MediaTransformationGenerator;
11350
+ /**
11351
+ * Generates the final media output with specified options.
11352
+ * @param output - Configuration for the output format and parameters
11353
+ * @returns The final transformation result containing the transformed media
11354
+ */
11355
+ output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
11260
11356
  }
11261
11357
  /**
11262
11358
  * Generator for producing media transformation results.
@@ -11268,7 +11364,7 @@ export interface MediaTransformationGenerator {
11268
11364
  * @param output - Configuration for the output format and parameters
11269
11365
  * @returns The final transformation result containing the transformed media
11270
11366
  */
11271
- output(output: MediaTransformationOutputOptions): MediaTransformationResult;
11367
+ output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
11272
11368
  }
11273
11369
  /**
11274
11370
  * Result of a media transformation operation.
@@ -11277,19 +11373,19 @@ export interface MediaTransformationGenerator {
11277
11373
  export interface MediaTransformationResult {
11278
11374
  /**
11279
11375
  * Returns the transformed media as a readable stream of bytes.
11280
- * @returns A stream containing the transformed media data
11376
+ * @returns A promise containing a readable stream with the transformed media
11281
11377
  */
11282
- media(): ReadableStream<Uint8Array>;
11378
+ media(): Promise<ReadableStream<Uint8Array>>;
11283
11379
  /**
11284
11380
  * Returns the transformed media as an HTTP response object.
11285
- * @returns The transformed media as a Response, ready to store in cache or return to users
11381
+ * @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
11286
11382
  */
11287
- response(): Response;
11383
+ response(): Promise<Response>;
11288
11384
  /**
11289
11385
  * Returns the MIME type of the transformed media.
11290
- * @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
11386
+ * @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
11291
11387
  */
11292
- contentType(): string;
11388
+ contentType(): Promise<string>;
11293
11389
  }
11294
11390
  /**
11295
11391
  * Configuration options for transforming media input.
@@ -3808,6 +3808,12 @@ declare abstract class Performance {
3808
3808
  get timeOrigin(): number;
3809
3809
  /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
3810
3810
  now(): number;
3811
+ /**
3812
+ * The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
3813
+ *
3814
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
3815
+ */
3816
+ toJSON(): object;
3811
3817
  }
3812
3818
  // AI Search V2 API Error Interfaces
3813
3819
  interface AiSearchInternalError extends Error {}
@@ -9511,7 +9517,7 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
9511
9517
  * });
9512
9518
  * ```
9513
9519
  */
9514
- aiSearch: AiSearchAccountService;
9520
+ aiSearch(): AiSearchAccountService;
9515
9521
  /**
9516
9522
  * @deprecated AutoRAG has been replaced by AI Search.
9517
9523
  * Use `env.AI.aiSearch` instead for better API design and new features.
@@ -11216,6 +11222,86 @@ type ImageOutputOptions = {
11216
11222
  background?: string;
11217
11223
  anim?: boolean;
11218
11224
  };
11225
+ interface ImageMetadata {
11226
+ id: string;
11227
+ filename?: string;
11228
+ uploaded?: string;
11229
+ requireSignedURLs: boolean;
11230
+ meta?: Record<string, unknown>;
11231
+ variants: string[];
11232
+ draft?: boolean;
11233
+ creator?: string;
11234
+ }
11235
+ interface ImageUploadOptions {
11236
+ id?: string;
11237
+ filename?: string;
11238
+ requireSignedURLs?: boolean;
11239
+ metadata?: Record<string, unknown>;
11240
+ creator?: string;
11241
+ encoding?: "base64";
11242
+ }
11243
+ interface ImageUpdateOptions {
11244
+ requireSignedURLs?: boolean;
11245
+ metadata?: Record<string, unknown>;
11246
+ creator?: string;
11247
+ }
11248
+ interface ImageListOptions {
11249
+ limit?: number;
11250
+ cursor?: string;
11251
+ sortOrder?: "asc" | "desc";
11252
+ creator?: string;
11253
+ }
11254
+ interface ImageList {
11255
+ images: ImageMetadata[];
11256
+ cursor?: string;
11257
+ listComplete: boolean;
11258
+ }
11259
+ interface HostedImagesBinding {
11260
+ /**
11261
+ * Get detailed metadata for a hosted image
11262
+ * @param imageId The ID of the image (UUID or custom ID)
11263
+ * @returns Image metadata, or null if not found
11264
+ */
11265
+ details(imageId: string): Promise<ImageMetadata | null>;
11266
+ /**
11267
+ * Get the raw image data for a hosted image
11268
+ * @param imageId The ID of the image (UUID or custom ID)
11269
+ * @returns ReadableStream of image bytes, or null if not found
11270
+ */
11271
+ image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
11272
+ /**
11273
+ * Upload a new hosted image
11274
+ * @param image The image file to upload
11275
+ * @param options Upload configuration
11276
+ * @returns Metadata for the uploaded image
11277
+ * @throws {@link ImagesError} if upload fails
11278
+ */
11279
+ upload(
11280
+ image: ReadableStream<Uint8Array> | ArrayBuffer,
11281
+ options?: ImageUploadOptions,
11282
+ ): Promise<ImageMetadata>;
11283
+ /**
11284
+ * Update hosted image metadata
11285
+ * @param imageId The ID of the image
11286
+ * @param options Properties to update
11287
+ * @returns Updated image metadata
11288
+ * @throws {@link ImagesError} if update fails
11289
+ */
11290
+ update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
11291
+ /**
11292
+ * Delete a hosted image
11293
+ * @param imageId The ID of the image
11294
+ * @returns True if deleted, false if not found
11295
+ */
11296
+ delete(imageId: string): Promise<boolean>;
11297
+ /**
11298
+ * List hosted images with pagination
11299
+ * @param options List configuration
11300
+ * @returns List of images with pagination info
11301
+ * @throws {@link ImagesError} if list fails
11302
+ */
11303
+ list(options?: ImageListOptions): Promise<ImageList>;
11304
+ }
11219
11305
  interface ImagesBinding {
11220
11306
  /**
11221
11307
  * Get image metadata (type, width and height)
@@ -11235,6 +11321,10 @@ interface ImagesBinding {
11235
11321
  stream: ReadableStream<Uint8Array>,
11236
11322
  options?: ImageInputOptions,
11237
11323
  ): ImageTransformer;
11324
+ /**
11325
+ * Access hosted images CRUD operations
11326
+ */
11327
+ readonly hosted: HostedImagesBinding;
11238
11328
  }
11239
11329
  interface ImageTransformer {
11240
11330
  /**
@@ -11305,8 +11395,14 @@ interface MediaTransformer {
11305
11395
  * @returns A generator for producing the transformed media output
11306
11396
  */
11307
11397
  transform(
11308
- transform: MediaTransformationInputOptions,
11398
+ transform?: MediaTransformationInputOptions,
11309
11399
  ): MediaTransformationGenerator;
11400
+ /**
11401
+ * Generates the final media output with specified options.
11402
+ * @param output - Configuration for the output format and parameters
11403
+ * @returns The final transformation result containing the transformed media
11404
+ */
11405
+ output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
11310
11406
  }
11311
11407
  /**
11312
11408
  * Generator for producing media transformation results.
@@ -11318,7 +11414,7 @@ interface MediaTransformationGenerator {
11318
11414
  * @param output - Configuration for the output format and parameters
11319
11415
  * @returns The final transformation result containing the transformed media
11320
11416
  */
11321
- output(output: MediaTransformationOutputOptions): MediaTransformationResult;
11417
+ output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
11322
11418
  }
11323
11419
  /**
11324
11420
  * Result of a media transformation operation.
@@ -11327,19 +11423,19 @@ interface MediaTransformationGenerator {
11327
11423
  interface MediaTransformationResult {
11328
11424
  /**
11329
11425
  * Returns the transformed media as a readable stream of bytes.
11330
- * @returns A stream containing the transformed media data
11426
+ * @returns A promise containing a readable stream with the transformed media
11331
11427
  */
11332
- media(): ReadableStream<Uint8Array>;
11428
+ media(): Promise<ReadableStream<Uint8Array>>;
11333
11429
  /**
11334
11430
  * Returns the transformed media as an HTTP response object.
11335
- * @returns The transformed media as a Response, ready to store in cache or return to users
11431
+ * @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
11336
11432
  */
11337
- response(): Response;
11433
+ response(): Promise<Response>;
11338
11434
  /**
11339
11435
  * Returns the MIME type of the transformed media.
11340
- * @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
11436
+ * @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
11341
11437
  */
11342
- contentType(): string;
11438
+ contentType(): Promise<string>;
11343
11439
  }
11344
11440
  /**
11345
11441
  * Configuration options for transforming media input.
@@ -3817,6 +3817,12 @@ export declare abstract class Performance {
3817
3817
  get timeOrigin(): number;
3818
3818
  /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
3819
3819
  now(): number;
3820
+ /**
3821
+ * The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
3822
+ *
3823
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
3824
+ */
3825
+ toJSON(): object;
3820
3826
  }
3821
3827
  // AI Search V2 API Error Interfaces
3822
3828
  export interface AiSearchInternalError extends Error {}
@@ -9523,7 +9529,7 @@ export declare abstract class Ai<
9523
9529
  * });
9524
9530
  * ```
9525
9531
  */
9526
- aiSearch: AiSearchAccountService;
9532
+ aiSearch(): AiSearchAccountService;
9527
9533
  /**
9528
9534
  * @deprecated AutoRAG has been replaced by AI Search.
9529
9535
  * Use `env.AI.aiSearch` instead for better API design and new features.
@@ -11233,6 +11239,86 @@ export type ImageOutputOptions = {
11233
11239
  background?: string;
11234
11240
  anim?: boolean;
11235
11241
  };
11242
+ export interface ImageMetadata {
11243
+ id: string;
11244
+ filename?: string;
11245
+ uploaded?: string;
11246
+ requireSignedURLs: boolean;
11247
+ meta?: Record<string, unknown>;
11248
+ variants: string[];
11249
+ draft?: boolean;
11250
+ creator?: string;
11251
+ }
11252
+ export interface ImageUploadOptions {
11253
+ id?: string;
11254
+ filename?: string;
11255
+ requireSignedURLs?: boolean;
11256
+ metadata?: Record<string, unknown>;
11257
+ creator?: string;
11258
+ encoding?: "base64";
11259
+ }
11260
+ export interface ImageUpdateOptions {
11261
+ requireSignedURLs?: boolean;
11262
+ metadata?: Record<string, unknown>;
11263
+ creator?: string;
11264
+ }
11265
+ export interface ImageListOptions {
11266
+ limit?: number;
11267
+ cursor?: string;
11268
+ sortOrder?: "asc" | "desc";
11269
+ creator?: string;
11270
+ }
11271
+ export interface ImageList {
11272
+ images: ImageMetadata[];
11273
+ cursor?: string;
11274
+ listComplete: boolean;
11275
+ }
11276
+ export interface HostedImagesBinding {
11277
+ /**
11278
+ * Get detailed metadata for a hosted image
11279
+ * @param imageId The ID of the image (UUID or custom ID)
11280
+ * @returns Image metadata, or null if not found
11281
+ */
11282
+ details(imageId: string): Promise<ImageMetadata | null>;
11283
+ /**
11284
+ * Get the raw image data for a hosted image
11285
+ * @param imageId The ID of the image (UUID or custom ID)
11286
+ * @returns ReadableStream of image bytes, or null if not found
11287
+ */
11288
+ image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
11289
+ /**
11290
+ * Upload a new hosted image
11291
+ * @param image The image file to upload
11292
+ * @param options Upload configuration
11293
+ * @returns Metadata for the uploaded image
11294
+ * @throws {@link ImagesError} if upload fails
11295
+ */
11296
+ upload(
11297
+ image: ReadableStream<Uint8Array> | ArrayBuffer,
11298
+ options?: ImageUploadOptions,
11299
+ ): Promise<ImageMetadata>;
11300
+ /**
11301
+ * Update hosted image metadata
11302
+ * @param imageId The ID of the image
11303
+ * @param options Properties to update
11304
+ * @returns Updated image metadata
11305
+ * @throws {@link ImagesError} if update fails
11306
+ */
11307
+ update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
11308
+ /**
11309
+ * Delete a hosted image
11310
+ * @param imageId The ID of the image
11311
+ * @returns True if deleted, false if not found
11312
+ */
11313
+ delete(imageId: string): Promise<boolean>;
11314
+ /**
11315
+ * List hosted images with pagination
11316
+ * @param options List configuration
11317
+ * @returns List of images with pagination info
11318
+ * @throws {@link ImagesError} if list fails
11319
+ */
11320
+ list(options?: ImageListOptions): Promise<ImageList>;
11321
+ }
11236
11322
  export interface ImagesBinding {
11237
11323
  /**
11238
11324
  * Get image metadata (type, width and height)
@@ -11252,6 +11338,10 @@ export interface ImagesBinding {
11252
11338
  stream: ReadableStream<Uint8Array>,
11253
11339
  options?: ImageInputOptions,
11254
11340
  ): ImageTransformer;
11341
+ /**
11342
+ * Access hosted images CRUD operations
11343
+ */
11344
+ readonly hosted: HostedImagesBinding;
11255
11345
  }
11256
11346
  export interface ImageTransformer {
11257
11347
  /**
@@ -11322,8 +11412,14 @@ export interface MediaTransformer {
11322
11412
  * @returns A generator for producing the transformed media output
11323
11413
  */
11324
11414
  transform(
11325
- transform: MediaTransformationInputOptions,
11415
+ transform?: MediaTransformationInputOptions,
11326
11416
  ): MediaTransformationGenerator;
11417
+ /**
11418
+ * Generates the final media output with specified options.
11419
+ * @param output - Configuration for the output format and parameters
11420
+ * @returns The final transformation result containing the transformed media
11421
+ */
11422
+ output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
11327
11423
  }
11328
11424
  /**
11329
11425
  * Generator for producing media transformation results.
@@ -11335,7 +11431,7 @@ export interface MediaTransformationGenerator {
11335
11431
  * @param output - Configuration for the output format and parameters
11336
11432
  * @returns The final transformation result containing the transformed media
11337
11433
  */
11338
- output(output: MediaTransformationOutputOptions): MediaTransformationResult;
11434
+ output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
11339
11435
  }
11340
11436
  /**
11341
11437
  * Result of a media transformation operation.
@@ -11344,19 +11440,19 @@ export interface MediaTransformationGenerator {
11344
11440
  export interface MediaTransformationResult {
11345
11441
  /**
11346
11442
  * Returns the transformed media as a readable stream of bytes.
11347
- * @returns A stream containing the transformed media data
11443
+ * @returns A promise containing a readable stream with the transformed media
11348
11444
  */
11349
- media(): ReadableStream<Uint8Array>;
11445
+ media(): Promise<ReadableStream<Uint8Array>>;
11350
11446
  /**
11351
11447
  * Returns the transformed media as an HTTP response object.
11352
- * @returns The transformed media as a Response, ready to store in cache or return to users
11448
+ * @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
11353
11449
  */
11354
- response(): Response;
11450
+ response(): Promise<Response>;
11355
11451
  /**
11356
11452
  * Returns the MIME type of the transformed media.
11357
- * @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
11453
+ * @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
11358
11454
  */
11359
- contentType(): string;
11455
+ contentType(): Promise<string>;
11360
11456
  }
11361
11457
  /**
11362
11458
  * Configuration options for transforming media input.