@cloudflare/workers-types 3.0.0 → 3.1.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 +198 -124
- package/package.json +1 -1
- package/CHANGELOG.md +0 -282
package/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// This file is auto-generated. DO NOT MODIFY.
|
|
2
|
+
// Please refer to the Auto-Generation section of the README.md.
|
|
3
|
+
|
|
1
4
|
declare class AbortController {
|
|
2
5
|
constructor();
|
|
3
6
|
readonly signal: AbortSignal;
|
|
@@ -100,7 +103,13 @@ declare abstract class Body {
|
|
|
100
103
|
blob(): Promise<Blob>;
|
|
101
104
|
}
|
|
102
105
|
|
|
103
|
-
declare type
|
|
106
|
+
declare type BodyInit = ReadableStream | string | ArrayBuffer | Blob | URLSearchParams | FormData;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Back compat for code migrating to older definitions.
|
|
110
|
+
* @deprecated Use BodyInit instead.
|
|
111
|
+
*/
|
|
112
|
+
declare type BodyInitializer = BodyInit;
|
|
104
113
|
|
|
105
114
|
declare abstract class Cache {
|
|
106
115
|
delete(request: Request | string, options?: CacheQueryOptions): Promise<boolean>;
|
|
@@ -117,24 +126,36 @@ declare abstract class CacheStorage {
|
|
|
117
126
|
readonly default: Cache;
|
|
118
127
|
}
|
|
119
128
|
|
|
120
|
-
interface
|
|
129
|
+
interface CfRequestInit extends Omit<RequestInit, "cf"> {
|
|
121
130
|
cf?: RequestInitCfProperties;
|
|
122
131
|
}
|
|
123
132
|
|
|
133
|
+
/**
|
|
134
|
+
* Back compat support with older types.
|
|
135
|
+
* @deprecated Use CfRequestInit instead.
|
|
136
|
+
*/
|
|
137
|
+
declare type CfRequestInitializerDict = CfRequestInit;
|
|
138
|
+
|
|
124
139
|
declare class CloseEvent extends Event {
|
|
125
|
-
constructor(type: string, initializer:
|
|
140
|
+
constructor(type: string, initializer: CloseEventInit);
|
|
126
141
|
readonly code: number;
|
|
127
142
|
readonly reason: string;
|
|
128
143
|
readonly wasClean: boolean;
|
|
129
144
|
}
|
|
130
145
|
|
|
131
|
-
interface
|
|
146
|
+
interface CloseEventInit {
|
|
132
147
|
code?: number;
|
|
133
148
|
reason?: string;
|
|
134
149
|
wasClean?: boolean;
|
|
135
150
|
}
|
|
136
151
|
|
|
137
|
-
|
|
152
|
+
/**
|
|
153
|
+
* Back compat for code migrating from older definitions.
|
|
154
|
+
* @deprecated Use CloseEventInit instead.
|
|
155
|
+
*/
|
|
156
|
+
declare type CloseEventInitializer = CloseEventInit;
|
|
157
|
+
|
|
158
|
+
interface Comment {
|
|
138
159
|
text: string;
|
|
139
160
|
readonly removed: boolean;
|
|
140
161
|
before(content: Content, options?: ContentOptions): Comment;
|
|
@@ -245,13 +266,13 @@ declare class DOMException extends Error {
|
|
|
245
266
|
static readonly DATA_CLONE_ERR: number;
|
|
246
267
|
}
|
|
247
268
|
|
|
248
|
-
|
|
269
|
+
interface Doctype {
|
|
249
270
|
readonly name: string | null;
|
|
250
271
|
readonly publicId: string | null;
|
|
251
272
|
readonly systemId: string | null;
|
|
252
273
|
}
|
|
253
274
|
|
|
254
|
-
|
|
275
|
+
interface DocumentEnd {
|
|
255
276
|
append(content: Content, options?: ContentOptions): DocumentEnd;
|
|
256
277
|
}
|
|
257
278
|
|
|
@@ -259,13 +280,13 @@ interface DurableObject {
|
|
|
259
280
|
fetch(request: Request): Promise<Response>;
|
|
260
281
|
}
|
|
261
282
|
|
|
262
|
-
|
|
283
|
+
interface DurableObjectId {
|
|
263
284
|
toString(): string;
|
|
264
285
|
equals(other: DurableObjectId): boolean;
|
|
265
286
|
readonly name?: string;
|
|
266
287
|
}
|
|
267
288
|
|
|
268
|
-
|
|
289
|
+
interface DurableObjectNamespace {
|
|
269
290
|
newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId;
|
|
270
291
|
idFromName(name: string): DurableObjectId;
|
|
271
292
|
idFromString(id: string): DurableObjectId;
|
|
@@ -276,14 +297,14 @@ interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
|
276
297
|
jurisdiction?: string;
|
|
277
298
|
}
|
|
278
299
|
|
|
279
|
-
|
|
280
|
-
waitUntil(promise: Promise<
|
|
300
|
+
interface DurableObjectState {
|
|
301
|
+
waitUntil(promise: Promise<any>): void;
|
|
281
302
|
readonly id: DurableObjectId | string;
|
|
282
|
-
readonly storage
|
|
303
|
+
readonly storage: DurableObjectStorage;
|
|
283
304
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
284
305
|
}
|
|
285
306
|
|
|
286
|
-
|
|
307
|
+
interface DurableObjectStorage {
|
|
287
308
|
get<T = unknown>(key: string, options?: DurableObjectStorageOperationsGetOptions): Promise<T | undefined>;
|
|
288
309
|
get<T = unknown>(keys: string[], options?: DurableObjectStorageOperationsGetOptions): Promise<Map<string, T>>;
|
|
289
310
|
list<T = unknown>(options?: DurableObjectStorageOperationsListOptions): Promise<Map<string, T>>;
|
|
@@ -316,12 +337,12 @@ interface DurableObjectStorageOperationsPutOptions {
|
|
|
316
337
|
noCache?: boolean;
|
|
317
338
|
}
|
|
318
339
|
|
|
319
|
-
|
|
340
|
+
interface DurableObjectStub extends Fetcher {
|
|
320
341
|
readonly id: DurableObjectId;
|
|
321
342
|
readonly name?: string;
|
|
322
343
|
}
|
|
323
344
|
|
|
324
|
-
|
|
345
|
+
interface DurableObjectTransaction {
|
|
325
346
|
get<T = unknown>(key: string, options?: DurableObjectStorageOperationsGetOptions): Promise<T>;
|
|
326
347
|
get<T = unknown>(keys: string[], options?: DurableObjectStorageOperationsGetOptions): Promise<Map<string, T>>;
|
|
327
348
|
list<T = unknown>(options?: DurableObjectStorageOperationsListOptions): Promise<Map<string, T>>;
|
|
@@ -332,7 +353,7 @@ declare abstract class DurableObjectTransaction {
|
|
|
332
353
|
rollback(): void;
|
|
333
354
|
}
|
|
334
355
|
|
|
335
|
-
|
|
356
|
+
interface Element {
|
|
336
357
|
tagName: string;
|
|
337
358
|
readonly attributes: IterableIterator<string[]>;
|
|
338
359
|
readonly removed: boolean;
|
|
@@ -400,14 +421,15 @@ interface EventTargetAddEventListenerOptions {
|
|
|
400
421
|
capture?: boolean;
|
|
401
422
|
passive?: boolean;
|
|
402
423
|
once?: boolean;
|
|
424
|
+
signal?: AbortSignal;
|
|
403
425
|
}
|
|
404
426
|
|
|
405
427
|
interface EventTargetEventListenerOptions {
|
|
406
428
|
capture?: boolean;
|
|
407
429
|
}
|
|
408
430
|
|
|
409
|
-
|
|
410
|
-
waitUntil(promise: Promise<
|
|
431
|
+
interface ExecutionContext {
|
|
432
|
+
waitUntil(promise: Promise<any>): void;
|
|
411
433
|
passThroughOnException(): void;
|
|
412
434
|
}
|
|
413
435
|
|
|
@@ -420,16 +442,15 @@ declare type ExportedHandlerFetchHandler<Env = unknown> = (request: Request, env
|
|
|
420
442
|
|
|
421
443
|
declare type ExportedHandlerScheduledHandler<Env = unknown> = (controller: ScheduledController, env: Env, ctx: ExecutionContext) => void | Promise<void>;
|
|
422
444
|
|
|
423
|
-
declare class FetchEvent extends Event {
|
|
424
|
-
constructor(type: string);
|
|
445
|
+
declare abstract class FetchEvent extends Event {
|
|
425
446
|
readonly request: Request;
|
|
426
447
|
respondWith(promise: Response | Promise<Response>): void;
|
|
427
448
|
passThroughOnException(): void;
|
|
428
|
-
waitUntil(promise: Promise<
|
|
449
|
+
waitUntil(promise: Promise<any>): void;
|
|
429
450
|
}
|
|
430
451
|
|
|
431
452
|
declare abstract class Fetcher {
|
|
432
|
-
fetch(requestOrUrl: Request | string, requestInit?:
|
|
453
|
+
fetch(requestOrUrl: Request | string, requestInit?: RequestInit | Request): Promise<Response>;
|
|
433
454
|
}
|
|
434
455
|
|
|
435
456
|
declare class File extends Blob {
|
|
@@ -485,7 +506,7 @@ interface HTMLRewriterElementContentHandlers {
|
|
|
485
506
|
}
|
|
486
507
|
|
|
487
508
|
declare class Headers {
|
|
488
|
-
constructor(init?:
|
|
509
|
+
constructor(init?: HeadersInit);
|
|
489
510
|
get(name: string): string | null;
|
|
490
511
|
getAll(name: string): string[];
|
|
491
512
|
has(name: string): boolean;
|
|
@@ -499,13 +520,19 @@ declare class Headers {
|
|
|
499
520
|
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
|
|
500
521
|
}
|
|
501
522
|
|
|
502
|
-
declare type
|
|
523
|
+
declare type HeadersInit = Headers | Record<string, string> | ([key: string, value: string])[];
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Back compat for code migrating to older definitions.
|
|
527
|
+
* @deprecated Use HeadersInit instead.
|
|
528
|
+
*/
|
|
529
|
+
declare type HeadersInitializer = HeadersInit;
|
|
503
530
|
|
|
504
531
|
/**
|
|
505
532
|
* In addition to the properties on the standard Request object,
|
|
506
533
|
* the cf object contains extra information about the request provided
|
|
507
534
|
* by Cloudflare's edge.
|
|
508
|
-
*
|
|
535
|
+
*
|
|
509
536
|
* Note: Currently, settings in the cf object cannot be accessed in the
|
|
510
537
|
* playground.
|
|
511
538
|
*/
|
|
@@ -514,6 +541,11 @@ interface IncomingRequestCfProperties {
|
|
|
514
541
|
* (e.g. 395747)
|
|
515
542
|
*/
|
|
516
543
|
asn: number;
|
|
544
|
+
/**
|
|
545
|
+
* The organisation which owns the ASN of the incoming request.
|
|
546
|
+
* (e.g. Google Cloud)
|
|
547
|
+
*/
|
|
548
|
+
asOrganization: string;
|
|
517
549
|
botManagement?: IncomingRequestCfPropertiesBotManagement;
|
|
518
550
|
city?: string;
|
|
519
551
|
clientTcpRtt: number;
|
|
@@ -590,7 +622,7 @@ interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
|
590
622
|
* Workers KV is a global, low-latency, key-value data store. It supports exceptionally high read volumes with low-latency,
|
|
591
623
|
* making it possible to build highly dynamic APIs and websites which respond as quickly as a cached static file would.
|
|
592
624
|
*/
|
|
593
|
-
|
|
625
|
+
interface KVNamespace {
|
|
594
626
|
get(key: string, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<string | null>;
|
|
595
627
|
get(key: string, type: "text"): Promise<string | null>;
|
|
596
628
|
get<ExpectedValue = unknown>(key: string, type: "json"): Promise<ExpectedValue | null>;
|
|
@@ -657,52 +689,98 @@ interface KVNamespacePutOptions {
|
|
|
657
689
|
}
|
|
658
690
|
|
|
659
691
|
declare class MessageEvent extends Event {
|
|
660
|
-
constructor(type: string, initializer:
|
|
692
|
+
constructor(type: string, initializer: MessageEventInit);
|
|
661
693
|
readonly data: ArrayBuffer | string;
|
|
662
694
|
}
|
|
663
695
|
|
|
664
|
-
interface
|
|
696
|
+
interface MessageEventInit {
|
|
665
697
|
data: ArrayBuffer | string;
|
|
666
698
|
}
|
|
667
699
|
|
|
700
|
+
/**
|
|
701
|
+
* Back compat for code migrating from older definitions.
|
|
702
|
+
* @deprecated Use MessageEventInit instead.
|
|
703
|
+
*/
|
|
704
|
+
declare type MessageEventInitializer = MessageEventInit;
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* Transitionary name.
|
|
708
|
+
* @deprecated Use StreamPipeOptions
|
|
709
|
+
*/
|
|
710
|
+
interface PipeToOptions {
|
|
711
|
+
preventClose?: boolean;
|
|
712
|
+
preventAbort?: boolean;
|
|
713
|
+
preventCancel?: boolean;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
declare abstract class PromiseRejectionEvent extends Event {
|
|
717
|
+
readonly promise: Promise<any>;
|
|
718
|
+
readonly reason: any;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
interface ReadResult {
|
|
722
|
+
value?: any;
|
|
723
|
+
done: boolean;
|
|
724
|
+
}
|
|
725
|
+
|
|
668
726
|
declare abstract class ReadableStream {
|
|
669
727
|
readonly locked: boolean;
|
|
670
728
|
cancel(reason?: any): Promise<void>;
|
|
671
|
-
getReader(options
|
|
672
|
-
|
|
673
|
-
|
|
729
|
+
getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
|
|
730
|
+
getReader(): ReadableStreamDefaultReader;
|
|
731
|
+
pipeThrough(transform: ReadableStreamTransform, options?: PipeToOptions): ReadableStream;
|
|
732
|
+
pipeTo(destination: WritableStream, options?: PipeToOptions): Promise<void>;
|
|
674
733
|
tee(): [ReadableStream, ReadableStream];
|
|
675
734
|
}
|
|
676
735
|
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
preventCancel?: boolean;
|
|
736
|
+
declare class ReadableStreamBYOBReader {
|
|
737
|
+
constructor(stream: ReadableStream);
|
|
738
|
+
readonly closed: Promise<void>;
|
|
739
|
+
cancel(reason?: any): Promise<void>;
|
|
740
|
+
read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
|
|
741
|
+
releaseLock(): void;
|
|
742
|
+
readAtLeast(minBytes: number, view: Uint8Array): Promise<ReadableStreamReadResult<Uint8Array>>;
|
|
685
743
|
}
|
|
686
744
|
|
|
687
|
-
declare
|
|
745
|
+
declare class ReadableStreamDefaultReader {
|
|
746
|
+
constructor(stream: ReadableStream);
|
|
688
747
|
readonly closed: Promise<void>;
|
|
689
748
|
cancel(reason?: any): Promise<void>;
|
|
690
|
-
read(
|
|
749
|
+
read(): Promise<ReadableStreamReadResult<any>>;
|
|
691
750
|
releaseLock(): void;
|
|
692
751
|
}
|
|
693
752
|
|
|
694
|
-
interface
|
|
695
|
-
|
|
696
|
-
done: boolean;
|
|
753
|
+
interface ReadableStreamGetReaderOptions {
|
|
754
|
+
mode: string;
|
|
697
755
|
}
|
|
698
756
|
|
|
757
|
+
/**
|
|
758
|
+
* Back-compat alias.
|
|
759
|
+
* @deprecated Use StreamPipeOptions
|
|
760
|
+
*/
|
|
761
|
+
declare type ReadableStreamPipeToOptions = PipeToOptions;
|
|
762
|
+
|
|
763
|
+
declare type ReadableStreamReadResult<T = any> = { done: true; value: undefined; } | { done: false; value: T; };
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* Back-compat alias.
|
|
767
|
+
* @deprecated Use ReadableStreamBYOBReader
|
|
768
|
+
*/
|
|
769
|
+
declare type ReadableStreamReadableStreamBYOBReader = ReadableStreamBYOBReader;
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* Back-compat alias.
|
|
773
|
+
* @deprecated Use ReadableStreamDefaultReader
|
|
774
|
+
*/
|
|
775
|
+
declare type ReadableStreamReadableStreamDefaultReader = ReadableStreamDefaultReader;
|
|
776
|
+
|
|
699
777
|
interface ReadableStreamTransform {
|
|
700
778
|
writable: WritableStream;
|
|
701
779
|
readable: ReadableStream;
|
|
702
780
|
}
|
|
703
781
|
|
|
704
782
|
declare class Request extends Body {
|
|
705
|
-
constructor(input: Request | string, init?:
|
|
783
|
+
constructor(input: Request | string, init?: RequestInit | Request);
|
|
706
784
|
clone(): Request;
|
|
707
785
|
readonly method: string;
|
|
708
786
|
readonly url: string;
|
|
@@ -713,12 +791,33 @@ declare class Request extends Body {
|
|
|
713
791
|
readonly cf?: IncomingRequestCfProperties;
|
|
714
792
|
}
|
|
715
793
|
|
|
794
|
+
interface RequestInit {
|
|
795
|
+
method?: string;
|
|
796
|
+
headers?: HeadersInit;
|
|
797
|
+
body?: BodyInit | null;
|
|
798
|
+
redirect?: string;
|
|
799
|
+
fetcher?: Fetcher | null;
|
|
800
|
+
/**
|
|
801
|
+
* cf is a union of these two types because there are multiple
|
|
802
|
+
* scenarios in which it might be one or the other.
|
|
803
|
+
*
|
|
804
|
+
* IncomingRequestCfProperties is required to allow
|
|
805
|
+
* new Request(someUrl, event.request)
|
|
806
|
+
*
|
|
807
|
+
* RequestInitCfProperties is required to allow
|
|
808
|
+
* new Request(event.request, {cf: { ... } })
|
|
809
|
+
* fetch(someUrl, {cf: { ... } })
|
|
810
|
+
*/
|
|
811
|
+
cf?: IncomingRequestCfProperties | RequestInitCfProperties;
|
|
812
|
+
signal?: AbortSignal | null;
|
|
813
|
+
}
|
|
814
|
+
|
|
716
815
|
/**
|
|
717
816
|
* In addition to the properties you can set in the RequestInit dict
|
|
718
817
|
* that you pass as an argument to the Request constructor, you can
|
|
719
818
|
* set certain properties of a `cf` object to control how Cloudflare
|
|
720
819
|
* features are applied to that new Request.
|
|
721
|
-
*
|
|
820
|
+
*
|
|
722
821
|
* Note: Currently, these properties cannot be tested in the
|
|
723
822
|
* playground.
|
|
724
823
|
*/
|
|
@@ -729,7 +828,7 @@ interface RequestInitCfProperties {
|
|
|
729
828
|
* "the same" for caching purposes. If a request has the same cache key
|
|
730
829
|
* as some previous request, then we can serve the same cached response for
|
|
731
830
|
* both. (e.g. 'some-key')
|
|
732
|
-
*
|
|
831
|
+
*
|
|
733
832
|
* Only available for Enterprise customers.
|
|
734
833
|
*/
|
|
735
834
|
cacheKey?: string;
|
|
@@ -751,7 +850,7 @@ interface RequestInitCfProperties {
|
|
|
751
850
|
* Redirects the request to an alternate origin server. You can use this,
|
|
752
851
|
* for example, to implement load balancing across several origins.
|
|
753
852
|
* (e.g.us-east.example.com)
|
|
754
|
-
*
|
|
853
|
+
*
|
|
755
854
|
* Note - For security reasons, the hostname set in resolveOverride must
|
|
756
855
|
* be proxied on the same Cloudflare zone of the incoming request.
|
|
757
856
|
* Otherwise, the setting is ignored. CNAME hosts are allowed, so to
|
|
@@ -833,9 +932,9 @@ interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
|
|
|
833
932
|
* positions left side of the overlay 10 pixels from the left edge of the
|
|
834
933
|
* image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom
|
|
835
934
|
* of the background image.
|
|
836
|
-
*
|
|
935
|
+
*
|
|
837
936
|
* Setting both left & right, or both top & bottom is an error.
|
|
838
|
-
*
|
|
937
|
+
*
|
|
839
938
|
* If no position is specified, the image will be centered.
|
|
840
939
|
*/
|
|
841
940
|
top?: number;
|
|
@@ -850,29 +949,14 @@ interface RequestInitCfPropertiesImageMinify {
|
|
|
850
949
|
html?: boolean;
|
|
851
950
|
}
|
|
852
951
|
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
fetcher?: Fetcher | null;
|
|
859
|
-
/**
|
|
860
|
-
* cf is a union of these two types because there are multiple
|
|
861
|
-
* scenarios in which it might be one or the other.
|
|
862
|
-
*
|
|
863
|
-
* IncomingRequestCfProperties is required to allow
|
|
864
|
-
* new Request(someUrl, event.request)
|
|
865
|
-
*
|
|
866
|
-
* RequestInitCfProperties is required to allow
|
|
867
|
-
* new Request(event.request, {cf: { ... } })
|
|
868
|
-
* fetch(someUrl, {cf: { ... } })
|
|
869
|
-
*/
|
|
870
|
-
cf?: IncomingRequestCfProperties | RequestInitCfProperties;
|
|
871
|
-
signal?: AbortSignal | null;
|
|
872
|
-
}
|
|
952
|
+
/**
|
|
953
|
+
* Back compat for code migrating from older definitions.
|
|
954
|
+
* @deprecated Use RequestInit instead.
|
|
955
|
+
*/
|
|
956
|
+
declare type RequestInitializerDict = RequestInit;
|
|
873
957
|
|
|
874
958
|
declare class Response extends Body {
|
|
875
|
-
constructor(bodyInit?:
|
|
959
|
+
constructor(bodyInit?: BodyInit | null, maybeInit?: ResponseInit | Response);
|
|
876
960
|
static redirect(url: string, status?: number): Response;
|
|
877
961
|
clone(): Response;
|
|
878
962
|
readonly status: number;
|
|
@@ -885,33 +969,35 @@ declare class Response extends Body {
|
|
|
885
969
|
readonly cf?: Object;
|
|
886
970
|
}
|
|
887
971
|
|
|
888
|
-
interface
|
|
972
|
+
interface ResponseInit {
|
|
889
973
|
status?: number;
|
|
890
974
|
statusText?: string;
|
|
891
|
-
headers?:
|
|
975
|
+
headers?: HeadersInit;
|
|
892
976
|
cf?: Object;
|
|
893
977
|
webSocket?: WebSocket | null;
|
|
894
978
|
encodeBody?: string;
|
|
895
979
|
}
|
|
896
980
|
|
|
897
|
-
|
|
981
|
+
/**
|
|
982
|
+
* Back compat for code migrating from older definitions.
|
|
983
|
+
* @deprecated Use ResponseInit instead.
|
|
984
|
+
*/
|
|
985
|
+
declare type ResponseInitializerDict = ResponseInit;
|
|
986
|
+
|
|
987
|
+
interface ScheduledController {
|
|
898
988
|
readonly scheduledTime: number;
|
|
899
989
|
readonly cron: string;
|
|
900
990
|
noRetry(): void;
|
|
901
991
|
}
|
|
902
992
|
|
|
903
|
-
declare class ScheduledEvent extends Event {
|
|
904
|
-
constructor(type: string);
|
|
993
|
+
declare abstract class ScheduledEvent extends Event {
|
|
905
994
|
readonly scheduledTime: number;
|
|
906
995
|
readonly cron: string;
|
|
907
996
|
noRetry(): void;
|
|
908
|
-
waitUntil(promise: Promise<
|
|
997
|
+
waitUntil(promise: Promise<any>): void;
|
|
909
998
|
}
|
|
910
999
|
|
|
911
|
-
|
|
912
|
-
constructor();
|
|
913
|
-
static readonly DOMException: typeof DOMException;
|
|
914
|
-
static readonly WorkerGlobalScope: typeof WorkerGlobalScope;
|
|
1000
|
+
interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
915
1001
|
btoa(data: string): string;
|
|
916
1002
|
atob(data: string): string;
|
|
917
1003
|
setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
|
|
@@ -919,46 +1005,18 @@ declare class ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
919
1005
|
setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
|
|
920
1006
|
clearInterval(timeoutId: number | null): void;
|
|
921
1007
|
queueMicrotask(task: Function): void;
|
|
922
|
-
fetch(request: Request | string, requestInitr?:
|
|
1008
|
+
fetch(request: Request | string, requestInitr?: RequestInit | Request): Promise<Response>;
|
|
923
1009
|
readonly self: ServiceWorkerGlobalScope;
|
|
924
1010
|
readonly crypto: Crypto;
|
|
925
1011
|
readonly caches: CacheStorage;
|
|
926
|
-
static readonly Event: typeof Event;
|
|
927
|
-
static readonly FetchEvent: typeof FetchEvent;
|
|
928
|
-
static readonly ScheduledEvent: typeof ScheduledEvent;
|
|
929
|
-
static readonly MessageEvent: typeof MessageEvent;
|
|
930
|
-
static readonly CloseEvent: typeof CloseEvent;
|
|
931
|
-
static readonly ReadableStream: typeof ReadableStream;
|
|
932
|
-
static readonly WritableStream: typeof WritableStream;
|
|
933
|
-
static readonly TransformStream: typeof TransformStream;
|
|
934
|
-
static readonly Headers: typeof Headers;
|
|
935
|
-
static readonly Body: typeof Body;
|
|
936
|
-
static readonly Request: typeof Request;
|
|
937
|
-
static readonly Response: typeof Response;
|
|
938
|
-
static readonly WebSocket: typeof WebSocket;
|
|
939
|
-
static readonly WebSocketPair: typeof WebSocketPair;
|
|
940
|
-
static readonly AbortController: typeof AbortController;
|
|
941
|
-
static readonly AbortSignal: typeof AbortSignal;
|
|
942
|
-
static readonly TextDecoder: typeof TextDecoder;
|
|
943
|
-
static readonly TextEncoder: typeof TextEncoder;
|
|
944
|
-
static readonly URL: typeof URL;
|
|
945
|
-
static readonly URLSearchParams: typeof URLSearchParams;
|
|
946
|
-
static readonly Blob: typeof Blob;
|
|
947
|
-
static readonly File: typeof File;
|
|
948
|
-
static readonly FormData: typeof FormData;
|
|
949
|
-
static readonly Crypto: typeof Crypto;
|
|
950
|
-
static readonly SubtleCrypto: typeof SubtleCrypto;
|
|
951
|
-
static readonly CryptoKey: typeof CryptoKey;
|
|
952
|
-
static readonly CacheStorage: typeof CacheStorage;
|
|
953
|
-
static readonly Cache: typeof Cache;
|
|
954
|
-
static readonly FixedLengthStream: typeof FixedLengthStream;
|
|
955
|
-
static readonly HTMLRewriter: typeof HTMLRewriter;
|
|
956
1012
|
readonly console: Console;
|
|
957
1013
|
}
|
|
958
1014
|
|
|
1015
|
+
declare type StreamPipeOptions = PipeToOptions;
|
|
1016
|
+
|
|
959
1017
|
interface StreamQueuingStrategy {
|
|
960
|
-
highWaterMark
|
|
961
|
-
size(
|
|
1018
|
+
highWaterMark?: number;
|
|
1019
|
+
size(chunk: ArrayBuffer): number;
|
|
962
1020
|
}
|
|
963
1021
|
|
|
964
1022
|
declare abstract class SubtleCrypto {
|
|
@@ -1050,7 +1108,7 @@ interface SubtleCryptoSignAlgorithm {
|
|
|
1050
1108
|
saltLength?: number;
|
|
1051
1109
|
}
|
|
1052
1110
|
|
|
1053
|
-
|
|
1111
|
+
interface Text {
|
|
1054
1112
|
readonly text: string;
|
|
1055
1113
|
readonly lastInTextNode: boolean;
|
|
1056
1114
|
readonly removed: boolean;
|
|
@@ -1114,7 +1172,7 @@ declare class URL {
|
|
|
1114
1172
|
}
|
|
1115
1173
|
|
|
1116
1174
|
declare class URLSearchParams {
|
|
1117
|
-
constructor(init?:
|
|
1175
|
+
constructor(init?: URLSearchParamsInit);
|
|
1118
1176
|
append(name: string, value: string): void;
|
|
1119
1177
|
delete(name: string): void;
|
|
1120
1178
|
get(name: string): string | null;
|
|
@@ -1130,7 +1188,15 @@ declare class URLSearchParams {
|
|
|
1130
1188
|
toString(): string;
|
|
1131
1189
|
}
|
|
1132
1190
|
|
|
1133
|
-
declare type
|
|
1191
|
+
declare type URLSearchParamsInit = URLSearchParams | string | Record<string, string> | ([key: string, value: string])[];
|
|
1192
|
+
|
|
1193
|
+
/**
|
|
1194
|
+
* Back compat for code migrating to older definitions.
|
|
1195
|
+
* This technically isn't part of a standard either way, but the naming
|
|
1196
|
+
* is more consistent.
|
|
1197
|
+
* @deprecated Use URLSearchParamsInit instead.
|
|
1198
|
+
*/
|
|
1199
|
+
declare type URLSearchParamsInitializer = URLSearchParamsInit;
|
|
1134
1200
|
|
|
1135
1201
|
declare abstract class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
1136
1202
|
accept(): void;
|
|
@@ -1142,20 +1208,21 @@ declare type WebSocketEventMap = { close: CloseEvent; message: MessageEvent; };
|
|
|
1142
1208
|
|
|
1143
1209
|
declare const WebSocketPair: { new(): { 0: WebSocket; 1: WebSocket; }; };
|
|
1144
1210
|
|
|
1145
|
-
declare class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {
|
|
1146
|
-
|
|
1147
|
-
static readonly EventTarget: typeof EventTarget;
|
|
1211
|
+
declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {
|
|
1212
|
+
|
|
1148
1213
|
}
|
|
1149
1214
|
|
|
1150
|
-
declare type WorkerGlobalScopeEventMap = { fetch: FetchEvent; scheduled: ScheduledEvent; };
|
|
1215
|
+
declare type WorkerGlobalScopeEventMap = { fetch: FetchEvent; scheduled: ScheduledEvent; unhandledrejection: PromiseRejectionEvent; rejectionhandled: PromiseRejectionEvent; };
|
|
1151
1216
|
|
|
1152
1217
|
declare abstract class WritableStream {
|
|
1153
1218
|
readonly locked: boolean;
|
|
1154
1219
|
abort(reason: any): Promise<void>;
|
|
1155
|
-
|
|
1220
|
+
close(): Promise<void>;
|
|
1221
|
+
getWriter(): WritableStreamDefaultWriter;
|
|
1156
1222
|
}
|
|
1157
1223
|
|
|
1158
|
-
declare
|
|
1224
|
+
declare class WritableStreamDefaultWriter {
|
|
1225
|
+
constructor(stream: WritableStream);
|
|
1159
1226
|
readonly closed: Promise<void>;
|
|
1160
1227
|
readonly desiredSize: number | null;
|
|
1161
1228
|
abort(reason: any): Promise<void>;
|
|
@@ -1164,6 +1231,12 @@ declare abstract class WritableStreamWriter {
|
|
|
1164
1231
|
releaseLock(): void;
|
|
1165
1232
|
}
|
|
1166
1233
|
|
|
1234
|
+
/**
|
|
1235
|
+
* Back-compat alias.
|
|
1236
|
+
* @deprecated Use WritableStreamDefaultWriter
|
|
1237
|
+
*/
|
|
1238
|
+
declare type WritableStreamWritableStreamDefaultWriter = WritableStreamDefaultWriter;
|
|
1239
|
+
|
|
1167
1240
|
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
|
|
1168
1241
|
|
|
1169
1242
|
declare function atob(data: string): string;
|
|
@@ -1182,7 +1255,7 @@ declare const crypto: Crypto;
|
|
|
1182
1255
|
|
|
1183
1256
|
declare function dispatchEvent(event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]): boolean;
|
|
1184
1257
|
|
|
1185
|
-
declare function fetch(request: Request | string, requestInitr?:
|
|
1258
|
+
declare function fetch(request: Request | string, requestInitr?: RequestInit | Request): Promise<Response>;
|
|
1186
1259
|
|
|
1187
1260
|
declare function queueMicrotask(task: Function): void;
|
|
1188
1261
|
|
|
@@ -1193,3 +1266,4 @@ declare const self: ServiceWorkerGlobalScope;
|
|
|
1193
1266
|
declare function setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
|
|
1194
1267
|
|
|
1195
1268
|
declare function setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
|
|
1269
|
+
|
package/package.json
CHANGED
package/CHANGELOG.md
DELETED
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 3.0.0
|
|
4
|
-
|
|
5
|
-
### Features
|
|
6
|
-
|
|
7
|
-
- **Types are automatically generated from the runtime - [@mrbbot], [pull/112]**
|
|
8
|
-
Types now match exactly what's defined in the runtime source code, meaning `webworker` should be removed from users' `tsconfig.json`s
|
|
9
|
-
|
|
10
|
-
[@mrbbot]: https://github.com/mrbbot
|
|
11
|
-
[pull/112]: https://github.com/cloudflare/workers-types/pull/112
|
|
12
|
-
|
|
13
|
-
## 2.2.2
|
|
14
|
-
|
|
15
|
-
### Features
|
|
16
|
-
|
|
17
|
-
- **Add KVNamespace.get options parameter, with cacheTtl - [@bretthoerner], [pull/87]**
|
|
18
|
-
|
|
19
|
-
### Bugfixes
|
|
20
|
-
|
|
21
|
-
- **fix DurableObjectStorage transaction method signature - [@sbfaulkner], [pull/89]**
|
|
22
|
-
|
|
23
|
-
## 2.1.0
|
|
24
|
-
|
|
25
|
-
### Features
|
|
26
|
-
|
|
27
|
-
- **Add types for Durable Objects - [@mathew-cf], [pull/63], [issue/64]**
|
|
28
|
-
Types for [Durable Objects Beta](https://developers.cloudflare.com/workers/runtime-apis/durable-objects), subject to change.
|
|
29
|
-
|
|
30
|
-
[@mathew-cf]: https://github.com/mathew-cf
|
|
31
|
-
[pull/63]: https://github.com/cloudflare/workers-types/pull/63
|
|
32
|
-
[issue/64]: https://github.com/cloudflare/workers-types/issues/64
|
|
33
|
-
|
|
34
|
-
- **Add ScheduledEvent - [@qwtel], [pull/61]**
|
|
35
|
-
Types for [Scheduled Events](https://developers.cloudflare.com/workers/runtime-apis/scheduled-event)
|
|
36
|
-
|
|
37
|
-
[@qwtel]: https://github.com/qwtel
|
|
38
|
-
[pull/61]: https://github.com/cloudflare/workers-types/pull/61
|
|
39
|
-
|
|
40
|
-
- **Add AVIF Format for Image Resizing - [@GregBrimble], [pull/59]**
|
|
41
|
-
|
|
42
|
-
[@GregBrimble]: https://github.com/GregBrimble
|
|
43
|
-
[pull/59]: https://github.com/cloudflare/workers-types/pull/59
|
|
44
|
-
|
|
45
|
-
- **Add metadata typings for KV - [@GregBrimble], [pull/54]**
|
|
46
|
-
Adds the [new metadata](https://developers.cloudflare.com/workers/runtime-apis/kv#metadata) types to the getWithMetadata, put and list methods on a KV namespace.
|
|
47
|
-
|
|
48
|
-
[@GregBrimble]: https://github.com/GregBrimble
|
|
49
|
-
[pull/54]: https://github.com/cloudflare/workers-types/pull/54
|
|
50
|
-
|
|
51
|
-
- **Complete Image Resizing properties - [@GregBrimble], [pull/50]**
|
|
52
|
-
Adds missing options for the Image Resizing API.
|
|
53
|
-
|
|
54
|
-
[@GregBrimble]: https://github.com/GregBrimble
|
|
55
|
-
[pull/50]: https://github.com/cloudflare/workers-types/pull/50
|
|
56
|
-
|
|
57
|
-
- **Add API for async handlers and end handler - [@ObsidianMinor], [pull/48]**
|
|
58
|
-
Types for [HTML Rewriter](https://developers.cloudflare.com/workers/runtime-apis/html-rewriter#end) end of document append method
|
|
59
|
-
|
|
60
|
-
[@ObsidianMinor]: https://github.com/ObsidianMinor
|
|
61
|
-
[pull/48]: https://github.com/cloudflare/workers-types/pull/48
|
|
62
|
-
|
|
63
|
-
### Bugfixes
|
|
64
|
-
|
|
65
|
-
- **Make Element.attributes iterable - [@jdanyow], [pull/47]**
|
|
66
|
-
|
|
67
|
-
Fixing a bug in the type definitions that prevents writing valid code like this:
|
|
68
|
-
|
|
69
|
-
```typescript
|
|
70
|
-
rewriter.on('bla', {
|
|
71
|
-
element: element => {
|
|
72
|
-
for (const [name, value] of element.attributes) {
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
[@jdanyow]: https://github.com/jdanyow
|
|
76
|
-
[pull/47]: https://github.com/cloudflare/workers-types/pull/47
|
|
77
|
-
|
|
78
|
-
### Maintenance
|
|
79
|
-
|
|
80
|
-
- **Update README.md instructions to avoid typescript error - [@jeremistadler], [pull/60]**
|
|
81
|
-
Add empty export to bindings.d.ts example to avoid an typescript error
|
|
82
|
-
|
|
83
|
-
[@jeremistadler]: https://github.com/jeremistadler
|
|
84
|
-
[pull/60]: https://github.com/cloudflare/workers-types/pull/60
|
|
85
|
-
|
|
86
|
-
- **Add a GitHub action to lint the Markdown - [@jbampton],[pull/51]**
|
|
87
|
-
|
|
88
|
-
[@jbampton]: https://github.com/jbampton
|
|
89
|
-
[pull/51]: https://github.com/cloudflare/workers-types/pull/51
|
|
90
|
-
|
|
91
|
-
- **Fix spelling - [@jbampton],[pull/50]**
|
|
92
|
-
|
|
93
|
-
[@jbampton]: https://github.com/jbampton
|
|
94
|
-
[pull/50]: https://github.com/cloudflare/workers-types/pull/50
|
|
95
|
-
|
|
96
|
-
- **Add CODEOWNERS - [@ispivey], [pull/49]**
|
|
97
|
-
This will ensure we have default reviewers.
|
|
98
|
-
|
|
99
|
-
[@ispivey]: https://github.com/ispivey
|
|
100
|
-
[pull/48]: https://github.com/cloudflare/workers-types/pull/48
|
|
101
|
-
|
|
102
|
-
- **Add prettier and typescript as devDependencies - [@1000hz], [pull/46]**
|
|
103
|
-
Automated formatting via prettier
|
|
104
|
-
|
|
105
|
-
[@1000hz]: https://github.com/1000hz
|
|
106
|
-
[pull/46]: https://github.com/cloudflare/workers-types/pull/46
|
|
107
|
-
|
|
108
|
-
## ⌨️ 2.0.0
|
|
109
|
-
|
|
110
|
-
### Breaking Changes
|
|
111
|
-
|
|
112
|
-
- **Types now only provided via automatic type inclusion, rather than explicit import - [@jdanyow], [issue/33], [pull/34]**
|
|
113
|
-
|
|
114
|
-
Users should no longer use an empty import to include `workers-types`, which used to be the recommendation in the README.
|
|
115
|
-
|
|
116
|
-
Remove this from your code:
|
|
117
|
-
|
|
118
|
-
```typescript
|
|
119
|
-
import {} from '@cloudflare/workers-types'
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
And instead include the types explicitly in your TypeScript configuration compiler options:
|
|
123
|
-
|
|
124
|
-
```json
|
|
125
|
-
{
|
|
126
|
-
"compilerOptions": {
|
|
127
|
-
"types": ["@cloudflare/workers-types"]
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
[@jdanyow]: https://github.com/jdanyow
|
|
133
|
-
[pull/34]: https://github.com/cloudflare/workers-types/pull/34
|
|
134
|
-
[issue/33]: https://github.com/cloudflare/workers-types/issues/33
|
|
135
|
-
|
|
136
|
-
### Features
|
|
137
|
-
|
|
138
|
-
- **Add Cache behavior modifiers to outbound Requests - [@trjstewart], [issue/22], [pull/17]**
|
|
139
|
-
|
|
140
|
-
When constructing a request, you can now include the following cache-manipulating properties in the initializer dictionary:
|
|
141
|
-
|
|
142
|
-
```typescript
|
|
143
|
-
// Force response to be cached for 300 seconds.
|
|
144
|
-
fetch(event.request, { cf: { cacheTtl: 300 } })
|
|
145
|
-
|
|
146
|
-
// Force response to be cached for 86400 seconds for 200 status codes, 1 second for 404, and do not cache 500 errors
|
|
147
|
-
fetch(request, { cf: { cacheTtlByStatus: { '200-299': 86400, '404': 1, '500-599': 0 } } })
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
Read more about these properties in the [`Request` docs](https://developers.cloudflare.com/workers/reference/apis/request/).
|
|
151
|
-
|
|
152
|
-
[@trjstewart]: https://github.com/trjstewart
|
|
153
|
-
[pull/17]: https://github.com/cloudflare/workers-types/pull/17
|
|
154
|
-
[issue/22]: https://github.com/cloudflare/workers-types/issues/22
|
|
155
|
-
|
|
156
|
-
- **Add support for `caches.default` - [@ispivey], [@ashnewmanjones], [issue/8], [pull/21]**
|
|
157
|
-
|
|
158
|
-
The Workers runtime exposes a default global cache as `caches.default`, accessed like:
|
|
159
|
-
|
|
160
|
-
```typescript
|
|
161
|
-
let cache = caches.default
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
This is an extension to the [Service Workers spec for `CacheStorage`](https://w3c.github.io/ServiceWorker/#cachestorage), and thus needed to be added explicitly to our type definitions.
|
|
165
|
-
|
|
166
|
-
[@ispivey]: https://github.com/ispivey
|
|
167
|
-
[@ashnewmanjones]: https://github.com/ashnewmanjones
|
|
168
|
-
[pull/21]: https://github.com/cloudflare/workers-types/pull/21
|
|
169
|
-
[issue/8]: https://github.com/cloudflare/workers-types/issues/8
|
|
170
|
-
|
|
171
|
-
- **Add missing properties to inbound `Request` `cf` object - [@ispivey], [@brycematheson1234], [issue/23], [pull/24], [pull/35]**
|
|
172
|
-
|
|
173
|
-
Adds:
|
|
174
|
-
|
|
175
|
-
- `clientTcpRtt`
|
|
176
|
-
- `metroCode`
|
|
177
|
-
- `botManagement.score`
|
|
178
|
-
- `botManagement.staticResource`
|
|
179
|
-
- `botManagement.verifiedBot`
|
|
180
|
-
|
|
181
|
-
Makes most geolocation properties optional, because they are not guaranteed to be set on every request.
|
|
182
|
-
|
|
183
|
-
Changes the type of `asn` from string to number.
|
|
184
|
-
|
|
185
|
-
[@ispivey]: https://github.com/ispivey
|
|
186
|
-
[@brycematheson1234]: https://github.com/brycematheson1234
|
|
187
|
-
[issue/23]: https://github.com/cloudflare/workers-types/issues/23
|
|
188
|
-
[pull/24]: https://github.com/cloudflare/workers-types/pull/24
|
|
189
|
-
[pull/35]: https://github.com/cloudflare/workers-types/pull/35
|
|
190
|
-
|
|
191
|
-
- **Adds `cf.cacheKey` property to `RequestInit` - [@ispivey], [issue/22], [pull/28]**
|
|
192
|
-
|
|
193
|
-
Adds the `cacheKey` property of the `cf` object to the `RequestInit` interface.
|
|
194
|
-
|
|
195
|
-
[@ispivey]: https://github.com/ispivey
|
|
196
|
-
[pull/28]: https://github.com/cloudflare/workers-types/pull/28
|
|
197
|
-
[issue/22]: https://github.com/cloudflare/workers-types/issues/22
|
|
198
|
-
|
|
199
|
-
- **Allow passing another Request as the `init` arg to `Request` constructor - [@ispivey], [issue/15], [pull/18]**
|
|
200
|
-
|
|
201
|
-
Previously, this pattern wasn't allowed:
|
|
202
|
-
|
|
203
|
-
```typescript
|
|
204
|
-
new Request(parsedUrl.toString(), request)
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
This is because the `cf` object on inbound Request objects, and that expected in the `init` dictionary arg to the Request constructor, have a different shape.
|
|
208
|
-
|
|
209
|
-
This change creates explicit `IncomingRequestCfProperties` (inbound) and `RequestInitCfProperties` (outbound) interfaces, and updates the `Request` constructor to accept either type:
|
|
210
|
-
|
|
211
|
-
```typescript
|
|
212
|
-
interface RequestInit {
|
|
213
|
-
cf?: RequestInitCfProperties | IncomingRequestCfProperties
|
|
214
|
-
}
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
Read more about the `Request` constructor in the [`Request` docs](https://developers.cloudflare.com/workers/reference/apis/request/).
|
|
218
|
-
|
|
219
|
-
[@ispivey]: https://github.com/ispivey
|
|
220
|
-
[pull/18]: https://github.com/cloudflare/workers-types/pull/18
|
|
221
|
-
[issue/15]: https://github.com/cloudflare/workers-types/issues/15
|
|
222
|
-
|
|
223
|
-
- **Add `CfRequestInit` type - [@third774], [issue/37], [pull/44]**
|
|
224
|
-
|
|
225
|
-
Because of the union mentioned above, if an object is declared as `RequestInit` and sets the `cf` property, subproperties of `cf` can not later be reassigned. For this scenario, a more specific `CfRequestInit` type has been introduced to use instead of `RequestInit` that doesn't exhibit the same assignability issues.
|
|
226
|
-
|
|
227
|
-
[@third774]: https://github.com/third774
|
|
228
|
-
[pull/44]: https://github.com/cloudflare/workers-types/pull/44
|
|
229
|
-
[issue/37]: https://github.com/cloudflare/workers-types/issues/37
|
|
230
|
-
|
|
231
|
-
- **Add iterable methods to `FormData`, `Headers`, and `URLSearchParams` - [@ispivey], [issue/25], [pull/26]**
|
|
232
|
-
|
|
233
|
-
The iterable methods `entries()`, `keys()` and `values()` are not present on these three types in `lib.webworker.d.ts`. They are instead supplied in `lib.dom.iterable.d.ts`.
|
|
234
|
-
|
|
235
|
-
However, as discussed in this issue on the TypeScript repo, `lib.dom.d.ts` and `lib.webworker.d.ts` have conflicting type definitions, and the maintainers hope to solve this issue by refactoring shared components into a new `web.iterable.d.ts` lib: [https://github.com/microsoft/TypeScript/issues/32435#issuecomment-624741120](https://github.com/microsoft/TypeScript/issues/32435#issuecomment-624741120)
|
|
236
|
-
|
|
237
|
-
Until then, we will include the iterable methods supported by Workers in our own type definitions.
|
|
238
|
-
|
|
239
|
-
[@ispivey]: https://github.com/ispivey
|
|
240
|
-
[pull/26]: https://github.com/cloudflare/workers-types/pull/26
|
|
241
|
-
[issue/25]: https://github.com/cloudflare/workers-types/issues/25
|
|
242
|
-
|
|
243
|
-
### Bugfixes
|
|
244
|
-
|
|
245
|
-
- **Remove `selector` parameter from `onDocument()` - [@jdanyow], [pull/41]**
|
|
246
|
-
|
|
247
|
-
The type signature for HTMLRewriter's `onDocument()` method previously erroneously included a `selector` parameter as its first argument. This has been removed.
|
|
248
|
-
|
|
249
|
-
[@jdanyow]: https://github.com/jdanyow
|
|
250
|
-
[pull/41]: https://github.com/cloudflare/workers-types/pull/41
|
|
251
|
-
|
|
252
|
-
- **Make `KVNamespace.list()` options argument optional - [@motiejunas], [pull/10]**
|
|
253
|
-
|
|
254
|
-
Previously, the `KVNamespace` interface required that callers provide an empty options object when listing all the keys in a namespace, like so:
|
|
255
|
-
|
|
256
|
-
```typescript
|
|
257
|
-
await NAMESPACE.list({})
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
However, this argument is not actually required. This change updates the interface to match the runtime.
|
|
261
|
-
|
|
262
|
-
[@motiejunas]: https://github.com/motiejunas
|
|
263
|
-
[pull/10]: https://github.com/cloudflare/workers-types/pull/10
|
|
264
|
-
|
|
265
|
-
### Maintenance
|
|
266
|
-
|
|
267
|
-
- **Add a Release Checklist - [@ispivey], [issue/20], [pull/27]**
|
|
268
|
-
|
|
269
|
-
As we onboard more contributors, we're documenting release procedures.
|
|
270
|
-
|
|
271
|
-
[@ispivey]: https://github.com/ispivey
|
|
272
|
-
[pull/27]: https://github.com/cloudflare/workers-types/pull/27
|
|
273
|
-
[issue/20]: https://github.com/cloudflare/workers-types/issues/20
|
|
274
|
-
|
|
275
|
-
- **Add BSD-3 License - [@ispivey], [issue/31], [pull/30], [pull/40]**
|
|
276
|
-
|
|
277
|
-
As we transition this to a project supported by the Cloudflare Workers team, we're releasing the code under a BSD-3 license. Thanks to all the contributors for their help!
|
|
278
|
-
|
|
279
|
-
[@ispivey]: https://github.com/ispivey
|
|
280
|
-
[pull/30]: https://github.com/cloudflare/workers-types/pull/30
|
|
281
|
-
[pull/40]: https://github.com/cloudflare/workers-types/pull/40
|
|
282
|
-
[issue/31]: https://github.com/cloudflare/workers-types/issues/31
|