@cloudflare/workers-types 2.2.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/README.md +41 -7
- package/index.d.ts +1080 -511
- package/package.json +14 -5
- package/.github/CODEOWNERS +0 -1
- package/.github/workflows/lint.yml +0 -15
- package/.markdownlint.yml +0 -9
- package/.prettierrc +0 -4
- package/CHANGELOG.md +0 -262
- package/test.ts +0 -49
package/index.d.ts
CHANGED
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// This file is auto-generated. DO NOT MODIFY.
|
|
2
|
+
// Please refer to the Auto-Generation section of the README.md.
|
|
3
|
+
|
|
4
|
+
declare class AbortController {
|
|
5
|
+
constructor();
|
|
6
|
+
readonly signal: AbortSignal;
|
|
7
|
+
abort(): void;
|
|
3
8
|
}
|
|
4
9
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type: string;
|
|
10
|
-
/**
|
|
11
|
-
* The time the `ScheduledEvent` was scheduled to be executed in
|
|
12
|
-
* milliseconds since January 1, 1970, UTC.
|
|
13
|
-
* It can be parsed as `new Date(event.scheduledTime)`
|
|
14
|
-
*/
|
|
15
|
-
scheduledTime: number;
|
|
16
|
-
/**
|
|
17
|
-
* Use this method to notify the runtime to wait for asynchronous tasks
|
|
18
|
-
* (e.g. logging, analytics to third-party services, streaming and caching).
|
|
19
|
-
* The first `event.waitUntil` to fail will be observed and recorded as the
|
|
20
|
-
* status in the Cron Trigger Past Events table. Otherwise, it will be
|
|
21
|
-
* reported as a Success.
|
|
22
|
-
*/
|
|
23
|
-
waitUntil(promise: Promise<any>): void;
|
|
10
|
+
declare class AbortSignal extends EventTarget {
|
|
11
|
+
constructor();
|
|
12
|
+
static abort(): AbortSignal;
|
|
13
|
+
readonly aborted: boolean;
|
|
24
14
|
}
|
|
25
15
|
|
|
26
16
|
interface BasicImageTransformations {
|
|
@@ -55,7 +45,7 @@ interface BasicImageTransformations {
|
|
|
55
45
|
* effect can be more efficiently achieved with the contain mode and the
|
|
56
46
|
* CSS object-fit: contain property.
|
|
57
47
|
*/
|
|
58
|
-
fit?:
|
|
48
|
+
fit?: "scale-down" | "contain" | "cover" | "crop" | "pad";
|
|
59
49
|
/**
|
|
60
50
|
* When cropping with fit: "cover", this defines the side or point that should
|
|
61
51
|
* be left uncropped. The value is either a string
|
|
@@ -68,7 +58,7 @@ interface BasicImageTransformations {
|
|
|
68
58
|
* preserve as much as possible around a point at 20% of the height of the
|
|
69
59
|
* source image.
|
|
70
60
|
*/
|
|
71
|
-
gravity?:
|
|
61
|
+
gravity?: "left" | "right" | "top" | "bottom" | "center" | BasicImageTransformationsGravityCoordinates;
|
|
72
62
|
/**
|
|
73
63
|
* Background color to add underneath the image. Applies only to images with
|
|
74
64
|
* transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),
|
|
@@ -82,155 +72,481 @@ interface BasicImageTransformations {
|
|
|
82
72
|
rotate?: 0 | 90 | 180 | 270 | 360;
|
|
83
73
|
}
|
|
84
74
|
|
|
85
|
-
interface
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
75
|
+
interface BasicImageTransformationsGravityCoordinates {
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
declare class Blob {
|
|
81
|
+
constructor(bits?: BlobBits, options?: BlobOptions);
|
|
82
|
+
readonly size: number;
|
|
83
|
+
readonly type: string;
|
|
84
|
+
slice(start?: number, end?: number, type?: string): Blob;
|
|
85
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
86
|
+
text(): Promise<string>;
|
|
87
|
+
stream(): ReadableStream;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
declare type BlobBits = (ArrayBuffer | string | Blob)[];
|
|
91
|
+
|
|
92
|
+
interface BlobOptions {
|
|
93
|
+
type?: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
declare abstract class Body {
|
|
97
|
+
readonly body: ReadableStream | null;
|
|
98
|
+
readonly bodyUsed: boolean;
|
|
99
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
100
|
+
text(): Promise<string>;
|
|
101
|
+
json<T>(): Promise<T>;
|
|
102
|
+
formData(): Promise<FormData>;
|
|
103
|
+
blob(): Promise<Blob>;
|
|
104
|
+
}
|
|
105
|
+
|
|
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;
|
|
113
|
+
|
|
114
|
+
declare abstract class Cache {
|
|
115
|
+
delete(request: Request | string, options?: CacheQueryOptions): Promise<boolean>;
|
|
116
|
+
match(request: Request | string, options?: CacheQueryOptions): Promise<Response | undefined>;
|
|
117
|
+
put(request: Request | string, response: Response): Promise<void>;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
interface CacheQueryOptions {
|
|
121
|
+
ignoreMethod?: boolean;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
declare abstract class CacheStorage {
|
|
125
|
+
open(cacheName: string): Promise<Cache>;
|
|
126
|
+
readonly default: Cache;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
interface CfRequestInit extends Omit<RequestInit, "cf"> {
|
|
130
|
+
cf?: RequestInitCfProperties;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Back compat support with older types.
|
|
135
|
+
* @deprecated Use CfRequestInit instead.
|
|
136
|
+
*/
|
|
137
|
+
declare type CfRequestInitializerDict = CfRequestInit;
|
|
138
|
+
|
|
139
|
+
declare class CloseEvent extends Event {
|
|
140
|
+
constructor(type: string, initializer: CloseEventInit);
|
|
141
|
+
readonly code: number;
|
|
142
|
+
readonly reason: string;
|
|
143
|
+
readonly wasClean: boolean;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
interface CloseEventInit {
|
|
147
|
+
code?: number;
|
|
148
|
+
reason?: string;
|
|
149
|
+
wasClean?: boolean;
|
|
150
|
+
}
|
|
151
|
+
|
|
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 {
|
|
159
|
+
text: string;
|
|
160
|
+
readonly removed: boolean;
|
|
161
|
+
before(content: Content, options?: ContentOptions): Comment;
|
|
162
|
+
after(content: Content, options?: ContentOptions): Comment;
|
|
163
|
+
replace(content: Content, options?: ContentOptions): Comment;
|
|
164
|
+
remove(): Comment;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
interface Console {
|
|
168
|
+
debug(...data: any[]): void;
|
|
169
|
+
error(...data: any[]): void;
|
|
170
|
+
info(...data: any[]): void;
|
|
171
|
+
log(...data: any[]): void;
|
|
172
|
+
warn(...data: any[]): void;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
declare type Content = string | ReadableStream | Response;
|
|
176
|
+
|
|
177
|
+
interface ContentOptions {
|
|
178
|
+
html?: boolean;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
declare abstract class Crypto {
|
|
182
|
+
readonly subtle: SubtleCrypto;
|
|
183
|
+
getRandomValues(buffer: ArrayBufferView): ArrayBufferView;
|
|
184
|
+
randomUUID(): string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
declare abstract class CryptoKey {
|
|
188
|
+
readonly type: string;
|
|
189
|
+
readonly extractable: boolean;
|
|
190
|
+
readonly algorithm: CryptoKeyAlgorithmVariant;
|
|
191
|
+
readonly usages: string[];
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
interface CryptoKeyAesKeyAlgorithm {
|
|
195
|
+
name: string;
|
|
196
|
+
length: number;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
declare type CryptoKeyAlgorithmVariant = CryptoKeyKeyAlgorithm | CryptoKeyAesKeyAlgorithm | CryptoKeyHmacKeyAlgorithm | CryptoKeyRsaKeyAlgorithm | CryptoKeyEllipticKeyAlgorithm | CryptoKeyVoprfKeyAlgorithm | CryptoKeyOprfKeyAlgorithm;
|
|
200
|
+
|
|
201
|
+
interface CryptoKeyEllipticKeyAlgorithm {
|
|
202
|
+
name: string;
|
|
203
|
+
namedCurve: string;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
interface CryptoKeyHmacKeyAlgorithm {
|
|
207
|
+
name: string;
|
|
208
|
+
hash: CryptoKeyKeyAlgorithm;
|
|
209
|
+
length: number;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
interface CryptoKeyKeyAlgorithm {
|
|
213
|
+
name: string;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
interface CryptoKeyOprfKeyAlgorithm {
|
|
217
|
+
name: string;
|
|
218
|
+
namedCurve: string;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
interface CryptoKeyPair {
|
|
222
|
+
publicKey: CryptoKey;
|
|
223
|
+
privateKey: CryptoKey;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
interface CryptoKeyRsaKeyAlgorithm {
|
|
227
|
+
name: string;
|
|
228
|
+
modulusLength: number;
|
|
229
|
+
publicExponent: ArrayBuffer;
|
|
230
|
+
hash?: CryptoKeyKeyAlgorithm;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
interface CryptoKeyVoprfKeyAlgorithm {
|
|
234
|
+
name: string;
|
|
235
|
+
hash: CryptoKeyKeyAlgorithm;
|
|
236
|
+
namedCurve: string;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
declare class DOMException extends Error {
|
|
240
|
+
constructor(message?: string, name?: string);
|
|
241
|
+
readonly code: number;
|
|
242
|
+
static readonly INDEX_SIZE_ERR: number;
|
|
243
|
+
static readonly DOMSTRING_SIZE_ERR: number;
|
|
244
|
+
static readonly HIERARCHY_REQUEST_ERR: number;
|
|
245
|
+
static readonly WRONG_DOCUMENT_ERR: number;
|
|
246
|
+
static readonly INVALID_CHARACTER_ERR: number;
|
|
247
|
+
static readonly NO_DATA_ALLOWED_ERR: number;
|
|
248
|
+
static readonly NO_MODIFICATION_ALLOWED_ERR: number;
|
|
249
|
+
static readonly NOT_FOUND_ERR: number;
|
|
250
|
+
static readonly NOT_SUPPORTED_ERR: number;
|
|
251
|
+
static readonly INUSE_ATTRIBUTE_ERR: number;
|
|
252
|
+
static readonly INVALID_STATE_ERR: number;
|
|
253
|
+
static readonly SYNTAX_ERR: number;
|
|
254
|
+
static readonly INVALID_MODIFICATION_ERR: number;
|
|
255
|
+
static readonly NAMESPACE_ERR: number;
|
|
256
|
+
static readonly INVALID_ACCESS_ERR: number;
|
|
257
|
+
static readonly VALIDATION_ERR: number;
|
|
258
|
+
static readonly TYPE_MISMATCH_ERR: number;
|
|
259
|
+
static readonly SECURITY_ERR: number;
|
|
260
|
+
static readonly NETWORK_ERR: number;
|
|
261
|
+
static readonly ABORT_ERR: number;
|
|
262
|
+
static readonly URL_MISMATCH_ERR: number;
|
|
263
|
+
static readonly QUOTA_EXCEEDED_ERR: number;
|
|
264
|
+
static readonly TIMEOUT_ERR: number;
|
|
265
|
+
static readonly INVALID_NODE_TYPE_ERR: number;
|
|
266
|
+
static readonly DATA_CLONE_ERR: number;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
interface Doctype {
|
|
270
|
+
readonly name: string | null;
|
|
271
|
+
readonly publicId: string | null;
|
|
272
|
+
readonly systemId: string | null;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
interface DocumentEnd {
|
|
276
|
+
append(content: Content, options?: ContentOptions): DocumentEnd;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
interface DurableObject {
|
|
280
|
+
fetch(request: Request): Promise<Response>;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
interface DurableObjectId {
|
|
284
|
+
toString(): string;
|
|
285
|
+
equals(other: DurableObjectId): boolean;
|
|
286
|
+
readonly name?: string;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
interface DurableObjectNamespace {
|
|
290
|
+
newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId;
|
|
291
|
+
idFromName(name: string): DurableObjectId;
|
|
292
|
+
idFromString(id: string): DurableObjectId;
|
|
293
|
+
get(id: DurableObjectId): DurableObjectStub;
|
|
214
294
|
}
|
|
215
295
|
|
|
296
|
+
interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
297
|
+
jurisdiction?: string;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
interface DurableObjectState {
|
|
301
|
+
waitUntil(promise: Promise<any>): void;
|
|
302
|
+
readonly id: DurableObjectId | string;
|
|
303
|
+
readonly storage: DurableObjectStorage;
|
|
304
|
+
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
interface DurableObjectStorage {
|
|
308
|
+
get<T = unknown>(key: string, options?: DurableObjectStorageOperationsGetOptions): Promise<T | undefined>;
|
|
309
|
+
get<T = unknown>(keys: string[], options?: DurableObjectStorageOperationsGetOptions): Promise<Map<string, T>>;
|
|
310
|
+
list<T = unknown>(options?: DurableObjectStorageOperationsListOptions): Promise<Map<string, T>>;
|
|
311
|
+
put<T>(key: string, value: T, options?: DurableObjectStorageOperationsPutOptions): Promise<void>;
|
|
312
|
+
put<T>(entries: Record<string, T>, options?: DurableObjectStorageOperationsPutOptions): Promise<void>;
|
|
313
|
+
delete(key: string, options?: DurableObjectStorageOperationsPutOptions): Promise<boolean>;
|
|
314
|
+
delete(keys: string[], options?: DurableObjectStorageOperationsPutOptions): Promise<number>;
|
|
315
|
+
deleteAll(options?: DurableObjectStorageOperationsPutOptions): Promise<void>;
|
|
316
|
+
transaction<T>(closure: (txn: DurableObjectTransaction) => Promise<T>): Promise<T>;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
interface DurableObjectStorageOperationsGetOptions {
|
|
320
|
+
allowConcurrency?: boolean;
|
|
321
|
+
noCache?: boolean;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
interface DurableObjectStorageOperationsListOptions {
|
|
325
|
+
start?: string;
|
|
326
|
+
end?: string;
|
|
327
|
+
prefix?: string;
|
|
328
|
+
reverse?: boolean;
|
|
329
|
+
limit?: number;
|
|
330
|
+
allowConcurrency?: boolean;
|
|
331
|
+
noCache?: boolean;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
interface DurableObjectStorageOperationsPutOptions {
|
|
335
|
+
allowConcurrency?: boolean;
|
|
336
|
+
allowUnconfirmed?: boolean;
|
|
337
|
+
noCache?: boolean;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
interface DurableObjectStub extends Fetcher {
|
|
341
|
+
readonly id: DurableObjectId;
|
|
342
|
+
readonly name?: string;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
interface DurableObjectTransaction {
|
|
346
|
+
get<T = unknown>(key: string, options?: DurableObjectStorageOperationsGetOptions): Promise<T>;
|
|
347
|
+
get<T = unknown>(keys: string[], options?: DurableObjectStorageOperationsGetOptions): Promise<Map<string, T>>;
|
|
348
|
+
list<T = unknown>(options?: DurableObjectStorageOperationsListOptions): Promise<Map<string, T>>;
|
|
349
|
+
put<T>(key: string, value: T, options?: DurableObjectStorageOperationsPutOptions): Promise<void>;
|
|
350
|
+
put<T>(entries: Record<string, T>, options?: DurableObjectStorageOperationsPutOptions): Promise<void>;
|
|
351
|
+
delete(key: string, options?: DurableObjectStorageOperationsPutOptions): Promise<boolean>;
|
|
352
|
+
delete(keys: string[], options?: DurableObjectStorageOperationsPutOptions): Promise<number>;
|
|
353
|
+
rollback(): void;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
interface Element {
|
|
357
|
+
tagName: string;
|
|
358
|
+
readonly attributes: IterableIterator<string[]>;
|
|
359
|
+
readonly removed: boolean;
|
|
360
|
+
readonly namespaceURI: string;
|
|
361
|
+
getAttribute(name: string): string | null;
|
|
362
|
+
hasAttribute(name: string): boolean;
|
|
363
|
+
setAttribute(name: string, value: string): Element;
|
|
364
|
+
removeAttribute(name: string): Element;
|
|
365
|
+
before(content: Content, options?: ContentOptions): Element;
|
|
366
|
+
after(content: Content, options?: ContentOptions): Element;
|
|
367
|
+
prepend(content: Content, options?: ContentOptions): Element;
|
|
368
|
+
append(content: Content, options?: ContentOptions): Element;
|
|
369
|
+
replace(content: Content, options?: ContentOptions): Element;
|
|
370
|
+
remove(): Element;
|
|
371
|
+
removeAndKeepContent(): Element;
|
|
372
|
+
setInnerContent(content: Content, options?: ContentOptions): Element;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
declare class Event {
|
|
376
|
+
constructor(type: string, init?: EventInit);
|
|
377
|
+
readonly type: string;
|
|
378
|
+
readonly eventPhase: number;
|
|
379
|
+
readonly composed: boolean;
|
|
380
|
+
readonly bubbles: boolean;
|
|
381
|
+
readonly cancelable: boolean;
|
|
382
|
+
readonly defaultPrevented: boolean;
|
|
383
|
+
readonly returnValue: boolean;
|
|
384
|
+
readonly currentTarget?: EventTarget;
|
|
385
|
+
readonly srcElement?: EventTarget;
|
|
386
|
+
readonly timeStamp: number;
|
|
387
|
+
readonly isTrusted: boolean;
|
|
388
|
+
cancelBubble: boolean;
|
|
389
|
+
stopImmediatePropagation(): void;
|
|
390
|
+
preventDefault(): void;
|
|
391
|
+
stopPropagation(): void;
|
|
392
|
+
composedPath(): EventTarget[];
|
|
393
|
+
static readonly NONE: number;
|
|
394
|
+
static readonly CAPTURING_PHASE: number;
|
|
395
|
+
static readonly AT_TARGET: number;
|
|
396
|
+
static readonly BUBBLING_PHASE: number;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
interface EventInit {
|
|
400
|
+
bubbles?: boolean;
|
|
401
|
+
cancelable?: boolean;
|
|
402
|
+
composed?: boolean;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
declare type EventListener<EventType extends Event = Event> = (event: EventType) => void;
|
|
406
|
+
|
|
407
|
+
interface EventListenerObject<EventType extends Event = Event> {
|
|
408
|
+
handleEvent(event: EventType): void;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
declare type EventListenerOrEventListenerObject<EventType extends Event = Event> = EventListener<EventType> | EventListenerObject<EventType>;
|
|
412
|
+
|
|
413
|
+
declare class EventTarget<EventMap extends Record<string, Event> = Record<string, Event>> {
|
|
414
|
+
constructor();
|
|
415
|
+
addEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
|
|
416
|
+
removeEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
|
|
417
|
+
dispatchEvent(event: EventMap[keyof EventMap]): boolean;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
interface EventTargetAddEventListenerOptions {
|
|
421
|
+
capture?: boolean;
|
|
422
|
+
passive?: boolean;
|
|
423
|
+
once?: boolean;
|
|
424
|
+
signal?: AbortSignal;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
interface EventTargetEventListenerOptions {
|
|
428
|
+
capture?: boolean;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
interface ExecutionContext {
|
|
432
|
+
waitUntil(promise: Promise<any>): void;
|
|
433
|
+
passThroughOnException(): void;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
interface ExportedHandler<Env = unknown> {
|
|
437
|
+
fetch?: ExportedHandlerFetchHandler<Env>;
|
|
438
|
+
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
declare type ExportedHandlerFetchHandler<Env = unknown> = (request: Request, env: Env, ctx: ExecutionContext) => Response | Promise<Response>;
|
|
442
|
+
|
|
443
|
+
declare type ExportedHandlerScheduledHandler<Env = unknown> = (controller: ScheduledController, env: Env, ctx: ExecutionContext) => void | Promise<void>;
|
|
444
|
+
|
|
445
|
+
declare abstract class FetchEvent extends Event {
|
|
446
|
+
readonly request: Request;
|
|
447
|
+
respondWith(promise: Response | Promise<Response>): void;
|
|
448
|
+
passThroughOnException(): void;
|
|
449
|
+
waitUntil(promise: Promise<any>): void;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
declare abstract class Fetcher {
|
|
453
|
+
fetch(requestOrUrl: Request | string, requestInit?: RequestInit | Request): Promise<Response>;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
declare class File extends Blob {
|
|
457
|
+
constructor(bits?: BlobBits, name?: string, options?: FileOptions);
|
|
458
|
+
readonly name: string;
|
|
459
|
+
readonly lastModified: number;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
interface FileOptions {
|
|
463
|
+
type?: string;
|
|
464
|
+
lastModified?: number;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
declare class FixedLengthStream extends TransformStream {
|
|
468
|
+
constructor(expectedLength: number);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
declare class FormData {
|
|
472
|
+
constructor();
|
|
473
|
+
append(name: string, value: string): void;
|
|
474
|
+
append(name: string, value: Blob, filename?: string): void;
|
|
475
|
+
delete(name: string): void;
|
|
476
|
+
get(name: string): File | string | null;
|
|
477
|
+
getAll(name: string): (File | string)[];
|
|
478
|
+
has(name: string): boolean;
|
|
479
|
+
set(name: string, value: string): void;
|
|
480
|
+
set(name: string, value: Blob, filename?: string): void;
|
|
481
|
+
entries(): IterableIterator<([key: string, value: File | string])[]>;
|
|
482
|
+
keys(): IterableIterator<string>;
|
|
483
|
+
values(): IterableIterator<File | string>;
|
|
484
|
+
forEach<This = unknown>(callback: (this: This, key: string, value: File | string, parent: FormData) => void, thisArg?: This): void;
|
|
485
|
+
[Symbol.iterator](): IterableIterator<([key: string, value: File | string])[]>;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
declare class HTMLRewriter {
|
|
489
|
+
constructor();
|
|
490
|
+
on(selector: string, handlers: HTMLRewriterElementContentHandlers): HTMLRewriter;
|
|
491
|
+
onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;
|
|
492
|
+
transform(response: Response): Response;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
interface HTMLRewriterDocumentContentHandlers {
|
|
496
|
+
doctype?(doctype: Doctype): void | Promise<void>;
|
|
497
|
+
comments?(comment: Comment): void | Promise<void>;
|
|
498
|
+
text?(text: Text): void | Promise<void>;
|
|
499
|
+
end?(end: DocumentEnd): void | Promise<void>;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
interface HTMLRewriterElementContentHandlers {
|
|
503
|
+
element?(element: Element): void | Promise<void>;
|
|
504
|
+
comments?(comment: Comment): void | Promise<void>;
|
|
505
|
+
text?(text: Text): void | Promise<void>;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
declare class Headers {
|
|
509
|
+
constructor(init?: HeadersInit);
|
|
510
|
+
get(name: string): string | null;
|
|
511
|
+
getAll(name: string): string[];
|
|
512
|
+
has(name: string): boolean;
|
|
513
|
+
set(name: string, value: string): void;
|
|
514
|
+
append(name: string, value: string): void;
|
|
515
|
+
delete(name: string): void;
|
|
516
|
+
forEach<This = unknown>(callback: (this: This, key: string, value: string, parent: Headers) => void, thisArg?: This): void;
|
|
517
|
+
entries(): IterableIterator<[key: string, value: string]>;
|
|
518
|
+
keys(): IterableIterator<string>;
|
|
519
|
+
values(): IterableIterator<string>;
|
|
520
|
+
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
|
|
521
|
+
}
|
|
522
|
+
|
|
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;
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* In addition to the properties on the standard Request object,
|
|
533
|
+
* the cf object contains extra information about the request provided
|
|
534
|
+
* by Cloudflare's edge.
|
|
535
|
+
*
|
|
536
|
+
* Note: Currently, settings in the cf object cannot be accessed in the
|
|
537
|
+
* playground.
|
|
538
|
+
*/
|
|
216
539
|
interface IncomingRequestCfProperties {
|
|
217
540
|
/**
|
|
218
|
-
*
|
|
219
|
-
* the cf object contains extra information about the request provided
|
|
220
|
-
* by Cloudflare's edge.
|
|
221
|
-
*
|
|
222
|
-
* Note: Currently, settings in the cf object cannot be accessed in the
|
|
223
|
-
* playground.
|
|
541
|
+
* (e.g. 395747)
|
|
224
542
|
*/
|
|
543
|
+
asn: number;
|
|
225
544
|
/**
|
|
226
|
-
*
|
|
545
|
+
* The organisation which owns the ASN of the incoming request.
|
|
546
|
+
* (e.g. Google Cloud)
|
|
227
547
|
*/
|
|
228
|
-
|
|
229
|
-
botManagement?:
|
|
230
|
-
score: number;
|
|
231
|
-
staticResource: boolean;
|
|
232
|
-
verifiedBot: boolean;
|
|
233
|
-
};
|
|
548
|
+
asOrganization: string;
|
|
549
|
+
botManagement?: IncomingRequestCfPropertiesBotManagement;
|
|
234
550
|
city?: string;
|
|
235
551
|
clientTcpRtt: number;
|
|
236
552
|
clientTrustScore?: number;
|
|
@@ -251,7 +567,7 @@ interface IncomingRequestCfProperties {
|
|
|
251
567
|
/**
|
|
252
568
|
* DMA metro code from which the request was issued, e.g. "635"
|
|
253
569
|
*/
|
|
254
|
-
metroCode?:
|
|
570
|
+
metroCode?: string;
|
|
255
571
|
postalCode?: string;
|
|
256
572
|
/**
|
|
257
573
|
* e.g. "Texas"
|
|
@@ -271,430 +587,683 @@ interface IncomingRequestCfProperties {
|
|
|
271
587
|
timezone?: string;
|
|
272
588
|
tlsVersion: string;
|
|
273
589
|
tlsCipher: string;
|
|
274
|
-
tlsClientAuth:
|
|
275
|
-
certIssuerDNLegacy: string;
|
|
276
|
-
certIssuerDN: string;
|
|
277
|
-
certPresented: '0' | '1';
|
|
278
|
-
certSubjectDNLegacy: string;
|
|
279
|
-
certSubjectDN: string;
|
|
280
|
-
certNotBefore: string; // In format "Dec 22 19:39:00 2018 GMT"
|
|
281
|
-
certNotAfter: string; // In format "Dec 22 19:39:00 2018 GMT"
|
|
282
|
-
certSerial: string;
|
|
283
|
-
certFingerprintSHA1: string;
|
|
284
|
-
certVerified: string; // “SUCCESS”, “FAILED:reason”, “NONE”
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
interface CfRequestInit extends Omit<RequestInit, 'cf'> {
|
|
289
|
-
cf?: RequestInitCfProperties;
|
|
590
|
+
tlsClientAuth: IncomingRequestCfPropertiesTLSClientAuth;
|
|
290
591
|
}
|
|
291
592
|
|
|
292
|
-
interface
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
* a type that only contains RequestInitCfProperties, use the
|
|
297
|
-
* CfRequestInit type.
|
|
298
|
-
*
|
|
299
|
-
* IncomingRequestCfProperties is required to allow
|
|
300
|
-
* new Request(someUrl, event.request)
|
|
301
|
-
*
|
|
302
|
-
* RequestInitCfProperties is required to allow
|
|
303
|
-
* new Request(event.request, {cf: { ... } })
|
|
304
|
-
* fetch(someUrl, {cf: { ... } })
|
|
305
|
-
*/
|
|
306
|
-
cf?: IncomingRequestCfProperties | RequestInitCfProperties;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
declare function addEventListener(type: 'fetch', handler: (event: FetchEvent) => void): void;
|
|
310
|
-
declare function addEventListener(type: 'scheduled', handler: (event: ScheduledEvent) => void): void;
|
|
311
|
-
|
|
312
|
-
interface Request {
|
|
313
|
-
cf: IncomingRequestCfProperties;
|
|
593
|
+
interface IncomingRequestCfPropertiesBotManagement {
|
|
594
|
+
score: number;
|
|
595
|
+
staticResource: boolean;
|
|
596
|
+
verifiedBot: boolean;
|
|
314
597
|
}
|
|
315
598
|
|
|
316
|
-
interface
|
|
317
|
-
|
|
599
|
+
interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
600
|
+
certIssuerDNLegacy: string;
|
|
601
|
+
certIssuerDN: string;
|
|
602
|
+
certPresented: "0" | "1";
|
|
603
|
+
certSubjectDNLegacy: string;
|
|
604
|
+
certSubjectDN: string;
|
|
318
605
|
/**
|
|
319
|
-
*
|
|
606
|
+
* In format "Dec 22 19:39:00 2018 GMT"
|
|
320
607
|
*/
|
|
321
|
-
|
|
608
|
+
certNotBefore: string;
|
|
322
609
|
/**
|
|
323
|
-
*
|
|
610
|
+
* In format "Dec 22 19:39:00 2018 GMT"
|
|
324
611
|
*/
|
|
325
|
-
|
|
612
|
+
certNotAfter: string;
|
|
613
|
+
certSerial: string;
|
|
614
|
+
certFingerprintSHA1: string;
|
|
326
615
|
/**
|
|
327
|
-
*
|
|
616
|
+
* "SUCCESS", "FAILED:reason", "NONE"
|
|
328
617
|
*/
|
|
329
|
-
|
|
618
|
+
certVerified: string;
|
|
330
619
|
}
|
|
331
620
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
621
|
+
/**
|
|
622
|
+
* Workers KV is a global, low-latency, key-value data store. It supports exceptionally high read volumes with low-latency,
|
|
623
|
+
* making it possible to build highly dynamic APIs and websites which respond as quickly as a cached static file would.
|
|
624
|
+
*/
|
|
625
|
+
interface KVNamespace {
|
|
626
|
+
get(key: string, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<string | null>;
|
|
627
|
+
get(key: string, type: "text"): Promise<string | null>;
|
|
628
|
+
get<ExpectedValue = unknown>(key: string, type: "json"): Promise<ExpectedValue | null>;
|
|
629
|
+
get(key: string, type: "arrayBuffer"): Promise<ArrayBuffer | null>;
|
|
630
|
+
get(key: string, type: "stream"): Promise<ReadableStream | null>;
|
|
631
|
+
get(key: string, options: KVNamespaceGetOptions<"text">): Promise<string | null>;
|
|
632
|
+
get<ExpectedValue = unknown>(key: string, options: KVNamespaceGetOptions<"json">): Promise<ExpectedValue | null>;
|
|
633
|
+
get(key: string, options: KVNamespaceGetOptions<"arrayBuffer">): Promise<ArrayBuffer | null>;
|
|
634
|
+
get(key: string, options: KVNamespaceGetOptions<"stream">): Promise<ReadableStream | null>;
|
|
635
|
+
list<Metadata = unknown>(options?: KVNamespaceListOptions): Promise<KVNamespaceListResult<Metadata>>;
|
|
636
|
+
/**
|
|
637
|
+
* Creates a new key-value pair, or updates the value for a particular key.
|
|
638
|
+
* @param key key to associate with the value. A key cannot be empty, `.` or `..`. All other keys are valid.
|
|
639
|
+
* @param value value to store. The type is inferred. The maximum size of a value is 25MB.
|
|
640
|
+
* @returns Returns a `Promise` that you should `await` on in order to verify a successful update.
|
|
641
|
+
* @example
|
|
642
|
+
* await NAMESPACE.put(key, value)
|
|
643
|
+
*/
|
|
644
|
+
put(key: string, value: string | ArrayBuffer | ArrayBufferView | ReadableStream, options?: KVNamespacePutOptions): Promise<void>;
|
|
645
|
+
getWithMetadata<Metadata = unknown>(key: string, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
646
|
+
getWithMetadata<Metadata = unknown>(key: string, type: "text"): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
647
|
+
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: string, type: "json"): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
|
|
648
|
+
getWithMetadata<Metadata = unknown>(key: string, type: "arrayBuffer"): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
|
|
649
|
+
getWithMetadata<Metadata = unknown>(key: string, type: "stream"): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
|
|
650
|
+
getWithMetadata<Metadata = unknown>(key: string, options: KVNamespaceGetOptions<"text">): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
651
|
+
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: string, options: KVNamespaceGetOptions<"json">): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
|
|
652
|
+
getWithMetadata<Metadata = unknown>(key: string, options: KVNamespaceGetOptions<"arrayBuffer">): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
|
|
653
|
+
getWithMetadata<Metadata = unknown>(key: string, options: KVNamespaceGetOptions<"stream">): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
|
|
654
|
+
delete(name: string): Promise<void>;
|
|
346
655
|
}
|
|
347
656
|
|
|
348
|
-
interface
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
* Returns an array of key, value pairs for every entry in the search params.
|
|
352
|
-
*/
|
|
353
|
-
entries(): IterableIterator<[string, string]>;
|
|
354
|
-
/**
|
|
355
|
-
* Returns a list of keys in the search params.
|
|
356
|
-
*/
|
|
357
|
-
keys(): IterableIterator<string>;
|
|
358
|
-
/**
|
|
359
|
-
* Returns a list of values in the search params.
|
|
360
|
-
*/
|
|
361
|
-
values(): IterableIterator<string>;
|
|
657
|
+
interface KVNamespaceGetOptions<Type> {
|
|
658
|
+
type: Type;
|
|
659
|
+
cacheTtl?: number;
|
|
362
660
|
}
|
|
363
661
|
|
|
364
|
-
interface
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
*
|
|
368
|
-
* - true: Raw HTML
|
|
369
|
-
* - false: (Default) Text and any HTML will be escaped
|
|
370
|
-
*/
|
|
371
|
-
html: boolean;
|
|
662
|
+
interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
663
|
+
value: Value | null;
|
|
664
|
+
metadata: Metadata | null;
|
|
372
665
|
}
|
|
373
666
|
|
|
374
|
-
interface
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
namespaceURI: string;
|
|
380
|
-
/**
|
|
381
|
-
* e.g. "div"
|
|
382
|
-
*/
|
|
383
|
-
tagName: string;
|
|
384
|
-
/**
|
|
385
|
-
* Read-Only - key/value pairs of attributes.
|
|
386
|
-
*/
|
|
387
|
-
readonly attributes: IterableIterator<[string, string]>;
|
|
388
|
-
/**
|
|
389
|
-
* Indicates whether the element was removed/replaced in a previous handler
|
|
390
|
-
*/
|
|
391
|
-
removed: boolean;
|
|
667
|
+
interface KVNamespaceListKey<Metadata> {
|
|
668
|
+
name: string;
|
|
669
|
+
expiration?: number;
|
|
670
|
+
metadata?: Metadata;
|
|
671
|
+
}
|
|
392
672
|
|
|
673
|
+
interface KVNamespaceListOptions {
|
|
674
|
+
limit?: number;
|
|
675
|
+
prefix?: string | null;
|
|
676
|
+
cursor?: string | null;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
interface KVNamespaceListResult<Metadata> {
|
|
680
|
+
keys: KVNamespaceListKey<Metadata>[];
|
|
681
|
+
list_complete: boolean;
|
|
682
|
+
cursor?: string;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
interface KVNamespacePutOptions {
|
|
686
|
+
expiration?: number;
|
|
687
|
+
expirationTtl?: number;
|
|
688
|
+
metadata?: any | null;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
declare class MessageEvent extends Event {
|
|
692
|
+
constructor(type: string, initializer: MessageEventInit);
|
|
693
|
+
readonly data: ArrayBuffer | string;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
interface MessageEventInit {
|
|
697
|
+
data: ArrayBuffer | string;
|
|
698
|
+
}
|
|
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
|
+
|
|
726
|
+
declare abstract class ReadableStream {
|
|
727
|
+
readonly locked: boolean;
|
|
728
|
+
cancel(reason?: any): Promise<void>;
|
|
729
|
+
getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
|
|
730
|
+
getReader(): ReadableStreamDefaultReader;
|
|
731
|
+
pipeThrough(transform: ReadableStreamTransform, options?: PipeToOptions): ReadableStream;
|
|
732
|
+
pipeTo(destination: WritableStream, options?: PipeToOptions): Promise<void>;
|
|
733
|
+
tee(): [ReadableStream, ReadableStream];
|
|
734
|
+
}
|
|
735
|
+
|
|
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>>;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
declare class ReadableStreamDefaultReader {
|
|
746
|
+
constructor(stream: ReadableStream);
|
|
747
|
+
readonly closed: Promise<void>;
|
|
748
|
+
cancel(reason?: any): Promise<void>;
|
|
749
|
+
read(): Promise<ReadableStreamReadResult<any>>;
|
|
750
|
+
releaseLock(): void;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
interface ReadableStreamGetReaderOptions {
|
|
754
|
+
mode: string;
|
|
755
|
+
}
|
|
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
|
+
|
|
777
|
+
interface ReadableStreamTransform {
|
|
778
|
+
writable: WritableStream;
|
|
779
|
+
readable: ReadableStream;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
declare class Request extends Body {
|
|
783
|
+
constructor(input: Request | string, init?: RequestInit | Request);
|
|
784
|
+
clone(): Request;
|
|
785
|
+
readonly method: string;
|
|
786
|
+
readonly url: string;
|
|
787
|
+
readonly headers: Headers;
|
|
788
|
+
readonly redirect: string;
|
|
789
|
+
readonly fetcher: Fetcher | null;
|
|
790
|
+
readonly signal: AbortSignal;
|
|
791
|
+
readonly cf?: IncomingRequestCfProperties;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
interface RequestInit {
|
|
795
|
+
method?: string;
|
|
796
|
+
headers?: HeadersInit;
|
|
797
|
+
body?: BodyInit | null;
|
|
798
|
+
redirect?: string;
|
|
799
|
+
fetcher?: Fetcher | null;
|
|
393
800
|
/**
|
|
394
|
-
*
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
*
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
*
|
|
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: { ... } })
|
|
403
810
|
*/
|
|
404
|
-
|
|
811
|
+
cf?: IncomingRequestCfProperties | RequestInitCfProperties;
|
|
812
|
+
signal?: AbortSignal | null;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* In addition to the properties you can set in the RequestInit dict
|
|
817
|
+
* that you pass as an argument to the Request constructor, you can
|
|
818
|
+
* set certain properties of a `cf` object to control how Cloudflare
|
|
819
|
+
* features are applied to that new Request.
|
|
820
|
+
*
|
|
821
|
+
* Note: Currently, these properties cannot be tested in the
|
|
822
|
+
* playground.
|
|
823
|
+
*/
|
|
824
|
+
interface RequestInitCfProperties {
|
|
825
|
+
cacheEverything?: boolean;
|
|
405
826
|
/**
|
|
406
|
-
*
|
|
827
|
+
* A request's cache key is what determines if two requests are
|
|
828
|
+
* "the same" for caching purposes. If a request has the same cache key
|
|
829
|
+
* as some previous request, then we can serve the same cached response for
|
|
830
|
+
* both. (e.g. 'some-key')
|
|
831
|
+
*
|
|
832
|
+
* Only available for Enterprise customers.
|
|
407
833
|
*/
|
|
408
|
-
|
|
834
|
+
cacheKey?: string;
|
|
409
835
|
/**
|
|
410
|
-
*
|
|
836
|
+
* Force response to be cached for a given number of seconds. (e.g. 300)
|
|
411
837
|
*/
|
|
412
|
-
|
|
838
|
+
cacheTtl?: number;
|
|
413
839
|
/**
|
|
414
|
-
*
|
|
840
|
+
* Force response to be cached for a given number of seconds based on the Origin status code.
|
|
841
|
+
* (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })
|
|
415
842
|
*/
|
|
416
|
-
|
|
843
|
+
cacheTtlByStatus?: Record<string, number>;
|
|
844
|
+
scrapeShield?: boolean;
|
|
845
|
+
apps?: boolean;
|
|
846
|
+
image?: RequestInitCfPropertiesImage;
|
|
847
|
+
minify?: RequestInitCfPropertiesImageMinify;
|
|
848
|
+
mirage?: boolean;
|
|
417
849
|
/**
|
|
418
|
-
*
|
|
850
|
+
* Redirects the request to an alternate origin server. You can use this,
|
|
851
|
+
* for example, to implement load balancing across several origins.
|
|
852
|
+
* (e.g.us-east.example.com)
|
|
853
|
+
*
|
|
854
|
+
* Note - For security reasons, the hostname set in resolveOverride must
|
|
855
|
+
* be proxied on the same Cloudflare zone of the incoming request.
|
|
856
|
+
* Otherwise, the setting is ignored. CNAME hosts are allowed, so to
|
|
857
|
+
* resolve to a host under a different domain or a DNS only domain first
|
|
858
|
+
* declare a CNAME record within your own zone’s DNS mapping to the
|
|
859
|
+
* external hostname, set proxy on Cloudflare, then set resolveOverride
|
|
860
|
+
* to point to that CNAME record.
|
|
419
861
|
*/
|
|
420
|
-
|
|
862
|
+
resolveOverride?: string;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
interface RequestInitCfPropertiesImage extends BasicImageTransformations {
|
|
421
866
|
/**
|
|
422
|
-
*
|
|
867
|
+
* Device Pixel Ratio. Default 1. Multiplier for width/height that makes it
|
|
868
|
+
* easier to specify higher-DPI sizes in <img srcset>.
|
|
423
869
|
*/
|
|
424
|
-
|
|
870
|
+
dpr?: number;
|
|
425
871
|
/**
|
|
426
|
-
*
|
|
872
|
+
* Quality setting from 1-100 (useful values are in 60-90 range). Lower values
|
|
873
|
+
* make images look worse, but load faster. The default is 85. It applies only
|
|
874
|
+
* to JPEG and WebP images. It doesn’t have any effect on PNG.
|
|
427
875
|
*/
|
|
428
|
-
|
|
876
|
+
quality?: number;
|
|
429
877
|
/**
|
|
430
|
-
*
|
|
878
|
+
* Output format to generate. It can be:
|
|
879
|
+
* - avif: generate images in AVIF format.
|
|
880
|
+
* - webp: generate images in Google WebP format. Set quality to 100 to get
|
|
881
|
+
* the WebP-lossless format.
|
|
882
|
+
* - json: instead of generating an image, outputs information about the
|
|
883
|
+
* image, in JSON format. The JSON object will contain image size
|
|
884
|
+
* (before and after resizing), source image’s MIME type, file size, etc.
|
|
431
885
|
*/
|
|
432
|
-
|
|
886
|
+
format?: "avif" | "webp" | "json";
|
|
433
887
|
/**
|
|
434
|
-
*
|
|
888
|
+
* What EXIF data should be preserved in the output image. Note that EXIF
|
|
889
|
+
* rotation and embedded color profiles are always applied ("baked in" into
|
|
890
|
+
* the image), and aren't affected by this option. Note that if the Polish
|
|
891
|
+
* feature is enabled, all metadata may have been removed already and this
|
|
892
|
+
* option may have no effect.
|
|
893
|
+
* - keep: Preserve most of EXIF metadata, including GPS location if there's
|
|
894
|
+
* any.
|
|
895
|
+
* - copyright: Only keep the copyright tag, and discard everything else.
|
|
896
|
+
* This is the default behavior for JPEG files.
|
|
897
|
+
* - none: Discard all invisible EXIF metadata. Currently WebP and PNG
|
|
898
|
+
* output formats always discard metadata.
|
|
435
899
|
*/
|
|
436
|
-
|
|
900
|
+
metadata?: "keep" | "copyright" | "none";
|
|
437
901
|
/**
|
|
438
|
-
*
|
|
902
|
+
* Overlays are drawn in the order they appear in the array (last array
|
|
903
|
+
* entry is the topmost layer).
|
|
439
904
|
*/
|
|
440
|
-
|
|
905
|
+
draw?: RequestInitCfPropertiesImageDraw[];
|
|
441
906
|
}
|
|
442
907
|
|
|
443
|
-
interface
|
|
444
|
-
/**
|
|
445
|
-
*
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
908
|
+
interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
|
|
909
|
+
/**
|
|
910
|
+
* Absolute URL of the image file to use for the drawing. It can be any of
|
|
911
|
+
* the supported file formats. For drawing of watermarks or non-rectangular
|
|
912
|
+
* overlays we recommend using PNG or WebP images.
|
|
913
|
+
*/
|
|
914
|
+
url: string;
|
|
915
|
+
/**
|
|
916
|
+
* Floating-point number between 0 (transparent) and 1 (opaque).
|
|
917
|
+
* For example, opacity: 0.5 makes overlay semitransparent.
|
|
918
|
+
*/
|
|
919
|
+
opacity?: number;
|
|
920
|
+
/**
|
|
921
|
+
* - If set to true, the overlay image will be tiled to cover the entire
|
|
922
|
+
* area. This is useful for stock-photo-like watermarks.
|
|
923
|
+
* - If set to "x", the overlay image will be tiled horizontally only
|
|
924
|
+
* (form a line).
|
|
925
|
+
* - If set to "y", the overlay image will be tiled vertically only
|
|
926
|
+
* (form a line).
|
|
927
|
+
*/
|
|
928
|
+
repeat?: true | "x" | "y";
|
|
929
|
+
/**
|
|
930
|
+
* Position of the overlay image relative to a given edge. Each property is
|
|
931
|
+
* an offset in pixels. 0 aligns exactly to the edge. For example, left: 10
|
|
932
|
+
* positions left side of the overlay 10 pixels from the left edge of the
|
|
933
|
+
* image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom
|
|
934
|
+
* of the background image.
|
|
935
|
+
*
|
|
936
|
+
* Setting both left & right, or both top & bottom is an error.
|
|
937
|
+
*
|
|
938
|
+
* If no position is specified, the image will be centered.
|
|
939
|
+
*/
|
|
940
|
+
top?: number;
|
|
941
|
+
left?: number;
|
|
942
|
+
bottom?: number;
|
|
943
|
+
right?: number;
|
|
944
|
+
}
|
|
457
945
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
/**
|
|
463
|
-
* Inserts content right after the element.
|
|
464
|
-
*/
|
|
465
|
-
after(content: string, options?: ContentOptions): Element;
|
|
466
|
-
/**
|
|
467
|
-
* Removes the element and inserts content in place of it.
|
|
468
|
-
*/
|
|
469
|
-
replace(content: string, options?: ContentOptions): Element;
|
|
470
|
-
/**
|
|
471
|
-
* Removes the element with all its content.
|
|
472
|
-
*/
|
|
473
|
-
remove(): Element;
|
|
946
|
+
interface RequestInitCfPropertiesImageMinify {
|
|
947
|
+
javascript?: boolean;
|
|
948
|
+
css?: boolean;
|
|
949
|
+
html?: boolean;
|
|
474
950
|
}
|
|
475
951
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
/**
|
|
482
|
-
* This property can be assigned different values, to modify comment’s text.
|
|
483
|
-
*/
|
|
484
|
-
text: string;
|
|
952
|
+
/**
|
|
953
|
+
* Back compat for code migrating from older definitions.
|
|
954
|
+
* @deprecated Use RequestInit instead.
|
|
955
|
+
*/
|
|
956
|
+
declare type RequestInitializerDict = RequestInit;
|
|
485
957
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
/**
|
|
499
|
-
* Removes the element with all its content.
|
|
500
|
-
*/
|
|
501
|
-
remove(): Element;
|
|
958
|
+
declare class Response extends Body {
|
|
959
|
+
constructor(bodyInit?: BodyInit | null, maybeInit?: ResponseInit | Response);
|
|
960
|
+
static redirect(url: string, status?: number): Response;
|
|
961
|
+
clone(): Response;
|
|
962
|
+
readonly status: number;
|
|
963
|
+
readonly statusText: string;
|
|
964
|
+
readonly headers: Headers;
|
|
965
|
+
readonly ok: boolean;
|
|
966
|
+
readonly redirected: boolean;
|
|
967
|
+
readonly url: string;
|
|
968
|
+
readonly webSocket: WebSocket | null;
|
|
969
|
+
readonly cf?: Object;
|
|
502
970
|
}
|
|
503
971
|
|
|
504
|
-
interface
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
* Read-Only, The quoted string in the doctype after the SYSTEM atom or immediately after the publicId.
|
|
512
|
-
*/
|
|
513
|
-
readonly systemId: string | null;
|
|
972
|
+
interface ResponseInit {
|
|
973
|
+
status?: number;
|
|
974
|
+
statusText?: string;
|
|
975
|
+
headers?: HeadersInit;
|
|
976
|
+
cf?: Object;
|
|
977
|
+
webSocket?: WebSocket | null;
|
|
978
|
+
encodeBody?: string;
|
|
514
979
|
}
|
|
515
980
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
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 {
|
|
988
|
+
readonly scheduledTime: number;
|
|
989
|
+
readonly cron: string;
|
|
990
|
+
noRetry(): void;
|
|
521
991
|
}
|
|
522
992
|
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
/**
|
|
529
|
-
* An incoming comment
|
|
530
|
-
*/
|
|
531
|
-
comments?(comment: Comment): void | Promise<void>;
|
|
532
|
-
/**
|
|
533
|
-
* An incoming piece of text
|
|
534
|
-
*/
|
|
535
|
-
text?(text: Text): void | Promise<void>;
|
|
993
|
+
declare abstract class ScheduledEvent extends Event {
|
|
994
|
+
readonly scheduledTime: number;
|
|
995
|
+
readonly cron: string;
|
|
996
|
+
noRetry(): void;
|
|
997
|
+
waitUntil(promise: Promise<any>): void;
|
|
536
998
|
}
|
|
537
999
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
1000
|
+
interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
1001
|
+
btoa(data: string): string;
|
|
1002
|
+
atob(data: string): string;
|
|
1003
|
+
setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
|
|
1004
|
+
clearTimeout(timeoutId: number | null): void;
|
|
1005
|
+
setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
|
|
1006
|
+
clearInterval(timeoutId: number | null): void;
|
|
1007
|
+
queueMicrotask(task: Function): void;
|
|
1008
|
+
fetch(request: Request | string, requestInitr?: RequestInit | Request): Promise<Response>;
|
|
1009
|
+
readonly self: ServiceWorkerGlobalScope;
|
|
1010
|
+
readonly crypto: Crypto;
|
|
1011
|
+
readonly caches: CacheStorage;
|
|
1012
|
+
readonly console: Console;
|
|
1013
|
+
}
|
|
543
1014
|
|
|
544
|
-
type
|
|
1015
|
+
declare type StreamPipeOptions = PipeToOptions;
|
|
545
1016
|
|
|
546
|
-
interface
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
*/
|
|
550
|
-
doctype(doctype: Doctype): void | Promise<void>;
|
|
551
|
-
/**
|
|
552
|
-
* An incoming comment
|
|
553
|
-
*/
|
|
554
|
-
comments(comment: Comment): void | Promise<void>;
|
|
555
|
-
/**
|
|
556
|
-
* An incoming piece of text
|
|
557
|
-
*/
|
|
558
|
-
text(text: Text): void | Promise<void>;
|
|
559
|
-
/**
|
|
560
|
-
* The ending of the document
|
|
561
|
-
*/
|
|
562
|
-
end(end: DocumentEnd): void | Promise<void>;
|
|
1017
|
+
interface StreamQueuingStrategy {
|
|
1018
|
+
highWaterMark?: number;
|
|
1019
|
+
size(chunk: ArrayBuffer): number;
|
|
563
1020
|
}
|
|
564
1021
|
|
|
565
|
-
declare class
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
1022
|
+
declare abstract class SubtleCrypto {
|
|
1023
|
+
encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer): Promise<ArrayBuffer>;
|
|
1024
|
+
decrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, cipherText: ArrayBuffer): Promise<ArrayBuffer>;
|
|
1025
|
+
sign(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>;
|
|
1026
|
+
verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer, data: ArrayBuffer): Promise<boolean>;
|
|
1027
|
+
digest(algorithm: string | SubtleCryptoHashAlgorithm, data: ArrayBuffer): Promise<ArrayBuffer>;
|
|
1028
|
+
generateKey(algorithm: string | SubtleCryptoGenerateKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey | CryptoKeyPair>;
|
|
1029
|
+
deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
|
|
1030
|
+
deriveBits(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, length: number | null): Promise<ArrayBuffer>;
|
|
1031
|
+
importKey(format: string, keyData: ArrayBuffer | SubtleCryptoJsonWebKey, algorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
|
|
1032
|
+
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | SubtleCryptoJsonWebKey>;
|
|
1033
|
+
wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>;
|
|
1034
|
+
unwrapKey(format: string, wrappedKey: ArrayBuffer, unwrappingKey: CryptoKey, unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
|
|
570
1035
|
}
|
|
571
1036
|
|
|
572
|
-
|
|
573
|
-
|
|
1037
|
+
interface SubtleCryptoDeriveKeyAlgorithm {
|
|
1038
|
+
name: string;
|
|
1039
|
+
salt?: ArrayBuffer;
|
|
1040
|
+
iterations?: number;
|
|
1041
|
+
hash?: string | SubtleCryptoHashAlgorithm;
|
|
1042
|
+
public?: CryptoKey;
|
|
1043
|
+
info?: ArrayBuffer;
|
|
574
1044
|
}
|
|
575
1045
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
1046
|
+
interface SubtleCryptoEncryptAlgorithm {
|
|
1047
|
+
name: string;
|
|
1048
|
+
iv?: ArrayBuffer;
|
|
1049
|
+
additionalData?: ArrayBuffer;
|
|
1050
|
+
tagLength?: number;
|
|
1051
|
+
counter?: ArrayBuffer;
|
|
1052
|
+
length?: number;
|
|
1053
|
+
label?: ArrayBuffer;
|
|
1054
|
+
}
|
|
581
1055
|
|
|
582
|
-
interface
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
getWithMetadata<Metadata = unknown>(key: string): KVValueWithMetadata<string, Metadata>;
|
|
590
|
-
getWithMetadata<Metadata = unknown>(
|
|
591
|
-
key: string,
|
|
592
|
-
type: 'text'
|
|
593
|
-
): KVValueWithMetadata<string, Metadata>;
|
|
594
|
-
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
|
|
595
|
-
key: string,
|
|
596
|
-
type: 'json'
|
|
597
|
-
): KVValueWithMetadata<ExpectedValue, Metadata>;
|
|
598
|
-
getWithMetadata<Metadata = unknown>(
|
|
599
|
-
key: string,
|
|
600
|
-
type: 'arrayBuffer'
|
|
601
|
-
): KVValueWithMetadata<ArrayBuffer, Metadata>;
|
|
602
|
-
getWithMetadata<Metadata = unknown>(
|
|
603
|
-
key: string,
|
|
604
|
-
type: 'stream'
|
|
605
|
-
): KVValueWithMetadata<ReadableStream, Metadata>;
|
|
606
|
-
|
|
607
|
-
put(
|
|
608
|
-
key: string,
|
|
609
|
-
value: string | ReadableStream | ArrayBuffer | FormData,
|
|
610
|
-
options?: {
|
|
611
|
-
expiration?: string | number;
|
|
612
|
-
expirationTtl?: string | number;
|
|
613
|
-
metadata?: any;
|
|
614
|
-
}
|
|
615
|
-
): Promise<void>;
|
|
616
|
-
|
|
617
|
-
delete(key: string): Promise<void>;
|
|
618
|
-
|
|
619
|
-
list(options?: {
|
|
620
|
-
prefix?: string;
|
|
621
|
-
limit?: number;
|
|
622
|
-
cursor?: string;
|
|
623
|
-
}): Promise<{
|
|
624
|
-
keys: { name: string; expiration?: number; metadata?: unknown }[];
|
|
625
|
-
list_complete: boolean;
|
|
626
|
-
cursor?: string;
|
|
627
|
-
}>;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
interface DurableObjectEntries<T> {
|
|
631
|
-
[key: string]: T;
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
interface DurableObjectListOptions {
|
|
635
|
-
start?: string;
|
|
636
|
-
end?: string;
|
|
637
|
-
reverse?: boolean;
|
|
638
|
-
limit?: number;
|
|
639
|
-
prefix?: string;
|
|
1056
|
+
interface SubtleCryptoGenerateKeyAlgorithm {
|
|
1057
|
+
name: string;
|
|
1058
|
+
hash?: string | SubtleCryptoHashAlgorithm;
|
|
1059
|
+
modulusLength?: number;
|
|
1060
|
+
publicExponent?: ArrayBuffer;
|
|
1061
|
+
length?: number;
|
|
1062
|
+
namedCurve?: string;
|
|
640
1063
|
}
|
|
641
1064
|
|
|
642
|
-
interface
|
|
643
|
-
|
|
644
|
-
get<T = unknown>(keys: Array<string>): Promise<Map<string, T>>;
|
|
645
|
-
put<T = unknown>(key: string, value: T): Promise<void>;
|
|
646
|
-
put<T = unknown>(entries: DurableObjectEntries<T>): Promise<void>;
|
|
647
|
-
delete(key: string): Promise<boolean>;
|
|
648
|
-
delete(keys: Array<string>): Promise<number>;
|
|
649
|
-
deleteAll(): Promise<void>;
|
|
650
|
-
list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;
|
|
1065
|
+
interface SubtleCryptoHashAlgorithm {
|
|
1066
|
+
name: string;
|
|
651
1067
|
}
|
|
652
1068
|
|
|
653
|
-
interface
|
|
654
|
-
|
|
1069
|
+
interface SubtleCryptoImportKeyAlgorithm {
|
|
1070
|
+
name: string;
|
|
1071
|
+
hash?: string | SubtleCryptoHashAlgorithm;
|
|
1072
|
+
length?: number;
|
|
1073
|
+
namedCurve?: string;
|
|
1074
|
+
compressed?: boolean;
|
|
655
1075
|
}
|
|
656
1076
|
|
|
657
|
-
interface
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
1077
|
+
interface SubtleCryptoJsonWebKey {
|
|
1078
|
+
kty: string;
|
|
1079
|
+
use?: string;
|
|
1080
|
+
key_ops?: string[];
|
|
1081
|
+
alg?: string;
|
|
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;
|
|
661
1096
|
}
|
|
662
1097
|
|
|
663
|
-
interface
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
* Use this method to notify the runtime to wait for asynchronous tasks
|
|
668
|
-
* (e.g. logging, analytics to third-party services, streaming and caching).
|
|
669
|
-
*/
|
|
670
|
-
waitUntil(promise: Promise<any>): void;
|
|
1098
|
+
interface SubtleCryptoJsonWebKeyRsaOtherPrimesInfo {
|
|
1099
|
+
r?: string;
|
|
1100
|
+
d?: string;
|
|
1101
|
+
t?: string;
|
|
671
1102
|
}
|
|
672
1103
|
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
1104
|
+
interface SubtleCryptoSignAlgorithm {
|
|
1105
|
+
name: string;
|
|
1106
|
+
hash?: string | SubtleCryptoHashAlgorithm;
|
|
1107
|
+
dataLength?: number;
|
|
1108
|
+
saltLength?: number;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
interface Text {
|
|
1112
|
+
readonly text: string;
|
|
1113
|
+
readonly lastInTextNode: boolean;
|
|
1114
|
+
readonly removed: boolean;
|
|
1115
|
+
before(content: Content, options?: ContentOptions): Text;
|
|
1116
|
+
after(content: Content, options?: ContentOptions): Text;
|
|
1117
|
+
replace(content: Content, options?: ContentOptions): Text;
|
|
1118
|
+
remove(): Text;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
declare class TextDecoder {
|
|
1122
|
+
constructor(label?: "utf-8" | "utf8" | "unicode-1-1-utf-8", options?: TextDecoderConstructorOptions);
|
|
1123
|
+
decode(input?: ArrayBuffer, options?: TextDecoderDecodeOptions): string;
|
|
1124
|
+
readonly encoding: string;
|
|
1125
|
+
readonly fatal: boolean;
|
|
1126
|
+
readonly ignoreBOM: boolean;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
interface TextDecoderConstructorOptions {
|
|
1130
|
+
fatal: boolean;
|
|
1131
|
+
ignoreBOM: boolean;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
interface TextDecoderDecodeOptions {
|
|
1135
|
+
stream: boolean;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
declare class TextEncoder {
|
|
1139
|
+
constructor();
|
|
1140
|
+
encode(input?: string): Uint8Array;
|
|
1141
|
+
encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult;
|
|
1142
|
+
readonly encoding: string;
|
|
678
1143
|
}
|
|
679
1144
|
|
|
1145
|
+
interface TextEncoderEncodeIntoResult {
|
|
1146
|
+
read: number;
|
|
1147
|
+
written: number;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
declare class TransformStream {
|
|
1151
|
+
constructor();
|
|
1152
|
+
readonly readable: ReadableStream;
|
|
1153
|
+
readonly writable: WritableStream;
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
declare class URL {
|
|
1157
|
+
constructor(url: string, base?: string);
|
|
1158
|
+
href: string;
|
|
1159
|
+
readonly origin: string;
|
|
1160
|
+
protocol: string;
|
|
1161
|
+
username: string;
|
|
1162
|
+
password: string;
|
|
1163
|
+
host: string;
|
|
1164
|
+
hostname: string;
|
|
1165
|
+
port: string;
|
|
1166
|
+
pathname: string;
|
|
1167
|
+
search: string;
|
|
1168
|
+
readonly searchParams: URLSearchParams;
|
|
1169
|
+
hash: string;
|
|
1170
|
+
toString(): string;
|
|
1171
|
+
toJSON(): string;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
declare class URLSearchParams {
|
|
1175
|
+
constructor(init?: URLSearchParamsInit);
|
|
1176
|
+
append(name: string, value: string): void;
|
|
1177
|
+
delete(name: string): void;
|
|
1178
|
+
get(name: string): string | null;
|
|
1179
|
+
getAll(name: string): string[];
|
|
1180
|
+
has(name: string): boolean;
|
|
1181
|
+
set(name: string, value: string): void;
|
|
1182
|
+
sort(): void;
|
|
1183
|
+
entries(): IterableIterator<[key: string, value: string]>;
|
|
1184
|
+
keys(): IterableIterator<string>;
|
|
1185
|
+
values(): IterableIterator<string>;
|
|
1186
|
+
forEach<This = unknown>(callback: (this: This, key: string, value: string, parent: URLSearchParams) => void, thisArg?: This): void;
|
|
1187
|
+
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
|
|
1188
|
+
toString(): string;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
declare type URLSearchParamsInit = URLSearchParams | string | Record<string, string> | ([key: string, value: string])[];
|
|
1192
|
+
|
|
680
1193
|
/**
|
|
681
|
-
*
|
|
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.
|
|
682
1198
|
*/
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
1199
|
+
declare type URLSearchParamsInitializer = URLSearchParamsInit;
|
|
1200
|
+
|
|
1201
|
+
declare abstract class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
1202
|
+
accept(): void;
|
|
1203
|
+
send(message: ArrayBuffer | string): void;
|
|
1204
|
+
close(code?: number, reason?: string): void;
|
|
687
1205
|
}
|
|
688
1206
|
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
1207
|
+
declare type WebSocketEventMap = { close: CloseEvent; message: MessageEvent; };
|
|
1208
|
+
|
|
1209
|
+
declare const WebSocketPair: { new(): { 0: WebSocket; 1: WebSocket; }; };
|
|
1210
|
+
|
|
1211
|
+
declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {
|
|
1212
|
+
|
|
692
1213
|
}
|
|
693
1214
|
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
1215
|
+
declare type WorkerGlobalScopeEventMap = { fetch: FetchEvent; scheduled: ScheduledEvent; unhandledrejection: PromiseRejectionEvent; rejectionhandled: PromiseRejectionEvent; };
|
|
1216
|
+
|
|
1217
|
+
declare abstract class WritableStream {
|
|
1218
|
+
readonly locked: boolean;
|
|
1219
|
+
abort(reason: any): Promise<void>;
|
|
1220
|
+
close(): Promise<void>;
|
|
1221
|
+
getWriter(): WritableStreamDefaultWriter;
|
|
1222
|
+
}
|
|
698
1223
|
|
|
699
|
-
|
|
1224
|
+
declare class WritableStreamDefaultWriter {
|
|
1225
|
+
constructor(stream: WritableStream);
|
|
1226
|
+
readonly closed: Promise<void>;
|
|
1227
|
+
readonly desiredSize: number | null;
|
|
1228
|
+
abort(reason: any): Promise<void>;
|
|
1229
|
+
close(): Promise<void>;
|
|
1230
|
+
write(chunk: any): Promise<void>;
|
|
1231
|
+
releaseLock(): void;
|
|
700
1232
|
}
|
|
1233
|
+
|
|
1234
|
+
/**
|
|
1235
|
+
* Back-compat alias.
|
|
1236
|
+
* @deprecated Use WritableStreamDefaultWriter
|
|
1237
|
+
*/
|
|
1238
|
+
declare type WritableStreamWritableStreamDefaultWriter = WritableStreamDefaultWriter;
|
|
1239
|
+
|
|
1240
|
+
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
|
|
1241
|
+
|
|
1242
|
+
declare function atob(data: string): string;
|
|
1243
|
+
|
|
1244
|
+
declare function btoa(data: string): string;
|
|
1245
|
+
|
|
1246
|
+
declare const caches: CacheStorage;
|
|
1247
|
+
|
|
1248
|
+
declare function clearInterval(timeoutId: number | null): void;
|
|
1249
|
+
|
|
1250
|
+
declare function clearTimeout(timeoutId: number | null): void;
|
|
1251
|
+
|
|
1252
|
+
declare const console: Console;
|
|
1253
|
+
|
|
1254
|
+
declare const crypto: Crypto;
|
|
1255
|
+
|
|
1256
|
+
declare function dispatchEvent(event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]): boolean;
|
|
1257
|
+
|
|
1258
|
+
declare function fetch(request: Request | string, requestInitr?: RequestInit | Request): Promise<Response>;
|
|
1259
|
+
|
|
1260
|
+
declare function queueMicrotask(task: Function): void;
|
|
1261
|
+
|
|
1262
|
+
declare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
|
|
1263
|
+
|
|
1264
|
+
declare const self: ServiceWorkerGlobalScope;
|
|
1265
|
+
|
|
1266
|
+
declare function setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
|
|
1267
|
+
|
|
1268
|
+
declare function setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
|
|
1269
|
+
|