Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Commit fba318b

Browse files
Updated types for 2022-10-13 (#294)
* Updated types for 2022-10-13 * fix overrides for iterator * run prettier
1 parent 576062f commit fba318b

File tree

4 files changed

+694
-93
lines changed

4 files changed

+694
-93
lines changed

.changeset/fresh-feet-push.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cloudflare/workers-types": minor
3+
---
4+
5+
Updated auto-generated types @ 2022-10-13

index.d.ts

+109-21
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,14 @@ declare type CryptoKeyAlgorithmVariant =
252252
| CryptoKeyHmacKeyAlgorithm
253253
| CryptoKeyRsaKeyAlgorithm
254254
| CryptoKeyEllipticKeyAlgorithm
255-
| CryptoKeyVoprfKeyAlgorithm
256-
| CryptoKeyOprfKeyAlgorithm;
255+
| CryptoKeyArbitraryKeyAlgorithm;
256+
257+
interface CryptoKeyArbitraryKeyAlgorithm {
258+
name: string;
259+
hash?: CryptoKeyKeyAlgorithm;
260+
namedCurve?: string;
261+
length?: number;
262+
}
257263

258264
interface CryptoKeyEllipticKeyAlgorithm {
259265
name: string;
@@ -270,11 +276,6 @@ interface CryptoKeyKeyAlgorithm {
270276
name: string;
271277
}
272278

273-
interface CryptoKeyOprfKeyAlgorithm {
274-
name: string;
275-
namedCurve: string;
276-
}
277-
278279
interface CryptoKeyPair {
279280
publicKey: CryptoKey;
280281
privateKey: CryptoKey;
@@ -287,12 +288,6 @@ interface CryptoKeyRsaKeyAlgorithm {
287288
hash?: CryptoKeyKeyAlgorithm;
288289
}
289290

290-
interface CryptoKeyVoprfKeyAlgorithm {
291-
name: string;
292-
hash: CryptoKeyKeyAlgorithm;
293-
namedCurve: string;
294-
}
295-
296291
interface D1Database {
297292
prepare(query: string): D1PreparedStatement;
298293
dump(): Promise<ArrayBuffer>;
@@ -304,7 +299,7 @@ interface D1PreparedStatement {
304299
bind(...values: any[]): D1PreparedStatement;
305300
first<T = unknown>(colName?: string): Promise<T>;
306301
run<T = unknown>(): Promise<D1Result<T>>;
307-
all<T = unknown>(): Promise<D1Result<T[]>>;
302+
all<T = unknown>(): Promise<D1Result<T>>;
308303
raw<T = unknown>(): Promise<T[]>;
309304
}
310305

@@ -698,8 +693,8 @@ declare class FormData {
698693
forEach<This = unknown>(
699694
callback: (
700695
this: This,
701-
key: string,
702696
value: File | string,
697+
key: string,
703698
parent: FormData
704699
) => void,
705700
thisArg?: This
@@ -739,7 +734,7 @@ declare class Headers {
739734
append(name: string, value: string): void;
740735
delete(name: string): void;
741736
forEach<This = unknown>(
742-
callback: (this: This, key: string, value: string, parent: Headers) => void,
737+
callback: (this: This, value: string, key: string, parent: Headers) => void,
743738
thisArg?: This
744739
): void;
745740
entries(): IterableIterator<[key: string, value: string]>;
@@ -784,7 +779,7 @@ interface IncomingRequestCfProperties {
784779
botManagement?: IncomingRequestCfPropertiesBotManagement;
785780
city?: string;
786781
clientAcceptEncoding?: string;
787-
clientTcpRtt: number;
782+
clientTcpRtt?: number;
788783
clientTrustScore?: number;
789784
/**
790785
* The three-letter airport code of the data center that the request
@@ -828,6 +823,8 @@ interface IncomingRequestCfProperties {
828823
}
829824

830825
interface IncomingRequestCfPropertiesBotManagement {
826+
corporateProxy: boolean;
827+
ja3Hash?: string;
831828
score: number;
832829
staticResource: boolean;
833830
verifiedBot: boolean;
@@ -1067,10 +1064,21 @@ interface R2Bucket {
10671064
| Blob,
10681065
options?: R2PutOptions
10691066
): Promise<R2Object>;
1070-
delete(key: string): Promise<void>;
1067+
delete(keys: string | string[]): Promise<void>;
10711068
list(options?: R2ListOptions): Promise<R2Objects>;
10721069
}
10731070

1071+
/**
1072+
* The checksums associated with the object.
1073+
*/
1074+
interface R2Checksums {
1075+
md5?: ArrayBuffer;
1076+
sha1?: ArrayBuffer;
1077+
sha256?: ArrayBuffer;
1078+
sha384?: ArrayBuffer;
1079+
sha512?: ArrayBuffer;
1080+
}
1081+
10741082
/**
10751083
* Perform the operation conditionally based on meeting the defined criteria.
10761084
*/
@@ -1141,6 +1149,7 @@ declare abstract class R2Object {
11411149
readonly size: number;
11421150
readonly etag: string;
11431151
readonly httpEtag: string;
1152+
readonly checksums: R2Checksums;
11441153
readonly uploaded: Date;
11451154
readonly httpMetadata?: R2HTTPMetadata;
11461155
readonly customMetadata?: Record<string, string>;
@@ -1168,9 +1177,14 @@ interface R2Objects {
11681177
}
11691178

11701179
interface R2PutOptions {
1180+
onlyIf?: R2Conditional | Headers;
11711181
httpMetadata?: R2HTTPMetadata | Headers;
11721182
customMetadata?: Record<string, string>;
11731183
md5?: ArrayBuffer | string;
1184+
sha1?: ArrayBuffer | string;
1185+
sha256?: ArrayBuffer | string;
1186+
sha384?: ArrayBuffer | string;
1187+
sha512?: ArrayBuffer | string;
11741188
}
11751189

11761190
declare type R2Range =
@@ -1404,8 +1418,10 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
14041418
* - json: instead of generating an image, outputs information about the
14051419
* image, in JSON format. The JSON object will contain image size
14061420
* (before and after resizing), source image’s MIME type, file size, etc.
1421+
* - jpeg: generate images in JPEG format.
1422+
* - png: generate images in PNG format.
14071423
*/
1408-
format?: "avif" | "webp" | "json";
1424+
format?: "avif" | "webp" | "json" | "jpeg" | "png";
14091425
/**
14101426
* Whether to preserve animation frames from input files. Default is true.
14111427
* Setting it to false reduces animations to still images. This setting is
@@ -1445,6 +1461,12 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
14451461
* entry is the topmost layer).
14461462
*/
14471463
draw?: RequestInitCfPropertiesImageDraw[];
1464+
/**
1465+
* Fetching image from authenticated origin. Setting this property will
1466+
* pass authentication headers (Authorization, Cookie, etc.) through to
1467+
* the origin.
1468+
*/
1469+
"origin-auth"?: "share-publicly";
14481470
}
14491471

14501472
interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
@@ -1593,7 +1615,7 @@ interface ServiceWorkerGlobalScopeStructuredCloneOptions {
15931615
declare type StreamPipeOptions = PipeToOptions;
15941616

15951617
interface StreamQueuingStrategy {
1596-
highWaterMark?: number;
1618+
highWaterMark?: bigint;
15971619
size(chunk: any): number;
15981620
}
15991621

@@ -1785,6 +1807,68 @@ declare class TextEncoderStream extends TransformStream {
17851807
constructor();
17861808
}
17871809

1810+
interface TraceEvent extends ExtendableEvent {
1811+
readonly traces: TraceItem[];
1812+
}
1813+
1814+
interface TraceException {
1815+
readonly timestamp: number;
1816+
readonly message: string;
1817+
readonly name: string;
1818+
}
1819+
1820+
interface TraceItem {
1821+
readonly event: TraceItemEventInfo | null;
1822+
readonly eventTimestamp: number | null;
1823+
readonly logs: TraceLog[];
1824+
readonly exceptions: TraceException[];
1825+
readonly scriptName: string | null;
1826+
readonly dispatchNamespace?: string;
1827+
readonly outcome: string;
1828+
}
1829+
1830+
interface TraceItemAlarmEventInfo {
1831+
readonly scheduledTime: Date;
1832+
}
1833+
1834+
declare type TraceItemEventInfo =
1835+
| TraceItemFetchEventInfo
1836+
| TraceItemScheduledEventInfo
1837+
| TraceItemAlarmEventInfo;
1838+
1839+
interface TraceItemFetchEventInfo {
1840+
readonly response?: TraceItemFetchEventInfoResponse;
1841+
readonly request: TraceItemFetchEventInfoRequest;
1842+
}
1843+
1844+
interface TraceItemFetchEventInfoRequest {
1845+
readonly cf?: Object;
1846+
readonly headers: Record<string, string>;
1847+
readonly method: string;
1848+
readonly url: string;
1849+
getUnredacted(): TraceItemFetchEventInfoRequest;
1850+
}
1851+
1852+
interface TraceItemFetchEventInfoResponse {
1853+
readonly status: number;
1854+
}
1855+
1856+
interface TraceItemScheduledEventInfo {
1857+
readonly scheduledTime: number;
1858+
readonly cron: string;
1859+
}
1860+
1861+
interface TraceLog {
1862+
readonly timestamp: number;
1863+
readonly level: string;
1864+
readonly message: Object;
1865+
}
1866+
1867+
interface TraceMetrics {
1868+
readonly cpuTime: number;
1869+
readonly wallTime: number;
1870+
}
1871+
17881872
declare class TransformStream {
17891873
constructor(
17901874
maybeTransformer?: Transformer,
@@ -1889,8 +1973,8 @@ declare class URLSearchParams {
18891973
forEach<This = unknown>(
18901974
callback: (
18911975
this: This,
1892-
key: string,
18931976
value: string,
1977+
key: string,
18941978
parent: URLSearchParams
18951979
) => void,
18961980
thisArg?: This
@@ -1933,6 +2017,10 @@ interface UnderlyingSource {
19332017
cancel?(reason?: any): any;
19342018
}
19352019

2020+
interface UnsafeTraceMetrics {
2021+
fromTrace(arg4: TraceItem): TraceMetrics;
2022+
}
2023+
19362024
declare class WebSocket extends EventTarget<WebSocketEventMap> {
19372025
constructor(url: string, protocols?: string[] | string);
19382026
accept(): void;

overrides/http.d.ts

+9
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ declare class FormData {
1212
entries(): IterableIterator<[key: string, value: File | string]>;
1313
[Symbol.iterator](): IterableIterator<[key: string, value: File | string]>;
1414

15+
keys(): IterableIterator<string>;
16+
values(): IterableIterator<string | File>;
17+
1518
forEach<This = unknown>(
1619
callback: (
1720
this: This,
@@ -27,6 +30,9 @@ declare class Headers {
2730
entries(): IterableIterator<[key: string, value: string]>;
2831
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
2932

33+
keys(): IterableIterator<string>;
34+
values(): IterableIterator<string>;
35+
3036
forEach<This = unknown>(
3137
callback: (this: This, value: string, key: string, parent: Headers) => void,
3238
thisArg?: This
@@ -44,6 +50,9 @@ declare class URLSearchParams {
4450
entries(): IterableIterator<[key: string, value: string]>;
4551
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
4652

53+
keys(): IterableIterator<string>;
54+
values(): IterableIterator<string>;
55+
4756
forEach<This = unknown>(
4857
callback: (
4958
this: This,

0 commit comments

Comments
 (0)