@cloudflare/workers-types 4.20241106.0 → 4.20241127.0

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.
@@ -228,7 +228,7 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
228
228
  structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
229
229
  reportError(error: any): void;
230
230
  fetch(
231
- input: RequestInfo,
231
+ input: RequestInfo | URL,
232
232
  init?: RequestInit<RequestInitCfProperties>,
233
233
  ): Promise<Response>;
234
234
  self: ServiceWorkerGlobalScope;
@@ -361,7 +361,7 @@ export declare function structuredClone<T>(
361
361
  export declare function reportError(error: any): void;
362
362
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
363
363
  export declare function fetch(
364
- input: RequestInfo,
364
+ input: RequestInfo | URL,
365
365
  init?: RequestInit<RequestInitCfProperties>,
366
366
  ): Promise<Response>;
367
367
  export declare const self: ServiceWorkerGlobalScope;
@@ -940,7 +940,7 @@ export declare class Blob {
940
940
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
941
941
  slice(start?: number, end?: number, type?: string): Blob;
942
942
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) */
943
- arrayBuffer(): Promise<ArrayBuffer>;
943
+ arrayBuffer(): Promise<ArrayBuffer | ArrayBufferView>;
944
944
  bytes(): Promise<Uint8Array>;
945
945
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
946
946
  text(): Promise<string>;
@@ -987,14 +987,17 @@ export declare abstract class CacheStorage {
987
987
  */
988
988
  export declare abstract class Cache {
989
989
  /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */
990
- delete(request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>;
990
+ delete(
991
+ request: RequestInfo | URL,
992
+ options?: CacheQueryOptions,
993
+ ): Promise<boolean>;
991
994
  /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */
992
995
  match(
993
- request: RequestInfo,
996
+ request: RequestInfo | URL,
994
997
  options?: CacheQueryOptions,
995
998
  ): Promise<Response | undefined>;
996
999
  /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */
997
- put(request: RequestInfo, response: Response): Promise<void>;
1000
+ put(request: RequestInfo | URL, response: Response): Promise<void>;
998
1001
  }
999
1002
  export interface CacheQueryOptions {
1000
1003
  ignoreMethod?: boolean;
@@ -1513,7 +1516,7 @@ export declare abstract class Body {
1513
1516
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */
1514
1517
  get bodyUsed(): boolean;
1515
1518
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */
1516
- arrayBuffer(): Promise<ArrayBuffer>;
1519
+ arrayBuffer(): Promise<ArrayBuffer | ArrayBufferView>;
1517
1520
  bytes(): Promise<Uint8Array>;
1518
1521
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */
1519
1522
  text(): Promise<string>;
@@ -1569,7 +1572,7 @@ export interface ResponseInit {
1569
1572
  export type RequestInfo<
1570
1573
  CfHostMetadata = unknown,
1571
1574
  Cf = CfProperties<CfHostMetadata>,
1572
- > = Request<CfHostMetadata, Cf> | string | URL;
1575
+ > = Request<CfHostMetadata, Cf> | string;
1573
1576
  /**
1574
1577
  * This Fetch API interface represents a resource request.
1575
1578
  *
@@ -1578,7 +1581,7 @@ export type RequestInfo<
1578
1581
  export declare var Request: {
1579
1582
  prototype: Request;
1580
1583
  new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(
1581
- input: RequestInfo<CfProperties>,
1584
+ input: RequestInfo<CfProperties> | URL,
1582
1585
  init?: RequestInit<Cf>,
1583
1586
  ): Request<CfHostMetadata, Cf>;
1584
1587
  };
@@ -1663,7 +1666,7 @@ export type Fetcher<
1663
1666
  > = (T extends Rpc.EntrypointBranded
1664
1667
  ? Rpc.Provider<T, Reserved | "fetch" | "connect">
1665
1668
  : unknown) & {
1666
- fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1669
+ fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
1667
1670
  connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1668
1671
  };
1669
1672
  export interface FetcherPutOptions {
@@ -1884,6 +1887,7 @@ export interface R2MultipartUpload {
1884
1887
  uploadPart(
1885
1888
  partNumber: number,
1886
1889
  value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob,
1890
+ options?: R2UploadPartOptions,
1887
1891
  ): Promise<R2UploadedPart>;
1888
1892
  abort(): Promise<void>;
1889
1893
  complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
@@ -1904,12 +1908,13 @@ export declare abstract class R2Object {
1904
1908
  readonly customMetadata?: Record<string, string>;
1905
1909
  readonly range?: R2Range;
1906
1910
  readonly storageClass: string;
1911
+ readonly ssecKeyMd5?: string;
1907
1912
  writeHttpMetadata(headers: Headers): void;
1908
1913
  }
1909
1914
  export interface R2ObjectBody extends R2Object {
1910
1915
  get body(): ReadableStream;
1911
1916
  get bodyUsed(): boolean;
1912
- arrayBuffer(): Promise<ArrayBuffer>;
1917
+ arrayBuffer(): Promise<ArrayBuffer | ArrayBufferView>;
1913
1918
  text(): Promise<string>;
1914
1919
  json<T>(): Promise<T>;
1915
1920
  blob(): Promise<Blob>;
@@ -1936,6 +1941,7 @@ export interface R2Conditional {
1936
1941
  export interface R2GetOptions {
1937
1942
  onlyIf?: R2Conditional | Headers;
1938
1943
  range?: R2Range | Headers;
1944
+ ssecKey?: ArrayBuffer | string;
1939
1945
  }
1940
1946
  export interface R2PutOptions {
1941
1947
  onlyIf?: R2Conditional | Headers;
@@ -1947,11 +1953,13 @@ export interface R2PutOptions {
1947
1953
  sha384?: ArrayBuffer | string;
1948
1954
  sha512?: ArrayBuffer | string;
1949
1955
  storageClass?: string;
1956
+ ssecKey?: ArrayBuffer | string;
1950
1957
  }
1951
1958
  export interface R2MultipartOptions {
1952
1959
  httpMetadata?: R2HTTPMetadata | Headers;
1953
1960
  customMetadata?: Record<string, string>;
1954
1961
  storageClass?: string;
1962
+ ssecKey?: ArrayBuffer | string;
1955
1963
  }
1956
1964
  export interface R2Checksums {
1957
1965
  readonly md5?: ArrayBuffer;
@@ -1988,6 +1996,9 @@ export type R2Objects = {
1988
1996
  truncated: false;
1989
1997
  }
1990
1998
  );
1999
+ export interface R2UploadPartOptions {
2000
+ ssecKey?: ArrayBuffer | string;
2001
+ }
1991
2002
  export declare abstract class ScheduledEvent extends ExtendableEvent {
1992
2003
  readonly scheduledTime: number;
1993
2004
  readonly cron: string;
@@ -3563,14 +3574,6 @@ export declare abstract class BaseAiTranslation {
3563
3574
  inputs: AiTranslationInput;
3564
3575
  postProcessedOutputs: AiTranslationOutput;
3565
3576
  }
3566
- export type GatewayOptions = {
3567
- id: string;
3568
- cacheKey?: string;
3569
- cacheTtl?: number;
3570
- skipCache?: boolean;
3571
- metadata?: Record<string, number | string | boolean | null | bigint>;
3572
- collectLog?: boolean;
3573
- };
3574
3577
  export type AiOptions = {
3575
3578
  gateway?: GatewayOptions;
3576
3579
  prefix?: string;
@@ -3637,6 +3640,8 @@ export type BaseAiImageToTextModels =
3637
3640
  | "@cf/unum/uform-gen2-qwen-500m"
3638
3641
  | "@cf/llava-hf/llava-1.5-7b-hf";
3639
3642
  export declare abstract class Ai {
3643
+ public aiGatewayLogId: string | null;
3644
+ public gateway(gatewayId: string): AiGateway;
3640
3645
  run(
3641
3646
  model: BaseAiTextClassificationModels,
3642
3647
  inputs: BaseAiTextClassification["inputs"],
@@ -3688,6 +3693,52 @@ export declare abstract class Ai {
3688
3693
  options?: AiOptions,
3689
3694
  ): Promise<BaseAiImageToText["postProcessedOutputs"]>;
3690
3695
  }
3696
+ export type GatewayOptions = {
3697
+ id: string;
3698
+ cacheKey?: string;
3699
+ cacheTtl?: number;
3700
+ skipCache?: boolean;
3701
+ metadata?: Record<string, number | string | boolean | null | bigint>;
3702
+ collectLog?: boolean;
3703
+ };
3704
+ export type AiGatewayPatchLog = {
3705
+ score?: number | null;
3706
+ feedback?: -1 | 1 | "-1" | "1" | null;
3707
+ metadata?: Record<string, number | string | boolean | null | bigint> | null;
3708
+ };
3709
+ export type AiGatewayLog = {
3710
+ id: string;
3711
+ provider: string;
3712
+ model: string;
3713
+ model_type?: string;
3714
+ path: string;
3715
+ duration: number;
3716
+ request_type?: string;
3717
+ request_content_type?: string;
3718
+ status_code: number;
3719
+ response_content_type?: string;
3720
+ success: boolean;
3721
+ cached: boolean;
3722
+ tokens_in?: number;
3723
+ tokens_out?: number;
3724
+ metadata?: Record<string, number | string | boolean | null | bigint>;
3725
+ step?: number;
3726
+ cost?: number;
3727
+ custom_cost?: boolean;
3728
+ request_size: number;
3729
+ request_head?: string;
3730
+ request_head_complete: boolean;
3731
+ response_size: number;
3732
+ response_head?: string;
3733
+ response_head_complete: boolean;
3734
+ created_at: Date;
3735
+ };
3736
+ export interface AiGatewayInternalError extends Error {}
3737
+ export interface AiGatewayLogNotFound extends Error {}
3738
+ export declare abstract class AiGateway {
3739
+ patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;
3740
+ getLog(logId: string): Promise<AiGatewayLog>;
3741
+ }
3691
3742
  export interface BasicImageTransformations {
3692
3743
  /**
3693
3744
  * Maximum width in image pixels. The value must be an integer.
@@ -228,7 +228,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
228
228
  structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
229
229
  reportError(error: any): void;
230
230
  fetch(
231
- input: RequestInfo,
231
+ input: RequestInfo | URL,
232
232
  init?: RequestInit<RequestInitCfProperties>,
233
233
  ): Promise<Response>;
234
234
  self: ServiceWorkerGlobalScope;
@@ -361,7 +361,7 @@ declare function structuredClone<T>(
361
361
  declare function reportError(error: any): void;
362
362
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
363
363
  declare function fetch(
364
- input: RequestInfo,
364
+ input: RequestInfo | URL,
365
365
  init?: RequestInit<RequestInitCfProperties>,
366
366
  ): Promise<Response>;
367
367
  declare const self: ServiceWorkerGlobalScope;
@@ -952,7 +952,7 @@ declare class Blob {
952
952
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
953
953
  slice(start?: number, end?: number, type?: string): Blob;
954
954
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) */
955
- arrayBuffer(): Promise<ArrayBuffer>;
955
+ arrayBuffer(): Promise<ArrayBuffer | ArrayBufferView>;
956
956
  bytes(): Promise<Uint8Array>;
957
957
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
958
958
  text(): Promise<string>;
@@ -999,14 +999,17 @@ declare abstract class CacheStorage {
999
999
  */
1000
1000
  declare abstract class Cache {
1001
1001
  /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */
1002
- delete(request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>;
1002
+ delete(
1003
+ request: RequestInfo | URL,
1004
+ options?: CacheQueryOptions,
1005
+ ): Promise<boolean>;
1003
1006
  /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */
1004
1007
  match(
1005
- request: RequestInfo,
1008
+ request: RequestInfo | URL,
1006
1009
  options?: CacheQueryOptions,
1007
1010
  ): Promise<Response | undefined>;
1008
1011
  /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */
1009
- put(request: RequestInfo, response: Response): Promise<void>;
1012
+ put(request: RequestInfo | URL, response: Response): Promise<void>;
1010
1013
  }
1011
1014
  interface CacheQueryOptions {
1012
1015
  ignoreMethod?: boolean;
@@ -1525,7 +1528,7 @@ declare abstract class Body {
1525
1528
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */
1526
1529
  get bodyUsed(): boolean;
1527
1530
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */
1528
- arrayBuffer(): Promise<ArrayBuffer>;
1531
+ arrayBuffer(): Promise<ArrayBuffer | ArrayBufferView>;
1529
1532
  bytes(): Promise<Uint8Array>;
1530
1533
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */
1531
1534
  text(): Promise<string>;
@@ -1580,8 +1583,7 @@ interface ResponseInit {
1580
1583
  }
1581
1584
  type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> =
1582
1585
  | Request<CfHostMetadata, Cf>
1583
- | string
1584
- | URL;
1586
+ | string;
1585
1587
  /**
1586
1588
  * This Fetch API interface represents a resource request.
1587
1589
  *
@@ -1590,7 +1592,7 @@ type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> =
1590
1592
  declare var Request: {
1591
1593
  prototype: Request;
1592
1594
  new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(
1593
- input: RequestInfo<CfProperties>,
1595
+ input: RequestInfo<CfProperties> | URL,
1594
1596
  init?: RequestInit<Cf>,
1595
1597
  ): Request<CfHostMetadata, Cf>;
1596
1598
  };
@@ -1672,7 +1674,7 @@ type Fetcher<
1672
1674
  > = (T extends Rpc.EntrypointBranded
1673
1675
  ? Rpc.Provider<T, Reserved | "fetch" | "connect">
1674
1676
  : unknown) & {
1675
- fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1677
+ fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
1676
1678
  connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1677
1679
  };
1678
1680
  interface FetcherPutOptions {
@@ -1893,6 +1895,7 @@ interface R2MultipartUpload {
1893
1895
  uploadPart(
1894
1896
  partNumber: number,
1895
1897
  value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob,
1898
+ options?: R2UploadPartOptions,
1896
1899
  ): Promise<R2UploadedPart>;
1897
1900
  abort(): Promise<void>;
1898
1901
  complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
@@ -1913,12 +1916,13 @@ declare abstract class R2Object {
1913
1916
  readonly customMetadata?: Record<string, string>;
1914
1917
  readonly range?: R2Range;
1915
1918
  readonly storageClass: string;
1919
+ readonly ssecKeyMd5?: string;
1916
1920
  writeHttpMetadata(headers: Headers): void;
1917
1921
  }
1918
1922
  interface R2ObjectBody extends R2Object {
1919
1923
  get body(): ReadableStream;
1920
1924
  get bodyUsed(): boolean;
1921
- arrayBuffer(): Promise<ArrayBuffer>;
1925
+ arrayBuffer(): Promise<ArrayBuffer | ArrayBufferView>;
1922
1926
  text(): Promise<string>;
1923
1927
  json<T>(): Promise<T>;
1924
1928
  blob(): Promise<Blob>;
@@ -1945,6 +1949,7 @@ interface R2Conditional {
1945
1949
  interface R2GetOptions {
1946
1950
  onlyIf?: R2Conditional | Headers;
1947
1951
  range?: R2Range | Headers;
1952
+ ssecKey?: ArrayBuffer | string;
1948
1953
  }
1949
1954
  interface R2PutOptions {
1950
1955
  onlyIf?: R2Conditional | Headers;
@@ -1956,11 +1961,13 @@ interface R2PutOptions {
1956
1961
  sha384?: ArrayBuffer | string;
1957
1962
  sha512?: ArrayBuffer | string;
1958
1963
  storageClass?: string;
1964
+ ssecKey?: ArrayBuffer | string;
1959
1965
  }
1960
1966
  interface R2MultipartOptions {
1961
1967
  httpMetadata?: R2HTTPMetadata | Headers;
1962
1968
  customMetadata?: Record<string, string>;
1963
1969
  storageClass?: string;
1970
+ ssecKey?: ArrayBuffer | string;
1964
1971
  }
1965
1972
  interface R2Checksums {
1966
1973
  readonly md5?: ArrayBuffer;
@@ -1997,6 +2004,9 @@ type R2Objects = {
1997
2004
  truncated: false;
1998
2005
  }
1999
2006
  );
2007
+ interface R2UploadPartOptions {
2008
+ ssecKey?: ArrayBuffer | string;
2009
+ }
2000
2010
  declare abstract class ScheduledEvent extends ExtendableEvent {
2001
2011
  readonly scheduledTime: number;
2002
2012
  readonly cron: string;
@@ -3576,14 +3586,6 @@ declare abstract class BaseAiTranslation {
3576
3586
  inputs: AiTranslationInput;
3577
3587
  postProcessedOutputs: AiTranslationOutput;
3578
3588
  }
3579
- type GatewayOptions = {
3580
- id: string;
3581
- cacheKey?: string;
3582
- cacheTtl?: number;
3583
- skipCache?: boolean;
3584
- metadata?: Record<string, number | string | boolean | null | bigint>;
3585
- collectLog?: boolean;
3586
- };
3587
3589
  type AiOptions = {
3588
3590
  gateway?: GatewayOptions;
3589
3591
  prefix?: string;
@@ -3649,6 +3651,8 @@ type BaseAiImageToTextModels =
3649
3651
  | "@cf/unum/uform-gen2-qwen-500m"
3650
3652
  | "@cf/llava-hf/llava-1.5-7b-hf";
3651
3653
  declare abstract class Ai {
3654
+ public aiGatewayLogId: string | null;
3655
+ public gateway(gatewayId: string): AiGateway;
3652
3656
  run(
3653
3657
  model: BaseAiTextClassificationModels,
3654
3658
  inputs: BaseAiTextClassification["inputs"],
@@ -3700,6 +3704,52 @@ declare abstract class Ai {
3700
3704
  options?: AiOptions,
3701
3705
  ): Promise<BaseAiImageToText["postProcessedOutputs"]>;
3702
3706
  }
3707
+ type GatewayOptions = {
3708
+ id: string;
3709
+ cacheKey?: string;
3710
+ cacheTtl?: number;
3711
+ skipCache?: boolean;
3712
+ metadata?: Record<string, number | string | boolean | null | bigint>;
3713
+ collectLog?: boolean;
3714
+ };
3715
+ type AiGatewayPatchLog = {
3716
+ score?: number | null;
3717
+ feedback?: -1 | 1 | "-1" | "1" | null;
3718
+ metadata?: Record<string, number | string | boolean | null | bigint> | null;
3719
+ };
3720
+ type AiGatewayLog = {
3721
+ id: string;
3722
+ provider: string;
3723
+ model: string;
3724
+ model_type?: string;
3725
+ path: string;
3726
+ duration: number;
3727
+ request_type?: string;
3728
+ request_content_type?: string;
3729
+ status_code: number;
3730
+ response_content_type?: string;
3731
+ success: boolean;
3732
+ cached: boolean;
3733
+ tokens_in?: number;
3734
+ tokens_out?: number;
3735
+ metadata?: Record<string, number | string | boolean | null | bigint>;
3736
+ step?: number;
3737
+ cost?: number;
3738
+ custom_cost?: boolean;
3739
+ request_size: number;
3740
+ request_head?: string;
3741
+ request_head_complete: boolean;
3742
+ response_size: number;
3743
+ response_head?: string;
3744
+ response_head_complete: boolean;
3745
+ created_at: Date;
3746
+ };
3747
+ interface AiGatewayInternalError extends Error {}
3748
+ interface AiGatewayLogNotFound extends Error {}
3749
+ declare abstract class AiGateway {
3750
+ patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;
3751
+ getLog(logId: string): Promise<AiGatewayLog>;
3752
+ }
3703
3753
  interface BasicImageTransformations {
3704
3754
  /**
3705
3755
  * Maximum width in image pixels. The value must be an integer.
@@ -228,7 +228,7 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
228
228
  structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
229
229
  reportError(error: any): void;
230
230
  fetch(
231
- input: RequestInfo,
231
+ input: RequestInfo | URL,
232
232
  init?: RequestInit<RequestInitCfProperties>,
233
233
  ): Promise<Response>;
234
234
  self: ServiceWorkerGlobalScope;
@@ -363,7 +363,7 @@ export declare function structuredClone<T>(
363
363
  export declare function reportError(error: any): void;
364
364
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
365
365
  export declare function fetch(
366
- input: RequestInfo,
366
+ input: RequestInfo | URL,
367
367
  init?: RequestInit<RequestInitCfProperties>,
368
368
  ): Promise<Response>;
369
369
  export declare const self: ServiceWorkerGlobalScope;
@@ -957,7 +957,7 @@ export declare class Blob {
957
957
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
958
958
  slice(start?: number, end?: number, type?: string): Blob;
959
959
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) */
960
- arrayBuffer(): Promise<ArrayBuffer>;
960
+ arrayBuffer(): Promise<ArrayBuffer | ArrayBufferView>;
961
961
  bytes(): Promise<Uint8Array>;
962
962
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
963
963
  text(): Promise<string>;
@@ -1004,14 +1004,17 @@ export declare abstract class CacheStorage {
1004
1004
  */
1005
1005
  export declare abstract class Cache {
1006
1006
  /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */
1007
- delete(request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>;
1007
+ delete(
1008
+ request: RequestInfo | URL,
1009
+ options?: CacheQueryOptions,
1010
+ ): Promise<boolean>;
1008
1011
  /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */
1009
1012
  match(
1010
- request: RequestInfo,
1013
+ request: RequestInfo | URL,
1011
1014
  options?: CacheQueryOptions,
1012
1015
  ): Promise<Response | undefined>;
1013
1016
  /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */
1014
- put(request: RequestInfo, response: Response): Promise<void>;
1017
+ put(request: RequestInfo | URL, response: Response): Promise<void>;
1015
1018
  }
1016
1019
  export interface CacheQueryOptions {
1017
1020
  ignoreMethod?: boolean;
@@ -1530,7 +1533,7 @@ export declare abstract class Body {
1530
1533
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */
1531
1534
  get bodyUsed(): boolean;
1532
1535
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */
1533
- arrayBuffer(): Promise<ArrayBuffer>;
1536
+ arrayBuffer(): Promise<ArrayBuffer | ArrayBufferView>;
1534
1537
  bytes(): Promise<Uint8Array>;
1535
1538
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */
1536
1539
  text(): Promise<string>;
@@ -1586,7 +1589,7 @@ export interface ResponseInit {
1586
1589
  export type RequestInfo<
1587
1590
  CfHostMetadata = unknown,
1588
1591
  Cf = CfProperties<CfHostMetadata>,
1589
- > = Request<CfHostMetadata, Cf> | string | URL;
1592
+ > = Request<CfHostMetadata, Cf> | string;
1590
1593
  /**
1591
1594
  * This Fetch API interface represents a resource request.
1592
1595
  *
@@ -1595,7 +1598,7 @@ export type RequestInfo<
1595
1598
  export declare var Request: {
1596
1599
  prototype: Request;
1597
1600
  new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(
1598
- input: RequestInfo<CfProperties>,
1601
+ input: RequestInfo<CfProperties> | URL,
1599
1602
  init?: RequestInit<Cf>,
1600
1603
  ): Request<CfHostMetadata, Cf>;
1601
1604
  };
@@ -1680,7 +1683,7 @@ export type Fetcher<
1680
1683
  > = (T extends Rpc.EntrypointBranded
1681
1684
  ? Rpc.Provider<T, Reserved | "fetch" | "connect">
1682
1685
  : unknown) & {
1683
- fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1686
+ fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
1684
1687
  connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1685
1688
  };
1686
1689
  export interface FetcherPutOptions {
@@ -1901,6 +1904,7 @@ export interface R2MultipartUpload {
1901
1904
  uploadPart(
1902
1905
  partNumber: number,
1903
1906
  value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob,
1907
+ options?: R2UploadPartOptions,
1904
1908
  ): Promise<R2UploadedPart>;
1905
1909
  abort(): Promise<void>;
1906
1910
  complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
@@ -1921,12 +1925,13 @@ export declare abstract class R2Object {
1921
1925
  readonly customMetadata?: Record<string, string>;
1922
1926
  readonly range?: R2Range;
1923
1927
  readonly storageClass: string;
1928
+ readonly ssecKeyMd5?: string;
1924
1929
  writeHttpMetadata(headers: Headers): void;
1925
1930
  }
1926
1931
  export interface R2ObjectBody extends R2Object {
1927
1932
  get body(): ReadableStream;
1928
1933
  get bodyUsed(): boolean;
1929
- arrayBuffer(): Promise<ArrayBuffer>;
1934
+ arrayBuffer(): Promise<ArrayBuffer | ArrayBufferView>;
1930
1935
  text(): Promise<string>;
1931
1936
  json<T>(): Promise<T>;
1932
1937
  blob(): Promise<Blob>;
@@ -1953,6 +1958,7 @@ export interface R2Conditional {
1953
1958
  export interface R2GetOptions {
1954
1959
  onlyIf?: R2Conditional | Headers;
1955
1960
  range?: R2Range | Headers;
1961
+ ssecKey?: ArrayBuffer | string;
1956
1962
  }
1957
1963
  export interface R2PutOptions {
1958
1964
  onlyIf?: R2Conditional | Headers;
@@ -1964,11 +1970,13 @@ export interface R2PutOptions {
1964
1970
  sha384?: ArrayBuffer | string;
1965
1971
  sha512?: ArrayBuffer | string;
1966
1972
  storageClass?: string;
1973
+ ssecKey?: ArrayBuffer | string;
1967
1974
  }
1968
1975
  export interface R2MultipartOptions {
1969
1976
  httpMetadata?: R2HTTPMetadata | Headers;
1970
1977
  customMetadata?: Record<string, string>;
1971
1978
  storageClass?: string;
1979
+ ssecKey?: ArrayBuffer | string;
1972
1980
  }
1973
1981
  export interface R2Checksums {
1974
1982
  readonly md5?: ArrayBuffer;
@@ -2005,6 +2013,9 @@ export type R2Objects = {
2005
2013
  truncated: false;
2006
2014
  }
2007
2015
  );
2016
+ export interface R2UploadPartOptions {
2017
+ ssecKey?: ArrayBuffer | string;
2018
+ }
2008
2019
  export declare abstract class ScheduledEvent extends ExtendableEvent {
2009
2020
  readonly scheduledTime: number;
2010
2021
  readonly cron: string;
@@ -3587,14 +3598,6 @@ export declare abstract class BaseAiTranslation {
3587
3598
  inputs: AiTranslationInput;
3588
3599
  postProcessedOutputs: AiTranslationOutput;
3589
3600
  }
3590
- export type GatewayOptions = {
3591
- id: string;
3592
- cacheKey?: string;
3593
- cacheTtl?: number;
3594
- skipCache?: boolean;
3595
- metadata?: Record<string, number | string | boolean | null | bigint>;
3596
- collectLog?: boolean;
3597
- };
3598
3601
  export type AiOptions = {
3599
3602
  gateway?: GatewayOptions;
3600
3603
  prefix?: string;
@@ -3661,6 +3664,8 @@ export type BaseAiImageToTextModels =
3661
3664
  | "@cf/unum/uform-gen2-qwen-500m"
3662
3665
  | "@cf/llava-hf/llava-1.5-7b-hf";
3663
3666
  export declare abstract class Ai {
3667
+ public aiGatewayLogId: string | null;
3668
+ public gateway(gatewayId: string): AiGateway;
3664
3669
  run(
3665
3670
  model: BaseAiTextClassificationModels,
3666
3671
  inputs: BaseAiTextClassification["inputs"],
@@ -3712,6 +3717,52 @@ export declare abstract class Ai {
3712
3717
  options?: AiOptions,
3713
3718
  ): Promise<BaseAiImageToText["postProcessedOutputs"]>;
3714
3719
  }
3720
+ export type GatewayOptions = {
3721
+ id: string;
3722
+ cacheKey?: string;
3723
+ cacheTtl?: number;
3724
+ skipCache?: boolean;
3725
+ metadata?: Record<string, number | string | boolean | null | bigint>;
3726
+ collectLog?: boolean;
3727
+ };
3728
+ export type AiGatewayPatchLog = {
3729
+ score?: number | null;
3730
+ feedback?: -1 | 1 | "-1" | "1" | null;
3731
+ metadata?: Record<string, number | string | boolean | null | bigint> | null;
3732
+ };
3733
+ export type AiGatewayLog = {
3734
+ id: string;
3735
+ provider: string;
3736
+ model: string;
3737
+ model_type?: string;
3738
+ path: string;
3739
+ duration: number;
3740
+ request_type?: string;
3741
+ request_content_type?: string;
3742
+ status_code: number;
3743
+ response_content_type?: string;
3744
+ success: boolean;
3745
+ cached: boolean;
3746
+ tokens_in?: number;
3747
+ tokens_out?: number;
3748
+ metadata?: Record<string, number | string | boolean | null | bigint>;
3749
+ step?: number;
3750
+ cost?: number;
3751
+ custom_cost?: boolean;
3752
+ request_size: number;
3753
+ request_head?: string;
3754
+ request_head_complete: boolean;
3755
+ response_size: number;
3756
+ response_head?: string;
3757
+ response_head_complete: boolean;
3758
+ created_at: Date;
3759
+ };
3760
+ export interface AiGatewayInternalError extends Error {}
3761
+ export interface AiGatewayLogNotFound extends Error {}
3762
+ export declare abstract class AiGateway {
3763
+ patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;
3764
+ getLog(logId: string): Promise<AiGatewayLog>;
3765
+ }
3715
3766
  export interface BasicImageTransformations {
3716
3767
  /**
3717
3768
  * Maximum width in image pixels. The value must be an integer.