@cloudflare/workers-types 3.3.0 → 3.5.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 +667 -120
- package/package.json +8 -4
package/index.d.ts
CHANGED
|
@@ -62,7 +62,14 @@ interface BasicImageTransformations {
|
|
|
62
62
|
* preserve as much as possible around a point at 20% of the height of the
|
|
63
63
|
* source image.
|
|
64
64
|
*/
|
|
65
|
-
gravity?:
|
|
65
|
+
gravity?:
|
|
66
|
+
| "left"
|
|
67
|
+
| "right"
|
|
68
|
+
| "top"
|
|
69
|
+
| "bottom"
|
|
70
|
+
| "center"
|
|
71
|
+
| "auto"
|
|
72
|
+
| BasicImageTransformationsGravityCoordinates;
|
|
66
73
|
/**
|
|
67
74
|
* Background color to add underneath the image. Applies only to images with
|
|
68
75
|
* transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),
|
|
@@ -107,7 +114,13 @@ declare abstract class Body {
|
|
|
107
114
|
blob(): Promise<Blob>;
|
|
108
115
|
}
|
|
109
116
|
|
|
110
|
-
declare type BodyInit =
|
|
117
|
+
declare type BodyInit =
|
|
118
|
+
| ReadableStream
|
|
119
|
+
| string
|
|
120
|
+
| ArrayBuffer
|
|
121
|
+
| Blob
|
|
122
|
+
| URLSearchParams
|
|
123
|
+
| FormData;
|
|
111
124
|
|
|
112
125
|
/**
|
|
113
126
|
* Back compat for code migrating to older definitions.
|
|
@@ -115,9 +128,21 @@ declare type BodyInit = ReadableStream | string | ArrayBuffer | Blob | URLSearch
|
|
|
115
128
|
*/
|
|
116
129
|
declare type BodyInitializer = BodyInit;
|
|
117
130
|
|
|
131
|
+
declare class ByteLengthQueuingStrategy {
|
|
132
|
+
constructor(init: QueuingStrategyInit);
|
|
133
|
+
readonly highWaterMark: number;
|
|
134
|
+
size(arg1?: any): number | undefined;
|
|
135
|
+
}
|
|
136
|
+
|
|
118
137
|
declare abstract class Cache {
|
|
119
|
-
delete(
|
|
120
|
-
|
|
138
|
+
delete(
|
|
139
|
+
request: Request | string,
|
|
140
|
+
options?: CacheQueryOptions
|
|
141
|
+
): Promise<boolean>;
|
|
142
|
+
match(
|
|
143
|
+
request: Request | string,
|
|
144
|
+
options?: CacheQueryOptions
|
|
145
|
+
): Promise<Response | undefined>;
|
|
121
146
|
put(request: Request | string, response: Response): Promise<void>;
|
|
122
147
|
}
|
|
123
148
|
|
|
@@ -168,6 +193,10 @@ interface Comment {
|
|
|
168
193
|
remove(): Comment;
|
|
169
194
|
}
|
|
170
195
|
|
|
196
|
+
declare class CompressionStream extends TransformStream {
|
|
197
|
+
constructor(format: string);
|
|
198
|
+
}
|
|
199
|
+
|
|
171
200
|
interface Console {
|
|
172
201
|
debug(...data: any[]): void;
|
|
173
202
|
error(...data: any[]): void;
|
|
@@ -182,9 +211,25 @@ interface ContentOptions {
|
|
|
182
211
|
html?: boolean;
|
|
183
212
|
}
|
|
184
213
|
|
|
214
|
+
declare class CountQueuingStrategy {
|
|
215
|
+
constructor(init: QueuingStrategyInit);
|
|
216
|
+
readonly highWaterMark: number;
|
|
217
|
+
size(arg1?: any): number | undefined;
|
|
218
|
+
}
|
|
219
|
+
|
|
185
220
|
declare abstract class Crypto {
|
|
186
221
|
readonly subtle: SubtleCrypto;
|
|
187
|
-
getRandomValues<
|
|
222
|
+
getRandomValues<
|
|
223
|
+
T extends
|
|
224
|
+
| Int8Array
|
|
225
|
+
| Uint8Array
|
|
226
|
+
| Int16Array
|
|
227
|
+
| Uint16Array
|
|
228
|
+
| Int32Array
|
|
229
|
+
| Uint32Array
|
|
230
|
+
| BigInt64Array
|
|
231
|
+
| BigUint64Array
|
|
232
|
+
>(buffer: T): T;
|
|
188
233
|
randomUUID(): string;
|
|
189
234
|
}
|
|
190
235
|
|
|
@@ -200,7 +245,14 @@ interface CryptoKeyAesKeyAlgorithm {
|
|
|
200
245
|
length: number;
|
|
201
246
|
}
|
|
202
247
|
|
|
203
|
-
declare type CryptoKeyAlgorithmVariant =
|
|
248
|
+
declare type CryptoKeyAlgorithmVariant =
|
|
249
|
+
| CryptoKeyKeyAlgorithm
|
|
250
|
+
| CryptoKeyAesKeyAlgorithm
|
|
251
|
+
| CryptoKeyHmacKeyAlgorithm
|
|
252
|
+
| CryptoKeyRsaKeyAlgorithm
|
|
253
|
+
| CryptoKeyEllipticKeyAlgorithm
|
|
254
|
+
| CryptoKeyVoprfKeyAlgorithm
|
|
255
|
+
| CryptoKeyOprfKeyAlgorithm;
|
|
204
256
|
|
|
205
257
|
interface CryptoKeyEllipticKeyAlgorithm {
|
|
206
258
|
name: string;
|
|
@@ -270,6 +322,10 @@ declare class DOMException extends Error {
|
|
|
270
322
|
static readonly DATA_CLONE_ERR: number;
|
|
271
323
|
}
|
|
272
324
|
|
|
325
|
+
declare class DecompressionStream extends TransformStream {
|
|
326
|
+
constructor(format: string);
|
|
327
|
+
}
|
|
328
|
+
|
|
273
329
|
declare class DigestStream extends WritableStream {
|
|
274
330
|
constructor(algorithm: string | SubtleCryptoHashAlgorithm);
|
|
275
331
|
readonly digest: Promise<ArrayBuffer>;
|
|
@@ -289,6 +345,10 @@ interface DurableObject {
|
|
|
289
345
|
fetch(request: Request): Promise<Response>;
|
|
290
346
|
}
|
|
291
347
|
|
|
348
|
+
interface DurableObjectGetAlarmOptions {
|
|
349
|
+
allowConcurrency?: boolean;
|
|
350
|
+
}
|
|
351
|
+
|
|
292
352
|
interface DurableObjectGetOptions {
|
|
293
353
|
allowConcurrency?: boolean;
|
|
294
354
|
noCache?: boolean;
|
|
@@ -311,7 +371,9 @@ interface DurableObjectListOptions {
|
|
|
311
371
|
}
|
|
312
372
|
|
|
313
373
|
interface DurableObjectNamespace {
|
|
314
|
-
newUniqueId(
|
|
374
|
+
newUniqueId(
|
|
375
|
+
options?: DurableObjectNamespaceNewUniqueIdOptions
|
|
376
|
+
): DurableObjectId;
|
|
315
377
|
idFromName(name: string): DurableObjectId;
|
|
316
378
|
idFromString(id: string): DurableObjectId;
|
|
317
379
|
get(id: DurableObjectId): DurableObjectStub;
|
|
@@ -327,6 +389,11 @@ interface DurableObjectPutOptions {
|
|
|
327
389
|
noCache?: boolean;
|
|
328
390
|
}
|
|
329
391
|
|
|
392
|
+
interface DurableObjectSetAlarmOptions {
|
|
393
|
+
allowConcurrency?: boolean;
|
|
394
|
+
allowUnconfirmed?: boolean;
|
|
395
|
+
}
|
|
396
|
+
|
|
330
397
|
interface DurableObjectState {
|
|
331
398
|
waitUntil(promise: Promise<any>): void;
|
|
332
399
|
readonly id: DurableObjectId | string;
|
|
@@ -335,32 +402,52 @@ interface DurableObjectState {
|
|
|
335
402
|
}
|
|
336
403
|
|
|
337
404
|
interface DurableObjectStorage {
|
|
338
|
-
get<T = unknown>(
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
405
|
+
get<T = unknown>(
|
|
406
|
+
key: string,
|
|
407
|
+
options?: DurableObjectGetOptions
|
|
408
|
+
): Promise<T | undefined>;
|
|
409
|
+
get<T = unknown>(
|
|
410
|
+
keys: string[],
|
|
411
|
+
options?: DurableObjectGetOptions
|
|
412
|
+
): Promise<Map<string, T>>;
|
|
413
|
+
list<T = unknown>(
|
|
414
|
+
options?: DurableObjectListOptions
|
|
415
|
+
): Promise<Map<string, T>>;
|
|
416
|
+
put<T>(
|
|
417
|
+
key: string,
|
|
418
|
+
value: T,
|
|
419
|
+
options?: DurableObjectPutOptions
|
|
420
|
+
): Promise<void>;
|
|
421
|
+
put<T>(
|
|
422
|
+
entries: Record<string, T>,
|
|
423
|
+
options?: DurableObjectPutOptions
|
|
424
|
+
): Promise<void>;
|
|
343
425
|
delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
|
|
344
426
|
delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
|
|
345
427
|
deleteAll(options?: DurableObjectPutOptions): Promise<void>;
|
|
346
|
-
transaction<T>(
|
|
428
|
+
transaction<T>(
|
|
429
|
+
closure: (txn: DurableObjectTransaction) => Promise<T>
|
|
430
|
+
): Promise<T>;
|
|
431
|
+
getAlarm(options?: DurableObjectGetAlarmOptions): Promise<Date | null>;
|
|
432
|
+
setAlarm(arg2: Date, options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
347
433
|
}
|
|
348
434
|
|
|
349
435
|
/**
|
|
350
|
-
*
|
|
351
|
-
* @deprecated Don't use. Introduced incidentally in 3.x. Scheduled for removal.
|
|
436
|
+
*
|
|
437
|
+
* @deprecated Don't use. Introduced incidentally in workers-types 3.x. Scheduled for removal.
|
|
352
438
|
*/
|
|
353
439
|
declare type DurableObjectStorageOperationsGetOptions = DurableObjectGetOptions;
|
|
354
440
|
|
|
355
441
|
/**
|
|
356
|
-
*
|
|
357
|
-
* @deprecated Don't use. Introduced incidentally in 3.x. Scheduled for removal.
|
|
442
|
+
*
|
|
443
|
+
* @deprecated Don't use. Introduced incidentally in workers-types 3.x. Scheduled for removal.
|
|
358
444
|
*/
|
|
359
|
-
declare type DurableObjectStorageOperationsListOptions =
|
|
445
|
+
declare type DurableObjectStorageOperationsListOptions =
|
|
446
|
+
DurableObjectListOptions;
|
|
360
447
|
|
|
361
448
|
/**
|
|
362
|
-
*
|
|
363
|
-
* @deprecated Don't use. Introduced incidentally in 3.x. Scheduled for removal.
|
|
449
|
+
*
|
|
450
|
+
* @deprecated Don't use. Introduced incidentally in workers-types 3.x. Scheduled for removal.
|
|
364
451
|
*/
|
|
365
452
|
declare type DurableObjectStorageOperationsPutOptions = DurableObjectPutOptions;
|
|
366
453
|
|
|
@@ -371,13 +458,27 @@ interface DurableObjectStub extends Fetcher {
|
|
|
371
458
|
|
|
372
459
|
interface DurableObjectTransaction {
|
|
373
460
|
get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T>;
|
|
374
|
-
get<T = unknown>(
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
461
|
+
get<T = unknown>(
|
|
462
|
+
keys: string[],
|
|
463
|
+
options?: DurableObjectGetOptions
|
|
464
|
+
): Promise<Map<string, T>>;
|
|
465
|
+
list<T = unknown>(
|
|
466
|
+
options?: DurableObjectListOptions
|
|
467
|
+
): Promise<Map<string, T>>;
|
|
468
|
+
put<T>(
|
|
469
|
+
key: string,
|
|
470
|
+
value: T,
|
|
471
|
+
options?: DurableObjectPutOptions
|
|
472
|
+
): Promise<void>;
|
|
473
|
+
put<T>(
|
|
474
|
+
entries: Record<string, T>,
|
|
475
|
+
options?: DurableObjectPutOptions
|
|
476
|
+
): Promise<void>;
|
|
378
477
|
delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
|
|
379
478
|
delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
|
|
380
479
|
rollback(): void;
|
|
480
|
+
getAlarm(options?: DurableObjectGetAlarmOptions): Promise<Date | null>;
|
|
481
|
+
setAlarm(arg2: Date, options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
381
482
|
}
|
|
382
483
|
|
|
383
484
|
interface Element {
|
|
@@ -397,6 +498,22 @@ interface Element {
|
|
|
397
498
|
remove(): Element;
|
|
398
499
|
removeAndKeepContent(): Element;
|
|
399
500
|
setInnerContent(content: Content, options?: ContentOptions): Element;
|
|
501
|
+
onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
interface EndTag {
|
|
505
|
+
name: string;
|
|
506
|
+
before(content: Content, options?: ContentOptions): EndTag;
|
|
507
|
+
after(content: Content, options?: ContentOptions): EndTag;
|
|
508
|
+
remove(): EndTag;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
interface ErrorEvent extends Event {
|
|
512
|
+
readonly filename: string;
|
|
513
|
+
readonly message: string;
|
|
514
|
+
readonly lineno: number;
|
|
515
|
+
readonly colno: number;
|
|
516
|
+
readonly error: any;
|
|
400
517
|
}
|
|
401
518
|
|
|
402
519
|
declare class Event {
|
|
@@ -429,18 +546,32 @@ interface EventInit {
|
|
|
429
546
|
composed?: boolean;
|
|
430
547
|
}
|
|
431
548
|
|
|
432
|
-
declare type EventListener<EventType extends Event = Event> = (
|
|
549
|
+
declare type EventListener<EventType extends Event = Event> = (
|
|
550
|
+
event: EventType
|
|
551
|
+
) => void;
|
|
433
552
|
|
|
434
553
|
interface EventListenerObject<EventType extends Event = Event> {
|
|
435
554
|
handleEvent(event: EventType): void;
|
|
436
555
|
}
|
|
437
556
|
|
|
438
|
-
declare type EventListenerOrEventListenerObject<
|
|
557
|
+
declare type EventListenerOrEventListenerObject<
|
|
558
|
+
EventType extends Event = Event
|
|
559
|
+
> = EventListener<EventType> | EventListenerObject<EventType>;
|
|
439
560
|
|
|
440
|
-
declare class EventTarget<
|
|
561
|
+
declare class EventTarget<
|
|
562
|
+
EventMap extends Record<string, Event> = Record<string, Event>
|
|
563
|
+
> {
|
|
441
564
|
constructor();
|
|
442
|
-
addEventListener<Type extends keyof EventMap>(
|
|
443
|
-
|
|
565
|
+
addEventListener<Type extends keyof EventMap>(
|
|
566
|
+
type: Type,
|
|
567
|
+
handler: EventListenerOrEventListenerObject<EventMap[Type]>,
|
|
568
|
+
options?: EventTargetAddEventListenerOptions | boolean
|
|
569
|
+
): void;
|
|
570
|
+
removeEventListener<Type extends keyof EventMap>(
|
|
571
|
+
type: Type,
|
|
572
|
+
handler: EventListenerOrEventListenerObject<EventMap[Type]>,
|
|
573
|
+
options?: EventTargetEventListenerOptions | boolean
|
|
574
|
+
): void;
|
|
444
575
|
dispatchEvent(event: EventMap[keyof EventMap]): boolean;
|
|
445
576
|
}
|
|
446
577
|
|
|
@@ -465,9 +596,17 @@ interface ExportedHandler<Env = unknown> {
|
|
|
465
596
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
466
597
|
}
|
|
467
598
|
|
|
468
|
-
declare type ExportedHandlerFetchHandler<Env = unknown> = (
|
|
599
|
+
declare type ExportedHandlerFetchHandler<Env = unknown> = (
|
|
600
|
+
request: Request,
|
|
601
|
+
env: Env,
|
|
602
|
+
ctx: ExecutionContext
|
|
603
|
+
) => Response | Promise<Response>;
|
|
469
604
|
|
|
470
|
-
declare type ExportedHandlerScheduledHandler<Env = unknown> = (
|
|
605
|
+
declare type ExportedHandlerScheduledHandler<Env = unknown> = (
|
|
606
|
+
controller: ScheduledController,
|
|
607
|
+
env: Env,
|
|
608
|
+
ctx: ExecutionContext
|
|
609
|
+
) => void | Promise<void>;
|
|
471
610
|
|
|
472
611
|
declare abstract class FetchEvent extends Event {
|
|
473
612
|
readonly request: Request;
|
|
@@ -477,7 +616,10 @@ declare abstract class FetchEvent extends Event {
|
|
|
477
616
|
}
|
|
478
617
|
|
|
479
618
|
declare abstract class Fetcher {
|
|
480
|
-
fetch(
|
|
619
|
+
fetch(
|
|
620
|
+
requestOrUrl: Request | string,
|
|
621
|
+
requestInit?: RequestInit | Request
|
|
622
|
+
): Promise<Response>;
|
|
481
623
|
}
|
|
482
624
|
|
|
483
625
|
declare class File extends Blob {
|
|
@@ -492,7 +634,7 @@ interface FileOptions {
|
|
|
492
634
|
}
|
|
493
635
|
|
|
494
636
|
declare class FixedLengthStream extends TransformStream {
|
|
495
|
-
constructor(expectedLength: number);
|
|
637
|
+
constructor(expectedLength: number | bigint);
|
|
496
638
|
}
|
|
497
639
|
|
|
498
640
|
declare class FormData {
|
|
@@ -505,16 +647,27 @@ declare class FormData {
|
|
|
505
647
|
has(name: string): boolean;
|
|
506
648
|
set(name: string, value: string): void;
|
|
507
649
|
set(name: string, value: Blob, filename?: string): void;
|
|
508
|
-
entries(): IterableIterator<
|
|
650
|
+
entries(): IterableIterator<[key: string, value: File | string]>;
|
|
509
651
|
keys(): IterableIterator<string>;
|
|
510
652
|
values(): IterableIterator<File | string>;
|
|
511
|
-
forEach<This = unknown>(
|
|
512
|
-
|
|
653
|
+
forEach<This = unknown>(
|
|
654
|
+
callback: (
|
|
655
|
+
this: This,
|
|
656
|
+
key: string,
|
|
657
|
+
value: File | string,
|
|
658
|
+
parent: FormData
|
|
659
|
+
) => void,
|
|
660
|
+
thisArg?: This
|
|
661
|
+
): void;
|
|
662
|
+
[Symbol.iterator](): IterableIterator<[key: string, value: File | string]>;
|
|
513
663
|
}
|
|
514
664
|
|
|
515
665
|
declare class HTMLRewriter {
|
|
516
666
|
constructor();
|
|
517
|
-
on(
|
|
667
|
+
on(
|
|
668
|
+
selector: string,
|
|
669
|
+
handlers: HTMLRewriterElementContentHandlers
|
|
670
|
+
): HTMLRewriter;
|
|
518
671
|
onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;
|
|
519
672
|
transform(response: Response): Response;
|
|
520
673
|
}
|
|
@@ -540,14 +693,20 @@ declare class Headers {
|
|
|
540
693
|
set(name: string, value: string): void;
|
|
541
694
|
append(name: string, value: string): void;
|
|
542
695
|
delete(name: string): void;
|
|
543
|
-
forEach<This = unknown>(
|
|
696
|
+
forEach<This = unknown>(
|
|
697
|
+
callback: (this: This, key: string, value: string, parent: Headers) => void,
|
|
698
|
+
thisArg?: This
|
|
699
|
+
): void;
|
|
544
700
|
entries(): IterableIterator<[key: string, value: string]>;
|
|
545
701
|
keys(): IterableIterator<string>;
|
|
546
702
|
values(): IterableIterator<string>;
|
|
547
703
|
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
|
|
548
704
|
}
|
|
549
705
|
|
|
550
|
-
declare type HeadersInit =
|
|
706
|
+
declare type HeadersInit =
|
|
707
|
+
| Headers
|
|
708
|
+
| Record<string, string>
|
|
709
|
+
| [key: string, value: string][];
|
|
551
710
|
|
|
552
711
|
/**
|
|
553
712
|
* Back compat for code migrating to older definitions.
|
|
@@ -555,11 +714,15 @@ declare type HeadersInit = Headers | Record<string, string> | ([key: string, val
|
|
|
555
714
|
*/
|
|
556
715
|
declare type HeadersInitializer = HeadersInit;
|
|
557
716
|
|
|
717
|
+
declare class IdentityTransformStream extends TransformStream {
|
|
718
|
+
constructor();
|
|
719
|
+
}
|
|
720
|
+
|
|
558
721
|
/**
|
|
559
722
|
* In addition to the properties on the standard Request object,
|
|
560
723
|
* the cf object contains extra information about the request provided
|
|
561
724
|
* by Cloudflare's edge.
|
|
562
|
-
*
|
|
725
|
+
*
|
|
563
726
|
* Note: Currently, settings in the cf object cannot be accessed in the
|
|
564
727
|
* playground.
|
|
565
728
|
*/
|
|
@@ -670,35 +833,83 @@ interface JsonWebKey {
|
|
|
670
833
|
* Workers KV is a global, low-latency, key-value data store. It supports exceptionally high read volumes with low-latency,
|
|
671
834
|
* making it possible to build highly dynamic APIs and websites which respond as quickly as a cached static file would.
|
|
672
835
|
*/
|
|
673
|
-
interface KVNamespace {
|
|
674
|
-
get(
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
get(key:
|
|
679
|
-
get
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
836
|
+
interface KVNamespace<K extends string = string> {
|
|
837
|
+
get(
|
|
838
|
+
key: K,
|
|
839
|
+
options?: Partial<KVNamespaceGetOptions<undefined>>
|
|
840
|
+
): Promise<string | null>;
|
|
841
|
+
get(key: K, type: "text"): Promise<string | null>;
|
|
842
|
+
get<ExpectedValue = unknown>(
|
|
843
|
+
key: K,
|
|
844
|
+
type: "json"
|
|
845
|
+
): Promise<ExpectedValue | null>;
|
|
846
|
+
get(key: K, type: "arrayBuffer"): Promise<ArrayBuffer | null>;
|
|
847
|
+
get(key: K, type: "stream"): Promise<ReadableStream | null>;
|
|
848
|
+
get(key: K, options: KVNamespaceGetOptions<"text">): Promise<string | null>;
|
|
849
|
+
get<ExpectedValue = unknown>(
|
|
850
|
+
key: string,
|
|
851
|
+
options: KVNamespaceGetOptions<"json">
|
|
852
|
+
): Promise<ExpectedValue | null>;
|
|
853
|
+
get(
|
|
854
|
+
key: K,
|
|
855
|
+
options: KVNamespaceGetOptions<"arrayBuffer">
|
|
856
|
+
): Promise<ArrayBuffer | null>;
|
|
857
|
+
get(
|
|
858
|
+
key: K,
|
|
859
|
+
options: KVNamespaceGetOptions<"stream">
|
|
860
|
+
): Promise<ReadableStream | null>;
|
|
861
|
+
list<Metadata = unknown>(
|
|
862
|
+
options?: KVNamespaceListOptions
|
|
863
|
+
): Promise<KVNamespaceListResult<Metadata>>;
|
|
684
864
|
/**
|
|
685
865
|
* Creates a new key-value pair, or updates the value for a particular key.
|
|
686
866
|
* @param key key to associate with the value. A key cannot be empty, `.` or `..`. All other keys are valid.
|
|
687
867
|
* @param value value to store. The type is inferred. The maximum size of a value is 25MB.
|
|
688
868
|
* @returns Returns a `Promise` that you should `await` on in order to verify a successful update.
|
|
689
869
|
* @example
|
|
690
|
-
* await NAMESPACE.put(key, value)
|
|
870
|
+
* await NAMESPACE.put(key, value);
|
|
691
871
|
*/
|
|
692
|
-
put(
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
getWithMetadata<Metadata = unknown>(
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
getWithMetadata<Metadata = unknown>(
|
|
872
|
+
put(
|
|
873
|
+
key: K,
|
|
874
|
+
value: string | ArrayBuffer | ArrayBufferView | ReadableStream,
|
|
875
|
+
options?: KVNamespacePutOptions
|
|
876
|
+
): Promise<void>;
|
|
877
|
+
getWithMetadata<Metadata = unknown>(
|
|
878
|
+
key: K,
|
|
879
|
+
options?: Partial<KVNamespaceGetOptions<undefined>>
|
|
880
|
+
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
881
|
+
getWithMetadata<Metadata = unknown>(
|
|
882
|
+
key: K,
|
|
883
|
+
type: "text"
|
|
884
|
+
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
885
|
+
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
|
|
886
|
+
key: K,
|
|
887
|
+
type: "json"
|
|
888
|
+
): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
|
|
889
|
+
getWithMetadata<Metadata = unknown>(
|
|
890
|
+
key: K,
|
|
891
|
+
type: "arrayBuffer"
|
|
892
|
+
): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
|
|
893
|
+
getWithMetadata<Metadata = unknown>(
|
|
894
|
+
key: K,
|
|
895
|
+
type: "stream"
|
|
896
|
+
): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
|
|
897
|
+
getWithMetadata<Metadata = unknown>(
|
|
898
|
+
key: K,
|
|
899
|
+
options: KVNamespaceGetOptions<"text">
|
|
900
|
+
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
901
|
+
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
|
|
902
|
+
key: K,
|
|
903
|
+
options: KVNamespaceGetOptions<"json">
|
|
904
|
+
): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
|
|
905
|
+
getWithMetadata<Metadata = unknown>(
|
|
906
|
+
key: K,
|
|
907
|
+
options: KVNamespaceGetOptions<"arrayBuffer">
|
|
908
|
+
): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
|
|
909
|
+
getWithMetadata<Metadata = unknown>(
|
|
910
|
+
key: K,
|
|
911
|
+
options: KVNamespaceGetOptions<"stream">
|
|
912
|
+
): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
|
|
702
913
|
delete(name: string): Promise<void>;
|
|
703
914
|
}
|
|
704
915
|
|
|
@@ -751,6 +962,10 @@ interface MessageEventInit {
|
|
|
751
962
|
*/
|
|
752
963
|
declare type MessageEventInitializer = MessageEventInit;
|
|
753
964
|
|
|
965
|
+
declare abstract class Navigator {
|
|
966
|
+
readonly userAgent: string;
|
|
967
|
+
}
|
|
968
|
+
|
|
754
969
|
/**
|
|
755
970
|
* Transitionary name.
|
|
756
971
|
* @deprecated Use StreamPipeOptions
|
|
@@ -766,12 +981,147 @@ declare abstract class PromiseRejectionEvent extends Event {
|
|
|
766
981
|
readonly reason: any;
|
|
767
982
|
}
|
|
768
983
|
|
|
984
|
+
interface QueuingStrategyInit {
|
|
985
|
+
highWaterMark: number;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
/**
|
|
989
|
+
* An instance of the R2 bucket binding.
|
|
990
|
+
*/
|
|
991
|
+
interface R2Bucket {
|
|
992
|
+
head(key: string, options?: R2HeadOptions): Promise<R2Object | null>;
|
|
993
|
+
get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;
|
|
994
|
+
put(
|
|
995
|
+
key: string,
|
|
996
|
+
value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null,
|
|
997
|
+
options?: R2PutOptions
|
|
998
|
+
): Promise<R2Object>;
|
|
999
|
+
delete(key: string): Promise<void>;
|
|
1000
|
+
list(options?: R2ListOptions): Promise<R2Objects>;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
/**
|
|
1004
|
+
* Perform the operation conditionally based on meeting the defined criteria.
|
|
1005
|
+
*/
|
|
1006
|
+
interface R2Conditional {
|
|
1007
|
+
etagMatches?: string;
|
|
1008
|
+
etagDoesNotMatch?: string;
|
|
1009
|
+
uploadedBefore?: Date;
|
|
1010
|
+
uploadedAfter?: Date;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
interface R2Error {
|
|
1014
|
+
readonly stack: string;
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
/**
|
|
1018
|
+
* Options for retrieving the object metadata nad payload.
|
|
1019
|
+
*/
|
|
1020
|
+
interface R2GetOptions {
|
|
1021
|
+
onlyIf?: R2Conditional | Headers;
|
|
1022
|
+
range?: R2Range;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
/**
|
|
1026
|
+
* Metadata that's automatically rendered into R2 HTTP API endpoints.
|
|
1027
|
+
* ```
|
|
1028
|
+
* * contentType -> content-type
|
|
1029
|
+
* * contentLanguage -> content-language
|
|
1030
|
+
* etc...
|
|
1031
|
+
* ```
|
|
1032
|
+
* This data is echoed back on GET responses based on what was originally
|
|
1033
|
+
* assigned to the object (and can typically also be overriden when issuing
|
|
1034
|
+
* the GET request).
|
|
1035
|
+
*/
|
|
1036
|
+
interface R2HTTPMetadata {
|
|
1037
|
+
contentType?: string;
|
|
1038
|
+
contentLanguage?: string;
|
|
1039
|
+
contentDisposition?: string;
|
|
1040
|
+
contentEncoding?: string;
|
|
1041
|
+
cacheControl?: string;
|
|
1042
|
+
cacheExpiry?: Date;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
/**
|
|
1046
|
+
* Options for retrieving the object metadata.
|
|
1047
|
+
*/
|
|
1048
|
+
interface R2HeadOptions {
|
|
1049
|
+
onlyIf?: R2Conditional | Headers;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
interface R2ListOptions {
|
|
1053
|
+
limit?: number;
|
|
1054
|
+
prefix?: string;
|
|
1055
|
+
cursor?: string;
|
|
1056
|
+
delimiter?: string;
|
|
1057
|
+
/**
|
|
1058
|
+
* If you populate this array, then items returned will include this metadata.
|
|
1059
|
+
* A tradeoff is that fewer results may be returned depending on how big this
|
|
1060
|
+
* data is. For now the caps are TBD but expect the total memory usage for a list
|
|
1061
|
+
* operation may need to be <1MB or even <128kb depending on how many list operations
|
|
1062
|
+
* you are sending into one bucket. Make sure to look at `truncated` for the result
|
|
1063
|
+
* rather than having logic like
|
|
1064
|
+
* ```
|
|
1065
|
+
* while (listed.length < limit) {
|
|
1066
|
+
* listed = myBucket.list({ limit, include: ['customMetadata'] })
|
|
1067
|
+
* }
|
|
1068
|
+
* ```
|
|
1069
|
+
*/
|
|
1070
|
+
include: ("httpMetadata" | "customMetadata")[];
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
/**
|
|
1074
|
+
* The metadata for the object.
|
|
1075
|
+
*/
|
|
1076
|
+
declare abstract class R2Object {
|
|
1077
|
+
readonly key: string;
|
|
1078
|
+
readonly version: string;
|
|
1079
|
+
readonly size: number;
|
|
1080
|
+
readonly etag: string;
|
|
1081
|
+
readonly httpEtag: string;
|
|
1082
|
+
readonly uploaded: Date;
|
|
1083
|
+
readonly httpMetadata: R2HTTPMetadata;
|
|
1084
|
+
readonly customMetadata: Record<string, string>;
|
|
1085
|
+
writeHttpMetadata(headers: Headers): void;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
/**
|
|
1089
|
+
* The metadata for the object and the body of the payload.
|
|
1090
|
+
*/
|
|
1091
|
+
interface R2ObjectBody extends R2Object {
|
|
1092
|
+
readonly body: ReadableStream;
|
|
1093
|
+
readonly bodyUsed: boolean;
|
|
1094
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
1095
|
+
text(): Promise<string>;
|
|
1096
|
+
json<T>(): Promise<T>;
|
|
1097
|
+
blob(): Promise<Blob>;
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
interface R2Objects {
|
|
1101
|
+
objects: R2Object[];
|
|
1102
|
+
truncated: boolean;
|
|
1103
|
+
cursor?: string;
|
|
1104
|
+
delimitedPrefixes: string[];
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
interface R2PutOptions {
|
|
1108
|
+
httpMetadata?: R2HTTPMetadata | Headers;
|
|
1109
|
+
customMetadata?: Record<string, string>;
|
|
1110
|
+
md5?: ArrayBuffer | string;
|
|
1111
|
+
sha1?: ArrayBuffer | string;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
interface R2Range {
|
|
1115
|
+
offset: number;
|
|
1116
|
+
length: number;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
769
1119
|
interface ReadResult {
|
|
770
1120
|
value?: any;
|
|
771
1121
|
done: boolean;
|
|
772
1122
|
}
|
|
773
1123
|
|
|
774
|
-
|
|
1124
|
+
declare abstract class ReadableByteStreamController {
|
|
775
1125
|
readonly byobRequest: ReadableStreamBYOBRequest | null;
|
|
776
1126
|
readonly desiredSize: number | null;
|
|
777
1127
|
close(): void;
|
|
@@ -785,28 +1135,40 @@ declare class ReadableStream {
|
|
|
785
1135
|
cancel(reason?: any): Promise<void>;
|
|
786
1136
|
getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
|
|
787
1137
|
getReader(): ReadableStreamDefaultReader;
|
|
788
|
-
pipeThrough(
|
|
1138
|
+
pipeThrough(
|
|
1139
|
+
transform: ReadableStreamTransform,
|
|
1140
|
+
options?: PipeToOptions
|
|
1141
|
+
): ReadableStream;
|
|
789
1142
|
pipeTo(destination: WritableStream, options?: PipeToOptions): Promise<void>;
|
|
790
1143
|
tee(): [ReadableStream, ReadableStream];
|
|
1144
|
+
values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<any>;
|
|
1145
|
+
[Symbol.asyncIterator](
|
|
1146
|
+
options?: ReadableStreamValuesOptions
|
|
1147
|
+
): AsyncIterableIterator<any>;
|
|
791
1148
|
}
|
|
792
1149
|
|
|
793
1150
|
declare class ReadableStreamBYOBReader {
|
|
794
1151
|
constructor(stream: ReadableStream);
|
|
795
1152
|
readonly closed: Promise<void>;
|
|
796
1153
|
cancel(reason?: any): Promise<void>;
|
|
797
|
-
read<T extends ArrayBufferView>(
|
|
1154
|
+
read<T extends ArrayBufferView>(
|
|
1155
|
+
view: T
|
|
1156
|
+
): Promise<ReadableStreamReadResult<T>>;
|
|
798
1157
|
releaseLock(): void;
|
|
799
|
-
readAtLeast(
|
|
1158
|
+
readAtLeast(
|
|
1159
|
+
minBytes: number,
|
|
1160
|
+
view: Uint8Array
|
|
1161
|
+
): Promise<ReadableStreamReadResult<Uint8Array>>;
|
|
800
1162
|
}
|
|
801
1163
|
|
|
802
|
-
|
|
1164
|
+
declare abstract class ReadableStreamBYOBRequest {
|
|
803
1165
|
readonly view: Uint8Array | null;
|
|
804
1166
|
respond(bytesWritten: number): void;
|
|
805
1167
|
respondWithNewView(view: ArrayBufferView): void;
|
|
806
1168
|
readonly atLeast: number | null;
|
|
807
1169
|
}
|
|
808
1170
|
|
|
809
|
-
|
|
1171
|
+
declare abstract class ReadableStreamDefaultController {
|
|
810
1172
|
readonly desiredSize: number | null;
|
|
811
1173
|
close(): void;
|
|
812
1174
|
enqueue(chunk?: any): void;
|
|
@@ -831,7 +1193,9 @@ interface ReadableStreamGetReaderOptions {
|
|
|
831
1193
|
*/
|
|
832
1194
|
declare type ReadableStreamPipeToOptions = PipeToOptions;
|
|
833
1195
|
|
|
834
|
-
declare type ReadableStreamReadResult<T = any> =
|
|
1196
|
+
declare type ReadableStreamReadResult<T = any> =
|
|
1197
|
+
| { done: true; value: undefined }
|
|
1198
|
+
| { done: false; value: T };
|
|
835
1199
|
|
|
836
1200
|
/**
|
|
837
1201
|
* Back-compat alias.
|
|
@@ -843,13 +1207,18 @@ declare type ReadableStreamReadableStreamBYOBReader = ReadableStreamBYOBReader;
|
|
|
843
1207
|
* Back-compat alias.
|
|
844
1208
|
* @deprecated Use ReadableStreamDefaultReader
|
|
845
1209
|
*/
|
|
846
|
-
declare type ReadableStreamReadableStreamDefaultReader =
|
|
1210
|
+
declare type ReadableStreamReadableStreamDefaultReader =
|
|
1211
|
+
ReadableStreamDefaultReader;
|
|
847
1212
|
|
|
848
1213
|
interface ReadableStreamTransform {
|
|
849
1214
|
writable: WritableStream;
|
|
850
1215
|
readable: ReadableStream;
|
|
851
1216
|
}
|
|
852
1217
|
|
|
1218
|
+
interface ReadableStreamValuesOptions {
|
|
1219
|
+
preventCancel?: boolean;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
853
1222
|
declare class Request extends Body {
|
|
854
1223
|
constructor(input: Request | string, init?: RequestInit | Request);
|
|
855
1224
|
clone(): Request;
|
|
@@ -871,10 +1240,10 @@ interface RequestInit {
|
|
|
871
1240
|
/**
|
|
872
1241
|
* cf is a union of these two types because there are multiple
|
|
873
1242
|
* scenarios in which it might be one or the other.
|
|
874
|
-
*
|
|
1243
|
+
*
|
|
875
1244
|
* IncomingRequestCfProperties is required to allow
|
|
876
1245
|
* new Request(someUrl, event.request)
|
|
877
|
-
*
|
|
1246
|
+
*
|
|
878
1247
|
* RequestInitCfProperties is required to allow
|
|
879
1248
|
* new Request(event.request, {cf: { ... } })
|
|
880
1249
|
* fetch(someUrl, {cf: { ... } })
|
|
@@ -888,7 +1257,7 @@ interface RequestInit {
|
|
|
888
1257
|
* that you pass as an argument to the Request constructor, you can
|
|
889
1258
|
* set certain properties of a `cf` object to control how Cloudflare
|
|
890
1259
|
* features are applied to that new Request.
|
|
891
|
-
*
|
|
1260
|
+
*
|
|
892
1261
|
* Note: Currently, these properties cannot be tested in the
|
|
893
1262
|
* playground.
|
|
894
1263
|
*/
|
|
@@ -899,7 +1268,7 @@ interface RequestInitCfProperties {
|
|
|
899
1268
|
* "the same" for caching purposes. If a request has the same cache key
|
|
900
1269
|
* as some previous request, then we can serve the same cached response for
|
|
901
1270
|
* both. (e.g. 'some-key')
|
|
902
|
-
*
|
|
1271
|
+
*
|
|
903
1272
|
* Only available for Enterprise customers.
|
|
904
1273
|
*/
|
|
905
1274
|
cacheKey?: string;
|
|
@@ -917,12 +1286,12 @@ interface RequestInitCfProperties {
|
|
|
917
1286
|
image?: RequestInitCfPropertiesImage;
|
|
918
1287
|
minify?: RequestInitCfPropertiesImageMinify;
|
|
919
1288
|
mirage?: boolean;
|
|
920
|
-
polish?:
|
|
1289
|
+
polish?: "lossy" | "lossless" | "off";
|
|
921
1290
|
/**
|
|
922
1291
|
* Redirects the request to an alternate origin server. You can use this,
|
|
923
1292
|
* for example, to implement load balancing across several origins.
|
|
924
1293
|
* (e.g.us-east.example.com)
|
|
925
|
-
*
|
|
1294
|
+
*
|
|
926
1295
|
* Note - For security reasons, the hostname set in resolveOverride must
|
|
927
1296
|
* be proxied on the same Cloudflare zone of the incoming request.
|
|
928
1297
|
* Otherwise, the setting is ignored. CNAME hosts are allowed, so to
|
|
@@ -946,7 +1315,7 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
|
|
|
946
1315
|
* or cutting out a specific fragment of an image. Trimming is performed
|
|
947
1316
|
* before resizing or rotation. Takes dpr into account.
|
|
948
1317
|
*/
|
|
949
|
-
trim?: { left?: number; top?: number; right?: number; bottom?: number
|
|
1318
|
+
trim?: { left?: number; top?: number; right?: number; bottom?: number };
|
|
950
1319
|
/**
|
|
951
1320
|
* Quality setting from 1-100 (useful values are in 60-90 range). Lower values
|
|
952
1321
|
* make images look worse, but load faster. The default is 85. It applies only
|
|
@@ -1031,9 +1400,9 @@ interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
|
|
|
1031
1400
|
* positions left side of the overlay 10 pixels from the left edge of the
|
|
1032
1401
|
* image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom
|
|
1033
1402
|
* of the background image.
|
|
1034
|
-
*
|
|
1403
|
+
*
|
|
1035
1404
|
* Setting both left & right, or both top & bottom is an error.
|
|
1036
|
-
*
|
|
1405
|
+
*
|
|
1037
1406
|
* If no position is specified, the image will be centered.
|
|
1038
1407
|
*/
|
|
1039
1408
|
top?: number;
|
|
@@ -1113,17 +1482,32 @@ interface SchedulerWaitOptions {
|
|
|
1113
1482
|
interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
1114
1483
|
btoa(data: string): string;
|
|
1115
1484
|
atob(data: string): string;
|
|
1116
|
-
setTimeout<Args extends any[]>(
|
|
1485
|
+
setTimeout<Args extends any[]>(
|
|
1486
|
+
callback: (...args: Args) => void,
|
|
1487
|
+
msDelay?: number,
|
|
1488
|
+
...args: Args
|
|
1489
|
+
): number;
|
|
1117
1490
|
clearTimeout(timeoutId: number | null): void;
|
|
1118
|
-
setInterval<Args extends any[]>(
|
|
1491
|
+
setInterval<Args extends any[]>(
|
|
1492
|
+
callback: (...args: Args) => void,
|
|
1493
|
+
msDelay?: number,
|
|
1494
|
+
...args: Args
|
|
1495
|
+
): number;
|
|
1119
1496
|
clearInterval(timeoutId: number | null): void;
|
|
1120
1497
|
queueMicrotask(task: Function): void;
|
|
1121
|
-
structuredClone(
|
|
1122
|
-
|
|
1498
|
+
structuredClone(
|
|
1499
|
+
value: any,
|
|
1500
|
+
options?: ServiceWorkerGlobalScopeStructuredCloneOptions
|
|
1501
|
+
): any;
|
|
1502
|
+
fetch(
|
|
1503
|
+
request: Request | string,
|
|
1504
|
+
requestInitr?: RequestInit | Request
|
|
1505
|
+
): Promise<Response>;
|
|
1123
1506
|
self: ServiceWorkerGlobalScope;
|
|
1124
1507
|
crypto: Crypto;
|
|
1125
1508
|
caches: CacheStorage;
|
|
1126
1509
|
scheduler: Scheduler;
|
|
1510
|
+
navigator: Navigator;
|
|
1127
1511
|
readonly console: Console;
|
|
1128
1512
|
origin: void;
|
|
1129
1513
|
}
|
|
@@ -1140,18 +1524,71 @@ interface StreamQueuingStrategy {
|
|
|
1140
1524
|
}
|
|
1141
1525
|
|
|
1142
1526
|
declare abstract class SubtleCrypto {
|
|
1143
|
-
encrypt(
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1527
|
+
encrypt(
|
|
1528
|
+
algorithm: string | SubtleCryptoEncryptAlgorithm,
|
|
1529
|
+
key: CryptoKey,
|
|
1530
|
+
plainText: ArrayBuffer | ArrayBufferView
|
|
1531
|
+
): Promise<ArrayBuffer>;
|
|
1532
|
+
decrypt(
|
|
1533
|
+
algorithm: string | SubtleCryptoEncryptAlgorithm,
|
|
1534
|
+
key: CryptoKey,
|
|
1535
|
+
cipherText: ArrayBuffer | ArrayBufferView
|
|
1536
|
+
): Promise<ArrayBuffer>;
|
|
1537
|
+
sign(
|
|
1538
|
+
algorithm: string | SubtleCryptoSignAlgorithm,
|
|
1539
|
+
key: CryptoKey,
|
|
1540
|
+
data: ArrayBuffer | ArrayBufferView
|
|
1541
|
+
): Promise<ArrayBuffer>;
|
|
1542
|
+
verify(
|
|
1543
|
+
algorithm: string | SubtleCryptoSignAlgorithm,
|
|
1544
|
+
key: CryptoKey,
|
|
1545
|
+
signature: ArrayBuffer | ArrayBufferView,
|
|
1546
|
+
data: ArrayBuffer | ArrayBufferView
|
|
1547
|
+
): Promise<boolean>;
|
|
1548
|
+
digest(
|
|
1549
|
+
algorithm: string | SubtleCryptoHashAlgorithm,
|
|
1550
|
+
data: ArrayBuffer | ArrayBufferView
|
|
1551
|
+
): Promise<ArrayBuffer>;
|
|
1552
|
+
generateKey(
|
|
1553
|
+
algorithm: string | SubtleCryptoGenerateKeyAlgorithm,
|
|
1554
|
+
extractable: boolean,
|
|
1555
|
+
keyUsages: string[]
|
|
1556
|
+
): Promise<CryptoKey | CryptoKeyPair>;
|
|
1557
|
+
deriveKey(
|
|
1558
|
+
algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
|
|
1559
|
+
baseKey: CryptoKey,
|
|
1560
|
+
derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
|
|
1561
|
+
extractable: boolean,
|
|
1562
|
+
keyUsages: string[]
|
|
1563
|
+
): Promise<CryptoKey>;
|
|
1564
|
+
deriveBits(
|
|
1565
|
+
algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
|
|
1566
|
+
baseKey: CryptoKey,
|
|
1567
|
+
length: number | null
|
|
1568
|
+
): Promise<ArrayBuffer>;
|
|
1569
|
+
importKey(
|
|
1570
|
+
format: string,
|
|
1571
|
+
keyData: ArrayBuffer | JsonWebKey,
|
|
1572
|
+
algorithm: string | SubtleCryptoImportKeyAlgorithm,
|
|
1573
|
+
extractable: boolean,
|
|
1574
|
+
keyUsages: string[]
|
|
1575
|
+
): Promise<CryptoKey>;
|
|
1152
1576
|
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
|
|
1153
|
-
wrapKey(
|
|
1154
|
-
|
|
1577
|
+
wrapKey(
|
|
1578
|
+
format: string,
|
|
1579
|
+
key: CryptoKey,
|
|
1580
|
+
wrappingKey: CryptoKey,
|
|
1581
|
+
wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm
|
|
1582
|
+
): Promise<ArrayBuffer>;
|
|
1583
|
+
unwrapKey(
|
|
1584
|
+
format: string,
|
|
1585
|
+
wrappedKey: ArrayBuffer | ArrayBufferView,
|
|
1586
|
+
unwrappingKey: CryptoKey,
|
|
1587
|
+
unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
|
|
1588
|
+
unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
|
|
1589
|
+
extractable: boolean,
|
|
1590
|
+
keyUsages: string[]
|
|
1591
|
+
): Promise<CryptoKey>;
|
|
1155
1592
|
}
|
|
1156
1593
|
|
|
1157
1594
|
interface SubtleCryptoDeriveKeyAlgorithm {
|
|
@@ -1195,13 +1632,13 @@ interface SubtleCryptoImportKeyAlgorithm {
|
|
|
1195
1632
|
}
|
|
1196
1633
|
|
|
1197
1634
|
/**
|
|
1198
|
-
*
|
|
1635
|
+
*
|
|
1199
1636
|
* @deprecated Don't use. Introduced incidentally in 3.x. Scheduled for removal.
|
|
1200
1637
|
*/
|
|
1201
1638
|
declare type SubtleCryptoJsonWebKey = JsonWebKey;
|
|
1202
1639
|
|
|
1203
1640
|
/**
|
|
1204
|
-
*
|
|
1641
|
+
*
|
|
1205
1642
|
* @deprecated Don't use. Introduced incidentally in 3.x. Scheduled for removal.
|
|
1206
1643
|
*/
|
|
1207
1644
|
declare type SubtleCryptoJsonWebKeyRsaOtherPrimesInfo = RsaOtherPrimesInfo;
|
|
@@ -1224,8 +1661,14 @@ interface Text {
|
|
|
1224
1661
|
}
|
|
1225
1662
|
|
|
1226
1663
|
declare class TextDecoder {
|
|
1227
|
-
constructor(
|
|
1228
|
-
|
|
1664
|
+
constructor(
|
|
1665
|
+
label?: "utf-8" | "utf8" | "unicode-1-1-utf-8",
|
|
1666
|
+
options?: TextDecoderConstructorOptions
|
|
1667
|
+
);
|
|
1668
|
+
decode(
|
|
1669
|
+
input?: ArrayBuffer | ArrayBufferView,
|
|
1670
|
+
options?: TextDecoderDecodeOptions
|
|
1671
|
+
): string;
|
|
1229
1672
|
readonly encoding: string;
|
|
1230
1673
|
readonly fatal: boolean;
|
|
1231
1674
|
readonly ignoreBOM: boolean;
|
|
@@ -1276,6 +1719,52 @@ declare class URL {
|
|
|
1276
1719
|
toJSON(): string;
|
|
1277
1720
|
}
|
|
1278
1721
|
|
|
1722
|
+
declare class URLPattern {
|
|
1723
|
+
constructor(input?: string | URLPatternURLPatternInit, baseURL?: string);
|
|
1724
|
+
readonly protocol: string;
|
|
1725
|
+
readonly username: string;
|
|
1726
|
+
readonly password: string;
|
|
1727
|
+
readonly hostname: string;
|
|
1728
|
+
readonly port: string;
|
|
1729
|
+
readonly pathname: string;
|
|
1730
|
+
readonly search: string;
|
|
1731
|
+
readonly hash: string;
|
|
1732
|
+
test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean;
|
|
1733
|
+
exec(
|
|
1734
|
+
input?: string | URLPatternURLPatternInit,
|
|
1735
|
+
baseURL?: string
|
|
1736
|
+
): URLPatternURLPatternResult | null;
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
interface URLPatternURLPatternComponentResult {
|
|
1740
|
+
input: string;
|
|
1741
|
+
groups: Record<string, string>;
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
interface URLPatternURLPatternInit {
|
|
1745
|
+
protocol?: string;
|
|
1746
|
+
username?: string;
|
|
1747
|
+
password?: string;
|
|
1748
|
+
hostname?: string;
|
|
1749
|
+
port?: string;
|
|
1750
|
+
pathname?: string;
|
|
1751
|
+
search?: string;
|
|
1752
|
+
hash?: string;
|
|
1753
|
+
baseURL?: string;
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
interface URLPatternURLPatternResult {
|
|
1757
|
+
inputs: (string | URLPatternURLPatternInit)[];
|
|
1758
|
+
protocol: URLPatternURLPatternComponentResult;
|
|
1759
|
+
username: URLPatternURLPatternComponentResult;
|
|
1760
|
+
password: URLPatternURLPatternComponentResult;
|
|
1761
|
+
hostname: URLPatternURLPatternComponentResult;
|
|
1762
|
+
port: URLPatternURLPatternComponentResult;
|
|
1763
|
+
pathname: URLPatternURLPatternComponentResult;
|
|
1764
|
+
search: URLPatternURLPatternComponentResult;
|
|
1765
|
+
hash: URLPatternURLPatternComponentResult;
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1279
1768
|
declare class URLSearchParams {
|
|
1280
1769
|
constructor(init?: URLSearchParamsInit);
|
|
1281
1770
|
append(name: string, value: string): void;
|
|
@@ -1288,12 +1777,24 @@ declare class URLSearchParams {
|
|
|
1288
1777
|
entries(): IterableIterator<[key: string, value: string]>;
|
|
1289
1778
|
keys(): IterableIterator<string>;
|
|
1290
1779
|
values(): IterableIterator<string>;
|
|
1291
|
-
forEach<This = unknown>(
|
|
1780
|
+
forEach<This = unknown>(
|
|
1781
|
+
callback: (
|
|
1782
|
+
this: This,
|
|
1783
|
+
key: string,
|
|
1784
|
+
value: string,
|
|
1785
|
+
parent: URLSearchParams
|
|
1786
|
+
) => void,
|
|
1787
|
+
thisArg?: This
|
|
1788
|
+
): void;
|
|
1292
1789
|
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
|
|
1293
1790
|
toString(): string;
|
|
1294
1791
|
}
|
|
1295
1792
|
|
|
1296
|
-
declare type URLSearchParamsInit =
|
|
1793
|
+
declare type URLSearchParamsInit =
|
|
1794
|
+
| URLSearchParams
|
|
1795
|
+
| string
|
|
1796
|
+
| Record<string, string>
|
|
1797
|
+
| [key: string, value: string][];
|
|
1297
1798
|
|
|
1298
1799
|
/**
|
|
1299
1800
|
* Back compat for code migrating to older definitions.
|
|
@@ -1303,21 +1804,38 @@ declare type URLSearchParamsInit = URLSearchParams | string | Record<string, str
|
|
|
1303
1804
|
*/
|
|
1304
1805
|
declare type URLSearchParamsInitializer = URLSearchParamsInit;
|
|
1305
1806
|
|
|
1306
|
-
declare
|
|
1807
|
+
declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
1808
|
+
constructor(url: string, protocols?: string[] | string);
|
|
1307
1809
|
accept(): void;
|
|
1308
|
-
send(message: ArrayBuffer | string): void;
|
|
1810
|
+
send(message: ArrayBuffer | ArrayBufferView | string): void;
|
|
1309
1811
|
close(code?: number, reason?: string): void;
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1812
|
+
static readonly READY_STATE_CONNECTING: number;
|
|
1813
|
+
static readonly READY_STATE_OPEN: number;
|
|
1814
|
+
static readonly READY_STATE_CLOSING: number;
|
|
1815
|
+
static readonly READY_STATE_CLOSED: number;
|
|
1816
|
+
readonly readyState: number;
|
|
1817
|
+
readonly url: string | null;
|
|
1818
|
+
readonly protocol: string | null;
|
|
1819
|
+
readonly extensions: string | null;
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
declare type WebSocketEventMap = {
|
|
1823
|
+
close: CloseEvent;
|
|
1824
|
+
message: MessageEvent;
|
|
1825
|
+
open: Event;
|
|
1826
|
+
error: ErrorEvent;
|
|
1827
|
+
};
|
|
1315
1828
|
|
|
1316
|
-
declare
|
|
1829
|
+
declare const WebSocketPair: { new (): { 0: WebSocket; 1: WebSocket } };
|
|
1317
1830
|
|
|
1318
|
-
}
|
|
1831
|
+
declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {}
|
|
1319
1832
|
|
|
1320
|
-
declare type WorkerGlobalScopeEventMap = {
|
|
1833
|
+
declare type WorkerGlobalScopeEventMap = {
|
|
1834
|
+
fetch: FetchEvent;
|
|
1835
|
+
scheduled: ScheduledEvent;
|
|
1836
|
+
unhandledrejection: PromiseRejectionEvent;
|
|
1837
|
+
rejectionhandled: PromiseRejectionEvent;
|
|
1838
|
+
};
|
|
1321
1839
|
|
|
1322
1840
|
declare class WritableStream {
|
|
1323
1841
|
constructor(underlyingSink?: Object, queuingStrategy?: Object);
|
|
@@ -1327,7 +1845,7 @@ declare class WritableStream {
|
|
|
1327
1845
|
getWriter(): WritableStreamDefaultWriter;
|
|
1328
1846
|
}
|
|
1329
1847
|
|
|
1330
|
-
|
|
1848
|
+
declare abstract class WritableStreamDefaultController {
|
|
1331
1849
|
readonly signal: AbortSignal;
|
|
1332
1850
|
error(reason?: any): void;
|
|
1333
1851
|
}
|
|
@@ -1347,9 +1865,14 @@ declare class WritableStreamDefaultWriter {
|
|
|
1347
1865
|
* Back-compat alias.
|
|
1348
1866
|
* @deprecated Use WritableStreamDefaultWriter
|
|
1349
1867
|
*/
|
|
1350
|
-
declare type WritableStreamWritableStreamDefaultWriter =
|
|
1868
|
+
declare type WritableStreamWritableStreamDefaultWriter =
|
|
1869
|
+
WritableStreamDefaultWriter;
|
|
1351
1870
|
|
|
1352
|
-
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
|
|
1871
|
+
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
|
|
1872
|
+
type: Type,
|
|
1873
|
+
handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
|
|
1874
|
+
options?: EventTargetAddEventListenerOptions | boolean
|
|
1875
|
+
): void;
|
|
1353
1876
|
|
|
1354
1877
|
declare function atob(data: string): string;
|
|
1355
1878
|
|
|
@@ -1365,25 +1888,49 @@ declare const console: Console;
|
|
|
1365
1888
|
|
|
1366
1889
|
declare const crypto: Crypto;
|
|
1367
1890
|
|
|
1368
|
-
declare function dispatchEvent(
|
|
1891
|
+
declare function dispatchEvent(
|
|
1892
|
+
event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]
|
|
1893
|
+
): boolean;
|
|
1894
|
+
|
|
1895
|
+
declare function fetch(
|
|
1896
|
+
request: Request | string,
|
|
1897
|
+
requestInitr?: RequestInit | Request
|
|
1898
|
+
): Promise<Response>;
|
|
1369
1899
|
|
|
1370
|
-
declare
|
|
1900
|
+
declare const navigator: Navigator;
|
|
1371
1901
|
|
|
1372
1902
|
declare const origin: void;
|
|
1373
1903
|
|
|
1374
1904
|
declare function queueMicrotask(task: Function): void;
|
|
1375
1905
|
|
|
1376
|
-
declare function removeEventListener<
|
|
1906
|
+
declare function removeEventListener<
|
|
1907
|
+
Type extends keyof WorkerGlobalScopeEventMap
|
|
1908
|
+
>(
|
|
1909
|
+
type: Type,
|
|
1910
|
+
handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
|
|
1911
|
+
options?: EventTargetEventListenerOptions | boolean
|
|
1912
|
+
): void;
|
|
1377
1913
|
|
|
1378
1914
|
declare const scheduler: Scheduler;
|
|
1379
1915
|
|
|
1380
1916
|
declare const self: ServiceWorkerGlobalScope;
|
|
1381
1917
|
|
|
1382
|
-
declare function setInterval<Args extends any[]>(
|
|
1918
|
+
declare function setInterval<Args extends any[]>(
|
|
1919
|
+
callback: (...args: Args) => void,
|
|
1920
|
+
msDelay?: number,
|
|
1921
|
+
...args: Args
|
|
1922
|
+
): number;
|
|
1383
1923
|
|
|
1384
|
-
declare function setTimeout<Args extends any[]>(
|
|
1924
|
+
declare function setTimeout<Args extends any[]>(
|
|
1925
|
+
callback: (...args: Args) => void,
|
|
1926
|
+
msDelay?: number,
|
|
1927
|
+
...args: Args
|
|
1928
|
+
): number;
|
|
1385
1929
|
|
|
1386
|
-
declare function structuredClone(
|
|
1930
|
+
declare function structuredClone(
|
|
1931
|
+
value: any,
|
|
1932
|
+
options?: ServiceWorkerGlobalScopeStructuredCloneOptions
|
|
1933
|
+
): any;
|
|
1387
1934
|
|
|
1388
1935
|
/*** Injected pages.d.ts ***/
|
|
1389
1936
|
type Params<P extends string = any> = Record<P, string | string[]>;
|
|
@@ -1392,7 +1939,7 @@ type EventContext<Env, P extends string, Data> = {
|
|
|
1392
1939
|
request: Request;
|
|
1393
1940
|
waitUntil: (promise: Promise<any>) => void;
|
|
1394
1941
|
next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
|
|
1395
|
-
env: Env & { ASSETS: { fetch: typeof fetch }};
|
|
1942
|
+
env: Env & { ASSETS: { fetch: typeof fetch } };
|
|
1396
1943
|
params: Params<P>;
|
|
1397
1944
|
data: Data;
|
|
1398
1945
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/workers-types",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "TypeScript typings for Cloudflare Workers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,17 +13,21 @@
|
|
|
13
13
|
"scripts": {
|
|
14
14
|
"export:docs": "node -r esbuild-register export/docs.ts",
|
|
15
15
|
"export:overrides": "node -r esbuild-register export/overrides.ts",
|
|
16
|
+
"prettier:check": "prettier --check '**/*.{md,ts}'",
|
|
17
|
+
"prettier": "prettier --write '**/*.{md,ts}'",
|
|
16
18
|
"test": "tsc"
|
|
17
19
|
},
|
|
18
20
|
"author": "Cloudflare Workers Team <workers@cloudflare.com> (https://workers.cloudflare.com)",
|
|
19
21
|
"license": "BSD-3-Clause",
|
|
20
22
|
"devDependencies": {
|
|
21
|
-
"@
|
|
23
|
+
"@changesets/changelog-github": "^0.4.2",
|
|
24
|
+
"@changesets/cli": "^2.18.1",
|
|
25
|
+
"@types/marked": "^4.0.1",
|
|
22
26
|
"@types/node": "^16.6.1",
|
|
23
27
|
"esbuild": "^0.12.22",
|
|
24
28
|
"esbuild-register": "^3.0.0",
|
|
25
|
-
"marked": "^
|
|
26
|
-
"prettier": "2.
|
|
29
|
+
"marked": "^4.0.10",
|
|
30
|
+
"prettier": "^2.5.1",
|
|
27
31
|
"typescript": "^4.3.5"
|
|
28
32
|
}
|
|
29
33
|
}
|