diff --git a/.changeset/fresh-feet-push.md b/.changeset/fresh-feet-push.md new file mode 100644 index 00000000..8ebace9a --- /dev/null +++ b/.changeset/fresh-feet-push.md @@ -0,0 +1,5 @@ +--- +"@cloudflare/workers-types": minor +--- + +Updated auto-generated types @ 2022-10-13 diff --git a/index.d.ts b/index.d.ts index 7dea8d33..22c0251f 100644 --- a/index.d.ts +++ b/index.d.ts @@ -252,8 +252,14 @@ declare type CryptoKeyAlgorithmVariant = | CryptoKeyHmacKeyAlgorithm | CryptoKeyRsaKeyAlgorithm | CryptoKeyEllipticKeyAlgorithm - | CryptoKeyVoprfKeyAlgorithm - | CryptoKeyOprfKeyAlgorithm; + | CryptoKeyArbitraryKeyAlgorithm; + +interface CryptoKeyArbitraryKeyAlgorithm { + name: string; + hash?: CryptoKeyKeyAlgorithm; + namedCurve?: string; + length?: number; +} interface CryptoKeyEllipticKeyAlgorithm { name: string; @@ -270,11 +276,6 @@ interface CryptoKeyKeyAlgorithm { name: string; } -interface CryptoKeyOprfKeyAlgorithm { - name: string; - namedCurve: string; -} - interface CryptoKeyPair { publicKey: CryptoKey; privateKey: CryptoKey; @@ -287,12 +288,6 @@ interface CryptoKeyRsaKeyAlgorithm { hash?: CryptoKeyKeyAlgorithm; } -interface CryptoKeyVoprfKeyAlgorithm { - name: string; - hash: CryptoKeyKeyAlgorithm; - namedCurve: string; -} - interface D1Database { prepare(query: string): D1PreparedStatement; dump(): Promise; @@ -304,7 +299,7 @@ interface D1PreparedStatement { bind(...values: any[]): D1PreparedStatement; first(colName?: string): Promise; run(): Promise>; - all(): Promise>; + all(): Promise>; raw(): Promise; } @@ -698,8 +693,8 @@ declare class FormData { forEach( callback: ( this: This, - key: string, value: File | string, + key: string, parent: FormData ) => void, thisArg?: This @@ -739,7 +734,7 @@ declare class Headers { append(name: string, value: string): void; delete(name: string): void; forEach( - callback: (this: This, key: string, value: string, parent: Headers) => void, + callback: (this: This, value: string, key: string, parent: Headers) => void, thisArg?: This ): void; entries(): IterableIterator<[key: string, value: string]>; @@ -784,7 +779,7 @@ interface IncomingRequestCfProperties { botManagement?: IncomingRequestCfPropertiesBotManagement; city?: string; clientAcceptEncoding?: string; - clientTcpRtt: number; + clientTcpRtt?: number; clientTrustScore?: number; /** * The three-letter airport code of the data center that the request @@ -828,6 +823,8 @@ interface IncomingRequestCfProperties { } interface IncomingRequestCfPropertiesBotManagement { + corporateProxy: boolean; + ja3Hash?: string; score: number; staticResource: boolean; verifiedBot: boolean; @@ -1067,10 +1064,21 @@ interface R2Bucket { | Blob, options?: R2PutOptions ): Promise; - delete(key: string): Promise; + delete(keys: string | string[]): Promise; list(options?: R2ListOptions): Promise; } +/** + * The checksums associated with the object. + */ +interface R2Checksums { + md5?: ArrayBuffer; + sha1?: ArrayBuffer; + sha256?: ArrayBuffer; + sha384?: ArrayBuffer; + sha512?: ArrayBuffer; +} + /** * Perform the operation conditionally based on meeting the defined criteria. */ @@ -1141,6 +1149,7 @@ declare abstract class R2Object { readonly size: number; readonly etag: string; readonly httpEtag: string; + readonly checksums: R2Checksums; readonly uploaded: Date; readonly httpMetadata?: R2HTTPMetadata; readonly customMetadata?: Record; @@ -1168,9 +1177,14 @@ interface R2Objects { } interface R2PutOptions { + onlyIf?: R2Conditional | Headers; httpMetadata?: R2HTTPMetadata | Headers; customMetadata?: Record; md5?: ArrayBuffer | string; + sha1?: ArrayBuffer | string; + sha256?: ArrayBuffer | string; + sha384?: ArrayBuffer | string; + sha512?: ArrayBuffer | string; } declare type R2Range = @@ -1404,8 +1418,10 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations { * - json: instead of generating an image, outputs information about the * image, in JSON format. The JSON object will contain image size * (before and after resizing), source image’s MIME type, file size, etc. + * - jpeg: generate images in JPEG format. + * - png: generate images in PNG format. */ - format?: "avif" | "webp" | "json"; + format?: "avif" | "webp" | "json" | "jpeg" | "png"; /** * Whether to preserve animation frames from input files. Default is true. * Setting it to false reduces animations to still images. This setting is @@ -1445,6 +1461,12 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations { * entry is the topmost layer). */ draw?: RequestInitCfPropertiesImageDraw[]; + /** + * Fetching image from authenticated origin. Setting this property will + * pass authentication headers (Authorization, Cookie, etc.) through to + * the origin. + */ + "origin-auth"?: "share-publicly"; } interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations { @@ -1593,7 +1615,7 @@ interface ServiceWorkerGlobalScopeStructuredCloneOptions { declare type StreamPipeOptions = PipeToOptions; interface StreamQueuingStrategy { - highWaterMark?: number; + highWaterMark?: bigint; size(chunk: any): number; } @@ -1785,6 +1807,68 @@ declare class TextEncoderStream extends TransformStream { constructor(); } +interface TraceEvent extends ExtendableEvent { + readonly traces: TraceItem[]; +} + +interface TraceException { + readonly timestamp: number; + readonly message: string; + readonly name: string; +} + +interface TraceItem { + readonly event: TraceItemEventInfo | null; + readonly eventTimestamp: number | null; + readonly logs: TraceLog[]; + readonly exceptions: TraceException[]; + readonly scriptName: string | null; + readonly dispatchNamespace?: string; + readonly outcome: string; +} + +interface TraceItemAlarmEventInfo { + readonly scheduledTime: Date; +} + +declare type TraceItemEventInfo = + | TraceItemFetchEventInfo + | TraceItemScheduledEventInfo + | TraceItemAlarmEventInfo; + +interface TraceItemFetchEventInfo { + readonly response?: TraceItemFetchEventInfoResponse; + readonly request: TraceItemFetchEventInfoRequest; +} + +interface TraceItemFetchEventInfoRequest { + readonly cf?: Object; + readonly headers: Record; + readonly method: string; + readonly url: string; + getUnredacted(): TraceItemFetchEventInfoRequest; +} + +interface TraceItemFetchEventInfoResponse { + readonly status: number; +} + +interface TraceItemScheduledEventInfo { + readonly scheduledTime: number; + readonly cron: string; +} + +interface TraceLog { + readonly timestamp: number; + readonly level: string; + readonly message: Object; +} + +interface TraceMetrics { + readonly cpuTime: number; + readonly wallTime: number; +} + declare class TransformStream { constructor( maybeTransformer?: Transformer, @@ -1889,8 +1973,8 @@ declare class URLSearchParams { forEach( callback: ( this: This, - key: string, value: string, + key: string, parent: URLSearchParams ) => void, thisArg?: This @@ -1933,6 +2017,10 @@ interface UnderlyingSource { cancel?(reason?: any): any; } +interface UnsafeTraceMetrics { + fromTrace(arg4: TraceItem): TraceMetrics; +} + declare class WebSocket extends EventTarget { constructor(url: string, protocols?: string[] | string); accept(): void; diff --git a/overrides/http.d.ts b/overrides/http.d.ts index 905ecac4..5f2f8931 100644 --- a/overrides/http.d.ts +++ b/overrides/http.d.ts @@ -12,6 +12,9 @@ declare class FormData { entries(): IterableIterator<[key: string, value: File | string]>; [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>; + keys(): IterableIterator; + values(): IterableIterator; + forEach( callback: ( this: This, @@ -27,6 +30,9 @@ declare class Headers { entries(): IterableIterator<[key: string, value: string]>; [Symbol.iterator](): IterableIterator<[key: string, value: string]>; + keys(): IterableIterator; + values(): IterableIterator; + forEach( callback: (this: This, value: string, key: string, parent: Headers) => void, thisArg?: This @@ -44,6 +50,9 @@ declare class URLSearchParams { entries(): IterableIterator<[key: string, value: string]>; [Symbol.iterator](): IterableIterator<[key: string, value: string]>; + keys(): IterableIterator; + values(): IterableIterator; + forEach( callback: ( this: This, diff --git a/src/workers.json b/src/workers.json index 4abf16c9..79babe41 100644 --- a/src/workers.json +++ b/src/workers.json @@ -1351,15 +1351,45 @@ "name": "CryptoKeyEllipticKeyAlgorithm" }, { - "name": "CryptoKeyVoprfKeyAlgorithm" - }, - { - "name": "CryptoKeyOprfKeyAlgorithm" + "name": "CryptoKeyArbitraryKeyAlgorithm" } ] }, "kind": "typedef" }, + "CryptoKeyArbitraryKeyAlgorithm": { + "name": "CryptoKeyArbitraryKeyAlgorithm", + "members": [ + { + "name": "name", + "type": { + "name": "string" + } + }, + { + "name": "hash", + "type": { + "name": "CryptoKeyKeyAlgorithm", + "optional": true + } + }, + { + "name": "namedCurve", + "type": { + "name": "string", + "optional": true + } + }, + { + "name": "length", + "type": { + "name": "integer", + "optional": true + } + } + ], + "kind": "struct" + }, "CryptoKeyEllipticKeyAlgorithm": { "name": "CryptoKeyEllipticKeyAlgorithm", "members": [ @@ -1414,24 +1444,6 @@ ], "kind": "struct" }, - "CryptoKeyOprfKeyAlgorithm": { - "name": "CryptoKeyOprfKeyAlgorithm", - "members": [ - { - "name": "name", - "type": { - "name": "string" - } - }, - { - "name": "namedCurve", - "type": { - "name": "string" - } - } - ], - "kind": "struct" - }, "CryptoKeyPair": { "name": "CryptoKeyPair", "members": [ @@ -1481,30 +1493,6 @@ ], "kind": "struct" }, - "CryptoKeyVoprfKeyAlgorithm": { - "name": "CryptoKeyVoprfKeyAlgorithm", - "members": [ - { - "name": "name", - "type": { - "name": "string" - } - }, - { - "name": "hash", - "type": { - "name": "CryptoKeyKeyAlgorithm" - } - }, - { - "name": "namedCurve", - "type": { - "name": "string" - } - } - ], - "kind": "struct" - }, "D1Database": { "name": "D1Database", "members": [ @@ -1712,12 +1700,7 @@ "name": "D1Result", "args": [ { - "name": "[]", - "args": [ - { - "name": "T" - } - ] + "name": "T" } ] } @@ -5160,12 +5143,6 @@ "name": "This" } }, - { - "name": "key", - "type": { - "name": "string" - } - }, { "name": "value", "type": { @@ -5180,6 +5157,12 @@ ] } }, + { + "name": "key", + "type": { + "name": "string" + } + }, { "name": "parent", "type": { @@ -5693,13 +5676,13 @@ } }, { - "name": "key", + "name": "value", "type": { "name": "string" } }, { - "name": "value", + "name": "key", "type": { "name": "string" } @@ -5942,7 +5925,8 @@ { "name": "clientTcpRtt", "type": { - "name": "number" + "name": "number", + "optional": true } }, { @@ -6087,6 +6071,19 @@ "IncomingRequestCfPropertiesBotManagement": { "name": "IncomingRequestCfPropertiesBotManagement", "members": [ + { + "name": "corporateProxy", + "type": { + "name": "boolean" + } + }, + { + "name": "ja3Hash", + "type": { + "name": "string", + "optional": true + } + }, { "name": "score", "type": { @@ -7885,9 +7882,22 @@ "type": { "params": [ { - "name": "key", + "name": "keys", "type": { - "name": "string" + "name": "|", + "args": [ + { + "name": "string" + }, + { + "name": "[]", + "args": [ + { + "name": "string" + } + ] + } + ] } } ], @@ -7930,6 +7940,51 @@ }, "kind": "class" }, + "R2Checksums": { + "name": "R2Checksums", + "members": [ + { + "name": "md5", + "type": { + "name": "ArrayBuffer", + "optional": true + } + }, + { + "name": "sha1", + "type": { + "name": "ArrayBuffer", + "optional": true + } + }, + { + "name": "sha256", + "type": { + "name": "ArrayBuffer", + "optional": true + } + }, + { + "name": "sha384", + "type": { + "name": "ArrayBuffer", + "optional": true + } + }, + { + "name": "sha512", + "type": { + "name": "ArrayBuffer", + "optional": true + } + } + ], + "comment": { + "text": "The checksums associated with the object.", + "renamed": true + }, + "kind": "struct" + }, "R2Conditional": { "name": "R2Conditional", "members": [ @@ -8173,6 +8228,13 @@ }, "readonly": true }, + { + "name": "checksums", + "type": { + "name": "R2Checksums" + }, + "readonly": true + }, { "name": "uploaded", "type": { @@ -8373,6 +8435,21 @@ "R2PutOptions": { "name": "R2PutOptions", "members": [ + { + "name": "onlyIf", + "type": { + "name": "|", + "args": [ + { + "name": "R2Conditional" + }, + { + "name": "Headers" + } + ], + "optional": true + } + }, { "name": "httpMetadata", "type": { @@ -8417,6 +8494,66 @@ ], "optional": true } + }, + { + "name": "sha1", + "type": { + "name": "|", + "args": [ + { + "name": "ArrayBuffer" + }, + { + "name": "string" + } + ], + "optional": true + } + }, + { + "name": "sha256", + "type": { + "name": "|", + "args": [ + { + "name": "ArrayBuffer" + }, + { + "name": "string" + } + ], + "optional": true + } + }, + { + "name": "sha384", + "type": { + "name": "|", + "args": [ + { + "name": "ArrayBuffer" + }, + { + "name": "string" + } + ], + "optional": true + } + }, + { + "name": "sha512", + "type": { + "name": "|", + "args": [ + { + "name": "ArrayBuffer" + }, + { + "name": "string" + } + ], + "optional": true + } } ], "comment": { @@ -9649,12 +9786,18 @@ }, { "name": "\"json\"" + }, + { + "name": "\"jpeg\"" + }, + { + "name": "\"png\"" } ], "optional": true }, "comment": { - "text": "Output format to generate. It can be:\n - avif: generate images in AVIF format.\n - webp: generate images in Google WebP format. Set quality to 100 to get\n the WebP-lossless format.\n - json: instead of generating an image, outputs information about the\n image, in JSON format. The JSON object will contain image size\n (before and after resizing), source image\u2019s MIME type, file size, etc." + "text": "Output format to generate. It can be:\n - avif: generate images in AVIF format.\n - webp: generate images in Google WebP format. Set quality to 100 to get\n the WebP-lossless format.\n - json: instead of generating an image, outputs information about the\n image, in JSON format. The JSON object will contain image size\n (before and after resizing), source image\u2019s MIME type, file size, etc.\n- jpeg: generate images in JPEG format.\n- png: generate images in PNG format." } }, { @@ -9722,6 +9865,16 @@ "comment": { "text": "Overlays are drawn in the order they appear in the array (last array\nentry is the topmost layer)." } + }, + { + "name": "\"origin-auth\"", + "type": { + "name": "\"share-publicly\"", + "optional": true + }, + "comment": { + "text": "Fetching image from authenticated origin. Setting this property will\npass authentication headers (Authorization, Cookie, etc.) through to\nthe origin." + } } ], "extends": [ @@ -11239,7 +11392,7 @@ { "name": "highWaterMark", "type": { - "name": "integer", + "name": "bigint", "optional": true } }, @@ -12533,14 +12686,338 @@ ], "kind": "class" }, - "TransformStream": { - "name": "TransformStream", + "TraceEvent": { + "name": "TraceEvent", "members": [ { - "name": "constructor", + "name": "traces", "type": { - "params": [ - { + "name": "[]", + "args": [ + { + "name": "TraceItem" + } + ] + }, + "readonly": true + } + ], + "extends": [ + { + "name": "ExtendableEvent" + } + ], + "kind": "class" + }, + "TraceException": { + "name": "TraceException", + "members": [ + { + "name": "timestamp", + "type": { + "name": "double" + }, + "readonly": true + }, + { + "name": "message", + "type": { + "name": "string" + }, + "readonly": true + }, + { + "name": "name", + "type": { + "name": "string" + }, + "readonly": true + } + ], + "kind": "class" + }, + "TraceItem": { + "name": "TraceItem", + "members": [ + { + "name": "event", + "type": { + "name": "|", + "args": [ + { + "name": "TraceItemEventInfo" + }, + { + "name": "null" + } + ] + }, + "readonly": true + }, + { + "name": "eventTimestamp", + "type": { + "name": "|", + "args": [ + { + "name": "double" + }, + { + "name": "null" + } + ] + }, + "readonly": true + }, + { + "name": "logs", + "type": { + "name": "[]", + "args": [ + { + "name": "TraceLog" + } + ] + }, + "readonly": true + }, + { + "name": "exceptions", + "type": { + "name": "[]", + "args": [ + { + "name": "TraceException" + } + ] + }, + "readonly": true + }, + { + "name": "scriptName", + "type": { + "name": "|", + "args": [ + { + "name": "string" + }, + { + "name": "null" + } + ] + }, + "readonly": true + }, + { + "name": "dispatchNamespace", + "type": { + "name": "string", + "optional": true + }, + "readonly": true + }, + { + "name": "outcome", + "type": { + "name": "string" + }, + "readonly": true + } + ], + "kind": "class" + }, + "TraceItemAlarmEventInfo": { + "name": "TraceItemAlarmEventInfo", + "members": [ + { + "name": "scheduledTime", + "type": { + "name": "Date" + }, + "readonly": true + } + ], + "kind": "class" + }, + "TraceItemEventInfo": { + "name": "TraceItemEventInfo", + "type": { + "name": "|", + "args": [ + { + "name": "TraceItemFetchEventInfo" + }, + { + "name": "TraceItemScheduledEventInfo" + }, + { + "name": "TraceItemAlarmEventInfo" + } + ] + }, + "kind": "typedef" + }, + "TraceItemFetchEventInfo": { + "name": "TraceItemFetchEventInfo", + "members": [ + { + "name": "response", + "type": { + "name": "TraceItemFetchEventInfoResponse", + "optional": true + }, + "readonly": true + }, + { + "name": "request", + "type": { + "name": "TraceItemFetchEventInfoRequest" + }, + "readonly": true + } + ], + "kind": "class" + }, + "TraceItemFetchEventInfoRequest": { + "name": "TraceItemFetchEventInfoRequest", + "members": [ + { + "name": "cf", + "type": { + "name": "Object", + "optional": true + }, + "readonly": true + }, + { + "name": "headers", + "type": { + "name": "Record", + "args": [ + { + "name": "string" + }, + { + "name": "string" + } + ] + }, + "readonly": true + }, + { + "name": "method", + "type": { + "name": "string" + }, + "readonly": true + }, + { + "name": "url", + "type": { + "name": "string" + }, + "readonly": true + }, + { + "name": "getUnredacted", + "type": { + "params": [], + "returns": { + "name": "TraceItemFetchEventInfoRequest" + } + } + } + ], + "kind": "class" + }, + "TraceItemFetchEventInfoResponse": { + "name": "TraceItemFetchEventInfoResponse", + "members": [ + { + "name": "status", + "type": { + "name": "integer" + }, + "readonly": true + } + ], + "kind": "class" + }, + "TraceItemScheduledEventInfo": { + "name": "TraceItemScheduledEventInfo", + "members": [ + { + "name": "scheduledTime", + "type": { + "name": "double" + }, + "readonly": true + }, + { + "name": "cron", + "type": { + "name": "string" + }, + "readonly": true + } + ], + "kind": "class" + }, + "TraceLog": { + "name": "TraceLog", + "members": [ + { + "name": "timestamp", + "type": { + "name": "double" + }, + "readonly": true + }, + { + "name": "level", + "type": { + "name": "string" + }, + "readonly": true + }, + { + "name": "message", + "type": { + "name": "Object" + }, + "readonly": true + } + ], + "kind": "class" + }, + "TraceMetrics": { + "name": "TraceMetrics", + "members": [ + { + "name": "cpuTime", + "type": { + "name": "integer" + }, + "readonly": true + }, + { + "name": "wallTime", + "type": { + "name": "integer" + }, + "readonly": true + } + ], + "kind": "class" + }, + "TransformStream": { + "name": "TransformStream", + "members": [ + { + "name": "constructor", + "type": { + "params": [ + { "name": "maybeTransformer", "type": { "name": "Transformer", @@ -13387,13 +13864,13 @@ } }, { - "name": "key", + "name": "value", "type": { "name": "string" } }, { - "name": "value", + "name": "key", "type": { "name": "string" } @@ -13698,6 +14175,28 @@ ], "kind": "struct" }, + "UnsafeTraceMetrics": { + "name": "UnsafeTraceMetrics", + "members": [ + { + "name": "fromTrace", + "type": { + "params": [ + { + "name": "arg4", + "type": { + "name": "TraceItem" + } + } + ], + "returns": { + "name": "TraceMetrics" + } + } + } + ], + "kind": "class" + }, "WebSocket": { "name": "WebSocket", "members": [