@cloudflare/workers-types 4.20240314.0 → 4.20240329.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.
@@ -16,8 +16,15 @@ and limitations under the License.
16
16
  // noinspection JSUnusedGlobalSymbols
17
17
  export declare class DOMException extends Error {
18
18
  constructor(message?: string, name?: string);
19
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */
19
20
  readonly message: string;
21
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */
20
22
  readonly name: string;
23
+ /**
24
+ * @deprecated
25
+ *
26
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
27
+ */
21
28
  readonly code: number;
22
29
  readonly stack: any;
23
30
  static readonly INDEX_SIZE_ERR: number;
@@ -56,30 +63,61 @@ export type WorkerGlobalScopeEventMap = {
56
63
  export declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {
57
64
  EventTarget: typeof EventTarget;
58
65
  }
66
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console) */
59
67
  export interface Console {
60
68
  "assert"(condition?: boolean, ...data: any[]): void;
69
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static) */
61
70
  clear(): void;
71
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static) */
62
72
  count(label?: string): void;
73
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static) */
63
74
  countReset(label?: string): void;
75
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static) */
64
76
  debug(...data: any[]): void;
77
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static) */
65
78
  dir(item?: any, options?: any): void;
79
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static) */
66
80
  dirxml(...data: any[]): void;
81
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static) */
67
82
  error(...data: any[]): void;
83
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static) */
68
84
  group(...data: any[]): void;
85
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static) */
69
86
  groupCollapsed(...data: any[]): void;
87
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static) */
70
88
  groupEnd(): void;
89
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static) */
71
90
  info(...data: any[]): void;
91
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static) */
72
92
  log(...data: any[]): void;
93
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static) */
73
94
  table(tabularData?: any, properties?: string[]): void;
95
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static) */
74
96
  time(label?: string): void;
97
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static) */
75
98
  timeEnd(label?: string): void;
99
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static) */
76
100
  timeLog(label?: string, ...data: any[]): void;
77
101
  timeStamp(label?: string): void;
102
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static) */
78
103
  trace(...data: any[]): void;
104
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static) */
79
105
  warn(...data: any[]): void;
80
106
  }
81
107
  export declare const console: Console;
82
108
  export type BufferSource = ArrayBufferView | ArrayBuffer;
109
+ export type TypedArray =
110
+ | Int8Array
111
+ | Uint8Array
112
+ | Uint8ClampedArray
113
+ | Int16Array
114
+ | Uint16Array
115
+ | Int32Array
116
+ | Uint32Array
117
+ | Float32Array
118
+ | Float64Array
119
+ | BigInt64Array
120
+ | BigUint64Array;
83
121
  export declare namespace WebAssembly {
84
122
  class CompileError extends Error {
85
123
  constructor(message?: string);
@@ -154,7 +192,11 @@ export declare namespace WebAssembly {
154
192
  function instantiate(module: Module, imports?: Imports): Promise<Instance>;
155
193
  function validate(bytes: BufferSource): boolean;
156
194
  }
157
- /** This ServiceWorker API interface represents the global execution context of a service worker. */
195
+ /**
196
+ * This ServiceWorker API interface represents the global execution context of a service worker.
197
+ *
198
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope)
199
+ */
158
200
  export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
159
201
  DOMException: typeof DOMException;
160
202
  WorkerGlobalScope: typeof WorkerGlobalScope;
@@ -178,7 +220,7 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
178
220
  structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
179
221
  fetch(
180
222
  input: RequestInfo,
181
- init?: RequestInit<RequestInitCfProperties>
223
+ init?: RequestInit<RequestInitCfProperties>,
182
224
  ): Promise<Response>;
183
225
  self: ServiceWorkerGlobalScope;
184
226
  crypto: Crypto;
@@ -245,53 +287,68 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
245
287
  GPUColorWrite: typeof gpuGPUColorWrite;
246
288
  }
247
289
  export declare function addEventListener<
248
- Type extends keyof WorkerGlobalScopeEventMap
290
+ Type extends keyof WorkerGlobalScopeEventMap,
249
291
  >(
250
292
  type: Type,
251
293
  handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
252
- options?: EventTargetAddEventListenerOptions | boolean
294
+ options?: EventTargetAddEventListenerOptions | boolean,
253
295
  ): void;
254
296
  export declare function removeEventListener<
255
- Type extends keyof WorkerGlobalScopeEventMap
297
+ Type extends keyof WorkerGlobalScopeEventMap,
256
298
  >(
257
299
  type: Type,
258
300
  handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
259
- options?: EventTargetEventListenerOptions | boolean
301
+ options?: EventTargetEventListenerOptions | boolean,
260
302
  ): void;
261
- /** 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. */
303
+ /**
304
+ * 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.
305
+ *
306
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
307
+ */
262
308
  export declare function dispatchEvent(
263
- event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]
309
+ event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap],
264
310
  ): boolean;
311
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/btoa) */
265
312
  export declare function btoa(data: string): string;
313
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/atob) */
266
314
  export declare function atob(data: string): string;
315
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
267
316
  export declare function setTimeout(
268
317
  callback: (...args: any[]) => void,
269
- msDelay?: number
318
+ msDelay?: number,
270
319
  ): number;
320
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
271
321
  export declare function setTimeout<Args extends any[]>(
272
322
  callback: (...args: Args) => void,
273
323
  msDelay?: number,
274
324
  ...args: Args
275
325
  ): number;
326
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearTimeout) */
276
327
  export declare function clearTimeout(timeoutId: number | null): void;
328
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
277
329
  export declare function setInterval(
278
330
  callback: (...args: any[]) => void,
279
- msDelay?: number
331
+ msDelay?: number,
280
332
  ): number;
333
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
281
334
  export declare function setInterval<Args extends any[]>(
282
335
  callback: (...args: Args) => void,
283
336
  msDelay?: number,
284
337
  ...args: Args
285
338
  ): number;
339
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearInterval) */
286
340
  export declare function clearInterval(timeoutId: number | null): void;
341
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/queueMicrotask) */
287
342
  export declare function queueMicrotask(task: Function): void;
343
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/structuredClone) */
288
344
  export declare function structuredClone<T>(
289
345
  value: T,
290
- options?: StructuredSerializeOptions
346
+ options?: StructuredSerializeOptions,
291
347
  ): T;
348
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
292
349
  export declare function fetch(
293
350
  input: RequestInfo,
294
- init?: RequestInit<RequestInitCfProperties>
351
+ init?: RequestInit<RequestInitCfProperties>,
295
352
  ): Promise<Response>;
296
353
  export declare const self: ServiceWorkerGlobalScope;
297
354
  export declare const crypto: Crypto;
@@ -306,41 +363,41 @@ export interface ExecutionContext {
306
363
  }
307
364
  export type ExportedHandlerFetchHandler<
308
365
  Env = unknown,
309
- CfHostMetadata = unknown
366
+ CfHostMetadata = unknown,
310
367
  > = (
311
368
  request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
312
369
  env: Env,
313
- ctx: ExecutionContext
370
+ ctx: ExecutionContext,
314
371
  ) => Response | Promise<Response>;
315
372
  export type ExportedHandlerTailHandler<Env = unknown> = (
316
373
  events: TraceItem[],
317
374
  env: Env,
318
- ctx: ExecutionContext
375
+ ctx: ExecutionContext,
319
376
  ) => void | Promise<void>;
320
377
  export type ExportedHandlerTraceHandler<Env = unknown> = (
321
378
  traces: TraceItem[],
322
379
  env: Env,
323
- ctx: ExecutionContext
380
+ ctx: ExecutionContext,
324
381
  ) => void | Promise<void>;
325
382
  export type ExportedHandlerScheduledHandler<Env = unknown> = (
326
383
  controller: ScheduledController,
327
384
  env: Env,
328
- ctx: ExecutionContext
385
+ ctx: ExecutionContext,
329
386
  ) => void | Promise<void>;
330
387
  export type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
331
388
  batch: MessageBatch<Message>,
332
389
  env: Env,
333
- ctx: ExecutionContext
390
+ ctx: ExecutionContext,
334
391
  ) => void | Promise<void>;
335
392
  export type ExportedHandlerTestHandler<Env = unknown> = (
336
393
  controller: TestController,
337
394
  env: Env,
338
- ctx: ExecutionContext
395
+ ctx: ExecutionContext,
339
396
  ) => void | Promise<void>;
340
397
  export interface ExportedHandler<
341
398
  Env = unknown,
342
399
  QueueHandlerMessage = unknown,
343
- CfHostMetadata = unknown
400
+ CfHostMetadata = unknown,
344
401
  > {
345
402
  fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
346
403
  tail?: ExportedHandlerTailHandler<Env>;
@@ -354,12 +411,20 @@ export interface StructuredSerializeOptions {
354
411
  transfer?: any[];
355
412
  }
356
413
  export declare abstract class PromiseRejectionEvent extends Event {
414
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise) */
357
415
  readonly promise: Promise<any>;
416
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason) */
358
417
  readonly reason: any;
359
418
  }
360
- /** 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. */
419
+ /**
420
+ * 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.
421
+ *
422
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance)
423
+ */
361
424
  export interface Performance {
425
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/timeOrigin) */
362
426
  readonly timeOrigin: number;
427
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/now) */
363
428
  now(): number;
364
429
  }
365
430
  export interface AlarmInvocationInfo {
@@ -371,36 +436,42 @@ export interface DurableObject {
371
436
  alarm?(): void | Promise<void>;
372
437
  webSocketMessage?(
373
438
  ws: WebSocket,
374
- message: string | ArrayBuffer
439
+ message: string | ArrayBuffer,
375
440
  ): void | Promise<void>;
376
441
  webSocketClose?(
377
442
  ws: WebSocket,
378
443
  code: number,
379
444
  reason: string,
380
- wasClean: boolean
445
+ wasClean: boolean,
381
446
  ): void | Promise<void>;
382
447
  webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
383
448
  }
384
- export interface DurableObjectStub extends Fetcher {
449
+ export type DurableObjectStub<
450
+ T extends Rpc.DurableObjectBranded | undefined = undefined,
451
+ > = Fetcher<
452
+ T,
453
+ "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
454
+ > & {
385
455
  readonly id: DurableObjectId;
386
456
  readonly name?: string;
387
- }
457
+ };
388
458
  export interface DurableObjectId {
389
459
  toString(): string;
390
460
  equals(other: DurableObjectId): boolean;
391
461
  readonly name?: string;
392
462
  }
393
- export interface DurableObjectNamespace {
463
+ export interface DurableObjectNamespace<
464
+ T extends Rpc.DurableObjectBranded | undefined = undefined,
465
+ > {
394
466
  newUniqueId(
395
- options?: DurableObjectNamespaceNewUniqueIdOptions
467
+ options?: DurableObjectNamespaceNewUniqueIdOptions,
396
468
  ): DurableObjectId;
397
469
  idFromName(name: string): DurableObjectId;
398
470
  idFromString(id: string): DurableObjectId;
399
- get(
400
- id: DurableObjectId,
401
- options?: DurableObjectNamespaceGetDurableObjectOptions
402
- ): DurableObjectStub;
403
- jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
471
+ get(id: DurableObjectId): DurableObjectStub<T>;
472
+ jurisdiction(
473
+ jurisdiction: DurableObjectJurisdiction,
474
+ ): DurableObjectNamespace<T>;
404
475
  }
405
476
  export type DurableObjectJurisdiction = "eu" | "fedramp";
406
477
  export interface DurableObjectNamespaceNewUniqueIdOptions {
@@ -436,23 +507,23 @@ export interface DurableObjectState {
436
507
  export interface DurableObjectTransaction {
437
508
  get<T = unknown>(
438
509
  key: string,
439
- options?: DurableObjectGetOptions
510
+ options?: DurableObjectGetOptions,
440
511
  ): Promise<T | undefined>;
441
512
  get<T = unknown>(
442
513
  keys: string[],
443
- options?: DurableObjectGetOptions
514
+ options?: DurableObjectGetOptions,
444
515
  ): Promise<Map<string, T>>;
445
516
  list<T = unknown>(
446
- options?: DurableObjectListOptions
517
+ options?: DurableObjectListOptions,
447
518
  ): Promise<Map<string, T>>;
448
519
  put<T>(
449
520
  key: string,
450
521
  value: T,
451
- options?: DurableObjectPutOptions
522
+ options?: DurableObjectPutOptions,
452
523
  ): Promise<void>;
453
524
  put<T>(
454
525
  entries: Record<string, T>,
455
- options?: DurableObjectPutOptions
526
+ options?: DurableObjectPutOptions,
456
527
  ): Promise<void>;
457
528
  delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
458
529
  delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
@@ -460,41 +531,41 @@ export interface DurableObjectTransaction {
460
531
  getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
461
532
  setAlarm(
462
533
  scheduledTime: number | Date,
463
- options?: DurableObjectSetAlarmOptions
534
+ options?: DurableObjectSetAlarmOptions,
464
535
  ): Promise<void>;
465
536
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
466
537
  }
467
538
  export interface DurableObjectStorage {
468
539
  get<T = unknown>(
469
540
  key: string,
470
- options?: DurableObjectGetOptions
541
+ options?: DurableObjectGetOptions,
471
542
  ): Promise<T | undefined>;
472
543
  get<T = unknown>(
473
544
  keys: string[],
474
- options?: DurableObjectGetOptions
545
+ options?: DurableObjectGetOptions,
475
546
  ): Promise<Map<string, T>>;
476
547
  list<T = unknown>(
477
- options?: DurableObjectListOptions
548
+ options?: DurableObjectListOptions,
478
549
  ): Promise<Map<string, T>>;
479
550
  put<T>(
480
551
  key: string,
481
552
  value: T,
482
- options?: DurableObjectPutOptions
553
+ options?: DurableObjectPutOptions,
483
554
  ): Promise<void>;
484
555
  put<T>(
485
556
  entries: Record<string, T>,
486
- options?: DurableObjectPutOptions
557
+ options?: DurableObjectPutOptions,
487
558
  ): Promise<void>;
488
559
  delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
489
560
  delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
490
561
  deleteAll(options?: DurableObjectPutOptions): Promise<void>;
491
562
  transaction<T>(
492
- closure: (txn: DurableObjectTransaction) => Promise<T>
563
+ closure: (txn: DurableObjectTransaction) => Promise<T>,
493
564
  ): Promise<T>;
494
565
  getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
495
566
  setAlarm(
496
567
  scheduledTime: number | Date,
497
- options?: DurableObjectSetAlarmOptions
568
+ options?: DurableObjectSetAlarmOptions,
498
569
  ): Promise<void>;
499
570
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
500
571
  sync(): Promise<void>;
@@ -541,22 +612,107 @@ export interface AnalyticsEngineDataPoint {
541
612
  }
542
613
  export declare class Event {
543
614
  constructor(type: string, init?: EventInit);
615
+ /**
616
+ * Returns the type of event, e.g. "click", "hashchange", or "submit".
617
+ *
618
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
619
+ */
544
620
  get type(): string;
621
+ /**
622
+ * Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE.
623
+ *
624
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
625
+ */
545
626
  get eventPhase(): number;
627
+ /**
628
+ * 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.
629
+ *
630
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
631
+ */
546
632
  get composed(): boolean;
633
+ /**
634
+ * 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.
635
+ *
636
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)
637
+ */
547
638
  get bubbles(): boolean;
639
+ /**
640
+ * 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.
641
+ *
642
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)
643
+ */
548
644
  get cancelable(): boolean;
645
+ /**
646
+ * Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise.
647
+ *
648
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)
649
+ */
549
650
  get defaultPrevented(): boolean;
651
+ /**
652
+ * @deprecated
653
+ *
654
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)
655
+ */
550
656
  get returnValue(): boolean;
657
+ /**
658
+ * Returns the object whose event listener's callback is currently being invoked.
659
+ *
660
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
661
+ */
551
662
  get currentTarget(): EventTarget | undefined;
663
+ /**
664
+ * @deprecated
665
+ *
666
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
667
+ */
552
668
  get srcElement(): EventTarget | undefined;
669
+ /**
670
+ * Returns the event's timestamp as the number of milliseconds measured relative to the time origin.
671
+ *
672
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)
673
+ */
553
674
  get timeStamp(): number;
675
+ /**
676
+ * Returns true if event was dispatched by the user agent, and false otherwise.
677
+ *
678
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
679
+ */
554
680
  get isTrusted(): boolean;
681
+ /**
682
+ * @deprecated
683
+ *
684
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
685
+ */
555
686
  get cancelBubble(): boolean;
687
+ /**
688
+ * @deprecated
689
+ *
690
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
691
+ */
556
692
  set cancelBubble(value: boolean);
693
+ /**
694
+ * Invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects.
695
+ *
696
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
697
+ */
557
698
  stopImmediatePropagation(): void;
699
+ /**
700
+ * If invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled.
701
+ *
702
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
703
+ */
558
704
  preventDefault(): void;
705
+ /**
706
+ * When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object.
707
+ *
708
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
709
+ */
559
710
  stopPropagation(): void;
711
+ /**
712
+ * Returns the invocation target objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget.
713
+ *
714
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
715
+ */
560
716
  composedPath(): EventTarget[];
561
717
  static readonly NONE: number;
562
718
  static readonly CAPTURING_PHASE: number;
@@ -569,28 +725,55 @@ export interface EventInit {
569
725
  composed?: boolean;
570
726
  }
571
727
  export type EventListener<EventType extends Event = Event> = (
572
- event: EventType
728
+ event: EventType,
573
729
  ) => void;
574
730
  export interface EventListenerObject<EventType extends Event = Event> {
575
731
  handleEvent(event: EventType): void;
576
732
  }
577
733
  export type EventListenerOrEventListenerObject<
578
- EventType extends Event = Event
734
+ EventType extends Event = Event,
579
735
  > = EventListener<EventType> | EventListenerObject<EventType>;
580
736
  export declare class EventTarget<
581
- EventMap extends Record<string, Event> = Record<string, Event>
737
+ EventMap extends Record<string, Event> = Record<string, Event>,
582
738
  > {
583
739
  constructor();
740
+ /**
741
+ * Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
742
+ *
743
+ * The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
744
+ *
745
+ * When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
746
+ *
747
+ * When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
748
+ *
749
+ * When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
750
+ *
751
+ * If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
752
+ *
753
+ * The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
754
+ *
755
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
756
+ */
584
757
  addEventListener<Type extends keyof EventMap>(
585
758
  type: Type,
586
759
  handler: EventListenerOrEventListenerObject<EventMap[Type]>,
587
- options?: EventTargetAddEventListenerOptions | boolean
760
+ options?: EventTargetAddEventListenerOptions | boolean,
588
761
  ): void;
762
+ /**
763
+ * Removes the event listener in target's event listener list with the same type, callback, and options.
764
+ *
765
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
766
+ */
589
767
  removeEventListener<Type extends keyof EventMap>(
590
768
  type: Type,
591
769
  handler: EventListenerOrEventListenerObject<EventMap[Type]>,
592
- options?: EventTargetEventListenerOptions | boolean
770
+ options?: EventTargetEventListenerOptions | boolean,
593
771
  ): void;
772
+ /**
773
+ * 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.
774
+ *
775
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
776
+ */
594
777
  dispatchEvent(event: EventMap[keyof EventMap]): boolean;
595
778
  }
596
779
  export interface EventTargetEventListenerOptions {
@@ -607,15 +790,34 @@ export interface EventTargetHandlerObject {
607
790
  }
608
791
  export declare class AbortController {
609
792
  constructor();
793
+ /**
794
+ * Returns the AbortSignal object associated with this object.
795
+ *
796
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)
797
+ */
610
798
  get signal(): AbortSignal;
799
+ /**
800
+ * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
801
+ *
802
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)
803
+ */
611
804
  abort(reason?: any): void;
612
805
  }
613
806
  export declare abstract class AbortSignal extends EventTarget {
807
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) */
614
808
  static abort(reason?: any): AbortSignal;
809
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static) */
615
810
  static timeout(delay: number): AbortSignal;
616
811
  static any(signals: AbortSignal[]): AbortSignal;
812
+ /**
813
+ * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
814
+ *
815
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)
816
+ */
617
817
  get aborted(): boolean;
818
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason) */
618
819
  get reason(): any;
820
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted) */
619
821
  throwIfAborted(): void;
620
822
  }
621
823
  export interface Scheduler {
@@ -625,10 +827,16 @@ export interface SchedulerWaitOptions {
625
827
  signal?: AbortSignal;
626
828
  }
627
829
  export declare abstract class ExtendableEvent extends Event {
830
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil) */
628
831
  waitUntil(promise: Promise<any>): void;
629
832
  }
630
833
  export declare class CustomEvent<T = any> extends Event {
631
834
  constructor(type: string, init?: CustomEventCustomEventInit);
835
+ /**
836
+ * Returns any custom data event was created with. Typically used for synthetic events.
837
+ *
838
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
839
+ */
632
840
  get detail(): T;
633
841
  }
634
842
  export interface CustomEventCustomEventInit {
@@ -640,13 +848,19 @@ export interface CustomEventCustomEventInit {
640
848
  export declare class Blob {
641
849
  constructor(
642
850
  bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[],
643
- options?: BlobOptions
851
+ options?: BlobOptions,
644
852
  );
853
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
645
854
  get size(): number;
855
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
646
856
  get type(): string;
857
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
647
858
  slice(start?: number, end?: number, type?: string): Blob;
859
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) */
648
860
  arrayBuffer(): Promise<ArrayBuffer>;
861
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
649
862
  text(): Promise<string>;
863
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream) */
650
864
  stream(): ReadableStream;
651
865
  }
652
866
  export interface BlobOptions {
@@ -656,9 +870,11 @@ export declare class File extends Blob {
656
870
  constructor(
657
871
  bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined,
658
872
  name: string,
659
- options?: FileOptions
873
+ options?: FileOptions,
660
874
  );
875
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
661
876
  get name(): string;
877
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
662
878
  get lastModified(): number;
663
879
  }
664
880
  export interface FileOptions {
@@ -666,6 +882,7 @@ export interface FileOptions {
666
882
  lastModified?: number;
667
883
  }
668
884
  export declare abstract class CacheStorage {
885
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open) */
669
886
  open(cacheName: string): Promise<Cache>;
670
887
  readonly default: Cache;
671
888
  }
@@ -673,7 +890,7 @@ export declare abstract class Cache {
673
890
  delete(request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>;
674
891
  match(
675
892
  request: RequestInfo,
676
- options?: CacheQueryOptions
893
+ options?: CacheQueryOptions,
677
894
  ): Promise<Response | undefined>;
678
895
  put(request: RequestInfo, response: Response): Promise<void>;
679
896
  }
@@ -681,7 +898,13 @@ export interface CacheQueryOptions {
681
898
  ignoreMethod?: boolean;
682
899
  }
683
900
  export declare abstract class Crypto {
901
+ /**
902
+ * Available only in secure contexts.
903
+ *
904
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
905
+ */
684
906
  get subtle(): SubtleCrypto;
907
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */
685
908
  getRandomValues<
686
909
  T extends
687
910
  | Int8Array
@@ -691,8 +914,13 @@ export declare abstract class Crypto {
691
914
  | Int32Array
692
915
  | Uint32Array
693
916
  | BigInt64Array
694
- | BigUint64Array
917
+ | BigUint64Array,
695
918
  >(buffer: T): T;
919
+ /**
920
+ * Available only in secure contexts.
921
+ *
922
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)
923
+ */
696
924
  randomUUID(): string;
697
925
  DigestStream: typeof DigestStream;
698
926
  }
@@ -700,59 +928,63 @@ export declare abstract class SubtleCrypto {
700
928
  encrypt(
701
929
  algorithm: string | SubtleCryptoEncryptAlgorithm,
702
930
  key: CryptoKey,
703
- plainText: ArrayBuffer | ArrayBufferView
931
+ plainText: ArrayBuffer | ArrayBufferView,
704
932
  ): Promise<ArrayBuffer>;
705
933
  decrypt(
706
934
  algorithm: string | SubtleCryptoEncryptAlgorithm,
707
935
  key: CryptoKey,
708
- cipherText: ArrayBuffer | ArrayBufferView
936
+ cipherText: ArrayBuffer | ArrayBufferView,
709
937
  ): Promise<ArrayBuffer>;
710
938
  sign(
711
939
  algorithm: string | SubtleCryptoSignAlgorithm,
712
940
  key: CryptoKey,
713
- data: ArrayBuffer | ArrayBufferView
941
+ data: ArrayBuffer | ArrayBufferView,
714
942
  ): Promise<ArrayBuffer>;
715
943
  verify(
716
944
  algorithm: string | SubtleCryptoSignAlgorithm,
717
945
  key: CryptoKey,
718
946
  signature: ArrayBuffer | ArrayBufferView,
719
- data: ArrayBuffer | ArrayBufferView
947
+ data: ArrayBuffer | ArrayBufferView,
720
948
  ): Promise<boolean>;
721
949
  digest(
722
950
  algorithm: string | SubtleCryptoHashAlgorithm,
723
- data: ArrayBuffer | ArrayBufferView
951
+ data: ArrayBuffer | ArrayBufferView,
724
952
  ): Promise<ArrayBuffer>;
953
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) */
725
954
  generateKey(
726
955
  algorithm: string | SubtleCryptoGenerateKeyAlgorithm,
727
956
  extractable: boolean,
728
- keyUsages: string[]
957
+ keyUsages: string[],
729
958
  ): Promise<CryptoKey | CryptoKeyPair>;
959
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey) */
730
960
  deriveKey(
731
961
  algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
732
962
  baseKey: CryptoKey,
733
963
  derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
734
964
  extractable: boolean,
735
- keyUsages: string[]
965
+ keyUsages: string[],
736
966
  ): Promise<CryptoKey>;
737
967
  deriveBits(
738
968
  algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
739
969
  baseKey: CryptoKey,
740
- length: number | null
970
+ length: number | null,
741
971
  ): Promise<ArrayBuffer>;
972
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) */
742
973
  importKey(
743
974
  format: string,
744
975
  keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey,
745
976
  algorithm: string | SubtleCryptoImportKeyAlgorithm,
746
977
  extractable: boolean,
747
- keyUsages: string[]
978
+ keyUsages: string[],
748
979
  ): Promise<CryptoKey>;
749
980
  exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
750
981
  wrapKey(
751
982
  format: string,
752
983
  key: CryptoKey,
753
984
  wrappingKey: CryptoKey,
754
- wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm
985
+ wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
755
986
  ): Promise<ArrayBuffer>;
987
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey) */
756
988
  unwrapKey(
757
989
  format: string,
758
990
  wrappedKey: ArrayBuffer | ArrayBufferView,
@@ -760,16 +992,19 @@ export declare abstract class SubtleCrypto {
760
992
  unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
761
993
  unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
762
994
  extractable: boolean,
763
- keyUsages: string[]
995
+ keyUsages: string[],
764
996
  ): Promise<CryptoKey>;
765
997
  timingSafeEqual(
766
998
  a: ArrayBuffer | ArrayBufferView,
767
- b: ArrayBuffer | ArrayBufferView
999
+ b: ArrayBuffer | ArrayBufferView,
768
1000
  ): boolean;
769
1001
  }
770
1002
  export declare abstract class CryptoKey {
1003
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) */
771
1004
  readonly type: string;
1005
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable) */
772
1006
  readonly extractable: boolean;
1007
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm) */
773
1008
  readonly algorithm:
774
1009
  | CryptoKeyKeyAlgorithm
775
1010
  | CryptoKeyAesKeyAlgorithm
@@ -777,6 +1012,7 @@ export declare abstract class CryptoKey {
777
1012
  | CryptoKeyRsaKeyAlgorithm
778
1013
  | CryptoKeyEllipticKeyAlgorithm
779
1014
  | CryptoKeyArbitraryKeyAlgorithm;
1015
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages) */
780
1016
  readonly usages: string[];
781
1017
  }
782
1018
  export interface CryptoKeyPair {
@@ -885,9 +1121,24 @@ export declare class DigestStream extends WritableStream<
885
1121
  }
886
1122
  export declare class TextDecoder {
887
1123
  constructor(decoder?: string, options?: TextDecoderConstructorOptions);
1124
+ /**
1125
+ * Returns the result of running encoding's decoder. The method can be invoked zero or more times with options's stream set to true, and then once without options's stream (or set to false), to process a fragmented input. If the invocation without options's stream (or set to false) has no input, it's clearest to omit both arguments.
1126
+ *
1127
+ * ```
1128
+ * var string = "", decoder = new TextDecoder(encoding), buffer;
1129
+ * while(buffer = next_chunk()) {
1130
+ * string += decoder.decode(buffer, {stream:true});
1131
+ * }
1132
+ * string += decoder.decode(); // end-of-queue
1133
+ * ```
1134
+ *
1135
+ * If the error mode is "fatal" and encoding's decoder returns error, throws a TypeError.
1136
+ *
1137
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)
1138
+ */
888
1139
  decode(
889
1140
  input?: ArrayBuffer | ArrayBufferView,
890
- options?: TextDecoderDecodeOptions
1141
+ options?: TextDecoderDecodeOptions,
891
1142
  ): string;
892
1143
  get encoding(): string;
893
1144
  get fatal(): boolean;
@@ -895,10 +1146,20 @@ export declare class TextDecoder {
895
1146
  }
896
1147
  export declare class TextEncoder {
897
1148
  constructor();
1149
+ /**
1150
+ * Returns the result of running UTF-8's encoder.
1151
+ *
1152
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)
1153
+ */
898
1154
  encode(input?: string): Uint8Array;
1155
+ /**
1156
+ * Runs the UTF-8 encoder on source, stores the result of that operation into destination, and returns the progress made as an object wherein read is the number of converted code units of source and written is the number of bytes modified in destination.
1157
+ *
1158
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)
1159
+ */
899
1160
  encodeInto(
900
1161
  input: string,
901
- buffer: ArrayBuffer | ArrayBufferView
1162
+ buffer: ArrayBuffer | ArrayBufferView,
902
1163
  ): TextEncoderEncodeIntoResult;
903
1164
  get encoding(): string;
904
1165
  }
@@ -923,17 +1184,20 @@ export declare class FormData {
923
1184
  has(name: string): boolean;
924
1185
  set(name: string, value: string): void;
925
1186
  set(name: string, value: Blob, filename?: string): void;
1187
+ /** Returns an array of key, value pairs for every entry in the list. */
926
1188
  entries(): IterableIterator<[key: string, value: File | string]>;
1189
+ /** Returns a list of keys in the list. */
927
1190
  keys(): IterableIterator<string>;
1191
+ /** Returns a list of values in the list. */
928
1192
  values(): IterableIterator<File | string>;
929
1193
  forEach<This = unknown>(
930
1194
  callback: (
931
1195
  this: This,
932
1196
  value: File | string,
933
1197
  key: string,
934
- parent: FormData
1198
+ parent: FormData,
935
1199
  ) => void,
936
- thisArg?: This
1200
+ thisArg?: This,
937
1201
  ): void;
938
1202
  [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>;
939
1203
  }
@@ -944,7 +1208,7 @@ export declare class HTMLRewriter {
944
1208
  constructor();
945
1209
  on(
946
1210
  selector: string,
947
- handlers: HTMLRewriterElementContentHandlers
1211
+ handlers: HTMLRewriterElementContentHandlers,
948
1212
  ): HTMLRewriter;
949
1213
  onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;
950
1214
  transform(response: Response): Response;
@@ -1011,7 +1275,9 @@ export interface DocumentEnd {
1011
1275
  append(content: string, options?: ContentOptions): DocumentEnd;
1012
1276
  }
1013
1277
  export declare abstract class FetchEvent extends ExtendableEvent {
1278
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request) */
1014
1279
  readonly request: Request;
1280
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith) */
1015
1281
  respondWith(promise: Response | Promise<Response>): void;
1016
1282
  passThroughOnException(): void;
1017
1283
  }
@@ -1029,10 +1295,13 @@ export declare class Headers {
1029
1295
  delete(name: string): void;
1030
1296
  forEach<This = unknown>(
1031
1297
  callback: (this: This, value: string, key: string, parent: Headers) => void,
1032
- thisArg?: This
1298
+ thisArg?: This,
1033
1299
  ): void;
1300
+ /** Returns an iterator allowing to go through all key/value pairs contained in this object. */
1034
1301
  entries(): IterableIterator<[key: string, value: string]>;
1302
+ /** Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */
1035
1303
  keys(): IterableIterator<string>;
1304
+ /** Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
1036
1305
  values(): IterableIterator<string>;
1037
1306
  [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
1038
1307
  }
@@ -1055,14 +1324,23 @@ export declare abstract class Body {
1055
1324
  }
1056
1325
  export declare class Response extends Body {
1057
1326
  constructor(body?: BodyInit | null, init?: ResponseInit);
1327
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirect_static) */
1058
1328
  static redirect(url: string, status?: number): Response;
1329
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/json_static) */
1059
1330
  static json(any: any, maybeInit?: ResponseInit | Response): Response;
1331
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) */
1060
1332
  clone(): Response;
1333
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) */
1061
1334
  get status(): number;
1335
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText) */
1062
1336
  get statusText(): string;
1337
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) */
1063
1338
  get headers(): Headers;
1339
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok) */
1064
1340
  get ok(): boolean;
1341
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected) */
1065
1342
  get redirected(): boolean;
1343
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) */
1066
1344
  get url(): string;
1067
1345
  get webSocket(): WebSocket | null;
1068
1346
  get cf(): any | undefined;
@@ -1077,22 +1355,58 @@ export interface ResponseInit {
1077
1355
  }
1078
1356
  export type RequestInfo<
1079
1357
  CfHostMetadata = unknown,
1080
- Cf = CfProperties<CfHostMetadata>
1358
+ Cf = CfProperties<CfHostMetadata>,
1081
1359
  > = Request<CfHostMetadata, Cf> | string | URL;
1082
1360
  export declare class Request<
1083
1361
  CfHostMetadata = unknown,
1084
- Cf = CfProperties<CfHostMetadata>
1362
+ Cf = CfProperties<CfHostMetadata>,
1085
1363
  > extends Body {
1086
1364
  constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
1365
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) */
1087
1366
  clone(): Request<CfHostMetadata, Cf>;
1367
+ /**
1368
+ * Returns request's HTTP method, which is "GET" by default.
1369
+ *
1370
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
1371
+ */
1088
1372
  get method(): string;
1373
+ /**
1374
+ * Returns the URL of request as a string.
1375
+ *
1376
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)
1377
+ */
1089
1378
  get url(): string;
1379
+ /**
1380
+ * 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.
1381
+ *
1382
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
1383
+ */
1090
1384
  get headers(): Headers;
1385
+ /**
1386
+ * 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.
1387
+ *
1388
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)
1389
+ */
1091
1390
  get redirect(): string;
1092
1391
  get fetcher(): Fetcher | null;
1392
+ /**
1393
+ * Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.
1394
+ *
1395
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)
1396
+ */
1093
1397
  get signal(): AbortSignal;
1094
1398
  get cf(): Cf | undefined;
1399
+ /**
1400
+ * 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]
1401
+ *
1402
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)
1403
+ */
1095
1404
  get integrity(): string;
1405
+ /**
1406
+ * Returns a boolean indicating whether or not request can outlive the global in which it was created.
1407
+ *
1408
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
1409
+ */
1096
1410
  get keepalive(): boolean;
1097
1411
  }
1098
1412
  export interface RequestInit<Cf = CfProperties> {
@@ -1111,10 +1425,18 @@ export interface RequestInit<Cf = CfProperties> {
1111
1425
  /** An AbortSignal to set request's signal. */
1112
1426
  signal?: AbortSignal | null;
1113
1427
  }
1114
- export declare abstract class Fetcher {
1428
+ export type Service<
1429
+ T extends Rpc.WorkerEntrypointBranded | undefined = undefined,
1430
+ > = Fetcher<T>;
1431
+ export type Fetcher<
1432
+ T extends Rpc.EntrypointBranded | undefined = undefined,
1433
+ Reserved extends string = never,
1434
+ > = (T extends Rpc.EntrypointBranded
1435
+ ? Rpc.Provider<T, Reserved | "fetch" | "connect">
1436
+ : unknown) & {
1115
1437
  fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1116
1438
  connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1117
- }
1439
+ };
1118
1440
  export interface FetcherPutOptions {
1119
1441
  expiration?: number;
1120
1442
  expirationTtl?: number;
@@ -1139,74 +1461,74 @@ export type KVNamespaceListResult<Metadata, Key extends string = string> =
1139
1461
  export interface KVNamespace<Key extends string = string> {
1140
1462
  get(
1141
1463
  key: Key,
1142
- options?: Partial<KVNamespaceGetOptions<undefined>>
1464
+ options?: Partial<KVNamespaceGetOptions<undefined>>,
1143
1465
  ): Promise<string | null>;
1144
1466
  get(key: Key, type: "text"): Promise<string | null>;
1145
1467
  get<ExpectedValue = unknown>(
1146
1468
  key: Key,
1147
- type: "json"
1469
+ type: "json",
1148
1470
  ): Promise<ExpectedValue | null>;
1149
1471
  get(key: Key, type: "arrayBuffer"): Promise<ArrayBuffer | null>;
1150
1472
  get(key: Key, type: "stream"): Promise<ReadableStream | null>;
1151
1473
  get(
1152
1474
  key: Key,
1153
- options?: KVNamespaceGetOptions<"text">
1475
+ options?: KVNamespaceGetOptions<"text">,
1154
1476
  ): Promise<string | null>;
1155
1477
  get<ExpectedValue = unknown>(
1156
1478
  key: Key,
1157
- options?: KVNamespaceGetOptions<"json">
1479
+ options?: KVNamespaceGetOptions<"json">,
1158
1480
  ): Promise<ExpectedValue | null>;
1159
1481
  get(
1160
1482
  key: Key,
1161
- options?: KVNamespaceGetOptions<"arrayBuffer">
1483
+ options?: KVNamespaceGetOptions<"arrayBuffer">,
1162
1484
  ): Promise<ArrayBuffer | null>;
1163
1485
  get(
1164
1486
  key: Key,
1165
- options?: KVNamespaceGetOptions<"stream">
1487
+ options?: KVNamespaceGetOptions<"stream">,
1166
1488
  ): Promise<ReadableStream | null>;
1167
1489
  list<Metadata = unknown>(
1168
- options?: KVNamespaceListOptions
1490
+ options?: KVNamespaceListOptions,
1169
1491
  ): Promise<KVNamespaceListResult<Metadata, Key>>;
1170
1492
  put(
1171
1493
  key: Key,
1172
1494
  value: string | ArrayBuffer | ArrayBufferView | ReadableStream,
1173
- options?: KVNamespacePutOptions
1495
+ options?: KVNamespacePutOptions,
1174
1496
  ): Promise<void>;
1175
1497
  getWithMetadata<Metadata = unknown>(
1176
1498
  key: Key,
1177
- options?: Partial<KVNamespaceGetOptions<undefined>>
1499
+ options?: Partial<KVNamespaceGetOptions<undefined>>,
1178
1500
  ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1179
1501
  getWithMetadata<Metadata = unknown>(
1180
1502
  key: Key,
1181
- type: "text"
1503
+ type: "text",
1182
1504
  ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1183
1505
  getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
1184
1506
  key: Key,
1185
- type: "json"
1507
+ type: "json",
1186
1508
  ): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
1187
1509
  getWithMetadata<Metadata = unknown>(
1188
1510
  key: Key,
1189
- type: "arrayBuffer"
1511
+ type: "arrayBuffer",
1190
1512
  ): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
1191
1513
  getWithMetadata<Metadata = unknown>(
1192
1514
  key: Key,
1193
- type: "stream"
1515
+ type: "stream",
1194
1516
  ): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
1195
1517
  getWithMetadata<Metadata = unknown>(
1196
1518
  key: Key,
1197
- options: KVNamespaceGetOptions<"text">
1519
+ options: KVNamespaceGetOptions<"text">,
1198
1520
  ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1199
1521
  getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
1200
1522
  key: Key,
1201
- options: KVNamespaceGetOptions<"json">
1523
+ options: KVNamespaceGetOptions<"json">,
1202
1524
  ): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
1203
1525
  getWithMetadata<Metadata = unknown>(
1204
1526
  key: Key,
1205
- options: KVNamespaceGetOptions<"arrayBuffer">
1527
+ options: KVNamespaceGetOptions<"arrayBuffer">,
1206
1528
  ): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
1207
1529
  getWithMetadata<Metadata = unknown>(
1208
1530
  key: Key,
1209
- options: KVNamespaceGetOptions<"stream">
1531
+ options: KVNamespaceGetOptions<"stream">,
1210
1532
  ): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
1211
1533
  delete(key: Key): Promise<void>;
1212
1534
  }
@@ -1234,7 +1556,7 @@ export interface Queue<Body = unknown> {
1234
1556
  send(message: Body, options?: QueueSendOptions): Promise<void>;
1235
1557
  sendBatch(
1236
1558
  messages: Iterable<MessageSendRequest<Body>>,
1237
- options?: QueueSendBatchOptions
1559
+ options?: QueueSendBatchOptions,
1238
1560
  ): Promise<void>;
1239
1561
  }
1240
1562
  export interface QueueSendOptions {
@@ -1256,6 +1578,7 @@ export interface Message<Body = unknown> {
1256
1578
  readonly id: string;
1257
1579
  readonly timestamp: Date;
1258
1580
  readonly body: Body;
1581
+ readonly attempts: number;
1259
1582
  retry(options?: QueueRetryOptions): void;
1260
1583
  ack(): void;
1261
1584
  }
@@ -1291,7 +1614,7 @@ export declare abstract class R2Bucket {
1291
1614
  key: string,
1292
1615
  options: R2GetOptions & {
1293
1616
  onlyIf: R2Conditional | Headers;
1294
- }
1617
+ },
1295
1618
  ): Promise<R2ObjectBody | R2Object | null>;
1296
1619
  get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;
1297
1620
  put(
@@ -1305,7 +1628,7 @@ export declare abstract class R2Bucket {
1305
1628
  | Blob,
1306
1629
  options?: R2PutOptions & {
1307
1630
  onlyIf: R2Conditional | Headers;
1308
- }
1631
+ },
1309
1632
  ): Promise<R2Object | null>;
1310
1633
  put(
1311
1634
  key: string,
@@ -1316,11 +1639,11 @@ export declare abstract class R2Bucket {
1316
1639
  | string
1317
1640
  | null
1318
1641
  | Blob,
1319
- options?: R2PutOptions
1642
+ options?: R2PutOptions,
1320
1643
  ): Promise<R2Object>;
1321
1644
  createMultipartUpload(
1322
1645
  key: string,
1323
- options?: R2MultipartOptions
1646
+ options?: R2MultipartOptions,
1324
1647
  ): Promise<R2MultipartUpload>;
1325
1648
  resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;
1326
1649
  delete(keys: string | string[]): Promise<void>;
@@ -1331,7 +1654,7 @@ export interface R2MultipartUpload {
1331
1654
  readonly uploadId: string;
1332
1655
  uploadPart(
1333
1656
  partNumber: number,
1334
- value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob
1657
+ value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob,
1335
1658
  ): Promise<R2UploadedPart>;
1336
1659
  abort(): Promise<void>;
1337
1660
  complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
@@ -1452,7 +1775,7 @@ export interface UnderlyingSink<W = any> {
1452
1775
  start?: (controller: WritableStreamDefaultController) => void | Promise<void>;
1453
1776
  write?: (
1454
1777
  chunk: W,
1455
- controller: WritableStreamDefaultController
1778
+ controller: WritableStreamDefaultController,
1456
1779
  ) => void | Promise<void>;
1457
1780
  abort?: (reason: any) => void | Promise<void>;
1458
1781
  close?: () => void | Promise<void>;
@@ -1467,10 +1790,10 @@ export interface UnderlyingByteSource {
1467
1790
  export interface UnderlyingSource<R = any> {
1468
1791
  type?: "" | undefined;
1469
1792
  start?: (
1470
- controller: ReadableStreamDefaultController<R>
1793
+ controller: ReadableStreamDefaultController<R>,
1471
1794
  ) => void | Promise<void>;
1472
1795
  pull?: (
1473
- controller: ReadableStreamDefaultController<R>
1796
+ controller: ReadableStreamDefaultController<R>,
1474
1797
  ) => void | Promise<void>;
1475
1798
  cancel?: (reason: any) => void | Promise<void>;
1476
1799
  expectedLength?: number | bigint;
@@ -1479,16 +1802,17 @@ export interface Transformer<I = any, O = any> {
1479
1802
  readableType?: string;
1480
1803
  writableType?: string;
1481
1804
  start?: (
1482
- controller: TransformStreamDefaultController<O>
1805
+ controller: TransformStreamDefaultController<O>,
1483
1806
  ) => void | Promise<void>;
1484
1807
  transform?: (
1485
1808
  chunk: I,
1486
- controller: TransformStreamDefaultController<O>
1809
+ controller: TransformStreamDefaultController<O>,
1487
1810
  ) => void | Promise<void>;
1488
1811
  flush?: (
1489
- controller: TransformStreamDefaultController<O>
1812
+ controller: TransformStreamDefaultController<O>,
1490
1813
  ) => void | Promise<void>;
1491
- expectedLength?: number | bigint;
1814
+ cancel?: (reason: any) => void | Promise<void>;
1815
+ expectedLength?: number;
1492
1816
  }
1493
1817
  export interface StreamPipeOptions {
1494
1818
  /**
@@ -1522,91 +1846,137 @@ export type ReadableStreamReadResult<R = any> =
1522
1846
  done: true;
1523
1847
  value?: undefined;
1524
1848
  };
1525
- /** 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. */
1849
+ /**
1850
+ * 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.
1851
+ *
1852
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
1853
+ */
1526
1854
  export interface ReadableStream<R = any> {
1855
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked) */
1527
1856
  get locked(): boolean;
1857
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel) */
1528
1858
  cancel(reason?: any): Promise<void>;
1859
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
1529
1860
  getReader(): ReadableStreamDefaultReader<R>;
1861
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
1530
1862
  getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
1863
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough) */
1531
1864
  pipeThrough<T>(
1532
1865
  transform: ReadableWritablePair<T, R>,
1533
- options?: StreamPipeOptions
1866
+ options?: StreamPipeOptions,
1534
1867
  ): ReadableStream<T>;
1868
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo) */
1535
1869
  pipeTo(
1536
1870
  destination: WritableStream<R>,
1537
- options?: StreamPipeOptions
1871
+ options?: StreamPipeOptions,
1538
1872
  ): Promise<void>;
1873
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee) */
1539
1874
  tee(): [ReadableStream<R>, ReadableStream<R>];
1540
1875
  values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
1541
1876
  [Symbol.asyncIterator](
1542
- options?: ReadableStreamValuesOptions
1877
+ options?: ReadableStreamValuesOptions,
1543
1878
  ): AsyncIterableIterator<R>;
1544
1879
  }
1545
1880
  export declare const ReadableStream: {
1546
1881
  prototype: ReadableStream;
1547
1882
  new (
1548
1883
  underlyingSource: UnderlyingByteSource,
1549
- strategy?: QueuingStrategy<Uint8Array>
1884
+ strategy?: QueuingStrategy<Uint8Array>,
1550
1885
  ): ReadableStream<Uint8Array>;
1551
1886
  new <R = any>(
1552
1887
  underlyingSource?: UnderlyingSource<R>,
1553
- strategy?: QueuingStrategy<R>
1888
+ strategy?: QueuingStrategy<R>,
1554
1889
  ): ReadableStream<R>;
1555
1890
  };
1556
1891
  export declare class ReadableStreamDefaultReader<R = any> {
1557
1892
  constructor(stream: ReadableStream);
1558
1893
  get closed(): Promise<void>;
1559
1894
  cancel(reason?: any): Promise<void>;
1895
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read) */
1560
1896
  read(): Promise<ReadableStreamReadResult<R>>;
1897
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock) */
1561
1898
  releaseLock(): void;
1562
1899
  }
1563
1900
  export declare class ReadableStreamBYOBReader {
1564
1901
  constructor(stream: ReadableStream);
1565
1902
  get closed(): Promise<void>;
1566
1903
  cancel(reason?: any): Promise<void>;
1904
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) */
1567
1905
  read<T extends ArrayBufferView>(
1568
- view: T
1906
+ view: T,
1569
1907
  ): Promise<ReadableStreamReadResult<T>>;
1908
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) */
1570
1909
  releaseLock(): void;
1571
1910
  readAtLeast<T extends ArrayBufferView>(
1572
1911
  minElements: number,
1573
- view: T
1912
+ view: T,
1574
1913
  ): Promise<ReadableStreamReadResult<T>>;
1575
1914
  }
1576
1915
  export interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
1577
1916
  min?: number;
1578
1917
  }
1579
1918
  export interface ReadableStreamGetReaderOptions {
1919
+ /**
1920
+ * Creates a ReadableStreamBYOBReader and locks the stream to the new reader.
1921
+ *
1922
+ * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation.
1923
+ */
1580
1924
  mode: "byob";
1581
1925
  }
1926
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest) */
1582
1927
  export interface ReadableStreamBYOBRequest {
1928
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view) */
1583
1929
  readonly view: Uint8Array | null;
1930
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond) */
1584
1931
  respond(bytesWritten: number): void;
1932
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView) */
1585
1933
  respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;
1586
1934
  readonly atLeast: number | null;
1587
1935
  }
1936
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController) */
1588
1937
  export interface ReadableStreamDefaultController<R = any> {
1938
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize) */
1589
1939
  readonly desiredSize: number | null;
1940
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close) */
1590
1941
  close(): void;
1942
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue) */
1591
1943
  enqueue(chunk?: R): void;
1944
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error) */
1592
1945
  error(reason: any): void;
1593
1946
  }
1947
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController) */
1594
1948
  export interface ReadableByteStreamController {
1949
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest) */
1595
1950
  readonly byobRequest: ReadableStreamBYOBRequest | null;
1951
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize) */
1596
1952
  readonly desiredSize: number | null;
1953
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close) */
1597
1954
  close(): void;
1955
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue) */
1598
1956
  enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
1957
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error) */
1599
1958
  error(reason: any): void;
1600
1959
  }
1601
- /** 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. */
1960
+ /**
1961
+ * 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.
1962
+ *
1963
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)
1964
+ */
1602
1965
  export interface WritableStreamDefaultController {
1966
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal) */
1603
1967
  readonly signal: AbortSignal;
1968
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error) */
1604
1969
  error(reason?: any): void;
1605
1970
  }
1971
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController) */
1606
1972
  export interface TransformStreamDefaultController<O = any> {
1973
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize) */
1607
1974
  get desiredSize(): number | null;
1975
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue) */
1608
1976
  enqueue(chunk?: O): void;
1977
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error) */
1609
1978
  error(reason: any): void;
1979
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate) */
1610
1980
  terminate(): void;
1611
1981
  }
1612
1982
  export interface ReadableWritablePair<R = any, W = any> {
@@ -1621,36 +1991,49 @@ export interface ReadableWritablePair<R = any, W = any> {
1621
1991
  export declare class WritableStream<W = any> {
1622
1992
  constructor(
1623
1993
  underlyingSink?: UnderlyingSink,
1624
- queuingStrategy?: QueuingStrategy
1994
+ queuingStrategy?: QueuingStrategy,
1625
1995
  );
1996
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked) */
1626
1997
  get locked(): boolean;
1998
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort) */
1627
1999
  abort(reason?: any): Promise<void>;
2000
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close) */
1628
2001
  close(): Promise<void>;
2002
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter) */
1629
2003
  getWriter(): WritableStreamDefaultWriter<W>;
1630
2004
  }
1631
2005
  export declare class WritableStreamDefaultWriter<W = any> {
1632
2006
  constructor(stream: WritableStream);
2007
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed) */
1633
2008
  get closed(): Promise<void>;
2009
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready) */
1634
2010
  get ready(): Promise<void>;
2011
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize) */
1635
2012
  get desiredSize(): number | null;
2013
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort) */
1636
2014
  abort(reason?: any): Promise<void>;
2015
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close) */
1637
2016
  close(): Promise<void>;
2017
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write) */
1638
2018
  write(chunk?: W): Promise<void>;
2019
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock) */
1639
2020
  releaseLock(): void;
1640
2021
  }
1641
2022
  export declare class TransformStream<I = any, O = any> {
1642
2023
  constructor(
1643
2024
  transformer?: Transformer<I, O>,
1644
2025
  writableStrategy?: QueuingStrategy<I>,
1645
- readableStrategy?: QueuingStrategy<O>
2026
+ readableStrategy?: QueuingStrategy<O>,
1646
2027
  );
2028
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable) */
1647
2029
  get readable(): ReadableStream<O>;
2030
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable) */
1648
2031
  get writable(): WritableStream<I>;
1649
2032
  }
1650
2033
  export declare class FixedLengthStream extends IdentityTransformStream {
1651
2034
  constructor(
1652
2035
  expectedLength: number | bigint,
1653
- queuingStrategy?: IdentityTransformStreamQueuingStrategy
2036
+ queuingStrategy?: IdentityTransformStreamQueuingStrategy,
1654
2037
  );
1655
2038
  }
1656
2039
  export declare class IdentityTransformStream extends TransformStream<
@@ -1696,12 +2079,16 @@ export declare class ByteLengthQueuingStrategy
1696
2079
  implements QueuingStrategy<ArrayBufferView>
1697
2080
  {
1698
2081
  constructor(init: QueuingStrategyInit);
2082
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark) */
1699
2083
  get highWaterMark(): number;
2084
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */
1700
2085
  get size(): (chunk?: any) => number;
1701
2086
  }
1702
2087
  export declare class CountQueuingStrategy implements QueuingStrategy {
1703
2088
  constructor(init: QueuingStrategyInit);
2089
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark) */
1704
2090
  get highWaterMark(): number;
2091
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */
1705
2092
  get size(): (chunk?: any) => number;
1706
2093
  }
1707
2094
  export interface QueuingStrategyInit {
@@ -1725,6 +2112,7 @@ export interface TraceItem {
1725
2112
  readonly event:
1726
2113
  | (
1727
2114
  | TraceItemFetchEventInfo
2115
+ | TraceItemJsRpcEventInfo
1728
2116
  | TraceItemScheduledEventInfo
1729
2117
  | TraceItemAlarmEventInfo
1730
2118
  | TraceItemQueueEventInfo
@@ -1739,6 +2127,7 @@ export interface TraceItem {
1739
2127
  readonly exceptions: TraceException[];
1740
2128
  readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
1741
2129
  readonly scriptName: string | null;
2130
+ readonly entrypoint?: string;
1742
2131
  readonly scriptVersion?: ScriptVersion;
1743
2132
  readonly dispatchNamespace?: string;
1744
2133
  readonly scriptTags?: string[];
@@ -1781,6 +2170,9 @@ export interface TraceItemFetchEventInfoRequest {
1781
2170
  export interface TraceItemFetchEventInfoResponse {
1782
2171
  readonly status: number;
1783
2172
  }
2173
+ export interface TraceItemJsRpcEventInfo {
2174
+ readonly rpcMethod: string;
2175
+ }
1784
2176
  export interface TraceItemHibernatableWebSocketEventInfo {
1785
2177
  readonly getWebSocketEvent:
1786
2178
  | TraceItemHibernatableWebSocketEventInfoMessage
@@ -1807,6 +2199,7 @@ export interface TraceException {
1807
2199
  readonly timestamp: number;
1808
2200
  readonly message: string;
1809
2201
  readonly name: string;
2202
+ readonly stack?: string;
1810
2203
  }
1811
2204
  export interface TraceDiagnosticChannelEvent {
1812
2205
  readonly timestamp: number;
@@ -1822,29 +2215,52 @@ export interface UnsafeTraceMetrics {
1822
2215
  }
1823
2216
  export declare class URL {
1824
2217
  constructor(url: string | URL, base?: string | URL);
2218
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) */
1825
2219
  get href(): string;
2220
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) */
1826
2221
  set href(value: string);
2222
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin) */
1827
2223
  get origin(): string;
2224
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) */
1828
2225
  get protocol(): string;
2226
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) */
1829
2227
  set protocol(value: string);
2228
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */
1830
2229
  get username(): string;
2230
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */
1831
2231
  set username(value: string);
2232
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */
1832
2233
  get password(): string;
2234
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */
1833
2235
  set password(value: string);
2236
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */
1834
2237
  get host(): string;
2238
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */
1835
2239
  set host(value: string);
2240
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */
1836
2241
  get hostname(): string;
2242
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */
1837
2243
  set hostname(value: string);
2244
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */
1838
2245
  get port(): string;
2246
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */
1839
2247
  set port(value: string);
2248
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */
1840
2249
  get pathname(): string;
2250
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */
1841
2251
  set pathname(value: string);
2252
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */
1842
2253
  get search(): string;
2254
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */
1843
2255
  set search(value: string);
2256
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams) */
1844
2257
  get searchParams(): URLSearchParams;
2258
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */
1845
2259
  get hash(): string;
2260
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */
1846
2261
  set hash(value: string);
1847
2262
  toString(): string;
2263
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON) */
1848
2264
  toJSON(): string;
1849
2265
  }
1850
2266
  export declare class URLSearchParams {
@@ -1853,7 +2269,7 @@ export declare class URLSearchParams {
1853
2269
  | URLSearchParams
1854
2270
  | string
1855
2271
  | Record<string, string>
1856
- | [key: string, value: string][]
2272
+ | [key: string, value: string][],
1857
2273
  );
1858
2274
  get size(): number;
1859
2275
  append(name: string, value: string): void;
@@ -1863,17 +2279,20 @@ export declare class URLSearchParams {
1863
2279
  has(name: string): boolean;
1864
2280
  set(name: string, value: string): void;
1865
2281
  sort(): void;
2282
+ /** Returns an array of key, value pairs for every entry in the search params. */
1866
2283
  entries(): IterableIterator<[key: string, value: string]>;
2284
+ /** Returns a list of keys in the search params. */
1867
2285
  keys(): IterableIterator<string>;
2286
+ /** Returns a list of values in the search params. */
1868
2287
  values(): IterableIterator<string>;
1869
2288
  forEach<This = unknown>(
1870
2289
  callback: (
1871
2290
  this: This,
1872
2291
  value: string,
1873
2292
  key: string,
1874
- parent: URLSearchParams
2293
+ parent: URLSearchParams,
1875
2294
  ) => void,
1876
- thisArg?: This
2295
+ thisArg?: This,
1877
2296
  ): void;
1878
2297
  toString(): string;
1879
2298
  [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
@@ -1882,7 +2301,7 @@ export declare class URLPattern {
1882
2301
  constructor(
1883
2302
  input?: string | URLPatternURLPatternInit,
1884
2303
  baseURL?: string,
1885
- patternOptions?: URLPatternURLPatternOptions
2304
+ patternOptions?: URLPatternURLPatternOptions,
1886
2305
  );
1887
2306
  get protocol(): string;
1888
2307
  get username(): string;
@@ -1895,7 +2314,7 @@ export declare class URLPattern {
1895
2314
  test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean;
1896
2315
  exec(
1897
2316
  input?: string | URLPatternURLPatternInit,
1898
- baseURL?: string
2317
+ baseURL?: string,
1899
2318
  ): URLPatternURLPatternResult | null;
1900
2319
  }
1901
2320
  export interface URLPatternURLPatternInit {
@@ -1928,12 +2347,24 @@ export interface URLPatternURLPatternOptions {
1928
2347
  ignoreCase?: boolean;
1929
2348
  }
1930
2349
  export declare class CloseEvent extends Event {
1931
- constructor(type: string, initializer: CloseEventInit);
1932
- /** Returns the WebSocket connection close code provided by the server. */
2350
+ constructor(type: string, initializer?: CloseEventInit);
2351
+ /**
2352
+ * Returns the WebSocket connection close code provided by the server.
2353
+ *
2354
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)
2355
+ */
1933
2356
  readonly code: number;
1934
- /** Returns the WebSocket connection close reason provided by the server. */
2357
+ /**
2358
+ * Returns the WebSocket connection close reason provided by the server.
2359
+ *
2360
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)
2361
+ */
1935
2362
  readonly reason: string;
1936
- /** Returns true if the connection closed cleanly; false otherwise. */
2363
+ /**
2364
+ * Returns true if the connection closed cleanly; false otherwise.
2365
+ *
2366
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)
2367
+ */
1937
2368
  readonly wasClean: boolean;
1938
2369
  }
1939
2370
  export interface CloseEventInit {
@@ -1948,12 +2379,21 @@ export declare class MessageEvent extends Event {
1948
2379
  export interface MessageEventInit {
1949
2380
  data: ArrayBuffer | string;
1950
2381
  }
1951
- /** Events providing information related to errors in scripts or in files. */
2382
+ /**
2383
+ * Events providing information related to errors in scripts or in files.
2384
+ *
2385
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)
2386
+ */
1952
2387
  export interface ErrorEvent extends Event {
2388
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename) */
1953
2389
  readonly filename: string;
2390
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message) */
1954
2391
  readonly message: string;
2392
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno) */
1955
2393
  readonly lineno: number;
2394
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno) */
1956
2395
  readonly colno: number;
2396
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error) */
1957
2397
  readonly error: any;
1958
2398
  }
1959
2399
  export type WebSocketEventMap = {
@@ -1965,7 +2405,17 @@ export type WebSocketEventMap = {
1965
2405
  export declare class WebSocket extends EventTarget<WebSocketEventMap> {
1966
2406
  constructor(url: string, protocols?: string[] | string);
1967
2407
  accept(): void;
2408
+ /**
2409
+ * Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
2410
+ *
2411
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
2412
+ */
1968
2413
  send(message: (ArrayBuffer | ArrayBufferView) | string): void;
2414
+ /**
2415
+ * Closes the WebSocket connection, optionally using code as the the WebSocket connection close code and reason as the the WebSocket connection close reason.
2416
+ *
2417
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)
2418
+ */
1969
2419
  close(code?: number, reason?: string): void;
1970
2420
  serializeAttachment(attachment: any): void;
1971
2421
  deserializeAttachment(): any | null;
@@ -1977,9 +2427,29 @@ export declare class WebSocket extends EventTarget<WebSocketEventMap> {
1977
2427
  static readonly CLOSING: number;
1978
2428
  static readonly READY_STATE_CLOSED: number;
1979
2429
  static readonly CLOSED: number;
2430
+ /**
2431
+ * Returns the state of the WebSocket object's connection. It can have the values described below.
2432
+ *
2433
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)
2434
+ */
1980
2435
  get readyState(): number;
2436
+ /**
2437
+ * Returns the URL that was used to establish the WebSocket connection.
2438
+ *
2439
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)
2440
+ */
1981
2441
  get url(): string | null;
2442
+ /**
2443
+ * 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.
2444
+ *
2445
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)
2446
+ */
1982
2447
  get protocol(): string | null;
2448
+ /**
2449
+ * Returns the extensions selected by the server, if any.
2450
+ *
2451
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
2452
+ */
1983
2453
  get extensions(): string | null;
1984
2454
  }
1985
2455
  export declare const WebSocketPair: {
@@ -2020,24 +2490,24 @@ export declare abstract class gpuGPUAdapter {
2020
2490
  export interface gpuGPUDevice extends EventTarget {
2021
2491
  createBuffer(param1: gpuGPUBufferDescriptor): gpuGPUBuffer;
2022
2492
  createBindGroupLayout(
2023
- descriptor: gpuGPUBindGroupLayoutDescriptor
2493
+ descriptor: gpuGPUBindGroupLayoutDescriptor,
2024
2494
  ): gpuGPUBindGroupLayout;
2025
2495
  createBindGroup(descriptor: gpuGPUBindGroupDescriptor): gpuGPUBindGroup;
2026
2496
  createSampler(descriptor: gpuGPUSamplerDescriptor): gpuGPUSampler;
2027
2497
  createShaderModule(
2028
- descriptor: gpuGPUShaderModuleDescriptor
2498
+ descriptor: gpuGPUShaderModuleDescriptor,
2029
2499
  ): gpuGPUShaderModule;
2030
2500
  createPipelineLayout(
2031
- descriptor: gpuGPUPipelineLayoutDescriptor
2501
+ descriptor: gpuGPUPipelineLayoutDescriptor,
2032
2502
  ): gpuGPUPipelineLayout;
2033
2503
  createComputePipeline(
2034
- descriptor: gpuGPUComputePipelineDescriptor
2504
+ descriptor: gpuGPUComputePipelineDescriptor,
2035
2505
  ): gpuGPUComputePipeline;
2036
2506
  createRenderPipeline(
2037
- descriptor: gpuGPURenderPipelineDescriptor
2507
+ descriptor: gpuGPURenderPipelineDescriptor,
2038
2508
  ): gpuGPURenderPipeline;
2039
2509
  createCommandEncoder(
2040
- descriptor?: gpuGPUCommandEncoderDescriptor
2510
+ descriptor?: gpuGPUCommandEncoderDescriptor,
2041
2511
  ): gpuGPUCommandEncoder;
2042
2512
  createTexture(param1: gpuGPUTextureDescriptor): gpuGPUTexture;
2043
2513
  destroy(): void;
@@ -2083,7 +2553,7 @@ export interface gpuGPUBuffer {
2083
2553
  mapAsync(
2084
2554
  offset: number,
2085
2555
  size?: number | bigint,
2086
- param3?: number | bigint
2556
+ param3?: number | bigint,
2087
2557
  ): Promise<void>;
2088
2558
  get size(): number | bigint;
2089
2559
  get usage(): number;
@@ -2182,38 +2652,38 @@ export interface gpuGPUProgrammableStage {
2182
2652
  export interface gpuGPUCommandEncoder {
2183
2653
  get label(): string;
2184
2654
  beginComputePass(
2185
- descriptor?: gpuGPUComputePassDescriptor
2655
+ descriptor?: gpuGPUComputePassDescriptor,
2186
2656
  ): gpuGPUComputePassEncoder;
2187
2657
  beginRenderPass(
2188
- descriptor: gpuGPURenderPassDescriptor
2658
+ descriptor: gpuGPURenderPassDescriptor,
2189
2659
  ): gpuGPURenderPassEncoder;
2190
2660
  copyBufferToBuffer(
2191
2661
  source: gpuGPUBuffer,
2192
2662
  sourceOffset: number | bigint,
2193
2663
  destination: gpuGPUBuffer,
2194
2664
  destinationOffset: number | bigint,
2195
- size: number | bigint
2665
+ size: number | bigint,
2196
2666
  ): void;
2197
2667
  finish(param0?: gpuGPUCommandBufferDescriptor): gpuGPUCommandBuffer;
2198
2668
  copyTextureToBuffer(
2199
2669
  source: gpuGPUImageCopyTexture,
2200
2670
  destination: gpuGPUImageCopyBuffer,
2201
- copySize: Iterable<number> | gpuGPUExtent3DDict
2671
+ copySize: Iterable<number> | gpuGPUExtent3DDict,
2202
2672
  ): void;
2203
2673
  copyBufferToTexture(
2204
2674
  source: gpuGPUImageCopyBuffer,
2205
2675
  destination: gpuGPUImageCopyTexture,
2206
- copySize: Iterable<number> | gpuGPUExtent3DDict
2676
+ copySize: Iterable<number> | gpuGPUExtent3DDict,
2207
2677
  ): void;
2208
2678
  copyTextureToTexture(
2209
2679
  source: gpuGPUImageCopyTexture,
2210
2680
  destination: gpuGPUImageCopyTexture,
2211
- copySize: Iterable<number> | gpuGPUExtent3DDict
2681
+ copySize: Iterable<number> | gpuGPUExtent3DDict,
2212
2682
  ): void;
2213
2683
  clearBuffer(
2214
2684
  buffer: gpuGPUBuffer,
2215
2685
  offset?: number | bigint,
2216
- size?: number | bigint
2686
+ size?: number | bigint,
2217
2687
  ): void;
2218
2688
  }
2219
2689
  export interface gpuGPUCommandEncoderDescriptor {
@@ -2224,12 +2694,12 @@ export interface gpuGPUComputePassEncoder {
2224
2694
  setBindGroup(
2225
2695
  index: number,
2226
2696
  bindGroup: gpuGPUBindGroup | null,
2227
- dynamicOffsets?: Iterable<number>
2697
+ dynamicOffsets?: Iterable<number>,
2228
2698
  ): void;
2229
2699
  dispatchWorkgroups(
2230
2700
  workgroupCountX: number,
2231
2701
  workgroupCountY?: number,
2232
- workgroupCountZ?: number
2702
+ workgroupCountZ?: number,
2233
2703
  ): void;
2234
2704
  end(): void;
2235
2705
  }
@@ -2257,7 +2727,7 @@ export interface gpuGPUQueue {
2257
2727
  bufferOffset: number | bigint,
2258
2728
  data: ArrayBuffer | ArrayBufferView,
2259
2729
  dataOffset?: number | bigint,
2260
- size?: number | bigint
2730
+ size?: number | bigint,
2261
2731
  ): void;
2262
2732
  }
2263
2733
  export declare abstract class gpuGPUMapMode {
@@ -2461,7 +2931,7 @@ export interface gpuGPURenderPassEncoder {
2461
2931
  vertexCount: number,
2462
2932
  instanceCount?: number,
2463
2933
  firstVertex?: number,
2464
- firstInstance?: number
2934
+ firstInstance?: number,
2465
2935
  ): void;
2466
2936
  end(): void;
2467
2937
  }
@@ -2959,7 +3429,7 @@ export interface IncomingRequestCfPropertiesBotManagementEnterprise
2959
3429
  };
2960
3430
  }
2961
3431
  export interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<
2962
- HostMetadata
3432
+ HostMetadata,
2963
3433
  > {
2964
3434
  /**
2965
3435
  * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/).
@@ -3529,6 +3999,13 @@ export declare abstract class D1PreparedStatement {
3529
3999
  }): Promise<[string[], ...T[]]>;
3530
4000
  raw<T = unknown[]>(options?: { columnNames?: false }): Promise<T[]>;
3531
4001
  }
4002
+ // `Disposable` was added to TypeScript's standard lib types in version 5.2.
4003
+ // To support older TypeScript versions, define an empty `Disposable` interface.
4004
+ // Users won't be able to use `using`/`Symbol.dispose` without upgrading to 5.2,
4005
+ // but this will ensure type checking on older versions still passes.
4006
+ // TypeScript's interface merging will ensure our empty interface is effectively
4007
+ // ignored when `Disposable` is included in the standard lib.
4008
+ export interface Disposable {}
3532
4009
  /**
3533
4010
  * An email message that can be sent from a Worker.
3534
4011
  */
@@ -3584,7 +4061,7 @@ export declare abstract class EmailEvent extends ExtendableEvent {
3584
4061
  export type EmailExportedHandler<Env = unknown> = (
3585
4062
  message: ForwardableEmailMessage,
3586
4063
  env: Env,
3587
- ctx: ExecutionContext
4064
+ ctx: ExecutionContext,
3588
4065
  ) => void | Promise<void>;
3589
4066
  export interface Hyperdrive {
3590
4067
  /**
@@ -3651,7 +4128,7 @@ export type EventContext<Env, P extends string, Data> = {
3651
4128
  export type PagesFunction<
3652
4129
  Env = unknown,
3653
4130
  Params extends string = any,
3654
- Data extends Record<string, unknown> = Record<string, unknown>
4131
+ Data extends Record<string, unknown> = Record<string, unknown>,
3655
4132
  > = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
3656
4133
  export type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
3657
4134
  request: Request<unknown, IncomingRequestCfProperties<unknown>>;
@@ -3672,9 +4149,9 @@ export type PagesPluginFunction<
3672
4149
  Env = unknown,
3673
4150
  Params extends string = any,
3674
4151
  Data extends Record<string, unknown> = Record<string, unknown>,
3675
- PluginArgs = unknown
4152
+ PluginArgs = unknown,
3676
4153
  > = (
3677
- context: EventPluginContext<Env, Params, Data, PluginArgs>
4154
+ context: EventPluginContext<Env, Params, Data, PluginArgs>,
3678
4155
  ) => Response | Promise<Response>;
3679
4156
  // PubSubMessage represents an incoming PubSub message.
3680
4157
  // The message includes metadata about the broker, the client, and the payload
@@ -3710,6 +4187,155 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
3710
4187
  // Key Identifier of the JWK
3711
4188
  readonly kid: string;
3712
4189
  }
4190
+ // Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need
4191
+ // to referenced by `Fetcher`. This is included in the "importable" version of the types which
4192
+ // strips all `module` blocks.
4193
+ export declare namespace Rpc {
4194
+ // Branded types for identifying `WorkerEntrypoint`/`DurableObject`/`Target`s.
4195
+ // TypeScript uses *structural* typing meaning anything with the same shape as type `T` is a `T`.
4196
+ // For the classes exported by `cloudflare:workers` we want *nominal* typing (i.e. we only want to
4197
+ // accept `WorkerEntrypoint` from `cloudflare:workers`, not any other class with the same shape)
4198
+ export const __RPC_STUB_BRAND: unique symbol;
4199
+ export const __RPC_TARGET_BRAND: unique symbol;
4200
+ export const __WORKER_ENTRYPOINT_BRAND: unique symbol;
4201
+ export const __DURABLE_OBJECT_BRAND: unique symbol;
4202
+ export interface RpcTargetBranded {
4203
+ [__RPC_TARGET_BRAND]: never;
4204
+ }
4205
+ export interface WorkerEntrypointBranded {
4206
+ [__WORKER_ENTRYPOINT_BRAND]: never;
4207
+ }
4208
+ export interface DurableObjectBranded {
4209
+ [__DURABLE_OBJECT_BRAND]: never;
4210
+ }
4211
+ export type EntrypointBranded =
4212
+ | WorkerEntrypointBranded
4213
+ | DurableObjectBranded;
4214
+ // Types that can be used through `Stub`s
4215
+ export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
4216
+ // Types that can be passed over RPC
4217
+ type Serializable =
4218
+ // Structured cloneables
4219
+ | void
4220
+ | undefined
4221
+ | null
4222
+ | boolean
4223
+ | number
4224
+ | bigint
4225
+ | string
4226
+ | TypedArray
4227
+ | ArrayBuffer
4228
+ | DataView
4229
+ | Date
4230
+ | Error
4231
+ | RegExp
4232
+ // Structured cloneable composites
4233
+ | Map<Serializable, Serializable>
4234
+ | Set<Serializable>
4235
+ | ReadonlyArray<Serializable>
4236
+ | {
4237
+ [key: string | number]: Serializable;
4238
+ }
4239
+ // Special types
4240
+ | ReadableStream<Uint8Array>
4241
+ | WritableStream<Uint8Array>
4242
+ | Request
4243
+ | Response
4244
+ | Headers
4245
+ | Stub<Stubable>
4246
+ // Serialized as stubs, see `Stubify`
4247
+ | Stubable;
4248
+ // Base type for all RPC stubs, including common memory management methods.
4249
+ // `T` is used as a marker type for unwrapping `Stub`s later.
4250
+ interface StubBase<T extends Stubable> extends Disposable {
4251
+ [__RPC_STUB_BRAND]: T;
4252
+ dup(): this;
4253
+ }
4254
+ export type Stub<T extends Stubable> = Provider<T> & StubBase<T>;
4255
+ // Recursively rewrite all `Stubable` types with `Stub`s
4256
+ type Stubify<T> = T extends Stubable
4257
+ ? Stub<T>
4258
+ : T extends Map<infer K, infer V>
4259
+ ? Map<Stubify<K>, Stubify<V>>
4260
+ : T extends Set<infer V>
4261
+ ? Set<Stubify<V>>
4262
+ : T extends Array<infer V>
4263
+ ? Array<Stubify<V>>
4264
+ : T extends ReadonlyArray<infer V>
4265
+ ? ReadonlyArray<Stubify<V>>
4266
+ : T extends {
4267
+ [key: string | number]: unknown;
4268
+ }
4269
+ ? {
4270
+ [K in keyof T]: Stubify<T[K]>;
4271
+ }
4272
+ : T;
4273
+ // Recursively rewrite all `Stub<T>`s with the corresponding `T`s.
4274
+ // Note we use `StubBase` instead of `Stub` here to avoid circular dependencies:
4275
+ // `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`.
4276
+ type Unstubify<T> =
4277
+ T extends StubBase<infer V>
4278
+ ? V
4279
+ : T extends Map<infer K, infer V>
4280
+ ? Map<Unstubify<K>, Unstubify<V>>
4281
+ : T extends Set<infer V>
4282
+ ? Set<Unstubify<V>>
4283
+ : T extends Array<infer V>
4284
+ ? Array<Unstubify<V>>
4285
+ : T extends ReadonlyArray<infer V>
4286
+ ? ReadonlyArray<Unstubify<V>>
4287
+ : T extends {
4288
+ [key: string | number]: unknown;
4289
+ }
4290
+ ? {
4291
+ [K in keyof T]: Unstubify<T[K]>;
4292
+ }
4293
+ : T;
4294
+ type UnstubifyAll<A extends any[]> = {
4295
+ [I in keyof A]: Unstubify<A[I]>;
4296
+ };
4297
+ // Utility type for adding `Provider`/`Disposable`s to `object` types only.
4298
+ // Note `unknown & T` is equivalent to `T`.
4299
+ type MaybeProvider<T> = T extends object ? Provider<T> : unknown;
4300
+ type MaybeDisposable<T> = T extends object ? Disposable : unknown;
4301
+ // Type for method return or property on an RPC interface.
4302
+ // - Stubable types are replaced by stubs.
4303
+ // - Serializable types are passed by value, with stubable types replaced by stubs
4304
+ // and a top-level `Disposer`.
4305
+ // Everything else can't be passed over PRC.
4306
+ // Technically, we use custom thenables here, but they quack like `Promise`s.
4307
+ // Intersecting with `(Maybe)Provider` allows pipelining.
4308
+ type Result<R> = R extends Stubable
4309
+ ? Promise<Stub<R>> & Provider<R>
4310
+ : R extends Serializable
4311
+ ? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R>
4312
+ : never;
4313
+ // Type for method or property on an RPC interface.
4314
+ // For methods, unwrap `Stub`s in parameters, and rewrite returns to be `Result`s.
4315
+ // Unwrapping `Stub`s allows calling with `Stubable` arguments.
4316
+ // For properties, rewrite types to be `Result`s.
4317
+ // In each case, unwrap `Promise`s.
4318
+ type MethodOrProperty<V> = V extends (...args: infer P) => infer R
4319
+ ? (...args: UnstubifyAll<P>) => Result<Awaited<R>>
4320
+ : Result<Awaited<V>>;
4321
+ // Type for the callable part of an `Provider` if `T` is callable.
4322
+ // This is intersected with methods/properties.
4323
+ type MaybeCallableProvider<T> = T extends (...args: any[]) => any
4324
+ ? MethodOrProperty<T>
4325
+ : unknown;
4326
+ // Base type for all other types providing RPC-like interfaces.
4327
+ // Rewrites all methods/properties to be `MethodOrProperty`s, while preserving callable types.
4328
+ // `Reserved` names (e.g. stub method names like `dup()`) and symbols can't be accessed over RPC.
4329
+ export type Provider<
4330
+ T extends object,
4331
+ Reserved extends string = never,
4332
+ > = MaybeCallableProvider<T> & {
4333
+ [K in Exclude<
4334
+ keyof T,
4335
+ Reserved | symbol | keyof StubBase<never>
4336
+ >]: MethodOrProperty<T[K]>;
4337
+ };
4338
+ }
3713
4339
  // Copyright (c) 2022-2023 Cloudflare, Inc.
3714
4340
  // Licensed under the Apache 2.0 license found in the LICENSE file or at:
3715
4341
  // https://opensource.org/licenses/Apache-2.0
@@ -3838,7 +4464,7 @@ export declare abstract class VectorizeIndex {
3838
4464
  */
3839
4465
  public query(
3840
4466
  vector: VectorFloatArray | number[],
3841
- options: VectorizeQueryOptions
4467
+ options: VectorizeQueryOptions,
3842
4468
  ): Promise<VectorizeMatches>;
3843
4469
  /**
3844
4470
  * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
@@ -3865,6 +4491,16 @@ export declare abstract class VectorizeIndex {
3865
4491
  */
3866
4492
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
3867
4493
  }
4494
+ /**
4495
+ * The interface for "version_metadata" binding
4496
+ * providing metadata about the Worker Version using this binding.
4497
+ */
4498
+ export type WorkerVersionMetadata = {
4499
+ /** The ID of the Worker Version using this binding */
4500
+ id: string;
4501
+ /** The tag of the Worker Version using this binding */
4502
+ tag: string;
4503
+ };
3868
4504
  export interface DynamicDispatchLimits {
3869
4505
  /**
3870
4506
  * Limit CPU time in milliseconds.
@@ -3900,6 +4536,6 @@ export interface DispatchNamespace {
3900
4536
  args?: {
3901
4537
  [key: string]: any;
3902
4538
  },
3903
- options?: DynamicDispatchOptions
4539
+ options?: DynamicDispatchOptions,
3904
4540
  ): Fetcher;
3905
4541
  }