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

Commit

Permalink
Updated types for 2022-04-27
Browse files Browse the repository at this point in the history
  • Loading branch information
autodecl-bot[bot] authored and vlovich committed Apr 28, 2022
1 parent 9bfd62f commit c2c7c2e
Show file tree
Hide file tree
Showing 3 changed files with 359 additions and 87 deletions.
5 changes: 5 additions & 0 deletions .changeset/2022-04-27.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cloudflare/workers-types": minor
---

Updated auto-generated types @ 2022-04-27
89 changes: 60 additions & 29 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ declare type BodyInitializer = BodyInit;
declare class ByteLengthQueuingStrategy {
constructor(init: QueuingStrategyInit);
readonly highWaterMark: number;
size(arg1?: any): number | undefined;
size(chunk?: any): number;
}

declare abstract class Cache {
Expand Down Expand Up @@ -194,7 +194,7 @@ interface Comment {
}

declare class CompressionStream extends TransformStream {
constructor(format: string);
constructor(format: "gzip" | "deflate");
}

interface Console {
Expand All @@ -214,7 +214,7 @@ interface ContentOptions {
declare class CountQueuingStrategy {
constructor(init: QueuingStrategyInit);
readonly highWaterMark: number;
size(arg1?: any): number | undefined;
size(chunk?: any): number;
}

declare abstract class Crypto {
Expand Down Expand Up @@ -323,7 +323,7 @@ declare class DOMException extends Error {
}

declare class DecompressionStream extends TransformStream {
constructor(format: string);
constructor(format: "gzip" | "deflate");
}

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

interface DurableObjectGetAlarmOptions {
allowConcurrency?: boolean;
}

interface DurableObjectGetOptions {
allowConcurrency?: boolean;
noCache?: boolean;
Expand Down Expand Up @@ -385,6 +389,11 @@ interface DurableObjectPutOptions {
noCache?: boolean;
}

interface DurableObjectSetAlarmOptions {
allowConcurrency?: boolean;
allowUnconfirmed?: boolean;
}

interface DurableObjectState {
waitUntil(promise: Promise<any>): void;
readonly id: DurableObjectId | string;
Expand Down Expand Up @@ -419,17 +428,12 @@ interface DurableObjectStorage {
transaction<T>(
closure: (txn: DurableObjectTransaction) => Promise<T>
): Promise<T>;
getAlarm(
options?: DurableObjectStorageOperationsGetAlarmOptions
): Promise<Date | null>;
getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
setAlarm(
arg2: Date,
options?: DurableObjectStorageOperationsSetAlarmOptions
scheduledTime: Date,
options?: DurableObjectSetAlarmOptions
): Promise<void>;
}

interface DurableObjectStorageOperationsGetAlarmOptions {
allowConcurrency?: boolean;
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
}

/**
Expand All @@ -451,11 +455,6 @@ declare type DurableObjectStorageOperationsListOptions =
*/
declare type DurableObjectStorageOperationsPutOptions = DurableObjectPutOptions;

interface DurableObjectStorageOperationsSetAlarmOptions {
allowConcurrency?: boolean;
allowUnconfirmed?: boolean;
}

interface DurableObjectStub extends Fetcher {
readonly id: DurableObjectId;
readonly name?: string;
Expand All @@ -482,13 +481,12 @@ interface DurableObjectTransaction {
delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
rollback(): void;
getAlarm(
options?: DurableObjectStorageOperationsGetAlarmOptions
): Promise<Date | null>;
getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
setAlarm(
arg2: Date,
options?: DurableObjectStorageOperationsSetAlarmOptions
scheduledTime: Date,
options?: DurableObjectSetAlarmOptions
): Promise<void>;
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
}

interface Element {
Expand Down Expand Up @@ -1003,7 +1001,13 @@ interface R2Bucket {
get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;
put(
key: string,
value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null,
value:
| ReadableStream
| ArrayBuffer
| ArrayBufferView
| string
| null
| Blob,
options?: R2PutOptions
): Promise<R2Object>;
delete(key: string): Promise<void>;
Expand Down Expand Up @@ -1077,7 +1081,7 @@ interface R2ListOptions {
* }
* ```
*/
include: ("httpMetadata" | "customMetadata")[];
include?: ("httpMetadata" | "customMetadata")[];
}

/**
Expand Down Expand Up @@ -1135,12 +1139,15 @@ declare abstract class ReadableByteStreamController {
readonly byobRequest: ReadableStreamBYOBRequest | null;
readonly desiredSize: number | null;
close(): void;
enqueue(chunk: ArrayBufferView): void;
enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
error(reason: any): void;
}

declare class ReadableStream {
constructor(underlyingSource?: Object, queuingStrategy?: Object);
constructor(
underlyingSource?: UnderlyingSource,
queuingStrategy?: StreamQueuingStrategy
);
readonly locked: boolean;
cancel(reason?: any): Promise<void>;
getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
Expand Down Expand Up @@ -1174,7 +1181,7 @@ declare class ReadableStreamBYOBReader {
declare abstract class ReadableStreamBYOBRequest {
readonly view: Uint8Array | null;
respond(bytesWritten: number): void;
respondWithNewView(view: ArrayBufferView): void;
respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;
readonly atLeast: number | null;
}

Expand Down Expand Up @@ -1814,6 +1821,26 @@ declare type URLSearchParamsInit =
*/
declare type URLSearchParamsInitializer = URLSearchParamsInit;

interface UnderlyingSink {
type?: string;
start?(controller: WritableStreamDefaultController): any;
write?(chunk: any, controller: WritableStreamDefaultController): any;
abort?(reason: any): any;
close?(): any;
}

interface UnderlyingSource {
type?: string;
autoAllocateChunkSize?: number;
start?(
controller: ReadableStreamDefaultController | ReadableByteStreamController
): any;
pull?(
controller: ReadableStreamDefaultController | ReadableByteStreamController
): any;
cancel?(reason?: any): any;
}

declare class WebSocket extends EventTarget<WebSocketEventMap> {
constructor(url: string, protocols?: string[] | string);
accept(): void;
Expand Down Expand Up @@ -1848,7 +1875,10 @@ declare type WorkerGlobalScopeEventMap = {
};

declare class WritableStream {
constructor(underlyingSink?: Object, queuingStrategy?: Object);
constructor(
underlyingSink?: UnderlyingSink,
queuingStrategy?: StreamQueuingStrategy
);
readonly locked: boolean;
abort(reason: any): Promise<void>;
close(): Promise<void>;
Expand Down Expand Up @@ -1947,6 +1977,7 @@ type Params<P extends string = any> = Record<P, string | string[]>;

type EventContext<Env, P extends string, Data> = {
request: Request;
functionPath: string;
waitUntil: (promise: Promise<any>) => void;
next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
env: Env & { ASSETS: { fetch: typeof fetch } };
Expand Down
Loading

0 comments on commit c2c7c2e

Please sign in to comment.