From f932188642cfd28c1a1b33d80897ace585422df4 Mon Sep 17 00:00:00 2001 From: "autodecl-bot[bot]" <91285878+autodecl-bot[bot]@users.noreply.github.com> Date: Tue, 30 Aug 2022 21:08:11 +0000 Subject: [PATCH 1/2] Updated types for 2022-08-30 --- .changeset/2022-08-30.md | 5 + index.d.ts | 79 ++++- src/workers.json | 636 +++++++++++++++++++++++++++++++++++++-- 3 files changed, 695 insertions(+), 25 deletions(-) create mode 100644 .changeset/2022-08-30.md diff --git a/.changeset/2022-08-30.md b/.changeset/2022-08-30.md new file mode 100644 index 00000000..a14db2ad --- /dev/null +++ b/.changeset/2022-08-30.md @@ -0,0 +1,5 @@ +--- +"@cloudflare/workers-types": minor +--- + +Updated auto-generated types @ 2022-08-30 diff --git a/index.d.ts b/index.d.ts index 1ba428d3..bdfc8fc1 100644 --- a/index.d.ts +++ b/index.d.ts @@ -293,6 +293,29 @@ interface CryptoKeyVoprfKeyAlgorithm { namedCurve: string; } +interface D1Database { + prepare(query: string): D1PreparedStatement; + dump(): Promise; + batch(statements: D1PreparedStatement[]): Promise[]>; + exec(query: string): Promise>; +} + +interface D1PreparedStatement { + bind(...values: any[]): D1PreparedStatement; + first(colName?: string): Promise; + run(): Promise>; + all(): Promise>; + raw(): Promise; +} + +declare type D1Result = { + results?: T[]; + lastRowId: number | null; + changes: number; + duration: number; + error?: string; +}; + declare class DOMException extends Error { constructor(message?: string, name?: string); readonly code: number; @@ -399,7 +422,7 @@ interface DurableObjectSetAlarmOptions { interface DurableObjectState { waitUntil(promise: Promise): void; - readonly id: DurableObjectId | string; + id: DurableObjectId; readonly storage: DurableObjectStorage; blockConcurrencyWhile(callback: () => Promise): Promise; } @@ -464,7 +487,10 @@ interface DurableObjectStub extends Fetcher { } interface DurableObjectTransaction { - get(key: string, options?: DurableObjectGetOptions): Promise; + get( + key: string, + options?: DurableObjectGetOptions + ): Promise; get( keys: string[], options?: DurableObjectGetOptions @@ -597,6 +623,10 @@ interface EventTargetEventListenerOptions { capture?: boolean; } +interface EventTargetHandlerObject { + handleEvent(arg1: Event): any | undefined; +} + interface ExecutionContext { waitUntil(promise: Promise): void; passThroughOnException(): void; @@ -664,7 +694,7 @@ declare class FormData { set(name: string, value: Blob, filename?: string): void; entries(): IterableIterator<[key: string, value: File | string]>; keys(): IterableIterator; - values(): IterableIterator; + values(): IterableIterator; forEach( callback: ( this: This, @@ -677,6 +707,10 @@ declare class FormData { [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>; } +declare type FormDataKeyIterator = IterableIterator; + +declare type FormDataValueIterator = IterableIterator; + declare class HTMLRewriter { constructor(); on( @@ -729,6 +763,10 @@ declare type HeadersInit = */ declare type HeadersInitializer = HeadersInit; +declare type HeadersKeyIterator = IterableIterator; + +declare type HeadersValueIterator = IterableIterator; + declare class IdentityTransformStream extends TransformStream { constructor(); } @@ -768,6 +806,7 @@ interface IncomingRequestCfProperties { */ country: string; httpProtocol: string; + isEUCountry?: string; latitude?: string; longitude?: string; /** @@ -805,9 +844,13 @@ interface IncomingRequestCfPropertiesBotManagement { interface IncomingRequestCfPropertiesTLSClientAuth { certIssuerDNLegacy: string; certIssuerDN: string; + certIssuerDNRFC2253: string; + certIssuerSKI: string; + certIssuerSerial: string; certPresented: "0" | "1"; certSubjectDNLegacy: string; certSubjectDN: string; + certSubjectDNRFC2253: string; /** * In format "Dec 22 19:39:00 2018 GMT" */ @@ -822,6 +865,8 @@ interface IncomingRequestCfPropertiesTLSClientAuth { * "SUCCESS", "FAILED:reason", "NONE" */ certVerified: string; + certRevoked: string; + certSKI: string; } interface JsonWebKey { @@ -1042,6 +1087,7 @@ interface R2Conditional { etagDoesNotMatch?: string; uploadedBefore?: Date; uploadedAfter?: Date; + secondsGranularity?: boolean; } /** @@ -1049,7 +1095,7 @@ interface R2Conditional { */ interface R2GetOptions { onlyIf?: R2Conditional | Headers; - range?: R2Range; + range?: R2Range | Headers; } /** @@ -1077,6 +1123,7 @@ interface R2ListOptions { prefix?: string; cursor?: string; delimiter?: string; + startAfter?: string; /** * If you populate this array, then items returned will include this metadata. * A tradeoff is that fewer results may be returned depending on how big this @@ -1103,8 +1150,8 @@ declare abstract class R2Object { readonly etag: string; readonly httpEtag: string; readonly uploaded: Date; - readonly httpMetadata: R2HTTPMetadata; - readonly customMetadata: Record; + readonly httpMetadata?: R2HTTPMetadata; + readonly customMetadata?: Record; readonly range?: R2Range; writeHttpMetadata(headers: Headers): void; } @@ -1624,6 +1671,10 @@ declare abstract class SubtleCrypto { extractable: boolean, keyUsages: string[] ): Promise; + timingSafeEqual( + a: ArrayBuffer | ArrayBufferView, + b: ArrayBuffer | ArrayBufferView + ): boolean; } interface SubtleCryptoDeriveKeyAlgorithm { @@ -1718,6 +1769,14 @@ interface TextDecoderDecodeOptions { stream: boolean; } +declare class TextDecoderStream extends TransformStream { + constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); +} + +interface TextDecoderStreamTextDecoderStreamInit { + fatal?: boolean; +} + declare class TextEncoder { constructor(); encode(input?: string): Uint8Array; @@ -1730,6 +1789,10 @@ interface TextEncoderEncodeIntoResult { written: number; } +declare class TextEncoderStream extends TransformStream { + constructor(); +} + declare class TransformStream { constructor( maybeTransformer?: Transformer, @@ -1858,6 +1921,10 @@ declare type URLSearchParamsInit = */ declare type URLSearchParamsInitializer = URLSearchParamsInit; +declare type URLSearchParamsKeyIterator = IterableIterator; + +declare type URLSearchParamsValueIterator = IterableIterator; + interface UnderlyingSink { type?: string; start?(controller: WritableStreamDefaultController): any; diff --git a/src/workers.json b/src/workers.json index 82986210..ab699441 100644 --- a/src/workers.json +++ b/src/workers.json @@ -1505,6 +1505,325 @@ ], "kind": "struct" }, + "D1Database": { + "name": "D1Database", + "members": [ + { + "name": "prepare", + "type": { + "params": [ + { + "name": "query", + "type": { + "name": "string" + } + } + ], + "returns": { + "name": "D1PreparedStatement" + } + } + }, + { + "name": "dump", + "type": { + "params": [], + "returns": { + "name": "Promise", + "args": [ + { + "name": "ArrayBuffer" + } + ] + } + } + }, + { + "name": "batch", + "type": { + "params": [ + { + "name": "statements", + "type": { + "name": "[]", + "args": [ + { + "name": "D1PreparedStatement" + } + ] + } + } + ], + "returns": { + "name": "Promise", + "args": [ + { + "name": "[]", + "args": [ + { + "name": "D1Result", + "args": [ + { + "name": "T" + } + ] + } + ] + } + ] + } + }, + "typeparams": [ + { + "name": "T", + "default": { + "name": "unknown" + } + } + ] + }, + { + "name": "exec", + "type": { + "params": [ + { + "name": "query", + "type": { + "name": "string" + } + } + ], + "returns": { + "name": "Promise", + "args": [ + { + "name": "D1Result", + "args": [ + { + "name": "T" + } + ] + } + ] + } + }, + "typeparams": [ + { + "name": "T", + "default": { + "name": "unknown" + } + } + ] + } + ], + "kind": "class" + }, + "D1PreparedStatement": { + "name": "D1PreparedStatement", + "members": [ + { + "name": "bind", + "type": { + "params": [ + { + "name": "values", + "type": { + "name": "[]", + "args": [ + { + "name": "any" + } + ], + "variadic": true + } + } + ], + "returns": { + "name": "D1PreparedStatement" + } + } + }, + { + "name": "first", + "type": { + "params": [ + { + "name": "colName", + "type": { + "name": "string", + "optional": true + } + } + ], + "returns": { + "name": "Promise", + "args": [ + { + "name": "T" + } + ] + } + }, + "typeparams": [ + { + "name": "T", + "default": { + "name": "unknown" + } + } + ] + }, + { + "name": "run", + "type": { + "params": [], + "returns": { + "name": "Promise", + "args": [ + { + "name": "D1Result", + "args": [ + { + "name": "T" + } + ] + } + ] + } + }, + "typeparams": [ + { + "name": "T", + "default": { + "name": "unknown" + } + } + ] + }, + { + "name": "all", + "type": { + "params": [], + "returns": { + "name": "Promise", + "args": [ + { + "name": "D1Result", + "args": [ + { + "name": "[]", + "args": [ + { + "name": "T" + } + ] + } + ] + } + ] + } + }, + "typeparams": [ + { + "name": "T", + "default": { + "name": "unknown" + } + } + ] + }, + { + "name": "raw", + "type": { + "params": [], + "returns": { + "name": "Promise", + "args": [ + { + "name": "[]", + "args": [ + { + "name": "T" + } + ] + } + ] + } + }, + "typeparams": [ + { + "name": "T", + "default": { + "name": "unknown" + } + } + ] + } + ], + "kind": "class" + }, + "D1Result": { + "name": "D1Result", + "type": { + "members": [ + { + "name": "results", + "type": { + "name": "[]", + "args": [ + { + "name": "T" + } + ], + "optional": true + } + }, + { + "name": "lastRowId", + "type": { + "name": "|", + "args": [ + { + "name": "number" + }, + { + "name": "null" + } + ] + } + }, + { + "name": "changes", + "type": { + "name": "number" + } + }, + { + "name": "duration", + "type": { + "name": "number" + } + }, + { + "name": "error", + "type": { + "name": "string", + "optional": true + } + } + ] + }, + "typeparams": [ + { + "name": "T", + "default": { + "name": "unknown" + } + } + ], + "kind": "typedef" + }, "DOMException": { "name": "DOMException", "members": [ @@ -2240,19 +2559,10 @@ } }, { - "name": "id", - "type": { - "name": "|", - "args": [ - { - "name": "DurableObjectId" - }, - { - "name": "string" - } - ] - }, - "readonly": true + "name": "id", + "type": { + "name": "DurableObjectId" + } }, { "name": "storage", @@ -2803,7 +3113,15 @@ "name": "Promise", "args": [ { - "name": "T" + "name": "|", + "args": [ + { + "name": "T" + }, + { + "name": "undefined" + } + ] } ] } @@ -4100,6 +4418,29 @@ ], "kind": "struct" }, + "EventTargetHandlerObject": { + "name": "EventTargetHandlerObject", + "members": [ + { + "name": "handleEvent", + "type": { + "params": [ + { + "name": "arg1", + "type": { + "name": "Event" + } + } + ], + "returns": { + "name": "any", + "optional": true + } + } + } + ], + "kind": "struct" + }, "ExecutionContext": { "name": "ExecutionContext", "members": [ @@ -4794,10 +5135,10 @@ "name": "|", "args": [ { - "name": "File" + "name": "string" }, { - "name": "string" + "name": "File" } ] } @@ -4911,6 +5252,38 @@ ], "kind": "class" }, + "FormDataKeyIterator": { + "name": "FormDataKeyIterator", + "type": { + "name": "IterableIterator", + "args": [ + { + "name": "string" + } + ] + }, + "kind": "typedef" + }, + "FormDataValueIterator": { + "name": "FormDataValueIterator", + "type": { + "name": "IterableIterator", + "args": [ + { + "name": "|", + "args": [ + { + "name": "string" + }, + { + "name": "File" + } + ] + } + ] + }, + "kind": "typedef" + }, "HTMLRewriter": { "name": "HTMLRewriter", "members": [ @@ -5539,6 +5912,30 @@ }, "kind": "typedef" }, + "HeadersKeyIterator": { + "name": "HeadersKeyIterator", + "type": { + "name": "IterableIterator", + "args": [ + { + "name": "string" + } + ] + }, + "kind": "typedef" + }, + "HeadersValueIterator": { + "name": "HeadersValueIterator", + "type": { + "name": "IterableIterator", + "args": [ + { + "name": "string" + } + ] + }, + "kind": "typedef" + }, "IdentityTransformStream": { "name": "IdentityTransformStream", "members": [ @@ -5642,6 +6039,13 @@ "name": "string" } }, + { + "name": "isEUCountry", + "type": { + "name": "string", + "optional": true + } + }, { "name": "latitude", "type": { @@ -5775,6 +6179,24 @@ "name": "string" } }, + { + "name": "certIssuerDNRFC2253", + "type": { + "name": "string" + } + }, + { + "name": "certIssuerSKI", + "type": { + "name": "string" + } + }, + { + "name": "certIssuerSerial", + "type": { + "name": "string" + } + }, { "name": "certPresented", "type": { @@ -5801,6 +6223,12 @@ "name": "string" } }, + { + "name": "certSubjectDNRFC2253", + "type": { + "name": "string" + } + }, { "name": "certNotBefore", "type": { @@ -5839,6 +6267,18 @@ "comment": { "text": "\"SUCCESS\", \"FAILED:reason\", \"NONE\"" } + }, + { + "name": "certRevoked", + "type": { + "name": "string" + } + }, + { + "name": "certSKI", + "type": { + "name": "string" + } } ], "kind": "struct" @@ -7576,6 +8016,13 @@ "name": "Date", "optional": true } + }, + { + "name": "secondsGranularity", + "type": { + "name": "boolean", + "optional": true + } } ], "comment": { @@ -7605,7 +8052,15 @@ { "name": "range", "type": { - "name": "R2Range", + "name": "|", + "args": [ + { + "name": "R2Range" + }, + { + "name": "Headers" + } + ], "optional": true } } @@ -7699,6 +8154,13 @@ "optional": true } }, + { + "name": "startAfter", + "type": { + "name": "string", + "optional": true + } + }, { "name": "include", "type": { @@ -7777,7 +8239,8 @@ { "name": "httpMetadata", "type": { - "name": "R2HTTPMetadata" + "name": "R2HTTPMetadata", + "optional": true }, "readonly": true }, @@ -7792,7 +8255,8 @@ { "name": "string" } - ] + ], + "optional": true }, "readonly": true }, @@ -10422,6 +10886,32 @@ "static": true, "readonly": true }, + { + "name": "TextEncoderStream", + "type": { + "name": "typeof", + "args": [ + { + "name": "TextEncoderStream" + } + ] + }, + "static": true, + "readonly": true + }, + { + "name": "TextDecoderStream", + "type": { + "name": "typeof", + "args": [ + { + "name": "TextDecoderStream" + } + ] + }, + "static": true, + "readonly": true + }, { "name": "Headers", "type": { @@ -11430,6 +11920,28 @@ ] } } + }, + { + "name": "timingSafeEqual", + "type": { + "params": [ + { + "name": "a", + "type": { + "name": "ArrayBuffer|ArrayBufferView" + } + }, + { + "name": "b", + "type": { + "name": "ArrayBuffer|ArrayBufferView" + } + } + ], + "returns": { + "name": "boolean" + } + } } ], "kind": "class" @@ -11939,6 +12451,51 @@ ], "kind": "struct" }, + "TextDecoderStream": { + "name": "TextDecoderStream", + "members": [ + { + "name": "constructor", + "type": { + "params": [ + { + "name": "label", + "type": { + "name": "string", + "optional": true + } + }, + { + "name": "options", + "type": { + "name": "TextDecoderStreamTextDecoderStreamInit", + "optional": true + } + } + ] + } + } + ], + "extends": [ + { + "name": "TransformStream" + } + ], + "kind": "class" + }, + "TextDecoderStreamTextDecoderStreamInit": { + "name": "TextDecoderStreamTextDecoderStreamInit", + "members": [ + { + "name": "fatal", + "type": { + "name": "boolean", + "optional": true + } + } + ], + "kind": "struct" + }, "TextEncoder": { "name": "TextEncoder", "members": [ @@ -12015,6 +12572,23 @@ ], "kind": "struct" }, + "TextEncoderStream": { + "name": "TextEncoderStream", + "members": [ + { + "name": "constructor", + "type": { + "params": [] + } + } + ], + "extends": [ + { + "name": "TransformStream" + } + ], + "kind": "class" + }, "TransformStream": { "name": "TransformStream", "members": [ @@ -13012,6 +13586,30 @@ }, "kind": "typedef" }, + "URLSearchParamsKeyIterator": { + "name": "URLSearchParamsKeyIterator", + "type": { + "name": "IterableIterator", + "args": [ + { + "name": "string" + } + ] + }, + "kind": "typedef" + }, + "URLSearchParamsValueIterator": { + "name": "URLSearchParamsValueIterator", + "type": { + "name": "IterableIterator", + "args": [ + { + "name": "string" + } + ] + }, + "kind": "typedef" + }, "UnderlyingSink": { "name": "UnderlyingSink", "members": [ From 4c34be539ae6e4b40de1585cde489c968dd63dee Mon Sep 17 00:00:00 2001 From: bcoll Date: Thu, 1 Sep 2022 10:05:20 +0100 Subject: [PATCH 2/2] Updated types for 2022-08-30 --- index.d.ts | 12 -------- src/workers.json | 80 ------------------------------------------------ 2 files changed, 92 deletions(-) diff --git a/index.d.ts b/index.d.ts index bdfc8fc1..7dea8d33 100644 --- a/index.d.ts +++ b/index.d.ts @@ -707,10 +707,6 @@ declare class FormData { [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>; } -declare type FormDataKeyIterator = IterableIterator; - -declare type FormDataValueIterator = IterableIterator; - declare class HTMLRewriter { constructor(); on( @@ -763,10 +759,6 @@ declare type HeadersInit = */ declare type HeadersInitializer = HeadersInit; -declare type HeadersKeyIterator = IterableIterator; - -declare type HeadersValueIterator = IterableIterator; - declare class IdentityTransformStream extends TransformStream { constructor(); } @@ -1921,10 +1913,6 @@ declare type URLSearchParamsInit = */ declare type URLSearchParamsInitializer = URLSearchParamsInit; -declare type URLSearchParamsKeyIterator = IterableIterator; - -declare type URLSearchParamsValueIterator = IterableIterator; - interface UnderlyingSink { type?: string; start?(controller: WritableStreamDefaultController): any; diff --git a/src/workers.json b/src/workers.json index ab699441..4abf16c9 100644 --- a/src/workers.json +++ b/src/workers.json @@ -5252,38 +5252,6 @@ ], "kind": "class" }, - "FormDataKeyIterator": { - "name": "FormDataKeyIterator", - "type": { - "name": "IterableIterator", - "args": [ - { - "name": "string" - } - ] - }, - "kind": "typedef" - }, - "FormDataValueIterator": { - "name": "FormDataValueIterator", - "type": { - "name": "IterableIterator", - "args": [ - { - "name": "|", - "args": [ - { - "name": "string" - }, - { - "name": "File" - } - ] - } - ] - }, - "kind": "typedef" - }, "HTMLRewriter": { "name": "HTMLRewriter", "members": [ @@ -5912,30 +5880,6 @@ }, "kind": "typedef" }, - "HeadersKeyIterator": { - "name": "HeadersKeyIterator", - "type": { - "name": "IterableIterator", - "args": [ - { - "name": "string" - } - ] - }, - "kind": "typedef" - }, - "HeadersValueIterator": { - "name": "HeadersValueIterator", - "type": { - "name": "IterableIterator", - "args": [ - { - "name": "string" - } - ] - }, - "kind": "typedef" - }, "IdentityTransformStream": { "name": "IdentityTransformStream", "members": [ @@ -13586,30 +13530,6 @@ }, "kind": "typedef" }, - "URLSearchParamsKeyIterator": { - "name": "URLSearchParamsKeyIterator", - "type": { - "name": "IterableIterator", - "args": [ - { - "name": "string" - } - ] - }, - "kind": "typedef" - }, - "URLSearchParamsValueIterator": { - "name": "URLSearchParamsValueIterator", - "type": { - "name": "IterableIterator", - "args": [ - { - "name": "string" - } - ] - }, - "kind": "typedef" - }, "UnderlyingSink": { "name": "UnderlyingSink", "members": [