@cloudflare/workers-types 2.2.1 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -7
- package/index.d.ts +1108 -508
- 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,11 +45,11 @@ 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
|
|
62
|
-
* "left", "right", "top", "bottom" or "center" (the default),
|
|
52
|
+
* "left", "right", "top", "bottom", "auto", or "center" (the default),
|
|
63
53
|
* or an object {x, y} containing focal point coordinates in the original
|
|
64
54
|
* image expressed as fractions ranging from 0.0 (top or left) to 1.0
|
|
65
55
|
* (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will
|
|
@@ -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" | "auto" | 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,499 @@ 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<T extends Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array>(buffer: T): T;
|
|
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 DurableObjectGetOptions {
|
|
284
|
+
allowConcurrency?: boolean;
|
|
285
|
+
noCache?: boolean;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
interface DurableObjectId {
|
|
289
|
+
toString(): string;
|
|
290
|
+
equals(other: DurableObjectId): boolean;
|
|
291
|
+
readonly name?: string;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
interface DurableObjectListOptions {
|
|
295
|
+
start?: string;
|
|
296
|
+
end?: string;
|
|
297
|
+
prefix?: string;
|
|
298
|
+
reverse?: boolean;
|
|
299
|
+
limit?: number;
|
|
300
|
+
allowConcurrency?: boolean;
|
|
301
|
+
noCache?: boolean;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
interface DurableObjectNamespace {
|
|
305
|
+
newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId;
|
|
306
|
+
idFromName(name: string): DurableObjectId;
|
|
307
|
+
idFromString(id: string): DurableObjectId;
|
|
308
|
+
get(id: DurableObjectId): DurableObjectStub;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
312
|
+
jurisdiction?: string;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
interface DurableObjectPutOptions {
|
|
316
|
+
allowConcurrency?: boolean;
|
|
317
|
+
allowUnconfirmed?: boolean;
|
|
318
|
+
noCache?: boolean;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
interface DurableObjectState {
|
|
322
|
+
waitUntil(promise: Promise<any>): void;
|
|
323
|
+
readonly id: DurableObjectId | string;
|
|
324
|
+
readonly storage: DurableObjectStorage;
|
|
325
|
+
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
interface DurableObjectStorage {
|
|
329
|
+
get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;
|
|
330
|
+
get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;
|
|
331
|
+
list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;
|
|
332
|
+
put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;
|
|
333
|
+
put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;
|
|
334
|
+
delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
|
|
335
|
+
delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
|
|
336
|
+
deleteAll(options?: DurableObjectPutOptions): Promise<void>;
|
|
337
|
+
transaction<T>(closure: (txn: DurableObjectTransaction) => Promise<T>): Promise<T>;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
*
|
|
342
|
+
* @deprecated Don't use. Introduced incidentally in 3.x. Scheduled for removal.
|
|
343
|
+
*/
|
|
344
|
+
declare type DurableObjectStorageOperationsGetOptions = DurableObjectGetOptions;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
*
|
|
348
|
+
* @deprecated Don't use. Introduced incidentally in 3.x. Scheduled for removal.
|
|
349
|
+
*/
|
|
350
|
+
declare type DurableObjectStorageOperationsListOptions = DurableObjectListOptions;
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
*
|
|
354
|
+
* @deprecated Don't use. Introduced incidentally in 3.x. Scheduled for removal.
|
|
355
|
+
*/
|
|
356
|
+
declare type DurableObjectStorageOperationsPutOptions = DurableObjectPutOptions;
|
|
357
|
+
|
|
358
|
+
interface DurableObjectStub extends Fetcher {
|
|
359
|
+
readonly id: DurableObjectId;
|
|
360
|
+
readonly name?: string;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
interface DurableObjectTransaction {
|
|
364
|
+
get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T>;
|
|
365
|
+
get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;
|
|
366
|
+
list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;
|
|
367
|
+
put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;
|
|
368
|
+
put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;
|
|
369
|
+
delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
|
|
370
|
+
delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
|
|
371
|
+
rollback(): void;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
interface Element {
|
|
375
|
+
tagName: string;
|
|
376
|
+
readonly attributes: IterableIterator<string[]>;
|
|
377
|
+
readonly removed: boolean;
|
|
378
|
+
readonly namespaceURI: string;
|
|
379
|
+
getAttribute(name: string): string | null;
|
|
380
|
+
hasAttribute(name: string): boolean;
|
|
381
|
+
setAttribute(name: string, value: string): Element;
|
|
382
|
+
removeAttribute(name: string): Element;
|
|
383
|
+
before(content: Content, options?: ContentOptions): Element;
|
|
384
|
+
after(content: Content, options?: ContentOptions): Element;
|
|
385
|
+
prepend(content: Content, options?: ContentOptions): Element;
|
|
386
|
+
append(content: Content, options?: ContentOptions): Element;
|
|
387
|
+
replace(content: Content, options?: ContentOptions): Element;
|
|
388
|
+
remove(): Element;
|
|
389
|
+
removeAndKeepContent(): Element;
|
|
390
|
+
setInnerContent(content: Content, options?: ContentOptions): Element;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
declare class Event {
|
|
394
|
+
constructor(type: string, init?: EventInit);
|
|
395
|
+
readonly type: string;
|
|
396
|
+
readonly eventPhase: number;
|
|
397
|
+
readonly composed: boolean;
|
|
398
|
+
readonly bubbles: boolean;
|
|
399
|
+
readonly cancelable: boolean;
|
|
400
|
+
readonly defaultPrevented: boolean;
|
|
401
|
+
readonly returnValue: boolean;
|
|
402
|
+
readonly currentTarget?: EventTarget;
|
|
403
|
+
readonly srcElement?: EventTarget;
|
|
404
|
+
readonly timeStamp: number;
|
|
405
|
+
readonly isTrusted: boolean;
|
|
406
|
+
cancelBubble: boolean;
|
|
407
|
+
stopImmediatePropagation(): void;
|
|
408
|
+
preventDefault(): void;
|
|
409
|
+
stopPropagation(): void;
|
|
410
|
+
composedPath(): EventTarget[];
|
|
411
|
+
static readonly NONE: number;
|
|
412
|
+
static readonly CAPTURING_PHASE: number;
|
|
413
|
+
static readonly AT_TARGET: number;
|
|
414
|
+
static readonly BUBBLING_PHASE: number;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
interface EventInit {
|
|
418
|
+
bubbles?: boolean;
|
|
419
|
+
cancelable?: boolean;
|
|
420
|
+
composed?: boolean;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
declare type EventListener<EventType extends Event = Event> = (event: EventType) => void;
|
|
424
|
+
|
|
425
|
+
interface EventListenerObject<EventType extends Event = Event> {
|
|
426
|
+
handleEvent(event: EventType): void;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
declare type EventListenerOrEventListenerObject<EventType extends Event = Event> = EventListener<EventType> | EventListenerObject<EventType>;
|
|
430
|
+
|
|
431
|
+
declare class EventTarget<EventMap extends Record<string, Event> = Record<string, Event>> {
|
|
432
|
+
constructor();
|
|
433
|
+
addEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
|
|
434
|
+
removeEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
|
|
435
|
+
dispatchEvent(event: EventMap[keyof EventMap]): boolean;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
interface EventTargetAddEventListenerOptions {
|
|
439
|
+
capture?: boolean;
|
|
440
|
+
passive?: boolean;
|
|
441
|
+
once?: boolean;
|
|
442
|
+
signal?: AbortSignal;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
interface EventTargetEventListenerOptions {
|
|
446
|
+
capture?: boolean;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
interface ExecutionContext {
|
|
450
|
+
waitUntil(promise: Promise<any>): void;
|
|
451
|
+
passThroughOnException(): void;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
interface ExportedHandler<Env = unknown> {
|
|
455
|
+
fetch?: ExportedHandlerFetchHandler<Env>;
|
|
456
|
+
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
214
457
|
}
|
|
215
458
|
|
|
459
|
+
declare type ExportedHandlerFetchHandler<Env = unknown> = (request: Request, env: Env, ctx: ExecutionContext) => Response | Promise<Response>;
|
|
460
|
+
|
|
461
|
+
declare type ExportedHandlerScheduledHandler<Env = unknown> = (controller: ScheduledController, env: Env, ctx: ExecutionContext) => void | Promise<void>;
|
|
462
|
+
|
|
463
|
+
declare abstract class FetchEvent extends Event {
|
|
464
|
+
readonly request: Request;
|
|
465
|
+
respondWith(promise: Response | Promise<Response>): void;
|
|
466
|
+
passThroughOnException(): void;
|
|
467
|
+
waitUntil(promise: Promise<any>): void;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
declare abstract class Fetcher {
|
|
471
|
+
fetch(requestOrUrl: Request | string, requestInit?: RequestInit | Request): Promise<Response>;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
declare class File extends Blob {
|
|
475
|
+
constructor(bits?: BlobBits, name?: string, options?: FileOptions);
|
|
476
|
+
readonly name: string;
|
|
477
|
+
readonly lastModified: number;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
interface FileOptions {
|
|
481
|
+
type?: string;
|
|
482
|
+
lastModified?: number;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
declare class FixedLengthStream extends TransformStream {
|
|
486
|
+
constructor(expectedLength: number);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
declare class FormData {
|
|
490
|
+
constructor();
|
|
491
|
+
append(name: string, value: string): void;
|
|
492
|
+
append(name: string, value: Blob, filename?: string): void;
|
|
493
|
+
delete(name: string): void;
|
|
494
|
+
get(name: string): File | string | null;
|
|
495
|
+
getAll(name: string): (File | string)[];
|
|
496
|
+
has(name: string): boolean;
|
|
497
|
+
set(name: string, value: string): void;
|
|
498
|
+
set(name: string, value: Blob, filename?: string): void;
|
|
499
|
+
entries(): IterableIterator<([key: string, value: File | string])[]>;
|
|
500
|
+
keys(): IterableIterator<string>;
|
|
501
|
+
values(): IterableIterator<File | string>;
|
|
502
|
+
forEach<This = unknown>(callback: (this: This, key: string, value: File | string, parent: FormData) => void, thisArg?: This): void;
|
|
503
|
+
[Symbol.iterator](): IterableIterator<([key: string, value: File | string])[]>;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
declare class HTMLRewriter {
|
|
507
|
+
constructor();
|
|
508
|
+
on(selector: string, handlers: HTMLRewriterElementContentHandlers): HTMLRewriter;
|
|
509
|
+
onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;
|
|
510
|
+
transform(response: Response): Response;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
interface HTMLRewriterDocumentContentHandlers {
|
|
514
|
+
doctype?(doctype: Doctype): void | Promise<void>;
|
|
515
|
+
comments?(comment: Comment): void | Promise<void>;
|
|
516
|
+
text?(text: Text): void | Promise<void>;
|
|
517
|
+
end?(end: DocumentEnd): void | Promise<void>;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
interface HTMLRewriterElementContentHandlers {
|
|
521
|
+
element?(element: Element): void | Promise<void>;
|
|
522
|
+
comments?(comment: Comment): void | Promise<void>;
|
|
523
|
+
text?(text: Text): void | Promise<void>;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
declare class Headers {
|
|
527
|
+
constructor(init?: HeadersInit);
|
|
528
|
+
get(name: string): string | null;
|
|
529
|
+
getAll(name: string): string[];
|
|
530
|
+
has(name: string): boolean;
|
|
531
|
+
set(name: string, value: string): void;
|
|
532
|
+
append(name: string, value: string): void;
|
|
533
|
+
delete(name: string): void;
|
|
534
|
+
forEach<This = unknown>(callback: (this: This, key: string, value: string, parent: Headers) => void, thisArg?: This): void;
|
|
535
|
+
entries(): IterableIterator<[key: string, value: string]>;
|
|
536
|
+
keys(): IterableIterator<string>;
|
|
537
|
+
values(): IterableIterator<string>;
|
|
538
|
+
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
declare type HeadersInit = Headers | Record<string, string> | ([key: string, value: string])[];
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* Back compat for code migrating to older definitions.
|
|
545
|
+
* @deprecated Use HeadersInit instead.
|
|
546
|
+
*/
|
|
547
|
+
declare type HeadersInitializer = HeadersInit;
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* In addition to the properties on the standard Request object,
|
|
551
|
+
* the cf object contains extra information about the request provided
|
|
552
|
+
* by Cloudflare's edge.
|
|
553
|
+
*
|
|
554
|
+
* Note: Currently, settings in the cf object cannot be accessed in the
|
|
555
|
+
* playground.
|
|
556
|
+
*/
|
|
216
557
|
interface IncomingRequestCfProperties {
|
|
217
558
|
/**
|
|
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.
|
|
559
|
+
* (e.g. 395747)
|
|
224
560
|
*/
|
|
561
|
+
asn: number;
|
|
225
562
|
/**
|
|
226
|
-
*
|
|
563
|
+
* The organisation which owns the ASN of the incoming request.
|
|
564
|
+
* (e.g. Google Cloud)
|
|
227
565
|
*/
|
|
228
|
-
|
|
229
|
-
botManagement?:
|
|
230
|
-
score: number;
|
|
231
|
-
staticResource: boolean;
|
|
232
|
-
verifiedBot: boolean;
|
|
233
|
-
};
|
|
566
|
+
asOrganization: string;
|
|
567
|
+
botManagement?: IncomingRequestCfPropertiesBotManagement;
|
|
234
568
|
city?: string;
|
|
235
569
|
clientTcpRtt: number;
|
|
236
570
|
clientTrustScore?: number;
|
|
@@ -271,430 +605,696 @@ interface IncomingRequestCfProperties {
|
|
|
271
605
|
timezone?: string;
|
|
272
606
|
tlsVersion: string;
|
|
273
607
|
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;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
interface RequestInit {
|
|
293
|
-
/**
|
|
294
|
-
* cf is a union of these two types because there are multiple
|
|
295
|
-
* scenarios in which it might be one or the other. If you need
|
|
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;
|
|
608
|
+
tlsClientAuth: IncomingRequestCfPropertiesTLSClientAuth;
|
|
307
609
|
}
|
|
308
610
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
cf: IncomingRequestCfProperties;
|
|
611
|
+
interface IncomingRequestCfPropertiesBotManagement {
|
|
612
|
+
score: number;
|
|
613
|
+
staticResource: boolean;
|
|
614
|
+
verifiedBot: boolean;
|
|
314
615
|
}
|
|
315
616
|
|
|
316
|
-
interface
|
|
317
|
-
|
|
617
|
+
interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
618
|
+
certIssuerDNLegacy: string;
|
|
619
|
+
certIssuerDN: string;
|
|
620
|
+
certPresented: "0" | "1";
|
|
621
|
+
certSubjectDNLegacy: string;
|
|
622
|
+
certSubjectDN: string;
|
|
318
623
|
/**
|
|
319
|
-
*
|
|
624
|
+
* In format "Dec 22 19:39:00 2018 GMT"
|
|
320
625
|
*/
|
|
321
|
-
|
|
626
|
+
certNotBefore: string;
|
|
322
627
|
/**
|
|
323
|
-
*
|
|
628
|
+
* In format "Dec 22 19:39:00 2018 GMT"
|
|
324
629
|
*/
|
|
325
|
-
|
|
630
|
+
certNotAfter: string;
|
|
631
|
+
certSerial: string;
|
|
632
|
+
certFingerprintSHA1: string;
|
|
326
633
|
/**
|
|
327
|
-
*
|
|
634
|
+
* "SUCCESS", "FAILED:reason", "NONE"
|
|
328
635
|
*/
|
|
329
|
-
|
|
636
|
+
certVerified: string;
|
|
330
637
|
}
|
|
331
638
|
|
|
332
|
-
interface
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
639
|
+
interface JsonWebKey {
|
|
640
|
+
kty: string;
|
|
641
|
+
use?: string;
|
|
642
|
+
key_ops?: string[];
|
|
643
|
+
alg?: string;
|
|
644
|
+
ext?: boolean;
|
|
645
|
+
crv?: string;
|
|
646
|
+
x?: string;
|
|
647
|
+
y?: string;
|
|
648
|
+
d?: string;
|
|
649
|
+
n?: string;
|
|
650
|
+
e?: string;
|
|
651
|
+
p?: string;
|
|
652
|
+
q?: string;
|
|
653
|
+
dp?: string;
|
|
654
|
+
dq?: string;
|
|
655
|
+
qi?: string;
|
|
656
|
+
oth?: RsaOtherPrimesInfo[];
|
|
657
|
+
k?: string;
|
|
346
658
|
}
|
|
347
659
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
660
|
+
/**
|
|
661
|
+
* Workers KV is a global, low-latency, key-value data store. It supports exceptionally high read volumes with low-latency,
|
|
662
|
+
* making it possible to build highly dynamic APIs and websites which respond as quickly as a cached static file would.
|
|
663
|
+
*/
|
|
664
|
+
interface KVNamespace {
|
|
665
|
+
get(key: string, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<string | null>;
|
|
666
|
+
get(key: string, type: "text"): Promise<string | null>;
|
|
667
|
+
get<ExpectedValue = unknown>(key: string, type: "json"): Promise<ExpectedValue | null>;
|
|
668
|
+
get(key: string, type: "arrayBuffer"): Promise<ArrayBuffer | null>;
|
|
669
|
+
get(key: string, type: "stream"): Promise<ReadableStream | null>;
|
|
670
|
+
get(key: string, options: KVNamespaceGetOptions<"text">): Promise<string | null>;
|
|
671
|
+
get<ExpectedValue = unknown>(key: string, options: KVNamespaceGetOptions<"json">): Promise<ExpectedValue | null>;
|
|
672
|
+
get(key: string, options: KVNamespaceGetOptions<"arrayBuffer">): Promise<ArrayBuffer | null>;
|
|
673
|
+
get(key: string, options: KVNamespaceGetOptions<"stream">): Promise<ReadableStream | null>;
|
|
674
|
+
list<Metadata = unknown>(options?: KVNamespaceListOptions): Promise<KVNamespaceListResult<Metadata>>;
|
|
675
|
+
/**
|
|
676
|
+
* Creates a new key-value pair, or updates the value for a particular key.
|
|
677
|
+
* @param key key to associate with the value. A key cannot be empty, `.` or `..`. All other keys are valid.
|
|
678
|
+
* @param value value to store. The type is inferred. The maximum size of a value is 25MB.
|
|
679
|
+
* @returns Returns a `Promise` that you should `await` on in order to verify a successful update.
|
|
680
|
+
* @example
|
|
681
|
+
* await NAMESPACE.put(key, value)
|
|
682
|
+
*/
|
|
683
|
+
put(key: string, value: string | ArrayBuffer | ArrayBufferView | ReadableStream, options?: KVNamespacePutOptions): Promise<void>;
|
|
684
|
+
getWithMetadata<Metadata = unknown>(key: string, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
685
|
+
getWithMetadata<Metadata = unknown>(key: string, type: "text"): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
686
|
+
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: string, type: "json"): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
|
|
687
|
+
getWithMetadata<Metadata = unknown>(key: string, type: "arrayBuffer"): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
|
|
688
|
+
getWithMetadata<Metadata = unknown>(key: string, type: "stream"): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
|
|
689
|
+
getWithMetadata<Metadata = unknown>(key: string, options: KVNamespaceGetOptions<"text">): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
690
|
+
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: string, options: KVNamespaceGetOptions<"json">): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
|
|
691
|
+
getWithMetadata<Metadata = unknown>(key: string, options: KVNamespaceGetOptions<"arrayBuffer">): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
|
|
692
|
+
getWithMetadata<Metadata = unknown>(key: string, options: KVNamespaceGetOptions<"stream">): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
|
|
693
|
+
delete(name: string): Promise<void>;
|
|
362
694
|
}
|
|
363
695
|
|
|
364
|
-
interface
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
*
|
|
368
|
-
* - true: Raw HTML
|
|
369
|
-
* - false: (Default) Text and any HTML will be escaped
|
|
370
|
-
*/
|
|
371
|
-
html: boolean;
|
|
696
|
+
interface KVNamespaceGetOptions<Type> {
|
|
697
|
+
type: Type;
|
|
698
|
+
cacheTtl?: number;
|
|
372
699
|
}
|
|
373
700
|
|
|
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;
|
|
701
|
+
interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
702
|
+
value: Value | null;
|
|
703
|
+
metadata: Metadata | null;
|
|
704
|
+
}
|
|
392
705
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
* Returns a boolean indicating whether an attribute exists on the element.
|
|
399
|
-
*/
|
|
400
|
-
hasAttribute(name: string): boolean;
|
|
401
|
-
/**
|
|
402
|
-
* Sets an attribute to a provided value, creating the attribute if it doesn’t exist.
|
|
403
|
-
*/
|
|
404
|
-
setAttribute(name: string, value: string): Element;
|
|
405
|
-
/**
|
|
406
|
-
* Removes the attribute.
|
|
407
|
-
*/
|
|
408
|
-
removeAttribute(name: string): Element;
|
|
409
|
-
/**
|
|
410
|
-
* Inserts content before the element.
|
|
411
|
-
*/
|
|
412
|
-
before(content: string, options?: ContentOptions): Element;
|
|
413
|
-
/**
|
|
414
|
-
* Inserts content right after the element.
|
|
415
|
-
*/
|
|
416
|
-
after(content: string, options?: ContentOptions): Element;
|
|
417
|
-
/**
|
|
418
|
-
* Inserts content right after the start tag of the element.
|
|
419
|
-
*/
|
|
420
|
-
prepend(content: string, options?: ContentOptions): Element;
|
|
421
|
-
/**
|
|
422
|
-
* Inserts content right before the end tag of the element.
|
|
423
|
-
*/
|
|
424
|
-
append(content: string, options?: ContentOptions): Element;
|
|
425
|
-
/**
|
|
426
|
-
* Removes the element and inserts content in place of it.
|
|
427
|
-
*/
|
|
428
|
-
replace(content: string, options?: ContentOptions): Element;
|
|
429
|
-
/**
|
|
430
|
-
* Replaces content of the element.
|
|
431
|
-
*/
|
|
432
|
-
setInnerContent(content: string, options?: ContentOptions): Element;
|
|
433
|
-
/**
|
|
434
|
-
* Removes the element with all its content.
|
|
435
|
-
*/
|
|
436
|
-
remove(): Element;
|
|
437
|
-
/**
|
|
438
|
-
* Removes the start tag and end tag of the element, but keeps its inner content intact.
|
|
439
|
-
*/
|
|
440
|
-
removeAndKeepContent(): Element;
|
|
706
|
+
interface KVNamespaceListKey<Metadata> {
|
|
707
|
+
name: string;
|
|
708
|
+
expiration?: number;
|
|
709
|
+
metadata?: Metadata;
|
|
441
710
|
}
|
|
442
711
|
|
|
443
|
-
interface
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
712
|
+
interface KVNamespaceListOptions {
|
|
713
|
+
limit?: number;
|
|
714
|
+
prefix?: string | null;
|
|
715
|
+
cursor?: string | null;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
interface KVNamespaceListResult<Metadata> {
|
|
719
|
+
keys: KVNamespaceListKey<Metadata>[];
|
|
720
|
+
list_complete: boolean;
|
|
721
|
+
cursor?: string;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
interface KVNamespacePutOptions {
|
|
725
|
+
expiration?: number;
|
|
726
|
+
expirationTtl?: number;
|
|
727
|
+
metadata?: any | null;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
declare class MessageEvent extends Event {
|
|
731
|
+
constructor(type: string, initializer: MessageEventInit);
|
|
732
|
+
readonly data: ArrayBuffer | string;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
interface MessageEventInit {
|
|
736
|
+
data: ArrayBuffer | string;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* Back compat for code migrating from older definitions.
|
|
741
|
+
* @deprecated Use MessageEventInit instead.
|
|
742
|
+
*/
|
|
743
|
+
declare type MessageEventInitializer = MessageEventInit;
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* Transitionary name.
|
|
747
|
+
* @deprecated Use StreamPipeOptions
|
|
748
|
+
*/
|
|
749
|
+
interface PipeToOptions {
|
|
750
|
+
preventClose?: boolean;
|
|
751
|
+
preventAbort?: boolean;
|
|
752
|
+
preventCancel?: boolean;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
declare abstract class PromiseRejectionEvent extends Event {
|
|
756
|
+
readonly promise: Promise<any>;
|
|
757
|
+
readonly reason: any;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
interface ReadResult {
|
|
761
|
+
value?: any;
|
|
762
|
+
done: boolean;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
declare abstract class ReadableStream {
|
|
766
|
+
readonly locked: boolean;
|
|
767
|
+
cancel(reason?: any): Promise<void>;
|
|
768
|
+
getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
|
|
769
|
+
getReader(): ReadableStreamDefaultReader;
|
|
770
|
+
pipeThrough(transform: ReadableStreamTransform, options?: PipeToOptions): ReadableStream;
|
|
771
|
+
pipeTo(destination: WritableStream, options?: PipeToOptions): Promise<void>;
|
|
772
|
+
tee(): [ReadableStream, ReadableStream];
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
declare class ReadableStreamBYOBReader {
|
|
776
|
+
constructor(stream: ReadableStream);
|
|
777
|
+
readonly closed: Promise<void>;
|
|
778
|
+
cancel(reason?: any): Promise<void>;
|
|
779
|
+
read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
|
|
780
|
+
releaseLock(): void;
|
|
781
|
+
readAtLeast(minBytes: number, view: Uint8Array): Promise<ReadableStreamReadResult<Uint8Array>>;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
declare class ReadableStreamDefaultReader {
|
|
785
|
+
constructor(stream: ReadableStream);
|
|
786
|
+
readonly closed: Promise<void>;
|
|
787
|
+
cancel(reason?: any): Promise<void>;
|
|
788
|
+
read(): Promise<ReadableStreamReadResult<any>>;
|
|
789
|
+
releaseLock(): void;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
interface ReadableStreamGetReaderOptions {
|
|
793
|
+
mode: string;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Back-compat alias.
|
|
798
|
+
* @deprecated Use StreamPipeOptions
|
|
799
|
+
*/
|
|
800
|
+
declare type ReadableStreamPipeToOptions = PipeToOptions;
|
|
801
|
+
|
|
802
|
+
declare type ReadableStreamReadResult<T = any> = { done: true; value: undefined; } | { done: false; value: T; };
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Back-compat alias.
|
|
806
|
+
* @deprecated Use ReadableStreamBYOBReader
|
|
807
|
+
*/
|
|
808
|
+
declare type ReadableStreamReadableStreamBYOBReader = ReadableStreamBYOBReader;
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* Back-compat alias.
|
|
812
|
+
* @deprecated Use ReadableStreamDefaultReader
|
|
813
|
+
*/
|
|
814
|
+
declare type ReadableStreamReadableStreamDefaultReader = ReadableStreamDefaultReader;
|
|
815
|
+
|
|
816
|
+
interface ReadableStreamTransform {
|
|
817
|
+
writable: WritableStream;
|
|
818
|
+
readable: ReadableStream;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
declare class Request extends Body {
|
|
822
|
+
constructor(input: Request | string, init?: RequestInit | Request);
|
|
823
|
+
clone(): Request;
|
|
824
|
+
readonly method: string;
|
|
825
|
+
readonly url: string;
|
|
826
|
+
readonly headers: Headers;
|
|
827
|
+
readonly redirect: string;
|
|
828
|
+
readonly fetcher: Fetcher | null;
|
|
829
|
+
readonly signal: AbortSignal;
|
|
830
|
+
readonly cf?: IncomingRequestCfProperties;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
interface RequestInit {
|
|
834
|
+
method?: string;
|
|
835
|
+
headers?: HeadersInit;
|
|
836
|
+
body?: BodyInit | null;
|
|
837
|
+
redirect?: string;
|
|
838
|
+
fetcher?: Fetcher | null;
|
|
453
839
|
/**
|
|
454
|
-
*
|
|
840
|
+
* cf is a union of these two types because there are multiple
|
|
841
|
+
* scenarios in which it might be one or the other.
|
|
842
|
+
*
|
|
843
|
+
* IncomingRequestCfProperties is required to allow
|
|
844
|
+
* new Request(someUrl, event.request)
|
|
845
|
+
*
|
|
846
|
+
* RequestInitCfProperties is required to allow
|
|
847
|
+
* new Request(event.request, {cf: { ... } })
|
|
848
|
+
* fetch(someUrl, {cf: { ... } })
|
|
455
849
|
*/
|
|
456
|
-
|
|
850
|
+
cf?: IncomingRequestCfProperties | RequestInitCfProperties;
|
|
851
|
+
signal?: AbortSignal | null;
|
|
852
|
+
}
|
|
457
853
|
|
|
854
|
+
/**
|
|
855
|
+
* In addition to the properties you can set in the RequestInit dict
|
|
856
|
+
* that you pass as an argument to the Request constructor, you can
|
|
857
|
+
* set certain properties of a `cf` object to control how Cloudflare
|
|
858
|
+
* features are applied to that new Request.
|
|
859
|
+
*
|
|
860
|
+
* Note: Currently, these properties cannot be tested in the
|
|
861
|
+
* playground.
|
|
862
|
+
*/
|
|
863
|
+
interface RequestInitCfProperties {
|
|
864
|
+
cacheEverything?: boolean;
|
|
458
865
|
/**
|
|
459
|
-
*
|
|
866
|
+
* A request's cache key is what determines if two requests are
|
|
867
|
+
* "the same" for caching purposes. If a request has the same cache key
|
|
868
|
+
* as some previous request, then we can serve the same cached response for
|
|
869
|
+
* both. (e.g. 'some-key')
|
|
870
|
+
*
|
|
871
|
+
* Only available for Enterprise customers.
|
|
460
872
|
*/
|
|
461
|
-
|
|
873
|
+
cacheKey?: string;
|
|
462
874
|
/**
|
|
463
|
-
*
|
|
875
|
+
* Force response to be cached for a given number of seconds. (e.g. 300)
|
|
464
876
|
*/
|
|
465
|
-
|
|
877
|
+
cacheTtl?: number;
|
|
466
878
|
/**
|
|
467
|
-
*
|
|
879
|
+
* Force response to be cached for a given number of seconds based on the Origin status code.
|
|
880
|
+
* (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })
|
|
468
881
|
*/
|
|
469
|
-
|
|
882
|
+
cacheTtlByStatus?: Record<string, number>;
|
|
883
|
+
scrapeShield?: boolean;
|
|
884
|
+
apps?: boolean;
|
|
885
|
+
image?: RequestInitCfPropertiesImage;
|
|
886
|
+
minify?: RequestInitCfPropertiesImageMinify;
|
|
887
|
+
mirage?: boolean;
|
|
888
|
+
polish?: 'lossy' | 'lossless' | 'off';
|
|
470
889
|
/**
|
|
471
|
-
*
|
|
890
|
+
* Redirects the request to an alternate origin server. You can use this,
|
|
891
|
+
* for example, to implement load balancing across several origins.
|
|
892
|
+
* (e.g.us-east.example.com)
|
|
893
|
+
*
|
|
894
|
+
* Note - For security reasons, the hostname set in resolveOverride must
|
|
895
|
+
* be proxied on the same Cloudflare zone of the incoming request.
|
|
896
|
+
* Otherwise, the setting is ignored. CNAME hosts are allowed, so to
|
|
897
|
+
* resolve to a host under a different domain or a DNS only domain first
|
|
898
|
+
* declare a CNAME record within your own zone’s DNS mapping to the
|
|
899
|
+
* external hostname, set proxy on Cloudflare, then set resolveOverride
|
|
900
|
+
* to point to that CNAME record.
|
|
472
901
|
*/
|
|
473
|
-
|
|
902
|
+
resolveOverride?: string;
|
|
474
903
|
}
|
|
475
904
|
|
|
476
|
-
interface
|
|
477
|
-
/**
|
|
478
|
-
* Indicates whether the element was removed/replaced in a previous handler.
|
|
479
|
-
*/
|
|
480
|
-
removed: boolean;
|
|
905
|
+
interface RequestInitCfPropertiesImage extends BasicImageTransformations {
|
|
481
906
|
/**
|
|
482
|
-
*
|
|
907
|
+
* Device Pixel Ratio. Default 1. Multiplier for width/height that makes it
|
|
908
|
+
* easier to specify higher-DPI sizes in <img srcset>.
|
|
483
909
|
*/
|
|
484
|
-
|
|
485
|
-
|
|
910
|
+
dpr?: number;
|
|
486
911
|
/**
|
|
487
|
-
*
|
|
912
|
+
* Quality setting from 1-100 (useful values are in 60-90 range). Lower values
|
|
913
|
+
* make images look worse, but load faster. The default is 85. It applies only
|
|
914
|
+
* to JPEG and WebP images. It doesn’t have any effect on PNG.
|
|
488
915
|
*/
|
|
489
|
-
|
|
916
|
+
quality?: number;
|
|
490
917
|
/**
|
|
491
|
-
*
|
|
918
|
+
* Output format to generate. It can be:
|
|
919
|
+
* - avif: generate images in AVIF format.
|
|
920
|
+
* - webp: generate images in Google WebP format. Set quality to 100 to get
|
|
921
|
+
* the WebP-lossless format.
|
|
922
|
+
* - json: instead of generating an image, outputs information about the
|
|
923
|
+
* image, in JSON format. The JSON object will contain image size
|
|
924
|
+
* (before and after resizing), source image’s MIME type, file size, etc.
|
|
492
925
|
*/
|
|
493
|
-
|
|
926
|
+
format?: "avif" | "webp" | "json";
|
|
494
927
|
/**
|
|
495
|
-
*
|
|
928
|
+
* What EXIF data should be preserved in the output image. Note that EXIF
|
|
929
|
+
* rotation and embedded color profiles are always applied ("baked in" into
|
|
930
|
+
* the image), and aren't affected by this option. Note that if the Polish
|
|
931
|
+
* feature is enabled, all metadata may have been removed already and this
|
|
932
|
+
* option may have no effect.
|
|
933
|
+
* - keep: Preserve most of EXIF metadata, including GPS location if there's
|
|
934
|
+
* any.
|
|
935
|
+
* - copyright: Only keep the copyright tag, and discard everything else.
|
|
936
|
+
* This is the default behavior for JPEG files.
|
|
937
|
+
* - none: Discard all invisible EXIF metadata. Currently WebP and PNG
|
|
938
|
+
* output formats always discard metadata.
|
|
496
939
|
*/
|
|
497
|
-
|
|
940
|
+
metadata?: "keep" | "copyright" | "none";
|
|
498
941
|
/**
|
|
499
|
-
*
|
|
942
|
+
* Overlays are drawn in the order they appear in the array (last array
|
|
943
|
+
* entry is the topmost layer).
|
|
500
944
|
*/
|
|
501
|
-
|
|
945
|
+
draw?: RequestInitCfPropertiesImageDraw[];
|
|
502
946
|
}
|
|
503
947
|
|
|
504
|
-
interface
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
*
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
948
|
+
interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
|
|
949
|
+
/**
|
|
950
|
+
* Absolute URL of the image file to use for the drawing. It can be any of
|
|
951
|
+
* the supported file formats. For drawing of watermarks or non-rectangular
|
|
952
|
+
* overlays we recommend using PNG or WebP images.
|
|
953
|
+
*/
|
|
954
|
+
url: string;
|
|
955
|
+
/**
|
|
956
|
+
* Floating-point number between 0 (transparent) and 1 (opaque).
|
|
957
|
+
* For example, opacity: 0.5 makes overlay semitransparent.
|
|
958
|
+
*/
|
|
959
|
+
opacity?: number;
|
|
960
|
+
/**
|
|
961
|
+
* - If set to true, the overlay image will be tiled to cover the entire
|
|
962
|
+
* area. This is useful for stock-photo-like watermarks.
|
|
963
|
+
* - If set to "x", the overlay image will be tiled horizontally only
|
|
964
|
+
* (form a line).
|
|
965
|
+
* - If set to "y", the overlay image will be tiled vertically only
|
|
966
|
+
* (form a line).
|
|
967
|
+
*/
|
|
968
|
+
repeat?: true | "x" | "y";
|
|
969
|
+
/**
|
|
970
|
+
* Position of the overlay image relative to a given edge. Each property is
|
|
971
|
+
* an offset in pixels. 0 aligns exactly to the edge. For example, left: 10
|
|
972
|
+
* positions left side of the overlay 10 pixels from the left edge of the
|
|
973
|
+
* image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom
|
|
974
|
+
* of the background image.
|
|
975
|
+
*
|
|
976
|
+
* Setting both left & right, or both top & bottom is an error.
|
|
977
|
+
*
|
|
978
|
+
* If no position is specified, the image will be centered.
|
|
979
|
+
*/
|
|
980
|
+
top?: number;
|
|
981
|
+
left?: number;
|
|
982
|
+
bottom?: number;
|
|
983
|
+
right?: number;
|
|
514
984
|
}
|
|
515
985
|
|
|
516
|
-
interface
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
append(content: string, options?: ContentOptions): DocumentEnd;
|
|
986
|
+
interface RequestInitCfPropertiesImageMinify {
|
|
987
|
+
javascript?: boolean;
|
|
988
|
+
css?: boolean;
|
|
989
|
+
html?: boolean;
|
|
521
990
|
}
|
|
522
991
|
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
992
|
+
/**
|
|
993
|
+
* Back compat for code migrating from older definitions.
|
|
994
|
+
* @deprecated Use RequestInit instead.
|
|
995
|
+
*/
|
|
996
|
+
declare type RequestInitializerDict = RequestInit;
|
|
997
|
+
|
|
998
|
+
declare class Response extends Body {
|
|
999
|
+
constructor(bodyInit?: BodyInit | null, maybeInit?: ResponseInit | Response);
|
|
1000
|
+
static redirect(url: string, status?: number): Response;
|
|
1001
|
+
clone(): Response;
|
|
1002
|
+
readonly status: number;
|
|
1003
|
+
readonly statusText: string;
|
|
1004
|
+
readonly headers: Headers;
|
|
1005
|
+
readonly ok: boolean;
|
|
1006
|
+
readonly redirected: boolean;
|
|
1007
|
+
readonly url: string;
|
|
1008
|
+
readonly webSocket: WebSocket | null;
|
|
1009
|
+
readonly cf?: Object;
|
|
536
1010
|
}
|
|
537
1011
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
1012
|
+
interface ResponseInit {
|
|
1013
|
+
status?: number;
|
|
1014
|
+
statusText?: string;
|
|
1015
|
+
headers?: HeadersInit;
|
|
1016
|
+
cf?: Object;
|
|
1017
|
+
webSocket?: WebSocket | null;
|
|
1018
|
+
encodeBody?: string;
|
|
1019
|
+
}
|
|
543
1020
|
|
|
544
|
-
|
|
1021
|
+
/**
|
|
1022
|
+
* Back compat for code migrating from older definitions.
|
|
1023
|
+
* @deprecated Use ResponseInit instead.
|
|
1024
|
+
*/
|
|
1025
|
+
declare type ResponseInitializerDict = ResponseInit;
|
|
545
1026
|
|
|
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>;
|
|
1027
|
+
interface RsaOtherPrimesInfo {
|
|
1028
|
+
r?: string;
|
|
1029
|
+
d?: string;
|
|
1030
|
+
t?: string;
|
|
563
1031
|
}
|
|
564
1032
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
public transform(response: Response): Response;
|
|
1033
|
+
interface ScheduledController {
|
|
1034
|
+
readonly scheduledTime: number;
|
|
1035
|
+
readonly cron: string;
|
|
1036
|
+
noRetry(): void;
|
|
570
1037
|
}
|
|
571
1038
|
|
|
572
|
-
declare
|
|
573
|
-
|
|
1039
|
+
declare abstract class ScheduledEvent extends Event {
|
|
1040
|
+
readonly scheduledTime: number;
|
|
1041
|
+
readonly cron: string;
|
|
1042
|
+
noRetry(): void;
|
|
1043
|
+
waitUntil(promise: Promise<any>): void;
|
|
574
1044
|
}
|
|
575
1045
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
1046
|
+
interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
1047
|
+
btoa(data: string): string;
|
|
1048
|
+
atob(data: string): string;
|
|
1049
|
+
setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
|
|
1050
|
+
clearTimeout(timeoutId: number | null): void;
|
|
1051
|
+
setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
|
|
1052
|
+
clearInterval(timeoutId: number | null): void;
|
|
1053
|
+
queueMicrotask(task: Function): void;
|
|
1054
|
+
fetch(request: Request | string, requestInitr?: RequestInit | Request): Promise<Response>;
|
|
1055
|
+
readonly self: ServiceWorkerGlobalScope;
|
|
1056
|
+
readonly crypto: Crypto;
|
|
1057
|
+
readonly caches: CacheStorage;
|
|
1058
|
+
readonly console: Console;
|
|
1059
|
+
}
|
|
581
1060
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
get(key: string, type: 'stream'): KVValue<ReadableStream>;
|
|
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;
|
|
1061
|
+
declare type StreamPipeOptions = PipeToOptions;
|
|
1062
|
+
|
|
1063
|
+
interface StreamQueuingStrategy {
|
|
1064
|
+
highWaterMark?: number;
|
|
1065
|
+
size(chunk: ArrayBuffer): number;
|
|
632
1066
|
}
|
|
633
1067
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
1068
|
+
declare abstract class SubtleCrypto {
|
|
1069
|
+
encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer): Promise<ArrayBuffer>;
|
|
1070
|
+
decrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, cipherText: ArrayBuffer): Promise<ArrayBuffer>;
|
|
1071
|
+
sign(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>;
|
|
1072
|
+
verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer, data: ArrayBuffer): Promise<boolean>;
|
|
1073
|
+
digest(algorithm: string | SubtleCryptoHashAlgorithm, data: ArrayBuffer): Promise<ArrayBuffer>;
|
|
1074
|
+
generateKey(algorithm: string | SubtleCryptoGenerateKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey | CryptoKeyPair>;
|
|
1075
|
+
deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
|
|
1076
|
+
deriveBits(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, length: number | null): Promise<ArrayBuffer>;
|
|
1077
|
+
importKey(format: string, keyData: ArrayBuffer | JsonWebKey, algorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
|
|
1078
|
+
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
|
|
1079
|
+
wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>;
|
|
1080
|
+
unwrapKey(format: string, wrappedKey: ArrayBuffer, unwrappingKey: CryptoKey, unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
|
|
640
1081
|
}
|
|
641
1082
|
|
|
642
|
-
interface
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
deleteAll(): Promise<void>;
|
|
650
|
-
list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;
|
|
1083
|
+
interface SubtleCryptoDeriveKeyAlgorithm {
|
|
1084
|
+
name: string;
|
|
1085
|
+
salt?: ArrayBuffer;
|
|
1086
|
+
iterations?: number;
|
|
1087
|
+
hash?: string | SubtleCryptoHashAlgorithm;
|
|
1088
|
+
public?: CryptoKey;
|
|
1089
|
+
info?: ArrayBuffer;
|
|
651
1090
|
}
|
|
652
1091
|
|
|
653
|
-
interface
|
|
654
|
-
|
|
1092
|
+
interface SubtleCryptoEncryptAlgorithm {
|
|
1093
|
+
name: string;
|
|
1094
|
+
iv?: ArrayBuffer;
|
|
1095
|
+
additionalData?: ArrayBuffer;
|
|
1096
|
+
tagLength?: number;
|
|
1097
|
+
counter?: ArrayBuffer;
|
|
1098
|
+
length?: number;
|
|
1099
|
+
label?: ArrayBuffer;
|
|
655
1100
|
}
|
|
656
1101
|
|
|
657
|
-
interface
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
1102
|
+
interface SubtleCryptoGenerateKeyAlgorithm {
|
|
1103
|
+
name: string;
|
|
1104
|
+
hash?: string | SubtleCryptoHashAlgorithm;
|
|
1105
|
+
modulusLength?: number;
|
|
1106
|
+
publicExponent?: ArrayBuffer;
|
|
1107
|
+
length?: number;
|
|
1108
|
+
namedCurve?: string;
|
|
661
1109
|
}
|
|
662
1110
|
|
|
663
|
-
interface
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
1111
|
+
interface SubtleCryptoHashAlgorithm {
|
|
1112
|
+
name: string;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
interface SubtleCryptoImportKeyAlgorithm {
|
|
1116
|
+
name: string;
|
|
1117
|
+
hash?: string | SubtleCryptoHashAlgorithm;
|
|
1118
|
+
length?: number;
|
|
1119
|
+
namedCurve?: string;
|
|
1120
|
+
compressed?: boolean;
|
|
671
1121
|
}
|
|
672
1122
|
|
|
673
1123
|
/**
|
|
674
|
-
*
|
|
1124
|
+
*
|
|
1125
|
+
* @deprecated Don't use. Introduced incidentally in 3.x. Scheduled for removal.
|
|
675
1126
|
*/
|
|
676
|
-
|
|
677
|
-
|
|
1127
|
+
declare type SubtleCryptoJsonWebKey = JsonWebKey;
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
*
|
|
1131
|
+
* @deprecated Don't use. Introduced incidentally in 3.x. Scheduled for removal.
|
|
1132
|
+
*/
|
|
1133
|
+
declare type SubtleCryptoJsonWebKeyRsaOtherPrimesInfo = RsaOtherPrimesInfo;
|
|
1134
|
+
|
|
1135
|
+
interface SubtleCryptoSignAlgorithm {
|
|
1136
|
+
name: string;
|
|
1137
|
+
hash?: string | SubtleCryptoHashAlgorithm;
|
|
1138
|
+
dataLength?: number;
|
|
1139
|
+
saltLength?: number;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
interface Text {
|
|
1143
|
+
readonly text: string;
|
|
1144
|
+
readonly lastInTextNode: boolean;
|
|
1145
|
+
readonly removed: boolean;
|
|
1146
|
+
before(content: Content, options?: ContentOptions): Text;
|
|
1147
|
+
after(content: Content, options?: ContentOptions): Text;
|
|
1148
|
+
replace(content: Content, options?: ContentOptions): Text;
|
|
1149
|
+
remove(): Text;
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
declare class TextDecoder {
|
|
1153
|
+
constructor(label?: "utf-8" | "utf8" | "unicode-1-1-utf-8", options?: TextDecoderConstructorOptions);
|
|
1154
|
+
decode(input?: ArrayBuffer, options?: TextDecoderDecodeOptions): string;
|
|
1155
|
+
readonly encoding: string;
|
|
1156
|
+
readonly fatal: boolean;
|
|
1157
|
+
readonly ignoreBOM: boolean;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
interface TextDecoderConstructorOptions {
|
|
1161
|
+
fatal: boolean;
|
|
1162
|
+
ignoreBOM: boolean;
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
interface TextDecoderDecodeOptions {
|
|
1166
|
+
stream: boolean;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
declare class TextEncoder {
|
|
1170
|
+
constructor();
|
|
1171
|
+
encode(input?: string): Uint8Array;
|
|
1172
|
+
encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult;
|
|
1173
|
+
readonly encoding: string;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
interface TextEncoderEncodeIntoResult {
|
|
1177
|
+
read: number;
|
|
1178
|
+
written: number;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
declare class TransformStream {
|
|
1182
|
+
constructor();
|
|
1183
|
+
readonly readable: ReadableStream;
|
|
1184
|
+
readonly writable: WritableStream;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
declare class URL {
|
|
1188
|
+
constructor(url: string, base?: string);
|
|
1189
|
+
href: string;
|
|
1190
|
+
readonly origin: string;
|
|
1191
|
+
protocol: string;
|
|
1192
|
+
username: string;
|
|
1193
|
+
password: string;
|
|
1194
|
+
host: string;
|
|
1195
|
+
hostname: string;
|
|
1196
|
+
port: string;
|
|
1197
|
+
pathname: string;
|
|
1198
|
+
search: string;
|
|
1199
|
+
readonly searchParams: URLSearchParams;
|
|
1200
|
+
hash: string;
|
|
1201
|
+
toString(): string;
|
|
1202
|
+
toJSON(): string;
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
declare class URLSearchParams {
|
|
1206
|
+
constructor(init?: URLSearchParamsInit);
|
|
1207
|
+
append(name: string, value: string): void;
|
|
1208
|
+
delete(name: string): void;
|
|
1209
|
+
get(name: string): string | null;
|
|
1210
|
+
getAll(name: string): string[];
|
|
1211
|
+
has(name: string): boolean;
|
|
1212
|
+
set(name: string, value: string): void;
|
|
1213
|
+
sort(): void;
|
|
1214
|
+
entries(): IterableIterator<[key: string, value: string]>;
|
|
1215
|
+
keys(): IterableIterator<string>;
|
|
1216
|
+
values(): IterableIterator<string>;
|
|
1217
|
+
forEach<This = unknown>(callback: (this: This, key: string, value: string, parent: URLSearchParams) => void, thisArg?: This): void;
|
|
1218
|
+
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
|
|
1219
|
+
toString(): string;
|
|
678
1220
|
}
|
|
679
1221
|
|
|
1222
|
+
declare type URLSearchParamsInit = URLSearchParams | string | Record<string, string> | ([key: string, value: string])[];
|
|
1223
|
+
|
|
680
1224
|
/**
|
|
681
|
-
*
|
|
1225
|
+
* Back compat for code migrating to older definitions.
|
|
1226
|
+
* This technically isn't part of a standard either way, but the naming
|
|
1227
|
+
* is more consistent.
|
|
1228
|
+
* @deprecated Use URLSearchParamsInit instead.
|
|
682
1229
|
*/
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
1230
|
+
declare type URLSearchParamsInitializer = URLSearchParamsInit;
|
|
1231
|
+
|
|
1232
|
+
declare abstract class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
1233
|
+
accept(): void;
|
|
1234
|
+
send(message: ArrayBuffer | string): void;
|
|
1235
|
+
close(code?: number, reason?: string): void;
|
|
687
1236
|
}
|
|
688
1237
|
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
1238
|
+
declare type WebSocketEventMap = { close: CloseEvent; message: MessageEvent; };
|
|
1239
|
+
|
|
1240
|
+
declare const WebSocketPair: { new(): { 0: WebSocket; 1: WebSocket; }; };
|
|
1241
|
+
|
|
1242
|
+
declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {
|
|
1243
|
+
|
|
692
1244
|
}
|
|
693
1245
|
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
1246
|
+
declare type WorkerGlobalScopeEventMap = { fetch: FetchEvent; scheduled: ScheduledEvent; unhandledrejection: PromiseRejectionEvent; rejectionhandled: PromiseRejectionEvent; };
|
|
1247
|
+
|
|
1248
|
+
declare abstract class WritableStream {
|
|
1249
|
+
readonly locked: boolean;
|
|
1250
|
+
abort(reason: any): Promise<void>;
|
|
1251
|
+
close(): Promise<void>;
|
|
1252
|
+
getWriter(): WritableStreamDefaultWriter;
|
|
1253
|
+
}
|
|
698
1254
|
|
|
699
|
-
|
|
1255
|
+
declare class WritableStreamDefaultWriter {
|
|
1256
|
+
constructor(stream: WritableStream);
|
|
1257
|
+
readonly closed: Promise<void>;
|
|
1258
|
+
readonly desiredSize: number | null;
|
|
1259
|
+
abort(reason: any): Promise<void>;
|
|
1260
|
+
close(): Promise<void>;
|
|
1261
|
+
write(chunk: any): Promise<void>;
|
|
1262
|
+
releaseLock(): void;
|
|
700
1263
|
}
|
|
1264
|
+
|
|
1265
|
+
/**
|
|
1266
|
+
* Back-compat alias.
|
|
1267
|
+
* @deprecated Use WritableStreamDefaultWriter
|
|
1268
|
+
*/
|
|
1269
|
+
declare type WritableStreamWritableStreamDefaultWriter = WritableStreamDefaultWriter;
|
|
1270
|
+
|
|
1271
|
+
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
|
|
1272
|
+
|
|
1273
|
+
declare function atob(data: string): string;
|
|
1274
|
+
|
|
1275
|
+
declare function btoa(data: string): string;
|
|
1276
|
+
|
|
1277
|
+
declare const caches: CacheStorage;
|
|
1278
|
+
|
|
1279
|
+
declare function clearInterval(timeoutId: number | null): void;
|
|
1280
|
+
|
|
1281
|
+
declare function clearTimeout(timeoutId: number | null): void;
|
|
1282
|
+
|
|
1283
|
+
declare const console: Console;
|
|
1284
|
+
|
|
1285
|
+
declare const crypto: Crypto;
|
|
1286
|
+
|
|
1287
|
+
declare function dispatchEvent(event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]): boolean;
|
|
1288
|
+
|
|
1289
|
+
declare function fetch(request: Request | string, requestInitr?: RequestInit | Request): Promise<Response>;
|
|
1290
|
+
|
|
1291
|
+
declare function queueMicrotask(task: Function): void;
|
|
1292
|
+
|
|
1293
|
+
declare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
|
|
1294
|
+
|
|
1295
|
+
declare const self: ServiceWorkerGlobalScope;
|
|
1296
|
+
|
|
1297
|
+
declare function setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
|
|
1298
|
+
|
|
1299
|
+
declare function setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
|
|
1300
|
+
|