@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.
@@ -635,10 +635,16 @@ type DurableObjectRoutingMode = "primary-only";
635
635
  interface DurableObjectNamespaceGetDurableObjectOptions {
636
636
  locationHint?: DurableObjectLocationHint;
637
637
  routingMode?: DurableObjectRoutingMode;
638
+ version?: {
639
+ cohort?: string;
640
+ };
638
641
  }
639
642
  interface DurableObjectClass<
640
643
  _T extends Rpc.DurableObjectBranded | undefined = undefined,
641
644
  > {}
645
+ interface DurableObjectNamespaceGetDurableObjectOptionsVersionOptions {
646
+ cohort?: string;
647
+ }
642
648
  interface DurableObjectState<Props = unknown> {
643
649
  waitUntil(promise: Promise<any>): void;
644
650
  readonly exports: Cloudflare.Exports;
@@ -647,6 +653,7 @@ interface DurableObjectState<Props = unknown> {
647
653
  readonly storage: DurableObjectStorage;
648
654
  container?: Container;
649
655
  facets: DurableObjectFacets;
656
+ version?: DurableObjectStateVersion;
650
657
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
651
658
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
652
659
  getWebSockets(tag?: string): WebSocket[];
@@ -781,6 +788,9 @@ interface FacetStartupOptions<
781
788
  id?: DurableObjectId | string;
782
789
  class: DurableObjectClass<T>;
783
790
  }
791
+ interface DurableObjectStateVersion {
792
+ cohort?: string;
793
+ }
784
794
  interface AnalyticsEngineDataset {
785
795
  writeDataPoint(event?: AnalyticsEngineDataPoint): void;
786
796
  }
@@ -4089,8 +4099,18 @@ type LoopbackServiceStub<
4089
4099
  T extends Rpc.WorkerEntrypointBranded | undefined = undefined,
4090
4100
  > = Fetcher<T> &
4091
4101
  (T extends CloudflareWorkersModule.WorkerEntrypoint<any, infer Props>
4092
- ? (opts: { props?: Props }) => Fetcher<T>
4093
- : (opts: { props?: any }) => Fetcher<T>);
4102
+ ? (opts: {
4103
+ props?: Props;
4104
+ version?: {
4105
+ cohort?: string | null;
4106
+ };
4107
+ }) => Fetcher<T>
4108
+ : (opts: {
4109
+ props?: any;
4110
+ version?: {
4111
+ cohort?: string | null;
4112
+ };
4113
+ }) => Fetcher<T>);
4094
4114
  type LoopbackDurableObjectClass<
4095
4115
  T extends Rpc.DurableObjectBranded | undefined = undefined,
4096
4116
  > = DurableObjectClass<T> &
@@ -4222,6 +4242,12 @@ declare abstract class Performance extends EventTarget {
4222
4242
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/setResourceTimingBufferSize)
4223
4243
  */
4224
4244
  setResourceTimingBufferSize(size: number): void;
4245
+ /**
4246
+ * The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
4247
+ *
4248
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
4249
+ */
4250
+ toJSON(): object;
4225
4251
  get nodeTiming(): PerformanceNodeTiming;
4226
4252
  eventLoopUtilization(): PerformanceEventLoopUtilization;
4227
4253
  markResourceTiming(): void;
@@ -4241,7 +4267,7 @@ interface PerformanceNodeTiming extends PerformanceEntry {
4241
4267
  readonly loopExit: number;
4242
4268
  readonly idleTime: number;
4243
4269
  readonly uvMetricsInfo: UvMetricsInfo;
4244
- toJSON(): any;
4270
+ toJSON(): object;
4245
4271
  }
4246
4272
  interface UvMetricsInfo {
4247
4273
  loopCount: number;
@@ -4261,7 +4287,7 @@ declare class PerformanceMark extends PerformanceEntry {
4261
4287
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMark/detail)
4262
4288
  */
4263
4289
  get detail(): any;
4264
- toJSON(): any;
4290
+ toJSON(): object;
4265
4291
  }
4266
4292
  /**
4267
4293
  * **`PerformanceMeasure`** is an _abstract_ interface for PerformanceEntry objects with an PerformanceEntry.entryType of `'measure'`.
@@ -4275,7 +4301,7 @@ declare abstract class PerformanceMeasure extends PerformanceEntry {
4275
4301
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMeasure/detail)
4276
4302
  */
4277
4303
  get detail(): any;
4278
- toJSON(): any;
4304
+ toJSON(): object;
4279
4305
  }
4280
4306
  interface PerformanceMarkOptions {
4281
4307
  detail?: any;
@@ -4347,7 +4373,7 @@ declare abstract class PerformanceEntry {
4347
4373
  *
4348
4374
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/toJSON)
4349
4375
  */
4350
- toJSON(): any;
4376
+ toJSON(): object;
4351
4377
  }
4352
4378
  /**
4353
4379
  * The **`PerformanceResourceTiming`** interface enables retrieval and analysis of detailed network timing data regarding the loading of an application's resources.
@@ -10212,7 +10238,7 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
10212
10238
  * });
10213
10239
  * ```
10214
10240
  */
10215
- aiSearch: AiSearchAccountService;
10241
+ aiSearch(): AiSearchAccountService;
10216
10242
  /**
10217
10243
  * @deprecated AutoRAG has been replaced by AI Search.
10218
10244
  * Use `env.AI.aiSearch` instead for better API design and new features.
@@ -11917,6 +11943,86 @@ type ImageOutputOptions = {
11917
11943
  background?: string;
11918
11944
  anim?: boolean;
11919
11945
  };
11946
+ interface ImageMetadata {
11947
+ id: string;
11948
+ filename?: string;
11949
+ uploaded?: string;
11950
+ requireSignedURLs: boolean;
11951
+ meta?: Record<string, unknown>;
11952
+ variants: string[];
11953
+ draft?: boolean;
11954
+ creator?: string;
11955
+ }
11956
+ interface ImageUploadOptions {
11957
+ id?: string;
11958
+ filename?: string;
11959
+ requireSignedURLs?: boolean;
11960
+ metadata?: Record<string, unknown>;
11961
+ creator?: string;
11962
+ encoding?: "base64";
11963
+ }
11964
+ interface ImageUpdateOptions {
11965
+ requireSignedURLs?: boolean;
11966
+ metadata?: Record<string, unknown>;
11967
+ creator?: string;
11968
+ }
11969
+ interface ImageListOptions {
11970
+ limit?: number;
11971
+ cursor?: string;
11972
+ sortOrder?: "asc" | "desc";
11973
+ creator?: string;
11974
+ }
11975
+ interface ImageList {
11976
+ images: ImageMetadata[];
11977
+ cursor?: string;
11978
+ listComplete: boolean;
11979
+ }
11980
+ interface HostedImagesBinding {
11981
+ /**
11982
+ * Get detailed metadata for a hosted image
11983
+ * @param imageId The ID of the image (UUID or custom ID)
11984
+ * @returns Image metadata, or null if not found
11985
+ */
11986
+ details(imageId: string): Promise<ImageMetadata | null>;
11987
+ /**
11988
+ * Get the raw image data for a hosted image
11989
+ * @param imageId The ID of the image (UUID or custom ID)
11990
+ * @returns ReadableStream of image bytes, or null if not found
11991
+ */
11992
+ image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
11993
+ /**
11994
+ * Upload a new hosted image
11995
+ * @param image The image file to upload
11996
+ * @param options Upload configuration
11997
+ * @returns Metadata for the uploaded image
11998
+ * @throws {@link ImagesError} if upload fails
11999
+ */
12000
+ upload(
12001
+ image: ReadableStream<Uint8Array> | ArrayBuffer,
12002
+ options?: ImageUploadOptions,
12003
+ ): Promise<ImageMetadata>;
12004
+ /**
12005
+ * Update hosted image metadata
12006
+ * @param imageId The ID of the image
12007
+ * @param options Properties to update
12008
+ * @returns Updated image metadata
12009
+ * @throws {@link ImagesError} if update fails
12010
+ */
12011
+ update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
12012
+ /**
12013
+ * Delete a hosted image
12014
+ * @param imageId The ID of the image
12015
+ * @returns True if deleted, false if not found
12016
+ */
12017
+ delete(imageId: string): Promise<boolean>;
12018
+ /**
12019
+ * List hosted images with pagination
12020
+ * @param options List configuration
12021
+ * @returns List of images with pagination info
12022
+ * @throws {@link ImagesError} if list fails
12023
+ */
12024
+ list(options?: ImageListOptions): Promise<ImageList>;
12025
+ }
11920
12026
  interface ImagesBinding {
11921
12027
  /**
11922
12028
  * Get image metadata (type, width and height)
@@ -11936,6 +12042,10 @@ interface ImagesBinding {
11936
12042
  stream: ReadableStream<Uint8Array>,
11937
12043
  options?: ImageInputOptions,
11938
12044
  ): ImageTransformer;
12045
+ /**
12046
+ * Access hosted images CRUD operations
12047
+ */
12048
+ readonly hosted: HostedImagesBinding;
11939
12049
  }
11940
12050
  interface ImageTransformer {
11941
12051
  /**
@@ -12006,8 +12116,14 @@ interface MediaTransformer {
12006
12116
  * @returns A generator for producing the transformed media output
12007
12117
  */
12008
12118
  transform(
12009
- transform: MediaTransformationInputOptions,
12119
+ transform?: MediaTransformationInputOptions,
12010
12120
  ): MediaTransformationGenerator;
12121
+ /**
12122
+ * Generates the final media output with specified options.
12123
+ * @param output - Configuration for the output format and parameters
12124
+ * @returns The final transformation result containing the transformed media
12125
+ */
12126
+ output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
12011
12127
  }
12012
12128
  /**
12013
12129
  * Generator for producing media transformation results.
@@ -12019,7 +12135,7 @@ interface MediaTransformationGenerator {
12019
12135
  * @param output - Configuration for the output format and parameters
12020
12136
  * @returns The final transformation result containing the transformed media
12021
12137
  */
12022
- output(output: MediaTransformationOutputOptions): MediaTransformationResult;
12138
+ output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
12023
12139
  }
12024
12140
  /**
12025
12141
  * Result of a media transformation operation.
@@ -12028,19 +12144,19 @@ interface MediaTransformationGenerator {
12028
12144
  interface MediaTransformationResult {
12029
12145
  /**
12030
12146
  * Returns the transformed media as a readable stream of bytes.
12031
- * @returns A stream containing the transformed media data
12147
+ * @returns A promise containing a readable stream with the transformed media
12032
12148
  */
12033
- media(): ReadableStream<Uint8Array>;
12149
+ media(): Promise<ReadableStream<Uint8Array>>;
12034
12150
  /**
12035
12151
  * Returns the transformed media as an HTTP response object.
12036
- * @returns The transformed media as a Response, ready to store in cache or return to users
12152
+ * @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
12037
12153
  */
12038
- response(): Response;
12154
+ response(): Promise<Response>;
12039
12155
  /**
12040
12156
  * Returns the MIME type of the transformed media.
12041
- * @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
12157
+ * @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
12042
12158
  */
12043
- contentType(): string;
12159
+ contentType(): Promise<string>;
12044
12160
  }
12045
12161
  /**
12046
12162
  * Configuration options for transforming media input.
@@ -640,10 +640,16 @@ export type DurableObjectRoutingMode = "primary-only";
640
640
  export interface DurableObjectNamespaceGetDurableObjectOptions {
641
641
  locationHint?: DurableObjectLocationHint;
642
642
  routingMode?: DurableObjectRoutingMode;
643
+ version?: {
644
+ cohort?: string;
645
+ };
643
646
  }
644
647
  export interface DurableObjectClass<
645
648
  _T extends Rpc.DurableObjectBranded | undefined = undefined,
646
649
  > {}
650
+ export interface DurableObjectNamespaceGetDurableObjectOptionsVersionOptions {
651
+ cohort?: string;
652
+ }
647
653
  export interface DurableObjectState<Props = unknown> {
648
654
  waitUntil(promise: Promise<any>): void;
649
655
  readonly exports: Cloudflare.Exports;
@@ -652,6 +658,7 @@ export interface DurableObjectState<Props = unknown> {
652
658
  readonly storage: DurableObjectStorage;
653
659
  container?: Container;
654
660
  facets: DurableObjectFacets;
661
+ version?: DurableObjectStateVersion;
655
662
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
656
663
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
657
664
  getWebSockets(tag?: string): WebSocket[];
@@ -786,6 +793,9 @@ export interface FacetStartupOptions<
786
793
  id?: DurableObjectId | string;
787
794
  class: DurableObjectClass<T>;
788
795
  }
796
+ export interface DurableObjectStateVersion {
797
+ cohort?: string;
798
+ }
789
799
  export interface AnalyticsEngineDataset {
790
800
  writeDataPoint(event?: AnalyticsEngineDataPoint): void;
791
801
  }
@@ -4098,8 +4108,18 @@ export type LoopbackServiceStub<
4098
4108
  T extends Rpc.WorkerEntrypointBranded | undefined = undefined,
4099
4109
  > = Fetcher<T> &
4100
4110
  (T extends CloudflareWorkersModule.WorkerEntrypoint<any, infer Props>
4101
- ? (opts: { props?: Props }) => Fetcher<T>
4102
- : (opts: { props?: any }) => Fetcher<T>);
4111
+ ? (opts: {
4112
+ props?: Props;
4113
+ version?: {
4114
+ cohort?: string | null;
4115
+ };
4116
+ }) => Fetcher<T>
4117
+ : (opts: {
4118
+ props?: any;
4119
+ version?: {
4120
+ cohort?: string | null;
4121
+ };
4122
+ }) => Fetcher<T>);
4103
4123
  export type LoopbackDurableObjectClass<
4104
4124
  T extends Rpc.DurableObjectBranded | undefined = undefined,
4105
4125
  > = DurableObjectClass<T> &
@@ -4231,6 +4251,12 @@ export declare abstract class Performance extends EventTarget {
4231
4251
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/setResourceTimingBufferSize)
4232
4252
  */
4233
4253
  setResourceTimingBufferSize(size: number): void;
4254
+ /**
4255
+ * The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
4256
+ *
4257
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
4258
+ */
4259
+ toJSON(): object;
4234
4260
  get nodeTiming(): PerformanceNodeTiming;
4235
4261
  eventLoopUtilization(): PerformanceEventLoopUtilization;
4236
4262
  markResourceTiming(): void;
@@ -4250,7 +4276,7 @@ export interface PerformanceNodeTiming extends PerformanceEntry {
4250
4276
  readonly loopExit: number;
4251
4277
  readonly idleTime: number;
4252
4278
  readonly uvMetricsInfo: UvMetricsInfo;
4253
- toJSON(): any;
4279
+ toJSON(): object;
4254
4280
  }
4255
4281
  export interface UvMetricsInfo {
4256
4282
  loopCount: number;
@@ -4270,7 +4296,7 @@ export declare class PerformanceMark extends PerformanceEntry {
4270
4296
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMark/detail)
4271
4297
  */
4272
4298
  get detail(): any;
4273
- toJSON(): any;
4299
+ toJSON(): object;
4274
4300
  }
4275
4301
  /**
4276
4302
  * **`PerformanceMeasure`** is an _abstract_ interface for PerformanceEntry objects with an PerformanceEntry.entryType of `'measure'`.
@@ -4284,7 +4310,7 @@ export declare abstract class PerformanceMeasure extends PerformanceEntry {
4284
4310
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceMeasure/detail)
4285
4311
  */
4286
4312
  get detail(): any;
4287
- toJSON(): any;
4313
+ toJSON(): object;
4288
4314
  }
4289
4315
  export interface PerformanceMarkOptions {
4290
4316
  detail?: any;
@@ -4356,7 +4382,7 @@ export declare abstract class PerformanceEntry {
4356
4382
  *
4357
4383
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PerformanceEntry/toJSON)
4358
4384
  */
4359
- toJSON(): any;
4385
+ toJSON(): object;
4360
4386
  }
4361
4387
  /**
4362
4388
  * The **`PerformanceResourceTiming`** interface enables retrieval and analysis of detailed network timing data regarding the loading of an application's resources.
@@ -10224,7 +10250,7 @@ export declare abstract class Ai<
10224
10250
  * });
10225
10251
  * ```
10226
10252
  */
10227
- aiSearch: AiSearchAccountService;
10253
+ aiSearch(): AiSearchAccountService;
10228
10254
  /**
10229
10255
  * @deprecated AutoRAG has been replaced by AI Search.
10230
10256
  * Use `env.AI.aiSearch` instead for better API design and new features.
@@ -11934,6 +11960,86 @@ export type ImageOutputOptions = {
11934
11960
  background?: string;
11935
11961
  anim?: boolean;
11936
11962
  };
11963
+ export interface ImageMetadata {
11964
+ id: string;
11965
+ filename?: string;
11966
+ uploaded?: string;
11967
+ requireSignedURLs: boolean;
11968
+ meta?: Record<string, unknown>;
11969
+ variants: string[];
11970
+ draft?: boolean;
11971
+ creator?: string;
11972
+ }
11973
+ export interface ImageUploadOptions {
11974
+ id?: string;
11975
+ filename?: string;
11976
+ requireSignedURLs?: boolean;
11977
+ metadata?: Record<string, unknown>;
11978
+ creator?: string;
11979
+ encoding?: "base64";
11980
+ }
11981
+ export interface ImageUpdateOptions {
11982
+ requireSignedURLs?: boolean;
11983
+ metadata?: Record<string, unknown>;
11984
+ creator?: string;
11985
+ }
11986
+ export interface ImageListOptions {
11987
+ limit?: number;
11988
+ cursor?: string;
11989
+ sortOrder?: "asc" | "desc";
11990
+ creator?: string;
11991
+ }
11992
+ export interface ImageList {
11993
+ images: ImageMetadata[];
11994
+ cursor?: string;
11995
+ listComplete: boolean;
11996
+ }
11997
+ export interface HostedImagesBinding {
11998
+ /**
11999
+ * Get detailed metadata for a hosted image
12000
+ * @param imageId The ID of the image (UUID or custom ID)
12001
+ * @returns Image metadata, or null if not found
12002
+ */
12003
+ details(imageId: string): Promise<ImageMetadata | null>;
12004
+ /**
12005
+ * Get the raw image data for a hosted image
12006
+ * @param imageId The ID of the image (UUID or custom ID)
12007
+ * @returns ReadableStream of image bytes, or null if not found
12008
+ */
12009
+ image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
12010
+ /**
12011
+ * Upload a new hosted image
12012
+ * @param image The image file to upload
12013
+ * @param options Upload configuration
12014
+ * @returns Metadata for the uploaded image
12015
+ * @throws {@link ImagesError} if upload fails
12016
+ */
12017
+ upload(
12018
+ image: ReadableStream<Uint8Array> | ArrayBuffer,
12019
+ options?: ImageUploadOptions,
12020
+ ): Promise<ImageMetadata>;
12021
+ /**
12022
+ * Update hosted image metadata
12023
+ * @param imageId The ID of the image
12024
+ * @param options Properties to update
12025
+ * @returns Updated image metadata
12026
+ * @throws {@link ImagesError} if update fails
12027
+ */
12028
+ update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
12029
+ /**
12030
+ * Delete a hosted image
12031
+ * @param imageId The ID of the image
12032
+ * @returns True if deleted, false if not found
12033
+ */
12034
+ delete(imageId: string): Promise<boolean>;
12035
+ /**
12036
+ * List hosted images with pagination
12037
+ * @param options List configuration
12038
+ * @returns List of images with pagination info
12039
+ * @throws {@link ImagesError} if list fails
12040
+ */
12041
+ list(options?: ImageListOptions): Promise<ImageList>;
12042
+ }
11937
12043
  export interface ImagesBinding {
11938
12044
  /**
11939
12045
  * Get image metadata (type, width and height)
@@ -11953,6 +12059,10 @@ export interface ImagesBinding {
11953
12059
  stream: ReadableStream<Uint8Array>,
11954
12060
  options?: ImageInputOptions,
11955
12061
  ): ImageTransformer;
12062
+ /**
12063
+ * Access hosted images CRUD operations
12064
+ */
12065
+ readonly hosted: HostedImagesBinding;
11956
12066
  }
11957
12067
  export interface ImageTransformer {
11958
12068
  /**
@@ -12023,8 +12133,14 @@ export interface MediaTransformer {
12023
12133
  * @returns A generator for producing the transformed media output
12024
12134
  */
12025
12135
  transform(
12026
- transform: MediaTransformationInputOptions,
12136
+ transform?: MediaTransformationInputOptions,
12027
12137
  ): MediaTransformationGenerator;
12138
+ /**
12139
+ * Generates the final media output with specified options.
12140
+ * @param output - Configuration for the output format and parameters
12141
+ * @returns The final transformation result containing the transformed media
12142
+ */
12143
+ output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
12028
12144
  }
12029
12145
  /**
12030
12146
  * Generator for producing media transformation results.
@@ -12036,7 +12152,7 @@ export interface MediaTransformationGenerator {
12036
12152
  * @param output - Configuration for the output format and parameters
12037
12153
  * @returns The final transformation result containing the transformed media
12038
12154
  */
12039
- output(output: MediaTransformationOutputOptions): MediaTransformationResult;
12155
+ output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
12040
12156
  }
12041
12157
  /**
12042
12158
  * Result of a media transformation operation.
@@ -12045,19 +12161,19 @@ export interface MediaTransformationGenerator {
12045
12161
  export interface MediaTransformationResult {
12046
12162
  /**
12047
12163
  * Returns the transformed media as a readable stream of bytes.
12048
- * @returns A stream containing the transformed media data
12164
+ * @returns A promise containing a readable stream with the transformed media
12049
12165
  */
12050
- media(): ReadableStream<Uint8Array>;
12166
+ media(): Promise<ReadableStream<Uint8Array>>;
12051
12167
  /**
12052
12168
  * Returns the transformed media as an HTTP response object.
12053
- * @returns The transformed media as a Response, ready to store in cache or return to users
12169
+ * @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
12054
12170
  */
12055
- response(): Response;
12171
+ response(): Promise<Response>;
12056
12172
  /**
12057
12173
  * Returns the MIME type of the transformed media.
12058
- * @returns The content type string (e.g., 'image/jpeg', 'video/mp4')
12174
+ * @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
12059
12175
  */
12060
- contentType(): string;
12176
+ contentType(): Promise<string>;
12061
12177
  }
12062
12178
  /**
12063
12179
  * Configuration options for transforming media input.
package/index.d.ts CHANGED
@@ -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.