@cloudflare/workers-types 1.0.8 → 1.20231121.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.
@@ -0,0 +1,3803 @@
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
+ queue: QueueEvent;
53
+ unhandledrejection: PromiseRejectionEvent;
54
+ rejectionhandled: PromiseRejectionEvent;
55
+ };
56
+ declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {
57
+ EventTarget: typeof EventTarget;
58
+ }
59
+ declare interface Console {
60
+ "assert"(condition?: boolean, ...data: any[]): void;
61
+ clear(): void;
62
+ count(label?: string): void;
63
+ countReset(label?: string): void;
64
+ debug(...data: any[]): void;
65
+ dir(item?: any, options?: any): void;
66
+ dirxml(...data: any[]): void;
67
+ error(...data: any[]): void;
68
+ group(...data: any[]): void;
69
+ groupCollapsed(...data: any[]): void;
70
+ groupEnd(): void;
71
+ info(...data: any[]): void;
72
+ log(...data: any[]): void;
73
+ table(tabularData?: any, properties?: string[]): void;
74
+ time(label?: string): void;
75
+ timeEnd(label?: string): void;
76
+ timeLog(label?: string, ...data: any[]): void;
77
+ timeStamp(label?: string): void;
78
+ trace(...data: any[]): void;
79
+ warn(...data: any[]): void;
80
+ }
81
+ declare const console: Console;
82
+ declare type BufferSource = ArrayBufferView | ArrayBuffer;
83
+ declare namespace WebAssembly {
84
+ class CompileError extends Error {
85
+ constructor(message?: string);
86
+ }
87
+ class RuntimeError extends Error {
88
+ constructor(message?: string);
89
+ }
90
+ type ValueType =
91
+ | "anyfunc"
92
+ | "externref"
93
+ | "f32"
94
+ | "f64"
95
+ | "i32"
96
+ | "i64"
97
+ | "v128";
98
+ interface GlobalDescriptor {
99
+ value: ValueType;
100
+ mutable?: boolean;
101
+ }
102
+ class Global {
103
+ constructor(descriptor: GlobalDescriptor, value?: any);
104
+ value: any;
105
+ valueOf(): any;
106
+ }
107
+ type ImportValue = ExportValue | number;
108
+ type ModuleImports = Record<string, ImportValue>;
109
+ type Imports = Record<string, ModuleImports>;
110
+ type ExportValue = Function | Global | Memory | Table;
111
+ type Exports = Record<string, ExportValue>;
112
+ class Instance {
113
+ constructor(module: Module, imports?: Imports);
114
+ readonly exports: Exports;
115
+ }
116
+ interface MemoryDescriptor {
117
+ initial: number;
118
+ maximum?: number;
119
+ shared?: boolean;
120
+ }
121
+ class Memory {
122
+ constructor(descriptor: MemoryDescriptor);
123
+ readonly buffer: ArrayBuffer;
124
+ grow(delta: number): number;
125
+ }
126
+ type ImportExportKind = "function" | "global" | "memory" | "table";
127
+ interface ModuleExportDescriptor {
128
+ kind: ImportExportKind;
129
+ name: string;
130
+ }
131
+ interface ModuleImportDescriptor {
132
+ kind: ImportExportKind;
133
+ module: string;
134
+ name: string;
135
+ }
136
+ abstract class Module {
137
+ static customSections(module: Module, sectionName: string): ArrayBuffer[];
138
+ static exports(module: Module): ModuleExportDescriptor[];
139
+ static imports(module: Module): ModuleImportDescriptor[];
140
+ }
141
+ type TableKind = "anyfunc" | "externref";
142
+ interface TableDescriptor {
143
+ element: TableKind;
144
+ initial: number;
145
+ maximum?: number;
146
+ }
147
+ class Table {
148
+ constructor(descriptor: TableDescriptor, value?: any);
149
+ readonly length: number;
150
+ get(index: number): any;
151
+ grow(delta: number, value?: any): number;
152
+ set(index: number, value?: any): void;
153
+ }
154
+ function instantiate(module: Module, imports?: Imports): Promise<Instance>;
155
+ function validate(bytes: BufferSource): boolean;
156
+ }
157
+ /** This ServiceWorker API interface represents the global execution context of a service worker. */
158
+ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
159
+ DOMException: typeof DOMException;
160
+ WorkerGlobalScope: typeof WorkerGlobalScope;
161
+ btoa(data: string): string;
162
+ atob(data: string): string;
163
+ setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;
164
+ setTimeout<Args extends any[]>(
165
+ callback: (...args: Args) => void,
166
+ msDelay?: number,
167
+ ...args: Args
168
+ ): number;
169
+ clearTimeout(timeoutId: number | null): void;
170
+ setInterval(callback: (...args: any[]) => void, msDelay?: number): number;
171
+ setInterval<Args extends any[]>(
172
+ callback: (...args: Args) => void,
173
+ msDelay?: number,
174
+ ...args: Args
175
+ ): number;
176
+ clearInterval(timeoutId: number | null): void;
177
+ queueMicrotask(task: Function): void;
178
+ structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
179
+ fetch(
180
+ input: RequestInfo,
181
+ init?: RequestInit<RequestInitCfProperties>
182
+ ): Promise<Response>;
183
+ self: ServiceWorkerGlobalScope;
184
+ crypto: Crypto;
185
+ caches: CacheStorage;
186
+ scheduler: Scheduler;
187
+ performance: Performance;
188
+ readonly origin: string;
189
+ Event: typeof Event;
190
+ ExtendableEvent: typeof ExtendableEvent;
191
+ CustomEvent: typeof CustomEvent;
192
+ PromiseRejectionEvent: typeof PromiseRejectionEvent;
193
+ FetchEvent: typeof FetchEvent;
194
+ TailEvent: typeof TailEvent;
195
+ TraceEvent: typeof TailEvent;
196
+ ScheduledEvent: typeof ScheduledEvent;
197
+ MessageEvent: typeof MessageEvent;
198
+ CloseEvent: typeof CloseEvent;
199
+ ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader;
200
+ ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader;
201
+ ReadableStream: typeof ReadableStream;
202
+ WritableStream: typeof WritableStream;
203
+ WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter;
204
+ TransformStream: typeof TransformStream;
205
+ ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;
206
+ CountQueuingStrategy: typeof CountQueuingStrategy;
207
+ CompressionStream: typeof CompressionStream;
208
+ DecompressionStream: typeof DecompressionStream;
209
+ TextEncoderStream: typeof TextEncoderStream;
210
+ TextDecoderStream: typeof TextDecoderStream;
211
+ Headers: typeof Headers;
212
+ Body: typeof Body;
213
+ Request: typeof Request;
214
+ Response: typeof Response;
215
+ WebSocket: typeof WebSocket;
216
+ WebSocketPair: typeof WebSocketPair;
217
+ WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;
218
+ AbortController: typeof AbortController;
219
+ AbortSignal: typeof AbortSignal;
220
+ TextDecoder: typeof TextDecoder;
221
+ TextEncoder: typeof TextEncoder;
222
+ URL: typeof URL;
223
+ URLSearchParams: typeof URLSearchParams;
224
+ URLPattern: typeof URLPattern;
225
+ Blob: typeof Blob;
226
+ File: typeof File;
227
+ FormData: typeof FormData;
228
+ Crypto: typeof Crypto;
229
+ SubtleCrypto: typeof SubtleCrypto;
230
+ CryptoKey: typeof CryptoKey;
231
+ CacheStorage: typeof CacheStorage;
232
+ Cache: typeof Cache;
233
+ FixedLengthStream: typeof FixedLengthStream;
234
+ IdentityTransformStream: typeof IdentityTransformStream;
235
+ HTMLRewriter: typeof HTMLRewriter;
236
+ GPUAdapter: typeof gpuGPUAdapter;
237
+ GPUOutOfMemoryError: typeof gpuGPUOutOfMemoryError;
238
+ GPUValidationError: typeof gpuGPUValidationError;
239
+ GPUInternalError: typeof gpuGPUInternalError;
240
+ GPUDeviceLostInfo: typeof gpuGPUDeviceLostInfo;
241
+ GPUBufferUsage: typeof gpuGPUBufferUsage;
242
+ GPUShaderStage: typeof gpuGPUShaderStage;
243
+ GPUMapMode: typeof gpuGPUMapMode;
244
+ GPUTextureUsage: typeof gpuGPUTextureUsage;
245
+ GPUColorWrite: typeof gpuGPUColorWrite;
246
+ }
247
+ declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
248
+ type: Type,
249
+ handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
250
+ options?: EventTargetAddEventListenerOptions | boolean
251
+ ): void;
252
+ declare function removeEventListener<
253
+ Type extends keyof WorkerGlobalScopeEventMap
254
+ >(
255
+ type: Type,
256
+ handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
257
+ options?: EventTargetEventListenerOptions | boolean
258
+ ): void;
259
+ /** 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. */
260
+ declare function dispatchEvent(
261
+ event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]
262
+ ): boolean;
263
+ declare function btoa(data: string): string;
264
+ declare function atob(data: string): string;
265
+ declare function setTimeout(
266
+ callback: (...args: any[]) => void,
267
+ msDelay?: number
268
+ ): number;
269
+ declare function setTimeout<Args extends any[]>(
270
+ callback: (...args: Args) => void,
271
+ msDelay?: number,
272
+ ...args: Args
273
+ ): number;
274
+ declare function clearTimeout(timeoutId: number | null): void;
275
+ declare function setInterval(
276
+ callback: (...args: any[]) => void,
277
+ msDelay?: number
278
+ ): number;
279
+ declare function setInterval<Args extends any[]>(
280
+ callback: (...args: Args) => void,
281
+ msDelay?: number,
282
+ ...args: Args
283
+ ): number;
284
+ declare function clearInterval(timeoutId: number | null): void;
285
+ declare function queueMicrotask(task: Function): void;
286
+ declare function structuredClone<T>(
287
+ value: T,
288
+ options?: StructuredSerializeOptions
289
+ ): T;
290
+ declare function fetch(
291
+ input: RequestInfo,
292
+ init?: RequestInit<RequestInitCfProperties>
293
+ ): Promise<Response>;
294
+ declare const self: ServiceWorkerGlobalScope;
295
+ declare const crypto: Crypto;
296
+ declare const caches: CacheStorage;
297
+ declare const scheduler: Scheduler;
298
+ declare const performance: Performance;
299
+ declare const origin: string;
300
+ declare interface TestController {}
301
+ declare interface ExecutionContext {
302
+ waitUntil(promise: Promise<any>): void;
303
+ passThroughOnException(): void;
304
+ }
305
+ declare type ExportedHandlerFetchHandler<
306
+ Env = unknown,
307
+ CfHostMetadata = unknown
308
+ > = (
309
+ request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
310
+ env: Env,
311
+ ctx: ExecutionContext
312
+ ) => Response | Promise<Response>;
313
+ declare type ExportedHandlerTailHandler<Env = unknown> = (
314
+ events: TraceItem[],
315
+ env: Env,
316
+ ctx: ExecutionContext
317
+ ) => void | Promise<void>;
318
+ declare type ExportedHandlerTraceHandler<Env = unknown> = (
319
+ traces: TraceItem[],
320
+ env: Env,
321
+ ctx: ExecutionContext
322
+ ) => void | Promise<void>;
323
+ declare type ExportedHandlerScheduledHandler<Env = unknown> = (
324
+ controller: ScheduledController,
325
+ env: Env,
326
+ ctx: ExecutionContext
327
+ ) => void | Promise<void>;
328
+ declare type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
329
+ batch: MessageBatch<Message>,
330
+ env: Env,
331
+ ctx: ExecutionContext
332
+ ) => void | Promise<void>;
333
+ declare type ExportedHandlerTestHandler<Env = unknown> = (
334
+ controller: TestController,
335
+ env: Env,
336
+ ctx: ExecutionContext
337
+ ) => void | Promise<void>;
338
+ declare interface ExportedHandler<
339
+ Env = unknown,
340
+ QueueHandlerMessage = unknown,
341
+ CfHostMetadata = unknown
342
+ > {
343
+ fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
344
+ tail?: ExportedHandlerTailHandler<Env>;
345
+ trace?: ExportedHandlerTraceHandler<Env>;
346
+ scheduled?: ExportedHandlerScheduledHandler<Env>;
347
+ test?: ExportedHandlerTestHandler<Env>;
348
+ email?: EmailExportedHandler<Env>;
349
+ queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
350
+ }
351
+ declare interface StructuredSerializeOptions {
352
+ transfer?: any[];
353
+ }
354
+ declare abstract class PromiseRejectionEvent extends Event {
355
+ readonly promise: Promise<any>;
356
+ readonly reason: any;
357
+ }
358
+ /** Provides access to performance-related information for the current page. It's part of the High Resolution Time API, but is enhanced by the Performance Timeline API, the Navigation Timing API, the User Timing API, and the Resource Timing API. */
359
+ declare interface Performance {
360
+ readonly timeOrigin: number;
361
+ now(): number;
362
+ }
363
+ declare interface DurableObject {
364
+ fetch(request: Request): Response | Promise<Response>;
365
+ alarm?(): void | Promise<void>;
366
+ webSocketMessage?(
367
+ ws: WebSocket,
368
+ message: string | ArrayBuffer
369
+ ): void | Promise<void>;
370
+ webSocketClose?(
371
+ ws: WebSocket,
372
+ code: number,
373
+ reason: string,
374
+ wasClean: boolean
375
+ ): void | Promise<void>;
376
+ webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
377
+ }
378
+ declare interface DurableObjectStub extends Fetcher {
379
+ readonly id: DurableObjectId;
380
+ readonly name?: string;
381
+ }
382
+ declare interface DurableObjectId {
383
+ toString(): string;
384
+ equals(other: DurableObjectId): boolean;
385
+ readonly name?: string;
386
+ }
387
+ declare interface DurableObjectNamespace {
388
+ newUniqueId(
389
+ options?: DurableObjectNamespaceNewUniqueIdOptions
390
+ ): DurableObjectId;
391
+ idFromName(name: string): DurableObjectId;
392
+ idFromString(id: string): DurableObjectId;
393
+ get(
394
+ id: DurableObjectId,
395
+ options?: DurableObjectNamespaceGetDurableObjectOptions
396
+ ): DurableObjectStub;
397
+ jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
398
+ }
399
+ declare type DurableObjectJurisdiction = "eu" | "fedramp";
400
+ declare interface DurableObjectNamespaceNewUniqueIdOptions {
401
+ jurisdiction?: DurableObjectJurisdiction;
402
+ }
403
+ declare type DurableObjectLocationHint =
404
+ | "wnam"
405
+ | "enam"
406
+ | "sam"
407
+ | "weur"
408
+ | "eeur"
409
+ | "apac"
410
+ | "oc"
411
+ | "afr"
412
+ | "me";
413
+ declare interface DurableObjectNamespaceGetDurableObjectOptions {
414
+ locationHint?: DurableObjectLocationHint;
415
+ }
416
+ declare interface DurableObjectState {
417
+ waitUntil(promise: Promise<any>): void;
418
+ readonly id: DurableObjectId;
419
+ readonly storage: DurableObjectStorage;
420
+ blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
421
+ acceptWebSocket(ws: WebSocket, tags?: string[]): void;
422
+ getWebSockets(tag?: string): WebSocket[];
423
+ setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
424
+ getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
425
+ getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
426
+ }
427
+ declare interface DurableObjectTransaction {
428
+ get<T = unknown>(
429
+ key: string,
430
+ options?: DurableObjectGetOptions
431
+ ): Promise<T | undefined>;
432
+ get<T = unknown>(
433
+ keys: string[],
434
+ options?: DurableObjectGetOptions
435
+ ): Promise<Map<string, T>>;
436
+ list<T = unknown>(
437
+ options?: DurableObjectListOptions
438
+ ): Promise<Map<string, T>>;
439
+ put<T>(
440
+ key: string,
441
+ value: T,
442
+ options?: DurableObjectPutOptions
443
+ ): Promise<void>;
444
+ put<T>(
445
+ entries: Record<string, T>,
446
+ options?: DurableObjectPutOptions
447
+ ): Promise<void>;
448
+ delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
449
+ delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
450
+ rollback(): void;
451
+ getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
452
+ setAlarm(
453
+ scheduledTime: number | Date,
454
+ options?: DurableObjectSetAlarmOptions
455
+ ): Promise<void>;
456
+ deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
457
+ }
458
+ declare interface DurableObjectStorage {
459
+ get<T = unknown>(
460
+ key: string,
461
+ options?: DurableObjectGetOptions
462
+ ): Promise<T | undefined>;
463
+ get<T = unknown>(
464
+ keys: string[],
465
+ options?: DurableObjectGetOptions
466
+ ): Promise<Map<string, T>>;
467
+ list<T = unknown>(
468
+ options?: DurableObjectListOptions
469
+ ): Promise<Map<string, T>>;
470
+ put<T>(
471
+ key: string,
472
+ value: T,
473
+ options?: DurableObjectPutOptions
474
+ ): Promise<void>;
475
+ put<T>(
476
+ entries: Record<string, T>,
477
+ options?: DurableObjectPutOptions
478
+ ): Promise<void>;
479
+ delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
480
+ delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
481
+ deleteAll(options?: DurableObjectPutOptions): Promise<void>;
482
+ transaction<T>(
483
+ closure: (txn: DurableObjectTransaction) => Promise<T>
484
+ ): Promise<T>;
485
+ getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
486
+ setAlarm(
487
+ scheduledTime: number | Date,
488
+ options?: DurableObjectSetAlarmOptions
489
+ ): Promise<void>;
490
+ deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
491
+ sync(): Promise<void>;
492
+ transactionSync<T>(closure: () => T): T;
493
+ }
494
+ declare interface DurableObjectListOptions {
495
+ start?: string;
496
+ startAfter?: string;
497
+ end?: string;
498
+ prefix?: string;
499
+ reverse?: boolean;
500
+ limit?: number;
501
+ allowConcurrency?: boolean;
502
+ noCache?: boolean;
503
+ }
504
+ declare interface DurableObjectGetOptions {
505
+ allowConcurrency?: boolean;
506
+ noCache?: boolean;
507
+ }
508
+ declare interface DurableObjectGetAlarmOptions {
509
+ allowConcurrency?: boolean;
510
+ }
511
+ declare interface DurableObjectPutOptions {
512
+ allowConcurrency?: boolean;
513
+ allowUnconfirmed?: boolean;
514
+ noCache?: boolean;
515
+ }
516
+ declare interface DurableObjectSetAlarmOptions {
517
+ allowConcurrency?: boolean;
518
+ allowUnconfirmed?: boolean;
519
+ }
520
+ declare class WebSocketRequestResponsePair {
521
+ constructor(request: string, response: string);
522
+ get request(): string;
523
+ get response(): string;
524
+ }
525
+ declare interface AnalyticsEngineDataset {
526
+ writeDataPoint(event?: AnalyticsEngineDataPoint): void;
527
+ }
528
+ declare interface AnalyticsEngineDataPoint {
529
+ indexes?: ((ArrayBuffer | string) | null)[];
530
+ doubles?: number[];
531
+ blobs?: ((ArrayBuffer | string) | null)[];
532
+ }
533
+ declare class Event {
534
+ constructor(type: string, init?: EventInit);
535
+ /** Returns the type of event, e.g. "click", "hashchange", or "submit". */
536
+ readonly type: string;
537
+ /** Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. */
538
+ readonly eventPhase: number;
539
+ /** 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. */
540
+ readonly composed: boolean;
541
+ /** 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. */
542
+ readonly bubbles: boolean;
543
+ /** 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. */
544
+ readonly cancelable: boolean;
545
+ /** Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. */
546
+ readonly defaultPrevented: boolean;
547
+ /** @deprecated */
548
+ readonly returnValue: boolean;
549
+ /** Returns the object whose event listener's callback is currently being invoked. */
550
+ readonly currentTarget?: EventTarget;
551
+ /** @deprecated */
552
+ readonly srcElement?: EventTarget;
553
+ /** Returns the event's timestamp as the number of milliseconds measured relative to the time origin. */
554
+ readonly timeStamp: number;
555
+ /** Returns true if event was dispatched by the user agent, and false otherwise. */
556
+ readonly isTrusted: boolean;
557
+ cancelBubble: boolean;
558
+ stopImmediatePropagation(): void;
559
+ preventDefault(): void;
560
+ stopPropagation(): void;
561
+ composedPath(): EventTarget[];
562
+ static readonly NONE: number;
563
+ static readonly CAPTURING_PHASE: number;
564
+ static readonly AT_TARGET: number;
565
+ static readonly BUBBLING_PHASE: number;
566
+ }
567
+ declare interface EventInit {
568
+ bubbles?: boolean;
569
+ cancelable?: boolean;
570
+ composed?: boolean;
571
+ }
572
+ declare type EventListener<EventType extends Event = Event> = (
573
+ event: EventType
574
+ ) => void;
575
+ declare interface EventListenerObject<EventType extends Event = Event> {
576
+ handleEvent(event: EventType): void;
577
+ }
578
+ declare type EventListenerOrEventListenerObject<
579
+ EventType extends Event = Event
580
+ > = EventListener<EventType> | EventListenerObject<EventType>;
581
+ declare class EventTarget<
582
+ EventMap extends Record<string, Event> = Record<string, Event>
583
+ > {
584
+ constructor();
585
+ addEventListener<Type extends keyof EventMap>(
586
+ type: Type,
587
+ handler: EventListenerOrEventListenerObject<EventMap[Type]>,
588
+ options?: EventTargetAddEventListenerOptions | boolean
589
+ ): void;
590
+ removeEventListener<Type extends keyof EventMap>(
591
+ type: Type,
592
+ handler: EventListenerOrEventListenerObject<EventMap[Type]>,
593
+ options?: EventTargetEventListenerOptions | boolean
594
+ ): void;
595
+ dispatchEvent(event: EventMap[keyof EventMap]): boolean;
596
+ }
597
+ declare interface EventTargetEventListenerOptions {
598
+ capture?: boolean;
599
+ }
600
+ declare interface EventTargetAddEventListenerOptions {
601
+ capture?: boolean;
602
+ passive?: boolean;
603
+ once?: boolean;
604
+ signal?: AbortSignal;
605
+ }
606
+ declare interface EventTargetHandlerObject {
607
+ handleEvent: (event: Event) => any | undefined;
608
+ }
609
+ declare class AbortController {
610
+ constructor();
611
+ /** Returns the AbortSignal object associated with this object. */
612
+ readonly signal: AbortSignal;
613
+ abort(reason?: any): void;
614
+ }
615
+ declare abstract class AbortSignal extends EventTarget {
616
+ static abort(reason?: any): AbortSignal;
617
+ static timeout(delay: number): AbortSignal;
618
+ static any(signals: AbortSignal[]): AbortSignal;
619
+ /** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */
620
+ readonly aborted: boolean;
621
+ readonly reason: any;
622
+ throwIfAborted(): void;
623
+ }
624
+ declare interface Scheduler {
625
+ wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise<void>;
626
+ }
627
+ declare interface SchedulerWaitOptions {
628
+ signal?: AbortSignal;
629
+ }
630
+ declare abstract class ExtendableEvent extends Event {
631
+ waitUntil(promise: Promise<any>): void;
632
+ }
633
+ declare class CustomEvent extends Event {
634
+ constructor(type: string, init?: CustomEventCustomEventInit);
635
+ get detail(): any | undefined;
636
+ }
637
+ declare interface CustomEventCustomEventInit {
638
+ bubbles?: boolean;
639
+ cancelable?: boolean;
640
+ composed?: boolean;
641
+ detail?: any;
642
+ }
643
+ declare class Blob {
644
+ constructor(
645
+ bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[],
646
+ options?: BlobOptions
647
+ );
648
+ readonly size: number;
649
+ readonly type: string;
650
+ slice(start?: number, end?: number, type?: string): Blob;
651
+ arrayBuffer(): Promise<ArrayBuffer>;
652
+ text(): Promise<string>;
653
+ stream(): ReadableStream;
654
+ }
655
+ declare interface BlobOptions {
656
+ type?: string;
657
+ }
658
+ declare class File extends Blob {
659
+ constructor(
660
+ bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined,
661
+ name: string,
662
+ options?: FileOptions
663
+ );
664
+ readonly name: string;
665
+ readonly lastModified: number;
666
+ }
667
+ declare interface FileOptions {
668
+ type?: string;
669
+ lastModified?: number;
670
+ }
671
+ declare abstract class CacheStorage {
672
+ open(cacheName: string): Promise<Cache>;
673
+ readonly default: Cache;
674
+ }
675
+ declare abstract class Cache {
676
+ delete(request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>;
677
+ match(
678
+ request: RequestInfo,
679
+ options?: CacheQueryOptions
680
+ ): Promise<Response | undefined>;
681
+ put(request: RequestInfo, response: Response): Promise<void>;
682
+ }
683
+ declare interface CacheQueryOptions {
684
+ ignoreMethod?: boolean;
685
+ }
686
+ declare abstract class Crypto {
687
+ /** Available only in secure contexts. */
688
+ readonly subtle: SubtleCrypto;
689
+ getRandomValues<
690
+ T extends
691
+ | Int8Array
692
+ | Uint8Array
693
+ | Int16Array
694
+ | Uint16Array
695
+ | Int32Array
696
+ | Uint32Array
697
+ | BigInt64Array
698
+ | BigUint64Array
699
+ >(buffer: T): T;
700
+ randomUUID(): string;
701
+ DigestStream: typeof DigestStream;
702
+ }
703
+ declare abstract class SubtleCrypto {
704
+ encrypt(
705
+ algorithm: string | SubtleCryptoEncryptAlgorithm,
706
+ key: CryptoKey,
707
+ plainText: ArrayBuffer | ArrayBufferView
708
+ ): Promise<ArrayBuffer>;
709
+ decrypt(
710
+ algorithm: string | SubtleCryptoEncryptAlgorithm,
711
+ key: CryptoKey,
712
+ cipherText: ArrayBuffer | ArrayBufferView
713
+ ): Promise<ArrayBuffer>;
714
+ sign(
715
+ algorithm: string | SubtleCryptoSignAlgorithm,
716
+ key: CryptoKey,
717
+ data: ArrayBuffer | ArrayBufferView
718
+ ): Promise<ArrayBuffer>;
719
+ verify(
720
+ algorithm: string | SubtleCryptoSignAlgorithm,
721
+ key: CryptoKey,
722
+ signature: ArrayBuffer | ArrayBufferView,
723
+ data: ArrayBuffer | ArrayBufferView
724
+ ): Promise<boolean>;
725
+ digest(
726
+ algorithm: string | SubtleCryptoHashAlgorithm,
727
+ data: ArrayBuffer | ArrayBufferView
728
+ ): Promise<ArrayBuffer>;
729
+ generateKey(
730
+ algorithm: string | SubtleCryptoGenerateKeyAlgorithm,
731
+ extractable: boolean,
732
+ keyUsages: string[]
733
+ ): Promise<CryptoKey | CryptoKeyPair>;
734
+ deriveKey(
735
+ algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
736
+ baseKey: CryptoKey,
737
+ derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
738
+ extractable: boolean,
739
+ keyUsages: string[]
740
+ ): Promise<CryptoKey>;
741
+ deriveBits(
742
+ algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
743
+ baseKey: CryptoKey,
744
+ length: number | null
745
+ ): Promise<ArrayBuffer>;
746
+ importKey(
747
+ format: string,
748
+ keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey,
749
+ algorithm: string | SubtleCryptoImportKeyAlgorithm,
750
+ extractable: boolean,
751
+ keyUsages: string[]
752
+ ): Promise<CryptoKey>;
753
+ exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
754
+ wrapKey(
755
+ format: string,
756
+ key: CryptoKey,
757
+ wrappingKey: CryptoKey,
758
+ wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm
759
+ ): Promise<ArrayBuffer>;
760
+ unwrapKey(
761
+ format: string,
762
+ wrappedKey: ArrayBuffer | ArrayBufferView,
763
+ unwrappingKey: CryptoKey,
764
+ unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
765
+ unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
766
+ extractable: boolean,
767
+ keyUsages: string[]
768
+ ): Promise<CryptoKey>;
769
+ timingSafeEqual(
770
+ a: ArrayBuffer | ArrayBufferView,
771
+ b: ArrayBuffer | ArrayBufferView
772
+ ): boolean;
773
+ }
774
+ declare abstract class CryptoKey {
775
+ readonly type: string;
776
+ readonly extractable: boolean;
777
+ readonly algorithm:
778
+ | CryptoKeyKeyAlgorithm
779
+ | CryptoKeyAesKeyAlgorithm
780
+ | CryptoKeyHmacKeyAlgorithm
781
+ | CryptoKeyRsaKeyAlgorithm
782
+ | CryptoKeyEllipticKeyAlgorithm
783
+ | CryptoKeyArbitraryKeyAlgorithm;
784
+ readonly usages: string[];
785
+ }
786
+ declare interface CryptoKeyPair {
787
+ publicKey: CryptoKey;
788
+ privateKey: CryptoKey;
789
+ }
790
+ declare interface JsonWebKey {
791
+ kty: string;
792
+ use?: string;
793
+ key_ops?: string[];
794
+ alg?: string;
795
+ ext?: boolean;
796
+ crv?: string;
797
+ x?: string;
798
+ y?: string;
799
+ d?: string;
800
+ n?: string;
801
+ e?: string;
802
+ p?: string;
803
+ q?: string;
804
+ dp?: string;
805
+ dq?: string;
806
+ qi?: string;
807
+ oth?: RsaOtherPrimesInfo[];
808
+ k?: string;
809
+ }
810
+ declare interface RsaOtherPrimesInfo {
811
+ r?: string;
812
+ d?: string;
813
+ t?: string;
814
+ }
815
+ declare interface SubtleCryptoDeriveKeyAlgorithm {
816
+ name: string;
817
+ salt?: ArrayBuffer;
818
+ iterations?: number;
819
+ hash?: string | SubtleCryptoHashAlgorithm;
820
+ $public?: CryptoKey;
821
+ info?: ArrayBuffer;
822
+ }
823
+ declare interface SubtleCryptoEncryptAlgorithm {
824
+ name: string;
825
+ iv?: ArrayBuffer;
826
+ additionalData?: ArrayBuffer;
827
+ tagLength?: number;
828
+ counter?: ArrayBuffer;
829
+ length?: number;
830
+ label?: ArrayBuffer;
831
+ }
832
+ declare interface SubtleCryptoGenerateKeyAlgorithm {
833
+ name: string;
834
+ hash?: string | SubtleCryptoHashAlgorithm;
835
+ modulusLength?: number;
836
+ publicExponent?: ArrayBuffer;
837
+ length?: number;
838
+ namedCurve?: string;
839
+ }
840
+ declare interface SubtleCryptoHashAlgorithm {
841
+ name: string;
842
+ }
843
+ declare interface SubtleCryptoImportKeyAlgorithm {
844
+ name: string;
845
+ hash?: string | SubtleCryptoHashAlgorithm;
846
+ length?: number;
847
+ namedCurve?: string;
848
+ compressed?: boolean;
849
+ }
850
+ declare interface SubtleCryptoSignAlgorithm {
851
+ name: string;
852
+ hash?: string | SubtleCryptoHashAlgorithm;
853
+ dataLength?: number;
854
+ saltLength?: number;
855
+ }
856
+ declare interface CryptoKeyKeyAlgorithm {
857
+ name: string;
858
+ }
859
+ declare interface CryptoKeyAesKeyAlgorithm {
860
+ name: string;
861
+ length: number;
862
+ }
863
+ declare interface CryptoKeyHmacKeyAlgorithm {
864
+ name: string;
865
+ hash: CryptoKeyKeyAlgorithm;
866
+ length: number;
867
+ }
868
+ declare interface CryptoKeyRsaKeyAlgorithm {
869
+ name: string;
870
+ modulusLength: number;
871
+ publicExponent: ArrayBuffer | (ArrayBuffer | ArrayBufferView);
872
+ hash?: CryptoKeyKeyAlgorithm;
873
+ }
874
+ declare interface CryptoKeyEllipticKeyAlgorithm {
875
+ name: string;
876
+ namedCurve: string;
877
+ }
878
+ declare interface CryptoKeyArbitraryKeyAlgorithm {
879
+ name: string;
880
+ hash?: CryptoKeyKeyAlgorithm;
881
+ namedCurve?: string;
882
+ length?: number;
883
+ }
884
+ declare class DigestStream extends WritableStream<
885
+ ArrayBuffer | ArrayBufferView
886
+ > {
887
+ constructor(algorithm: string | SubtleCryptoHashAlgorithm);
888
+ readonly digest: Promise<ArrayBuffer>;
889
+ }
890
+ declare class TextDecoder {
891
+ constructor(decoder?: string, options?: TextDecoderConstructorOptions);
892
+ decode(
893
+ input?: ArrayBuffer | ArrayBufferView,
894
+ options?: TextDecoderDecodeOptions
895
+ ): string;
896
+ readonly encoding: string;
897
+ readonly fatal: boolean;
898
+ readonly ignoreBOM: boolean;
899
+ }
900
+ declare class TextEncoder {
901
+ constructor();
902
+ encode(input?: string): Uint8Array;
903
+ encodeInto(
904
+ input: string,
905
+ buffer: ArrayBuffer | ArrayBufferView
906
+ ): TextEncoderEncodeIntoResult;
907
+ readonly encoding: string;
908
+ }
909
+ declare interface TextDecoderConstructorOptions {
910
+ fatal: boolean;
911
+ ignoreBOM: boolean;
912
+ }
913
+ declare interface TextDecoderDecodeOptions {
914
+ stream: boolean;
915
+ }
916
+ declare interface TextEncoderEncodeIntoResult {
917
+ read: number;
918
+ written: number;
919
+ }
920
+ declare class FormData {
921
+ constructor();
922
+ append(name: string, value: string): void;
923
+ append(name: string, value: Blob, filename?: string): void;
924
+ delete(name: string): void;
925
+ get(name: string): (File | string) | null;
926
+ getAll(name: string): (File | string)[];
927
+ has(name: string): boolean;
928
+ set(name: string, value: string): void;
929
+ set(name: string, value: Blob, filename?: string): void;
930
+ entries(): IterableIterator<[key: string, value: File | string]>;
931
+ keys(): IterableIterator<string>;
932
+ values(): IterableIterator<File | string>;
933
+ forEach<This = unknown>(
934
+ callback: (
935
+ this: This,
936
+ value: File | string,
937
+ key: string,
938
+ parent: FormData
939
+ ) => void,
940
+ thisArg?: This
941
+ ): void;
942
+ [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>;
943
+ }
944
+ declare interface ContentOptions {
945
+ html?: boolean;
946
+ }
947
+ declare class HTMLRewriter {
948
+ constructor();
949
+ on(
950
+ selector: string,
951
+ handlers: HTMLRewriterElementContentHandlers
952
+ ): HTMLRewriter;
953
+ onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;
954
+ transform(response: Response): Response;
955
+ }
956
+ declare interface HTMLRewriterElementContentHandlers {
957
+ element?(element: Element): void | Promise<void>;
958
+ comments?(comment: Comment): void | Promise<void>;
959
+ text?(element: Text): void | Promise<void>;
960
+ }
961
+ declare interface HTMLRewriterDocumentContentHandlers {
962
+ doctype?(doctype: Doctype): void | Promise<void>;
963
+ comments?(comment: Comment): void | Promise<void>;
964
+ text?(text: Text): void | Promise<void>;
965
+ end?(end: DocumentEnd): void | Promise<void>;
966
+ }
967
+ declare interface Doctype {
968
+ readonly name: string | null;
969
+ readonly publicId: string | null;
970
+ readonly systemId: string | null;
971
+ }
972
+ declare interface Element {
973
+ tagName: string;
974
+ readonly attributes: IterableIterator<string[]>;
975
+ readonly removed: boolean;
976
+ readonly namespaceURI: string;
977
+ getAttribute(name: string): string | null;
978
+ hasAttribute(name: string): boolean;
979
+ setAttribute(name: string, value: string): Element;
980
+ removeAttribute(name: string): Element;
981
+ before(content: string, options?: ContentOptions): Element;
982
+ after(content: string, options?: ContentOptions): Element;
983
+ prepend(content: string, options?: ContentOptions): Element;
984
+ append(content: string, options?: ContentOptions): Element;
985
+ replace(content: string, options?: ContentOptions): Element;
986
+ remove(): Element;
987
+ removeAndKeepContent(): Element;
988
+ setInnerContent(content: string, options?: ContentOptions): Element;
989
+ onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;
990
+ }
991
+ declare interface EndTag {
992
+ name: string;
993
+ before(content: string, options?: ContentOptions): EndTag;
994
+ after(content: string, options?: ContentOptions): EndTag;
995
+ remove(): EndTag;
996
+ }
997
+ declare interface Comment {
998
+ text: string;
999
+ readonly removed: boolean;
1000
+ before(content: string, options?: ContentOptions): Comment;
1001
+ after(content: string, options?: ContentOptions): Comment;
1002
+ replace(content: string, options?: ContentOptions): Comment;
1003
+ remove(): Comment;
1004
+ }
1005
+ declare interface Text {
1006
+ readonly text: string;
1007
+ readonly lastInTextNode: boolean;
1008
+ readonly removed: boolean;
1009
+ before(content: string, options?: ContentOptions): Text;
1010
+ after(content: string, options?: ContentOptions): Text;
1011
+ replace(content: string, options?: ContentOptions): Text;
1012
+ remove(): Text;
1013
+ }
1014
+ declare interface DocumentEnd {
1015
+ append(content: string, options?: ContentOptions): DocumentEnd;
1016
+ }
1017
+ declare abstract class FetchEvent extends ExtendableEvent {
1018
+ readonly request: Request;
1019
+ respondWith(promise: Response | Promise<Response>): void;
1020
+ passThroughOnException(): void;
1021
+ }
1022
+ declare type HeadersInit =
1023
+ | Headers
1024
+ | Iterable<Iterable<string>>
1025
+ | Record<string, string>;
1026
+ declare class Headers {
1027
+ constructor(init?: HeadersInit);
1028
+ get(name: string): string | null;
1029
+ getAll(name: string): string[];
1030
+ has(name: string): boolean;
1031
+ set(name: string, value: string): void;
1032
+ append(name: string, value: string): void;
1033
+ delete(name: string): void;
1034
+ forEach<This = unknown>(
1035
+ callback: (this: This, value: string, key: string, parent: Headers) => void,
1036
+ thisArg?: This
1037
+ ): void;
1038
+ entries(): IterableIterator<[key: string, value: string]>;
1039
+ keys(): IterableIterator<string>;
1040
+ values(): IterableIterator<string>;
1041
+ [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
1042
+ }
1043
+ declare type BodyInit =
1044
+ | ReadableStream<Uint8Array>
1045
+ | string
1046
+ | ArrayBuffer
1047
+ | ArrayBufferView
1048
+ | Blob
1049
+ | URLSearchParams
1050
+ | FormData;
1051
+ declare abstract class Body {
1052
+ readonly body: ReadableStream | null;
1053
+ readonly bodyUsed: boolean;
1054
+ arrayBuffer(): Promise<ArrayBuffer>;
1055
+ text(): Promise<string>;
1056
+ json<T>(): Promise<T>;
1057
+ formData(): Promise<FormData>;
1058
+ blob(): Promise<Blob>;
1059
+ }
1060
+ declare class Response extends Body {
1061
+ constructor(body?: BodyInit | null, init?: ResponseInit);
1062
+ static redirect(url: string, status?: number): Response;
1063
+ static json(any: any, maybeInit?: ResponseInit | Response): Response;
1064
+ clone(): Response;
1065
+ readonly status: number;
1066
+ readonly statusText: string;
1067
+ readonly headers: Headers;
1068
+ readonly ok: boolean;
1069
+ readonly redirected: boolean;
1070
+ readonly url: string;
1071
+ readonly webSocket: WebSocket | null;
1072
+ readonly cf?: any;
1073
+ }
1074
+ declare interface ResponseInit {
1075
+ status?: number;
1076
+ statusText?: string;
1077
+ headers?: HeadersInit;
1078
+ cf?: any;
1079
+ webSocket?: WebSocket | null;
1080
+ encodeBody?: "automatic" | "manual";
1081
+ }
1082
+ declare type RequestInfo<
1083
+ CfHostMetadata = unknown,
1084
+ Cf = CfProperties<CfHostMetadata>
1085
+ > = Request<CfHostMetadata, Cf> | string | URL;
1086
+ declare class Request<
1087
+ CfHostMetadata = unknown,
1088
+ Cf = CfProperties<CfHostMetadata>
1089
+ > extends Body {
1090
+ constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
1091
+ clone(): Request<CfHostMetadata, Cf>;
1092
+ /** Returns request's HTTP method, which is "GET" by default. */
1093
+ readonly method: string;
1094
+ /** Returns the URL of request as a string. */
1095
+ readonly url: string;
1096
+ /** 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. */
1097
+ readonly headers: Headers;
1098
+ /** 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. */
1099
+ readonly redirect: string;
1100
+ readonly fetcher: Fetcher | null;
1101
+ /** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. */
1102
+ readonly signal: AbortSignal;
1103
+ readonly cf?: Cf;
1104
+ /** Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI] */
1105
+ readonly integrity: string;
1106
+ /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
1107
+ readonly keepalive: boolean;
1108
+ }
1109
+ declare interface RequestInit<Cf = CfProperties> {
1110
+ /** A string to set request's method. */
1111
+ method?: string;
1112
+ /** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
1113
+ headers?: HeadersInit;
1114
+ /** A BodyInit object or null to set request's body. */
1115
+ body?: BodyInit | null;
1116
+ /** 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. */
1117
+ redirect?: string;
1118
+ fetcher?: Fetcher | null;
1119
+ cf?: Cf;
1120
+ /** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1121
+ integrity?: string;
1122
+ /** An AbortSignal to set request's signal. */
1123
+ signal?: AbortSignal | null;
1124
+ }
1125
+ declare abstract class Fetcher {
1126
+ fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1127
+ connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1128
+ }
1129
+ declare interface FetcherPutOptions {
1130
+ expiration?: number;
1131
+ expirationTtl?: number;
1132
+ }
1133
+ declare interface KVNamespaceListKey<Metadata, Key extends string = string> {
1134
+ name: Key;
1135
+ expiration?: number;
1136
+ metadata?: Metadata;
1137
+ }
1138
+ declare type KVNamespaceListResult<Metadata, Key extends string = string> =
1139
+ | {
1140
+ list_complete: false;
1141
+ keys: KVNamespaceListKey<Metadata, Key>[];
1142
+ cursor: string;
1143
+ cacheStatus: string | null;
1144
+ }
1145
+ | {
1146
+ list_complete: true;
1147
+ keys: KVNamespaceListKey<Metadata, Key>[];
1148
+ cacheStatus: string | null;
1149
+ };
1150
+ declare interface KVNamespace<Key extends string = string> {
1151
+ get(
1152
+ key: Key,
1153
+ options?: Partial<KVNamespaceGetOptions<undefined>>
1154
+ ): Promise<string | null>;
1155
+ get(key: Key, type: "text"): Promise<string | null>;
1156
+ get<ExpectedValue = unknown>(
1157
+ key: Key,
1158
+ type: "json"
1159
+ ): Promise<ExpectedValue | null>;
1160
+ get(key: Key, type: "arrayBuffer"): Promise<ArrayBuffer | null>;
1161
+ get(key: Key, type: "stream"): Promise<ReadableStream | null>;
1162
+ get(
1163
+ key: Key,
1164
+ options?: KVNamespaceGetOptions<"text">
1165
+ ): Promise<string | null>;
1166
+ get<ExpectedValue = unknown>(
1167
+ key: Key,
1168
+ options?: KVNamespaceGetOptions<"json">
1169
+ ): Promise<ExpectedValue | null>;
1170
+ get(
1171
+ key: Key,
1172
+ options?: KVNamespaceGetOptions<"arrayBuffer">
1173
+ ): Promise<ArrayBuffer | null>;
1174
+ get(
1175
+ key: Key,
1176
+ options?: KVNamespaceGetOptions<"stream">
1177
+ ): Promise<ReadableStream | null>;
1178
+ list<Metadata = unknown>(
1179
+ options?: KVNamespaceListOptions
1180
+ ): Promise<KVNamespaceListResult<Metadata, Key>>;
1181
+ put(
1182
+ key: Key,
1183
+ value: string | ArrayBuffer | ArrayBufferView | ReadableStream,
1184
+ options?: KVNamespacePutOptions
1185
+ ): Promise<void>;
1186
+ getWithMetadata<Metadata = unknown>(
1187
+ key: Key,
1188
+ options?: Partial<KVNamespaceGetOptions<undefined>>
1189
+ ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1190
+ getWithMetadata<Metadata = unknown>(
1191
+ key: Key,
1192
+ type: "text"
1193
+ ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1194
+ getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
1195
+ key: Key,
1196
+ type: "json"
1197
+ ): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
1198
+ getWithMetadata<Metadata = unknown>(
1199
+ key: Key,
1200
+ type: "arrayBuffer"
1201
+ ): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
1202
+ getWithMetadata<Metadata = unknown>(
1203
+ key: Key,
1204
+ type: "stream"
1205
+ ): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
1206
+ getWithMetadata<Metadata = unknown>(
1207
+ key: Key,
1208
+ options: KVNamespaceGetOptions<"text">
1209
+ ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1210
+ getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
1211
+ key: Key,
1212
+ options: KVNamespaceGetOptions<"json">
1213
+ ): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
1214
+ getWithMetadata<Metadata = unknown>(
1215
+ key: Key,
1216
+ options: KVNamespaceGetOptions<"arrayBuffer">
1217
+ ): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
1218
+ getWithMetadata<Metadata = unknown>(
1219
+ key: Key,
1220
+ options: KVNamespaceGetOptions<"stream">
1221
+ ): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
1222
+ delete(key: Key): Promise<void>;
1223
+ }
1224
+ declare interface KVNamespaceListOptions {
1225
+ limit?: number;
1226
+ prefix?: string | null;
1227
+ cursor?: string | null;
1228
+ }
1229
+ declare interface KVNamespaceGetOptions<Type> {
1230
+ type: Type;
1231
+ cacheTtl?: number;
1232
+ }
1233
+ declare interface KVNamespacePutOptions {
1234
+ expiration?: number;
1235
+ expirationTtl?: number;
1236
+ metadata?: any | null;
1237
+ }
1238
+ declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
1239
+ value: Value | null;
1240
+ metadata: Metadata | null;
1241
+ cacheStatus: string | null;
1242
+ }
1243
+ declare type QueueContentType = "text" | "bytes" | "json" | "v8";
1244
+ declare interface Queue<Body = unknown> {
1245
+ send(message: Body, options?: QueueSendOptions): Promise<void>;
1246
+ sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
1247
+ }
1248
+ declare interface QueueSendOptions {
1249
+ contentType?: QueueContentType;
1250
+ }
1251
+ declare interface MessageSendRequest<Body = unknown> {
1252
+ body: Body;
1253
+ contentType?: QueueContentType;
1254
+ }
1255
+ declare interface Message<Body = unknown> {
1256
+ readonly id: string;
1257
+ readonly timestamp: Date;
1258
+ readonly body: Body;
1259
+ retry(): void;
1260
+ ack(): void;
1261
+ }
1262
+ declare interface QueueEvent<Body = unknown> extends ExtendableEvent {
1263
+ readonly messages: readonly Message<Body>[];
1264
+ readonly queue: string;
1265
+ retryAll(): void;
1266
+ ackAll(): void;
1267
+ }
1268
+ declare interface MessageBatch<Body = unknown> {
1269
+ readonly messages: readonly Message<Body>[];
1270
+ readonly queue: string;
1271
+ retryAll(): void;
1272
+ ackAll(): void;
1273
+ }
1274
+ declare interface R2Error extends Error {
1275
+ readonly name: string;
1276
+ readonly code: number;
1277
+ readonly message: string;
1278
+ readonly action: string;
1279
+ readonly stack: any;
1280
+ }
1281
+ declare interface R2ListOptions {
1282
+ limit?: number;
1283
+ prefix?: string;
1284
+ cursor?: string;
1285
+ delimiter?: string;
1286
+ startAfter?: string;
1287
+ }
1288
+ declare abstract class R2Bucket {
1289
+ head(key: string): Promise<R2Object | null>;
1290
+ get(
1291
+ key: string,
1292
+ options: R2GetOptions & {
1293
+ onlyIf: R2Conditional | Headers;
1294
+ }
1295
+ ): Promise<R2ObjectBody | R2Object | null>;
1296
+ get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;
1297
+ put(
1298
+ key: string,
1299
+ value:
1300
+ | ReadableStream
1301
+ | ArrayBuffer
1302
+ | ArrayBufferView
1303
+ | string
1304
+ | null
1305
+ | Blob,
1306
+ options?: R2PutOptions & {
1307
+ onlyIf: R2Conditional | Headers;
1308
+ }
1309
+ ): Promise<R2Object | null>;
1310
+ put(
1311
+ key: string,
1312
+ value:
1313
+ | ReadableStream
1314
+ | ArrayBuffer
1315
+ | ArrayBufferView
1316
+ | string
1317
+ | null
1318
+ | Blob,
1319
+ options?: R2PutOptions
1320
+ ): Promise<R2Object>;
1321
+ createMultipartUpload(
1322
+ key: string,
1323
+ options?: R2MultipartOptions
1324
+ ): Promise<R2MultipartUpload>;
1325
+ resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;
1326
+ delete(keys: string | string[]): Promise<void>;
1327
+ list(options?: R2ListOptions): Promise<R2Objects>;
1328
+ }
1329
+ declare interface R2MultipartUpload {
1330
+ readonly key: string;
1331
+ readonly uploadId: string;
1332
+ uploadPart(
1333
+ partNumber: number,
1334
+ value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob
1335
+ ): Promise<R2UploadedPart>;
1336
+ abort(): Promise<void>;
1337
+ complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
1338
+ }
1339
+ declare interface R2UploadedPart {
1340
+ partNumber: number;
1341
+ etag: string;
1342
+ }
1343
+ declare abstract class R2Object {
1344
+ readonly key: string;
1345
+ readonly version: string;
1346
+ readonly size: number;
1347
+ readonly etag: string;
1348
+ readonly httpEtag: string;
1349
+ readonly checksums: R2Checksums;
1350
+ readonly uploaded: Date;
1351
+ readonly httpMetadata?: R2HTTPMetadata;
1352
+ readonly customMetadata?: Record<string, string>;
1353
+ readonly range?: R2Range;
1354
+ writeHttpMetadata(headers: Headers): void;
1355
+ }
1356
+ declare interface R2ObjectBody extends R2Object {
1357
+ get body(): ReadableStream;
1358
+ get bodyUsed(): boolean;
1359
+ arrayBuffer(): Promise<ArrayBuffer>;
1360
+ text(): Promise<string>;
1361
+ json<T>(): Promise<T>;
1362
+ blob(): Promise<Blob>;
1363
+ }
1364
+ declare type R2Range =
1365
+ | {
1366
+ offset: number;
1367
+ length?: number;
1368
+ }
1369
+ | {
1370
+ offset?: number;
1371
+ length: number;
1372
+ }
1373
+ | {
1374
+ suffix: number;
1375
+ };
1376
+ declare interface R2Conditional {
1377
+ etagMatches?: string;
1378
+ etagDoesNotMatch?: string;
1379
+ uploadedBefore?: Date;
1380
+ uploadedAfter?: Date;
1381
+ secondsGranularity?: boolean;
1382
+ }
1383
+ declare interface R2GetOptions {
1384
+ onlyIf?: R2Conditional | Headers;
1385
+ range?: R2Range | Headers;
1386
+ }
1387
+ declare interface R2PutOptions {
1388
+ onlyIf?: R2Conditional | Headers;
1389
+ httpMetadata?: R2HTTPMetadata | Headers;
1390
+ customMetadata?: Record<string, string>;
1391
+ md5?: ArrayBuffer | string;
1392
+ sha1?: ArrayBuffer | string;
1393
+ sha256?: ArrayBuffer | string;
1394
+ sha384?: ArrayBuffer | string;
1395
+ sha512?: ArrayBuffer | string;
1396
+ }
1397
+ declare interface R2MultipartOptions {
1398
+ httpMetadata?: R2HTTPMetadata | Headers;
1399
+ customMetadata?: Record<string, string>;
1400
+ }
1401
+ declare interface R2Checksums {
1402
+ readonly md5?: ArrayBuffer;
1403
+ readonly sha1?: ArrayBuffer;
1404
+ readonly sha256?: ArrayBuffer;
1405
+ readonly sha384?: ArrayBuffer;
1406
+ readonly sha512?: ArrayBuffer;
1407
+ toJSON(): R2StringChecksums;
1408
+ }
1409
+ declare interface R2StringChecksums {
1410
+ md5?: string;
1411
+ sha1?: string;
1412
+ sha256?: string;
1413
+ sha384?: string;
1414
+ sha512?: string;
1415
+ }
1416
+ declare interface R2HTTPMetadata {
1417
+ contentType?: string;
1418
+ contentLanguage?: string;
1419
+ contentDisposition?: string;
1420
+ contentEncoding?: string;
1421
+ cacheControl?: string;
1422
+ cacheExpiry?: Date;
1423
+ }
1424
+ declare type R2Objects = {
1425
+ objects: R2Object[];
1426
+ delimitedPrefixes: string[];
1427
+ } & (
1428
+ | {
1429
+ truncated: true;
1430
+ cursor: string;
1431
+ }
1432
+ | {
1433
+ truncated: false;
1434
+ }
1435
+ );
1436
+ declare abstract class ScheduledEvent extends ExtendableEvent {
1437
+ readonly scheduledTime: number;
1438
+ readonly cron: string;
1439
+ noRetry(): void;
1440
+ }
1441
+ declare interface ScheduledController {
1442
+ readonly scheduledTime: number;
1443
+ readonly cron: string;
1444
+ noRetry(): void;
1445
+ }
1446
+ declare interface QueuingStrategy<T = any> {
1447
+ highWaterMark?: number | bigint;
1448
+ size?: (chunk: T) => number | bigint;
1449
+ }
1450
+ declare interface UnderlyingSink<W = any> {
1451
+ type?: string;
1452
+ start?: (controller: WritableStreamDefaultController) => void | Promise<void>;
1453
+ write?: (
1454
+ chunk: W,
1455
+ controller: WritableStreamDefaultController
1456
+ ) => void | Promise<void>;
1457
+ abort?: (reason: any) => void | Promise<void>;
1458
+ close?: () => void | Promise<void>;
1459
+ }
1460
+ declare interface UnderlyingByteSource {
1461
+ type: "bytes";
1462
+ autoAllocateChunkSize?: number;
1463
+ start?: (controller: ReadableByteStreamController) => void | Promise<void>;
1464
+ pull?: (controller: ReadableByteStreamController) => void | Promise<void>;
1465
+ cancel?: (reason: any) => void | Promise<void>;
1466
+ }
1467
+ declare interface UnderlyingSource<R = any> {
1468
+ type?: "" | undefined;
1469
+ start?: (
1470
+ controller: ReadableStreamDefaultController<R>
1471
+ ) => void | Promise<void>;
1472
+ pull?: (
1473
+ controller: ReadableStreamDefaultController<R>
1474
+ ) => void | Promise<void>;
1475
+ cancel?: (reason: any) => void | Promise<void>;
1476
+ }
1477
+ declare interface Transformer<I = any, O = any> {
1478
+ readableType?: string;
1479
+ writableType?: string;
1480
+ start?: (
1481
+ controller: TransformStreamDefaultController<O>
1482
+ ) => void | Promise<void>;
1483
+ transform?: (
1484
+ chunk: I,
1485
+ controller: TransformStreamDefaultController<O>
1486
+ ) => void | Promise<void>;
1487
+ flush?: (
1488
+ controller: TransformStreamDefaultController<O>
1489
+ ) => void | Promise<void>;
1490
+ }
1491
+ declare interface StreamPipeOptions {
1492
+ /**
1493
+ * 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.
1494
+ *
1495
+ * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
1496
+ *
1497
+ * Errors and closures of the source and destination streams propagate as follows:
1498
+ *
1499
+ * 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.
1500
+ *
1501
+ * 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.
1502
+ *
1503
+ * 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.
1504
+ *
1505
+ * 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.
1506
+ *
1507
+ * 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.
1508
+ */
1509
+ preventClose?: boolean;
1510
+ preventAbort?: boolean;
1511
+ preventCancel?: boolean;
1512
+ signal?: AbortSignal;
1513
+ }
1514
+ declare type ReadableStreamReadResult<R = any> =
1515
+ | {
1516
+ done: false;
1517
+ value: R;
1518
+ }
1519
+ | {
1520
+ done: true;
1521
+ value?: undefined;
1522
+ };
1523
+ /** 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. */
1524
+ declare interface ReadableStream<R = any> {
1525
+ readonly locked: boolean;
1526
+ cancel(reason?: any): Promise<void>;
1527
+ getReader(): ReadableStreamDefaultReader<R>;
1528
+ getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
1529
+ pipeThrough<T>(
1530
+ transform: ReadableWritablePair<T, R>,
1531
+ options?: StreamPipeOptions
1532
+ ): ReadableStream<T>;
1533
+ pipeTo(
1534
+ destination: WritableStream<R>,
1535
+ options?: StreamPipeOptions
1536
+ ): Promise<void>;
1537
+ tee(): [ReadableStream<R>, ReadableStream<R>];
1538
+ values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
1539
+ [Symbol.asyncIterator](
1540
+ options?: ReadableStreamValuesOptions
1541
+ ): AsyncIterableIterator<R>;
1542
+ }
1543
+ declare const ReadableStream: {
1544
+ prototype: ReadableStream;
1545
+ new (
1546
+ underlyingSource: UnderlyingByteSource,
1547
+ strategy?: QueuingStrategy<Uint8Array>
1548
+ ): ReadableStream<Uint8Array>;
1549
+ new <R = any>(
1550
+ underlyingSource?: UnderlyingSource<R>,
1551
+ strategy?: QueuingStrategy<R>
1552
+ ): ReadableStream<R>;
1553
+ };
1554
+ declare class ReadableStreamDefaultReader<R = any> {
1555
+ constructor(stream: ReadableStream);
1556
+ readonly closed: Promise<void>;
1557
+ cancel(reason?: any): Promise<void>;
1558
+ read(): Promise<ReadableStreamReadResult<R>>;
1559
+ releaseLock(): void;
1560
+ }
1561
+ declare class ReadableStreamBYOBReader {
1562
+ constructor(stream: ReadableStream);
1563
+ readonly closed: Promise<void>;
1564
+ cancel(reason?: any): Promise<void>;
1565
+ read<T extends ArrayBufferView>(
1566
+ view: T
1567
+ ): Promise<ReadableStreamReadResult<T>>;
1568
+ releaseLock(): void;
1569
+ readAtLeast<T extends ArrayBufferView>(
1570
+ minElements: number,
1571
+ view: T
1572
+ ): Promise<ReadableStreamReadResult<T>>;
1573
+ }
1574
+ declare interface ReadableStreamGetReaderOptions {
1575
+ mode: "byob";
1576
+ }
1577
+ declare interface ReadableStreamBYOBRequest {
1578
+ readonly view: Uint8Array | null;
1579
+ respond(bytesWritten: number): void;
1580
+ respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;
1581
+ readonly atLeast: number | null;
1582
+ }
1583
+ declare interface ReadableStreamDefaultController<R = any> {
1584
+ readonly desiredSize: number | null;
1585
+ close(): void;
1586
+ enqueue(chunk?: R): void;
1587
+ error(reason: any): void;
1588
+ }
1589
+ declare interface ReadableByteStreamController {
1590
+ readonly byobRequest: ReadableStreamBYOBRequest | null;
1591
+ readonly desiredSize: number | null;
1592
+ close(): void;
1593
+ enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
1594
+ error(reason: any): void;
1595
+ }
1596
+ /** 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. */
1597
+ declare interface WritableStreamDefaultController {
1598
+ readonly signal: AbortSignal;
1599
+ error(reason?: any): void;
1600
+ }
1601
+ declare interface TransformStreamDefaultController<O = any> {
1602
+ get desiredSize(): number | null;
1603
+ enqueue(chunk?: O): void;
1604
+ error(reason: any): void;
1605
+ terminate(): void;
1606
+ }
1607
+ declare interface ReadableWritablePair<R = any, W = any> {
1608
+ /**
1609
+ * 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.
1610
+ *
1611
+ * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
1612
+ */
1613
+ writable: WritableStream<W>;
1614
+ readable: ReadableStream<R>;
1615
+ }
1616
+ declare class WritableStream<W = any> {
1617
+ constructor(
1618
+ underlyingSink?: UnderlyingSink,
1619
+ queuingStrategy?: QueuingStrategy
1620
+ );
1621
+ readonly locked: boolean;
1622
+ abort(reason?: any): Promise<void>;
1623
+ close(): Promise<void>;
1624
+ getWriter(): WritableStreamDefaultWriter<W>;
1625
+ }
1626
+ declare class WritableStreamDefaultWriter<W = any> {
1627
+ constructor(stream: WritableStream);
1628
+ readonly closed: Promise<void>;
1629
+ readonly ready: Promise<void>;
1630
+ readonly desiredSize: number | null;
1631
+ abort(reason?: any): Promise<void>;
1632
+ close(): Promise<void>;
1633
+ write(chunk?: W): Promise<void>;
1634
+ releaseLock(): void;
1635
+ }
1636
+ declare class TransformStream<I = any, O = any> {
1637
+ constructor(
1638
+ transformer?: Transformer<I, O>,
1639
+ writableStrategy?: QueuingStrategy<I>,
1640
+ readableStrategy?: QueuingStrategy<O>
1641
+ );
1642
+ readonly readable: ReadableStream<O>;
1643
+ readonly writable: WritableStream<I>;
1644
+ }
1645
+ declare class FixedLengthStream extends IdentityTransformStream {
1646
+ constructor(
1647
+ expectedLength: number | bigint,
1648
+ queuingStrategy?: IdentityTransformStreamQueuingStrategy
1649
+ );
1650
+ }
1651
+ declare class IdentityTransformStream extends TransformStream<
1652
+ ArrayBuffer | ArrayBufferView,
1653
+ Uint8Array
1654
+ > {
1655
+ constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
1656
+ }
1657
+ declare interface IdentityTransformStreamQueuingStrategy {
1658
+ highWaterMark?: number | bigint;
1659
+ }
1660
+ declare interface ReadableStreamValuesOptions {
1661
+ preventCancel?: boolean;
1662
+ }
1663
+ declare class CompressionStream extends TransformStream<
1664
+ ArrayBuffer | ArrayBufferView,
1665
+ Uint8Array
1666
+ > {
1667
+ constructor(format: "gzip" | "deflate" | "deflate-raw");
1668
+ }
1669
+ declare class DecompressionStream extends TransformStream<
1670
+ ArrayBuffer | ArrayBufferView,
1671
+ Uint8Array
1672
+ > {
1673
+ constructor(format: "gzip" | "deflate" | "deflate-raw");
1674
+ }
1675
+ declare class TextEncoderStream extends TransformStream<string, Uint8Array> {
1676
+ constructor();
1677
+ }
1678
+ declare class TextDecoderStream extends TransformStream<
1679
+ ArrayBuffer | ArrayBufferView,
1680
+ string
1681
+ > {
1682
+ constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);
1683
+ }
1684
+ declare interface TextDecoderStreamTextDecoderStreamInit {
1685
+ fatal?: boolean;
1686
+ }
1687
+ declare class ByteLengthQueuingStrategy
1688
+ implements QueuingStrategy<ArrayBufferView>
1689
+ {
1690
+ constructor(init: QueuingStrategyInit);
1691
+ get highWaterMark(): number;
1692
+ get size(): (chunk?: any) => number;
1693
+ }
1694
+ declare class CountQueuingStrategy implements QueuingStrategy {
1695
+ constructor(init: QueuingStrategyInit);
1696
+ get highWaterMark(): number;
1697
+ get size(): (chunk?: any) => number;
1698
+ }
1699
+ declare interface QueuingStrategyInit {
1700
+ /**
1701
+ * Creates a new ByteLengthQueuingStrategy with the provided high water mark.
1702
+ *
1703
+ * 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.
1704
+ */
1705
+ highWaterMark: number;
1706
+ }
1707
+ declare abstract class TailEvent extends ExtendableEvent {
1708
+ readonly events: TraceItem[];
1709
+ readonly traces: TraceItem[];
1710
+ }
1711
+ declare interface TraceItem {
1712
+ readonly event:
1713
+ | (
1714
+ | TraceItemFetchEventInfo
1715
+ | TraceItemScheduledEventInfo
1716
+ | TraceItemAlarmEventInfo
1717
+ | TraceItemQueueEventInfo
1718
+ | TraceItemEmailEventInfo
1719
+ | TraceItemTailEventInfo
1720
+ | TraceItemCustomEventInfo
1721
+ )
1722
+ | null;
1723
+ readonly eventTimestamp: number | null;
1724
+ readonly logs: TraceLog[];
1725
+ readonly exceptions: TraceException[];
1726
+ readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
1727
+ readonly scriptName: string | null;
1728
+ readonly dispatchNamespace?: string;
1729
+ readonly scriptTags?: string[];
1730
+ readonly outcome: string;
1731
+ }
1732
+ declare interface TraceItemAlarmEventInfo {
1733
+ readonly scheduledTime: Date;
1734
+ }
1735
+ declare interface TraceItemCustomEventInfo {}
1736
+ declare interface TraceItemScheduledEventInfo {
1737
+ readonly scheduledTime: number;
1738
+ readonly cron: string;
1739
+ }
1740
+ declare interface TraceItemQueueEventInfo {
1741
+ readonly queue: string;
1742
+ readonly batchSize: number;
1743
+ }
1744
+ declare interface TraceItemEmailEventInfo {
1745
+ readonly mailFrom: string;
1746
+ readonly rcptTo: string;
1747
+ readonly rawSize: number;
1748
+ }
1749
+ declare interface TraceItemTailEventInfo {
1750
+ readonly consumedEvents: TraceItemTailEventInfoTailItem[];
1751
+ }
1752
+ declare interface TraceItemTailEventInfoTailItem {
1753
+ readonly scriptName: string | null;
1754
+ }
1755
+ declare interface TraceItemFetchEventInfo {
1756
+ readonly response?: TraceItemFetchEventInfoResponse;
1757
+ readonly request: TraceItemFetchEventInfoRequest;
1758
+ }
1759
+ declare interface TraceItemFetchEventInfoRequest {
1760
+ readonly cf?: any;
1761
+ readonly headers: Record<string, string>;
1762
+ readonly method: string;
1763
+ readonly url: string;
1764
+ getUnredacted(): TraceItemFetchEventInfoRequest;
1765
+ }
1766
+ declare interface TraceItemFetchEventInfoResponse {
1767
+ readonly status: number;
1768
+ }
1769
+ declare interface TraceLog {
1770
+ readonly timestamp: number;
1771
+ readonly level: string;
1772
+ readonly message: any;
1773
+ }
1774
+ declare interface TraceException {
1775
+ readonly timestamp: number;
1776
+ readonly message: string;
1777
+ readonly name: string;
1778
+ }
1779
+ declare interface TraceDiagnosticChannelEvent {
1780
+ readonly timestamp: number;
1781
+ readonly channel: string;
1782
+ readonly message: any;
1783
+ }
1784
+ declare interface TraceMetrics {
1785
+ readonly cpuTime: number;
1786
+ readonly wallTime: number;
1787
+ }
1788
+ declare interface UnsafeTraceMetrics {
1789
+ fromTrace(item: TraceItem): TraceMetrics;
1790
+ }
1791
+ declare class URL {
1792
+ constructor(url: string | URL, base?: string | URL);
1793
+ href: string;
1794
+ readonly origin: string;
1795
+ protocol: string;
1796
+ username: string;
1797
+ password: string;
1798
+ host: string;
1799
+ hostname: string;
1800
+ port: string;
1801
+ pathname: string;
1802
+ search: string;
1803
+ readonly searchParams: URLSearchParams;
1804
+ hash: string;
1805
+ toString(): string;
1806
+ toJSON(): string;
1807
+ }
1808
+ declare class URLSearchParams {
1809
+ constructor(
1810
+ init?:
1811
+ | URLSearchParams
1812
+ | string
1813
+ | Record<string, string>
1814
+ | [key: string, value: string][]
1815
+ );
1816
+ get size(): number;
1817
+ append(name: string, value: string): void;
1818
+ delete(name: string): void;
1819
+ get(name: string): string | null;
1820
+ getAll(name: string): string[];
1821
+ has(name: string): boolean;
1822
+ set(name: string, value: string): void;
1823
+ sort(): void;
1824
+ entries(): IterableIterator<[key: string, value: string]>;
1825
+ keys(): IterableIterator<string>;
1826
+ values(): IterableIterator<string>;
1827
+ forEach<This = unknown>(
1828
+ callback: (
1829
+ this: This,
1830
+ value: string,
1831
+ key: string,
1832
+ parent: URLSearchParams
1833
+ ) => void,
1834
+ thisArg?: This
1835
+ ): void;
1836
+ toString(): string;
1837
+ [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
1838
+ }
1839
+ declare class URLPattern {
1840
+ constructor(input?: string | URLPatternURLPatternInit, baseURL?: string);
1841
+ get protocol(): string;
1842
+ get username(): string;
1843
+ get password(): string;
1844
+ get hostname(): string;
1845
+ get port(): string;
1846
+ get pathname(): string;
1847
+ get search(): string;
1848
+ get hash(): string;
1849
+ test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean;
1850
+ exec(
1851
+ input?: string | URLPatternURLPatternInit,
1852
+ baseURL?: string
1853
+ ): URLPatternURLPatternResult | null;
1854
+ }
1855
+ declare interface URLPatternURLPatternInit {
1856
+ protocol?: string;
1857
+ username?: string;
1858
+ password?: string;
1859
+ hostname?: string;
1860
+ port?: string;
1861
+ pathname?: string;
1862
+ search?: string;
1863
+ hash?: string;
1864
+ baseURL?: string;
1865
+ }
1866
+ declare interface URLPatternURLPatternComponentResult {
1867
+ input: string;
1868
+ groups: Record<string, string>;
1869
+ }
1870
+ declare interface URLPatternURLPatternResult {
1871
+ inputs: (string | URLPatternURLPatternInit)[];
1872
+ protocol: URLPatternURLPatternComponentResult;
1873
+ username: URLPatternURLPatternComponentResult;
1874
+ password: URLPatternURLPatternComponentResult;
1875
+ hostname: URLPatternURLPatternComponentResult;
1876
+ port: URLPatternURLPatternComponentResult;
1877
+ pathname: URLPatternURLPatternComponentResult;
1878
+ search: URLPatternURLPatternComponentResult;
1879
+ hash: URLPatternURLPatternComponentResult;
1880
+ }
1881
+ declare class CloseEvent extends Event {
1882
+ constructor(type: string, initializer: CloseEventInit);
1883
+ /** Returns the WebSocket connection close code provided by the server. */
1884
+ readonly code: number;
1885
+ /** Returns the WebSocket connection close reason provided by the server. */
1886
+ readonly reason: string;
1887
+ /** Returns true if the connection closed cleanly; false otherwise. */
1888
+ readonly wasClean: boolean;
1889
+ }
1890
+ declare interface CloseEventInit {
1891
+ code?: number;
1892
+ reason?: string;
1893
+ wasClean?: boolean;
1894
+ }
1895
+ declare class MessageEvent extends Event {
1896
+ constructor(type: string, initializer: MessageEventInit);
1897
+ readonly data: ArrayBuffer | string;
1898
+ }
1899
+ declare interface MessageEventInit {
1900
+ data: ArrayBuffer | string;
1901
+ }
1902
+ /** Events providing information related to errors in scripts or in files. */
1903
+ declare interface ErrorEvent extends Event {
1904
+ readonly filename: string;
1905
+ readonly message: string;
1906
+ readonly lineno: number;
1907
+ readonly colno: number;
1908
+ readonly error: any;
1909
+ }
1910
+ declare type WebSocketEventMap = {
1911
+ close: CloseEvent;
1912
+ message: MessageEvent;
1913
+ open: Event;
1914
+ error: ErrorEvent;
1915
+ };
1916
+ declare class WebSocket extends EventTarget<WebSocketEventMap> {
1917
+ constructor(url: string, protocols?: string[] | string);
1918
+ accept(): void;
1919
+ send(message: (ArrayBuffer | ArrayBufferView) | string): void;
1920
+ close(code?: number, reason?: string): void;
1921
+ serializeAttachment(attachment: any): void;
1922
+ deserializeAttachment(): any | null;
1923
+ static readonly READY_STATE_CONNECTING: number;
1924
+ static readonly READY_STATE_OPEN: number;
1925
+ static readonly READY_STATE_CLOSING: number;
1926
+ static readonly READY_STATE_CLOSED: number;
1927
+ /** Returns the state of the WebSocket object's connection. It can have the values described below. */
1928
+ readonly readyState: number;
1929
+ /** Returns the URL that was used to establish the WebSocket connection. */
1930
+ readonly url: string | null;
1931
+ /** 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. */
1932
+ readonly protocol: string | null;
1933
+ /** Returns the extensions selected by the server, if any. */
1934
+ readonly extensions: string | null;
1935
+ }
1936
+ declare const WebSocketPair: {
1937
+ new (): {
1938
+ 0: WebSocket;
1939
+ 1: WebSocket;
1940
+ };
1941
+ };
1942
+ declare interface Socket {
1943
+ get readable(): ReadableStream;
1944
+ get writable(): WritableStream;
1945
+ get closed(): Promise<void>;
1946
+ close(): Promise<void>;
1947
+ startTls(options?: TlsOptions): Socket;
1948
+ }
1949
+ declare interface SocketOptions {
1950
+ secureTransport?: string;
1951
+ allowHalfOpen: boolean;
1952
+ }
1953
+ declare interface SocketAddress {
1954
+ hostname: string;
1955
+ port: number;
1956
+ }
1957
+ declare interface TlsOptions {
1958
+ expectedServerHostname?: string;
1959
+ }
1960
+ declare abstract class gpuGPUAdapter {
1961
+ requestDevice(param1?: gpuGPUDeviceDescriptor): Promise<gpuGPUDevice>;
1962
+ requestAdapterInfo(unmaskHints?: string[]): Promise<gpuGPUAdapterInfo>;
1963
+ get features(): gpuGPUSupportedFeatures;
1964
+ get limits(): gpuGPUSupportedLimits;
1965
+ }
1966
+ declare interface gpuGPUDevice extends EventTarget {
1967
+ createBuffer(param1: gpuGPUBufferDescriptor): gpuGPUBuffer;
1968
+ createBindGroupLayout(
1969
+ descriptor: gpuGPUBindGroupLayoutDescriptor
1970
+ ): gpuGPUBindGroupLayout;
1971
+ createBindGroup(descriptor: gpuGPUBindGroupDescriptor): gpuGPUBindGroup;
1972
+ createSampler(descriptor: gpuGPUSamplerDescriptor): gpuGPUSampler;
1973
+ createShaderModule(
1974
+ descriptor: gpuGPUShaderModuleDescriptor
1975
+ ): gpuGPUShaderModule;
1976
+ createPipelineLayout(
1977
+ descriptor: gpuGPUPipelineLayoutDescriptor
1978
+ ): gpuGPUPipelineLayout;
1979
+ createComputePipeline(
1980
+ descriptor: gpuGPUComputePipelineDescriptor
1981
+ ): gpuGPUComputePipeline;
1982
+ createRenderPipeline(
1983
+ descriptor: gpuGPURenderPipelineDescriptor
1984
+ ): gpuGPURenderPipeline;
1985
+ createCommandEncoder(
1986
+ descriptor?: gpuGPUCommandEncoderDescriptor
1987
+ ): gpuGPUCommandEncoder;
1988
+ createTexture(param1: gpuGPUTextureDescriptor): gpuGPUTexture;
1989
+ destroy(): void;
1990
+ createQuerySet(descriptor: gpuGPUQuerySetDescriptor): gpuGPUQuerySet;
1991
+ pushErrorScope(filter: string): void;
1992
+ popErrorScope(): Promise<gpuGPUError | null>;
1993
+ get queue(): gpuGPUQueue;
1994
+ get lost(): Promise<gpuGPUDeviceLostInfo>;
1995
+ get features(): gpuGPUSupportedFeatures;
1996
+ get limits(): gpuGPUSupportedLimits;
1997
+ }
1998
+ declare interface gpuGPUDeviceDescriptor {
1999
+ label?: string;
2000
+ requiredFeatures?: string[];
2001
+ requiredLimits?: Record<string, number | bigint>;
2002
+ defaultQueue?: gpuGPUQueueDescriptor;
2003
+ }
2004
+ declare interface gpuGPUBufferDescriptor {
2005
+ label: string;
2006
+ size: number | bigint;
2007
+ usage: number;
2008
+ mappedAtCreation: boolean;
2009
+ }
2010
+ declare interface gpuGPUQueueDescriptor {
2011
+ label?: string;
2012
+ }
2013
+ declare abstract class gpuGPUBufferUsage {
2014
+ static readonly MAP_READ: number;
2015
+ static readonly MAP_WRITE: number;
2016
+ static readonly COPY_SRC: number;
2017
+ static readonly COPY_DST: number;
2018
+ static readonly INDEX: number;
2019
+ static readonly VERTEX: number;
2020
+ static readonly UNIFORM: number;
2021
+ static readonly STORAGE: number;
2022
+ static readonly INDIRECT: number;
2023
+ static readonly QUERY_RESOLVE: number;
2024
+ }
2025
+ declare interface gpuGPUBuffer {
2026
+ getMappedRange(size?: number | bigint, param2?: number | bigint): ArrayBuffer;
2027
+ unmap(): void;
2028
+ destroy(): void;
2029
+ mapAsync(
2030
+ mode: number,
2031
+ offset?: number | bigint,
2032
+ size?: number | bigint
2033
+ ): Promise<void>;
2034
+ get size(): number | bigint;
2035
+ get usage(): number;
2036
+ get mapState(): string;
2037
+ }
2038
+ declare abstract class gpuGPUShaderStage {
2039
+ static readonly VERTEX: number;
2040
+ static readonly FRAGMENT: number;
2041
+ static readonly COMPUTE: number;
2042
+ }
2043
+ declare interface gpuGPUBindGroupLayoutDescriptor {
2044
+ label?: string;
2045
+ entries: gpuGPUBindGroupLayoutEntry[];
2046
+ }
2047
+ declare interface gpuGPUBindGroupLayoutEntry {
2048
+ binding: number;
2049
+ visibility: number;
2050
+ buffer?: gpuGPUBufferBindingLayout;
2051
+ sampler?: gpuGPUSamplerBindingLayout;
2052
+ texture?: gpuGPUTextureBindingLayout;
2053
+ storageTexture?: gpuGPUStorageTextureBindingLayout;
2054
+ }
2055
+ declare interface gpuGPUStorageTextureBindingLayout {
2056
+ access?: string;
2057
+ format: string;
2058
+ viewDimension?: string;
2059
+ }
2060
+ declare interface gpuGPUTextureBindingLayout {
2061
+ sampleType?: string;
2062
+ viewDimension?: string;
2063
+ multisampled?: boolean;
2064
+ }
2065
+ declare interface gpuGPUSamplerBindingLayout {
2066
+ type?: string;
2067
+ }
2068
+ declare interface gpuGPUBufferBindingLayout {
2069
+ type?: string;
2070
+ hasDynamicOffset?: boolean;
2071
+ minBindingSize?: number | bigint;
2072
+ }
2073
+ declare interface gpuGPUBindGroupLayout {}
2074
+ declare interface gpuGPUBindGroup {}
2075
+ declare interface gpuGPUBindGroupDescriptor {
2076
+ label?: string;
2077
+ layout: gpuGPUBindGroupLayout;
2078
+ entries: gpuGPUBindGroupEntry[];
2079
+ }
2080
+ declare interface gpuGPUBindGroupEntry {
2081
+ binding: number;
2082
+ resource: gpuGPUBufferBinding | gpuGPUSampler;
2083
+ }
2084
+ declare interface gpuGPUBufferBinding {
2085
+ buffer: gpuGPUBuffer;
2086
+ offset?: number | bigint;
2087
+ size?: number | bigint;
2088
+ }
2089
+ declare interface gpuGPUSampler {}
2090
+ declare interface gpuGPUSamplerDescriptor {
2091
+ label?: string;
2092
+ addressModeU?: string;
2093
+ addressModeV?: string;
2094
+ addressModeW?: string;
2095
+ magFilter?: string;
2096
+ minFilter?: string;
2097
+ mipmapFilter?: string;
2098
+ lodMinClamp?: number;
2099
+ lodMaxClamp?: number;
2100
+ compare: string;
2101
+ maxAnisotropy?: number;
2102
+ }
2103
+ declare interface gpuGPUShaderModule {
2104
+ getCompilationInfo(): Promise<gpuGPUCompilationInfo>;
2105
+ }
2106
+ declare interface gpuGPUShaderModuleDescriptor {
2107
+ label?: string;
2108
+ code: string;
2109
+ }
2110
+ declare interface gpuGPUPipelineLayout {}
2111
+ declare interface gpuGPUPipelineLayoutDescriptor {
2112
+ label?: string;
2113
+ bindGroupLayouts: gpuGPUBindGroupLayout[];
2114
+ }
2115
+ declare interface gpuGPUComputePipeline {
2116
+ getBindGroupLayout(index: number): gpuGPUBindGroupLayout;
2117
+ }
2118
+ declare interface gpuGPUComputePipelineDescriptor {
2119
+ label?: string;
2120
+ compute: gpuGPUProgrammableStage;
2121
+ layout: string | gpuGPUPipelineLayout;
2122
+ }
2123
+ declare interface gpuGPUProgrammableStage {
2124
+ module: gpuGPUShaderModule;
2125
+ entryPoint: string;
2126
+ constants?: Record<string, number>;
2127
+ }
2128
+ declare interface gpuGPUCommandEncoder {
2129
+ get label(): string;
2130
+ beginComputePass(
2131
+ descriptor?: gpuGPUComputePassDescriptor
2132
+ ): gpuGPUComputePassEncoder;
2133
+ beginRenderPass(
2134
+ descriptor: gpuGPURenderPassDescriptor
2135
+ ): gpuGPURenderPassEncoder;
2136
+ copyBufferToBuffer(
2137
+ source: gpuGPUBuffer,
2138
+ sourceOffset: number | bigint,
2139
+ destination: gpuGPUBuffer,
2140
+ destinationOffset: number | bigint,
2141
+ size: number | bigint
2142
+ ): void;
2143
+ finish(param0?: gpuGPUCommandBufferDescriptor): gpuGPUCommandBuffer;
2144
+ }
2145
+ declare interface gpuGPUCommandEncoderDescriptor {
2146
+ label?: string;
2147
+ }
2148
+ declare interface gpuGPUComputePassEncoder {
2149
+ setPipeline(pipeline: gpuGPUComputePipeline): void;
2150
+ setBindGroup(
2151
+ index: number,
2152
+ bindGroup: gpuGPUBindGroup | null,
2153
+ dynamicOffsets?: Iterable<number>
2154
+ ): void;
2155
+ dispatchWorkgroups(
2156
+ workgroupCountX: number,
2157
+ workgroupCountY?: number,
2158
+ workgroupCountZ?: number
2159
+ ): void;
2160
+ end(): void;
2161
+ }
2162
+ declare interface gpuGPUComputePassDescriptor {
2163
+ label?: string;
2164
+ timestampWrites?: gpuGPUComputePassTimestampWrite[];
2165
+ }
2166
+ declare interface gpuGPUQuerySet {}
2167
+ declare interface gpuGPUQuerySetDescriptor {
2168
+ label?: string;
2169
+ }
2170
+ declare interface gpuGPUComputePassTimestampWrite {
2171
+ querySet: gpuGPUQuerySet;
2172
+ queryIndex: number;
2173
+ location: string;
2174
+ }
2175
+ declare interface gpuGPUCommandBufferDescriptor {
2176
+ label?: string;
2177
+ }
2178
+ declare interface gpuGPUCommandBuffer {}
2179
+ declare interface gpuGPUQueue {
2180
+ submit(commandBuffers: gpuGPUCommandBuffer[]): void;
2181
+ writeBuffer(
2182
+ buffer: gpuGPUBuffer,
2183
+ bufferOffset: number | bigint,
2184
+ data: ArrayBuffer | ArrayBufferView,
2185
+ dataOffset?: number | bigint,
2186
+ size?: number | bigint
2187
+ ): void;
2188
+ }
2189
+ declare abstract class gpuGPUMapMode {
2190
+ static readonly READ: number;
2191
+ static readonly WRITE: number;
2192
+ }
2193
+ declare interface gpuGPUAdapterInfo {
2194
+ get vendor(): string;
2195
+ get architecture(): string;
2196
+ get device(): string;
2197
+ get description(): string;
2198
+ }
2199
+ declare interface gpuGPUSupportedFeatures {
2200
+ has(name: string): boolean;
2201
+ keys(): string[];
2202
+ }
2203
+ declare interface gpuGPUSupportedLimits {
2204
+ get maxTextureDimension1D(): number;
2205
+ get maxTextureDimension2D(): number;
2206
+ get maxTextureDimension3D(): number;
2207
+ get maxTextureArrayLayers(): number;
2208
+ get maxBindGroups(): number;
2209
+ get maxBindingsPerBindGroup(): number;
2210
+ get maxDynamicUniformBuffersPerPipelineLayout(): number;
2211
+ get maxDynamicStorageBuffersPerPipelineLayout(): number;
2212
+ get maxSampledTexturesPerShaderStage(): number;
2213
+ get maxSamplersPerShaderStage(): number;
2214
+ get maxStorageBuffersPerShaderStage(): number;
2215
+ get maxStorageTexturesPerShaderStage(): number;
2216
+ get maxUniformBuffersPerShaderStage(): number;
2217
+ get maxUniformBufferBindingSize(): number | bigint;
2218
+ get maxStorageBufferBindingSize(): number | bigint;
2219
+ get minUniformBufferOffsetAlignment(): number;
2220
+ get minStorageBufferOffsetAlignment(): number;
2221
+ get maxVertexBuffers(): number;
2222
+ get maxBufferSize(): number | bigint;
2223
+ get maxVertexAttributes(): number;
2224
+ get maxVertexBufferArrayStride(): number;
2225
+ get maxInterStageShaderComponents(): number;
2226
+ get maxInterStageShaderVariables(): number;
2227
+ get maxColorAttachments(): number;
2228
+ get maxColorAttachmentBytesPerSample(): number;
2229
+ get maxComputeWorkgroupStorageSize(): number;
2230
+ get maxComputeInvocationsPerWorkgroup(): number;
2231
+ get maxComputeWorkgroupSizeX(): number;
2232
+ get maxComputeWorkgroupSizeY(): number;
2233
+ get maxComputeWorkgroupSizeZ(): number;
2234
+ get maxComputeWorkgroupsPerDimension(): number;
2235
+ }
2236
+ declare abstract class gpuGPUError {
2237
+ get message(): string;
2238
+ }
2239
+ declare abstract class gpuGPUOutOfMemoryError extends gpuGPUError {}
2240
+ declare abstract class gpuGPUInternalError extends gpuGPUError {}
2241
+ declare abstract class gpuGPUValidationError extends gpuGPUError {}
2242
+ declare abstract class gpuGPUDeviceLostInfo {
2243
+ get message(): string;
2244
+ get reason(): string;
2245
+ }
2246
+ declare interface gpuGPUCompilationMessage {
2247
+ get message(): string;
2248
+ get type(): string;
2249
+ get lineNum(): number;
2250
+ get linePos(): number;
2251
+ get offset(): number;
2252
+ get length(): number;
2253
+ }
2254
+ declare interface gpuGPUCompilationInfo {
2255
+ get messages(): gpuGPUCompilationMessage[];
2256
+ }
2257
+ declare abstract class gpuGPUTextureUsage {
2258
+ static readonly COPY_SRC: number;
2259
+ static readonly COPY_DST: number;
2260
+ static readonly TEXTURE_BINDING: number;
2261
+ static readonly STORAGE_BINDING: number;
2262
+ static readonly RENDER_ATTACHMENT: number;
2263
+ }
2264
+ declare interface gpuGPUTextureDescriptor {
2265
+ label: string;
2266
+ size: number[] | gpuGPUExtent3DDict;
2267
+ mipLevelCount?: number;
2268
+ sampleCount?: number;
2269
+ dimension?: string;
2270
+ format: string;
2271
+ usage: number;
2272
+ viewFormats?: string[];
2273
+ }
2274
+ declare interface gpuGPUExtent3DDict {
2275
+ width: number;
2276
+ height?: number;
2277
+ depthOrArrayLayers?: number;
2278
+ }
2279
+ declare interface gpuGPUTexture {
2280
+ createView(descriptor?: gpuGPUTextureViewDescriptor): gpuGPUTextureView;
2281
+ destroy(): void;
2282
+ get width(): number;
2283
+ get height(): number;
2284
+ get depthOrArrayLayers(): number;
2285
+ get mipLevelCount(): number;
2286
+ get dimension(): string;
2287
+ get format(): string;
2288
+ get usage(): number;
2289
+ }
2290
+ declare interface gpuGPUTextureView {}
2291
+ declare interface gpuGPUTextureViewDescriptor {
2292
+ label: string;
2293
+ format: string;
2294
+ dimension: string;
2295
+ aspect?: string;
2296
+ baseMipLevel?: number;
2297
+ mipLevelCount: number;
2298
+ baseArrayLayer?: number;
2299
+ arrayLayerCount: number;
2300
+ }
2301
+ declare abstract class gpuGPUColorWrite {
2302
+ static readonly RED: number;
2303
+ static readonly GREEN: number;
2304
+ static readonly BLUE: number;
2305
+ static readonly ALPHA: number;
2306
+ static readonly ALL: number;
2307
+ }
2308
+ declare interface gpuGPURenderPipeline {}
2309
+ declare interface gpuGPURenderPipelineDescriptor {
2310
+ label?: string;
2311
+ layout: string | gpuGPUPipelineLayout;
2312
+ vertex: gpuGPUVertexState;
2313
+ primitive?: gpuGPUPrimitiveState;
2314
+ depthStencil?: gpuGPUDepthStencilState;
2315
+ multisample?: gpuGPUMultisampleState;
2316
+ fragment?: gpuGPUFragmentState;
2317
+ }
2318
+ declare interface gpuGPUVertexState {
2319
+ module: gpuGPUShaderModule;
2320
+ entryPoint: string;
2321
+ constants?: Record<string, number>;
2322
+ buffers?: gpuGPUVertexBufferLayout[];
2323
+ }
2324
+ declare interface gpuGPUVertexBufferLayout {
2325
+ arrayStride: number | bigint;
2326
+ stepMode?: string;
2327
+ attributes: gpuGPUVertexAttribute[];
2328
+ }
2329
+ declare interface gpuGPUVertexAttribute {
2330
+ format: string;
2331
+ offset: number | bigint;
2332
+ shaderLocation: number;
2333
+ }
2334
+ declare interface gpuGPUPrimitiveState {
2335
+ topology?: string;
2336
+ stripIndexFormat?: string;
2337
+ frontFace?: string;
2338
+ cullMode?: string;
2339
+ unclippedDepth?: boolean;
2340
+ }
2341
+ declare interface gpuGPUStencilFaceState {
2342
+ compare?: string;
2343
+ failOp?: string;
2344
+ depthFailOp?: string;
2345
+ passOp?: string;
2346
+ }
2347
+ declare interface gpuGPUDepthStencilState {
2348
+ format: string;
2349
+ depthWriteEnabled: boolean;
2350
+ depthCompare: string;
2351
+ stencilFront?: gpuGPUStencilFaceState;
2352
+ stencilBack?: gpuGPUStencilFaceState;
2353
+ stencilReadMask?: number;
2354
+ stencilWriteMask?: number;
2355
+ depthBias?: number;
2356
+ depthBiasSlopeScale?: number;
2357
+ depthBiasClamp?: number;
2358
+ }
2359
+ declare interface gpuGPUMultisampleState {
2360
+ count?: number;
2361
+ mask?: number;
2362
+ alphaToCoverageEnabled?: boolean;
2363
+ }
2364
+ declare interface gpuGPUFragmentState {
2365
+ module: gpuGPUShaderModule;
2366
+ entryPoint: string;
2367
+ constants?: Record<string, number>;
2368
+ targets: gpuGPUColorTargetState[];
2369
+ }
2370
+ declare interface gpuGPUColorTargetState {
2371
+ format: string;
2372
+ blend: gpuGPUBlendState;
2373
+ writeMask?: number;
2374
+ }
2375
+ declare interface gpuGPUBlendState {
2376
+ color: gpuGPUBlendComponent;
2377
+ alpha: gpuGPUBlendComponent;
2378
+ }
2379
+ declare interface gpuGPUBlendComponent {
2380
+ operation?: string;
2381
+ srcFactor?: string;
2382
+ dstFactor?: string;
2383
+ }
2384
+ declare interface gpuGPURenderPassEncoder {
2385
+ setPipeline(pipeline: gpuGPURenderPipeline): void;
2386
+ draw(
2387
+ vertexCount: number,
2388
+ instanceCount?: number,
2389
+ firstVertex?: number,
2390
+ firstInstance?: number
2391
+ ): void;
2392
+ }
2393
+ declare interface gpuGPURenderPassDescriptor {
2394
+ label?: string;
2395
+ colorAttachments: gpuGPURenderPassColorAttachment[];
2396
+ depthStencilAttachment?: gpuGPURenderPassDepthStencilAttachment;
2397
+ occlusionQuerySet?: gpuGPUQuerySet;
2398
+ timestampWrites?: gpuGPURenderPassTimestampWrite[];
2399
+ maxDrawCount?: number | bigint;
2400
+ }
2401
+ declare interface gpuGPURenderPassColorAttachment {
2402
+ view: gpuGPUTextureView;
2403
+ depthSlice?: number;
2404
+ resolveTarget?: gpuGPUTextureView;
2405
+ clearValue?: number[] | gpuGPUColorDict;
2406
+ loadOp: string;
2407
+ storeOp: string;
2408
+ }
2409
+ declare interface gpuGPUColorDict {
2410
+ r: number;
2411
+ g: number;
2412
+ b: number;
2413
+ a: number;
2414
+ }
2415
+ declare interface gpuGPURenderPassDepthStencilAttachment {
2416
+ view: gpuGPUTextureView;
2417
+ depthClearValue?: number;
2418
+ depthLoadOp?: string;
2419
+ depthStoreOp?: string;
2420
+ depthReadOnly?: boolean;
2421
+ stencilClearValue?: number;
2422
+ stencilLoadOp?: string;
2423
+ stencilStoreOp?: string;
2424
+ stencilReadOnly?: boolean;
2425
+ }
2426
+ declare interface gpuGPURenderPassTimestampWrite {
2427
+ querySet: gpuGPUQuerySet;
2428
+ queryIndex: number;
2429
+ location: string;
2430
+ }
2431
+ declare interface BasicImageTransformations {
2432
+ /**
2433
+ * Maximum width in image pixels. The value must be an integer.
2434
+ */
2435
+ width?: number;
2436
+ /**
2437
+ * Maximum height in image pixels. The value must be an integer.
2438
+ */
2439
+ height?: number;
2440
+ /**
2441
+ * Resizing mode as a string. It affects interpretation of width and height
2442
+ * options:
2443
+ * - scale-down: Similar to contain, but the image is never enlarged. If
2444
+ * the image is larger than given width or height, it will be resized.
2445
+ * Otherwise its original size will be kept.
2446
+ * - contain: Resizes to maximum size that fits within the given width and
2447
+ * height. If only a single dimension is given (e.g. only width), the
2448
+ * image will be shrunk or enlarged to exactly match that dimension.
2449
+ * Aspect ratio is always preserved.
2450
+ * - cover: Resizes (shrinks or enlarges) to fill the entire area of width
2451
+ * and height. If the image has an aspect ratio different from the ratio
2452
+ * of width and height, it will be cropped to fit.
2453
+ * - crop: The image will be shrunk and cropped to fit within the area
2454
+ * specified by width and height. The image will not be enlarged. For images
2455
+ * smaller than the given dimensions it's the same as scale-down. For
2456
+ * images larger than the given dimensions, it's the same as cover.
2457
+ * See also trim.
2458
+ * - pad: Resizes to the maximum size that fits within the given width and
2459
+ * height, and then fills the remaining area with a background color
2460
+ * (white by default). Use of this mode is not recommended, as the same
2461
+ * effect can be more efficiently achieved with the contain mode and the
2462
+ * CSS object-fit: contain property.
2463
+ */
2464
+ fit?: "scale-down" | "contain" | "cover" | "crop" | "pad";
2465
+ /**
2466
+ * When cropping with fit: "cover", this defines the side or point that should
2467
+ * be left uncropped. The value is either a string
2468
+ * "left", "right", "top", "bottom", "auto", or "center" (the default),
2469
+ * or an object {x, y} containing focal point coordinates in the original
2470
+ * image expressed as fractions ranging from 0.0 (top or left) to 1.0
2471
+ * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will
2472
+ * crop bottom or left and right sides as necessary, but won’t crop anything
2473
+ * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to
2474
+ * preserve as much as possible around a point at 20% of the height of the
2475
+ * source image.
2476
+ */
2477
+ gravity?:
2478
+ | "left"
2479
+ | "right"
2480
+ | "top"
2481
+ | "bottom"
2482
+ | "center"
2483
+ | "auto"
2484
+ | BasicImageTransformationsGravityCoordinates;
2485
+ /**
2486
+ * Background color to add underneath the image. Applies only to images with
2487
+ * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),
2488
+ * hsl(…), etc.)
2489
+ */
2490
+ background?: string;
2491
+ /**
2492
+ * Number of degrees (90, 180, 270) to rotate the image by. width and height
2493
+ * options refer to axes after rotation.
2494
+ */
2495
+ rotate?: 0 | 90 | 180 | 270 | 360;
2496
+ }
2497
+ declare interface BasicImageTransformationsGravityCoordinates {
2498
+ x: number;
2499
+ y: number;
2500
+ }
2501
+ /**
2502
+ * In addition to the properties you can set in the RequestInit dict
2503
+ * that you pass as an argument to the Request constructor, you can
2504
+ * set certain properties of a `cf` object to control how Cloudflare
2505
+ * features are applied to that new Request.
2506
+ *
2507
+ * Note: Currently, these properties cannot be tested in the
2508
+ * playground.
2509
+ */
2510
+ declare interface RequestInitCfProperties extends Record<string, unknown> {
2511
+ cacheEverything?: boolean;
2512
+ /**
2513
+ * A request's cache key is what determines if two requests are
2514
+ * "the same" for caching purposes. If a request has the same cache key
2515
+ * as some previous request, then we can serve the same cached response for
2516
+ * both. (e.g. 'some-key')
2517
+ *
2518
+ * Only available for Enterprise customers.
2519
+ */
2520
+ cacheKey?: string;
2521
+ /**
2522
+ * This allows you to append additional Cache-Tag response headers
2523
+ * to the origin response without modifications to the origin server.
2524
+ * This will allow for greater control over the Purge by Cache Tag feature
2525
+ * utilizing changes only in the Workers process.
2526
+ *
2527
+ * Only available for Enterprise customers.
2528
+ */
2529
+ cacheTags?: string[];
2530
+ /**
2531
+ * Force response to be cached for a given number of seconds. (e.g. 300)
2532
+ */
2533
+ cacheTtl?: number;
2534
+ /**
2535
+ * Force response to be cached for a given number of seconds based on the Origin status code.
2536
+ * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })
2537
+ */
2538
+ cacheTtlByStatus?: Record<string, number>;
2539
+ scrapeShield?: boolean;
2540
+ apps?: boolean;
2541
+ image?: RequestInitCfPropertiesImage;
2542
+ minify?: RequestInitCfPropertiesImageMinify;
2543
+ mirage?: boolean;
2544
+ polish?: "lossy" | "lossless" | "off";
2545
+ /**
2546
+ * Redirects the request to an alternate origin server. You can use this,
2547
+ * for example, to implement load balancing across several origins.
2548
+ * (e.g.us-east.example.com)
2549
+ *
2550
+ * Note - For security reasons, the hostname set in resolveOverride must
2551
+ * be proxied on the same Cloudflare zone of the incoming request.
2552
+ * Otherwise, the setting is ignored. CNAME hosts are allowed, so to
2553
+ * resolve to a host under a different domain or a DNS only domain first
2554
+ * declare a CNAME record within your own zone’s DNS mapping to the
2555
+ * external hostname, set proxy on Cloudflare, then set resolveOverride
2556
+ * to point to that CNAME record.
2557
+ */
2558
+ resolveOverride?: string;
2559
+ }
2560
+ declare interface RequestInitCfPropertiesImageDraw
2561
+ extends BasicImageTransformations {
2562
+ /**
2563
+ * Absolute URL of the image file to use for the drawing. It can be any of
2564
+ * the supported file formats. For drawing of watermarks or non-rectangular
2565
+ * overlays we recommend using PNG or WebP images.
2566
+ */
2567
+ url: string;
2568
+ /**
2569
+ * Floating-point number between 0 (transparent) and 1 (opaque).
2570
+ * For example, opacity: 0.5 makes overlay semitransparent.
2571
+ */
2572
+ opacity?: number;
2573
+ /**
2574
+ * - If set to true, the overlay image will be tiled to cover the entire
2575
+ * area. This is useful for stock-photo-like watermarks.
2576
+ * - If set to "x", the overlay image will be tiled horizontally only
2577
+ * (form a line).
2578
+ * - If set to "y", the overlay image will be tiled vertically only
2579
+ * (form a line).
2580
+ */
2581
+ repeat?: true | "x" | "y";
2582
+ /**
2583
+ * Position of the overlay image relative to a given edge. Each property is
2584
+ * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10
2585
+ * positions left side of the overlay 10 pixels from the left edge of the
2586
+ * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom
2587
+ * of the background image.
2588
+ *
2589
+ * Setting both left & right, or both top & bottom is an error.
2590
+ *
2591
+ * If no position is specified, the image will be centered.
2592
+ */
2593
+ top?: number;
2594
+ left?: number;
2595
+ bottom?: number;
2596
+ right?: number;
2597
+ }
2598
+ declare interface RequestInitCfPropertiesImage
2599
+ extends BasicImageTransformations {
2600
+ /**
2601
+ * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it
2602
+ * easier to specify higher-DPI sizes in <img srcset>.
2603
+ */
2604
+ dpr?: number;
2605
+ /**
2606
+ * An object with four properties {left, top, right, bottom} that specify
2607
+ * a number of pixels to cut off on each side. Allows removal of borders
2608
+ * or cutting out a specific fragment of an image. Trimming is performed
2609
+ * before resizing or rotation. Takes dpr into account.
2610
+ */
2611
+ trim?: {
2612
+ left?: number;
2613
+ top?: number;
2614
+ right?: number;
2615
+ bottom?: number;
2616
+ };
2617
+ /**
2618
+ * Quality setting from 1-100 (useful values are in 60-90 range). Lower values
2619
+ * make images look worse, but load faster. The default is 85. It applies only
2620
+ * to JPEG and WebP images. It doesn’t have any effect on PNG.
2621
+ */
2622
+ quality?: number;
2623
+ /**
2624
+ * Output format to generate. It can be:
2625
+ * - avif: generate images in AVIF format.
2626
+ * - webp: generate images in Google WebP format. Set quality to 100 to get
2627
+ * the WebP-lossless format.
2628
+ * - json: instead of generating an image, outputs information about the
2629
+ * image, in JSON format. The JSON object will contain image size
2630
+ * (before and after resizing), source image’s MIME type, file size, etc.
2631
+ * - jpeg: generate images in JPEG format.
2632
+ * - png: generate images in PNG format.
2633
+ */
2634
+ format?: "avif" | "webp" | "json" | "jpeg" | "png";
2635
+ /**
2636
+ * Whether to preserve animation frames from input files. Default is true.
2637
+ * Setting it to false reduces animations to still images. This setting is
2638
+ * recommended when enlarging images or processing arbitrary user content,
2639
+ * because large GIF animations can weigh tens or even hundreds of megabytes.
2640
+ * It is also useful to set anim:false when using format:"json" to get the
2641
+ * response quicker without the number of frames.
2642
+ */
2643
+ anim?: boolean;
2644
+ /**
2645
+ * What EXIF data should be preserved in the output image. Note that EXIF
2646
+ * rotation and embedded color profiles are always applied ("baked in" into
2647
+ * the image), and aren't affected by this option. Note that if the Polish
2648
+ * feature is enabled, all metadata may have been removed already and this
2649
+ * option may have no effect.
2650
+ * - keep: Preserve most of EXIF metadata, including GPS location if there's
2651
+ * any.
2652
+ * - copyright: Only keep the copyright tag, and discard everything else.
2653
+ * This is the default behavior for JPEG files.
2654
+ * - none: Discard all invisible EXIF metadata. Currently WebP and PNG
2655
+ * output formats always discard metadata.
2656
+ */
2657
+ metadata?: "keep" | "copyright" | "none";
2658
+ /**
2659
+ * Strength of sharpening filter to apply to the image. Floating-point
2660
+ * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a
2661
+ * recommended value for downscaled images.
2662
+ */
2663
+ sharpen?: number;
2664
+ /**
2665
+ * Radius of a blur filter (approximate gaussian). Maximum supported radius
2666
+ * is 250.
2667
+ */
2668
+ blur?: number;
2669
+ /**
2670
+ * Overlays are drawn in the order they appear in the array (last array
2671
+ * entry is the topmost layer).
2672
+ */
2673
+ draw?: RequestInitCfPropertiesImageDraw[];
2674
+ /**
2675
+ * Fetching image from authenticated origin. Setting this property will
2676
+ * pass authentication headers (Authorization, Cookie, etc.) through to
2677
+ * the origin.
2678
+ */
2679
+ "origin-auth"?: "share-publicly";
2680
+ /**
2681
+ * Adds a border around the image. The border is added after resizing. Border
2682
+ * width takes dpr into account, and can be specified either using a single
2683
+ * width property, or individually for each side.
2684
+ */
2685
+ border?:
2686
+ | {
2687
+ color: string;
2688
+ width: number;
2689
+ }
2690
+ | {
2691
+ color: string;
2692
+ top: number;
2693
+ right: number;
2694
+ bottom: number;
2695
+ left: number;
2696
+ };
2697
+ /**
2698
+ * Increase brightness by a factor. A value of 1.0 equals no change, a value
2699
+ * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
2700
+ * 0 is ignored.
2701
+ */
2702
+ brightness?: number;
2703
+ /**
2704
+ * Increase contrast by a factor. A value of 1.0 equals no change, a value of
2705
+ * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
2706
+ * ignored.
2707
+ */
2708
+ contrast?: number;
2709
+ /**
2710
+ * Increase exposure by a factor. A value of 1.0 equals no change, a value of
2711
+ * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
2712
+ */
2713
+ gamma?: number;
2714
+ /**
2715
+ * Slightly reduces latency on a cache miss by selecting a
2716
+ * quickest-to-compress file format, at a cost of increased file size and
2717
+ * lower image quality. It will usually override the format option and choose
2718
+ * JPEG over WebP or AVIF. We do not recommend using this option, except in
2719
+ * unusual circumstances like resizing uncacheable dynamically-generated
2720
+ * images.
2721
+ */
2722
+ compression?: "fast";
2723
+ }
2724
+ declare interface RequestInitCfPropertiesImageMinify {
2725
+ javascript?: boolean;
2726
+ css?: boolean;
2727
+ html?: boolean;
2728
+ }
2729
+ /**
2730
+ * Request metadata provided by Cloudflare's edge.
2731
+ */
2732
+ declare type IncomingRequestCfProperties<HostMetadata = unknown> =
2733
+ IncomingRequestCfPropertiesBase &
2734
+ IncomingRequestCfPropertiesBotManagementEnterprise &
2735
+ IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
2736
+ IncomingRequestCfPropertiesGeographicInformation &
2737
+ IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
2738
+ declare interface IncomingRequestCfPropertiesBase
2739
+ extends Record<string, unknown> {
2740
+ /**
2741
+ * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
2742
+ *
2743
+ * @example 395747
2744
+ */
2745
+ asn: number;
2746
+ /**
2747
+ * The organization which owns the ASN of the incoming request.
2748
+ *
2749
+ * @example "Google Cloud"
2750
+ */
2751
+ asOrganization: string;
2752
+ /**
2753
+ * The original value of the `Accept-Encoding` header if Cloudflare modified it.
2754
+ *
2755
+ * @example "gzip, deflate, br"
2756
+ */
2757
+ clientAcceptEncoding?: string;
2758
+ /**
2759
+ * The number of milliseconds it took for the request to reach your worker.
2760
+ *
2761
+ * @example 22
2762
+ */
2763
+ clientTcpRtt?: number;
2764
+ /**
2765
+ * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code)
2766
+ * airport code of the data center that the request hit.
2767
+ *
2768
+ * @example "DFW"
2769
+ */
2770
+ colo: string;
2771
+ /**
2772
+ * Represents the upstream's response to a
2773
+ * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html)
2774
+ * from cloudflare.
2775
+ *
2776
+ * For workers with no upstream, this will always be `1`.
2777
+ *
2778
+ * @example 3
2779
+ */
2780
+ edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus;
2781
+ /**
2782
+ * The HTTP Protocol the request used.
2783
+ *
2784
+ * @example "HTTP/2"
2785
+ */
2786
+ httpProtocol: string;
2787
+ /**
2788
+ * The browser-requested prioritization information in the request object.
2789
+ *
2790
+ * If no information was set, defaults to the empty string `""`
2791
+ *
2792
+ * @example "weight=192;exclusive=0;group=3;group-weight=127"
2793
+ * @default ""
2794
+ */
2795
+ requestPriority: string;
2796
+ /**
2797
+ * The TLS version of the connection to Cloudflare.
2798
+ * In requests served over plaintext (without TLS), this property is the empty string `""`.
2799
+ *
2800
+ * @example "TLSv1.3"
2801
+ */
2802
+ tlsVersion: string;
2803
+ /**
2804
+ * The cipher for the connection to Cloudflare.
2805
+ * In requests served over plaintext (without TLS), this property is the empty string `""`.
2806
+ *
2807
+ * @example "AEAD-AES128-GCM-SHA256"
2808
+ */
2809
+ tlsCipher: string;
2810
+ /**
2811
+ * 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.
2812
+ *
2813
+ * If the incoming request was served over plaintext (without TLS) this field is undefined.
2814
+ */
2815
+ tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata;
2816
+ }
2817
+ declare interface IncomingRequestCfPropertiesBotManagementBase {
2818
+ /**
2819
+ * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
2820
+ * represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
2821
+ *
2822
+ * @example 54
2823
+ */
2824
+ score: number;
2825
+ /**
2826
+ * A boolean value that is true if the request comes from a good bot, like Google or Bing.
2827
+ * 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).
2828
+ */
2829
+ verifiedBot: boolean;
2830
+ /**
2831
+ * A boolean value that is true if the request originates from a
2832
+ * Cloudflare-verified proxy service.
2833
+ */
2834
+ corporateProxy: boolean;
2835
+ /**
2836
+ * 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.
2837
+ */
2838
+ staticResource: boolean;
2839
+ /**
2840
+ * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request).
2841
+ */
2842
+ detectionIds: number[];
2843
+ }
2844
+ declare interface IncomingRequestCfPropertiesBotManagement {
2845
+ /**
2846
+ * Results of Cloudflare's Bot Management analysis
2847
+ */
2848
+ botManagement: IncomingRequestCfPropertiesBotManagementBase;
2849
+ /**
2850
+ * Duplicate of `botManagement.score`.
2851
+ *
2852
+ * @deprecated
2853
+ */
2854
+ clientTrustScore: number;
2855
+ }
2856
+ declare interface IncomingRequestCfPropertiesBotManagementEnterprise
2857
+ extends IncomingRequestCfPropertiesBotManagement {
2858
+ /**
2859
+ * Results of Cloudflare's Bot Management analysis
2860
+ */
2861
+ botManagement: IncomingRequestCfPropertiesBotManagementBase & {
2862
+ /**
2863
+ * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients
2864
+ * across different destination IPs, Ports, and X509 certificates.
2865
+ */
2866
+ ja3Hash: string;
2867
+ };
2868
+ }
2869
+ declare interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<
2870
+ HostMetadata
2871
+ > {
2872
+ /**
2873
+ * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/).
2874
+ *
2875
+ * This field is only present if you have Cloudflare for SaaS enabled on your account
2876
+ * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)).
2877
+ */
2878
+ hostMetadata: HostMetadata;
2879
+ }
2880
+ declare interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield {
2881
+ /**
2882
+ * Information about the client certificate presented to Cloudflare.
2883
+ *
2884
+ * This is populated when the incoming request is served over TLS using
2885
+ * either Cloudflare Access or API Shield (mTLS)
2886
+ * and the presented SSL certificate has a valid
2887
+ * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number)
2888
+ * (i.e., not `null` or `""`).
2889
+ *
2890
+ * Otherwise, a set of placeholder values are used.
2891
+ *
2892
+ * The property `certPresented` will be set to `"1"` when
2893
+ * the object is populated (i.e. the above conditions were met).
2894
+ */
2895
+ tlsClientAuth:
2896
+ | IncomingRequestCfPropertiesTLSClientAuth
2897
+ | IncomingRequestCfPropertiesTLSClientAuthPlaceholder;
2898
+ }
2899
+ /**
2900
+ * Metadata about the request's TLS handshake
2901
+ */
2902
+ declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
2903
+ /**
2904
+ * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal
2905
+ *
2906
+ * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d"
2907
+ */
2908
+ clientHandshake: string;
2909
+ /**
2910
+ * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal
2911
+ *
2912
+ * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d"
2913
+ */
2914
+ serverHandshake: string;
2915
+ /**
2916
+ * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal
2917
+ *
2918
+ * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b"
2919
+ */
2920
+ clientFinished: string;
2921
+ /**
2922
+ * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal
2923
+ *
2924
+ * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b"
2925
+ */
2926
+ serverFinished: string;
2927
+ }
2928
+ /**
2929
+ * Geographic data about the request's origin.
2930
+ */
2931
+ declare interface IncomingRequestCfPropertiesGeographicInformation {
2932
+ /**
2933
+ * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
2934
+ *
2935
+ * 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.
2936
+ *
2937
+ * If Cloudflare is unable to determine where the request originated this property is omitted.
2938
+ *
2939
+ * The country code `"T1"` is used for requests originating on TOR.
2940
+ *
2941
+ * @example "GB"
2942
+ */
2943
+ country?: Iso3166Alpha2Code | "T1";
2944
+ /**
2945
+ * If present, this property indicates that the request originated in the EU
2946
+ *
2947
+ * @example "1"
2948
+ */
2949
+ isEUCountry?: "1";
2950
+ /**
2951
+ * A two-letter code indicating the continent the request originated from.
2952
+ *
2953
+ * @example "AN"
2954
+ */
2955
+ continent?: ContinentCode;
2956
+ /**
2957
+ * The city the request originated from
2958
+ *
2959
+ * @example "Austin"
2960
+ */
2961
+ city?: string;
2962
+ /**
2963
+ * Postal code of the incoming request
2964
+ *
2965
+ * @example "78701"
2966
+ */
2967
+ postalCode?: string;
2968
+ /**
2969
+ * Latitude of the incoming request
2970
+ *
2971
+ * @example "30.27130"
2972
+ */
2973
+ latitude?: string;
2974
+ /**
2975
+ * Longitude of the incoming request
2976
+ *
2977
+ * @example "-97.74260"
2978
+ */
2979
+ longitude?: string;
2980
+ /**
2981
+ * Timezone of the incoming request
2982
+ *
2983
+ * @example "America/Chicago"
2984
+ */
2985
+ timezone?: string;
2986
+ /**
2987
+ * If known, the ISO 3166-2 name for the first level region associated with
2988
+ * the IP address of the incoming request
2989
+ *
2990
+ * @example "Texas"
2991
+ */
2992
+ region?: string;
2993
+ /**
2994
+ * If known, the ISO 3166-2 code for the first-level region associated with
2995
+ * the IP address of the incoming request
2996
+ *
2997
+ * @example "TX"
2998
+ */
2999
+ regionCode?: string;
3000
+ /**
3001
+ * Metro code (DMA) of the incoming request
3002
+ *
3003
+ * @example "635"
3004
+ */
3005
+ metroCode?: string;
3006
+ }
3007
+ /** Data about the incoming request's TLS certificate */
3008
+ declare interface IncomingRequestCfPropertiesTLSClientAuth {
3009
+ /** Always `"1"`, indicating that the certificate was presented */
3010
+ certPresented: "1";
3011
+ /**
3012
+ * Result of certificate verification.
3013
+ *
3014
+ * @example "FAILED:self signed certificate"
3015
+ */
3016
+ certVerified: Exclude<CertVerificationStatus, "NONE">;
3017
+ /** The presented certificate's revokation status.
3018
+ *
3019
+ * - A value of `"1"` indicates the certificate has been revoked
3020
+ * - A value of `"0"` indicates the certificate has not been revoked
3021
+ */
3022
+ certRevoked: "1" | "0";
3023
+ /**
3024
+ * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)
3025
+ *
3026
+ * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
3027
+ */
3028
+ certIssuerDN: string;
3029
+ /**
3030
+ * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)
3031
+ *
3032
+ * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
3033
+ */
3034
+ certSubjectDN: string;
3035
+ /**
3036
+ * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)
3037
+ *
3038
+ * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
3039
+ */
3040
+ certIssuerDNRFC2253: string;
3041
+ /**
3042
+ * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)
3043
+ *
3044
+ * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"
3045
+ */
3046
+ certSubjectDNRFC2253: string;
3047
+ /** The certificate issuer's distinguished name (legacy policies) */
3048
+ certIssuerDNLegacy: string;
3049
+ /** The certificate subject's distinguished name (legacy policies) */
3050
+ certSubjectDNLegacy: string;
3051
+ /**
3052
+ * The certificate's serial number
3053
+ *
3054
+ * @example "00936EACBE07F201DF"
3055
+ */
3056
+ certSerial: string;
3057
+ /**
3058
+ * The certificate issuer's serial number
3059
+ *
3060
+ * @example "2489002934BDFEA34"
3061
+ */
3062
+ certIssuerSerial: string;
3063
+ /**
3064
+ * The certificate's Subject Key Identifier
3065
+ *
3066
+ * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4"
3067
+ */
3068
+ certSKI: string;
3069
+ /**
3070
+ * The certificate issuer's Subject Key Identifier
3071
+ *
3072
+ * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4"
3073
+ */
3074
+ certIssuerSKI: string;
3075
+ /**
3076
+ * The certificate's SHA-1 fingerprint
3077
+ *
3078
+ * @example "6b9109f323999e52259cda7373ff0b4d26bd232e"
3079
+ */
3080
+ certFingerprintSHA1: string;
3081
+ /**
3082
+ * The certificate's SHA-256 fingerprint
3083
+ *
3084
+ * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea"
3085
+ */
3086
+ certFingerprintSHA256: string;
3087
+ /**
3088
+ * The effective starting date of the certificate
3089
+ *
3090
+ * @example "Dec 22 19:39:00 2018 GMT"
3091
+ */
3092
+ certNotBefore: string;
3093
+ /**
3094
+ * The effective expiration date of the certificate
3095
+ *
3096
+ * @example "Dec 22 19:39:00 2018 GMT"
3097
+ */
3098
+ certNotAfter: string;
3099
+ }
3100
+ /** Placeholder values for TLS Client Authorization */
3101
+ declare interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {
3102
+ certPresented: "0";
3103
+ certVerified: "NONE";
3104
+ certRevoked: "0";
3105
+ certIssuerDN: "";
3106
+ certSubjectDN: "";
3107
+ certIssuerDNRFC2253: "";
3108
+ certSubjectDNRFC2253: "";
3109
+ certIssuerDNLegacy: "";
3110
+ certSubjectDNLegacy: "";
3111
+ certSerial: "";
3112
+ certIssuerSerial: "";
3113
+ certSKI: "";
3114
+ certIssuerSKI: "";
3115
+ certFingerprintSHA1: "";
3116
+ certFingerprintSHA256: "";
3117
+ certNotBefore: "";
3118
+ certNotAfter: "";
3119
+ }
3120
+ /** Possible outcomes of TLS verification */
3121
+ declare type CertVerificationStatus =
3122
+ /** Authentication succeeded */
3123
+ | "SUCCESS"
3124
+ /** No certificate was presented */
3125
+ | "NONE"
3126
+ /** Failed because the certificate was self-signed */
3127
+ | "FAILED:self signed certificate"
3128
+ /** Failed because the certificate failed a trust chain check */
3129
+ | "FAILED:unable to verify the first certificate"
3130
+ /** Failed because the certificate not yet valid */
3131
+ | "FAILED:certificate is not yet valid"
3132
+ /** Failed because the certificate is expired */
3133
+ | "FAILED:certificate has expired"
3134
+ /** Failed for another unspecified reason */
3135
+ | "FAILED";
3136
+ /**
3137
+ * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare.
3138
+ */
3139
+ declare type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus =
3140
+ | 0 /** Unknown */
3141
+ | 1 /** no keepalives (not found) */
3142
+ | 2 /** no connection re-use, opening keepalive connection failed */
3143
+ | 3 /** no connection re-use, keepalive accepted and saved */
3144
+ | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */
3145
+ | 5; /** connection re-use, accepted by the origin server */
3146
+ /** ISO 3166-1 Alpha-2 codes */
3147
+ declare type Iso3166Alpha2Code =
3148
+ | "AD"
3149
+ | "AE"
3150
+ | "AF"
3151
+ | "AG"
3152
+ | "AI"
3153
+ | "AL"
3154
+ | "AM"
3155
+ | "AO"
3156
+ | "AQ"
3157
+ | "AR"
3158
+ | "AS"
3159
+ | "AT"
3160
+ | "AU"
3161
+ | "AW"
3162
+ | "AX"
3163
+ | "AZ"
3164
+ | "BA"
3165
+ | "BB"
3166
+ | "BD"
3167
+ | "BE"
3168
+ | "BF"
3169
+ | "BG"
3170
+ | "BH"
3171
+ | "BI"
3172
+ | "BJ"
3173
+ | "BL"
3174
+ | "BM"
3175
+ | "BN"
3176
+ | "BO"
3177
+ | "BQ"
3178
+ | "BR"
3179
+ | "BS"
3180
+ | "BT"
3181
+ | "BV"
3182
+ | "BW"
3183
+ | "BY"
3184
+ | "BZ"
3185
+ | "CA"
3186
+ | "CC"
3187
+ | "CD"
3188
+ | "CF"
3189
+ | "CG"
3190
+ | "CH"
3191
+ | "CI"
3192
+ | "CK"
3193
+ | "CL"
3194
+ | "CM"
3195
+ | "CN"
3196
+ | "CO"
3197
+ | "CR"
3198
+ | "CU"
3199
+ | "CV"
3200
+ | "CW"
3201
+ | "CX"
3202
+ | "CY"
3203
+ | "CZ"
3204
+ | "DE"
3205
+ | "DJ"
3206
+ | "DK"
3207
+ | "DM"
3208
+ | "DO"
3209
+ | "DZ"
3210
+ | "EC"
3211
+ | "EE"
3212
+ | "EG"
3213
+ | "EH"
3214
+ | "ER"
3215
+ | "ES"
3216
+ | "ET"
3217
+ | "FI"
3218
+ | "FJ"
3219
+ | "FK"
3220
+ | "FM"
3221
+ | "FO"
3222
+ | "FR"
3223
+ | "GA"
3224
+ | "GB"
3225
+ | "GD"
3226
+ | "GE"
3227
+ | "GF"
3228
+ | "GG"
3229
+ | "GH"
3230
+ | "GI"
3231
+ | "GL"
3232
+ | "GM"
3233
+ | "GN"
3234
+ | "GP"
3235
+ | "GQ"
3236
+ | "GR"
3237
+ | "GS"
3238
+ | "GT"
3239
+ | "GU"
3240
+ | "GW"
3241
+ | "GY"
3242
+ | "HK"
3243
+ | "HM"
3244
+ | "HN"
3245
+ | "HR"
3246
+ | "HT"
3247
+ | "HU"
3248
+ | "ID"
3249
+ | "IE"
3250
+ | "IL"
3251
+ | "IM"
3252
+ | "IN"
3253
+ | "IO"
3254
+ | "IQ"
3255
+ | "IR"
3256
+ | "IS"
3257
+ | "IT"
3258
+ | "JE"
3259
+ | "JM"
3260
+ | "JO"
3261
+ | "JP"
3262
+ | "KE"
3263
+ | "KG"
3264
+ | "KH"
3265
+ | "KI"
3266
+ | "KM"
3267
+ | "KN"
3268
+ | "KP"
3269
+ | "KR"
3270
+ | "KW"
3271
+ | "KY"
3272
+ | "KZ"
3273
+ | "LA"
3274
+ | "LB"
3275
+ | "LC"
3276
+ | "LI"
3277
+ | "LK"
3278
+ | "LR"
3279
+ | "LS"
3280
+ | "LT"
3281
+ | "LU"
3282
+ | "LV"
3283
+ | "LY"
3284
+ | "MA"
3285
+ | "MC"
3286
+ | "MD"
3287
+ | "ME"
3288
+ | "MF"
3289
+ | "MG"
3290
+ | "MH"
3291
+ | "MK"
3292
+ | "ML"
3293
+ | "MM"
3294
+ | "MN"
3295
+ | "MO"
3296
+ | "MP"
3297
+ | "MQ"
3298
+ | "MR"
3299
+ | "MS"
3300
+ | "MT"
3301
+ | "MU"
3302
+ | "MV"
3303
+ | "MW"
3304
+ | "MX"
3305
+ | "MY"
3306
+ | "MZ"
3307
+ | "NA"
3308
+ | "NC"
3309
+ | "NE"
3310
+ | "NF"
3311
+ | "NG"
3312
+ | "NI"
3313
+ | "NL"
3314
+ | "NO"
3315
+ | "NP"
3316
+ | "NR"
3317
+ | "NU"
3318
+ | "NZ"
3319
+ | "OM"
3320
+ | "PA"
3321
+ | "PE"
3322
+ | "PF"
3323
+ | "PG"
3324
+ | "PH"
3325
+ | "PK"
3326
+ | "PL"
3327
+ | "PM"
3328
+ | "PN"
3329
+ | "PR"
3330
+ | "PS"
3331
+ | "PT"
3332
+ | "PW"
3333
+ | "PY"
3334
+ | "QA"
3335
+ | "RE"
3336
+ | "RO"
3337
+ | "RS"
3338
+ | "RU"
3339
+ | "RW"
3340
+ | "SA"
3341
+ | "SB"
3342
+ | "SC"
3343
+ | "SD"
3344
+ | "SE"
3345
+ | "SG"
3346
+ | "SH"
3347
+ | "SI"
3348
+ | "SJ"
3349
+ | "SK"
3350
+ | "SL"
3351
+ | "SM"
3352
+ | "SN"
3353
+ | "SO"
3354
+ | "SR"
3355
+ | "SS"
3356
+ | "ST"
3357
+ | "SV"
3358
+ | "SX"
3359
+ | "SY"
3360
+ | "SZ"
3361
+ | "TC"
3362
+ | "TD"
3363
+ | "TF"
3364
+ | "TG"
3365
+ | "TH"
3366
+ | "TJ"
3367
+ | "TK"
3368
+ | "TL"
3369
+ | "TM"
3370
+ | "TN"
3371
+ | "TO"
3372
+ | "TR"
3373
+ | "TT"
3374
+ | "TV"
3375
+ | "TW"
3376
+ | "TZ"
3377
+ | "UA"
3378
+ | "UG"
3379
+ | "UM"
3380
+ | "US"
3381
+ | "UY"
3382
+ | "UZ"
3383
+ | "VA"
3384
+ | "VC"
3385
+ | "VE"
3386
+ | "VG"
3387
+ | "VI"
3388
+ | "VN"
3389
+ | "VU"
3390
+ | "WF"
3391
+ | "WS"
3392
+ | "YE"
3393
+ | "YT"
3394
+ | "ZA"
3395
+ | "ZM"
3396
+ | "ZW";
3397
+ /** The 2-letter continent codes Cloudflare uses */
3398
+ declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
3399
+ declare type CfProperties<HostMetadata = unknown> =
3400
+ | IncomingRequestCfProperties<HostMetadata>
3401
+ | RequestInitCfProperties;
3402
+ declare interface D1Meta {
3403
+ duration: number;
3404
+ size_after: number;
3405
+ rows_read: number;
3406
+ rows_written: number;
3407
+ last_row_id: number;
3408
+ changed_db: boolean;
3409
+ changes: number;
3410
+ }
3411
+ declare interface D1Result<T = unknown> {
3412
+ results: T[];
3413
+ success: true;
3414
+ meta: D1Meta & Record<string, unknown>;
3415
+ error?: never;
3416
+ }
3417
+ declare interface D1ExecResult {
3418
+ count: number;
3419
+ duration: number;
3420
+ }
3421
+ declare abstract class D1Database {
3422
+ prepare(query: string): D1PreparedStatement;
3423
+ dump(): Promise<ArrayBuffer>;
3424
+ batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
3425
+ exec(query: string): Promise<D1ExecResult>;
3426
+ }
3427
+ declare abstract class D1PreparedStatement {
3428
+ bind(...values: unknown[]): D1PreparedStatement;
3429
+ first<T = unknown>(colName: string): Promise<T | null>;
3430
+ first<T = Record<string, unknown>>(): Promise<T | null>;
3431
+ run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
3432
+ all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
3433
+ raw<T = unknown[]>(): Promise<T[]>;
3434
+ }
3435
+ /**
3436
+ * An email message that can be sent from a Worker.
3437
+ */
3438
+ declare interface EmailMessage {
3439
+ /**
3440
+ * Envelope From attribute of the email message.
3441
+ */
3442
+ readonly from: string;
3443
+ /**
3444
+ * Envelope To attribute of the email message.
3445
+ */
3446
+ readonly to: string;
3447
+ }
3448
+ /**
3449
+ * An email message that is sent to a consumer Worker and can be rejected/forwarded.
3450
+ */
3451
+ declare interface ForwardableEmailMessage extends EmailMessage {
3452
+ /**
3453
+ * Stream of the email message content.
3454
+ */
3455
+ readonly raw: ReadableStream;
3456
+ /**
3457
+ * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
3458
+ */
3459
+ readonly headers: Headers;
3460
+ /**
3461
+ * Size of the email message content.
3462
+ */
3463
+ readonly rawSize: number;
3464
+ /**
3465
+ * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
3466
+ * @param reason The reject reason.
3467
+ * @returns void
3468
+ */
3469
+ setReject(reason: string): void;
3470
+ /**
3471
+ * Forward this email message to a verified destination address of the account.
3472
+ * @param rcptTo Verified destination address.
3473
+ * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
3474
+ * @returns A promise that resolves when the email message is forwarded.
3475
+ */
3476
+ forward(rcptTo: string, headers?: Headers): Promise<void>;
3477
+ }
3478
+ /**
3479
+ * A binding that allows a Worker to send email messages.
3480
+ */
3481
+ declare interface SendEmail {
3482
+ send(message: EmailMessage): Promise<void>;
3483
+ }
3484
+ declare abstract class EmailEvent extends ExtendableEvent {
3485
+ readonly message: ForwardableEmailMessage;
3486
+ }
3487
+ declare type EmailExportedHandler<Env = unknown> = (
3488
+ message: ForwardableEmailMessage,
3489
+ env: Env,
3490
+ ctx: ExecutionContext
3491
+ ) => void | Promise<void>;
3492
+ declare module "cloudflare:email" {
3493
+ let _EmailMessage: {
3494
+ prototype: EmailMessage;
3495
+ new (from: string, to: string, raw: ReadableStream | string): EmailMessage;
3496
+ };
3497
+ export { _EmailMessage as EmailMessage };
3498
+ }
3499
+ declare interface Hyperdrive {
3500
+ /**
3501
+ * Connect directly to Hyperdrive as if it's your database, returning a TCP socket.
3502
+ *
3503
+ * Calling this method returns an idential socket to if you call
3504
+ * `connect("host:port")` using the `host` and `port` fields from this object.
3505
+ * Pick whichever approach works better with your preferred DB client library.
3506
+ *
3507
+ * Note that this socket is not yet authenticated -- it's expected that your
3508
+ * code (or preferably, the client library of your choice) will authenticate
3509
+ * using the information in this class's readonly fields.
3510
+ */
3511
+ connect(): Socket;
3512
+ /**
3513
+ * A valid DB connection string that can be passed straight into the typical
3514
+ * client library/driver/ORM. This will typically be the easiest way to use
3515
+ * Hyperdrive.
3516
+ */
3517
+ readonly connectionString: string;
3518
+ /*
3519
+ * A randomly generated hostname that is only valid within the context of the
3520
+ * currently running Worker which, when passed into `connect()` function from
3521
+ * the "cloudflare:sockets" module, will connect to the Hyperdrive instance
3522
+ * for your database.
3523
+ */
3524
+ readonly host: string;
3525
+ /*
3526
+ * The port that must be paired the the host field when connecting.
3527
+ */
3528
+ readonly port: string;
3529
+ /*
3530
+ * The username to use when authenticating to your database via Hyperdrive.
3531
+ * Unlike the host and password, this will be the same every time
3532
+ */
3533
+ readonly user: string;
3534
+ /*
3535
+ * The randomly generated password to use when authenticating to your
3536
+ * database via Hyperdrive. Like the host field, this password is only valid
3537
+ * within the context of the currently running Worker instance from which
3538
+ * it's read.
3539
+ */
3540
+ readonly password: string;
3541
+ /*
3542
+ * The name of the database to connect to.
3543
+ */
3544
+ readonly database: string;
3545
+ }
3546
+ declare type Params<P extends string = any> = Record<P, string | string[]>;
3547
+ declare type EventContext<Env, P extends string, Data> = {
3548
+ request: Request;
3549
+ functionPath: string;
3550
+ waitUntil: (promise: Promise<any>) => void;
3551
+ passThroughOnException: () => void;
3552
+ next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
3553
+ env: Env & {
3554
+ ASSETS: {
3555
+ fetch: typeof fetch;
3556
+ };
3557
+ };
3558
+ params: Params<P>;
3559
+ data: Data;
3560
+ };
3561
+ declare type PagesFunction<
3562
+ Env = unknown,
3563
+ Params extends string = any,
3564
+ Data extends Record<string, unknown> = Record<string, unknown>
3565
+ > = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
3566
+ declare type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
3567
+ request: Request;
3568
+ functionPath: string;
3569
+ waitUntil: (promise: Promise<any>) => void;
3570
+ passThroughOnException: () => void;
3571
+ next: (input?: Request | string, init?: RequestInit) => Promise<Response>;
3572
+ env: Env & {
3573
+ ASSETS: {
3574
+ fetch: typeof fetch;
3575
+ };
3576
+ };
3577
+ params: Params<P>;
3578
+ data: Data;
3579
+ pluginArgs: PluginArgs;
3580
+ };
3581
+ declare type PagesPluginFunction<
3582
+ Env = unknown,
3583
+ Params extends string = any,
3584
+ Data extends Record<string, unknown> = Record<string, unknown>,
3585
+ PluginArgs = unknown
3586
+ > = (
3587
+ context: EventPluginContext<Env, Params, Data, PluginArgs>
3588
+ ) => Response | Promise<Response>;
3589
+ declare module "assets:*" {
3590
+ export const onRequest: PagesFunction;
3591
+ }
3592
+ // PubSubMessage represents an incoming PubSub message.
3593
+ // The message includes metadata about the broker, the client, and the payload
3594
+ // itself.
3595
+ // https://developers.cloudflare.com/pub-sub/
3596
+ declare interface PubSubMessage {
3597
+ // Message ID
3598
+ readonly mid: number;
3599
+ // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
3600
+ readonly broker: string;
3601
+ // The MQTT topic the message was sent on.
3602
+ readonly topic: string;
3603
+ // The client ID of the client that published this message.
3604
+ readonly clientId: string;
3605
+ // The unique identifier (JWT ID) used by the client to authenticate, if token
3606
+ // auth was used.
3607
+ readonly jti?: string;
3608
+ // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
3609
+ // received the message from the client.
3610
+ readonly receivedAt: number;
3611
+ // An (optional) string with the MIME type of the payload, if set by the
3612
+ // client.
3613
+ readonly contentType: string;
3614
+ // Set to 1 when the payload is a UTF-8 string
3615
+ // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
3616
+ readonly payloadFormatIndicator: number;
3617
+ // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
3618
+ // You can use payloadFormatIndicator to inspect this before decoding.
3619
+ payload: string | Uint8Array;
3620
+ }
3621
+ // JsonWebKey extended by kid parameter
3622
+ declare interface JsonWebKeyWithKid extends JsonWebKey {
3623
+ // Key Identifier of the JWK
3624
+ readonly kid: string;
3625
+ }
3626
+ declare module "cloudflare:sockets" {
3627
+ function _connect(
3628
+ address: string | SocketAddress,
3629
+ options?: SocketOptions
3630
+ ): Socket;
3631
+ export { _connect as connect };
3632
+ }
3633
+ // Copyright (c) 2022-2023 Cloudflare, Inc.
3634
+ // Licensed under the Apache 2.0 license found in the LICENSE file or at:
3635
+ // https://opensource.org/licenses/Apache-2.0
3636
+ /**
3637
+ * Additional information to associate with a vector.
3638
+ */
3639
+ declare type VectorizeVectorMetadata =
3640
+ | string
3641
+ | number
3642
+ | boolean
3643
+ | string[]
3644
+ | Record<string, string | number | boolean | string[]>;
3645
+ declare type VectorFloatArray = Float32Array | Float64Array;
3646
+ declare interface VectorizeError {
3647
+ code?: number;
3648
+ error: string;
3649
+ }
3650
+ /**
3651
+ * Supported distance metrics for an index.
3652
+ * Distance metrics determine how other "similar" vectors are determined.
3653
+ */
3654
+ declare type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
3655
+ declare interface VectorizeQueryOptions {
3656
+ topK?: number;
3657
+ namespace?: string;
3658
+ returnValues?: boolean;
3659
+ returnMetadata?: boolean;
3660
+ }
3661
+ /**
3662
+ * Information about the configuration of an index.
3663
+ */
3664
+ declare type VectorizeIndexConfig =
3665
+ | {
3666
+ dimensions: number;
3667
+ metric: VectorizeDistanceMetric;
3668
+ }
3669
+ | {
3670
+ preset: string; // keep this generic, as we'll be adding more presets in the future and this is only in a read capacity
3671
+ };
3672
+ /**
3673
+ * Metadata about an existing index.
3674
+ */
3675
+ declare interface VectorizeIndexDetails {
3676
+ /** The unique ID of the index */
3677
+ readonly id: string;
3678
+ /** The name of the index. */
3679
+ name: string;
3680
+ /** (optional) A human readable description for the index. */
3681
+ description?: string;
3682
+ /** The index configuration, including the dimension size and distance metric. */
3683
+ config: VectorizeIndexConfig;
3684
+ /** The number of records containing vectors within the index. */
3685
+ vectorsCount: number;
3686
+ }
3687
+ /**
3688
+ * Represents a single vector value set along with its associated metadata.
3689
+ */
3690
+ declare interface VectorizeVector {
3691
+ /** The ID for the vector. This can be user-defined, and must be unique. It should uniquely identify the object, and is best set based on the ID of what the vector represents. */
3692
+ id: string;
3693
+ /** The vector values */
3694
+ values: VectorFloatArray | number[];
3695
+ /** The namespace this vector belongs to. */
3696
+ namespace?: string;
3697
+ /** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
3698
+ metadata?: Record<string, VectorizeVectorMetadata>;
3699
+ }
3700
+ /**
3701
+ * Represents a matched vector for a query along with its score and (if specified) the matching vector information.
3702
+ */
3703
+ declare type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
3704
+ Omit<VectorizeVector, "values"> & {
3705
+ /** The score or rank for similarity, when returned as a result */
3706
+ score: number;
3707
+ };
3708
+ /**
3709
+ * A set of vector {@link VectorizeMatch} for a particular query.
3710
+ */
3711
+ declare interface VectorizeMatches {
3712
+ matches: VectorizeMatch[];
3713
+ count: number;
3714
+ }
3715
+ /**
3716
+ * Results of an operation that performed a mutation on a set of vectors.
3717
+ * Here, `ids` is a list of vectors that were successfully processed.
3718
+ */
3719
+ declare interface VectorizeVectorMutation {
3720
+ /* List of ids of vectors that were successfully processed. */
3721
+ ids: string[];
3722
+ /* Total count of the number of processed vectors. */
3723
+ count: number;
3724
+ }
3725
+ declare abstract class VectorizeIndex {
3726
+ /**
3727
+ * Get information about the currently bound index.
3728
+ * @returns A promise that resolves with information about the current index.
3729
+ */
3730
+ public describe(): Promise<VectorizeIndexDetails>;
3731
+ /**
3732
+ * Use the provided vector to perform a similarity search across the index.
3733
+ * @param vector Input vector that will be used to drive the similarity search.
3734
+ * @param options Configuration options to massage the returned data.
3735
+ * @returns A promise that resolves with matched and scored vectors.
3736
+ */
3737
+ public query(
3738
+ vector: VectorFloatArray | number[],
3739
+ options: VectorizeQueryOptions
3740
+ ): Promise<VectorizeMatches>;
3741
+ /**
3742
+ * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
3743
+ * @param vectors List of vectors that will be inserted.
3744
+ * @returns A promise that resolves with the ids & count of records that were successfully processed.
3745
+ */
3746
+ public insert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;
3747
+ /**
3748
+ * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
3749
+ * @param vectors List of vectors that will be upserted.
3750
+ * @returns A promise that resolves with the ids & count of records that were successfully processed.
3751
+ */
3752
+ public upsert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;
3753
+ /**
3754
+ * Delete a list of vectors with a matching id.
3755
+ * @param ids List of vector ids that should be deleted.
3756
+ * @returns A promise that resolves with the ids & count of records that were successfully processed (and thus deleted).
3757
+ */
3758
+ public deleteByIds(ids: string[]): Promise<VectorizeVectorMutation>;
3759
+ /**
3760
+ * Get a list of vectors with a matching id.
3761
+ * @param ids List of vector ids that should be returned.
3762
+ * @returns A promise that resolves with the raw unscored vectors matching the id set.
3763
+ */
3764
+ public getByIds(ids: string[]): Promise<VectorizeVector[]>;
3765
+ }
3766
+ declare interface DynamicDispatchLimits {
3767
+ /**
3768
+ * Limit CPU time in milliseconds.
3769
+ */
3770
+ cpuMs?: number;
3771
+ /**
3772
+ * Limit number of subrequests.
3773
+ */
3774
+ subRequests?: number;
3775
+ }
3776
+ declare interface DynamicDispatchOptions {
3777
+ /**
3778
+ * Limit resources of invoked Worker script.
3779
+ */
3780
+ limits?: DynamicDispatchLimits;
3781
+ /**
3782
+ * Arguments for outbound Worker script, if configured.
3783
+ */
3784
+ outbound?: {
3785
+ [key: string]: any;
3786
+ };
3787
+ }
3788
+ declare interface DispatchNamespace {
3789
+ /**
3790
+ * @param name Name of the Worker script.
3791
+ * @param args Arguments to Worker script.
3792
+ * @param options Options for Dynamic Dispatch invocation.
3793
+ * @returns A Fetcher object that allows you to send requests to the Worker script.
3794
+ * @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
3795
+ */
3796
+ get(
3797
+ name: string,
3798
+ args?: {
3799
+ [key: string]: any;
3800
+ },
3801
+ options?: DynamicDispatchOptions
3802
+ ): Fetcher;
3803
+ }