From 9409be6c83e1f93af074ebf4cd9cdcb3af5cff1c Mon Sep 17 00:00:00 2001 From: "autodecl-bot[bot]" <91285878+autodecl-bot[bot]@users.noreply.github.com> Date: Wed, 11 May 2022 19:57:28 +0000 Subject: [PATCH] Updated types for 2022-05-11 --- .changeset/2022-05-11.md | 5 ++ index.d.ts | 28 +++++---- src/workers.json | 121 +++++++++++++++++++++++++-------------- 3 files changed, 98 insertions(+), 56 deletions(-) create mode 100644 .changeset/2022-05-11.md diff --git a/.changeset/2022-05-11.md b/.changeset/2022-05-11.md new file mode 100644 index 00000000..e8498956 --- /dev/null +++ b/.changeset/2022-05-11.md @@ -0,0 +1,5 @@ +--- +"@cloudflare/workers-types": minor +--- + +Updated auto-generated types @ 2022-05-11 diff --git a/index.d.ts b/index.d.ts index fbd01c77..a6eca9db 100644 --- a/index.d.ts +++ b/index.d.ts @@ -363,6 +363,7 @@ interface DurableObjectId { interface DurableObjectListOptions { start?: string; + startAfter?: string; end?: string; prefix?: string; reverse?: boolean; @@ -622,7 +623,7 @@ declare class ExtendableEvent extends Event { waitUntil(promise: Promise): void; } -declare abstract class FetchEvent extends ExtendableEvent { +declare abstract class FetchEvent extends Event { readonly request: Request; respondWith(promise: Response | Promise): void; passThroughOnException(): void; @@ -1002,8 +1003,19 @@ interface QueuingStrategyInit { * An instance of the R2 bucket binding. */ interface R2Bucket { - head(key: string, options?: R2HeadOptions): Promise; - get(key: string, options?: R2GetOptions): Promise; + head(key: string): Promise; + get(key: string): Promise; + /** + * Returns R2Object on a failure of the conditional specified in onlyIf. + */ + get( + key: string, + options: R2GetOptions + ): Promise; + get( + key: string, + options?: R2GetOptions + ): Promise; put( key: string, value: @@ -1057,13 +1069,6 @@ interface R2HTTPMetadata { cacheExpiry?: Date; } -/** - * Options for retrieving the object metadata. - */ -interface R2HeadOptions { - onlyIf?: R2Conditional | Headers; -} - interface R2ListOptions { limit?: number; prefix?: string; @@ -1123,7 +1128,6 @@ interface R2PutOptions { httpMetadata?: R2HTTPMetadata | Headers; customMetadata?: Record; md5?: ArrayBuffer | string; - sha1?: ArrayBuffer | string; } interface R2Range { @@ -1537,7 +1541,7 @@ declare type StreamPipeOptions = PipeToOptions; interface StreamQueuingStrategy { highWaterMark?: number; - size(chunk: ArrayBuffer): number; + size(chunk: any): number; } declare abstract class SubtleCrypto { diff --git a/src/workers.json b/src/workers.json index 902e52ea..572564f7 100644 --- a/src/workers.json +++ b/src/workers.json @@ -2013,6 +2013,13 @@ "optional": true } }, + { + "name": "startAfter", + "type": { + "name": "string", + "optional": true + } + }, { "name": "end", "type": { @@ -4355,7 +4362,7 @@ ], "extends": [ { - "name": "ExtendableEvent" + "name": "Event" } ], "kind": "class" @@ -7270,6 +7277,64 @@ "members": [ { "name": "head", + "type": { + "params": [ + { + "name": "key", + "type": { + "name": "string" + } + } + ], + "returns": { + "name": "Promise", + "args": [ + { + "name": "|", + "args": [ + { + "name": "R2Object" + }, + { + "name": "null" + } + ] + } + ] + } + } + }, + { + "name": "get", + "type": { + "params": [ + { + "name": "key", + "type": { + "name": "string" + } + } + ], + "returns": { + "name": "Promise", + "args": [ + { + "name": "|", + "args": [ + { + "name": "R2ObjectBody" + }, + { + "name": "null" + } + ] + } + ] + } + } + }, + { + "name": "get", "type": { "params": [ { @@ -7281,8 +7346,7 @@ { "name": "options", "type": { - "name": "R2HeadOptions", - "optional": true + "name": "R2GetOptions" } } ], @@ -7292,6 +7356,9 @@ { "name": "|", "args": [ + { + "name": "R2ObjectBody" + }, { "name": "R2Object" }, @@ -7302,6 +7369,9 @@ } ] } + }, + "comment": { + "text": "Returns R2Object on a failure of the conditional specified in onlyIf." } }, { @@ -7331,6 +7401,9 @@ { "name": "R2ObjectBody" }, + { + "name": "R2Object" + }, { "name": "null" } @@ -7566,31 +7639,6 @@ }, "kind": "struct" }, - "R2HeadOptions": { - "name": "R2HeadOptions", - "members": [ - { - "name": "onlyIf", - "type": { - "name": "|", - "args": [ - { - "name": "R2Conditional" - }, - { - "name": "Headers" - } - ], - "optional": true - } - } - ], - "comment": { - "text": "Options for retrieving the object metadata.", - "renamed": true - }, - "kind": "struct" - }, "R2ListOptions": { "name": "R2ListOptions", "members": [ @@ -7924,21 +7972,6 @@ ], "optional": true } - }, - { - "name": "sha1", - "type": { - "name": "|", - "args": [ - { - "name": "ArrayBuffer" - }, - { - "name": "string" - } - ], - "optional": true - } } ], "comment": { @@ -10668,7 +10701,7 @@ { "name": "chunk", "type": { - "name": "ArrayBuffer" + "name": "any" } } ],