@cloudflare/workers-types 3.17.0 → 4.20221111.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/2021-11-03/index.d.ts +2794 -0
- package/2021-11-03/index.ts +2799 -0
- package/2022-01-31/index.d.ts +2782 -0
- package/2022-01-31/index.ts +2787 -0
- package/2022-03-21/index.d.ts +2788 -0
- package/2022-03-21/index.ts +2793 -0
- package/2022-08-04/index.d.ts +2789 -0
- package/2022-08-04/index.ts +2794 -0
- package/README.md +71 -35
- package/experimental/index.d.ts +2788 -0
- package/experimental/index.ts +2793 -0
- package/index.d.ts +2336 -1738
- package/index.ts +2799 -0
- package/oldest/index.d.ts +2794 -0
- package/oldest/index.ts +2799 -0
- package/package.json +4 -26
- package/LICENSE +0 -29
|
@@ -0,0 +1,2794 @@
|
|
|
1
|
+
/*! *****************************************************************************
|
|
2
|
+
Copyright (c) Cloudflare. All rights reserved.
|
|
3
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
6
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
7
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
9
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
10
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
11
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
12
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
13
|
+
and limitations under the License.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
/* eslint-disable */
|
|
16
|
+
// noinspection JSUnusedGlobalSymbols
|
|
17
|
+
declare class DOMException extends Error {
|
|
18
|
+
constructor(message?: string, name?: string);
|
|
19
|
+
readonly message: string;
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly code: number;
|
|
22
|
+
readonly stack: any;
|
|
23
|
+
static readonly INDEX_SIZE_ERR: number;
|
|
24
|
+
static readonly DOMSTRING_SIZE_ERR: number;
|
|
25
|
+
static readonly HIERARCHY_REQUEST_ERR: number;
|
|
26
|
+
static readonly WRONG_DOCUMENT_ERR: number;
|
|
27
|
+
static readonly INVALID_CHARACTER_ERR: number;
|
|
28
|
+
static readonly NO_DATA_ALLOWED_ERR: number;
|
|
29
|
+
static readonly NO_MODIFICATION_ALLOWED_ERR: number;
|
|
30
|
+
static readonly NOT_FOUND_ERR: number;
|
|
31
|
+
static readonly NOT_SUPPORTED_ERR: number;
|
|
32
|
+
static readonly INUSE_ATTRIBUTE_ERR: number;
|
|
33
|
+
static readonly INVALID_STATE_ERR: number;
|
|
34
|
+
static readonly SYNTAX_ERR: number;
|
|
35
|
+
static readonly INVALID_MODIFICATION_ERR: number;
|
|
36
|
+
static readonly NAMESPACE_ERR: number;
|
|
37
|
+
static readonly INVALID_ACCESS_ERR: number;
|
|
38
|
+
static readonly VALIDATION_ERR: number;
|
|
39
|
+
static readonly TYPE_MISMATCH_ERR: number;
|
|
40
|
+
static readonly SECURITY_ERR: number;
|
|
41
|
+
static readonly NETWORK_ERR: number;
|
|
42
|
+
static readonly ABORT_ERR: number;
|
|
43
|
+
static readonly URL_MISMATCH_ERR: number;
|
|
44
|
+
static readonly QUOTA_EXCEEDED_ERR: number;
|
|
45
|
+
static readonly TIMEOUT_ERR: number;
|
|
46
|
+
static readonly INVALID_NODE_TYPE_ERR: number;
|
|
47
|
+
static readonly DATA_CLONE_ERR: number;
|
|
48
|
+
}
|
|
49
|
+
declare type WorkerGlobalScopeEventMap = {
|
|
50
|
+
fetch: FetchEvent;
|
|
51
|
+
scheduled: ScheduledEvent;
|
|
52
|
+
unhandledrejection: PromiseRejectionEvent;
|
|
53
|
+
rejectionhandled: PromiseRejectionEvent;
|
|
54
|
+
};
|
|
55
|
+
declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {
|
|
56
|
+
EventTarget: typeof EventTarget;
|
|
57
|
+
}
|
|
58
|
+
declare interface Console {
|
|
59
|
+
"assert"(condition?: boolean, ...data: any[]): void;
|
|
60
|
+
clear(): void;
|
|
61
|
+
count(label?: string): void;
|
|
62
|
+
countReset(label?: string): void;
|
|
63
|
+
debug(...data: any[]): void;
|
|
64
|
+
dir(item?: any, options?: any): void;
|
|
65
|
+
dirxml(...data: any[]): void;
|
|
66
|
+
error(...data: any[]): void;
|
|
67
|
+
group(...data: any[]): void;
|
|
68
|
+
groupCollapsed(...data: any[]): void;
|
|
69
|
+
groupEnd(): void;
|
|
70
|
+
info(...data: any[]): void;
|
|
71
|
+
log(...data: any[]): void;
|
|
72
|
+
table(tabularData?: any, properties?: string[]): void;
|
|
73
|
+
time(label?: string): void;
|
|
74
|
+
timeEnd(label?: string): void;
|
|
75
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
76
|
+
timeStamp(label?: string): void;
|
|
77
|
+
trace(...data: any[]): void;
|
|
78
|
+
warn(...data: any[]): void;
|
|
79
|
+
}
|
|
80
|
+
declare const console: Console;
|
|
81
|
+
declare type BufferSource = ArrayBufferView | ArrayBuffer;
|
|
82
|
+
declare namespace WebAssembly {
|
|
83
|
+
class CompileError extends Error {
|
|
84
|
+
constructor(message?: string);
|
|
85
|
+
}
|
|
86
|
+
class RuntimeError extends Error {
|
|
87
|
+
constructor(message?: string);
|
|
88
|
+
}
|
|
89
|
+
type ValueType =
|
|
90
|
+
| "anyfunc"
|
|
91
|
+
| "externref"
|
|
92
|
+
| "f32"
|
|
93
|
+
| "f64"
|
|
94
|
+
| "i32"
|
|
95
|
+
| "i64"
|
|
96
|
+
| "v128";
|
|
97
|
+
interface GlobalDescriptor {
|
|
98
|
+
value: ValueType;
|
|
99
|
+
mutable?: boolean;
|
|
100
|
+
}
|
|
101
|
+
class Global {
|
|
102
|
+
constructor(descriptor: GlobalDescriptor, value?: any);
|
|
103
|
+
value: any;
|
|
104
|
+
valueOf(): any;
|
|
105
|
+
}
|
|
106
|
+
type ImportValue = ExportValue | number;
|
|
107
|
+
type ModuleImports = Record<string, ImportValue>;
|
|
108
|
+
type Imports = Record<string, ModuleImports>;
|
|
109
|
+
type ExportValue = Function | Global | Memory | Table;
|
|
110
|
+
type Exports = Record<string, ExportValue>;
|
|
111
|
+
class Instance {
|
|
112
|
+
constructor(module: Module, imports?: Imports);
|
|
113
|
+
readonly exports: Exports;
|
|
114
|
+
}
|
|
115
|
+
interface MemoryDescriptor {
|
|
116
|
+
initial: number;
|
|
117
|
+
maximum?: number;
|
|
118
|
+
shared?: boolean;
|
|
119
|
+
}
|
|
120
|
+
class Memory {
|
|
121
|
+
constructor(descriptor: MemoryDescriptor);
|
|
122
|
+
readonly buffer: ArrayBuffer;
|
|
123
|
+
grow(delta: number): number;
|
|
124
|
+
}
|
|
125
|
+
type ImportExportKind = "function" | "global" | "memory" | "table";
|
|
126
|
+
interface ModuleExportDescriptor {
|
|
127
|
+
kind: ImportExportKind;
|
|
128
|
+
name: string;
|
|
129
|
+
}
|
|
130
|
+
interface ModuleImportDescriptor {
|
|
131
|
+
kind: ImportExportKind;
|
|
132
|
+
module: string;
|
|
133
|
+
name: string;
|
|
134
|
+
}
|
|
135
|
+
abstract class Module {
|
|
136
|
+
static customSections(module: Module, sectionName: string): ArrayBuffer[];
|
|
137
|
+
static exports(module: Module): ModuleExportDescriptor[];
|
|
138
|
+
static imports(module: Module): ModuleImportDescriptor[];
|
|
139
|
+
}
|
|
140
|
+
type TableKind = "anyfunc" | "externref";
|
|
141
|
+
interface TableDescriptor {
|
|
142
|
+
element: TableKind;
|
|
143
|
+
initial: number;
|
|
144
|
+
maximum?: number;
|
|
145
|
+
}
|
|
146
|
+
class Table {
|
|
147
|
+
constructor(descriptor: TableDescriptor, value?: any);
|
|
148
|
+
readonly length: number;
|
|
149
|
+
get(index: number): any;
|
|
150
|
+
grow(delta: number, value?: any): number;
|
|
151
|
+
set(index: number, value?: any): void;
|
|
152
|
+
}
|
|
153
|
+
function instantiate(module: Module, imports?: Imports): Promise<Instance>;
|
|
154
|
+
function validate(bytes: BufferSource): boolean;
|
|
155
|
+
}
|
|
156
|
+
/** This ServiceWorker API interface represents the global execution context of a service worker. */
|
|
157
|
+
declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
158
|
+
DOMException: typeof DOMException;
|
|
159
|
+
WorkerGlobalScope: typeof WorkerGlobalScope;
|
|
160
|
+
btoa(data: string): string;
|
|
161
|
+
atob(data: string): string;
|
|
162
|
+
setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;
|
|
163
|
+
setTimeout<Args extends any[]>(
|
|
164
|
+
callback: (...args: Args) => void,
|
|
165
|
+
msDelay?: number,
|
|
166
|
+
...args: Args
|
|
167
|
+
): number;
|
|
168
|
+
clearTimeout(timeoutId: number | null): void;
|
|
169
|
+
setInterval(callback: (...args: any[]) => void, msDelay?: number): number;
|
|
170
|
+
setInterval<Args extends any[]>(
|
|
171
|
+
callback: (...args: Args) => void,
|
|
172
|
+
msDelay?: number,
|
|
173
|
+
...args: Args
|
|
174
|
+
): number;
|
|
175
|
+
clearInterval(timeoutId: number | null): void;
|
|
176
|
+
queueMicrotask(task: Function): void;
|
|
177
|
+
structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
|
|
178
|
+
fetch(
|
|
179
|
+
input: RequestInfo,
|
|
180
|
+
init?: RequestInit<RequestInitCfProperties>
|
|
181
|
+
): Promise<Response>;
|
|
182
|
+
self: ServiceWorkerGlobalScope;
|
|
183
|
+
crypto: Crypto;
|
|
184
|
+
caches: CacheStorage;
|
|
185
|
+
scheduler: Scheduler;
|
|
186
|
+
Event: typeof Event;
|
|
187
|
+
ExtendableEvent: typeof ExtendableEvent;
|
|
188
|
+
PromiseRejectionEvent: typeof PromiseRejectionEvent;
|
|
189
|
+
FetchEvent: typeof FetchEvent;
|
|
190
|
+
TraceEvent: typeof TraceEvent;
|
|
191
|
+
ScheduledEvent: typeof ScheduledEvent;
|
|
192
|
+
MessageEvent: typeof MessageEvent;
|
|
193
|
+
CloseEvent: typeof CloseEvent;
|
|
194
|
+
ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader;
|
|
195
|
+
ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader;
|
|
196
|
+
ReadableStream: typeof ReadableStream;
|
|
197
|
+
WritableStream: typeof WritableStream;
|
|
198
|
+
WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter;
|
|
199
|
+
TransformStream: typeof TransformStream;
|
|
200
|
+
ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;
|
|
201
|
+
CountQueuingStrategy: typeof CountQueuingStrategy;
|
|
202
|
+
CompressionStream: typeof CompressionStream;
|
|
203
|
+
DecompressionStream: typeof DecompressionStream;
|
|
204
|
+
TextEncoderStream: typeof TextEncoderStream;
|
|
205
|
+
TextDecoderStream: typeof TextDecoderStream;
|
|
206
|
+
Headers: typeof Headers;
|
|
207
|
+
Body: typeof Body;
|
|
208
|
+
Request: typeof Request;
|
|
209
|
+
Response: typeof Response;
|
|
210
|
+
WebSocket: typeof WebSocket;
|
|
211
|
+
WebSocketPair: typeof WebSocketPair;
|
|
212
|
+
AbortController: typeof AbortController;
|
|
213
|
+
AbortSignal: typeof AbortSignal;
|
|
214
|
+
TextDecoder: typeof TextDecoder;
|
|
215
|
+
TextEncoder: typeof TextEncoder;
|
|
216
|
+
URL: typeof URL;
|
|
217
|
+
URLSearchParams: typeof URLSearchParams;
|
|
218
|
+
URLPattern: typeof URLPattern;
|
|
219
|
+
Blob: typeof Blob;
|
|
220
|
+
File: typeof File;
|
|
221
|
+
FormData: typeof FormData;
|
|
222
|
+
Crypto: typeof Crypto;
|
|
223
|
+
SubtleCrypto: typeof SubtleCrypto;
|
|
224
|
+
CryptoKey: typeof CryptoKey;
|
|
225
|
+
CacheStorage: typeof CacheStorage;
|
|
226
|
+
Cache: typeof Cache;
|
|
227
|
+
FixedLengthStream: typeof FixedLengthStream;
|
|
228
|
+
IdentityTransformStream: typeof IdentityTransformStream;
|
|
229
|
+
HTMLRewriter: typeof HTMLRewriter;
|
|
230
|
+
connect(address: string, options?: SocketOptions): Socket;
|
|
231
|
+
}
|
|
232
|
+
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
|
|
233
|
+
type: Type,
|
|
234
|
+
handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
|
|
235
|
+
options?: EventTargetAddEventListenerOptions | boolean
|
|
236
|
+
): void;
|
|
237
|
+
declare function removeEventListener<
|
|
238
|
+
Type extends keyof WorkerGlobalScopeEventMap
|
|
239
|
+
>(
|
|
240
|
+
type: Type,
|
|
241
|
+
handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
|
|
242
|
+
options?: EventTargetEventListenerOptions | boolean
|
|
243
|
+
): void;
|
|
244
|
+
/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */
|
|
245
|
+
declare function dispatchEvent(
|
|
246
|
+
event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]
|
|
247
|
+
): boolean;
|
|
248
|
+
declare function btoa(data: string): string;
|
|
249
|
+
declare function atob(data: string): string;
|
|
250
|
+
declare function setTimeout(
|
|
251
|
+
callback: (...args: any[]) => void,
|
|
252
|
+
msDelay?: number
|
|
253
|
+
): number;
|
|
254
|
+
declare function setTimeout<Args extends any[]>(
|
|
255
|
+
callback: (...args: Args) => void,
|
|
256
|
+
msDelay?: number,
|
|
257
|
+
...args: Args
|
|
258
|
+
): number;
|
|
259
|
+
declare function clearTimeout(timeoutId: number | null): void;
|
|
260
|
+
declare function setInterval(
|
|
261
|
+
callback: (...args: any[]) => void,
|
|
262
|
+
msDelay?: number
|
|
263
|
+
): number;
|
|
264
|
+
declare function setInterval<Args extends any[]>(
|
|
265
|
+
callback: (...args: Args) => void,
|
|
266
|
+
msDelay?: number,
|
|
267
|
+
...args: Args
|
|
268
|
+
): number;
|
|
269
|
+
declare function clearInterval(timeoutId: number | null): void;
|
|
270
|
+
declare function queueMicrotask(task: Function): void;
|
|
271
|
+
declare function structuredClone<T>(
|
|
272
|
+
value: T,
|
|
273
|
+
options?: StructuredSerializeOptions
|
|
274
|
+
): T;
|
|
275
|
+
declare function fetch(
|
|
276
|
+
input: RequestInfo,
|
|
277
|
+
init?: RequestInit<RequestInitCfProperties>
|
|
278
|
+
): Promise<Response>;
|
|
279
|
+
declare const self: ServiceWorkerGlobalScope;
|
|
280
|
+
declare const crypto: Crypto;
|
|
281
|
+
declare const caches: CacheStorage;
|
|
282
|
+
declare const scheduler: Scheduler;
|
|
283
|
+
declare function connect(address: string, options?: SocketOptions): Socket;
|
|
284
|
+
declare interface ExecutionContext {
|
|
285
|
+
waitUntil(promise: void | Promise<void>): void;
|
|
286
|
+
passThroughOnException(): void;
|
|
287
|
+
}
|
|
288
|
+
declare type ExportedHandlerFetchHandler<Env = unknown> = (
|
|
289
|
+
request: Request,
|
|
290
|
+
env: Env,
|
|
291
|
+
ctx: ExecutionContext
|
|
292
|
+
) => Response | Promise<Response>;
|
|
293
|
+
declare type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
294
|
+
traces: TraceItem[],
|
|
295
|
+
env: Env,
|
|
296
|
+
ctx: ExecutionContext
|
|
297
|
+
) => void | Promise<void>;
|
|
298
|
+
declare type ExportedHandlerScheduledHandler<Env = unknown> = (
|
|
299
|
+
controller: ScheduledController,
|
|
300
|
+
env: Env,
|
|
301
|
+
ctx: ExecutionContext
|
|
302
|
+
) => void | Promise<void>;
|
|
303
|
+
declare type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
|
|
304
|
+
batch: MessageBatch<Message>,
|
|
305
|
+
env: Env,
|
|
306
|
+
ctx: ExecutionContext
|
|
307
|
+
) => void | Promise<void>;
|
|
308
|
+
declare interface ExportedHandler<Env = unknown, QueueMessage = unknown> {
|
|
309
|
+
fetch?: ExportedHandlerFetchHandler<Env>;
|
|
310
|
+
trace?: ExportedHandlerTraceHandler<Env>;
|
|
311
|
+
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
312
|
+
queue?: ExportedHandlerQueueHandler<Env, QueueMessage>;
|
|
313
|
+
}
|
|
314
|
+
declare interface StructuredSerializeOptions {
|
|
315
|
+
transfer?: any[];
|
|
316
|
+
}
|
|
317
|
+
declare abstract class PromiseRejectionEvent extends Event {
|
|
318
|
+
readonly promise: Promise<any>;
|
|
319
|
+
readonly reason: any;
|
|
320
|
+
}
|
|
321
|
+
declare interface DurableObject {
|
|
322
|
+
fetch(request: Request): Response | Promise<Response>;
|
|
323
|
+
alarm?(): void | Promise<void>;
|
|
324
|
+
}
|
|
325
|
+
declare interface DurableObjectStub extends Fetcher {
|
|
326
|
+
readonly id: DurableObjectId;
|
|
327
|
+
readonly name?: string;
|
|
328
|
+
}
|
|
329
|
+
declare interface DurableObjectId {
|
|
330
|
+
toString(): string;
|
|
331
|
+
equals(other: DurableObjectId): boolean;
|
|
332
|
+
readonly name?: string;
|
|
333
|
+
}
|
|
334
|
+
declare interface DurableObjectNamespace {
|
|
335
|
+
newUniqueId(
|
|
336
|
+
options?: DurableObjectNamespaceNewUniqueIdOptions
|
|
337
|
+
): DurableObjectId;
|
|
338
|
+
idFromName(name: string): DurableObjectId;
|
|
339
|
+
idFromString(id: string): DurableObjectId;
|
|
340
|
+
get(id: DurableObjectId): DurableObjectStub;
|
|
341
|
+
}
|
|
342
|
+
declare interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
343
|
+
jurisdiction?: string;
|
|
344
|
+
}
|
|
345
|
+
declare interface DurableObjectState {
|
|
346
|
+
waitUntil(promise: void | Promise<void>): void;
|
|
347
|
+
readonly id: DurableObjectId;
|
|
348
|
+
readonly storage: DurableObjectStorage;
|
|
349
|
+
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
350
|
+
}
|
|
351
|
+
declare interface DurableObjectTransaction {
|
|
352
|
+
get<T = unknown>(
|
|
353
|
+
key: string,
|
|
354
|
+
options?: DurableObjectGetOptions
|
|
355
|
+
): Promise<T | undefined>;
|
|
356
|
+
get<T = unknown>(
|
|
357
|
+
keys: string[],
|
|
358
|
+
options?: DurableObjectGetOptions
|
|
359
|
+
): Promise<Map<string, T>>;
|
|
360
|
+
list<T = unknown>(
|
|
361
|
+
options?: DurableObjectListOptions
|
|
362
|
+
): Promise<Map<string, T>>;
|
|
363
|
+
put<T>(
|
|
364
|
+
key: string,
|
|
365
|
+
value: T,
|
|
366
|
+
options?: DurableObjectPutOptions
|
|
367
|
+
): Promise<void>;
|
|
368
|
+
put<T>(
|
|
369
|
+
entries: Record<string, T>,
|
|
370
|
+
options?: DurableObjectPutOptions
|
|
371
|
+
): Promise<void>;
|
|
372
|
+
delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
|
|
373
|
+
delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
|
|
374
|
+
rollback(): void;
|
|
375
|
+
getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
|
|
376
|
+
setAlarm(
|
|
377
|
+
scheduledTime: number | Date,
|
|
378
|
+
options?: DurableObjectSetAlarmOptions
|
|
379
|
+
): Promise<void>;
|
|
380
|
+
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
381
|
+
}
|
|
382
|
+
declare interface DurableObjectStorage {
|
|
383
|
+
get<T = unknown>(
|
|
384
|
+
key: string,
|
|
385
|
+
options?: DurableObjectGetOptions
|
|
386
|
+
): Promise<T | undefined>;
|
|
387
|
+
get<T = unknown>(
|
|
388
|
+
keys: string[],
|
|
389
|
+
options?: DurableObjectGetOptions
|
|
390
|
+
): Promise<Map<string, T>>;
|
|
391
|
+
list<T = unknown>(
|
|
392
|
+
options?: DurableObjectListOptions
|
|
393
|
+
): Promise<Map<string, T>>;
|
|
394
|
+
put<T>(
|
|
395
|
+
key: string,
|
|
396
|
+
value: T,
|
|
397
|
+
options?: DurableObjectPutOptions
|
|
398
|
+
): Promise<void>;
|
|
399
|
+
put<T>(
|
|
400
|
+
entries: Record<string, T>,
|
|
401
|
+
options?: DurableObjectPutOptions
|
|
402
|
+
): Promise<void>;
|
|
403
|
+
delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
|
|
404
|
+
delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
|
|
405
|
+
deleteAll(options?: DurableObjectPutOptions): Promise<void>;
|
|
406
|
+
transaction<T>(
|
|
407
|
+
closure: (txn: DurableObjectTransaction) => Promise<T>
|
|
408
|
+
): Promise<T>;
|
|
409
|
+
getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
|
|
410
|
+
setAlarm(
|
|
411
|
+
scheduledTime: number | Date,
|
|
412
|
+
options?: DurableObjectSetAlarmOptions
|
|
413
|
+
): Promise<void>;
|
|
414
|
+
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
415
|
+
sync(): Promise<void>;
|
|
416
|
+
}
|
|
417
|
+
declare interface DurableObjectListOptions {
|
|
418
|
+
start?: string;
|
|
419
|
+
startAfter?: string;
|
|
420
|
+
end?: string;
|
|
421
|
+
prefix?: string;
|
|
422
|
+
reverse?: boolean;
|
|
423
|
+
limit?: number;
|
|
424
|
+
allowConcurrency?: boolean;
|
|
425
|
+
noCache?: boolean;
|
|
426
|
+
}
|
|
427
|
+
declare interface DurableObjectGetOptions {
|
|
428
|
+
allowConcurrency?: boolean;
|
|
429
|
+
noCache?: boolean;
|
|
430
|
+
}
|
|
431
|
+
declare interface DurableObjectGetAlarmOptions {
|
|
432
|
+
allowConcurrency?: boolean;
|
|
433
|
+
}
|
|
434
|
+
declare interface DurableObjectPutOptions {
|
|
435
|
+
allowConcurrency?: boolean;
|
|
436
|
+
allowUnconfirmed?: boolean;
|
|
437
|
+
noCache?: boolean;
|
|
438
|
+
}
|
|
439
|
+
declare interface DurableObjectSetAlarmOptions {
|
|
440
|
+
allowConcurrency?: boolean;
|
|
441
|
+
allowUnconfirmed?: boolean;
|
|
442
|
+
}
|
|
443
|
+
declare interface AnalyticsEngineDataset {
|
|
444
|
+
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
445
|
+
}
|
|
446
|
+
declare interface AnalyticsEngineDataPoint {
|
|
447
|
+
indexes?: ((ArrayBuffer | string) | null)[];
|
|
448
|
+
doubles?: number[];
|
|
449
|
+
blobs?: ((ArrayBuffer | string) | null)[];
|
|
450
|
+
}
|
|
451
|
+
declare class Event {
|
|
452
|
+
constructor(type: string, init?: EventInit);
|
|
453
|
+
/** Returns the type of event, e.g. "click", "hashchange", or "submit". */
|
|
454
|
+
readonly type: string;
|
|
455
|
+
/** Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. */
|
|
456
|
+
readonly eventPhase: number;
|
|
457
|
+
/** Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. */
|
|
458
|
+
readonly composed: boolean;
|
|
459
|
+
/** Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. */
|
|
460
|
+
readonly bubbles: boolean;
|
|
461
|
+
/** Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. */
|
|
462
|
+
readonly cancelable: boolean;
|
|
463
|
+
/** Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. */
|
|
464
|
+
readonly defaultPrevented: boolean;
|
|
465
|
+
/** @deprecated */
|
|
466
|
+
readonly returnValue: boolean;
|
|
467
|
+
/** Returns the object whose event listener's callback is currently being invoked. */
|
|
468
|
+
readonly currentTarget?: EventTarget;
|
|
469
|
+
/** @deprecated */
|
|
470
|
+
readonly srcElement?: EventTarget;
|
|
471
|
+
/** Returns the event's timestamp as the number of milliseconds measured relative to the time origin. */
|
|
472
|
+
readonly timeStamp: number;
|
|
473
|
+
/** Returns true if event was dispatched by the user agent, and false otherwise. */
|
|
474
|
+
readonly isTrusted: boolean;
|
|
475
|
+
cancelBubble: boolean;
|
|
476
|
+
stopImmediatePropagation(): void;
|
|
477
|
+
preventDefault(): void;
|
|
478
|
+
stopPropagation(): void;
|
|
479
|
+
composedPath(): EventTarget[];
|
|
480
|
+
static readonly NONE: number;
|
|
481
|
+
static readonly CAPTURING_PHASE: number;
|
|
482
|
+
static readonly AT_TARGET: number;
|
|
483
|
+
static readonly BUBBLING_PHASE: number;
|
|
484
|
+
}
|
|
485
|
+
declare interface EventInit {
|
|
486
|
+
bubbles?: boolean;
|
|
487
|
+
cancelable?: boolean;
|
|
488
|
+
composed?: boolean;
|
|
489
|
+
}
|
|
490
|
+
declare type EventListener<EventType extends Event = Event> = (
|
|
491
|
+
event: EventType
|
|
492
|
+
) => void;
|
|
493
|
+
declare interface EventListenerObject<EventType extends Event = Event> {
|
|
494
|
+
handleEvent(event: EventType): void;
|
|
495
|
+
}
|
|
496
|
+
declare type EventListenerOrEventListenerObject<
|
|
497
|
+
EventType extends Event = Event
|
|
498
|
+
> = EventListener<EventType> | EventListenerObject<EventType>;
|
|
499
|
+
declare class EventTarget<
|
|
500
|
+
EventMap extends Record<string, Event> = Record<string, Event>
|
|
501
|
+
> {
|
|
502
|
+
constructor();
|
|
503
|
+
addEventListener<Type extends keyof EventMap>(
|
|
504
|
+
type: Type,
|
|
505
|
+
handler: EventListenerOrEventListenerObject<EventMap[Type]>,
|
|
506
|
+
options?: EventTargetAddEventListenerOptions | boolean
|
|
507
|
+
): void;
|
|
508
|
+
removeEventListener<Type extends keyof EventMap>(
|
|
509
|
+
type: Type,
|
|
510
|
+
handler: EventListenerOrEventListenerObject<EventMap[Type]>,
|
|
511
|
+
options?: EventTargetEventListenerOptions | boolean
|
|
512
|
+
): void;
|
|
513
|
+
dispatchEvent(event: EventMap[keyof EventMap]): boolean;
|
|
514
|
+
}
|
|
515
|
+
declare interface EventTargetEventListenerOptions {
|
|
516
|
+
capture?: boolean;
|
|
517
|
+
}
|
|
518
|
+
declare interface EventTargetAddEventListenerOptions {
|
|
519
|
+
capture?: boolean;
|
|
520
|
+
passive?: boolean;
|
|
521
|
+
once?: boolean;
|
|
522
|
+
signal?: AbortSignal;
|
|
523
|
+
}
|
|
524
|
+
declare interface EventTargetHandlerObject {
|
|
525
|
+
handleEvent: (event: Event) => any | undefined;
|
|
526
|
+
}
|
|
527
|
+
declare class AbortController {
|
|
528
|
+
constructor();
|
|
529
|
+
/** Returns the AbortSignal object associated with this object. */
|
|
530
|
+
readonly signal: AbortSignal;
|
|
531
|
+
abort(reason?: any): void;
|
|
532
|
+
}
|
|
533
|
+
declare abstract class AbortSignal extends EventTarget {
|
|
534
|
+
static abort(reason?: any): AbortSignal;
|
|
535
|
+
static timeout(delay: number): AbortSignal;
|
|
536
|
+
/** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */
|
|
537
|
+
readonly aborted: boolean;
|
|
538
|
+
readonly reason: any;
|
|
539
|
+
throwIfAborted(): void;
|
|
540
|
+
}
|
|
541
|
+
declare interface Scheduler {
|
|
542
|
+
wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise<void>;
|
|
543
|
+
}
|
|
544
|
+
declare interface SchedulerWaitOptions {
|
|
545
|
+
signal?: AbortSignal;
|
|
546
|
+
}
|
|
547
|
+
declare abstract class ExtendableEvent extends Event {
|
|
548
|
+
waitUntil(promise: void | Promise<void>): void;
|
|
549
|
+
}
|
|
550
|
+
declare class Blob {
|
|
551
|
+
constructor(
|
|
552
|
+
bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[],
|
|
553
|
+
options?: BlobOptions
|
|
554
|
+
);
|
|
555
|
+
readonly size: number;
|
|
556
|
+
readonly type: string;
|
|
557
|
+
slice(start?: number, end?: number, type?: string): Blob;
|
|
558
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
559
|
+
text(): Promise<string>;
|
|
560
|
+
stream(): ReadableStream;
|
|
561
|
+
}
|
|
562
|
+
declare interface BlobOptions {
|
|
563
|
+
type?: string;
|
|
564
|
+
}
|
|
565
|
+
declare class File extends Blob {
|
|
566
|
+
constructor(
|
|
567
|
+
bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined,
|
|
568
|
+
name: string,
|
|
569
|
+
options?: FileOptions
|
|
570
|
+
);
|
|
571
|
+
readonly name: string;
|
|
572
|
+
readonly lastModified: number;
|
|
573
|
+
}
|
|
574
|
+
declare interface FileOptions {
|
|
575
|
+
type?: string;
|
|
576
|
+
lastModified?: number;
|
|
577
|
+
}
|
|
578
|
+
declare abstract class CacheStorage {
|
|
579
|
+
open(cacheName: string): Promise<Cache>;
|
|
580
|
+
readonly default: Cache;
|
|
581
|
+
}
|
|
582
|
+
declare abstract class Cache {
|
|
583
|
+
delete(request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>;
|
|
584
|
+
match(
|
|
585
|
+
request: RequestInfo,
|
|
586
|
+
options?: CacheQueryOptions
|
|
587
|
+
): Promise<Response | undefined>;
|
|
588
|
+
put(request: RequestInfo, response: Response): Promise<void>;
|
|
589
|
+
}
|
|
590
|
+
declare interface CacheQueryOptions {
|
|
591
|
+
ignoreMethod?: boolean;
|
|
592
|
+
}
|
|
593
|
+
declare abstract class Crypto {
|
|
594
|
+
/** Available only in secure contexts. */
|
|
595
|
+
readonly subtle: SubtleCrypto;
|
|
596
|
+
getRandomValues<
|
|
597
|
+
T extends
|
|
598
|
+
| Int8Array
|
|
599
|
+
| Uint8Array
|
|
600
|
+
| Int16Array
|
|
601
|
+
| Uint16Array
|
|
602
|
+
| Int32Array
|
|
603
|
+
| Uint32Array
|
|
604
|
+
| BigInt64Array
|
|
605
|
+
| BigUint64Array
|
|
606
|
+
>(buffer: T): T;
|
|
607
|
+
randomUUID(): string;
|
|
608
|
+
DigestStream: typeof DigestStream;
|
|
609
|
+
}
|
|
610
|
+
declare abstract class SubtleCrypto {
|
|
611
|
+
encrypt(
|
|
612
|
+
algorithm: string | SubtleCryptoEncryptAlgorithm,
|
|
613
|
+
key: CryptoKey,
|
|
614
|
+
plainText: ArrayBuffer | ArrayBufferView
|
|
615
|
+
): Promise<ArrayBuffer>;
|
|
616
|
+
decrypt(
|
|
617
|
+
algorithm: string | SubtleCryptoEncryptAlgorithm,
|
|
618
|
+
key: CryptoKey,
|
|
619
|
+
cipherText: ArrayBuffer | ArrayBufferView
|
|
620
|
+
): Promise<ArrayBuffer>;
|
|
621
|
+
sign(
|
|
622
|
+
algorithm: string | SubtleCryptoSignAlgorithm,
|
|
623
|
+
key: CryptoKey,
|
|
624
|
+
data: ArrayBuffer | ArrayBufferView
|
|
625
|
+
): Promise<ArrayBuffer>;
|
|
626
|
+
verify(
|
|
627
|
+
algorithm: string | SubtleCryptoSignAlgorithm,
|
|
628
|
+
key: CryptoKey,
|
|
629
|
+
signature: ArrayBuffer | ArrayBufferView,
|
|
630
|
+
data: ArrayBuffer | ArrayBufferView
|
|
631
|
+
): Promise<boolean>;
|
|
632
|
+
digest(
|
|
633
|
+
algorithm: string | SubtleCryptoHashAlgorithm,
|
|
634
|
+
data: ArrayBuffer | ArrayBufferView
|
|
635
|
+
): Promise<ArrayBuffer>;
|
|
636
|
+
generateKey(
|
|
637
|
+
algorithm: string | SubtleCryptoGenerateKeyAlgorithm,
|
|
638
|
+
extractable: boolean,
|
|
639
|
+
keyUsages: string[]
|
|
640
|
+
): Promise<CryptoKey | CryptoKeyPair>;
|
|
641
|
+
deriveKey(
|
|
642
|
+
algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
|
|
643
|
+
baseKey: CryptoKey,
|
|
644
|
+
derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
|
|
645
|
+
extractable: boolean,
|
|
646
|
+
keyUsages: string[]
|
|
647
|
+
): Promise<CryptoKey>;
|
|
648
|
+
deriveBits(
|
|
649
|
+
algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
|
|
650
|
+
baseKey: CryptoKey,
|
|
651
|
+
length: number | null
|
|
652
|
+
): Promise<ArrayBuffer>;
|
|
653
|
+
importKey(
|
|
654
|
+
format: string,
|
|
655
|
+
keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey,
|
|
656
|
+
algorithm: string | SubtleCryptoImportKeyAlgorithm,
|
|
657
|
+
extractable: boolean,
|
|
658
|
+
keyUsages: string[]
|
|
659
|
+
): Promise<CryptoKey>;
|
|
660
|
+
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
|
|
661
|
+
wrapKey(
|
|
662
|
+
format: string,
|
|
663
|
+
key: CryptoKey,
|
|
664
|
+
wrappingKey: CryptoKey,
|
|
665
|
+
wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm
|
|
666
|
+
): Promise<ArrayBuffer>;
|
|
667
|
+
unwrapKey(
|
|
668
|
+
format: string,
|
|
669
|
+
wrappedKey: ArrayBuffer | ArrayBufferView,
|
|
670
|
+
unwrappingKey: CryptoKey,
|
|
671
|
+
unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
|
|
672
|
+
unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
|
|
673
|
+
extractable: boolean,
|
|
674
|
+
keyUsages: string[]
|
|
675
|
+
): Promise<CryptoKey>;
|
|
676
|
+
timingSafeEqual(
|
|
677
|
+
a: ArrayBuffer | ArrayBufferView,
|
|
678
|
+
b: ArrayBuffer | ArrayBufferView
|
|
679
|
+
): boolean;
|
|
680
|
+
}
|
|
681
|
+
declare abstract class CryptoKey {
|
|
682
|
+
readonly type: string;
|
|
683
|
+
readonly extractable: boolean;
|
|
684
|
+
readonly algorithm:
|
|
685
|
+
| CryptoKeyKeyAlgorithm
|
|
686
|
+
| CryptoKeyAesKeyAlgorithm
|
|
687
|
+
| CryptoKeyHmacKeyAlgorithm
|
|
688
|
+
| CryptoKeyRsaKeyAlgorithm
|
|
689
|
+
| CryptoKeyEllipticKeyAlgorithm
|
|
690
|
+
| CryptoKeyArbitraryKeyAlgorithm;
|
|
691
|
+
readonly usages: string[];
|
|
692
|
+
}
|
|
693
|
+
declare interface CryptoKeyPair {
|
|
694
|
+
publicKey: CryptoKey;
|
|
695
|
+
privateKey: CryptoKey;
|
|
696
|
+
}
|
|
697
|
+
declare interface JsonWebKey {
|
|
698
|
+
kty: string;
|
|
699
|
+
use?: string;
|
|
700
|
+
key_ops?: string[];
|
|
701
|
+
alg?: string;
|
|
702
|
+
ext?: boolean;
|
|
703
|
+
crv?: string;
|
|
704
|
+
x?: string;
|
|
705
|
+
y?: string;
|
|
706
|
+
d?: string;
|
|
707
|
+
n?: string;
|
|
708
|
+
e?: string;
|
|
709
|
+
p?: string;
|
|
710
|
+
q?: string;
|
|
711
|
+
dp?: string;
|
|
712
|
+
dq?: string;
|
|
713
|
+
qi?: string;
|
|
714
|
+
oth?: RsaOtherPrimesInfo[];
|
|
715
|
+
k?: string;
|
|
716
|
+
}
|
|
717
|
+
declare interface RsaOtherPrimesInfo {
|
|
718
|
+
r?: string;
|
|
719
|
+
d?: string;
|
|
720
|
+
t?: string;
|
|
721
|
+
}
|
|
722
|
+
declare interface SubtleCryptoDeriveKeyAlgorithm {
|
|
723
|
+
name: string;
|
|
724
|
+
salt?: ArrayBuffer;
|
|
725
|
+
iterations?: number;
|
|
726
|
+
hash?: string | SubtleCryptoHashAlgorithm;
|
|
727
|
+
$public?: CryptoKey;
|
|
728
|
+
info?: ArrayBuffer;
|
|
729
|
+
}
|
|
730
|
+
declare interface SubtleCryptoEncryptAlgorithm {
|
|
731
|
+
name: string;
|
|
732
|
+
iv?: ArrayBuffer;
|
|
733
|
+
additionalData?: ArrayBuffer;
|
|
734
|
+
tagLength?: number;
|
|
735
|
+
counter?: ArrayBuffer;
|
|
736
|
+
length?: number;
|
|
737
|
+
label?: ArrayBuffer;
|
|
738
|
+
}
|
|
739
|
+
declare interface SubtleCryptoGenerateKeyAlgorithm {
|
|
740
|
+
name: string;
|
|
741
|
+
hash?: string | SubtleCryptoHashAlgorithm;
|
|
742
|
+
modulusLength?: number;
|
|
743
|
+
publicExponent?: ArrayBuffer;
|
|
744
|
+
length?: number;
|
|
745
|
+
namedCurve?: string;
|
|
746
|
+
}
|
|
747
|
+
declare interface SubtleCryptoHashAlgorithm {
|
|
748
|
+
name: string;
|
|
749
|
+
}
|
|
750
|
+
declare interface SubtleCryptoImportKeyAlgorithm {
|
|
751
|
+
name: string;
|
|
752
|
+
hash?: string | SubtleCryptoHashAlgorithm;
|
|
753
|
+
length?: number;
|
|
754
|
+
namedCurve?: string;
|
|
755
|
+
compressed?: boolean;
|
|
756
|
+
}
|
|
757
|
+
declare interface SubtleCryptoSignAlgorithm {
|
|
758
|
+
name: string;
|
|
759
|
+
hash?: string | SubtleCryptoHashAlgorithm;
|
|
760
|
+
dataLength?: number;
|
|
761
|
+
saltLength?: number;
|
|
762
|
+
}
|
|
763
|
+
declare interface CryptoKeyKeyAlgorithm {
|
|
764
|
+
name: string;
|
|
765
|
+
}
|
|
766
|
+
declare interface CryptoKeyAesKeyAlgorithm {
|
|
767
|
+
name: string;
|
|
768
|
+
length: number;
|
|
769
|
+
}
|
|
770
|
+
declare interface CryptoKeyHmacKeyAlgorithm {
|
|
771
|
+
name: string;
|
|
772
|
+
hash: CryptoKeyKeyAlgorithm;
|
|
773
|
+
length: number;
|
|
774
|
+
}
|
|
775
|
+
declare interface CryptoKeyRsaKeyAlgorithm {
|
|
776
|
+
name: string;
|
|
777
|
+
modulusLength: number;
|
|
778
|
+
publicExponent: ArrayBuffer;
|
|
779
|
+
hash?: CryptoKeyKeyAlgorithm;
|
|
780
|
+
}
|
|
781
|
+
declare interface CryptoKeyEllipticKeyAlgorithm {
|
|
782
|
+
name: string;
|
|
783
|
+
namedCurve: string;
|
|
784
|
+
}
|
|
785
|
+
declare interface CryptoKeyArbitraryKeyAlgorithm {
|
|
786
|
+
name: string;
|
|
787
|
+
hash?: CryptoKeyKeyAlgorithm;
|
|
788
|
+
namedCurve?: string;
|
|
789
|
+
length?: number;
|
|
790
|
+
}
|
|
791
|
+
declare class DigestStream extends WritableStream<
|
|
792
|
+
ArrayBuffer | ArrayBufferView
|
|
793
|
+
> {
|
|
794
|
+
constructor(algorithm: string | SubtleCryptoHashAlgorithm);
|
|
795
|
+
readonly digest: Promise<ArrayBuffer>;
|
|
796
|
+
}
|
|
797
|
+
declare class TextDecoder {
|
|
798
|
+
constructor(decoder?: string, options?: TextDecoderConstructorOptions);
|
|
799
|
+
decode(
|
|
800
|
+
input?: ArrayBuffer | ArrayBufferView,
|
|
801
|
+
options?: TextDecoderDecodeOptions
|
|
802
|
+
): string;
|
|
803
|
+
readonly encoding: string;
|
|
804
|
+
readonly fatal: boolean;
|
|
805
|
+
readonly ignoreBOM: boolean;
|
|
806
|
+
}
|
|
807
|
+
declare class TextEncoder {
|
|
808
|
+
constructor();
|
|
809
|
+
encode(input?: string): Uint8Array;
|
|
810
|
+
encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult;
|
|
811
|
+
readonly encoding: string;
|
|
812
|
+
}
|
|
813
|
+
declare interface TextDecoderConstructorOptions {
|
|
814
|
+
fatal: boolean;
|
|
815
|
+
ignoreBOM: boolean;
|
|
816
|
+
}
|
|
817
|
+
declare interface TextDecoderDecodeOptions {
|
|
818
|
+
stream: boolean;
|
|
819
|
+
}
|
|
820
|
+
declare interface TextEncoderEncodeIntoResult {
|
|
821
|
+
read: number;
|
|
822
|
+
written: number;
|
|
823
|
+
}
|
|
824
|
+
declare class FormData {
|
|
825
|
+
constructor();
|
|
826
|
+
append(name: string, value: string): void;
|
|
827
|
+
append(name: string, value: Blob, filename?: string): void;
|
|
828
|
+
delete(name: string): void;
|
|
829
|
+
get(name: string): (File | string) | null;
|
|
830
|
+
getAll(name: string): (File | string)[];
|
|
831
|
+
has(name: string): boolean;
|
|
832
|
+
set(name: string, value: string): void;
|
|
833
|
+
set(name: string, value: Blob, filename?: string): void;
|
|
834
|
+
entries(): IterableIterator<[key: string, value: File | string]>;
|
|
835
|
+
keys(): IterableIterator<string>;
|
|
836
|
+
values(): IterableIterator<File | string>;
|
|
837
|
+
forEach<This = unknown>(
|
|
838
|
+
callback: (
|
|
839
|
+
this: This,
|
|
840
|
+
value: File | string,
|
|
841
|
+
key: string,
|
|
842
|
+
parent: FormData
|
|
843
|
+
) => void,
|
|
844
|
+
thisArg?: This
|
|
845
|
+
): void;
|
|
846
|
+
[Symbol.iterator](): IterableIterator<[key: string, value: File | string]>;
|
|
847
|
+
}
|
|
848
|
+
declare interface ContentOptions {
|
|
849
|
+
html?: boolean;
|
|
850
|
+
}
|
|
851
|
+
declare class HTMLRewriter {
|
|
852
|
+
constructor();
|
|
853
|
+
on(
|
|
854
|
+
selector: string,
|
|
855
|
+
handlers: HTMLRewriterElementContentHandlers
|
|
856
|
+
): HTMLRewriter;
|
|
857
|
+
onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;
|
|
858
|
+
transform(response: Response): Response;
|
|
859
|
+
}
|
|
860
|
+
declare interface HTMLRewriterElementContentHandlers {
|
|
861
|
+
element?(element: Element): void | Promise<void>;
|
|
862
|
+
comments?(comment: Comment): void | Promise<void>;
|
|
863
|
+
text?(element: Text): void | Promise<void>;
|
|
864
|
+
}
|
|
865
|
+
declare interface HTMLRewriterDocumentContentHandlers {
|
|
866
|
+
doctype?(doctype: Doctype): void | Promise<void>;
|
|
867
|
+
comments?(comment: Comment): void | Promise<void>;
|
|
868
|
+
text?(text: Text): void | Promise<void>;
|
|
869
|
+
end?(end: DocumentEnd): void | Promise<void>;
|
|
870
|
+
}
|
|
871
|
+
declare interface Doctype {
|
|
872
|
+
readonly name: string | null;
|
|
873
|
+
readonly publicId: string | null;
|
|
874
|
+
readonly systemId: string | null;
|
|
875
|
+
}
|
|
876
|
+
declare interface Element {
|
|
877
|
+
tagName: string;
|
|
878
|
+
readonly attributes: IterableIterator<string[]>;
|
|
879
|
+
readonly removed: boolean;
|
|
880
|
+
readonly namespaceURI: string;
|
|
881
|
+
getAttribute(name: string): string | null;
|
|
882
|
+
hasAttribute(name: string): boolean;
|
|
883
|
+
setAttribute(name: string, value: string): Element;
|
|
884
|
+
removeAttribute(name: string): Element;
|
|
885
|
+
before(content: string, options?: ContentOptions): Element;
|
|
886
|
+
after(content: string, options?: ContentOptions): Element;
|
|
887
|
+
prepend(content: string, options?: ContentOptions): Element;
|
|
888
|
+
append(content: string, options?: ContentOptions): Element;
|
|
889
|
+
replace(content: string, options?: ContentOptions): Element;
|
|
890
|
+
remove(): Element;
|
|
891
|
+
removeAndKeepContent(): Element;
|
|
892
|
+
setInnerContent(content: string, options?: ContentOptions): Element;
|
|
893
|
+
onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;
|
|
894
|
+
}
|
|
895
|
+
declare interface EndTag {
|
|
896
|
+
name: string;
|
|
897
|
+
before(content: string, options?: ContentOptions): EndTag;
|
|
898
|
+
after(content: string, options?: ContentOptions): EndTag;
|
|
899
|
+
remove(): EndTag;
|
|
900
|
+
}
|
|
901
|
+
declare interface Comment {
|
|
902
|
+
text: string;
|
|
903
|
+
readonly removed: boolean;
|
|
904
|
+
before(content: string, options?: ContentOptions): Comment;
|
|
905
|
+
after(content: string, options?: ContentOptions): Comment;
|
|
906
|
+
replace(content: string, options?: ContentOptions): Comment;
|
|
907
|
+
remove(): Comment;
|
|
908
|
+
}
|
|
909
|
+
declare interface Text {
|
|
910
|
+
readonly text: string;
|
|
911
|
+
readonly lastInTextNode: boolean;
|
|
912
|
+
readonly removed: boolean;
|
|
913
|
+
before(content: string, options?: ContentOptions): Text;
|
|
914
|
+
after(content: string, options?: ContentOptions): Text;
|
|
915
|
+
replace(content: string, options?: ContentOptions): Text;
|
|
916
|
+
remove(): Text;
|
|
917
|
+
}
|
|
918
|
+
declare interface DocumentEnd {
|
|
919
|
+
append(content: string, options?: ContentOptions): DocumentEnd;
|
|
920
|
+
}
|
|
921
|
+
declare abstract class FetchEvent extends ExtendableEvent {
|
|
922
|
+
readonly request: Request;
|
|
923
|
+
respondWith(promise: Response | Promise<Response>): void;
|
|
924
|
+
passThroughOnException(): void;
|
|
925
|
+
}
|
|
926
|
+
declare type HeadersInit =
|
|
927
|
+
| Headers
|
|
928
|
+
| Iterable<Iterable<string>>
|
|
929
|
+
| Record<string, string>;
|
|
930
|
+
declare class Headers {
|
|
931
|
+
constructor(init?: HeadersInit);
|
|
932
|
+
get(name: string): string | null;
|
|
933
|
+
getAll(name: string): string[];
|
|
934
|
+
has(name: string): boolean;
|
|
935
|
+
set(name: string, value: string): void;
|
|
936
|
+
append(name: string, value: string): void;
|
|
937
|
+
delete(name: string): void;
|
|
938
|
+
forEach<This = unknown>(
|
|
939
|
+
callback: (this: This, value: string, key: string, parent: Headers) => void,
|
|
940
|
+
thisArg?: This
|
|
941
|
+
): void;
|
|
942
|
+
entries(): IterableIterator<[key: string, value: string]>;
|
|
943
|
+
keys(): IterableIterator<string>;
|
|
944
|
+
values(): IterableIterator<string>;
|
|
945
|
+
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
|
|
946
|
+
}
|
|
947
|
+
declare type BodyInit =
|
|
948
|
+
| ReadableStream<Uint8Array>
|
|
949
|
+
| string
|
|
950
|
+
| ArrayBuffer
|
|
951
|
+
| ArrayBufferView
|
|
952
|
+
| Blob
|
|
953
|
+
| URLSearchParams
|
|
954
|
+
| FormData;
|
|
955
|
+
declare abstract class Body {
|
|
956
|
+
readonly body: ReadableStream | null;
|
|
957
|
+
readonly bodyUsed: boolean;
|
|
958
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
959
|
+
text(): Promise<string>;
|
|
960
|
+
json<T>(): Promise<T>;
|
|
961
|
+
formData(): Promise<FormData>;
|
|
962
|
+
blob(): Promise<Blob>;
|
|
963
|
+
}
|
|
964
|
+
declare class Response extends Body {
|
|
965
|
+
constructor(body?: BodyInit | null, init?: ResponseInit);
|
|
966
|
+
static redirect(url: string, status?: number): Response;
|
|
967
|
+
static json(any: any, maybeInit?: ResponseInit | Response): Response;
|
|
968
|
+
clone(): Response;
|
|
969
|
+
readonly status: number;
|
|
970
|
+
readonly statusText: string;
|
|
971
|
+
readonly headers: Headers;
|
|
972
|
+
readonly ok: boolean;
|
|
973
|
+
readonly redirected: boolean;
|
|
974
|
+
readonly url: string;
|
|
975
|
+
readonly webSocket: WebSocket | null;
|
|
976
|
+
readonly cf?: any;
|
|
977
|
+
}
|
|
978
|
+
declare interface ResponseInit {
|
|
979
|
+
status?: number;
|
|
980
|
+
statusText?: string;
|
|
981
|
+
headers?: HeadersInit;
|
|
982
|
+
cf?: any;
|
|
983
|
+
webSocket?: WebSocket | null;
|
|
984
|
+
encodeBody?: "automatic" | "manual";
|
|
985
|
+
}
|
|
986
|
+
declare type RequestInfo = Request | string | URL;
|
|
987
|
+
declare class Request<CfHostMetadata = unknown> extends Body {
|
|
988
|
+
constructor(input: RequestInfo, init?: RequestInit);
|
|
989
|
+
clone(): Request<CfHostMetadata>;
|
|
990
|
+
/** Returns request's HTTP method, which is "GET" by default. */
|
|
991
|
+
readonly method: string;
|
|
992
|
+
/** Returns the URL of request as a string. */
|
|
993
|
+
readonly url: string;
|
|
994
|
+
/** Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header. */
|
|
995
|
+
readonly headers: Headers;
|
|
996
|
+
/** Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default. */
|
|
997
|
+
readonly redirect: string;
|
|
998
|
+
readonly fetcher: Fetcher | null;
|
|
999
|
+
/** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. */
|
|
1000
|
+
readonly signal: AbortSignal;
|
|
1001
|
+
readonly cf?: IncomingRequestCfProperties<CfHostMetadata>;
|
|
1002
|
+
}
|
|
1003
|
+
declare interface RequestInit<
|
|
1004
|
+
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
1005
|
+
> {
|
|
1006
|
+
/** A string to set request's method. */
|
|
1007
|
+
method?: string;
|
|
1008
|
+
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
1009
|
+
headers?: HeadersInit;
|
|
1010
|
+
/** A BodyInit object or null to set request's body. */
|
|
1011
|
+
body?: BodyInit | null;
|
|
1012
|
+
/** A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */
|
|
1013
|
+
redirect?: string;
|
|
1014
|
+
fetcher?: Fetcher | null;
|
|
1015
|
+
cf?: CfType;
|
|
1016
|
+
/** An AbortSignal to set request's signal. */
|
|
1017
|
+
signal?: AbortSignal | null;
|
|
1018
|
+
}
|
|
1019
|
+
declare abstract class Fetcher {
|
|
1020
|
+
fetch(
|
|
1021
|
+
input: RequestInfo,
|
|
1022
|
+
init?: RequestInit<RequestInitCfProperties>
|
|
1023
|
+
): Promise<Response>;
|
|
1024
|
+
connect(address: string, options?: SocketOptions): Socket;
|
|
1025
|
+
}
|
|
1026
|
+
declare interface FetcherPutOptions {
|
|
1027
|
+
expiration?: number;
|
|
1028
|
+
expirationTtl?: number;
|
|
1029
|
+
}
|
|
1030
|
+
declare interface KVNamespaceListKey<Metadata, Key extends string = string> {
|
|
1031
|
+
name: Key;
|
|
1032
|
+
expiration?: number;
|
|
1033
|
+
metadata?: Metadata;
|
|
1034
|
+
}
|
|
1035
|
+
declare type KVNamespaceListResult<Metadata, Key extends string = string> =
|
|
1036
|
+
| {
|
|
1037
|
+
list_complete: false;
|
|
1038
|
+
keys: KVNamespaceListKey<Metadata, Key>[];
|
|
1039
|
+
cursor: string;
|
|
1040
|
+
}
|
|
1041
|
+
| {
|
|
1042
|
+
list_complete: true;
|
|
1043
|
+
keys: KVNamespaceListKey<Metadata, Key>[];
|
|
1044
|
+
};
|
|
1045
|
+
declare interface KVNamespace<Key extends string = string> {
|
|
1046
|
+
get(
|
|
1047
|
+
key: Key,
|
|
1048
|
+
options?: Partial<KVNamespaceGetOptions<undefined>>
|
|
1049
|
+
): Promise<string | null>;
|
|
1050
|
+
get(key: Key, type: "text"): Promise<string | null>;
|
|
1051
|
+
get<ExpectedValue = unknown>(
|
|
1052
|
+
key: Key,
|
|
1053
|
+
type: "json"
|
|
1054
|
+
): Promise<ExpectedValue | null>;
|
|
1055
|
+
get(key: Key, type: "arrayBuffer"): Promise<ArrayBuffer | null>;
|
|
1056
|
+
get(key: Key, type: "stream"): Promise<ReadableStream | null>;
|
|
1057
|
+
get(
|
|
1058
|
+
key: Key,
|
|
1059
|
+
options?: KVNamespaceGetOptions<"text">
|
|
1060
|
+
): Promise<string | null>;
|
|
1061
|
+
get<ExpectedValue = unknown>(
|
|
1062
|
+
key: Key,
|
|
1063
|
+
options?: KVNamespaceGetOptions<"json">
|
|
1064
|
+
): Promise<ExpectedValue | null>;
|
|
1065
|
+
get(
|
|
1066
|
+
key: Key,
|
|
1067
|
+
options?: KVNamespaceGetOptions<"arrayBuffer">
|
|
1068
|
+
): Promise<string | null>;
|
|
1069
|
+
get(
|
|
1070
|
+
key: Key,
|
|
1071
|
+
options?: KVNamespaceGetOptions<"stream">
|
|
1072
|
+
): Promise<string | null>;
|
|
1073
|
+
list<Metadata = unknown>(
|
|
1074
|
+
options?: KVNamespaceListOptions
|
|
1075
|
+
): Promise<KVNamespaceListResult<Metadata, Key>>;
|
|
1076
|
+
put(
|
|
1077
|
+
key: Key,
|
|
1078
|
+
value: string | ArrayBuffer | ArrayBufferView | ReadableStream,
|
|
1079
|
+
options?: KVNamespacePutOptions
|
|
1080
|
+
): Promise<void>;
|
|
1081
|
+
getWithMetadata<Metadata = unknown>(
|
|
1082
|
+
key: Key,
|
|
1083
|
+
options?: Partial<KVNamespaceGetOptions<undefined>>
|
|
1084
|
+
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
1085
|
+
getWithMetadata<Metadata = unknown>(
|
|
1086
|
+
key: Key,
|
|
1087
|
+
type: "text"
|
|
1088
|
+
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
1089
|
+
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
|
|
1090
|
+
key: Key,
|
|
1091
|
+
type: "json"
|
|
1092
|
+
): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
|
|
1093
|
+
getWithMetadata<Metadata = unknown>(
|
|
1094
|
+
key: Key,
|
|
1095
|
+
type: "arrayBuffer"
|
|
1096
|
+
): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
|
|
1097
|
+
getWithMetadata<Metadata = unknown>(
|
|
1098
|
+
key: Key,
|
|
1099
|
+
type: "stream"
|
|
1100
|
+
): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
|
|
1101
|
+
getWithMetadata<Metadata = unknown>(
|
|
1102
|
+
key: Key,
|
|
1103
|
+
options: KVNamespaceGetOptions<"text">
|
|
1104
|
+
): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
1105
|
+
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
|
|
1106
|
+
key: Key,
|
|
1107
|
+
options: KVNamespaceGetOptions<"json">
|
|
1108
|
+
): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
|
|
1109
|
+
getWithMetadata<Metadata = unknown>(
|
|
1110
|
+
key: Key,
|
|
1111
|
+
options: KVNamespaceGetOptions<"arrayBuffer">
|
|
1112
|
+
): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
|
|
1113
|
+
getWithMetadata<Metadata = unknown>(
|
|
1114
|
+
key: Key,
|
|
1115
|
+
options: KVNamespaceGetOptions<"stream">
|
|
1116
|
+
): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
|
|
1117
|
+
delete(key: Key): Promise<void>;
|
|
1118
|
+
}
|
|
1119
|
+
declare interface KVNamespaceListOptions {
|
|
1120
|
+
limit?: number;
|
|
1121
|
+
prefix?: string | null;
|
|
1122
|
+
cursor?: string | null;
|
|
1123
|
+
}
|
|
1124
|
+
declare interface KVNamespaceGetOptions<Type> {
|
|
1125
|
+
type: Type;
|
|
1126
|
+
cacheTtl?: number;
|
|
1127
|
+
}
|
|
1128
|
+
declare interface KVNamespacePutOptions {
|
|
1129
|
+
expiration?: number;
|
|
1130
|
+
expirationTtl?: number;
|
|
1131
|
+
metadata?: any | null;
|
|
1132
|
+
}
|
|
1133
|
+
declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
1134
|
+
value: Value | null;
|
|
1135
|
+
metadata: Metadata | null;
|
|
1136
|
+
}
|
|
1137
|
+
declare interface R2Error extends Error {
|
|
1138
|
+
readonly name: string;
|
|
1139
|
+
readonly code: number;
|
|
1140
|
+
readonly message: string;
|
|
1141
|
+
readonly action: string;
|
|
1142
|
+
readonly stack: any;
|
|
1143
|
+
}
|
|
1144
|
+
declare interface R2ListOptions {
|
|
1145
|
+
limit?: number;
|
|
1146
|
+
prefix?: string;
|
|
1147
|
+
cursor?: string;
|
|
1148
|
+
delimiter?: string;
|
|
1149
|
+
startAfter?: string;
|
|
1150
|
+
}
|
|
1151
|
+
declare abstract class R2Bucket {
|
|
1152
|
+
head(key: string): Promise<R2Object | null>;
|
|
1153
|
+
get(
|
|
1154
|
+
key: string,
|
|
1155
|
+
options: R2GetOptions & {
|
|
1156
|
+
onlyIf: R2Conditional | Headers;
|
|
1157
|
+
}
|
|
1158
|
+
): Promise<R2ObjectBody | R2Object | null>;
|
|
1159
|
+
get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;
|
|
1160
|
+
put(
|
|
1161
|
+
key: string,
|
|
1162
|
+
value:
|
|
1163
|
+
| ReadableStream
|
|
1164
|
+
| ArrayBuffer
|
|
1165
|
+
| ArrayBufferView
|
|
1166
|
+
| string
|
|
1167
|
+
| null
|
|
1168
|
+
| Blob,
|
|
1169
|
+
options?: R2PutOptions
|
|
1170
|
+
): Promise<R2Object>;
|
|
1171
|
+
createMultipartUpload(
|
|
1172
|
+
key: string,
|
|
1173
|
+
options?: R2MultipartOptions
|
|
1174
|
+
): Promise<R2MultipartUpload>;
|
|
1175
|
+
resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;
|
|
1176
|
+
delete(keys: string | string[]): Promise<void>;
|
|
1177
|
+
list(options?: R2ListOptions): Promise<R2Objects>;
|
|
1178
|
+
}
|
|
1179
|
+
declare interface R2MultipartUpload {
|
|
1180
|
+
readonly key: string;
|
|
1181
|
+
readonly uploadId: string;
|
|
1182
|
+
uploadPart(
|
|
1183
|
+
partNumber: number,
|
|
1184
|
+
value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob
|
|
1185
|
+
): Promise<R2UploadedPart>;
|
|
1186
|
+
abort(): Promise<void>;
|
|
1187
|
+
complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
|
|
1188
|
+
}
|
|
1189
|
+
declare interface R2UploadedPart {
|
|
1190
|
+
partNumber: number;
|
|
1191
|
+
etag: string;
|
|
1192
|
+
}
|
|
1193
|
+
declare abstract class R2Object {
|
|
1194
|
+
readonly key: string;
|
|
1195
|
+
readonly version: string;
|
|
1196
|
+
readonly size: number;
|
|
1197
|
+
readonly etag: string;
|
|
1198
|
+
readonly httpEtag: string;
|
|
1199
|
+
readonly checksums: R2Checksums;
|
|
1200
|
+
readonly uploaded: Date;
|
|
1201
|
+
readonly httpMetadata?: R2HTTPMetadata;
|
|
1202
|
+
readonly customMetadata?: Record<string, string>;
|
|
1203
|
+
readonly range?: R2Range;
|
|
1204
|
+
writeHttpMetadata(headers: Headers): void;
|
|
1205
|
+
}
|
|
1206
|
+
declare interface R2ObjectBody extends R2Object {
|
|
1207
|
+
get body(): ReadableStream;
|
|
1208
|
+
get bodyUsed(): boolean;
|
|
1209
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
1210
|
+
text(): Promise<string>;
|
|
1211
|
+
json<T>(): Promise<T>;
|
|
1212
|
+
blob(): Promise<Blob>;
|
|
1213
|
+
}
|
|
1214
|
+
declare type R2Range =
|
|
1215
|
+
| {
|
|
1216
|
+
offset: number;
|
|
1217
|
+
length?: number;
|
|
1218
|
+
}
|
|
1219
|
+
| {
|
|
1220
|
+
offset?: number;
|
|
1221
|
+
length: number;
|
|
1222
|
+
}
|
|
1223
|
+
| {
|
|
1224
|
+
suffix: number;
|
|
1225
|
+
};
|
|
1226
|
+
declare interface R2Conditional {
|
|
1227
|
+
etagMatches?: string;
|
|
1228
|
+
etagDoesNotMatch?: string;
|
|
1229
|
+
uploadedBefore?: Date;
|
|
1230
|
+
uploadedAfter?: Date;
|
|
1231
|
+
secondsGranularity?: boolean;
|
|
1232
|
+
}
|
|
1233
|
+
declare interface R2GetOptions {
|
|
1234
|
+
onlyIf?: R2Conditional | Headers;
|
|
1235
|
+
range?: R2Range | Headers;
|
|
1236
|
+
}
|
|
1237
|
+
declare interface R2PutOptions {
|
|
1238
|
+
onlyIf?: R2Conditional | Headers;
|
|
1239
|
+
httpMetadata?: R2HTTPMetadata | Headers;
|
|
1240
|
+
customMetadata?: Record<string, string>;
|
|
1241
|
+
md5?: ArrayBuffer | string;
|
|
1242
|
+
sha1?: ArrayBuffer | string;
|
|
1243
|
+
sha256?: ArrayBuffer | string;
|
|
1244
|
+
sha384?: ArrayBuffer | string;
|
|
1245
|
+
sha512?: ArrayBuffer | string;
|
|
1246
|
+
}
|
|
1247
|
+
declare interface R2MultipartOptions {
|
|
1248
|
+
httpMetadata?: R2HTTPMetadata | Headers;
|
|
1249
|
+
customMetadata?: Record<string, string>;
|
|
1250
|
+
}
|
|
1251
|
+
declare interface R2Checksums {
|
|
1252
|
+
readonly md5?: ArrayBuffer;
|
|
1253
|
+
readonly sha1?: ArrayBuffer;
|
|
1254
|
+
readonly sha256?: ArrayBuffer;
|
|
1255
|
+
readonly sha384?: ArrayBuffer;
|
|
1256
|
+
readonly sha512?: ArrayBuffer;
|
|
1257
|
+
toJSON(): R2StringChecksums;
|
|
1258
|
+
}
|
|
1259
|
+
declare interface R2StringChecksums {
|
|
1260
|
+
md5?: string;
|
|
1261
|
+
sha1?: string;
|
|
1262
|
+
sha256?: string;
|
|
1263
|
+
sha384?: string;
|
|
1264
|
+
sha512?: string;
|
|
1265
|
+
}
|
|
1266
|
+
declare interface R2HTTPMetadata {
|
|
1267
|
+
contentType?: string;
|
|
1268
|
+
contentLanguage?: string;
|
|
1269
|
+
contentDisposition?: string;
|
|
1270
|
+
contentEncoding?: string;
|
|
1271
|
+
cacheControl?: string;
|
|
1272
|
+
cacheExpiry?: Date;
|
|
1273
|
+
}
|
|
1274
|
+
declare interface R2Objects {
|
|
1275
|
+
objects: R2Object[];
|
|
1276
|
+
truncated: boolean;
|
|
1277
|
+
cursor?: string;
|
|
1278
|
+
delimitedPrefixes: string[];
|
|
1279
|
+
}
|
|
1280
|
+
declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1281
|
+
readonly scheduledTime: number;
|
|
1282
|
+
readonly cron: string;
|
|
1283
|
+
noRetry(): void;
|
|
1284
|
+
}
|
|
1285
|
+
declare interface ScheduledController {
|
|
1286
|
+
readonly scheduledTime: number;
|
|
1287
|
+
readonly cron: string;
|
|
1288
|
+
noRetry(): void;
|
|
1289
|
+
}
|
|
1290
|
+
declare interface QueuingStrategy<T = any> {
|
|
1291
|
+
highWaterMark?: number | bigint;
|
|
1292
|
+
size?: (chunk: T) => number | bigint;
|
|
1293
|
+
}
|
|
1294
|
+
declare interface UnderlyingSink<W = any> {
|
|
1295
|
+
type?: string;
|
|
1296
|
+
start?: (controller: WritableStreamDefaultController) => void | Promise<void>;
|
|
1297
|
+
write?: (
|
|
1298
|
+
chunk: W,
|
|
1299
|
+
controller: WritableStreamDefaultController
|
|
1300
|
+
) => void | Promise<void>;
|
|
1301
|
+
abort?: (reason: any) => void | Promise<void>;
|
|
1302
|
+
close?: () => void | Promise<void>;
|
|
1303
|
+
}
|
|
1304
|
+
declare interface UnderlyingByteSource {
|
|
1305
|
+
type: "bytes";
|
|
1306
|
+
autoAllocateChunkSize?: number;
|
|
1307
|
+
start?: (controller: ReadableByteStreamController) => void | Promise<void>;
|
|
1308
|
+
pull?: (controller: ReadableByteStreamController) => void | Promise<void>;
|
|
1309
|
+
cancel?: (reason: any) => void | Promise<void>;
|
|
1310
|
+
}
|
|
1311
|
+
declare interface UnderlyingSource<R = any> {
|
|
1312
|
+
type?: "" | undefined;
|
|
1313
|
+
start?: (
|
|
1314
|
+
controller: ReadableStreamDefaultController<R>
|
|
1315
|
+
) => void | Promise<void>;
|
|
1316
|
+
pull?: (
|
|
1317
|
+
controller: ReadableStreamDefaultController<R>
|
|
1318
|
+
) => void | Promise<void>;
|
|
1319
|
+
cancel?: (reason: any) => void | Promise<void>;
|
|
1320
|
+
}
|
|
1321
|
+
declare interface Transformer<I = any, O = any> {
|
|
1322
|
+
readableType?: string;
|
|
1323
|
+
writableType?: string;
|
|
1324
|
+
start?: (
|
|
1325
|
+
controller: TransformStreamDefaultController<O>
|
|
1326
|
+
) => void | Promise<void>;
|
|
1327
|
+
transform?: (
|
|
1328
|
+
chunk: I,
|
|
1329
|
+
controller: TransformStreamDefaultController<O>
|
|
1330
|
+
) => void | Promise<void>;
|
|
1331
|
+
flush?: (
|
|
1332
|
+
controller: TransformStreamDefaultController<O>
|
|
1333
|
+
) => void | Promise<void>;
|
|
1334
|
+
}
|
|
1335
|
+
declare interface StreamPipeOptions {
|
|
1336
|
+
/**
|
|
1337
|
+
* Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.
|
|
1338
|
+
*
|
|
1339
|
+
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
|
|
1340
|
+
*
|
|
1341
|
+
* Errors and closures of the source and destination streams propagate as follows:
|
|
1342
|
+
*
|
|
1343
|
+
* An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination.
|
|
1344
|
+
*
|
|
1345
|
+
* An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source.
|
|
1346
|
+
*
|
|
1347
|
+
* When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error.
|
|
1348
|
+
*
|
|
1349
|
+
* If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source.
|
|
1350
|
+
*
|
|
1351
|
+
* The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set.
|
|
1352
|
+
*/
|
|
1353
|
+
preventClose?: boolean;
|
|
1354
|
+
preventAbort?: boolean;
|
|
1355
|
+
preventCancel?: boolean;
|
|
1356
|
+
signal?: AbortSignal;
|
|
1357
|
+
}
|
|
1358
|
+
declare type ReadableStreamReadResult<R = any> =
|
|
1359
|
+
| {
|
|
1360
|
+
done: false;
|
|
1361
|
+
value: R;
|
|
1362
|
+
}
|
|
1363
|
+
| {
|
|
1364
|
+
done: true;
|
|
1365
|
+
value?: undefined;
|
|
1366
|
+
};
|
|
1367
|
+
/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */
|
|
1368
|
+
declare interface ReadableStream<R = any> {
|
|
1369
|
+
readonly locked: boolean;
|
|
1370
|
+
cancel(reason?: any): Promise<void>;
|
|
1371
|
+
getReader(): ReadableStreamDefaultReader<R>;
|
|
1372
|
+
getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
|
|
1373
|
+
pipeThrough<T>(
|
|
1374
|
+
transform: ReadableWritablePair<T, R>,
|
|
1375
|
+
options?: StreamPipeOptions
|
|
1376
|
+
): ReadableStream<T>;
|
|
1377
|
+
pipeTo(
|
|
1378
|
+
destination: WritableStream<R>,
|
|
1379
|
+
options?: StreamPipeOptions
|
|
1380
|
+
): Promise<void>;
|
|
1381
|
+
tee(): [ReadableStream<R>, ReadableStream<R>];
|
|
1382
|
+
values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
|
|
1383
|
+
[Symbol.asyncIterator](
|
|
1384
|
+
options?: ReadableStreamValuesOptions
|
|
1385
|
+
): AsyncIterableIterator<R>;
|
|
1386
|
+
}
|
|
1387
|
+
declare const ReadableStream: {
|
|
1388
|
+
prototype: ReadableStream;
|
|
1389
|
+
new (
|
|
1390
|
+
underlyingSource: UnderlyingByteSource,
|
|
1391
|
+
strategy?: QueuingStrategy<Uint8Array>
|
|
1392
|
+
): ReadableStream<Uint8Array>;
|
|
1393
|
+
new <R = any>(
|
|
1394
|
+
underlyingSource?: UnderlyingSource<R>,
|
|
1395
|
+
strategy?: QueuingStrategy<R>
|
|
1396
|
+
): ReadableStream<R>;
|
|
1397
|
+
};
|
|
1398
|
+
declare class ReadableStreamDefaultReader<R = any> {
|
|
1399
|
+
constructor(stream: ReadableStream);
|
|
1400
|
+
readonly closed: Promise<void>;
|
|
1401
|
+
cancel(reason?: any): Promise<void>;
|
|
1402
|
+
read(): Promise<ReadableStreamReadResult<R>>;
|
|
1403
|
+
releaseLock(): void;
|
|
1404
|
+
}
|
|
1405
|
+
declare class ReadableStreamBYOBReader {
|
|
1406
|
+
constructor(stream: ReadableStream);
|
|
1407
|
+
readonly closed: Promise<void>;
|
|
1408
|
+
cancel(reason?: any): Promise<void>;
|
|
1409
|
+
read<T extends ArrayBufferView>(
|
|
1410
|
+
view: T
|
|
1411
|
+
): Promise<ReadableStreamReadResult<T>>;
|
|
1412
|
+
releaseLock(): void;
|
|
1413
|
+
readAtLeast<T extends ArrayBufferView>(
|
|
1414
|
+
minElements: number,
|
|
1415
|
+
view: T
|
|
1416
|
+
): Promise<ReadableStreamReadResult<T>>;
|
|
1417
|
+
}
|
|
1418
|
+
declare interface ReadableStreamGetReaderOptions {
|
|
1419
|
+
mode: "byob";
|
|
1420
|
+
}
|
|
1421
|
+
declare interface ReadableStreamBYOBRequest {
|
|
1422
|
+
readonly view: Uint8Array | null;
|
|
1423
|
+
respond(bytesWritten: number): void;
|
|
1424
|
+
respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;
|
|
1425
|
+
readonly atLeast: number | null;
|
|
1426
|
+
}
|
|
1427
|
+
declare interface ReadableStreamDefaultController<R = any> {
|
|
1428
|
+
readonly desiredSize: number | null;
|
|
1429
|
+
close(): void;
|
|
1430
|
+
enqueue(chunk?: R): void;
|
|
1431
|
+
error(reason: any): void;
|
|
1432
|
+
}
|
|
1433
|
+
declare interface ReadableByteStreamController {
|
|
1434
|
+
readonly byobRequest: ReadableStreamBYOBRequest | null;
|
|
1435
|
+
readonly desiredSize: number | null;
|
|
1436
|
+
close(): void;
|
|
1437
|
+
enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
|
|
1438
|
+
error(reason: any): void;
|
|
1439
|
+
}
|
|
1440
|
+
/** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */
|
|
1441
|
+
declare interface WritableStreamDefaultController {
|
|
1442
|
+
readonly signal: AbortSignal;
|
|
1443
|
+
error(reason?: any): void;
|
|
1444
|
+
}
|
|
1445
|
+
declare interface TransformStreamDefaultController<O = any> {
|
|
1446
|
+
get desiredSize(): number | null;
|
|
1447
|
+
enqueue(chunk?: O): void;
|
|
1448
|
+
error(reason: any): void;
|
|
1449
|
+
terminate(): void;
|
|
1450
|
+
}
|
|
1451
|
+
declare interface ReadableWritablePair<R = any, W = any> {
|
|
1452
|
+
/**
|
|
1453
|
+
* Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use.
|
|
1454
|
+
*
|
|
1455
|
+
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
|
|
1456
|
+
*/
|
|
1457
|
+
writable: WritableStream<W>;
|
|
1458
|
+
readable: ReadableStream<R>;
|
|
1459
|
+
}
|
|
1460
|
+
declare class WritableStream<W = any> {
|
|
1461
|
+
constructor(
|
|
1462
|
+
underlyingSink?: UnderlyingSink,
|
|
1463
|
+
queuingStrategy?: QueuingStrategy
|
|
1464
|
+
);
|
|
1465
|
+
readonly locked: boolean;
|
|
1466
|
+
abort(reason?: any): Promise<void>;
|
|
1467
|
+
close(): Promise<void>;
|
|
1468
|
+
getWriter(): WritableStreamDefaultWriter<W>;
|
|
1469
|
+
}
|
|
1470
|
+
declare class WritableStreamDefaultWriter<W = any> {
|
|
1471
|
+
constructor(stream: WritableStream);
|
|
1472
|
+
readonly closed: Promise<void>;
|
|
1473
|
+
readonly ready: Promise<void>;
|
|
1474
|
+
readonly desiredSize: number | null;
|
|
1475
|
+
abort(reason?: any): Promise<void>;
|
|
1476
|
+
close(): Promise<void>;
|
|
1477
|
+
write(chunk?: W): Promise<void>;
|
|
1478
|
+
releaseLock(): void;
|
|
1479
|
+
}
|
|
1480
|
+
declare class TransformStream<I = any, O = any> {
|
|
1481
|
+
constructor(
|
|
1482
|
+
transformer?: Transformer<I, O>,
|
|
1483
|
+
writableStrategy?: QueuingStrategy<I>,
|
|
1484
|
+
readableStrategy?: QueuingStrategy<O>
|
|
1485
|
+
);
|
|
1486
|
+
readonly readable: ReadableStream<O>;
|
|
1487
|
+
readonly writable: WritableStream<I>;
|
|
1488
|
+
}
|
|
1489
|
+
declare class FixedLengthStream extends IdentityTransformStream {
|
|
1490
|
+
constructor(expectedLength: number | bigint);
|
|
1491
|
+
}
|
|
1492
|
+
declare class IdentityTransformStream extends TransformStream<
|
|
1493
|
+
ArrayBuffer | ArrayBufferView,
|
|
1494
|
+
Uint8Array
|
|
1495
|
+
> {
|
|
1496
|
+
constructor();
|
|
1497
|
+
}
|
|
1498
|
+
declare interface ReadableStreamValuesOptions {
|
|
1499
|
+
preventCancel?: boolean;
|
|
1500
|
+
}
|
|
1501
|
+
declare class CompressionStream extends TransformStream<
|
|
1502
|
+
ArrayBuffer | ArrayBufferView,
|
|
1503
|
+
Uint8Array
|
|
1504
|
+
> {
|
|
1505
|
+
constructor(format: "gzip" | "deflate");
|
|
1506
|
+
}
|
|
1507
|
+
declare class DecompressionStream extends TransformStream<
|
|
1508
|
+
ArrayBuffer | ArrayBufferView,
|
|
1509
|
+
Uint8Array
|
|
1510
|
+
> {
|
|
1511
|
+
constructor(format: "gzip" | "deflate");
|
|
1512
|
+
}
|
|
1513
|
+
declare class TextEncoderStream extends TransformStream<string, Uint8Array> {
|
|
1514
|
+
constructor();
|
|
1515
|
+
}
|
|
1516
|
+
declare class TextDecoderStream extends TransformStream<
|
|
1517
|
+
ArrayBuffer | ArrayBufferView,
|
|
1518
|
+
string
|
|
1519
|
+
> {
|
|
1520
|
+
constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);
|
|
1521
|
+
}
|
|
1522
|
+
declare interface TextDecoderStreamTextDecoderStreamInit {
|
|
1523
|
+
fatal?: boolean;
|
|
1524
|
+
}
|
|
1525
|
+
declare class ByteLengthQueuingStrategy
|
|
1526
|
+
implements QueuingStrategy<ArrayBufferView>
|
|
1527
|
+
{
|
|
1528
|
+
constructor(init: QueuingStrategyInit);
|
|
1529
|
+
get highWaterMark(): number;
|
|
1530
|
+
get size(): (chunk?: any) => number;
|
|
1531
|
+
}
|
|
1532
|
+
declare class CountQueuingStrategy implements QueuingStrategy {
|
|
1533
|
+
constructor(init: QueuingStrategyInit);
|
|
1534
|
+
get highWaterMark(): number;
|
|
1535
|
+
get size(): (chunk?: any) => number;
|
|
1536
|
+
}
|
|
1537
|
+
declare interface QueuingStrategyInit {
|
|
1538
|
+
/**
|
|
1539
|
+
* Creates a new ByteLengthQueuingStrategy with the provided high water mark.
|
|
1540
|
+
*
|
|
1541
|
+
* Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw.
|
|
1542
|
+
*/
|
|
1543
|
+
highWaterMark: number;
|
|
1544
|
+
}
|
|
1545
|
+
declare abstract class TraceEvent extends ExtendableEvent {
|
|
1546
|
+
readonly traces: TraceItem[];
|
|
1547
|
+
}
|
|
1548
|
+
declare interface TraceItem {
|
|
1549
|
+
readonly event:
|
|
1550
|
+
| (
|
|
1551
|
+
| TraceItemFetchEventInfo
|
|
1552
|
+
| TraceItemScheduledEventInfo
|
|
1553
|
+
| TraceItemAlarmEventInfo
|
|
1554
|
+
| TraceItemCustomEventInfo
|
|
1555
|
+
)
|
|
1556
|
+
| null;
|
|
1557
|
+
readonly eventTimestamp: number | null;
|
|
1558
|
+
readonly logs: TraceLog[];
|
|
1559
|
+
readonly exceptions: TraceException[];
|
|
1560
|
+
readonly scriptName: string | null;
|
|
1561
|
+
readonly dispatchNamespace?: string;
|
|
1562
|
+
readonly outcome: string;
|
|
1563
|
+
}
|
|
1564
|
+
declare interface TraceItemAlarmEventInfo {
|
|
1565
|
+
readonly scheduledTime: Date;
|
|
1566
|
+
}
|
|
1567
|
+
declare interface TraceItemCustomEventInfo {}
|
|
1568
|
+
declare interface TraceItemScheduledEventInfo {
|
|
1569
|
+
readonly scheduledTime: number;
|
|
1570
|
+
readonly cron: string;
|
|
1571
|
+
}
|
|
1572
|
+
declare interface TraceItemFetchEventInfo {
|
|
1573
|
+
readonly response?: TraceItemFetchEventInfoResponse;
|
|
1574
|
+
readonly request: TraceItemFetchEventInfoRequest;
|
|
1575
|
+
}
|
|
1576
|
+
declare interface TraceItemFetchEventInfoRequest {
|
|
1577
|
+
readonly cf?: any;
|
|
1578
|
+
readonly headers: Record<string, string>;
|
|
1579
|
+
readonly method: string;
|
|
1580
|
+
readonly url: string;
|
|
1581
|
+
getUnredacted(): TraceItemFetchEventInfoRequest;
|
|
1582
|
+
}
|
|
1583
|
+
declare interface TraceItemFetchEventInfoResponse {
|
|
1584
|
+
readonly status: number;
|
|
1585
|
+
}
|
|
1586
|
+
declare interface TraceLog {
|
|
1587
|
+
readonly timestamp: number;
|
|
1588
|
+
readonly level: string;
|
|
1589
|
+
readonly message: any;
|
|
1590
|
+
}
|
|
1591
|
+
declare interface TraceException {
|
|
1592
|
+
readonly timestamp: number;
|
|
1593
|
+
readonly message: string;
|
|
1594
|
+
readonly name: string;
|
|
1595
|
+
}
|
|
1596
|
+
declare interface TraceMetrics {
|
|
1597
|
+
readonly cpuTime: number;
|
|
1598
|
+
readonly wallTime: number;
|
|
1599
|
+
}
|
|
1600
|
+
declare interface UnsafeTraceMetrics {
|
|
1601
|
+
fromTrace(item: TraceItem): TraceMetrics;
|
|
1602
|
+
}
|
|
1603
|
+
declare class URL {
|
|
1604
|
+
constructor(url: string | URL, base?: string | URL);
|
|
1605
|
+
href: string;
|
|
1606
|
+
readonly origin: string;
|
|
1607
|
+
protocol: string;
|
|
1608
|
+
username: string;
|
|
1609
|
+
password: string;
|
|
1610
|
+
host: string;
|
|
1611
|
+
hostname: string;
|
|
1612
|
+
port: string;
|
|
1613
|
+
pathname: string;
|
|
1614
|
+
search: string;
|
|
1615
|
+
readonly searchParams: URLSearchParams;
|
|
1616
|
+
hash: string;
|
|
1617
|
+
toString(): string;
|
|
1618
|
+
toJSON(): string;
|
|
1619
|
+
}
|
|
1620
|
+
declare class URLSearchParams {
|
|
1621
|
+
constructor(
|
|
1622
|
+
init?:
|
|
1623
|
+
| URLSearchParams
|
|
1624
|
+
| string
|
|
1625
|
+
| Record<string, string>
|
|
1626
|
+
| [key: string, value: string][]
|
|
1627
|
+
);
|
|
1628
|
+
append(name: string, value: string): void;
|
|
1629
|
+
delete(name: string): void;
|
|
1630
|
+
get(name: string): string | null;
|
|
1631
|
+
getAll(name: string): string[];
|
|
1632
|
+
has(name: string): boolean;
|
|
1633
|
+
set(name: string, value: string): void;
|
|
1634
|
+
sort(): void;
|
|
1635
|
+
entries(): IterableIterator<[key: string, value: string]>;
|
|
1636
|
+
keys(): IterableIterator<string>;
|
|
1637
|
+
values(): IterableIterator<string>;
|
|
1638
|
+
forEach<This = unknown>(
|
|
1639
|
+
callback: (
|
|
1640
|
+
this: This,
|
|
1641
|
+
value: string,
|
|
1642
|
+
key: string,
|
|
1643
|
+
parent: URLSearchParams
|
|
1644
|
+
) => void,
|
|
1645
|
+
thisArg?: This
|
|
1646
|
+
): void;
|
|
1647
|
+
toString(): string;
|
|
1648
|
+
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
|
|
1649
|
+
}
|
|
1650
|
+
declare class URLPattern {
|
|
1651
|
+
constructor(input?: string | URLPatternURLPatternInit, baseURL?: string);
|
|
1652
|
+
get protocol(): string;
|
|
1653
|
+
get username(): string;
|
|
1654
|
+
get password(): string;
|
|
1655
|
+
get hostname(): string;
|
|
1656
|
+
get port(): string;
|
|
1657
|
+
get pathname(): string;
|
|
1658
|
+
get search(): string;
|
|
1659
|
+
get hash(): string;
|
|
1660
|
+
test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean;
|
|
1661
|
+
exec(
|
|
1662
|
+
input?: string | URLPatternURLPatternInit,
|
|
1663
|
+
baseURL?: string
|
|
1664
|
+
): URLPatternURLPatternResult | null;
|
|
1665
|
+
}
|
|
1666
|
+
declare interface URLPatternURLPatternInit {
|
|
1667
|
+
protocol?: string;
|
|
1668
|
+
username?: string;
|
|
1669
|
+
password?: string;
|
|
1670
|
+
hostname?: string;
|
|
1671
|
+
port?: string;
|
|
1672
|
+
pathname?: string;
|
|
1673
|
+
search?: string;
|
|
1674
|
+
hash?: string;
|
|
1675
|
+
baseURL?: string;
|
|
1676
|
+
}
|
|
1677
|
+
declare interface URLPatternURLPatternComponentResult {
|
|
1678
|
+
input: string;
|
|
1679
|
+
groups: Record<string, string>;
|
|
1680
|
+
}
|
|
1681
|
+
declare interface URLPatternURLPatternResult {
|
|
1682
|
+
inputs: (string | URLPatternURLPatternInit)[];
|
|
1683
|
+
protocol: URLPatternURLPatternComponentResult;
|
|
1684
|
+
username: URLPatternURLPatternComponentResult;
|
|
1685
|
+
password: URLPatternURLPatternComponentResult;
|
|
1686
|
+
hostname: URLPatternURLPatternComponentResult;
|
|
1687
|
+
port: URLPatternURLPatternComponentResult;
|
|
1688
|
+
pathname: URLPatternURLPatternComponentResult;
|
|
1689
|
+
search: URLPatternURLPatternComponentResult;
|
|
1690
|
+
hash: URLPatternURLPatternComponentResult;
|
|
1691
|
+
}
|
|
1692
|
+
declare class CloseEvent extends Event {
|
|
1693
|
+
constructor(type: string, initializer: CloseEventInit);
|
|
1694
|
+
/** Returns the WebSocket connection close code provided by the server. */
|
|
1695
|
+
readonly code: number;
|
|
1696
|
+
/** Returns the WebSocket connection close reason provided by the server. */
|
|
1697
|
+
readonly reason: string;
|
|
1698
|
+
/** Returns true if the connection closed cleanly; false otherwise. */
|
|
1699
|
+
readonly wasClean: boolean;
|
|
1700
|
+
}
|
|
1701
|
+
declare interface CloseEventInit {
|
|
1702
|
+
code?: number;
|
|
1703
|
+
reason?: string;
|
|
1704
|
+
wasClean?: boolean;
|
|
1705
|
+
}
|
|
1706
|
+
declare class MessageEvent extends Event {
|
|
1707
|
+
constructor(type: string, initializer: MessageEventInit);
|
|
1708
|
+
readonly data: ArrayBuffer | string;
|
|
1709
|
+
}
|
|
1710
|
+
declare interface MessageEventInit {
|
|
1711
|
+
data: ArrayBuffer | string;
|
|
1712
|
+
}
|
|
1713
|
+
/** Events providing information related to errors in scripts or in files. */
|
|
1714
|
+
declare interface ErrorEvent extends Event {
|
|
1715
|
+
readonly filename: string;
|
|
1716
|
+
readonly message: string;
|
|
1717
|
+
readonly lineno: number;
|
|
1718
|
+
readonly colno: number;
|
|
1719
|
+
readonly error: any;
|
|
1720
|
+
}
|
|
1721
|
+
declare type WebSocketEventMap = {
|
|
1722
|
+
close: CloseEvent;
|
|
1723
|
+
message: MessageEvent;
|
|
1724
|
+
open: Event;
|
|
1725
|
+
error: ErrorEvent;
|
|
1726
|
+
};
|
|
1727
|
+
declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
1728
|
+
constructor(url: string, protocols?: string[] | string);
|
|
1729
|
+
accept(): void;
|
|
1730
|
+
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1731
|
+
close(code?: number, reason?: string): void;
|
|
1732
|
+
static readonly READY_STATE_CONNECTING: number;
|
|
1733
|
+
static readonly READY_STATE_OPEN: number;
|
|
1734
|
+
static readonly READY_STATE_CLOSING: number;
|
|
1735
|
+
static readonly READY_STATE_CLOSED: number;
|
|
1736
|
+
/** Returns the state of the WebSocket object's connection. It can have the values described below. */
|
|
1737
|
+
readonly readyState: number;
|
|
1738
|
+
/** Returns the URL that was used to establish the WebSocket connection. */
|
|
1739
|
+
readonly url: string | null;
|
|
1740
|
+
/** Returns the subprotocol selected by the server, if any. It can be used in conjunction with the array form of the constructor's second argument to perform subprotocol negotiation. */
|
|
1741
|
+
readonly protocol: string | null;
|
|
1742
|
+
/** Returns the extensions selected by the server, if any. */
|
|
1743
|
+
readonly extensions: string | null;
|
|
1744
|
+
}
|
|
1745
|
+
declare const WebSocketPair: {
|
|
1746
|
+
new (): {
|
|
1747
|
+
0: WebSocket;
|
|
1748
|
+
1: WebSocket;
|
|
1749
|
+
};
|
|
1750
|
+
};
|
|
1751
|
+
declare interface Socket {
|
|
1752
|
+
readonly readable: ReadableStream;
|
|
1753
|
+
readonly writable: WritableStream;
|
|
1754
|
+
readonly closed: Promise<void>;
|
|
1755
|
+
close(): Promise<void>;
|
|
1756
|
+
}
|
|
1757
|
+
declare interface SocketOptions {
|
|
1758
|
+
tsl: boolean;
|
|
1759
|
+
}
|
|
1760
|
+
declare interface BasicImageTransformations {
|
|
1761
|
+
/**
|
|
1762
|
+
* Maximum width in image pixels. The value must be an integer.
|
|
1763
|
+
*/
|
|
1764
|
+
width?: number;
|
|
1765
|
+
/**
|
|
1766
|
+
* Maximum height in image pixels. The value must be an integer.
|
|
1767
|
+
*/
|
|
1768
|
+
height?: number;
|
|
1769
|
+
/**
|
|
1770
|
+
* Resizing mode as a string. It affects interpretation of width and height
|
|
1771
|
+
* options:
|
|
1772
|
+
* - scale-down: Similar to contain, but the image is never enlarged. If
|
|
1773
|
+
* the image is larger than given width or height, it will be resized.
|
|
1774
|
+
* Otherwise its original size will be kept.
|
|
1775
|
+
* - contain: Resizes to maximum size that fits within the given width and
|
|
1776
|
+
* height. If only a single dimension is given (e.g. only width), the
|
|
1777
|
+
* image will be shrunk or enlarged to exactly match that dimension.
|
|
1778
|
+
* Aspect ratio is always preserved.
|
|
1779
|
+
* - cover: Resizes (shrinks or enlarges) to fill the entire area of width
|
|
1780
|
+
* and height. If the image has an aspect ratio different from the ratio
|
|
1781
|
+
* of width and height, it will be cropped to fit.
|
|
1782
|
+
* - crop: The image will be shrunk and cropped to fit within the area
|
|
1783
|
+
* specified by width and height. The image will not be enlarged. For images
|
|
1784
|
+
* smaller than the given dimensions it's the same as scale-down. For
|
|
1785
|
+
* images larger than the given dimensions, it's the same as cover.
|
|
1786
|
+
* See also trim.
|
|
1787
|
+
* - pad: Resizes to the maximum size that fits within the given width and
|
|
1788
|
+
* height, and then fills the remaining area with a background color
|
|
1789
|
+
* (white by default). Use of this mode is not recommended, as the same
|
|
1790
|
+
* effect can be more efficiently achieved with the contain mode and the
|
|
1791
|
+
* CSS object-fit: contain property.
|
|
1792
|
+
*/
|
|
1793
|
+
fit?: "scale-down" | "contain" | "cover" | "crop" | "pad";
|
|
1794
|
+
/**
|
|
1795
|
+
* When cropping with fit: "cover", this defines the side or point that should
|
|
1796
|
+
* be left uncropped. The value is either a string
|
|
1797
|
+
* "left", "right", "top", "bottom", "auto", or "center" (the default),
|
|
1798
|
+
* or an object {x, y} containing focal point coordinates in the original
|
|
1799
|
+
* image expressed as fractions ranging from 0.0 (top or left) to 1.0
|
|
1800
|
+
* (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will
|
|
1801
|
+
* crop bottom or left and right sides as necessary, but won’t crop anything
|
|
1802
|
+
* from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to
|
|
1803
|
+
* preserve as much as possible around a point at 20% of the height of the
|
|
1804
|
+
* source image.
|
|
1805
|
+
*/
|
|
1806
|
+
gravity?:
|
|
1807
|
+
| "left"
|
|
1808
|
+
| "right"
|
|
1809
|
+
| "top"
|
|
1810
|
+
| "bottom"
|
|
1811
|
+
| "center"
|
|
1812
|
+
| "auto"
|
|
1813
|
+
| BasicImageTransformationsGravityCoordinates;
|
|
1814
|
+
/**
|
|
1815
|
+
* Background color to add underneath the image. Applies only to images with
|
|
1816
|
+
* transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),
|
|
1817
|
+
* hsl(…), etc.)
|
|
1818
|
+
*/
|
|
1819
|
+
background?: string;
|
|
1820
|
+
/**
|
|
1821
|
+
* Number of degrees (90, 180, 270) to rotate the image by. width and height
|
|
1822
|
+
* options refer to axes after rotation.
|
|
1823
|
+
*/
|
|
1824
|
+
rotate?: 0 | 90 | 180 | 270 | 360;
|
|
1825
|
+
}
|
|
1826
|
+
declare interface BasicImageTransformationsGravityCoordinates {
|
|
1827
|
+
x: number;
|
|
1828
|
+
y: number;
|
|
1829
|
+
}
|
|
1830
|
+
/**
|
|
1831
|
+
* In addition to the properties you can set in the RequestInit dict
|
|
1832
|
+
* that you pass as an argument to the Request constructor, you can
|
|
1833
|
+
* set certain properties of a `cf` object to control how Cloudflare
|
|
1834
|
+
* features are applied to that new Request.
|
|
1835
|
+
*
|
|
1836
|
+
* Note: Currently, these properties cannot be tested in the
|
|
1837
|
+
* playground.
|
|
1838
|
+
*/
|
|
1839
|
+
declare interface RequestInitCfProperties {
|
|
1840
|
+
cacheEverything?: boolean;
|
|
1841
|
+
/**
|
|
1842
|
+
* A request's cache key is what determines if two requests are
|
|
1843
|
+
* "the same" for caching purposes. If a request has the same cache key
|
|
1844
|
+
* as some previous request, then we can serve the same cached response for
|
|
1845
|
+
* both. (e.g. 'some-key')
|
|
1846
|
+
*
|
|
1847
|
+
* Only available for Enterprise customers.
|
|
1848
|
+
*/
|
|
1849
|
+
cacheKey?: string;
|
|
1850
|
+
/**
|
|
1851
|
+
* This allows you to append additional Cache-Tag response headers
|
|
1852
|
+
* to the origin response without modifications to the origin server.
|
|
1853
|
+
* This will allow for greater control over the Purge by Cache Tag feature
|
|
1854
|
+
* utilizing changes only in the Workers process.
|
|
1855
|
+
*
|
|
1856
|
+
* Only available for Enterprise customers.
|
|
1857
|
+
*/
|
|
1858
|
+
cacheTags?: string[];
|
|
1859
|
+
/**
|
|
1860
|
+
* Force response to be cached for a given number of seconds. (e.g. 300)
|
|
1861
|
+
*/
|
|
1862
|
+
cacheTtl?: number;
|
|
1863
|
+
/**
|
|
1864
|
+
* Force response to be cached for a given number of seconds based on the Origin status code.
|
|
1865
|
+
* (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })
|
|
1866
|
+
*/
|
|
1867
|
+
cacheTtlByStatus?: Record<string, number>;
|
|
1868
|
+
scrapeShield?: boolean;
|
|
1869
|
+
apps?: boolean;
|
|
1870
|
+
image?: RequestInitCfPropertiesImage;
|
|
1871
|
+
minify?: RequestInitCfPropertiesImageMinify;
|
|
1872
|
+
mirage?: boolean;
|
|
1873
|
+
polish?: "lossy" | "lossless" | "off";
|
|
1874
|
+
/**
|
|
1875
|
+
* Redirects the request to an alternate origin server. You can use this,
|
|
1876
|
+
* for example, to implement load balancing across several origins.
|
|
1877
|
+
* (e.g.us-east.example.com)
|
|
1878
|
+
*
|
|
1879
|
+
* Note - For security reasons, the hostname set in resolveOverride must
|
|
1880
|
+
* be proxied on the same Cloudflare zone of the incoming request.
|
|
1881
|
+
* Otherwise, the setting is ignored. CNAME hosts are allowed, so to
|
|
1882
|
+
* resolve to a host under a different domain or a DNS only domain first
|
|
1883
|
+
* declare a CNAME record within your own zone’s DNS mapping to the
|
|
1884
|
+
* external hostname, set proxy on Cloudflare, then set resolveOverride
|
|
1885
|
+
* to point to that CNAME record.
|
|
1886
|
+
*/
|
|
1887
|
+
resolveOverride?: string;
|
|
1888
|
+
}
|
|
1889
|
+
declare interface RequestInitCfPropertiesImageDraw
|
|
1890
|
+
extends BasicImageTransformations {
|
|
1891
|
+
/**
|
|
1892
|
+
* Absolute URL of the image file to use for the drawing. It can be any of
|
|
1893
|
+
* the supported file formats. For drawing of watermarks or non-rectangular
|
|
1894
|
+
* overlays we recommend using PNG or WebP images.
|
|
1895
|
+
*/
|
|
1896
|
+
url: string;
|
|
1897
|
+
/**
|
|
1898
|
+
* Floating-point number between 0 (transparent) and 1 (opaque).
|
|
1899
|
+
* For example, opacity: 0.5 makes overlay semitransparent.
|
|
1900
|
+
*/
|
|
1901
|
+
opacity?: number;
|
|
1902
|
+
/**
|
|
1903
|
+
* - If set to true, the overlay image will be tiled to cover the entire
|
|
1904
|
+
* area. This is useful for stock-photo-like watermarks.
|
|
1905
|
+
* - If set to "x", the overlay image will be tiled horizontally only
|
|
1906
|
+
* (form a line).
|
|
1907
|
+
* - If set to "y", the overlay image will be tiled vertically only
|
|
1908
|
+
* (form a line).
|
|
1909
|
+
*/
|
|
1910
|
+
repeat?: true | "x" | "y";
|
|
1911
|
+
/**
|
|
1912
|
+
* Position of the overlay image relative to a given edge. Each property is
|
|
1913
|
+
* an offset in pixels. 0 aligns exactly to the edge. For example, left: 10
|
|
1914
|
+
* positions left side of the overlay 10 pixels from the left edge of the
|
|
1915
|
+
* image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom
|
|
1916
|
+
* of the background image.
|
|
1917
|
+
*
|
|
1918
|
+
* Setting both left & right, or both top & bottom is an error.
|
|
1919
|
+
*
|
|
1920
|
+
* If no position is specified, the image will be centered.
|
|
1921
|
+
*/
|
|
1922
|
+
top?: number;
|
|
1923
|
+
left?: number;
|
|
1924
|
+
bottom?: number;
|
|
1925
|
+
right?: number;
|
|
1926
|
+
}
|
|
1927
|
+
declare interface RequestInitCfPropertiesImage
|
|
1928
|
+
extends BasicImageTransformations {
|
|
1929
|
+
/**
|
|
1930
|
+
* Device Pixel Ratio. Default 1. Multiplier for width/height that makes it
|
|
1931
|
+
* easier to specify higher-DPI sizes in <img srcset>.
|
|
1932
|
+
*/
|
|
1933
|
+
dpr?: number;
|
|
1934
|
+
/**
|
|
1935
|
+
* An object with four properties {left, top, right, bottom} that specify
|
|
1936
|
+
* a number of pixels to cut off on each side. Allows removal of borders
|
|
1937
|
+
* or cutting out a specific fragment of an image. Trimming is performed
|
|
1938
|
+
* before resizing or rotation. Takes dpr into account.
|
|
1939
|
+
*/
|
|
1940
|
+
trim?: {
|
|
1941
|
+
left?: number;
|
|
1942
|
+
top?: number;
|
|
1943
|
+
right?: number;
|
|
1944
|
+
bottom?: number;
|
|
1945
|
+
};
|
|
1946
|
+
/**
|
|
1947
|
+
* Quality setting from 1-100 (useful values are in 60-90 range). Lower values
|
|
1948
|
+
* make images look worse, but load faster. The default is 85. It applies only
|
|
1949
|
+
* to JPEG and WebP images. It doesn’t have any effect on PNG.
|
|
1950
|
+
*/
|
|
1951
|
+
quality?: number;
|
|
1952
|
+
/**
|
|
1953
|
+
* Output format to generate. It can be:
|
|
1954
|
+
* - avif: generate images in AVIF format.
|
|
1955
|
+
* - webp: generate images in Google WebP format. Set quality to 100 to get
|
|
1956
|
+
* the WebP-lossless format.
|
|
1957
|
+
* - json: instead of generating an image, outputs information about the
|
|
1958
|
+
* image, in JSON format. The JSON object will contain image size
|
|
1959
|
+
* (before and after resizing), source image’s MIME type, file size, etc.
|
|
1960
|
+
* - jpeg: generate images in JPEG format.
|
|
1961
|
+
* - png: generate images in PNG format.
|
|
1962
|
+
*/
|
|
1963
|
+
format?: "avif" | "webp" | "json" | "jpeg" | "png";
|
|
1964
|
+
/**
|
|
1965
|
+
* Whether to preserve animation frames from input files. Default is true.
|
|
1966
|
+
* Setting it to false reduces animations to still images. This setting is
|
|
1967
|
+
* recommended when enlarging images or processing arbitrary user content,
|
|
1968
|
+
* because large GIF animations can weigh tens or even hundreds of megabytes.
|
|
1969
|
+
* It is also useful to set anim:false when using format:"json" to get the
|
|
1970
|
+
* response quicker without the number of frames.
|
|
1971
|
+
*/
|
|
1972
|
+
anim?: boolean;
|
|
1973
|
+
/**
|
|
1974
|
+
* What EXIF data should be preserved in the output image. Note that EXIF
|
|
1975
|
+
* rotation and embedded color profiles are always applied ("baked in" into
|
|
1976
|
+
* the image), and aren't affected by this option. Note that if the Polish
|
|
1977
|
+
* feature is enabled, all metadata may have been removed already and this
|
|
1978
|
+
* option may have no effect.
|
|
1979
|
+
* - keep: Preserve most of EXIF metadata, including GPS location if there's
|
|
1980
|
+
* any.
|
|
1981
|
+
* - copyright: Only keep the copyright tag, and discard everything else.
|
|
1982
|
+
* This is the default behavior for JPEG files.
|
|
1983
|
+
* - none: Discard all invisible EXIF metadata. Currently WebP and PNG
|
|
1984
|
+
* output formats always discard metadata.
|
|
1985
|
+
*/
|
|
1986
|
+
metadata?: "keep" | "copyright" | "none";
|
|
1987
|
+
/**
|
|
1988
|
+
* Strength of sharpening filter to apply to the image. Floating-point
|
|
1989
|
+
* number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a
|
|
1990
|
+
* recommended value for downscaled images.
|
|
1991
|
+
*/
|
|
1992
|
+
sharpen?: number;
|
|
1993
|
+
/**
|
|
1994
|
+
* Radius of a blur filter (approximate gaussian). Maximum supported radius
|
|
1995
|
+
* is 250.
|
|
1996
|
+
*/
|
|
1997
|
+
blur?: number;
|
|
1998
|
+
/**
|
|
1999
|
+
* Overlays are drawn in the order they appear in the array (last array
|
|
2000
|
+
* entry is the topmost layer).
|
|
2001
|
+
*/
|
|
2002
|
+
draw?: RequestInitCfPropertiesImageDraw[];
|
|
2003
|
+
/**
|
|
2004
|
+
* Fetching image from authenticated origin. Setting this property will
|
|
2005
|
+
* pass authentication headers (Authorization, Cookie, etc.) through to
|
|
2006
|
+
* the origin.
|
|
2007
|
+
*/
|
|
2008
|
+
"origin-auth"?: "share-publicly";
|
|
2009
|
+
}
|
|
2010
|
+
declare interface RequestInitCfPropertiesImageMinify {
|
|
2011
|
+
javascript?: boolean;
|
|
2012
|
+
css?: boolean;
|
|
2013
|
+
html?: boolean;
|
|
2014
|
+
}
|
|
2015
|
+
/**
|
|
2016
|
+
* Request metadata provided by Cloudflare's edge.
|
|
2017
|
+
*/
|
|
2018
|
+
declare type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
2019
|
+
IncomingRequestCfPropertiesBase &
|
|
2020
|
+
IncomingRequestCfPropertiesBotManagementEnterprise &
|
|
2021
|
+
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2022
|
+
IncomingRequestCfPropertiesGeographicInformation &
|
|
2023
|
+
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2024
|
+
declare interface IncomingRequestCfPropertiesBase {
|
|
2025
|
+
/**
|
|
2026
|
+
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2027
|
+
*
|
|
2028
|
+
* @example 395747
|
|
2029
|
+
*/
|
|
2030
|
+
asn: number;
|
|
2031
|
+
/**
|
|
2032
|
+
* The organization which owns the ASN of the incoming request.
|
|
2033
|
+
*
|
|
2034
|
+
* @example "Google Cloud"
|
|
2035
|
+
*/
|
|
2036
|
+
asOrganization: string;
|
|
2037
|
+
/**
|
|
2038
|
+
* The original value of the `Accept-Encoding` header if Cloudflare modified it.
|
|
2039
|
+
*
|
|
2040
|
+
* @example "gzip, deflate, br"
|
|
2041
|
+
*/
|
|
2042
|
+
clientAcceptEncoding?: string;
|
|
2043
|
+
/**
|
|
2044
|
+
* The number of milliseconds it took for the request to reach your worker.
|
|
2045
|
+
*
|
|
2046
|
+
* @example 22
|
|
2047
|
+
*/
|
|
2048
|
+
clientTcpRtt?: number;
|
|
2049
|
+
/**
|
|
2050
|
+
* The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code)
|
|
2051
|
+
* airport code of the data center that the request hit.
|
|
2052
|
+
*
|
|
2053
|
+
* @example "DFW"
|
|
2054
|
+
*/
|
|
2055
|
+
colo: string;
|
|
2056
|
+
/**
|
|
2057
|
+
* Represents the upstream's response to a
|
|
2058
|
+
* [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html)
|
|
2059
|
+
* from cloudflare.
|
|
2060
|
+
*
|
|
2061
|
+
* For workers with no upstream, this will always be `1`.
|
|
2062
|
+
*
|
|
2063
|
+
* @example 3
|
|
2064
|
+
*/
|
|
2065
|
+
edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus;
|
|
2066
|
+
/**
|
|
2067
|
+
* The HTTP Protocol the request used.
|
|
2068
|
+
*
|
|
2069
|
+
* @example "HTTP/2"
|
|
2070
|
+
*/
|
|
2071
|
+
httpProtocol: string;
|
|
2072
|
+
/**
|
|
2073
|
+
* The browser-requested prioritization information in the request object.
|
|
2074
|
+
*
|
|
2075
|
+
* If no information was set, defaults to the empty string `""`
|
|
2076
|
+
*
|
|
2077
|
+
* @example "weight=192;exclusive=0;group=3;group-weight=127"
|
|
2078
|
+
* @default ""
|
|
2079
|
+
*/
|
|
2080
|
+
requestPriority: string;
|
|
2081
|
+
/**
|
|
2082
|
+
* The TLS version of the connection to Cloudflare.
|
|
2083
|
+
* In requests served over plaintext (without TLS), this property is the empty string `""`.
|
|
2084
|
+
*
|
|
2085
|
+
* @example "TLSv1.3"
|
|
2086
|
+
*/
|
|
2087
|
+
tlsVersion: string;
|
|
2088
|
+
/**
|
|
2089
|
+
* The cipher for the connection to Cloudflare.
|
|
2090
|
+
* In requests served over plaintext (without TLS), this property is the empty string `""`.
|
|
2091
|
+
*
|
|
2092
|
+
* @example "AEAD-AES128-GCM-SHA256"
|
|
2093
|
+
*/
|
|
2094
|
+
tlsCipher: string;
|
|
2095
|
+
/**
|
|
2096
|
+
* Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake.
|
|
2097
|
+
*
|
|
2098
|
+
* If the incoming request was served over plaintext (without TLS) this field is undefined.
|
|
2099
|
+
*/
|
|
2100
|
+
tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata;
|
|
2101
|
+
}
|
|
2102
|
+
declare interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2103
|
+
/**
|
|
2104
|
+
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2105
|
+
* represented as an integer percentage between `1` (almost certainly human)
|
|
2106
|
+
* and `99` (almost certainly a bot).
|
|
2107
|
+
*
|
|
2108
|
+
* @example 54
|
|
2109
|
+
*/
|
|
2110
|
+
score: number;
|
|
2111
|
+
/**
|
|
2112
|
+
* A boolean value that is true if the request comes from a good bot, like Google or Bing.
|
|
2113
|
+
* Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots).
|
|
2114
|
+
*/
|
|
2115
|
+
verifiedBot: boolean;
|
|
2116
|
+
/**
|
|
2117
|
+
* A boolean value that is true if the request originates from a
|
|
2118
|
+
* Cloudflare-verified proxy service.
|
|
2119
|
+
*/
|
|
2120
|
+
corporateProxy: boolean;
|
|
2121
|
+
/**
|
|
2122
|
+
* A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources.
|
|
2123
|
+
*/
|
|
2124
|
+
staticResource: boolean;
|
|
2125
|
+
}
|
|
2126
|
+
declare interface IncomingRequestCfPropertiesBotManagement {
|
|
2127
|
+
/**
|
|
2128
|
+
* Results of Cloudflare's Bot Management analysis
|
|
2129
|
+
*/
|
|
2130
|
+
botManagement: IncomingRequestCfPropertiesBotManagementBase;
|
|
2131
|
+
/**
|
|
2132
|
+
* Duplicate of `botManagement.score`.
|
|
2133
|
+
*
|
|
2134
|
+
* @deprecated
|
|
2135
|
+
*/
|
|
2136
|
+
clientTrustScore: number;
|
|
2137
|
+
}
|
|
2138
|
+
declare interface IncomingRequestCfPropertiesBotManagementEnterprise
|
|
2139
|
+
extends IncomingRequestCfPropertiesBotManagement {
|
|
2140
|
+
/**
|
|
2141
|
+
* Results of Cloudflare's Bot Management analysis
|
|
2142
|
+
*/
|
|
2143
|
+
botManagement: IncomingRequestCfPropertiesBotManagementBase & {
|
|
2144
|
+
/**
|
|
2145
|
+
* A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients
|
|
2146
|
+
* across different destination IPs, Ports, and X509 certificates.
|
|
2147
|
+
*/
|
|
2148
|
+
ja3Hash: string;
|
|
2149
|
+
};
|
|
2150
|
+
}
|
|
2151
|
+
declare interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<
|
|
2152
|
+
HostMetadata
|
|
2153
|
+
> {
|
|
2154
|
+
/**
|
|
2155
|
+
* Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/).
|
|
2156
|
+
*
|
|
2157
|
+
* This field is only present if you have Cloudflare for SaaS enabled on your account
|
|
2158
|
+
* and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)).
|
|
2159
|
+
*/
|
|
2160
|
+
hostMetadata: HostMetadata;
|
|
2161
|
+
}
|
|
2162
|
+
declare interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield {
|
|
2163
|
+
/**
|
|
2164
|
+
* Information about the client certificate presented to Cloudflare.
|
|
2165
|
+
*
|
|
2166
|
+
* This is populated when the incoming request is served over TLS using
|
|
2167
|
+
* either Cloudflare Access or API Shield (mTLS)
|
|
2168
|
+
* and the presented SSL certificate has a valid
|
|
2169
|
+
* [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number)
|
|
2170
|
+
* (i.e., not `null` or `""`).
|
|
2171
|
+
*
|
|
2172
|
+
* Otherwise, a set of placeholder values are used.
|
|
2173
|
+
*
|
|
2174
|
+
* The property `certPresented` will be set to `"1"` when
|
|
2175
|
+
* the object is populated (i.e. the above conditions were met).
|
|
2176
|
+
*/
|
|
2177
|
+
tlsClientAuth:
|
|
2178
|
+
| IncomingRequestCfPropertiesTLSClientAuth
|
|
2179
|
+
| IncomingRequestCfPropertiesTLSClientAuthPlaceholder;
|
|
2180
|
+
}
|
|
2181
|
+
/**
|
|
2182
|
+
* Metadata about the request's TLS handshake
|
|
2183
|
+
*/
|
|
2184
|
+
declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
2185
|
+
/**
|
|
2186
|
+
* The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal
|
|
2187
|
+
*
|
|
2188
|
+
* @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d"
|
|
2189
|
+
*/
|
|
2190
|
+
clientHandshake: string;
|
|
2191
|
+
/**
|
|
2192
|
+
* The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal
|
|
2193
|
+
*
|
|
2194
|
+
* @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d"
|
|
2195
|
+
*/
|
|
2196
|
+
serverHandshake: string;
|
|
2197
|
+
/**
|
|
2198
|
+
* The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal
|
|
2199
|
+
*
|
|
2200
|
+
* @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b"
|
|
2201
|
+
*/
|
|
2202
|
+
clientFinished: string;
|
|
2203
|
+
/**
|
|
2204
|
+
* The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal
|
|
2205
|
+
*
|
|
2206
|
+
* @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b"
|
|
2207
|
+
*/
|
|
2208
|
+
serverFinished: string;
|
|
2209
|
+
}
|
|
2210
|
+
/**
|
|
2211
|
+
* Geographic data about the request's origin.
|
|
2212
|
+
*/
|
|
2213
|
+
declare type IncomingRequestCfPropertiesGeographicInformation =
|
|
2214
|
+
| {}
|
|
2215
|
+
| {
|
|
2216
|
+
/** The country code `"T1"` is used for requests originating on TOR */
|
|
2217
|
+
country: "T1";
|
|
2218
|
+
}
|
|
2219
|
+
| {
|
|
2220
|
+
/**
|
|
2221
|
+
* The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
|
|
2222
|
+
*
|
|
2223
|
+
* If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR.
|
|
2224
|
+
*
|
|
2225
|
+
* If Cloudflare is unable to determine where the request originated this property is omitted.
|
|
2226
|
+
*
|
|
2227
|
+
* @example "GB"
|
|
2228
|
+
*/
|
|
2229
|
+
country: Iso3166Alpha2Code;
|
|
2230
|
+
/**
|
|
2231
|
+
* If present, this property indicates that the request originated in the EU
|
|
2232
|
+
*
|
|
2233
|
+
* @example "1"
|
|
2234
|
+
*/
|
|
2235
|
+
isEUCountry?: "1";
|
|
2236
|
+
/**
|
|
2237
|
+
* A two-letter code indicating the continent the request originated from.
|
|
2238
|
+
*
|
|
2239
|
+
* @example "AN"
|
|
2240
|
+
*/
|
|
2241
|
+
continent: ContinentCode;
|
|
2242
|
+
/**
|
|
2243
|
+
* The city the request originated from
|
|
2244
|
+
*
|
|
2245
|
+
* @example "Austin"
|
|
2246
|
+
*/
|
|
2247
|
+
city?: string;
|
|
2248
|
+
/**
|
|
2249
|
+
* Postal code of the incoming request
|
|
2250
|
+
*
|
|
2251
|
+
* @example "78701"
|
|
2252
|
+
*/
|
|
2253
|
+
postalCode?: string;
|
|
2254
|
+
/**
|
|
2255
|
+
* Latitude of the incoming request
|
|
2256
|
+
*
|
|
2257
|
+
* @example "30.27130"
|
|
2258
|
+
*/
|
|
2259
|
+
latitude?: string;
|
|
2260
|
+
/**
|
|
2261
|
+
* Longitude of the incoming request
|
|
2262
|
+
*
|
|
2263
|
+
* @example "-97.74260"
|
|
2264
|
+
*/
|
|
2265
|
+
longitude?: string;
|
|
2266
|
+
/**
|
|
2267
|
+
* Timezone of the incoming request
|
|
2268
|
+
*
|
|
2269
|
+
* @example "America/Chicago"
|
|
2270
|
+
*/
|
|
2271
|
+
timezone?: string;
|
|
2272
|
+
/**
|
|
2273
|
+
* If known, the ISO 3166-2 name for the first level region associated with
|
|
2274
|
+
* the IP address of the incoming request
|
|
2275
|
+
*
|
|
2276
|
+
* @example "Texas"
|
|
2277
|
+
*/
|
|
2278
|
+
region?: string;
|
|
2279
|
+
/**
|
|
2280
|
+
* If known, the ISO 3166-2 code for the first-level region associated with
|
|
2281
|
+
* the IP address of the incoming request
|
|
2282
|
+
*
|
|
2283
|
+
* @example "TX"
|
|
2284
|
+
*/
|
|
2285
|
+
regionCode?: string;
|
|
2286
|
+
/**
|
|
2287
|
+
* Metro code (DMA) of the incoming request
|
|
2288
|
+
*
|
|
2289
|
+
* @example "635"
|
|
2290
|
+
*/
|
|
2291
|
+
metroCode?: string;
|
|
2292
|
+
};
|
|
2293
|
+
/** Data about the incoming request's TLS certificate */
|
|
2294
|
+
declare interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2295
|
+
/** Always `"1"`, indicating that the certificate was presented */
|
|
2296
|
+
certPresented: "1";
|
|
2297
|
+
/**
|
|
2298
|
+
* Result of certificate verification.
|
|
2299
|
+
*
|
|
2300
|
+
* @example "FAILED:self signed certificate"
|
|
2301
|
+
*/
|
|
2302
|
+
certVerified: Exclude<CertVerificationStatus, "NONE">;
|
|
2303
|
+
/** The presented certificate's revokation status.
|
|
2304
|
+
*
|
|
2305
|
+
* - A value of `"1"` indicates the certificate has been revoked
|
|
2306
|
+
* - A value of `"0"` indicates the certificate has not been revoked
|
|
2307
|
+
*/
|
|
2308
|
+
certRevoked: "1" | "0";
|
|
2309
|
+
/**
|
|
2310
|
+
* The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)
|
|
2311
|
+
*
|
|
2312
|
+
* @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
|
|
2313
|
+
*/
|
|
2314
|
+
certIssuerDN: string;
|
|
2315
|
+
/**
|
|
2316
|
+
* The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)
|
|
2317
|
+
*
|
|
2318
|
+
* @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
|
|
2319
|
+
*/
|
|
2320
|
+
certSubjectDN: string;
|
|
2321
|
+
/**
|
|
2322
|
+
* The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)
|
|
2323
|
+
*
|
|
2324
|
+
* @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
|
|
2325
|
+
*/
|
|
2326
|
+
certIssuerDNRFC2253: string;
|
|
2327
|
+
/**
|
|
2328
|
+
* The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)
|
|
2329
|
+
*
|
|
2330
|
+
* @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
|
|
2331
|
+
*/
|
|
2332
|
+
certSubjectDNRFC2253: string;
|
|
2333
|
+
/** The certificate issuer's distinguished name (legacy policies) */
|
|
2334
|
+
certIssuerDNLegacy: string;
|
|
2335
|
+
/** The certificate subject's distinguished name (legacy policies) */
|
|
2336
|
+
certSubjectDNLegacy: string;
|
|
2337
|
+
/**
|
|
2338
|
+
* The certificate's serial number
|
|
2339
|
+
*
|
|
2340
|
+
* @example "00936EACBE07F201DF"
|
|
2341
|
+
*/
|
|
2342
|
+
certSerial: string;
|
|
2343
|
+
/**
|
|
2344
|
+
* The certificate issuer's serial number
|
|
2345
|
+
*
|
|
2346
|
+
* @example "2489002934BDFEA34"
|
|
2347
|
+
*/
|
|
2348
|
+
certIssuerSerial: string;
|
|
2349
|
+
/**
|
|
2350
|
+
* The certificate's Subject Key Identifier
|
|
2351
|
+
*
|
|
2352
|
+
* @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4"
|
|
2353
|
+
*/
|
|
2354
|
+
certSKI: string;
|
|
2355
|
+
/**
|
|
2356
|
+
* The certificate issuer's Subject Key Identifier
|
|
2357
|
+
*
|
|
2358
|
+
* @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4"
|
|
2359
|
+
*/
|
|
2360
|
+
certIssuerSKI: string;
|
|
2361
|
+
/**
|
|
2362
|
+
* The certificate's SHA-1 fingerprint
|
|
2363
|
+
*
|
|
2364
|
+
* @example "6b9109f323999e52259cda7373ff0b4d26bd232e"
|
|
2365
|
+
*/
|
|
2366
|
+
certFingerprintSHA1: string;
|
|
2367
|
+
/**
|
|
2368
|
+
* The certificate's SHA-256 fingerprint
|
|
2369
|
+
*
|
|
2370
|
+
* @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea"
|
|
2371
|
+
*/
|
|
2372
|
+
certFingerprintSHA256: string;
|
|
2373
|
+
/**
|
|
2374
|
+
* The effective starting date of the certificate
|
|
2375
|
+
*
|
|
2376
|
+
* @example "Dec 22 19:39:00 2018 GMT"
|
|
2377
|
+
*/
|
|
2378
|
+
certNotBefore: string;
|
|
2379
|
+
/**
|
|
2380
|
+
* The effective expiration date of the certificate
|
|
2381
|
+
*
|
|
2382
|
+
* @example "Dec 22 19:39:00 2018 GMT"
|
|
2383
|
+
*/
|
|
2384
|
+
certNotAfter: string;
|
|
2385
|
+
}
|
|
2386
|
+
/** Placeholder values for TLS Client Authorization */
|
|
2387
|
+
declare interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {
|
|
2388
|
+
certPresented: "0";
|
|
2389
|
+
certVerified: "NONE";
|
|
2390
|
+
certRevoked: "0";
|
|
2391
|
+
certIssuerDN: "";
|
|
2392
|
+
certSubjectDN: "";
|
|
2393
|
+
certIssuerDNRFC2253: "";
|
|
2394
|
+
certSubjectDNRFC2253: "";
|
|
2395
|
+
certIssuerDNLegacy: "";
|
|
2396
|
+
certSubjectDNLegacy: "";
|
|
2397
|
+
certSerial: "";
|
|
2398
|
+
certIssuerSerial: "";
|
|
2399
|
+
certSKI: "";
|
|
2400
|
+
certIssuerSKI: "";
|
|
2401
|
+
certFingerprintSHA1: "";
|
|
2402
|
+
certFingerprintSHA256: "";
|
|
2403
|
+
certNotBefore: "";
|
|
2404
|
+
certNotAfter: "";
|
|
2405
|
+
}
|
|
2406
|
+
/** Possible outcomes of TLS verification */
|
|
2407
|
+
declare type CertVerificationStatus =
|
|
2408
|
+
/** Authentication succeeded */
|
|
2409
|
+
| "SUCCESS"
|
|
2410
|
+
/** No certificate was presented */
|
|
2411
|
+
| "NONE"
|
|
2412
|
+
/** Failed because the certificate was self-signed */
|
|
2413
|
+
| "FAILED:self signed certificate"
|
|
2414
|
+
/** Failed because the certificate failed a trust chain check */
|
|
2415
|
+
| "FAILED:unable to verify the first certificate"
|
|
2416
|
+
/** Failed because the certificate not yet valid */
|
|
2417
|
+
| "FAILED:certificate is not yet valid"
|
|
2418
|
+
/** Failed because the certificate is expired */
|
|
2419
|
+
| "FAILED:certificate has expired"
|
|
2420
|
+
/** Failed for another unspecified reason */
|
|
2421
|
+
| "FAILED";
|
|
2422
|
+
/**
|
|
2423
|
+
* An upstream endpoint's response to a TCP `keepalive` message from Cloudflare.
|
|
2424
|
+
*/
|
|
2425
|
+
declare type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus =
|
|
2426
|
+
| 0 /** Unknown */
|
|
2427
|
+
| 1 /** no keepalives (not found) */
|
|
2428
|
+
| 2 /** no connection re-use, opening keepalive connection failed */
|
|
2429
|
+
| 3 /** no connection re-use, keepalive accepted and saved */
|
|
2430
|
+
| 4 /** connection re-use, refused by the origin server (`TCP FIN`) */
|
|
2431
|
+
| 5; /** connection re-use, accepted by the origin server */
|
|
2432
|
+
/** ISO 3166-1 Alpha-2 codes */
|
|
2433
|
+
declare type Iso3166Alpha2Code =
|
|
2434
|
+
| "AD"
|
|
2435
|
+
| "AE"
|
|
2436
|
+
| "AF"
|
|
2437
|
+
| "AG"
|
|
2438
|
+
| "AI"
|
|
2439
|
+
| "AL"
|
|
2440
|
+
| "AM"
|
|
2441
|
+
| "AO"
|
|
2442
|
+
| "AQ"
|
|
2443
|
+
| "AR"
|
|
2444
|
+
| "AS"
|
|
2445
|
+
| "AT"
|
|
2446
|
+
| "AU"
|
|
2447
|
+
| "AW"
|
|
2448
|
+
| "AX"
|
|
2449
|
+
| "AZ"
|
|
2450
|
+
| "BA"
|
|
2451
|
+
| "BB"
|
|
2452
|
+
| "BD"
|
|
2453
|
+
| "BE"
|
|
2454
|
+
| "BF"
|
|
2455
|
+
| "BG"
|
|
2456
|
+
| "BH"
|
|
2457
|
+
| "BI"
|
|
2458
|
+
| "BJ"
|
|
2459
|
+
| "BL"
|
|
2460
|
+
| "BM"
|
|
2461
|
+
| "BN"
|
|
2462
|
+
| "BO"
|
|
2463
|
+
| "BQ"
|
|
2464
|
+
| "BR"
|
|
2465
|
+
| "BS"
|
|
2466
|
+
| "BT"
|
|
2467
|
+
| "BV"
|
|
2468
|
+
| "BW"
|
|
2469
|
+
| "BY"
|
|
2470
|
+
| "BZ"
|
|
2471
|
+
| "CA"
|
|
2472
|
+
| "CC"
|
|
2473
|
+
| "CD"
|
|
2474
|
+
| "CF"
|
|
2475
|
+
| "CG"
|
|
2476
|
+
| "CH"
|
|
2477
|
+
| "CI"
|
|
2478
|
+
| "CK"
|
|
2479
|
+
| "CL"
|
|
2480
|
+
| "CM"
|
|
2481
|
+
| "CN"
|
|
2482
|
+
| "CO"
|
|
2483
|
+
| "CR"
|
|
2484
|
+
| "CU"
|
|
2485
|
+
| "CV"
|
|
2486
|
+
| "CW"
|
|
2487
|
+
| "CX"
|
|
2488
|
+
| "CY"
|
|
2489
|
+
| "CZ"
|
|
2490
|
+
| "DE"
|
|
2491
|
+
| "DJ"
|
|
2492
|
+
| "DK"
|
|
2493
|
+
| "DM"
|
|
2494
|
+
| "DO"
|
|
2495
|
+
| "DZ"
|
|
2496
|
+
| "EC"
|
|
2497
|
+
| "EE"
|
|
2498
|
+
| "EG"
|
|
2499
|
+
| "EH"
|
|
2500
|
+
| "ER"
|
|
2501
|
+
| "ES"
|
|
2502
|
+
| "ET"
|
|
2503
|
+
| "FI"
|
|
2504
|
+
| "FJ"
|
|
2505
|
+
| "FK"
|
|
2506
|
+
| "FM"
|
|
2507
|
+
| "FO"
|
|
2508
|
+
| "FR"
|
|
2509
|
+
| "GA"
|
|
2510
|
+
| "GB"
|
|
2511
|
+
| "GD"
|
|
2512
|
+
| "GE"
|
|
2513
|
+
| "GF"
|
|
2514
|
+
| "GG"
|
|
2515
|
+
| "GH"
|
|
2516
|
+
| "GI"
|
|
2517
|
+
| "GL"
|
|
2518
|
+
| "GM"
|
|
2519
|
+
| "GN"
|
|
2520
|
+
| "GP"
|
|
2521
|
+
| "GQ"
|
|
2522
|
+
| "GR"
|
|
2523
|
+
| "GS"
|
|
2524
|
+
| "GT"
|
|
2525
|
+
| "GU"
|
|
2526
|
+
| "GW"
|
|
2527
|
+
| "GY"
|
|
2528
|
+
| "HK"
|
|
2529
|
+
| "HM"
|
|
2530
|
+
| "HN"
|
|
2531
|
+
| "HR"
|
|
2532
|
+
| "HT"
|
|
2533
|
+
| "HU"
|
|
2534
|
+
| "ID"
|
|
2535
|
+
| "IE"
|
|
2536
|
+
| "IL"
|
|
2537
|
+
| "IM"
|
|
2538
|
+
| "IN"
|
|
2539
|
+
| "IO"
|
|
2540
|
+
| "IQ"
|
|
2541
|
+
| "IR"
|
|
2542
|
+
| "IS"
|
|
2543
|
+
| "IT"
|
|
2544
|
+
| "JE"
|
|
2545
|
+
| "JM"
|
|
2546
|
+
| "JO"
|
|
2547
|
+
| "JP"
|
|
2548
|
+
| "KE"
|
|
2549
|
+
| "KG"
|
|
2550
|
+
| "KH"
|
|
2551
|
+
| "KI"
|
|
2552
|
+
| "KM"
|
|
2553
|
+
| "KN"
|
|
2554
|
+
| "KP"
|
|
2555
|
+
| "KR"
|
|
2556
|
+
| "KW"
|
|
2557
|
+
| "KY"
|
|
2558
|
+
| "KZ"
|
|
2559
|
+
| "LA"
|
|
2560
|
+
| "LB"
|
|
2561
|
+
| "LC"
|
|
2562
|
+
| "LI"
|
|
2563
|
+
| "LK"
|
|
2564
|
+
| "LR"
|
|
2565
|
+
| "LS"
|
|
2566
|
+
| "LT"
|
|
2567
|
+
| "LU"
|
|
2568
|
+
| "LV"
|
|
2569
|
+
| "LY"
|
|
2570
|
+
| "MA"
|
|
2571
|
+
| "MC"
|
|
2572
|
+
| "MD"
|
|
2573
|
+
| "ME"
|
|
2574
|
+
| "MF"
|
|
2575
|
+
| "MG"
|
|
2576
|
+
| "MH"
|
|
2577
|
+
| "MK"
|
|
2578
|
+
| "ML"
|
|
2579
|
+
| "MM"
|
|
2580
|
+
| "MN"
|
|
2581
|
+
| "MO"
|
|
2582
|
+
| "MP"
|
|
2583
|
+
| "MQ"
|
|
2584
|
+
| "MR"
|
|
2585
|
+
| "MS"
|
|
2586
|
+
| "MT"
|
|
2587
|
+
| "MU"
|
|
2588
|
+
| "MV"
|
|
2589
|
+
| "MW"
|
|
2590
|
+
| "MX"
|
|
2591
|
+
| "MY"
|
|
2592
|
+
| "MZ"
|
|
2593
|
+
| "NA"
|
|
2594
|
+
| "NC"
|
|
2595
|
+
| "NE"
|
|
2596
|
+
| "NF"
|
|
2597
|
+
| "NG"
|
|
2598
|
+
| "NI"
|
|
2599
|
+
| "NL"
|
|
2600
|
+
| "NO"
|
|
2601
|
+
| "NP"
|
|
2602
|
+
| "NR"
|
|
2603
|
+
| "NU"
|
|
2604
|
+
| "NZ"
|
|
2605
|
+
| "OM"
|
|
2606
|
+
| "PA"
|
|
2607
|
+
| "PE"
|
|
2608
|
+
| "PF"
|
|
2609
|
+
| "PG"
|
|
2610
|
+
| "PH"
|
|
2611
|
+
| "PK"
|
|
2612
|
+
| "PL"
|
|
2613
|
+
| "PM"
|
|
2614
|
+
| "PN"
|
|
2615
|
+
| "PR"
|
|
2616
|
+
| "PS"
|
|
2617
|
+
| "PT"
|
|
2618
|
+
| "PW"
|
|
2619
|
+
| "PY"
|
|
2620
|
+
| "QA"
|
|
2621
|
+
| "RE"
|
|
2622
|
+
| "RO"
|
|
2623
|
+
| "RS"
|
|
2624
|
+
| "RU"
|
|
2625
|
+
| "RW"
|
|
2626
|
+
| "SA"
|
|
2627
|
+
| "SB"
|
|
2628
|
+
| "SC"
|
|
2629
|
+
| "SD"
|
|
2630
|
+
| "SE"
|
|
2631
|
+
| "SG"
|
|
2632
|
+
| "SH"
|
|
2633
|
+
| "SI"
|
|
2634
|
+
| "SJ"
|
|
2635
|
+
| "SK"
|
|
2636
|
+
| "SL"
|
|
2637
|
+
| "SM"
|
|
2638
|
+
| "SN"
|
|
2639
|
+
| "SO"
|
|
2640
|
+
| "SR"
|
|
2641
|
+
| "SS"
|
|
2642
|
+
| "ST"
|
|
2643
|
+
| "SV"
|
|
2644
|
+
| "SX"
|
|
2645
|
+
| "SY"
|
|
2646
|
+
| "SZ"
|
|
2647
|
+
| "TC"
|
|
2648
|
+
| "TD"
|
|
2649
|
+
| "TF"
|
|
2650
|
+
| "TG"
|
|
2651
|
+
| "TH"
|
|
2652
|
+
| "TJ"
|
|
2653
|
+
| "TK"
|
|
2654
|
+
| "TL"
|
|
2655
|
+
| "TM"
|
|
2656
|
+
| "TN"
|
|
2657
|
+
| "TO"
|
|
2658
|
+
| "TR"
|
|
2659
|
+
| "TT"
|
|
2660
|
+
| "TV"
|
|
2661
|
+
| "TW"
|
|
2662
|
+
| "TZ"
|
|
2663
|
+
| "UA"
|
|
2664
|
+
| "UG"
|
|
2665
|
+
| "UM"
|
|
2666
|
+
| "US"
|
|
2667
|
+
| "UY"
|
|
2668
|
+
| "UZ"
|
|
2669
|
+
| "VA"
|
|
2670
|
+
| "VC"
|
|
2671
|
+
| "VE"
|
|
2672
|
+
| "VG"
|
|
2673
|
+
| "VI"
|
|
2674
|
+
| "VN"
|
|
2675
|
+
| "VU"
|
|
2676
|
+
| "WF"
|
|
2677
|
+
| "WS"
|
|
2678
|
+
| "YE"
|
|
2679
|
+
| "YT"
|
|
2680
|
+
| "ZA"
|
|
2681
|
+
| "ZM"
|
|
2682
|
+
| "ZW";
|
|
2683
|
+
/** The 2-letter continent codes Cloudflare uses */
|
|
2684
|
+
declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2685
|
+
declare interface D1Result<T = unknown> {
|
|
2686
|
+
results?: T[];
|
|
2687
|
+
success: boolean;
|
|
2688
|
+
error?: string;
|
|
2689
|
+
meta: any;
|
|
2690
|
+
}
|
|
2691
|
+
declare abstract class D1Database {
|
|
2692
|
+
prepare(query: string): D1PreparedStatement;
|
|
2693
|
+
dump(): Promise<ArrayBuffer>;
|
|
2694
|
+
batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
|
|
2695
|
+
exec<T = unknown>(query: string): Promise<D1Result<T>>;
|
|
2696
|
+
}
|
|
2697
|
+
declare abstract class D1PreparedStatement {
|
|
2698
|
+
bind(...values: any[]): D1PreparedStatement;
|
|
2699
|
+
first<T = unknown>(colName?: string): Promise<T>;
|
|
2700
|
+
run<T = unknown>(): Promise<D1Result<T>>;
|
|
2701
|
+
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2702
|
+
raw<T = unknown>(): Promise<T[]>;
|
|
2703
|
+
}
|
|
2704
|
+
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2705
|
+
declare type EventContext<Env, P extends string, Data> = {
|
|
2706
|
+
request: Request;
|
|
2707
|
+
functionPath: string;
|
|
2708
|
+
waitUntil: (promise: Promise<any>) => void;
|
|
2709
|
+
passThroughOnException: () => void;
|
|
2710
|
+
next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
|
|
2711
|
+
env: Env & {
|
|
2712
|
+
ASSETS: {
|
|
2713
|
+
fetch: typeof fetch;
|
|
2714
|
+
};
|
|
2715
|
+
};
|
|
2716
|
+
params: Params<P>;
|
|
2717
|
+
data: Data;
|
|
2718
|
+
};
|
|
2719
|
+
declare type PagesFunction<
|
|
2720
|
+
Env = unknown,
|
|
2721
|
+
Params extends string = any,
|
|
2722
|
+
Data extends Record<string, unknown> = Record<string, unknown>
|
|
2723
|
+
> = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
|
|
2724
|
+
declare type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
|
|
2725
|
+
request: Request;
|
|
2726
|
+
functionPath: string;
|
|
2727
|
+
waitUntil: (promise: Promise<any>) => void;
|
|
2728
|
+
passThroughOnException: () => void;
|
|
2729
|
+
next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
|
|
2730
|
+
env: Env & {
|
|
2731
|
+
ASSETS: {
|
|
2732
|
+
fetch: typeof fetch;
|
|
2733
|
+
};
|
|
2734
|
+
};
|
|
2735
|
+
params: Params<P>;
|
|
2736
|
+
data: Data;
|
|
2737
|
+
pluginArgs: PluginArgs;
|
|
2738
|
+
};
|
|
2739
|
+
declare type PagesPluginFunction<
|
|
2740
|
+
Env = unknown,
|
|
2741
|
+
Params extends string = any,
|
|
2742
|
+
Data extends Record<string, unknown> = Record<string, unknown>,
|
|
2743
|
+
PluginArgs = unknown
|
|
2744
|
+
> = (
|
|
2745
|
+
context: EventPluginContext<Env, Params, Data, PluginArgs>
|
|
2746
|
+
) => Response | Promise<Response>;
|
|
2747
|
+
declare module "assets:*" {
|
|
2748
|
+
export const onRequest: PagesFunction;
|
|
2749
|
+
}
|
|
2750
|
+
/**
|
|
2751
|
+
* A message that is sent to a consumer Worker.
|
|
2752
|
+
*/
|
|
2753
|
+
declare interface Message<Body = unknown> {
|
|
2754
|
+
/**
|
|
2755
|
+
* A unique, system-generated ID for the message.
|
|
2756
|
+
*/
|
|
2757
|
+
readonly id: string;
|
|
2758
|
+
/**
|
|
2759
|
+
* A timestamp when the message was sent.
|
|
2760
|
+
*/
|
|
2761
|
+
readonly timestamp: Date;
|
|
2762
|
+
/**
|
|
2763
|
+
* The body of the message.
|
|
2764
|
+
*/
|
|
2765
|
+
readonly body: Body;
|
|
2766
|
+
}
|
|
2767
|
+
/**
|
|
2768
|
+
* A batch of messages that are sent to a consumer Worker.
|
|
2769
|
+
*/
|
|
2770
|
+
declare interface MessageBatch<Body = unknown> {
|
|
2771
|
+
/**
|
|
2772
|
+
* The name of the Queue that belongs to this batch.
|
|
2773
|
+
*/
|
|
2774
|
+
readonly queue: string;
|
|
2775
|
+
/**
|
|
2776
|
+
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2777
|
+
*/
|
|
2778
|
+
readonly messages: readonly Message<Body>[];
|
|
2779
|
+
/**
|
|
2780
|
+
* Marks every message to be retried in the next batch.
|
|
2781
|
+
*/
|
|
2782
|
+
retryAll(): void;
|
|
2783
|
+
}
|
|
2784
|
+
/**
|
|
2785
|
+
* A binding that allows a producer to send messages to a Queue.
|
|
2786
|
+
*/
|
|
2787
|
+
declare interface Queue<Body = any> {
|
|
2788
|
+
/**
|
|
2789
|
+
* Sends a message to the Queue.
|
|
2790
|
+
* @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB.
|
|
2791
|
+
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2792
|
+
*/
|
|
2793
|
+
send(message: Body): Promise<void>;
|
|
2794
|
+
}
|