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

Commit c2c7c2e

Browse files
autodecl-bot[bot]vlovich
autodecl-bot[bot]
authored andcommitted
Updated types for 2022-04-27
1 parent 9bfd62f commit c2c7c2e

File tree

3 files changed

+359
-87
lines changed

3 files changed

+359
-87
lines changed

.changeset/2022-04-27.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-04-27

index.d.ts

+60-29
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ declare type BodyInitializer = BodyInit;
131131
declare class ByteLengthQueuingStrategy {
132132
constructor(init: QueuingStrategyInit);
133133
readonly highWaterMark: number;
134-
size(arg1?: any): number | undefined;
134+
size(chunk?: any): number;
135135
}
136136

137137
declare abstract class Cache {
@@ -194,7 +194,7 @@ interface Comment {
194194
}
195195

196196
declare class CompressionStream extends TransformStream {
197-
constructor(format: string);
197+
constructor(format: "gzip" | "deflate");
198198
}
199199

200200
interface Console {
@@ -214,7 +214,7 @@ interface ContentOptions {
214214
declare class CountQueuingStrategy {
215215
constructor(init: QueuingStrategyInit);
216216
readonly highWaterMark: number;
217-
size(arg1?: any): number | undefined;
217+
size(chunk?: any): number;
218218
}
219219

220220
declare abstract class Crypto {
@@ -323,7 +323,7 @@ declare class DOMException extends Error {
323323
}
324324

325325
declare class DecompressionStream extends TransformStream {
326-
constructor(format: string);
326+
constructor(format: "gzip" | "deflate");
327327
}
328328

329329
declare class DigestStream extends WritableStream {
@@ -345,6 +345,10 @@ interface DurableObject {
345345
fetch(request: Request): Promise<Response>;
346346
}
347347

348+
interface DurableObjectGetAlarmOptions {
349+
allowConcurrency?: boolean;
350+
}
351+
348352
interface DurableObjectGetOptions {
349353
allowConcurrency?: boolean;
350354
noCache?: boolean;
@@ -385,6 +389,11 @@ interface DurableObjectPutOptions {
385389
noCache?: boolean;
386390
}
387391

392+
interface DurableObjectSetAlarmOptions {
393+
allowConcurrency?: boolean;
394+
allowUnconfirmed?: boolean;
395+
}
396+
388397
interface DurableObjectState {
389398
waitUntil(promise: Promise<any>): void;
390399
readonly id: DurableObjectId | string;
@@ -419,17 +428,12 @@ interface DurableObjectStorage {
419428
transaction<T>(
420429
closure: (txn: DurableObjectTransaction) => Promise<T>
421430
): Promise<T>;
422-
getAlarm(
423-
options?: DurableObjectStorageOperationsGetAlarmOptions
424-
): Promise<Date | null>;
431+
getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
425432
setAlarm(
426-
arg2: Date,
427-
options?: DurableObjectStorageOperationsSetAlarmOptions
433+
scheduledTime: Date,
434+
options?: DurableObjectSetAlarmOptions
428435
): Promise<void>;
429-
}
430-
431-
interface DurableObjectStorageOperationsGetAlarmOptions {
432-
allowConcurrency?: boolean;
436+
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
433437
}
434438

435439
/**
@@ -451,11 +455,6 @@ declare type DurableObjectStorageOperationsListOptions =
451455
*/
452456
declare type DurableObjectStorageOperationsPutOptions = DurableObjectPutOptions;
453457

454-
interface DurableObjectStorageOperationsSetAlarmOptions {
455-
allowConcurrency?: boolean;
456-
allowUnconfirmed?: boolean;
457-
}
458-
459458
interface DurableObjectStub extends Fetcher {
460459
readonly id: DurableObjectId;
461460
readonly name?: string;
@@ -482,13 +481,12 @@ interface DurableObjectTransaction {
482481
delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
483482
delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
484483
rollback(): void;
485-
getAlarm(
486-
options?: DurableObjectStorageOperationsGetAlarmOptions
487-
): Promise<Date | null>;
484+
getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
488485
setAlarm(
489-
arg2: Date,
490-
options?: DurableObjectStorageOperationsSetAlarmOptions
486+
scheduledTime: Date,
487+
options?: DurableObjectSetAlarmOptions
491488
): Promise<void>;
489+
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
492490
}
493491

494492
interface Element {
@@ -1003,7 +1001,13 @@ interface R2Bucket {
10031001
get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;
10041002
put(
10051003
key: string,
1006-
value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null,
1004+
value:
1005+
| ReadableStream
1006+
| ArrayBuffer
1007+
| ArrayBufferView
1008+
| string
1009+
| null
1010+
| Blob,
10071011
options?: R2PutOptions
10081012
): Promise<R2Object>;
10091013
delete(key: string): Promise<void>;
@@ -1077,7 +1081,7 @@ interface R2ListOptions {
10771081
* }
10781082
* ```
10791083
*/
1080-
include: ("httpMetadata" | "customMetadata")[];
1084+
include?: ("httpMetadata" | "customMetadata")[];
10811085
}
10821086

10831087
/**
@@ -1135,12 +1139,15 @@ declare abstract class ReadableByteStreamController {
11351139
readonly byobRequest: ReadableStreamBYOBRequest | null;
11361140
readonly desiredSize: number | null;
11371141
close(): void;
1138-
enqueue(chunk: ArrayBufferView): void;
1142+
enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
11391143
error(reason: any): void;
11401144
}
11411145

11421146
declare class ReadableStream {
1143-
constructor(underlyingSource?: Object, queuingStrategy?: Object);
1147+
constructor(
1148+
underlyingSource?: UnderlyingSource,
1149+
queuingStrategy?: StreamQueuingStrategy
1150+
);
11441151
readonly locked: boolean;
11451152
cancel(reason?: any): Promise<void>;
11461153
getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
@@ -1174,7 +1181,7 @@ declare class ReadableStreamBYOBReader {
11741181
declare abstract class ReadableStreamBYOBRequest {
11751182
readonly view: Uint8Array | null;
11761183
respond(bytesWritten: number): void;
1177-
respondWithNewView(view: ArrayBufferView): void;
1184+
respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;
11781185
readonly atLeast: number | null;
11791186
}
11801187

@@ -1814,6 +1821,26 @@ declare type URLSearchParamsInit =
18141821
*/
18151822
declare type URLSearchParamsInitializer = URLSearchParamsInit;
18161823

1824+
interface UnderlyingSink {
1825+
type?: string;
1826+
start?(controller: WritableStreamDefaultController): any;
1827+
write?(chunk: any, controller: WritableStreamDefaultController): any;
1828+
abort?(reason: any): any;
1829+
close?(): any;
1830+
}
1831+
1832+
interface UnderlyingSource {
1833+
type?: string;
1834+
autoAllocateChunkSize?: number;
1835+
start?(
1836+
controller: ReadableStreamDefaultController | ReadableByteStreamController
1837+
): any;
1838+
pull?(
1839+
controller: ReadableStreamDefaultController | ReadableByteStreamController
1840+
): any;
1841+
cancel?(reason?: any): any;
1842+
}
1843+
18171844
declare class WebSocket extends EventTarget<WebSocketEventMap> {
18181845
constructor(url: string, protocols?: string[] | string);
18191846
accept(): void;
@@ -1848,7 +1875,10 @@ declare type WorkerGlobalScopeEventMap = {
18481875
};
18491876

18501877
declare class WritableStream {
1851-
constructor(underlyingSink?: Object, queuingStrategy?: Object);
1878+
constructor(
1879+
underlyingSink?: UnderlyingSink,
1880+
queuingStrategy?: StreamQueuingStrategy
1881+
);
18521882
readonly locked: boolean;
18531883
abort(reason: any): Promise<void>;
18541884
close(): Promise<void>;
@@ -1947,6 +1977,7 @@ type Params<P extends string = any> = Record<P, string | string[]>;
19471977

19481978
type EventContext<Env, P extends string, Data> = {
19491979
request: Request;
1980+
functionPath: string;
19501981
waitUntil: (promise: Promise<any>) => void;
19511982
next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
19521983
env: Env & { ASSETS: { fetch: typeof fetch } };

0 commit comments

Comments
 (0)