@cloudflare/workers-types 3.7.1 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +72 -37
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -131,7 +131,7 @@ declare type BodyInitializer = BodyInit;
|
|
|
131
131
|
declare class ByteLengthQueuingStrategy {
|
|
132
132
|
constructor(init: QueuingStrategyInit);
|
|
133
133
|
readonly highWaterMark: number;
|
|
134
|
-
size(
|
|
134
|
+
size(chunk?: any): number;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
declare abstract class Cache {
|
|
@@ -194,7 +194,7 @@ interface Comment {
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
declare class CompressionStream extends TransformStream {
|
|
197
|
-
constructor(format:
|
|
197
|
+
constructor(format: "gzip" | "deflate");
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
interface Console {
|
|
@@ -214,7 +214,7 @@ interface ContentOptions {
|
|
|
214
214
|
declare class CountQueuingStrategy {
|
|
215
215
|
constructor(init: QueuingStrategyInit);
|
|
216
216
|
readonly highWaterMark: number;
|
|
217
|
-
size(
|
|
217
|
+
size(chunk?: any): number;
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
declare abstract class Crypto {
|
|
@@ -231,6 +231,7 @@ declare abstract class Crypto {
|
|
|
231
231
|
| BigUint64Array
|
|
232
232
|
>(buffer: T): T;
|
|
233
233
|
randomUUID(): string;
|
|
234
|
+
DigestStream: typeof DigestStream;
|
|
234
235
|
}
|
|
235
236
|
|
|
236
237
|
declare abstract class CryptoKey {
|
|
@@ -323,7 +324,7 @@ declare class DOMException extends Error {
|
|
|
323
324
|
}
|
|
324
325
|
|
|
325
326
|
declare class DecompressionStream extends TransformStream {
|
|
326
|
-
constructor(format:
|
|
327
|
+
constructor(format: "gzip" | "deflate");
|
|
327
328
|
}
|
|
328
329
|
|
|
329
330
|
declare class DigestStream extends WritableStream {
|
|
@@ -345,6 +346,10 @@ interface DurableObject {
|
|
|
345
346
|
fetch(request: Request): Promise<Response>;
|
|
346
347
|
}
|
|
347
348
|
|
|
349
|
+
interface DurableObjectGetAlarmOptions {
|
|
350
|
+
allowConcurrency?: boolean;
|
|
351
|
+
}
|
|
352
|
+
|
|
348
353
|
interface DurableObjectGetOptions {
|
|
349
354
|
allowConcurrency?: boolean;
|
|
350
355
|
noCache?: boolean;
|
|
@@ -385,6 +390,11 @@ interface DurableObjectPutOptions {
|
|
|
385
390
|
noCache?: boolean;
|
|
386
391
|
}
|
|
387
392
|
|
|
393
|
+
interface DurableObjectSetAlarmOptions {
|
|
394
|
+
allowConcurrency?: boolean;
|
|
395
|
+
allowUnconfirmed?: boolean;
|
|
396
|
+
}
|
|
397
|
+
|
|
388
398
|
interface DurableObjectState {
|
|
389
399
|
waitUntil(promise: Promise<any>): void;
|
|
390
400
|
readonly id: DurableObjectId | string;
|
|
@@ -419,17 +429,12 @@ interface DurableObjectStorage {
|
|
|
419
429
|
transaction<T>(
|
|
420
430
|
closure: (txn: DurableObjectTransaction) => Promise<T>
|
|
421
431
|
): Promise<T>;
|
|
422
|
-
getAlarm(
|
|
423
|
-
options?: DurableObjectStorageOperationsGetAlarmOptions
|
|
424
|
-
): Promise<Date | null>;
|
|
432
|
+
getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
|
|
425
433
|
setAlarm(
|
|
426
|
-
|
|
427
|
-
options?:
|
|
434
|
+
scheduledTime: number | Date,
|
|
435
|
+
options?: DurableObjectSetAlarmOptions
|
|
428
436
|
): Promise<void>;
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
interface DurableObjectStorageOperationsGetAlarmOptions {
|
|
432
|
-
allowConcurrency?: boolean;
|
|
437
|
+
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
433
438
|
}
|
|
434
439
|
|
|
435
440
|
/**
|
|
@@ -451,11 +456,6 @@ declare type DurableObjectStorageOperationsListOptions =
|
|
|
451
456
|
*/
|
|
452
457
|
declare type DurableObjectStorageOperationsPutOptions = DurableObjectPutOptions;
|
|
453
458
|
|
|
454
|
-
interface DurableObjectStorageOperationsSetAlarmOptions {
|
|
455
|
-
allowConcurrency?: boolean;
|
|
456
|
-
allowUnconfirmed?: boolean;
|
|
457
|
-
}
|
|
458
|
-
|
|
459
459
|
interface DurableObjectStub extends Fetcher {
|
|
460
460
|
readonly id: DurableObjectId;
|
|
461
461
|
readonly name?: string;
|
|
@@ -482,13 +482,12 @@ interface DurableObjectTransaction {
|
|
|
482
482
|
delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
|
|
483
483
|
delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
|
|
484
484
|
rollback(): void;
|
|
485
|
-
getAlarm(
|
|
486
|
-
options?: DurableObjectStorageOperationsGetAlarmOptions
|
|
487
|
-
): Promise<Date | null>;
|
|
485
|
+
getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
|
|
488
486
|
setAlarm(
|
|
489
|
-
|
|
490
|
-
options?:
|
|
487
|
+
scheduledTime: number | Date,
|
|
488
|
+
options?: DurableObjectSetAlarmOptions
|
|
491
489
|
): Promise<void>;
|
|
490
|
+
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
492
491
|
}
|
|
493
492
|
|
|
494
493
|
interface Element {
|
|
@@ -618,11 +617,15 @@ declare type ExportedHandlerScheduledHandler<Env = unknown> = (
|
|
|
618
617
|
ctx: ExecutionContext
|
|
619
618
|
) => void | Promise<void>;
|
|
620
619
|
|
|
621
|
-
declare
|
|
620
|
+
declare class ExtendableEvent extends Event {
|
|
621
|
+
constructor(type: string, init?: EventInit);
|
|
622
|
+
waitUntil(promise: Promise<any>): void;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
declare abstract class FetchEvent extends ExtendableEvent {
|
|
622
626
|
readonly request: Request;
|
|
623
627
|
respondWith(promise: Response | Promise<Response>): void;
|
|
624
628
|
passThroughOnException(): void;
|
|
625
|
-
waitUntil(promise: Promise<any>): void;
|
|
626
629
|
}
|
|
627
630
|
|
|
628
631
|
declare abstract class Fetcher {
|
|
@@ -1003,7 +1006,13 @@ interface R2Bucket {
|
|
|
1003
1006
|
get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;
|
|
1004
1007
|
put(
|
|
1005
1008
|
key: string,
|
|
1006
|
-
value:
|
|
1009
|
+
value:
|
|
1010
|
+
| ReadableStream
|
|
1011
|
+
| ArrayBuffer
|
|
1012
|
+
| ArrayBufferView
|
|
1013
|
+
| string
|
|
1014
|
+
| null
|
|
1015
|
+
| Blob,
|
|
1007
1016
|
options?: R2PutOptions
|
|
1008
1017
|
): Promise<R2Object>;
|
|
1009
1018
|
delete(key: string): Promise<void>;
|
|
@@ -1020,10 +1029,6 @@ interface R2Conditional {
|
|
|
1020
1029
|
uploadedAfter?: Date;
|
|
1021
1030
|
}
|
|
1022
1031
|
|
|
1023
|
-
interface R2Error {
|
|
1024
|
-
readonly stack: string;
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
1032
|
/**
|
|
1028
1033
|
* Options for retrieving the object metadata nad payload.
|
|
1029
1034
|
*/
|
|
@@ -1077,7 +1082,7 @@ interface R2ListOptions {
|
|
|
1077
1082
|
* }
|
|
1078
1083
|
* ```
|
|
1079
1084
|
*/
|
|
1080
|
-
include
|
|
1085
|
+
include?: ("httpMetadata" | "customMetadata")[];
|
|
1081
1086
|
}
|
|
1082
1087
|
|
|
1083
1088
|
/**
|
|
@@ -1135,12 +1140,15 @@ declare abstract class ReadableByteStreamController {
|
|
|
1135
1140
|
readonly byobRequest: ReadableStreamBYOBRequest | null;
|
|
1136
1141
|
readonly desiredSize: number | null;
|
|
1137
1142
|
close(): void;
|
|
1138
|
-
enqueue(chunk: ArrayBufferView): void;
|
|
1143
|
+
enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
|
|
1139
1144
|
error(reason: any): void;
|
|
1140
1145
|
}
|
|
1141
1146
|
|
|
1142
1147
|
declare class ReadableStream {
|
|
1143
|
-
constructor(
|
|
1148
|
+
constructor(
|
|
1149
|
+
underlyingSource?: UnderlyingSource,
|
|
1150
|
+
queuingStrategy?: StreamQueuingStrategy
|
|
1151
|
+
);
|
|
1144
1152
|
readonly locked: boolean;
|
|
1145
1153
|
cancel(reason?: any): Promise<void>;
|
|
1146
1154
|
getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
|
|
@@ -1174,7 +1182,7 @@ declare class ReadableStreamBYOBReader {
|
|
|
1174
1182
|
declare abstract class ReadableStreamBYOBRequest {
|
|
1175
1183
|
readonly view: Uint8Array | null;
|
|
1176
1184
|
respond(bytesWritten: number): void;
|
|
1177
|
-
respondWithNewView(view: ArrayBufferView): void;
|
|
1185
|
+
respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;
|
|
1178
1186
|
readonly atLeast: number | null;
|
|
1179
1187
|
}
|
|
1180
1188
|
|
|
@@ -1474,11 +1482,10 @@ interface ScheduledController {
|
|
|
1474
1482
|
noRetry(): void;
|
|
1475
1483
|
}
|
|
1476
1484
|
|
|
1477
|
-
declare abstract class ScheduledEvent extends
|
|
1485
|
+
declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1478
1486
|
readonly scheduledTime: number;
|
|
1479
1487
|
readonly cron: string;
|
|
1480
1488
|
noRetry(): void;
|
|
1481
|
-
waitUntil(promise: Promise<any>): void;
|
|
1482
1489
|
}
|
|
1483
1490
|
|
|
1484
1491
|
interface Scheduler {
|
|
@@ -1814,6 +1821,26 @@ declare type URLSearchParamsInit =
|
|
|
1814
1821
|
*/
|
|
1815
1822
|
declare type URLSearchParamsInitializer = URLSearchParamsInit;
|
|
1816
1823
|
|
|
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
|
+
|
|
1817
1844
|
declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
1818
1845
|
constructor(url: string, protocols?: string[] | string);
|
|
1819
1846
|
accept(): void;
|
|
@@ -1848,7 +1875,10 @@ declare type WorkerGlobalScopeEventMap = {
|
|
|
1848
1875
|
};
|
|
1849
1876
|
|
|
1850
1877
|
declare class WritableStream {
|
|
1851
|
-
constructor(
|
|
1878
|
+
constructor(
|
|
1879
|
+
underlyingSink?: UnderlyingSink,
|
|
1880
|
+
queuingStrategy?: StreamQueuingStrategy
|
|
1881
|
+
);
|
|
1852
1882
|
readonly locked: boolean;
|
|
1853
1883
|
abort(reason: any): Promise<void>;
|
|
1854
1884
|
close(): Promise<void>;
|
|
@@ -1947,6 +1977,7 @@ type Params<P extends string = any> = Record<P, string | string[]>;
|
|
|
1947
1977
|
|
|
1948
1978
|
type EventContext<Env, P extends string, Data> = {
|
|
1949
1979
|
request: Request;
|
|
1980
|
+
functionPath: string;
|
|
1950
1981
|
waitUntil: (promise: Promise<any>) => void;
|
|
1951
1982
|
next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
|
|
1952
1983
|
env: Env & { ASSETS: { fetch: typeof fetch } };
|
|
@@ -1979,3 +2010,7 @@ declare type PagesPluginFunction<
|
|
|
1979
2010
|
> = (
|
|
1980
2011
|
context: EventPluginContext<Env, Params, Data, PluginArgs>
|
|
1981
2012
|
) => Response | Promise<Response>;
|
|
2013
|
+
|
|
2014
|
+
declare module "assets:*" {
|
|
2015
|
+
export const onRequest: PagesFunction;
|
|
2016
|
+
}
|