@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.
- package/2021-11-03/index.d.ts +70 -20
- package/2021-11-03/index.ts +70 -19
- package/2022-01-31/index.d.ts +70 -20
- package/2022-01-31/index.ts +70 -19
- package/2022-03-21/index.d.ts +70 -20
- package/2022-03-21/index.ts +70 -19
- package/2022-08-04/index.d.ts +70 -20
- package/2022-08-04/index.ts +70 -19
- package/2022-10-31/index.d.ts +70 -20
- package/2022-10-31/index.ts +70 -19
- package/2022-11-30/index.d.ts +70 -20
- package/2022-11-30/index.ts +70 -19
- package/2023-03-01/index.d.ts +70 -20
- package/2023-03-01/index.ts +70 -19
- package/2023-07-01/index.d.ts +70 -20
- package/2023-07-01/index.ts +70 -19
- package/experimental/index.d.ts +72 -20
- package/experimental/index.ts +72 -19
- package/index.d.ts +70 -20
- package/index.ts +70 -19
- package/oldest/index.d.ts +70 -20
- package/oldest/index.ts +70 -19
- package/package.json +1 -1
package/2021-11-03/index.d.ts
CHANGED
|
@@ -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;
|
|
@@ -359,7 +359,7 @@ declare function structuredClone<T>(
|
|
|
359
359
|
declare function reportError(error: any): void;
|
|
360
360
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
|
|
361
361
|
declare function fetch(
|
|
362
|
-
input: RequestInfo,
|
|
362
|
+
input: RequestInfo | URL,
|
|
363
363
|
init?: RequestInit<RequestInitCfProperties>,
|
|
364
364
|
): Promise<Response>;
|
|
365
365
|
declare const self: ServiceWorkerGlobalScope;
|
|
@@ -929,7 +929,7 @@ declare class Blob {
|
|
|
929
929
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
|
|
930
930
|
slice(start?: number, end?: number, type?: string): Blob;
|
|
931
931
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) */
|
|
932
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
932
|
+
arrayBuffer(): Promise<ArrayBuffer | ArrayBufferView>;
|
|
933
933
|
bytes(): Promise<Uint8Array>;
|
|
934
934
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
|
|
935
935
|
text(): Promise<string>;
|
|
@@ -976,14 +976,17 @@ declare abstract class CacheStorage {
|
|
|
976
976
|
*/
|
|
977
977
|
declare abstract class Cache {
|
|
978
978
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */
|
|
979
|
-
delete(
|
|
979
|
+
delete(
|
|
980
|
+
request: RequestInfo | URL,
|
|
981
|
+
options?: CacheQueryOptions,
|
|
982
|
+
): Promise<boolean>;
|
|
980
983
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */
|
|
981
984
|
match(
|
|
982
|
-
request: RequestInfo,
|
|
985
|
+
request: RequestInfo | URL,
|
|
983
986
|
options?: CacheQueryOptions,
|
|
984
987
|
): Promise<Response | undefined>;
|
|
985
988
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */
|
|
986
|
-
put(request: RequestInfo, response: Response): Promise<void>;
|
|
989
|
+
put(request: RequestInfo | URL, response: Response): Promise<void>;
|
|
987
990
|
}
|
|
988
991
|
interface CacheQueryOptions {
|
|
989
992
|
ignoreMethod?: boolean;
|
|
@@ -1502,7 +1505,7 @@ declare abstract class Body {
|
|
|
1502
1505
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */
|
|
1503
1506
|
readonly bodyUsed: boolean;
|
|
1504
1507
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */
|
|
1505
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
1508
|
+
arrayBuffer(): Promise<ArrayBuffer | ArrayBufferView>;
|
|
1506
1509
|
bytes(): Promise<Uint8Array>;
|
|
1507
1510
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */
|
|
1508
1511
|
text(): Promise<string>;
|
|
@@ -1557,8 +1560,7 @@ interface ResponseInit {
|
|
|
1557
1560
|
}
|
|
1558
1561
|
type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> =
|
|
1559
1562
|
| Request<CfHostMetadata, Cf>
|
|
1560
|
-
| string
|
|
1561
|
-
| URL;
|
|
1563
|
+
| string;
|
|
1562
1564
|
/**
|
|
1563
1565
|
* This Fetch API interface represents a resource request.
|
|
1564
1566
|
*
|
|
@@ -1567,7 +1569,7 @@ type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> =
|
|
|
1567
1569
|
declare var Request: {
|
|
1568
1570
|
prototype: Request;
|
|
1569
1571
|
new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(
|
|
1570
|
-
input: RequestInfo<CfProperties
|
|
1572
|
+
input: RequestInfo<CfProperties> | URL,
|
|
1571
1573
|
init?: RequestInit<Cf>,
|
|
1572
1574
|
): Request<CfHostMetadata, Cf>;
|
|
1573
1575
|
};
|
|
@@ -1649,7 +1651,7 @@ type Fetcher<
|
|
|
1649
1651
|
> = (T extends Rpc.EntrypointBranded
|
|
1650
1652
|
? Rpc.Provider<T, Reserved | "fetch" | "connect">
|
|
1651
1653
|
: unknown) & {
|
|
1652
|
-
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1654
|
+
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
1653
1655
|
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1654
1656
|
};
|
|
1655
1657
|
interface FetcherPutOptions {
|
|
@@ -1870,6 +1872,7 @@ interface R2MultipartUpload {
|
|
|
1870
1872
|
uploadPart(
|
|
1871
1873
|
partNumber: number,
|
|
1872
1874
|
value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob,
|
|
1875
|
+
options?: R2UploadPartOptions,
|
|
1873
1876
|
): Promise<R2UploadedPart>;
|
|
1874
1877
|
abort(): Promise<void>;
|
|
1875
1878
|
complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
|
|
@@ -1890,12 +1893,13 @@ declare abstract class R2Object {
|
|
|
1890
1893
|
readonly customMetadata?: Record<string, string>;
|
|
1891
1894
|
readonly range?: R2Range;
|
|
1892
1895
|
readonly storageClass: string;
|
|
1896
|
+
readonly ssecKeyMd5?: string;
|
|
1893
1897
|
writeHttpMetadata(headers: Headers): void;
|
|
1894
1898
|
}
|
|
1895
1899
|
interface R2ObjectBody extends R2Object {
|
|
1896
1900
|
get body(): ReadableStream;
|
|
1897
1901
|
get bodyUsed(): boolean;
|
|
1898
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
1902
|
+
arrayBuffer(): Promise<ArrayBuffer | ArrayBufferView>;
|
|
1899
1903
|
text(): Promise<string>;
|
|
1900
1904
|
json<T>(): Promise<T>;
|
|
1901
1905
|
blob(): Promise<Blob>;
|
|
@@ -1922,6 +1926,7 @@ interface R2Conditional {
|
|
|
1922
1926
|
interface R2GetOptions {
|
|
1923
1927
|
onlyIf?: R2Conditional | Headers;
|
|
1924
1928
|
range?: R2Range | Headers;
|
|
1929
|
+
ssecKey?: ArrayBuffer | string;
|
|
1925
1930
|
}
|
|
1926
1931
|
interface R2PutOptions {
|
|
1927
1932
|
onlyIf?: R2Conditional | Headers;
|
|
@@ -1933,11 +1938,13 @@ interface R2PutOptions {
|
|
|
1933
1938
|
sha384?: ArrayBuffer | string;
|
|
1934
1939
|
sha512?: ArrayBuffer | string;
|
|
1935
1940
|
storageClass?: string;
|
|
1941
|
+
ssecKey?: ArrayBuffer | string;
|
|
1936
1942
|
}
|
|
1937
1943
|
interface R2MultipartOptions {
|
|
1938
1944
|
httpMetadata?: R2HTTPMetadata | Headers;
|
|
1939
1945
|
customMetadata?: Record<string, string>;
|
|
1940
1946
|
storageClass?: string;
|
|
1947
|
+
ssecKey?: ArrayBuffer | string;
|
|
1941
1948
|
}
|
|
1942
1949
|
interface R2Checksums {
|
|
1943
1950
|
readonly md5?: ArrayBuffer;
|
|
@@ -1974,6 +1981,9 @@ type R2Objects = {
|
|
|
1974
1981
|
truncated: false;
|
|
1975
1982
|
}
|
|
1976
1983
|
);
|
|
1984
|
+
interface R2UploadPartOptions {
|
|
1985
|
+
ssecKey?: ArrayBuffer | string;
|
|
1986
|
+
}
|
|
1977
1987
|
declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1978
1988
|
readonly scheduledTime: number;
|
|
1979
1989
|
readonly cron: string;
|
|
@@ -3526,14 +3536,6 @@ declare abstract class BaseAiTranslation {
|
|
|
3526
3536
|
inputs: AiTranslationInput;
|
|
3527
3537
|
postProcessedOutputs: AiTranslationOutput;
|
|
3528
3538
|
}
|
|
3529
|
-
type GatewayOptions = {
|
|
3530
|
-
id: string;
|
|
3531
|
-
cacheKey?: string;
|
|
3532
|
-
cacheTtl?: number;
|
|
3533
|
-
skipCache?: boolean;
|
|
3534
|
-
metadata?: Record<string, number | string | boolean | null | bigint>;
|
|
3535
|
-
collectLog?: boolean;
|
|
3536
|
-
};
|
|
3537
3539
|
type AiOptions = {
|
|
3538
3540
|
gateway?: GatewayOptions;
|
|
3539
3541
|
prefix?: string;
|
|
@@ -3599,6 +3601,8 @@ type BaseAiImageToTextModels =
|
|
|
3599
3601
|
| "@cf/unum/uform-gen2-qwen-500m"
|
|
3600
3602
|
| "@cf/llava-hf/llava-1.5-7b-hf";
|
|
3601
3603
|
declare abstract class Ai {
|
|
3604
|
+
public aiGatewayLogId: string | null;
|
|
3605
|
+
public gateway(gatewayId: string): AiGateway;
|
|
3602
3606
|
run(
|
|
3603
3607
|
model: BaseAiTextClassificationModels,
|
|
3604
3608
|
inputs: BaseAiTextClassification["inputs"],
|
|
@@ -3650,6 +3654,52 @@ declare abstract class Ai {
|
|
|
3650
3654
|
options?: AiOptions,
|
|
3651
3655
|
): Promise<BaseAiImageToText["postProcessedOutputs"]>;
|
|
3652
3656
|
}
|
|
3657
|
+
type GatewayOptions = {
|
|
3658
|
+
id: string;
|
|
3659
|
+
cacheKey?: string;
|
|
3660
|
+
cacheTtl?: number;
|
|
3661
|
+
skipCache?: boolean;
|
|
3662
|
+
metadata?: Record<string, number | string | boolean | null | bigint>;
|
|
3663
|
+
collectLog?: boolean;
|
|
3664
|
+
};
|
|
3665
|
+
type AiGatewayPatchLog = {
|
|
3666
|
+
score?: number | null;
|
|
3667
|
+
feedback?: -1 | 1 | "-1" | "1" | null;
|
|
3668
|
+
metadata?: Record<string, number | string | boolean | null | bigint> | null;
|
|
3669
|
+
};
|
|
3670
|
+
type AiGatewayLog = {
|
|
3671
|
+
id: string;
|
|
3672
|
+
provider: string;
|
|
3673
|
+
model: string;
|
|
3674
|
+
model_type?: string;
|
|
3675
|
+
path: string;
|
|
3676
|
+
duration: number;
|
|
3677
|
+
request_type?: string;
|
|
3678
|
+
request_content_type?: string;
|
|
3679
|
+
status_code: number;
|
|
3680
|
+
response_content_type?: string;
|
|
3681
|
+
success: boolean;
|
|
3682
|
+
cached: boolean;
|
|
3683
|
+
tokens_in?: number;
|
|
3684
|
+
tokens_out?: number;
|
|
3685
|
+
metadata?: Record<string, number | string | boolean | null | bigint>;
|
|
3686
|
+
step?: number;
|
|
3687
|
+
cost?: number;
|
|
3688
|
+
custom_cost?: boolean;
|
|
3689
|
+
request_size: number;
|
|
3690
|
+
request_head?: string;
|
|
3691
|
+
request_head_complete: boolean;
|
|
3692
|
+
response_size: number;
|
|
3693
|
+
response_head?: string;
|
|
3694
|
+
response_head_complete: boolean;
|
|
3695
|
+
created_at: Date;
|
|
3696
|
+
};
|
|
3697
|
+
interface AiGatewayInternalError extends Error {}
|
|
3698
|
+
interface AiGatewayLogNotFound extends Error {}
|
|
3699
|
+
declare abstract class AiGateway {
|
|
3700
|
+
patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;
|
|
3701
|
+
getLog(logId: string): Promise<AiGatewayLog>;
|
|
3702
|
+
}
|
|
3653
3703
|
interface BasicImageTransformations {
|
|
3654
3704
|
/**
|
|
3655
3705
|
* Maximum width in image pixels. The value must be an integer.
|
package/2021-11-03/index.ts
CHANGED
|
@@ -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;
|
|
@@ -934,7 +934,7 @@ export declare class Blob {
|
|
|
934
934
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
|
|
935
935
|
slice(start?: number, end?: number, type?: string): Blob;
|
|
936
936
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) */
|
|
937
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
937
|
+
arrayBuffer(): Promise<ArrayBuffer | ArrayBufferView>;
|
|
938
938
|
bytes(): Promise<Uint8Array>;
|
|
939
939
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
|
|
940
940
|
text(): Promise<string>;
|
|
@@ -981,14 +981,17 @@ export declare abstract class CacheStorage {
|
|
|
981
981
|
*/
|
|
982
982
|
export declare abstract class Cache {
|
|
983
983
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */
|
|
984
|
-
delete(
|
|
984
|
+
delete(
|
|
985
|
+
request: RequestInfo | URL,
|
|
986
|
+
options?: CacheQueryOptions,
|
|
987
|
+
): Promise<boolean>;
|
|
985
988
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */
|
|
986
989
|
match(
|
|
987
|
-
request: RequestInfo,
|
|
990
|
+
request: RequestInfo | URL,
|
|
988
991
|
options?: CacheQueryOptions,
|
|
989
992
|
): Promise<Response | undefined>;
|
|
990
993
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */
|
|
991
|
-
put(request: RequestInfo, response: Response): Promise<void>;
|
|
994
|
+
put(request: RequestInfo | URL, response: Response): Promise<void>;
|
|
992
995
|
}
|
|
993
996
|
export interface CacheQueryOptions {
|
|
994
997
|
ignoreMethod?: boolean;
|
|
@@ -1507,7 +1510,7 @@ export declare abstract class Body {
|
|
|
1507
1510
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */
|
|
1508
1511
|
readonly bodyUsed: boolean;
|
|
1509
1512
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */
|
|
1510
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
1513
|
+
arrayBuffer(): Promise<ArrayBuffer | ArrayBufferView>;
|
|
1511
1514
|
bytes(): Promise<Uint8Array>;
|
|
1512
1515
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */
|
|
1513
1516
|
text(): Promise<string>;
|
|
@@ -1563,7 +1566,7 @@ export interface ResponseInit {
|
|
|
1563
1566
|
export type RequestInfo<
|
|
1564
1567
|
CfHostMetadata = unknown,
|
|
1565
1568
|
Cf = CfProperties<CfHostMetadata>,
|
|
1566
|
-
> = Request<CfHostMetadata, Cf> | string
|
|
1569
|
+
> = Request<CfHostMetadata, Cf> | string;
|
|
1567
1570
|
/**
|
|
1568
1571
|
* This Fetch API interface represents a resource request.
|
|
1569
1572
|
*
|
|
@@ -1572,7 +1575,7 @@ export type RequestInfo<
|
|
|
1572
1575
|
export declare var Request: {
|
|
1573
1576
|
prototype: Request;
|
|
1574
1577
|
new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(
|
|
1575
|
-
input: RequestInfo<CfProperties
|
|
1578
|
+
input: RequestInfo<CfProperties> | URL,
|
|
1576
1579
|
init?: RequestInit<Cf>,
|
|
1577
1580
|
): Request<CfHostMetadata, Cf>;
|
|
1578
1581
|
};
|
|
@@ -1657,7 +1660,7 @@ export type Fetcher<
|
|
|
1657
1660
|
> = (T extends Rpc.EntrypointBranded
|
|
1658
1661
|
? Rpc.Provider<T, Reserved | "fetch" | "connect">
|
|
1659
1662
|
: unknown) & {
|
|
1660
|
-
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1663
|
+
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
1661
1664
|
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1662
1665
|
};
|
|
1663
1666
|
export interface FetcherPutOptions {
|
|
@@ -1878,6 +1881,7 @@ export interface R2MultipartUpload {
|
|
|
1878
1881
|
uploadPart(
|
|
1879
1882
|
partNumber: number,
|
|
1880
1883
|
value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob,
|
|
1884
|
+
options?: R2UploadPartOptions,
|
|
1881
1885
|
): Promise<R2UploadedPart>;
|
|
1882
1886
|
abort(): Promise<void>;
|
|
1883
1887
|
complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
|
|
@@ -1898,12 +1902,13 @@ export declare abstract class R2Object {
|
|
|
1898
1902
|
readonly customMetadata?: Record<string, string>;
|
|
1899
1903
|
readonly range?: R2Range;
|
|
1900
1904
|
readonly storageClass: string;
|
|
1905
|
+
readonly ssecKeyMd5?: string;
|
|
1901
1906
|
writeHttpMetadata(headers: Headers): void;
|
|
1902
1907
|
}
|
|
1903
1908
|
export interface R2ObjectBody extends R2Object {
|
|
1904
1909
|
get body(): ReadableStream;
|
|
1905
1910
|
get bodyUsed(): boolean;
|
|
1906
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
1911
|
+
arrayBuffer(): Promise<ArrayBuffer | ArrayBufferView>;
|
|
1907
1912
|
text(): Promise<string>;
|
|
1908
1913
|
json<T>(): Promise<T>;
|
|
1909
1914
|
blob(): Promise<Blob>;
|
|
@@ -1930,6 +1935,7 @@ export interface R2Conditional {
|
|
|
1930
1935
|
export interface R2GetOptions {
|
|
1931
1936
|
onlyIf?: R2Conditional | Headers;
|
|
1932
1937
|
range?: R2Range | Headers;
|
|
1938
|
+
ssecKey?: ArrayBuffer | string;
|
|
1933
1939
|
}
|
|
1934
1940
|
export interface R2PutOptions {
|
|
1935
1941
|
onlyIf?: R2Conditional | Headers;
|
|
@@ -1941,11 +1947,13 @@ export interface R2PutOptions {
|
|
|
1941
1947
|
sha384?: ArrayBuffer | string;
|
|
1942
1948
|
sha512?: ArrayBuffer | string;
|
|
1943
1949
|
storageClass?: string;
|
|
1950
|
+
ssecKey?: ArrayBuffer | string;
|
|
1944
1951
|
}
|
|
1945
1952
|
export interface R2MultipartOptions {
|
|
1946
1953
|
httpMetadata?: R2HTTPMetadata | Headers;
|
|
1947
1954
|
customMetadata?: Record<string, string>;
|
|
1948
1955
|
storageClass?: string;
|
|
1956
|
+
ssecKey?: ArrayBuffer | string;
|
|
1949
1957
|
}
|
|
1950
1958
|
export interface R2Checksums {
|
|
1951
1959
|
readonly md5?: ArrayBuffer;
|
|
@@ -1982,6 +1990,9 @@ export type R2Objects = {
|
|
|
1982
1990
|
truncated: false;
|
|
1983
1991
|
}
|
|
1984
1992
|
);
|
|
1993
|
+
export interface R2UploadPartOptions {
|
|
1994
|
+
ssecKey?: ArrayBuffer | string;
|
|
1995
|
+
}
|
|
1985
1996
|
export declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1986
1997
|
readonly scheduledTime: number;
|
|
1987
1998
|
readonly cron: string;
|
|
@@ -3537,14 +3548,6 @@ export declare abstract class BaseAiTranslation {
|
|
|
3537
3548
|
inputs: AiTranslationInput;
|
|
3538
3549
|
postProcessedOutputs: AiTranslationOutput;
|
|
3539
3550
|
}
|
|
3540
|
-
export type GatewayOptions = {
|
|
3541
|
-
id: string;
|
|
3542
|
-
cacheKey?: string;
|
|
3543
|
-
cacheTtl?: number;
|
|
3544
|
-
skipCache?: boolean;
|
|
3545
|
-
metadata?: Record<string, number | string | boolean | null | bigint>;
|
|
3546
|
-
collectLog?: boolean;
|
|
3547
|
-
};
|
|
3548
3551
|
export type AiOptions = {
|
|
3549
3552
|
gateway?: GatewayOptions;
|
|
3550
3553
|
prefix?: string;
|
|
@@ -3611,6 +3614,8 @@ export type BaseAiImageToTextModels =
|
|
|
3611
3614
|
| "@cf/unum/uform-gen2-qwen-500m"
|
|
3612
3615
|
| "@cf/llava-hf/llava-1.5-7b-hf";
|
|
3613
3616
|
export declare abstract class Ai {
|
|
3617
|
+
public aiGatewayLogId: string | null;
|
|
3618
|
+
public gateway(gatewayId: string): AiGateway;
|
|
3614
3619
|
run(
|
|
3615
3620
|
model: BaseAiTextClassificationModels,
|
|
3616
3621
|
inputs: BaseAiTextClassification["inputs"],
|
|
@@ -3662,6 +3667,52 @@ export declare abstract class Ai {
|
|
|
3662
3667
|
options?: AiOptions,
|
|
3663
3668
|
): Promise<BaseAiImageToText["postProcessedOutputs"]>;
|
|
3664
3669
|
}
|
|
3670
|
+
export type GatewayOptions = {
|
|
3671
|
+
id: string;
|
|
3672
|
+
cacheKey?: string;
|
|
3673
|
+
cacheTtl?: number;
|
|
3674
|
+
skipCache?: boolean;
|
|
3675
|
+
metadata?: Record<string, number | string | boolean | null | bigint>;
|
|
3676
|
+
collectLog?: boolean;
|
|
3677
|
+
};
|
|
3678
|
+
export type AiGatewayPatchLog = {
|
|
3679
|
+
score?: number | null;
|
|
3680
|
+
feedback?: -1 | 1 | "-1" | "1" | null;
|
|
3681
|
+
metadata?: Record<string, number | string | boolean | null | bigint> | null;
|
|
3682
|
+
};
|
|
3683
|
+
export type AiGatewayLog = {
|
|
3684
|
+
id: string;
|
|
3685
|
+
provider: string;
|
|
3686
|
+
model: string;
|
|
3687
|
+
model_type?: string;
|
|
3688
|
+
path: string;
|
|
3689
|
+
duration: number;
|
|
3690
|
+
request_type?: string;
|
|
3691
|
+
request_content_type?: string;
|
|
3692
|
+
status_code: number;
|
|
3693
|
+
response_content_type?: string;
|
|
3694
|
+
success: boolean;
|
|
3695
|
+
cached: boolean;
|
|
3696
|
+
tokens_in?: number;
|
|
3697
|
+
tokens_out?: number;
|
|
3698
|
+
metadata?: Record<string, number | string | boolean | null | bigint>;
|
|
3699
|
+
step?: number;
|
|
3700
|
+
cost?: number;
|
|
3701
|
+
custom_cost?: boolean;
|
|
3702
|
+
request_size: number;
|
|
3703
|
+
request_head?: string;
|
|
3704
|
+
request_head_complete: boolean;
|
|
3705
|
+
response_size: number;
|
|
3706
|
+
response_head?: string;
|
|
3707
|
+
response_head_complete: boolean;
|
|
3708
|
+
created_at: Date;
|
|
3709
|
+
};
|
|
3710
|
+
export interface AiGatewayInternalError extends Error {}
|
|
3711
|
+
export interface AiGatewayLogNotFound extends Error {}
|
|
3712
|
+
export declare abstract class AiGateway {
|
|
3713
|
+
patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;
|
|
3714
|
+
getLog(logId: string): Promise<AiGatewayLog>;
|
|
3715
|
+
}
|
|
3665
3716
|
export interface BasicImageTransformations {
|
|
3666
3717
|
/**
|
|
3667
3718
|
* Maximum width in image pixels. The value must be an integer.
|
package/2022-01-31/index.d.ts
CHANGED
|
@@ -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;
|
|
@@ -359,7 +359,7 @@ declare function structuredClone<T>(
|
|
|
359
359
|
declare function reportError(error: any): void;
|
|
360
360
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
|
|
361
361
|
declare function fetch(
|
|
362
|
-
input: RequestInfo,
|
|
362
|
+
input: RequestInfo | URL,
|
|
363
363
|
init?: RequestInit<RequestInitCfProperties>,
|
|
364
364
|
): Promise<Response>;
|
|
365
365
|
declare const self: ServiceWorkerGlobalScope;
|
|
@@ -935,7 +935,7 @@ declare class Blob {
|
|
|
935
935
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
|
|
936
936
|
slice(start?: number, end?: number, type?: string): Blob;
|
|
937
937
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) */
|
|
938
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
938
|
+
arrayBuffer(): Promise<ArrayBuffer | ArrayBufferView>;
|
|
939
939
|
bytes(): Promise<Uint8Array>;
|
|
940
940
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
|
|
941
941
|
text(): Promise<string>;
|
|
@@ -982,14 +982,17 @@ declare abstract class CacheStorage {
|
|
|
982
982
|
*/
|
|
983
983
|
declare abstract class Cache {
|
|
984
984
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */
|
|
985
|
-
delete(
|
|
985
|
+
delete(
|
|
986
|
+
request: RequestInfo | URL,
|
|
987
|
+
options?: CacheQueryOptions,
|
|
988
|
+
): Promise<boolean>;
|
|
986
989
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */
|
|
987
990
|
match(
|
|
988
|
-
request: RequestInfo,
|
|
991
|
+
request: RequestInfo | URL,
|
|
989
992
|
options?: CacheQueryOptions,
|
|
990
993
|
): Promise<Response | undefined>;
|
|
991
994
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */
|
|
992
|
-
put(request: RequestInfo, response: Response): Promise<void>;
|
|
995
|
+
put(request: RequestInfo | URL, response: Response): Promise<void>;
|
|
993
996
|
}
|
|
994
997
|
interface CacheQueryOptions {
|
|
995
998
|
ignoreMethod?: boolean;
|
|
@@ -1508,7 +1511,7 @@ declare abstract class Body {
|
|
|
1508
1511
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */
|
|
1509
1512
|
get bodyUsed(): boolean;
|
|
1510
1513
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */
|
|
1511
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
1514
|
+
arrayBuffer(): Promise<ArrayBuffer | ArrayBufferView>;
|
|
1512
1515
|
bytes(): Promise<Uint8Array>;
|
|
1513
1516
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */
|
|
1514
1517
|
text(): Promise<string>;
|
|
@@ -1563,8 +1566,7 @@ interface ResponseInit {
|
|
|
1563
1566
|
}
|
|
1564
1567
|
type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> =
|
|
1565
1568
|
| Request<CfHostMetadata, Cf>
|
|
1566
|
-
| string
|
|
1567
|
-
| URL;
|
|
1569
|
+
| string;
|
|
1568
1570
|
/**
|
|
1569
1571
|
* This Fetch API interface represents a resource request.
|
|
1570
1572
|
*
|
|
@@ -1573,7 +1575,7 @@ type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> =
|
|
|
1573
1575
|
declare var Request: {
|
|
1574
1576
|
prototype: Request;
|
|
1575
1577
|
new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(
|
|
1576
|
-
input: RequestInfo<CfProperties
|
|
1578
|
+
input: RequestInfo<CfProperties> | URL,
|
|
1577
1579
|
init?: RequestInit<Cf>,
|
|
1578
1580
|
): Request<CfHostMetadata, Cf>;
|
|
1579
1581
|
};
|
|
@@ -1655,7 +1657,7 @@ type Fetcher<
|
|
|
1655
1657
|
> = (T extends Rpc.EntrypointBranded
|
|
1656
1658
|
? Rpc.Provider<T, Reserved | "fetch" | "connect">
|
|
1657
1659
|
: unknown) & {
|
|
1658
|
-
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1660
|
+
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
1659
1661
|
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1660
1662
|
};
|
|
1661
1663
|
interface FetcherPutOptions {
|
|
@@ -1876,6 +1878,7 @@ interface R2MultipartUpload {
|
|
|
1876
1878
|
uploadPart(
|
|
1877
1879
|
partNumber: number,
|
|
1878
1880
|
value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob,
|
|
1881
|
+
options?: R2UploadPartOptions,
|
|
1879
1882
|
): Promise<R2UploadedPart>;
|
|
1880
1883
|
abort(): Promise<void>;
|
|
1881
1884
|
complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
|
|
@@ -1896,12 +1899,13 @@ declare abstract class R2Object {
|
|
|
1896
1899
|
readonly customMetadata?: Record<string, string>;
|
|
1897
1900
|
readonly range?: R2Range;
|
|
1898
1901
|
readonly storageClass: string;
|
|
1902
|
+
readonly ssecKeyMd5?: string;
|
|
1899
1903
|
writeHttpMetadata(headers: Headers): void;
|
|
1900
1904
|
}
|
|
1901
1905
|
interface R2ObjectBody extends R2Object {
|
|
1902
1906
|
get body(): ReadableStream;
|
|
1903
1907
|
get bodyUsed(): boolean;
|
|
1904
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
1908
|
+
arrayBuffer(): Promise<ArrayBuffer | ArrayBufferView>;
|
|
1905
1909
|
text(): Promise<string>;
|
|
1906
1910
|
json<T>(): Promise<T>;
|
|
1907
1911
|
blob(): Promise<Blob>;
|
|
@@ -1928,6 +1932,7 @@ interface R2Conditional {
|
|
|
1928
1932
|
interface R2GetOptions {
|
|
1929
1933
|
onlyIf?: R2Conditional | Headers;
|
|
1930
1934
|
range?: R2Range | Headers;
|
|
1935
|
+
ssecKey?: ArrayBuffer | string;
|
|
1931
1936
|
}
|
|
1932
1937
|
interface R2PutOptions {
|
|
1933
1938
|
onlyIf?: R2Conditional | Headers;
|
|
@@ -1939,11 +1944,13 @@ interface R2PutOptions {
|
|
|
1939
1944
|
sha384?: ArrayBuffer | string;
|
|
1940
1945
|
sha512?: ArrayBuffer | string;
|
|
1941
1946
|
storageClass?: string;
|
|
1947
|
+
ssecKey?: ArrayBuffer | string;
|
|
1942
1948
|
}
|
|
1943
1949
|
interface R2MultipartOptions {
|
|
1944
1950
|
httpMetadata?: R2HTTPMetadata | Headers;
|
|
1945
1951
|
customMetadata?: Record<string, string>;
|
|
1946
1952
|
storageClass?: string;
|
|
1953
|
+
ssecKey?: ArrayBuffer | string;
|
|
1947
1954
|
}
|
|
1948
1955
|
interface R2Checksums {
|
|
1949
1956
|
readonly md5?: ArrayBuffer;
|
|
@@ -1980,6 +1987,9 @@ type R2Objects = {
|
|
|
1980
1987
|
truncated: false;
|
|
1981
1988
|
}
|
|
1982
1989
|
);
|
|
1990
|
+
interface R2UploadPartOptions {
|
|
1991
|
+
ssecKey?: ArrayBuffer | string;
|
|
1992
|
+
}
|
|
1983
1993
|
declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1984
1994
|
readonly scheduledTime: number;
|
|
1985
1995
|
readonly cron: string;
|
|
@@ -3552,14 +3562,6 @@ declare abstract class BaseAiTranslation {
|
|
|
3552
3562
|
inputs: AiTranslationInput;
|
|
3553
3563
|
postProcessedOutputs: AiTranslationOutput;
|
|
3554
3564
|
}
|
|
3555
|
-
type GatewayOptions = {
|
|
3556
|
-
id: string;
|
|
3557
|
-
cacheKey?: string;
|
|
3558
|
-
cacheTtl?: number;
|
|
3559
|
-
skipCache?: boolean;
|
|
3560
|
-
metadata?: Record<string, number | string | boolean | null | bigint>;
|
|
3561
|
-
collectLog?: boolean;
|
|
3562
|
-
};
|
|
3563
3565
|
type AiOptions = {
|
|
3564
3566
|
gateway?: GatewayOptions;
|
|
3565
3567
|
prefix?: string;
|
|
@@ -3625,6 +3627,8 @@ type BaseAiImageToTextModels =
|
|
|
3625
3627
|
| "@cf/unum/uform-gen2-qwen-500m"
|
|
3626
3628
|
| "@cf/llava-hf/llava-1.5-7b-hf";
|
|
3627
3629
|
declare abstract class Ai {
|
|
3630
|
+
public aiGatewayLogId: string | null;
|
|
3631
|
+
public gateway(gatewayId: string): AiGateway;
|
|
3628
3632
|
run(
|
|
3629
3633
|
model: BaseAiTextClassificationModels,
|
|
3630
3634
|
inputs: BaseAiTextClassification["inputs"],
|
|
@@ -3676,6 +3680,52 @@ declare abstract class Ai {
|
|
|
3676
3680
|
options?: AiOptions,
|
|
3677
3681
|
): Promise<BaseAiImageToText["postProcessedOutputs"]>;
|
|
3678
3682
|
}
|
|
3683
|
+
type GatewayOptions = {
|
|
3684
|
+
id: string;
|
|
3685
|
+
cacheKey?: string;
|
|
3686
|
+
cacheTtl?: number;
|
|
3687
|
+
skipCache?: boolean;
|
|
3688
|
+
metadata?: Record<string, number | string | boolean | null | bigint>;
|
|
3689
|
+
collectLog?: boolean;
|
|
3690
|
+
};
|
|
3691
|
+
type AiGatewayPatchLog = {
|
|
3692
|
+
score?: number | null;
|
|
3693
|
+
feedback?: -1 | 1 | "-1" | "1" | null;
|
|
3694
|
+
metadata?: Record<string, number | string | boolean | null | bigint> | null;
|
|
3695
|
+
};
|
|
3696
|
+
type AiGatewayLog = {
|
|
3697
|
+
id: string;
|
|
3698
|
+
provider: string;
|
|
3699
|
+
model: string;
|
|
3700
|
+
model_type?: string;
|
|
3701
|
+
path: string;
|
|
3702
|
+
duration: number;
|
|
3703
|
+
request_type?: string;
|
|
3704
|
+
request_content_type?: string;
|
|
3705
|
+
status_code: number;
|
|
3706
|
+
response_content_type?: string;
|
|
3707
|
+
success: boolean;
|
|
3708
|
+
cached: boolean;
|
|
3709
|
+
tokens_in?: number;
|
|
3710
|
+
tokens_out?: number;
|
|
3711
|
+
metadata?: Record<string, number | string | boolean | null | bigint>;
|
|
3712
|
+
step?: number;
|
|
3713
|
+
cost?: number;
|
|
3714
|
+
custom_cost?: boolean;
|
|
3715
|
+
request_size: number;
|
|
3716
|
+
request_head?: string;
|
|
3717
|
+
request_head_complete: boolean;
|
|
3718
|
+
response_size: number;
|
|
3719
|
+
response_head?: string;
|
|
3720
|
+
response_head_complete: boolean;
|
|
3721
|
+
created_at: Date;
|
|
3722
|
+
};
|
|
3723
|
+
interface AiGatewayInternalError extends Error {}
|
|
3724
|
+
interface AiGatewayLogNotFound extends Error {}
|
|
3725
|
+
declare abstract class AiGateway {
|
|
3726
|
+
patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;
|
|
3727
|
+
getLog(logId: string): Promise<AiGatewayLog>;
|
|
3728
|
+
}
|
|
3679
3729
|
interface BasicImageTransformations {
|
|
3680
3730
|
/**
|
|
3681
3731
|
* Maximum width in image pixels. The value must be an integer.
|