@cloudflare/workers-types 3.1.0 → 3.3.1
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 +596 -160
- package/package.json +6 -2
package/index.d.ts
CHANGED
|
@@ -4,13 +4,16 @@
|
|
|
4
4
|
declare class AbortController {
|
|
5
5
|
constructor();
|
|
6
6
|
readonly signal: AbortSignal;
|
|
7
|
-
abort(): void;
|
|
7
|
+
abort(reason?: any): void;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
declare class AbortSignal extends EventTarget {
|
|
11
11
|
constructor();
|
|
12
|
-
static abort(): AbortSignal;
|
|
12
|
+
static abort(reason?: any): AbortSignal;
|
|
13
|
+
static timeout(delay: number): AbortSignal;
|
|
13
14
|
readonly aborted: boolean;
|
|
15
|
+
readonly reason: any;
|
|
16
|
+
throwIfAborted(): void;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
interface BasicImageTransformations {
|
|
@@ -35,10 +38,11 @@ interface BasicImageTransformations {
|
|
|
35
38
|
* - cover: Resizes (shrinks or enlarges) to fill the entire area of width
|
|
36
39
|
* and height. If the image has an aspect ratio different from the ratio
|
|
37
40
|
* of width and height, it will be cropped to fit.
|
|
38
|
-
* - crop: The image will shrunk and cropped to fit within the area
|
|
39
|
-
* specified by width and height. The image
|
|
40
|
-
* smaller than the given dimensions it
|
|
41
|
-
* images larger than the given dimensions, it
|
|
41
|
+
* - crop: The image will be shrunk and cropped to fit within the area
|
|
42
|
+
* specified by width and height. The image will not be enlarged. For images
|
|
43
|
+
* smaller than the given dimensions it's the same as scale-down. For
|
|
44
|
+
* images larger than the given dimensions, it's the same as cover.
|
|
45
|
+
* See also trim.
|
|
42
46
|
* - pad: Resizes to the maximum size that fits within the given width and
|
|
43
47
|
* height, and then fills the remaining area with a background color
|
|
44
48
|
* (white by default). Use of this mode is not recommended, as the same
|
|
@@ -49,7 +53,7 @@ interface BasicImageTransformations {
|
|
|
49
53
|
/**
|
|
50
54
|
* When cropping with fit: "cover", this defines the side or point that should
|
|
51
55
|
* be left uncropped. The value is either a string
|
|
52
|
-
* "left", "right", "top", "bottom" or "center" (the default),
|
|
56
|
+
* "left", "right", "top", "bottom", "auto", or "center" (the default),
|
|
53
57
|
* or an object {x, y} containing focal point coordinates in the original
|
|
54
58
|
* image expressed as fractions ranging from 0.0 (top or left) to 1.0
|
|
55
59
|
* (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will
|
|
@@ -58,7 +62,14 @@ interface BasicImageTransformations {
|
|
|
58
62
|
* preserve as much as possible around a point at 20% of the height of the
|
|
59
63
|
* source image.
|
|
60
64
|
*/
|
|
61
|
-
gravity?:
|
|
65
|
+
gravity?:
|
|
66
|
+
| "left"
|
|
67
|
+
| "right"
|
|
68
|
+
| "top"
|
|
69
|
+
| "bottom"
|
|
70
|
+
| "center"
|
|
71
|
+
| "auto"
|
|
72
|
+
| BasicImageTransformationsGravityCoordinates;
|
|
62
73
|
/**
|
|
63
74
|
* Background color to add underneath the image. Applies only to images with
|
|
64
75
|
* transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),
|
|
@@ -103,7 +114,13 @@ declare abstract class Body {
|
|
|
103
114
|
blob(): Promise<Blob>;
|
|
104
115
|
}
|
|
105
116
|
|
|
106
|
-
declare type BodyInit =
|
|
117
|
+
declare type BodyInit =
|
|
118
|
+
| ReadableStream
|
|
119
|
+
| string
|
|
120
|
+
| ArrayBuffer
|
|
121
|
+
| Blob
|
|
122
|
+
| URLSearchParams
|
|
123
|
+
| FormData;
|
|
107
124
|
|
|
108
125
|
/**
|
|
109
126
|
* Back compat for code migrating to older definitions.
|
|
@@ -112,8 +129,14 @@ declare type BodyInit = ReadableStream | string | ArrayBuffer | Blob | URLSearch
|
|
|
112
129
|
declare type BodyInitializer = BodyInit;
|
|
113
130
|
|
|
114
131
|
declare abstract class Cache {
|
|
115
|
-
delete(
|
|
116
|
-
|
|
132
|
+
delete(
|
|
133
|
+
request: Request | string,
|
|
134
|
+
options?: CacheQueryOptions
|
|
135
|
+
): Promise<boolean>;
|
|
136
|
+
match(
|
|
137
|
+
request: Request | string,
|
|
138
|
+
options?: CacheQueryOptions
|
|
139
|
+
): Promise<Response | undefined>;
|
|
117
140
|
put(request: Request | string, response: Response): Promise<void>;
|
|
118
141
|
}
|
|
119
142
|
|
|
@@ -180,7 +203,15 @@ interface ContentOptions {
|
|
|
180
203
|
|
|
181
204
|
declare abstract class Crypto {
|
|
182
205
|
readonly subtle: SubtleCrypto;
|
|
183
|
-
getRandomValues
|
|
206
|
+
getRandomValues<
|
|
207
|
+
T extends
|
|
208
|
+
| Int8Array
|
|
209
|
+
| Uint8Array
|
|
210
|
+
| Int16Array
|
|
211
|
+
| Uint16Array
|
|
212
|
+
| Int32Array
|
|
213
|
+
| Uint32Array
|
|
214
|
+
>(buffer: T): T;
|
|
184
215
|
randomUUID(): string;
|
|
185
216
|
}
|
|
186
217
|
|
|
@@ -196,7 +227,14 @@ interface CryptoKeyAesKeyAlgorithm {
|
|
|
196
227
|
length: number;
|
|
197
228
|
}
|
|
198
229
|
|
|
199
|
-
declare type CryptoKeyAlgorithmVariant =
|
|
230
|
+
declare type CryptoKeyAlgorithmVariant =
|
|
231
|
+
| CryptoKeyKeyAlgorithm
|
|
232
|
+
| CryptoKeyAesKeyAlgorithm
|
|
233
|
+
| CryptoKeyHmacKeyAlgorithm
|
|
234
|
+
| CryptoKeyRsaKeyAlgorithm
|
|
235
|
+
| CryptoKeyEllipticKeyAlgorithm
|
|
236
|
+
| CryptoKeyVoprfKeyAlgorithm
|
|
237
|
+
| CryptoKeyOprfKeyAlgorithm;
|
|
200
238
|
|
|
201
239
|
interface CryptoKeyEllipticKeyAlgorithm {
|
|
202
240
|
name: string;
|
|
@@ -266,6 +304,11 @@ declare class DOMException extends Error {
|
|
|
266
304
|
static readonly DATA_CLONE_ERR: number;
|
|
267
305
|
}
|
|
268
306
|
|
|
307
|
+
declare class DigestStream extends WritableStream {
|
|
308
|
+
constructor(algorithm: string | SubtleCryptoHashAlgorithm);
|
|
309
|
+
readonly digest: Promise<ArrayBuffer>;
|
|
310
|
+
}
|
|
311
|
+
|
|
269
312
|
interface Doctype {
|
|
270
313
|
readonly name: string | null;
|
|
271
314
|
readonly publicId: string | null;
|
|
@@ -280,14 +323,31 @@ interface DurableObject {
|
|
|
280
323
|
fetch(request: Request): Promise<Response>;
|
|
281
324
|
}
|
|
282
325
|
|
|
326
|
+
interface DurableObjectGetOptions {
|
|
327
|
+
allowConcurrency?: boolean;
|
|
328
|
+
noCache?: boolean;
|
|
329
|
+
}
|
|
330
|
+
|
|
283
331
|
interface DurableObjectId {
|
|
284
332
|
toString(): string;
|
|
285
333
|
equals(other: DurableObjectId): boolean;
|
|
286
334
|
readonly name?: string;
|
|
287
335
|
}
|
|
288
336
|
|
|
337
|
+
interface DurableObjectListOptions {
|
|
338
|
+
start?: string;
|
|
339
|
+
end?: string;
|
|
340
|
+
prefix?: string;
|
|
341
|
+
reverse?: boolean;
|
|
342
|
+
limit?: number;
|
|
343
|
+
allowConcurrency?: boolean;
|
|
344
|
+
noCache?: boolean;
|
|
345
|
+
}
|
|
346
|
+
|
|
289
347
|
interface DurableObjectNamespace {
|
|
290
|
-
newUniqueId(
|
|
348
|
+
newUniqueId(
|
|
349
|
+
options?: DurableObjectNamespaceNewUniqueIdOptions
|
|
350
|
+
): DurableObjectId;
|
|
291
351
|
idFromName(name: string): DurableObjectId;
|
|
292
352
|
idFromString(id: string): DurableObjectId;
|
|
293
353
|
get(id: DurableObjectId): DurableObjectStub;
|
|
@@ -297,6 +357,12 @@ interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
|
297
357
|
jurisdiction?: string;
|
|
298
358
|
}
|
|
299
359
|
|
|
360
|
+
interface DurableObjectPutOptions {
|
|
361
|
+
allowConcurrency?: boolean;
|
|
362
|
+
allowUnconfirmed?: boolean;
|
|
363
|
+
noCache?: boolean;
|
|
364
|
+
}
|
|
365
|
+
|
|
300
366
|
interface DurableObjectState {
|
|
301
367
|
waitUntil(promise: Promise<any>): void;
|
|
302
368
|
readonly id: DurableObjectId | string;
|
|
@@ -305,37 +371,52 @@ interface DurableObjectState {
|
|
|
305
371
|
}
|
|
306
372
|
|
|
307
373
|
interface DurableObjectStorage {
|
|
308
|
-
get<T = unknown>(
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
374
|
+
get<T = unknown>(
|
|
375
|
+
key: string,
|
|
376
|
+
options?: DurableObjectGetOptions
|
|
377
|
+
): Promise<T | undefined>;
|
|
378
|
+
get<T = unknown>(
|
|
379
|
+
keys: string[],
|
|
380
|
+
options?: DurableObjectGetOptions
|
|
381
|
+
): Promise<Map<string, T>>;
|
|
382
|
+
list<T = unknown>(
|
|
383
|
+
options?: DurableObjectListOptions
|
|
384
|
+
): Promise<Map<string, T>>;
|
|
385
|
+
put<T>(
|
|
386
|
+
key: string,
|
|
387
|
+
value: T,
|
|
388
|
+
options?: DurableObjectPutOptions
|
|
389
|
+
): Promise<void>;
|
|
390
|
+
put<T>(
|
|
391
|
+
entries: Record<string, T>,
|
|
392
|
+
options?: DurableObjectPutOptions
|
|
393
|
+
): Promise<void>;
|
|
394
|
+
delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
|
|
395
|
+
delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
|
|
396
|
+
deleteAll(options?: DurableObjectPutOptions): Promise<void>;
|
|
397
|
+
transaction<T>(
|
|
398
|
+
closure: (txn: DurableObjectTransaction) => Promise<T>
|
|
399
|
+
): Promise<T>;
|
|
322
400
|
}
|
|
323
401
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
limit?: number;
|
|
330
|
-
allowConcurrency?: boolean;
|
|
331
|
-
noCache?: boolean;
|
|
332
|
-
}
|
|
402
|
+
/**
|
|
403
|
+
*
|
|
404
|
+
* @deprecated Don't use. Introduced incidentally in 3.x. Scheduled for removal.
|
|
405
|
+
*/
|
|
406
|
+
declare type DurableObjectStorageOperationsGetOptions = DurableObjectGetOptions;
|
|
333
407
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
408
|
+
/**
|
|
409
|
+
*
|
|
410
|
+
* @deprecated Don't use. Introduced incidentally in 3.x. Scheduled for removal.
|
|
411
|
+
*/
|
|
412
|
+
declare type DurableObjectStorageOperationsListOptions =
|
|
413
|
+
DurableObjectListOptions;
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
*
|
|
417
|
+
* @deprecated Don't use. Introduced incidentally in 3.x. Scheduled for removal.
|
|
418
|
+
*/
|
|
419
|
+
declare type DurableObjectStorageOperationsPutOptions = DurableObjectPutOptions;
|
|
339
420
|
|
|
340
421
|
interface DurableObjectStub extends Fetcher {
|
|
341
422
|
readonly id: DurableObjectId;
|
|
@@ -343,13 +424,25 @@ interface DurableObjectStub extends Fetcher {
|
|
|
343
424
|
}
|
|
344
425
|
|
|
345
426
|
interface DurableObjectTransaction {
|
|
346
|
-
get<T = unknown>(key: string, options?:
|
|
347
|
-
get<T = unknown>(
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
427
|
+
get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T>;
|
|
428
|
+
get<T = unknown>(
|
|
429
|
+
keys: string[],
|
|
430
|
+
options?: DurableObjectGetOptions
|
|
431
|
+
): Promise<Map<string, T>>;
|
|
432
|
+
list<T = unknown>(
|
|
433
|
+
options?: DurableObjectListOptions
|
|
434
|
+
): Promise<Map<string, T>>;
|
|
435
|
+
put<T>(
|
|
436
|
+
key: string,
|
|
437
|
+
value: T,
|
|
438
|
+
options?: DurableObjectPutOptions
|
|
439
|
+
): Promise<void>;
|
|
440
|
+
put<T>(
|
|
441
|
+
entries: Record<string, T>,
|
|
442
|
+
options?: DurableObjectPutOptions
|
|
443
|
+
): Promise<void>;
|
|
444
|
+
delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
|
|
445
|
+
delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
|
|
353
446
|
rollback(): void;
|
|
354
447
|
}
|
|
355
448
|
|
|
@@ -370,6 +463,14 @@ interface Element {
|
|
|
370
463
|
remove(): Element;
|
|
371
464
|
removeAndKeepContent(): Element;
|
|
372
465
|
setInnerContent(content: Content, options?: ContentOptions): Element;
|
|
466
|
+
onEndTag(handler: Function): void;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
interface EndTag {
|
|
470
|
+
name: string;
|
|
471
|
+
before(content: Content, options?: ContentOptions): EndTag;
|
|
472
|
+
after(content: Content, options?: ContentOptions): EndTag;
|
|
473
|
+
remove(): EndTag;
|
|
373
474
|
}
|
|
374
475
|
|
|
375
476
|
declare class Event {
|
|
@@ -402,18 +503,32 @@ interface EventInit {
|
|
|
402
503
|
composed?: boolean;
|
|
403
504
|
}
|
|
404
505
|
|
|
405
|
-
declare type EventListener<EventType extends Event = Event> = (
|
|
506
|
+
declare type EventListener<EventType extends Event = Event> = (
|
|
507
|
+
event: EventType
|
|
508
|
+
) => void;
|
|
406
509
|
|
|
407
510
|
interface EventListenerObject<EventType extends Event = Event> {
|
|
408
511
|
handleEvent(event: EventType): void;
|
|
409
512
|
}
|
|
410
513
|
|
|
411
|
-
declare type EventListenerOrEventListenerObject<
|
|
514
|
+
declare type EventListenerOrEventListenerObject<
|
|
515
|
+
EventType extends Event = Event
|
|
516
|
+
> = EventListener<EventType> | EventListenerObject<EventType>;
|
|
412
517
|
|
|
413
|
-
declare class EventTarget<
|
|
518
|
+
declare class EventTarget<
|
|
519
|
+
EventMap extends Record<string, Event> = Record<string, Event>
|
|
520
|
+
> {
|
|
414
521
|
constructor();
|
|
415
|
-
addEventListener<Type extends keyof EventMap>(
|
|
416
|
-
|
|
522
|
+
addEventListener<Type extends keyof EventMap>(
|
|
523
|
+
type: Type,
|
|
524
|
+
handler: EventListenerOrEventListenerObject<EventMap[Type]>,
|
|
525
|
+
options?: EventTargetAddEventListenerOptions | boolean
|
|
526
|
+
): void;
|
|
527
|
+
removeEventListener<Type extends keyof EventMap>(
|
|
528
|
+
type: Type,
|
|
529
|
+
handler: EventListenerOrEventListenerObject<EventMap[Type]>,
|
|
530
|
+
options?: EventTargetEventListenerOptions | boolean
|
|
531
|
+
): void;
|
|
417
532
|
dispatchEvent(event: EventMap[keyof EventMap]): boolean;
|
|
418
533
|
}
|
|
419
534
|
|
|
@@ -438,9 +553,17 @@ interface ExportedHandler<Env = unknown> {
|
|
|
438
553
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
439
554
|
}
|
|
440
555
|
|
|
441
|
-
declare type ExportedHandlerFetchHandler<Env = unknown> = (
|
|
556
|
+
declare type ExportedHandlerFetchHandler<Env = unknown> = (
|
|
557
|
+
request: Request,
|
|
558
|
+
env: Env,
|
|
559
|
+
ctx: ExecutionContext
|
|
560
|
+
) => Response | Promise<Response>;
|
|
442
561
|
|
|
443
|
-
declare type ExportedHandlerScheduledHandler<Env = unknown> = (
|
|
562
|
+
declare type ExportedHandlerScheduledHandler<Env = unknown> = (
|
|
563
|
+
controller: ScheduledController,
|
|
564
|
+
env: Env,
|
|
565
|
+
ctx: ExecutionContext
|
|
566
|
+
) => void | Promise<void>;
|
|
444
567
|
|
|
445
568
|
declare abstract class FetchEvent extends Event {
|
|
446
569
|
readonly request: Request;
|
|
@@ -450,7 +573,10 @@ declare abstract class FetchEvent extends Event {
|
|
|
450
573
|
}
|
|
451
574
|
|
|
452
575
|
declare abstract class Fetcher {
|
|
453
|
-
fetch(
|
|
576
|
+
fetch(
|
|
577
|
+
requestOrUrl: Request | string,
|
|
578
|
+
requestInit?: RequestInit | Request
|
|
579
|
+
): Promise<Response>;
|
|
454
580
|
}
|
|
455
581
|
|
|
456
582
|
declare class File extends Blob {
|
|
@@ -478,16 +604,27 @@ declare class FormData {
|
|
|
478
604
|
has(name: string): boolean;
|
|
479
605
|
set(name: string, value: string): void;
|
|
480
606
|
set(name: string, value: Blob, filename?: string): void;
|
|
481
|
-
entries(): IterableIterator<
|
|
607
|
+
entries(): IterableIterator<[key: string, value: File | string][]>;
|
|
482
608
|
keys(): IterableIterator<string>;
|
|
483
609
|
values(): IterableIterator<File | string>;
|
|
484
|
-
forEach<This = unknown>(
|
|
485
|
-
|
|
610
|
+
forEach<This = unknown>(
|
|
611
|
+
callback: (
|
|
612
|
+
this: This,
|
|
613
|
+
key: string,
|
|
614
|
+
value: File | string,
|
|
615
|
+
parent: FormData
|
|
616
|
+
) => void,
|
|
617
|
+
thisArg?: This
|
|
618
|
+
): void;
|
|
619
|
+
[Symbol.iterator](): IterableIterator<[key: string, value: File | string][]>;
|
|
486
620
|
}
|
|
487
621
|
|
|
488
622
|
declare class HTMLRewriter {
|
|
489
623
|
constructor();
|
|
490
|
-
on(
|
|
624
|
+
on(
|
|
625
|
+
selector: string,
|
|
626
|
+
handlers: HTMLRewriterElementContentHandlers
|
|
627
|
+
): HTMLRewriter;
|
|
491
628
|
onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;
|
|
492
629
|
transform(response: Response): Response;
|
|
493
630
|
}
|
|
@@ -513,14 +650,20 @@ declare class Headers {
|
|
|
513
650
|
set(name: string, value: string): void;
|
|
514
651
|
append(name: string, value: string): void;
|
|
515
652
|
delete(name: string): void;
|
|
516
|
-
forEach<This = unknown>(
|
|
653
|
+
forEach<This = unknown>(
|
|
654
|
+
callback: (this: This, key: string, value: string, parent: Headers) => void,
|
|
655
|
+
thisArg?: This
|
|
656
|
+
): void;
|
|
517
657
|
entries(): IterableIterator<[key: string, value: string]>;
|
|
518
658
|
keys(): IterableIterator<string>;
|
|
519
659
|
values(): IterableIterator<string>;
|
|
520
660
|
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
|
|
521
661
|
}
|
|
522
662
|
|
|
523
|
-
declare type HeadersInit =
|
|
663
|
+
declare type HeadersInit =
|
|
664
|
+
| Headers
|
|
665
|
+
| Record<string, string>
|
|
666
|
+
| [key: string, value: string][];
|
|
524
667
|
|
|
525
668
|
/**
|
|
526
669
|
* Back compat for code migrating to older definitions.
|
|
@@ -532,7 +675,7 @@ declare type HeadersInitializer = HeadersInit;
|
|
|
532
675
|
* In addition to the properties on the standard Request object,
|
|
533
676
|
* the cf object contains extra information about the request provided
|
|
534
677
|
* by Cloudflare's edge.
|
|
535
|
-
*
|
|
678
|
+
*
|
|
536
679
|
* Note: Currently, settings in the cf object cannot be accessed in the
|
|
537
680
|
* playground.
|
|
538
681
|
*/
|
|
@@ -618,21 +761,59 @@ interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
|
618
761
|
certVerified: string;
|
|
619
762
|
}
|
|
620
763
|
|
|
764
|
+
interface JsonWebKey {
|
|
765
|
+
kty: string;
|
|
766
|
+
use?: string;
|
|
767
|
+
key_ops?: string[];
|
|
768
|
+
alg?: string;
|
|
769
|
+
ext?: boolean;
|
|
770
|
+
crv?: string;
|
|
771
|
+
x?: string;
|
|
772
|
+
y?: string;
|
|
773
|
+
d?: string;
|
|
774
|
+
n?: string;
|
|
775
|
+
e?: string;
|
|
776
|
+
p?: string;
|
|
777
|
+
q?: string;
|
|
778
|
+
dp?: string;
|
|
779
|
+
dq?: string;
|
|
780
|
+
qi?: string;
|
|
781
|
+
oth?: RsaOtherPrimesInfo[];
|
|
782
|
+
k?: string;
|
|
783
|
+
}
|
|
784
|
+
|
|
621
785
|
/**
|
|
622
786
|
* Workers KV is a global, low-latency, key-value data store. It supports exceptionally high read volumes with low-latency,
|
|
623
787
|
* making it possible to build highly dynamic APIs and websites which respond as quickly as a cached static file would.
|
|
624
788
|
*/
|
|
625
|
-
interface KVNamespace {
|
|
626
|
-
get(
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
get(key:
|
|
631
|
-
get
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
789
|
+
interface KVNamespace<K extends string = string> {
|
|
790
|
+
get(
|
|
791
|
+
key: K,
|
|
792
|
+
options?: Partial<KVNamespaceGetOptions<undefined>>
|
|
793
|
+
): Promise<string | null>;
|
|
794
|
+
get(key: K, type: "text"): Promise<string | null>;
|
|
795
|
+
get<ExpectedValue = unknown>(
|
|
796
|
+
key: K,
|
|
797
|
+
type: "json"
|
|
798
|
+
): Promise<ExpectedValue | null>;
|
|
799
|
+
get(key: K, type: "arrayBuffer"): Promise<ArrayBuffer | null>;
|
|
800
|
+
get(key: K, type: "stream"): Promise<ReadableStream | null>;
|
|
801
|
+
get(key: K, options: KVNamespaceGetOptions<"text">): Promise<string | null>;
|
|
802
|
+
get<ExpectedValue = unknown>(
|
|
803
|
+
key: string,
|
|
804
|
+
options: KVNamespaceGetOptions<"json">
|
|
805
|
+
): Promise<ExpectedValue | null>;
|
|
806
|
+
get(
|
|
807
|
+
key: K,
|
|
808
|
+
options: KVNamespaceGetOptions<"arrayBuffer">
|
|
809
|
+
): Promise<ArrayBuffer | null>;
|
|
810
|
+
get(
|
|
811
|
+
key: K,
|
|
812
|
+
options: KVNamespaceGetOptions<"stream">
|
|
813
|
+
): Promise<ReadableStream | null>;
|
|
814
|
+
list<Metadata = unknown>(
|
|
815
|
+
options?: KVNamespaceListOptions
|
|
816
|
+
): Promise<KVNamespaceListResult<Metadata>>;
|
|
636
817
|
/**
|
|
637
818
|
* Creates a new key-value pair, or updates the value for a particular key.
|
|
638
819
|
* @param key key to associate with the value. A key cannot be empty, `.` or `..`. All other keys are valid.
|
|
@@ -641,16 +822,47 @@ interface KVNamespace {
|
|
|
641
822
|
* @example
|
|
642
823
|
* await NAMESPACE.put(key, value)
|
|
643
824
|
*/
|
|
644
|
-
put(
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
getWithMetadata<Metadata = unknown>(
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
getWithMetadata<Metadata = unknown>(
|
|
825
|
+
put(
|
|
826
|
+
key: K,
|
|
827
|
+
value: string | ArrayBuffer | ArrayBufferView | ReadableStream,
|
|
828
|
+
options?: KVNamespacePutOptions
|
|
829
|
+
): Promise<void>;
|
|
830
|
+
getWithMetadata<Metadata = unknown>(
|
|
831
|
+
key: K,
|
|
832
|
+
options?: Partial<KVNamespaceGetOptions<undefined>>
|
|
833
|
+
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
834
|
+
getWithMetadata<Metadata = unknown>(
|
|
835
|
+
key: K,
|
|
836
|
+
type: "text"
|
|
837
|
+
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
838
|
+
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
|
|
839
|
+
key: K,
|
|
840
|
+
type: "json"
|
|
841
|
+
): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
|
|
842
|
+
getWithMetadata<Metadata = unknown>(
|
|
843
|
+
key: K,
|
|
844
|
+
type: "arrayBuffer"
|
|
845
|
+
): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
|
|
846
|
+
getWithMetadata<Metadata = unknown>(
|
|
847
|
+
key: K,
|
|
848
|
+
type: "stream"
|
|
849
|
+
): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
|
|
850
|
+
getWithMetadata<Metadata = unknown>(
|
|
851
|
+
key: K,
|
|
852
|
+
options: KVNamespaceGetOptions<"text">
|
|
853
|
+
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
854
|
+
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
|
|
855
|
+
key: K,
|
|
856
|
+
options: KVNamespaceGetOptions<"json">
|
|
857
|
+
): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
|
|
858
|
+
getWithMetadata<Metadata = unknown>(
|
|
859
|
+
key: K,
|
|
860
|
+
options: KVNamespaceGetOptions<"arrayBuffer">
|
|
861
|
+
): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
|
|
862
|
+
getWithMetadata<Metadata = unknown>(
|
|
863
|
+
key: K,
|
|
864
|
+
options: KVNamespaceGetOptions<"stream">
|
|
865
|
+
): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
|
|
654
866
|
delete(name: string): Promise<void>;
|
|
655
867
|
}
|
|
656
868
|
|
|
@@ -723,23 +935,60 @@ interface ReadResult {
|
|
|
723
935
|
done: boolean;
|
|
724
936
|
}
|
|
725
937
|
|
|
726
|
-
declare abstract class
|
|
938
|
+
declare abstract class ReadableByteStreamController {
|
|
939
|
+
readonly byobRequest: ReadableStreamBYOBRequest | null;
|
|
940
|
+
readonly desiredSize: number | null;
|
|
941
|
+
close(): void;
|
|
942
|
+
enqueue(chunk: ArrayBufferView): void;
|
|
943
|
+
error(reason: any): void;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
declare class ReadableStream {
|
|
947
|
+
constructor(underlyingSource?: Object, queuingStrategy?: Object);
|
|
727
948
|
readonly locked: boolean;
|
|
728
949
|
cancel(reason?: any): Promise<void>;
|
|
729
950
|
getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
|
|
730
951
|
getReader(): ReadableStreamDefaultReader;
|
|
731
|
-
pipeThrough(
|
|
952
|
+
pipeThrough(
|
|
953
|
+
transform: ReadableStreamTransform,
|
|
954
|
+
options?: PipeToOptions
|
|
955
|
+
): ReadableStream;
|
|
732
956
|
pipeTo(destination: WritableStream, options?: PipeToOptions): Promise<void>;
|
|
733
957
|
tee(): [ReadableStream, ReadableStream];
|
|
958
|
+
values(
|
|
959
|
+
options?: ReadableStreamValuesOptions
|
|
960
|
+
): AsyncIterableIterator<ReadableStreamReadResult>;
|
|
961
|
+
[Symbol.asyncIterator](
|
|
962
|
+
options?: ReadableStreamValuesOptions
|
|
963
|
+
): AsyncIterableIterator<ReadableStreamReadResult>;
|
|
734
964
|
}
|
|
735
965
|
|
|
736
966
|
declare class ReadableStreamBYOBReader {
|
|
737
967
|
constructor(stream: ReadableStream);
|
|
738
968
|
readonly closed: Promise<void>;
|
|
739
969
|
cancel(reason?: any): Promise<void>;
|
|
740
|
-
read<T extends ArrayBufferView>(
|
|
970
|
+
read<T extends ArrayBufferView>(
|
|
971
|
+
view: T
|
|
972
|
+
): Promise<ReadableStreamReadResult<T>>;
|
|
741
973
|
releaseLock(): void;
|
|
742
|
-
readAtLeast(
|
|
974
|
+
readAtLeast(
|
|
975
|
+
minBytes: number,
|
|
976
|
+
view: Uint8Array
|
|
977
|
+
): Promise<ReadableStreamReadResult<Uint8Array>>;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
declare abstract class ReadableStreamBYOBRequest {
|
|
981
|
+
readonly view: Uint8Array | null;
|
|
982
|
+
respond(bytesWritten: number): void;
|
|
983
|
+
respondWithNewView(view: ArrayBufferView): void;
|
|
984
|
+
readonly atLeast: number | null;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
declare abstract class ReadableStreamDefaultController {
|
|
988
|
+
readonly desiredSize: number | null;
|
|
989
|
+
close(): void;
|
|
990
|
+
enqueue(chunk?: any): void;
|
|
991
|
+
error(reason: any): void;
|
|
743
992
|
}
|
|
744
993
|
|
|
745
994
|
declare class ReadableStreamDefaultReader {
|
|
@@ -760,7 +1009,9 @@ interface ReadableStreamGetReaderOptions {
|
|
|
760
1009
|
*/
|
|
761
1010
|
declare type ReadableStreamPipeToOptions = PipeToOptions;
|
|
762
1011
|
|
|
763
|
-
declare type ReadableStreamReadResult<T = any> =
|
|
1012
|
+
declare type ReadableStreamReadResult<T = any> =
|
|
1013
|
+
| { done: true; value: undefined }
|
|
1014
|
+
| { done: false; value: T };
|
|
764
1015
|
|
|
765
1016
|
/**
|
|
766
1017
|
* Back-compat alias.
|
|
@@ -772,13 +1023,18 @@ declare type ReadableStreamReadableStreamBYOBReader = ReadableStreamBYOBReader;
|
|
|
772
1023
|
* Back-compat alias.
|
|
773
1024
|
* @deprecated Use ReadableStreamDefaultReader
|
|
774
1025
|
*/
|
|
775
|
-
declare type ReadableStreamReadableStreamDefaultReader =
|
|
1026
|
+
declare type ReadableStreamReadableStreamDefaultReader =
|
|
1027
|
+
ReadableStreamDefaultReader;
|
|
776
1028
|
|
|
777
1029
|
interface ReadableStreamTransform {
|
|
778
1030
|
writable: WritableStream;
|
|
779
1031
|
readable: ReadableStream;
|
|
780
1032
|
}
|
|
781
1033
|
|
|
1034
|
+
interface ReadableStreamValuesOptions {
|
|
1035
|
+
preventCancel?: boolean;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
782
1038
|
declare class Request extends Body {
|
|
783
1039
|
constructor(input: Request | string, init?: RequestInit | Request);
|
|
784
1040
|
clone(): Request;
|
|
@@ -800,10 +1056,10 @@ interface RequestInit {
|
|
|
800
1056
|
/**
|
|
801
1057
|
* cf is a union of these two types because there are multiple
|
|
802
1058
|
* scenarios in which it might be one or the other.
|
|
803
|
-
*
|
|
1059
|
+
*
|
|
804
1060
|
* IncomingRequestCfProperties is required to allow
|
|
805
1061
|
* new Request(someUrl, event.request)
|
|
806
|
-
*
|
|
1062
|
+
*
|
|
807
1063
|
* RequestInitCfProperties is required to allow
|
|
808
1064
|
* new Request(event.request, {cf: { ... } })
|
|
809
1065
|
* fetch(someUrl, {cf: { ... } })
|
|
@@ -817,7 +1073,7 @@ interface RequestInit {
|
|
|
817
1073
|
* that you pass as an argument to the Request constructor, you can
|
|
818
1074
|
* set certain properties of a `cf` object to control how Cloudflare
|
|
819
1075
|
* features are applied to that new Request.
|
|
820
|
-
*
|
|
1076
|
+
*
|
|
821
1077
|
* Note: Currently, these properties cannot be tested in the
|
|
822
1078
|
* playground.
|
|
823
1079
|
*/
|
|
@@ -828,7 +1084,7 @@ interface RequestInitCfProperties {
|
|
|
828
1084
|
* "the same" for caching purposes. If a request has the same cache key
|
|
829
1085
|
* as some previous request, then we can serve the same cached response for
|
|
830
1086
|
* both. (e.g. 'some-key')
|
|
831
|
-
*
|
|
1087
|
+
*
|
|
832
1088
|
* Only available for Enterprise customers.
|
|
833
1089
|
*/
|
|
834
1090
|
cacheKey?: string;
|
|
@@ -846,11 +1102,12 @@ interface RequestInitCfProperties {
|
|
|
846
1102
|
image?: RequestInitCfPropertiesImage;
|
|
847
1103
|
minify?: RequestInitCfPropertiesImageMinify;
|
|
848
1104
|
mirage?: boolean;
|
|
1105
|
+
polish?: "lossy" | "lossless" | "off";
|
|
849
1106
|
/**
|
|
850
1107
|
* Redirects the request to an alternate origin server. You can use this,
|
|
851
1108
|
* for example, to implement load balancing across several origins.
|
|
852
1109
|
* (e.g.us-east.example.com)
|
|
853
|
-
*
|
|
1110
|
+
*
|
|
854
1111
|
* Note - For security reasons, the hostname set in resolveOverride must
|
|
855
1112
|
* be proxied on the same Cloudflare zone of the incoming request.
|
|
856
1113
|
* Otherwise, the setting is ignored. CNAME hosts are allowed, so to
|
|
@@ -868,6 +1125,13 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
|
|
|
868
1125
|
* easier to specify higher-DPI sizes in <img srcset>.
|
|
869
1126
|
*/
|
|
870
1127
|
dpr?: number;
|
|
1128
|
+
/**
|
|
1129
|
+
* An object with four properties {left, top, right, bottom} that specify
|
|
1130
|
+
* a number of pixels to cut off on each side. Allows removal of borders
|
|
1131
|
+
* or cutting out a specific fragment of an image. Trimming is performed
|
|
1132
|
+
* before resizing or rotation. Takes dpr into account.
|
|
1133
|
+
*/
|
|
1134
|
+
trim?: { left?: number; top?: number; right?: number; bottom?: number };
|
|
871
1135
|
/**
|
|
872
1136
|
* Quality setting from 1-100 (useful values are in 60-90 range). Lower values
|
|
873
1137
|
* make images look worse, but load faster. The default is 85. It applies only
|
|
@@ -884,6 +1148,15 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
|
|
|
884
1148
|
* (before and after resizing), source image’s MIME type, file size, etc.
|
|
885
1149
|
*/
|
|
886
1150
|
format?: "avif" | "webp" | "json";
|
|
1151
|
+
/**
|
|
1152
|
+
* Whether to preserve animation frames from input files. Default is true.
|
|
1153
|
+
* Setting it to false reduces animations to still images. This setting is
|
|
1154
|
+
* recommended when enlarging images or processing arbitrary user content,
|
|
1155
|
+
* because large GIF animations can weigh tens or even hundreds of megabytes.
|
|
1156
|
+
* It is also useful to set anim:false when using format:"json" to get the
|
|
1157
|
+
* response quicker without the number of frames.
|
|
1158
|
+
*/
|
|
1159
|
+
anim?: boolean;
|
|
887
1160
|
/**
|
|
888
1161
|
* What EXIF data should be preserved in the output image. Note that EXIF
|
|
889
1162
|
* rotation and embedded color profiles are always applied ("baked in" into
|
|
@@ -898,6 +1171,17 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
|
|
|
898
1171
|
* output formats always discard metadata.
|
|
899
1172
|
*/
|
|
900
1173
|
metadata?: "keep" | "copyright" | "none";
|
|
1174
|
+
/**
|
|
1175
|
+
* Strength of sharpening filter to apply to the image. Floating-point
|
|
1176
|
+
* number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a
|
|
1177
|
+
* recommended value for downscaled images.
|
|
1178
|
+
*/
|
|
1179
|
+
sharpen?: number;
|
|
1180
|
+
/**
|
|
1181
|
+
* Radius of a blur filter (approximate gaussian). Maximum supported radius
|
|
1182
|
+
* is 250.
|
|
1183
|
+
*/
|
|
1184
|
+
blur?: number;
|
|
901
1185
|
/**
|
|
902
1186
|
* Overlays are drawn in the order they appear in the array (last array
|
|
903
1187
|
* entry is the topmost layer).
|
|
@@ -932,9 +1216,9 @@ interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
|
|
|
932
1216
|
* positions left side of the overlay 10 pixels from the left edge of the
|
|
933
1217
|
* image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom
|
|
934
1218
|
* of the background image.
|
|
935
|
-
*
|
|
1219
|
+
*
|
|
936
1220
|
* Setting both left & right, or both top & bottom is an error.
|
|
937
|
-
*
|
|
1221
|
+
*
|
|
938
1222
|
* If no position is specified, the image will be centered.
|
|
939
1223
|
*/
|
|
940
1224
|
top?: number;
|
|
@@ -984,6 +1268,12 @@ interface ResponseInit {
|
|
|
984
1268
|
*/
|
|
985
1269
|
declare type ResponseInitializerDict = ResponseInit;
|
|
986
1270
|
|
|
1271
|
+
interface RsaOtherPrimesInfo {
|
|
1272
|
+
r?: string;
|
|
1273
|
+
d?: string;
|
|
1274
|
+
t?: string;
|
|
1275
|
+
}
|
|
1276
|
+
|
|
987
1277
|
interface ScheduledController {
|
|
988
1278
|
readonly scheduledTime: number;
|
|
989
1279
|
readonly cron: string;
|
|
@@ -997,19 +1287,48 @@ declare abstract class ScheduledEvent extends Event {
|
|
|
997
1287
|
waitUntil(promise: Promise<any>): void;
|
|
998
1288
|
}
|
|
999
1289
|
|
|
1290
|
+
interface Scheduler {
|
|
1291
|
+
wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise<void>;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
interface SchedulerWaitOptions {
|
|
1295
|
+
signal?: AbortSignal;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1000
1298
|
interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
1001
1299
|
btoa(data: string): string;
|
|
1002
1300
|
atob(data: string): string;
|
|
1003
|
-
setTimeout<Args extends any[]>(
|
|
1301
|
+
setTimeout<Args extends any[]>(
|
|
1302
|
+
callback: (...args: Args) => void,
|
|
1303
|
+
msDelay?: number,
|
|
1304
|
+
...args: Args
|
|
1305
|
+
): number;
|
|
1004
1306
|
clearTimeout(timeoutId: number | null): void;
|
|
1005
|
-
setInterval<Args extends any[]>(
|
|
1307
|
+
setInterval<Args extends any[]>(
|
|
1308
|
+
callback: (...args: Args) => void,
|
|
1309
|
+
msDelay?: number,
|
|
1310
|
+
...args: Args
|
|
1311
|
+
): number;
|
|
1006
1312
|
clearInterval(timeoutId: number | null): void;
|
|
1007
1313
|
queueMicrotask(task: Function): void;
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1314
|
+
structuredClone(
|
|
1315
|
+
value: any,
|
|
1316
|
+
options?: ServiceWorkerGlobalScopeStructuredCloneOptions
|
|
1317
|
+
): any;
|
|
1318
|
+
fetch(
|
|
1319
|
+
request: Request | string,
|
|
1320
|
+
requestInitr?: RequestInit | Request
|
|
1321
|
+
): Promise<Response>;
|
|
1322
|
+
self: ServiceWorkerGlobalScope;
|
|
1323
|
+
crypto: Crypto;
|
|
1324
|
+
caches: CacheStorage;
|
|
1325
|
+
scheduler: Scheduler;
|
|
1012
1326
|
readonly console: Console;
|
|
1327
|
+
origin: void;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
interface ServiceWorkerGlobalScopeStructuredCloneOptions {
|
|
1331
|
+
transfer?: any[];
|
|
1013
1332
|
}
|
|
1014
1333
|
|
|
1015
1334
|
declare type StreamPipeOptions = PipeToOptions;
|
|
@@ -1020,18 +1339,71 @@ interface StreamQueuingStrategy {
|
|
|
1020
1339
|
}
|
|
1021
1340
|
|
|
1022
1341
|
declare abstract class SubtleCrypto {
|
|
1023
|
-
encrypt(
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1342
|
+
encrypt(
|
|
1343
|
+
algorithm: string | SubtleCryptoEncryptAlgorithm,
|
|
1344
|
+
key: CryptoKey,
|
|
1345
|
+
plainText: ArrayBuffer
|
|
1346
|
+
): Promise<ArrayBuffer>;
|
|
1347
|
+
decrypt(
|
|
1348
|
+
algorithm: string | SubtleCryptoEncryptAlgorithm,
|
|
1349
|
+
key: CryptoKey,
|
|
1350
|
+
cipherText: ArrayBuffer
|
|
1351
|
+
): Promise<ArrayBuffer>;
|
|
1352
|
+
sign(
|
|
1353
|
+
algorithm: string | SubtleCryptoSignAlgorithm,
|
|
1354
|
+
key: CryptoKey,
|
|
1355
|
+
data: ArrayBuffer
|
|
1356
|
+
): Promise<ArrayBuffer>;
|
|
1357
|
+
verify(
|
|
1358
|
+
algorithm: string | SubtleCryptoSignAlgorithm,
|
|
1359
|
+
key: CryptoKey,
|
|
1360
|
+
signature: ArrayBuffer,
|
|
1361
|
+
data: ArrayBuffer
|
|
1362
|
+
): Promise<boolean>;
|
|
1363
|
+
digest(
|
|
1364
|
+
algorithm: string | SubtleCryptoHashAlgorithm,
|
|
1365
|
+
data: ArrayBuffer
|
|
1366
|
+
): Promise<ArrayBuffer>;
|
|
1367
|
+
generateKey(
|
|
1368
|
+
algorithm: string | SubtleCryptoGenerateKeyAlgorithm,
|
|
1369
|
+
extractable: boolean,
|
|
1370
|
+
keyUsages: string[]
|
|
1371
|
+
): Promise<CryptoKey | CryptoKeyPair>;
|
|
1372
|
+
deriveKey(
|
|
1373
|
+
algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
|
|
1374
|
+
baseKey: CryptoKey,
|
|
1375
|
+
derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
|
|
1376
|
+
extractable: boolean,
|
|
1377
|
+
keyUsages: string[]
|
|
1378
|
+
): Promise<CryptoKey>;
|
|
1379
|
+
deriveBits(
|
|
1380
|
+
algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
|
|
1381
|
+
baseKey: CryptoKey,
|
|
1382
|
+
length: number | null
|
|
1383
|
+
): Promise<ArrayBuffer>;
|
|
1384
|
+
importKey(
|
|
1385
|
+
format: string,
|
|
1386
|
+
keyData: ArrayBuffer | JsonWebKey,
|
|
1387
|
+
algorithm: string | SubtleCryptoImportKeyAlgorithm,
|
|
1388
|
+
extractable: boolean,
|
|
1389
|
+
keyUsages: string[]
|
|
1390
|
+
): Promise<CryptoKey>;
|
|
1391
|
+
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
|
|
1392
|
+
wrapKey(
|
|
1393
|
+
format: string,
|
|
1394
|
+
key: CryptoKey,
|
|
1395
|
+
wrappingKey: CryptoKey,
|
|
1396
|
+
wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm
|
|
1397
|
+
): Promise<ArrayBuffer>;
|
|
1398
|
+
unwrapKey(
|
|
1399
|
+
format: string,
|
|
1400
|
+
wrappedKey: ArrayBuffer,
|
|
1401
|
+
unwrappingKey: CryptoKey,
|
|
1402
|
+
unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
|
|
1403
|
+
unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
|
|
1404
|
+
extractable: boolean,
|
|
1405
|
+
keyUsages: string[]
|
|
1406
|
+
): Promise<CryptoKey>;
|
|
1035
1407
|
}
|
|
1036
1408
|
|
|
1037
1409
|
interface SubtleCryptoDeriveKeyAlgorithm {
|
|
@@ -1074,32 +1446,17 @@ interface SubtleCryptoImportKeyAlgorithm {
|
|
|
1074
1446
|
compressed?: boolean;
|
|
1075
1447
|
}
|
|
1076
1448
|
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
ext?: boolean;
|
|
1083
|
-
crv?: string;
|
|
1084
|
-
x?: string;
|
|
1085
|
-
y?: string;
|
|
1086
|
-
d?: string;
|
|
1087
|
-
n?: string;
|
|
1088
|
-
e?: string;
|
|
1089
|
-
p?: string;
|
|
1090
|
-
q?: string;
|
|
1091
|
-
dp?: string;
|
|
1092
|
-
dq?: string;
|
|
1093
|
-
qi?: string;
|
|
1094
|
-
oth?: SubtleCryptoJsonWebKeyRsaOtherPrimesInfo[];
|
|
1095
|
-
k?: string;
|
|
1096
|
-
}
|
|
1449
|
+
/**
|
|
1450
|
+
*
|
|
1451
|
+
* @deprecated Don't use. Introduced incidentally in 3.x. Scheduled for removal.
|
|
1452
|
+
*/
|
|
1453
|
+
declare type SubtleCryptoJsonWebKey = JsonWebKey;
|
|
1097
1454
|
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1455
|
+
/**
|
|
1456
|
+
*
|
|
1457
|
+
* @deprecated Don't use. Introduced incidentally in 3.x. Scheduled for removal.
|
|
1458
|
+
*/
|
|
1459
|
+
declare type SubtleCryptoJsonWebKeyRsaOtherPrimesInfo = RsaOtherPrimesInfo;
|
|
1103
1460
|
|
|
1104
1461
|
interface SubtleCryptoSignAlgorithm {
|
|
1105
1462
|
name: string;
|
|
@@ -1119,7 +1476,10 @@ interface Text {
|
|
|
1119
1476
|
}
|
|
1120
1477
|
|
|
1121
1478
|
declare class TextDecoder {
|
|
1122
|
-
constructor(
|
|
1479
|
+
constructor(
|
|
1480
|
+
label?: "utf-8" | "utf8" | "unicode-1-1-utf-8",
|
|
1481
|
+
options?: TextDecoderConstructorOptions
|
|
1482
|
+
);
|
|
1123
1483
|
decode(input?: ArrayBuffer, options?: TextDecoderDecodeOptions): string;
|
|
1124
1484
|
readonly encoding: string;
|
|
1125
1485
|
readonly fatal: boolean;
|
|
@@ -1183,12 +1543,24 @@ declare class URLSearchParams {
|
|
|
1183
1543
|
entries(): IterableIterator<[key: string, value: string]>;
|
|
1184
1544
|
keys(): IterableIterator<string>;
|
|
1185
1545
|
values(): IterableIterator<string>;
|
|
1186
|
-
forEach<This = unknown>(
|
|
1546
|
+
forEach<This = unknown>(
|
|
1547
|
+
callback: (
|
|
1548
|
+
this: This,
|
|
1549
|
+
key: string,
|
|
1550
|
+
value: string,
|
|
1551
|
+
parent: URLSearchParams
|
|
1552
|
+
) => void,
|
|
1553
|
+
thisArg?: This
|
|
1554
|
+
): void;
|
|
1187
1555
|
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
|
|
1188
1556
|
toString(): string;
|
|
1189
1557
|
}
|
|
1190
1558
|
|
|
1191
|
-
declare type URLSearchParamsInit =
|
|
1559
|
+
declare type URLSearchParamsInit =
|
|
1560
|
+
| URLSearchParams
|
|
1561
|
+
| string
|
|
1562
|
+
| Record<string, string>
|
|
1563
|
+
| [key: string, value: string][];
|
|
1192
1564
|
|
|
1193
1565
|
/**
|
|
1194
1566
|
* Back compat for code migrating to older definitions.
|
|
@@ -1204,26 +1576,40 @@ declare abstract class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1204
1576
|
close(code?: number, reason?: string): void;
|
|
1205
1577
|
}
|
|
1206
1578
|
|
|
1207
|
-
declare type WebSocketEventMap = {
|
|
1208
|
-
|
|
1209
|
-
|
|
1579
|
+
declare type WebSocketEventMap = {
|
|
1580
|
+
close: CloseEvent;
|
|
1581
|
+
message: MessageEvent;
|
|
1582
|
+
error: Event;
|
|
1583
|
+
};
|
|
1210
1584
|
|
|
1211
|
-
declare
|
|
1585
|
+
declare const WebSocketPair: { new (): { 0: WebSocket; 1: WebSocket } };
|
|
1212
1586
|
|
|
1213
|
-
}
|
|
1587
|
+
declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {}
|
|
1214
1588
|
|
|
1215
|
-
declare type WorkerGlobalScopeEventMap = {
|
|
1589
|
+
declare type WorkerGlobalScopeEventMap = {
|
|
1590
|
+
fetch: FetchEvent;
|
|
1591
|
+
scheduled: ScheduledEvent;
|
|
1592
|
+
unhandledrejection: PromiseRejectionEvent;
|
|
1593
|
+
rejectionhandled: PromiseRejectionEvent;
|
|
1594
|
+
};
|
|
1216
1595
|
|
|
1217
|
-
declare
|
|
1596
|
+
declare class WritableStream {
|
|
1597
|
+
constructor(underlyingSink?: Object, queuingStrategy?: Object);
|
|
1218
1598
|
readonly locked: boolean;
|
|
1219
1599
|
abort(reason: any): Promise<void>;
|
|
1220
1600
|
close(): Promise<void>;
|
|
1221
1601
|
getWriter(): WritableStreamDefaultWriter;
|
|
1222
1602
|
}
|
|
1223
1603
|
|
|
1604
|
+
declare abstract class WritableStreamDefaultController {
|
|
1605
|
+
readonly signal: AbortSignal;
|
|
1606
|
+
error(reason?: any): void;
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1224
1609
|
declare class WritableStreamDefaultWriter {
|
|
1225
1610
|
constructor(stream: WritableStream);
|
|
1226
1611
|
readonly closed: Promise<void>;
|
|
1612
|
+
readonly ready: Promise<void>;
|
|
1227
1613
|
readonly desiredSize: number | null;
|
|
1228
1614
|
abort(reason: any): Promise<void>;
|
|
1229
1615
|
close(): Promise<void>;
|
|
@@ -1235,9 +1621,14 @@ declare class WritableStreamDefaultWriter {
|
|
|
1235
1621
|
* Back-compat alias.
|
|
1236
1622
|
* @deprecated Use WritableStreamDefaultWriter
|
|
1237
1623
|
*/
|
|
1238
|
-
declare type WritableStreamWritableStreamDefaultWriter =
|
|
1624
|
+
declare type WritableStreamWritableStreamDefaultWriter =
|
|
1625
|
+
WritableStreamDefaultWriter;
|
|
1239
1626
|
|
|
1240
|
-
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
|
|
1627
|
+
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
|
|
1628
|
+
type: Type,
|
|
1629
|
+
handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
|
|
1630
|
+
options?: EventTargetAddEventListenerOptions | boolean
|
|
1631
|
+
): void;
|
|
1241
1632
|
|
|
1242
1633
|
declare function atob(data: string): string;
|
|
1243
1634
|
|
|
@@ -1253,17 +1644,62 @@ declare const console: Console;
|
|
|
1253
1644
|
|
|
1254
1645
|
declare const crypto: Crypto;
|
|
1255
1646
|
|
|
1256
|
-
declare function dispatchEvent(
|
|
1647
|
+
declare function dispatchEvent(
|
|
1648
|
+
event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]
|
|
1649
|
+
): boolean;
|
|
1257
1650
|
|
|
1258
|
-
declare function fetch(
|
|
1651
|
+
declare function fetch(
|
|
1652
|
+
request: Request | string,
|
|
1653
|
+
requestInitr?: RequestInit | Request
|
|
1654
|
+
): Promise<Response>;
|
|
1259
1655
|
|
|
1260
|
-
declare
|
|
1656
|
+
declare const origin: void;
|
|
1261
1657
|
|
|
1262
|
-
declare function
|
|
1658
|
+
declare function queueMicrotask(task: Function): void;
|
|
1263
1659
|
|
|
1264
|
-
declare
|
|
1660
|
+
declare function removeEventListener<
|
|
1661
|
+
Type extends keyof WorkerGlobalScopeEventMap
|
|
1662
|
+
>(
|
|
1663
|
+
type: Type,
|
|
1664
|
+
handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
|
|
1665
|
+
options?: EventTargetEventListenerOptions | boolean
|
|
1666
|
+
): void;
|
|
1265
1667
|
|
|
1266
|
-
declare
|
|
1668
|
+
declare const scheduler: Scheduler;
|
|
1267
1669
|
|
|
1268
|
-
declare
|
|
1670
|
+
declare const self: ServiceWorkerGlobalScope;
|
|
1269
1671
|
|
|
1672
|
+
declare function setInterval<Args extends any[]>(
|
|
1673
|
+
callback: (...args: Args) => void,
|
|
1674
|
+
msDelay?: number,
|
|
1675
|
+
...args: Args
|
|
1676
|
+
): number;
|
|
1677
|
+
|
|
1678
|
+
declare function setTimeout<Args extends any[]>(
|
|
1679
|
+
callback: (...args: Args) => void,
|
|
1680
|
+
msDelay?: number,
|
|
1681
|
+
...args: Args
|
|
1682
|
+
): number;
|
|
1683
|
+
|
|
1684
|
+
declare function structuredClone(
|
|
1685
|
+
value: any,
|
|
1686
|
+
options?: ServiceWorkerGlobalScopeStructuredCloneOptions
|
|
1687
|
+
): any;
|
|
1688
|
+
|
|
1689
|
+
/*** Injected pages.d.ts ***/
|
|
1690
|
+
type Params<P extends string = any> = Record<P, string | string[]>;
|
|
1691
|
+
|
|
1692
|
+
type EventContext<Env, P extends string, Data> = {
|
|
1693
|
+
request: Request;
|
|
1694
|
+
waitUntil: (promise: Promise<any>) => void;
|
|
1695
|
+
next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
|
|
1696
|
+
env: Env & { ASSETS: { fetch: typeof fetch } };
|
|
1697
|
+
params: Params<P>;
|
|
1698
|
+
data: Data;
|
|
1699
|
+
};
|
|
1700
|
+
|
|
1701
|
+
declare type PagesFunction<
|
|
1702
|
+
Env = unknown,
|
|
1703
|
+
Params extends string = any,
|
|
1704
|
+
Data extends Record<string, unknown> = Record<string, unknown>
|
|
1705
|
+
> = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/workers-types",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.3.1",
|
|
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": {
|
|
23
|
+
"@changesets/changelog-github": "^0.4.2",
|
|
24
|
+
"@changesets/cli": "^2.18.1",
|
|
21
25
|
"@types/marked": "^3.0.0",
|
|
22
26
|
"@types/node": "^16.6.1",
|
|
23
27
|
"esbuild": "^0.12.22",
|
|
24
28
|
"esbuild-register": "^3.0.0",
|
|
25
29
|
"marked": "^3.0.2",
|
|
26
|
-
"prettier": "2.
|
|
30
|
+
"prettier": "^2.5.1",
|
|
27
31
|
"typescript": "^4.3.5"
|
|
28
32
|
}
|
|
29
33
|
}
|