@cloudflare/workers-types 4.20240320.1 → 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
  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 @@ declare type WorkerGlobalScopeEventMap = {
56
63
  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
  declare 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
  declare const console: Console;
82
108
  declare type BufferSource = ArrayBufferView | ArrayBuffer;
109
+ declare 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
  declare namespace WebAssembly {
84
122
  class CompileError extends Error {
85
123
  constructor(message?: string);
@@ -154,7 +192,11 @@ 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
  declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
159
201
  DOMException: typeof DOMException;
160
202
  WorkerGlobalScope: typeof WorkerGlobalScope;
@@ -178,7 +220,7 @@ declare 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;
@@ -247,49 +289,64 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
247
289
  declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
248
290
  type: Type,
249
291
  handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
250
- options?: EventTargetAddEventListenerOptions | boolean
292
+ options?: EventTargetAddEventListenerOptions | boolean,
251
293
  ): void;
252
294
  declare function removeEventListener<
253
- Type extends keyof WorkerGlobalScopeEventMap
295
+ Type extends keyof WorkerGlobalScopeEventMap,
254
296
  >(
255
297
  type: Type,
256
298
  handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
257
- options?: EventTargetEventListenerOptions | boolean
299
+ options?: EventTargetEventListenerOptions | boolean,
258
300
  ): void;
259
- /** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */
301
+ /**
302
+ * 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
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
305
+ */
260
306
  declare function dispatchEvent(
261
- event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]
307
+ event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap],
262
308
  ): boolean;
309
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/btoa) */
263
310
  declare function btoa(data: string): string;
311
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/atob) */
264
312
  declare function atob(data: string): string;
313
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
265
314
  declare function setTimeout(
266
315
  callback: (...args: any[]) => void,
267
- msDelay?: number
316
+ msDelay?: number,
268
317
  ): number;
318
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
269
319
  declare function setTimeout<Args extends any[]>(
270
320
  callback: (...args: Args) => void,
271
321
  msDelay?: number,
272
322
  ...args: Args
273
323
  ): number;
324
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearTimeout) */
274
325
  declare function clearTimeout(timeoutId: number | null): void;
326
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
275
327
  declare function setInterval(
276
328
  callback: (...args: any[]) => void,
277
- msDelay?: number
329
+ msDelay?: number,
278
330
  ): number;
331
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
279
332
  declare function setInterval<Args extends any[]>(
280
333
  callback: (...args: Args) => void,
281
334
  msDelay?: number,
282
335
  ...args: Args
283
336
  ): number;
337
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearInterval) */
284
338
  declare function clearInterval(timeoutId: number | null): void;
339
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/queueMicrotask) */
285
340
  declare function queueMicrotask(task: Function): void;
341
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/structuredClone) */
286
342
  declare function structuredClone<T>(
287
343
  value: T,
288
- options?: StructuredSerializeOptions
344
+ options?: StructuredSerializeOptions,
289
345
  ): T;
346
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
290
347
  declare function fetch(
291
348
  input: RequestInfo,
292
- init?: RequestInit<RequestInitCfProperties>
349
+ init?: RequestInit<RequestInitCfProperties>,
293
350
  ): Promise<Response>;
294
351
  declare const self: ServiceWorkerGlobalScope;
295
352
  declare const crypto: Crypto;
@@ -304,41 +361,41 @@ declare interface ExecutionContext {
304
361
  }
305
362
  declare type ExportedHandlerFetchHandler<
306
363
  Env = unknown,
307
- CfHostMetadata = unknown
364
+ CfHostMetadata = unknown,
308
365
  > = (
309
366
  request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
310
367
  env: Env,
311
- ctx: ExecutionContext
368
+ ctx: ExecutionContext,
312
369
  ) => Response | Promise<Response>;
313
370
  declare type ExportedHandlerTailHandler<Env = unknown> = (
314
371
  events: TraceItem[],
315
372
  env: Env,
316
- ctx: ExecutionContext
373
+ ctx: ExecutionContext,
317
374
  ) => void | Promise<void>;
318
375
  declare type ExportedHandlerTraceHandler<Env = unknown> = (
319
376
  traces: TraceItem[],
320
377
  env: Env,
321
- ctx: ExecutionContext
378
+ ctx: ExecutionContext,
322
379
  ) => void | Promise<void>;
323
380
  declare type ExportedHandlerScheduledHandler<Env = unknown> = (
324
381
  controller: ScheduledController,
325
382
  env: Env,
326
- ctx: ExecutionContext
383
+ ctx: ExecutionContext,
327
384
  ) => void | Promise<void>;
328
385
  declare type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
329
386
  batch: MessageBatch<Message>,
330
387
  env: Env,
331
- ctx: ExecutionContext
388
+ ctx: ExecutionContext,
332
389
  ) => void | Promise<void>;
333
390
  declare type ExportedHandlerTestHandler<Env = unknown> = (
334
391
  controller: TestController,
335
392
  env: Env,
336
- ctx: ExecutionContext
393
+ ctx: ExecutionContext,
337
394
  ) => void | Promise<void>;
338
395
  declare interface ExportedHandler<
339
396
  Env = unknown,
340
397
  QueueHandlerMessage = unknown,
341
- CfHostMetadata = unknown
398
+ CfHostMetadata = unknown,
342
399
  > {
343
400
  fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
344
401
  tail?: ExportedHandlerTailHandler<Env>;
@@ -352,12 +409,20 @@ declare interface StructuredSerializeOptions {
352
409
  transfer?: any[];
353
410
  }
354
411
  declare abstract class PromiseRejectionEvent extends Event {
412
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise) */
355
413
  readonly promise: Promise<any>;
414
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason) */
356
415
  readonly reason: any;
357
416
  }
358
- /** Provides access to performance-related information for the current page. It's part of the High Resolution Time API, but is enhanced by the Performance Timeline API, the Navigation Timing API, the User Timing API, and the Resource Timing API. */
417
+ /**
418
+ * 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
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance)
421
+ */
359
422
  declare interface Performance {
423
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/timeOrigin) */
360
424
  readonly timeOrigin: number;
425
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/now) */
361
426
  now(): number;
362
427
  }
363
428
  declare interface AlarmInvocationInfo {
@@ -369,36 +434,42 @@ declare interface DurableObject {
369
434
  alarm?(): void | Promise<void>;
370
435
  webSocketMessage?(
371
436
  ws: WebSocket,
372
- message: string | ArrayBuffer
437
+ message: string | ArrayBuffer,
373
438
  ): void | Promise<void>;
374
439
  webSocketClose?(
375
440
  ws: WebSocket,
376
441
  code: number,
377
442
  reason: string,
378
- wasClean: boolean
443
+ wasClean: boolean,
379
444
  ): void | Promise<void>;
380
445
  webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
381
446
  }
382
- declare interface DurableObjectStub extends Fetcher {
447
+ declare type DurableObjectStub<
448
+ T extends Rpc.DurableObjectBranded | undefined = undefined,
449
+ > = Fetcher<
450
+ T,
451
+ "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
452
+ > & {
383
453
  readonly id: DurableObjectId;
384
454
  readonly name?: string;
385
- }
455
+ };
386
456
  declare interface DurableObjectId {
387
457
  toString(): string;
388
458
  equals(other: DurableObjectId): boolean;
389
459
  readonly name?: string;
390
460
  }
391
- declare interface DurableObjectNamespace {
461
+ declare interface DurableObjectNamespace<
462
+ T extends Rpc.DurableObjectBranded | undefined = undefined,
463
+ > {
392
464
  newUniqueId(
393
- options?: DurableObjectNamespaceNewUniqueIdOptions
465
+ options?: DurableObjectNamespaceNewUniqueIdOptions,
394
466
  ): DurableObjectId;
395
467
  idFromName(name: string): DurableObjectId;
396
468
  idFromString(id: string): DurableObjectId;
397
- get(
398
- id: DurableObjectId,
399
- options?: DurableObjectNamespaceGetDurableObjectOptions
400
- ): DurableObjectStub;
401
- jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
469
+ get(id: DurableObjectId): DurableObjectStub<T>;
470
+ jurisdiction(
471
+ jurisdiction: DurableObjectJurisdiction,
472
+ ): DurableObjectNamespace<T>;
402
473
  }
403
474
  declare type DurableObjectJurisdiction = "eu" | "fedramp";
404
475
  declare interface DurableObjectNamespaceNewUniqueIdOptions {
@@ -434,23 +505,23 @@ declare interface DurableObjectState {
434
505
  declare interface DurableObjectTransaction {
435
506
  get<T = unknown>(
436
507
  key: string,
437
- options?: DurableObjectGetOptions
508
+ options?: DurableObjectGetOptions,
438
509
  ): Promise<T | undefined>;
439
510
  get<T = unknown>(
440
511
  keys: string[],
441
- options?: DurableObjectGetOptions
512
+ options?: DurableObjectGetOptions,
442
513
  ): Promise<Map<string, T>>;
443
514
  list<T = unknown>(
444
- options?: DurableObjectListOptions
515
+ options?: DurableObjectListOptions,
445
516
  ): Promise<Map<string, T>>;
446
517
  put<T>(
447
518
  key: string,
448
519
  value: T,
449
- options?: DurableObjectPutOptions
520
+ options?: DurableObjectPutOptions,
450
521
  ): Promise<void>;
451
522
  put<T>(
452
523
  entries: Record<string, T>,
453
- options?: DurableObjectPutOptions
524
+ options?: DurableObjectPutOptions,
454
525
  ): Promise<void>;
455
526
  delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
456
527
  delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
@@ -458,41 +529,41 @@ declare interface DurableObjectTransaction {
458
529
  getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
459
530
  setAlarm(
460
531
  scheduledTime: number | Date,
461
- options?: DurableObjectSetAlarmOptions
532
+ options?: DurableObjectSetAlarmOptions,
462
533
  ): Promise<void>;
463
534
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
464
535
  }
465
536
  declare interface DurableObjectStorage {
466
537
  get<T = unknown>(
467
538
  key: string,
468
- options?: DurableObjectGetOptions
539
+ options?: DurableObjectGetOptions,
469
540
  ): Promise<T | undefined>;
470
541
  get<T = unknown>(
471
542
  keys: string[],
472
- options?: DurableObjectGetOptions
543
+ options?: DurableObjectGetOptions,
473
544
  ): Promise<Map<string, T>>;
474
545
  list<T = unknown>(
475
- options?: DurableObjectListOptions
546
+ options?: DurableObjectListOptions,
476
547
  ): Promise<Map<string, T>>;
477
548
  put<T>(
478
549
  key: string,
479
550
  value: T,
480
- options?: DurableObjectPutOptions
551
+ options?: DurableObjectPutOptions,
481
552
  ): Promise<void>;
482
553
  put<T>(
483
554
  entries: Record<string, T>,
484
- options?: DurableObjectPutOptions
555
+ options?: DurableObjectPutOptions,
485
556
  ): Promise<void>;
486
557
  delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
487
558
  delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
488
559
  deleteAll(options?: DurableObjectPutOptions): Promise<void>;
489
560
  transaction<T>(
490
- closure: (txn: DurableObjectTransaction) => Promise<T>
561
+ closure: (txn: DurableObjectTransaction) => Promise<T>,
491
562
  ): Promise<T>;
492
563
  getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
493
564
  setAlarm(
494
565
  scheduledTime: number | Date,
495
- options?: DurableObjectSetAlarmOptions
566
+ options?: DurableObjectSetAlarmOptions,
496
567
  ): Promise<void>;
497
568
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
498
569
  sync(): Promise<void>;
@@ -539,22 +610,107 @@ declare interface AnalyticsEngineDataPoint {
539
610
  }
540
611
  declare class Event {
541
612
  constructor(type: string, init?: EventInit);
613
+ /**
614
+ * Returns the type of event, e.g. "click", "hashchange", or "submit".
615
+ *
616
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
617
+ */
542
618
  get type(): string;
619
+ /**
620
+ * Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE.
621
+ *
622
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
623
+ */
543
624
  get eventPhase(): number;
625
+ /**
626
+ * 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.
627
+ *
628
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
629
+ */
544
630
  get composed(): boolean;
631
+ /**
632
+ * 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.
633
+ *
634
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)
635
+ */
545
636
  get bubbles(): boolean;
637
+ /**
638
+ * 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.
639
+ *
640
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)
641
+ */
546
642
  get cancelable(): boolean;
643
+ /**
644
+ * Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise.
645
+ *
646
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)
647
+ */
547
648
  get defaultPrevented(): boolean;
649
+ /**
650
+ * @deprecated
651
+ *
652
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)
653
+ */
548
654
  get returnValue(): boolean;
655
+ /**
656
+ * Returns the object whose event listener's callback is currently being invoked.
657
+ *
658
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
659
+ */
549
660
  get currentTarget(): EventTarget | undefined;
661
+ /**
662
+ * @deprecated
663
+ *
664
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
665
+ */
550
666
  get srcElement(): EventTarget | undefined;
667
+ /**
668
+ * Returns the event's timestamp as the number of milliseconds measured relative to the time origin.
669
+ *
670
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)
671
+ */
551
672
  get timeStamp(): number;
673
+ /**
674
+ * Returns true if event was dispatched by the user agent, and false otherwise.
675
+ *
676
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
677
+ */
552
678
  get isTrusted(): boolean;
679
+ /**
680
+ * @deprecated
681
+ *
682
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
683
+ */
553
684
  get cancelBubble(): boolean;
685
+ /**
686
+ * @deprecated
687
+ *
688
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
689
+ */
554
690
  set cancelBubble(value: boolean);
691
+ /**
692
+ * 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.
693
+ *
694
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
695
+ */
555
696
  stopImmediatePropagation(): void;
697
+ /**
698
+ * 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.
699
+ *
700
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
701
+ */
556
702
  preventDefault(): void;
703
+ /**
704
+ * When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object.
705
+ *
706
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
707
+ */
557
708
  stopPropagation(): void;
709
+ /**
710
+ * 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.
711
+ *
712
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
713
+ */
558
714
  composedPath(): EventTarget[];
559
715
  static readonly NONE: number;
560
716
  static readonly CAPTURING_PHASE: number;
@@ -567,28 +723,55 @@ declare interface EventInit {
567
723
  composed?: boolean;
568
724
  }
569
725
  declare type EventListener<EventType extends Event = Event> = (
570
- event: EventType
726
+ event: EventType,
571
727
  ) => void;
572
728
  declare interface EventListenerObject<EventType extends Event = Event> {
573
729
  handleEvent(event: EventType): void;
574
730
  }
575
731
  declare type EventListenerOrEventListenerObject<
576
- EventType extends Event = Event
732
+ EventType extends Event = Event,
577
733
  > = EventListener<EventType> | EventListenerObject<EventType>;
578
734
  declare class EventTarget<
579
- EventMap extends Record<string, Event> = Record<string, Event>
735
+ EventMap extends Record<string, Event> = Record<string, Event>,
580
736
  > {
581
737
  constructor();
738
+ /**
739
+ * 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.
740
+ *
741
+ * 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.
742
+ *
743
+ * 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.
744
+ *
745
+ * 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.
746
+ *
747
+ * When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
748
+ *
749
+ * If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
750
+ *
751
+ * The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
752
+ *
753
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
754
+ */
582
755
  addEventListener<Type extends keyof EventMap>(
583
756
  type: Type,
584
757
  handler: EventListenerOrEventListenerObject<EventMap[Type]>,
585
- options?: EventTargetAddEventListenerOptions | boolean
758
+ options?: EventTargetAddEventListenerOptions | boolean,
586
759
  ): void;
760
+ /**
761
+ * Removes the event listener in target's event listener list with the same type, callback, and options.
762
+ *
763
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
764
+ */
587
765
  removeEventListener<Type extends keyof EventMap>(
588
766
  type: Type,
589
767
  handler: EventListenerOrEventListenerObject<EventMap[Type]>,
590
- options?: EventTargetEventListenerOptions | boolean
768
+ options?: EventTargetEventListenerOptions | boolean,
591
769
  ): void;
770
+ /**
771
+ * 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.
772
+ *
773
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
774
+ */
592
775
  dispatchEvent(event: EventMap[keyof EventMap]): boolean;
593
776
  }
594
777
  declare interface EventTargetEventListenerOptions {
@@ -605,15 +788,34 @@ declare interface EventTargetHandlerObject {
605
788
  }
606
789
  declare class AbortController {
607
790
  constructor();
791
+ /**
792
+ * Returns the AbortSignal object associated with this object.
793
+ *
794
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)
795
+ */
608
796
  get signal(): AbortSignal;
797
+ /**
798
+ * 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.
799
+ *
800
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)
801
+ */
609
802
  abort(reason?: any): void;
610
803
  }
611
804
  declare abstract class AbortSignal extends EventTarget {
805
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) */
612
806
  static abort(reason?: any): AbortSignal;
807
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static) */
613
808
  static timeout(delay: number): AbortSignal;
614
809
  static any(signals: AbortSignal[]): AbortSignal;
810
+ /**
811
+ * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
812
+ *
813
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)
814
+ */
615
815
  get aborted(): boolean;
816
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason) */
616
817
  get reason(): any;
818
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted) */
617
819
  throwIfAborted(): void;
618
820
  }
619
821
  declare interface Scheduler {
@@ -623,10 +825,16 @@ declare interface SchedulerWaitOptions {
623
825
  signal?: AbortSignal;
624
826
  }
625
827
  declare abstract class ExtendableEvent extends Event {
828
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil) */
626
829
  waitUntil(promise: Promise<any>): void;
627
830
  }
628
831
  declare class CustomEvent<T = any> extends Event {
629
832
  constructor(type: string, init?: CustomEventCustomEventInit);
833
+ /**
834
+ * Returns any custom data event was created with. Typically used for synthetic events.
835
+ *
836
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
837
+ */
630
838
  get detail(): T;
631
839
  }
632
840
  declare interface CustomEventCustomEventInit {
@@ -638,13 +846,19 @@ declare interface CustomEventCustomEventInit {
638
846
  declare class Blob {
639
847
  constructor(
640
848
  bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[],
641
- options?: BlobOptions
849
+ options?: BlobOptions,
642
850
  );
851
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
643
852
  get size(): number;
853
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
644
854
  get type(): string;
855
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
645
856
  slice(start?: number, end?: number, type?: string): Blob;
857
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) */
646
858
  arrayBuffer(): Promise<ArrayBuffer>;
859
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
647
860
  text(): Promise<string>;
861
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream) */
648
862
  stream(): ReadableStream;
649
863
  }
650
864
  declare interface BlobOptions {
@@ -654,9 +868,11 @@ declare class File extends Blob {
654
868
  constructor(
655
869
  bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined,
656
870
  name: string,
657
- options?: FileOptions
871
+ options?: FileOptions,
658
872
  );
873
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
659
874
  get name(): string;
875
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
660
876
  get lastModified(): number;
661
877
  }
662
878
  declare interface FileOptions {
@@ -664,6 +880,7 @@ declare interface FileOptions {
664
880
  lastModified?: number;
665
881
  }
666
882
  declare abstract class CacheStorage {
883
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open) */
667
884
  open(cacheName: string): Promise<Cache>;
668
885
  readonly default: Cache;
669
886
  }
@@ -671,7 +888,7 @@ declare abstract class Cache {
671
888
  delete(request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>;
672
889
  match(
673
890
  request: RequestInfo,
674
- options?: CacheQueryOptions
891
+ options?: CacheQueryOptions,
675
892
  ): Promise<Response | undefined>;
676
893
  put(request: RequestInfo, response: Response): Promise<void>;
677
894
  }
@@ -679,7 +896,13 @@ declare interface CacheQueryOptions {
679
896
  ignoreMethod?: boolean;
680
897
  }
681
898
  declare abstract class Crypto {
899
+ /**
900
+ * Available only in secure contexts.
901
+ *
902
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
903
+ */
682
904
  get subtle(): SubtleCrypto;
905
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */
683
906
  getRandomValues<
684
907
  T extends
685
908
  | Int8Array
@@ -689,8 +912,13 @@ declare abstract class Crypto {
689
912
  | Int32Array
690
913
  | Uint32Array
691
914
  | BigInt64Array
692
- | BigUint64Array
915
+ | BigUint64Array,
693
916
  >(buffer: T): T;
917
+ /**
918
+ * Available only in secure contexts.
919
+ *
920
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)
921
+ */
694
922
  randomUUID(): string;
695
923
  DigestStream: typeof DigestStream;
696
924
  }
@@ -698,59 +926,63 @@ declare abstract class SubtleCrypto {
698
926
  encrypt(
699
927
  algorithm: string | SubtleCryptoEncryptAlgorithm,
700
928
  key: CryptoKey,
701
- plainText: ArrayBuffer | ArrayBufferView
929
+ plainText: ArrayBuffer | ArrayBufferView,
702
930
  ): Promise<ArrayBuffer>;
703
931
  decrypt(
704
932
  algorithm: string | SubtleCryptoEncryptAlgorithm,
705
933
  key: CryptoKey,
706
- cipherText: ArrayBuffer | ArrayBufferView
934
+ cipherText: ArrayBuffer | ArrayBufferView,
707
935
  ): Promise<ArrayBuffer>;
708
936
  sign(
709
937
  algorithm: string | SubtleCryptoSignAlgorithm,
710
938
  key: CryptoKey,
711
- data: ArrayBuffer | ArrayBufferView
939
+ data: ArrayBuffer | ArrayBufferView,
712
940
  ): Promise<ArrayBuffer>;
713
941
  verify(
714
942
  algorithm: string | SubtleCryptoSignAlgorithm,
715
943
  key: CryptoKey,
716
944
  signature: ArrayBuffer | ArrayBufferView,
717
- data: ArrayBuffer | ArrayBufferView
945
+ data: ArrayBuffer | ArrayBufferView,
718
946
  ): Promise<boolean>;
719
947
  digest(
720
948
  algorithm: string | SubtleCryptoHashAlgorithm,
721
- data: ArrayBuffer | ArrayBufferView
949
+ data: ArrayBuffer | ArrayBufferView,
722
950
  ): Promise<ArrayBuffer>;
951
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) */
723
952
  generateKey(
724
953
  algorithm: string | SubtleCryptoGenerateKeyAlgorithm,
725
954
  extractable: boolean,
726
- keyUsages: string[]
955
+ keyUsages: string[],
727
956
  ): Promise<CryptoKey | CryptoKeyPair>;
957
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey) */
728
958
  deriveKey(
729
959
  algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
730
960
  baseKey: CryptoKey,
731
961
  derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
732
962
  extractable: boolean,
733
- keyUsages: string[]
963
+ keyUsages: string[],
734
964
  ): Promise<CryptoKey>;
735
965
  deriveBits(
736
966
  algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
737
967
  baseKey: CryptoKey,
738
- length: number | null
968
+ length: number | null,
739
969
  ): Promise<ArrayBuffer>;
970
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) */
740
971
  importKey(
741
972
  format: string,
742
973
  keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey,
743
974
  algorithm: string | SubtleCryptoImportKeyAlgorithm,
744
975
  extractable: boolean,
745
- keyUsages: string[]
976
+ keyUsages: string[],
746
977
  ): Promise<CryptoKey>;
747
978
  exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
748
979
  wrapKey(
749
980
  format: string,
750
981
  key: CryptoKey,
751
982
  wrappingKey: CryptoKey,
752
- wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm
983
+ wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
753
984
  ): Promise<ArrayBuffer>;
985
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey) */
754
986
  unwrapKey(
755
987
  format: string,
756
988
  wrappedKey: ArrayBuffer | ArrayBufferView,
@@ -758,16 +990,19 @@ declare abstract class SubtleCrypto {
758
990
  unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
759
991
  unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
760
992
  extractable: boolean,
761
- keyUsages: string[]
993
+ keyUsages: string[],
762
994
  ): Promise<CryptoKey>;
763
995
  timingSafeEqual(
764
996
  a: ArrayBuffer | ArrayBufferView,
765
- b: ArrayBuffer | ArrayBufferView
997
+ b: ArrayBuffer | ArrayBufferView,
766
998
  ): boolean;
767
999
  }
768
1000
  declare abstract class CryptoKey {
1001
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) */
769
1002
  readonly type: string;
1003
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable) */
770
1004
  readonly extractable: boolean;
1005
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm) */
771
1006
  readonly algorithm:
772
1007
  | CryptoKeyKeyAlgorithm
773
1008
  | CryptoKeyAesKeyAlgorithm
@@ -775,6 +1010,7 @@ declare abstract class CryptoKey {
775
1010
  | CryptoKeyRsaKeyAlgorithm
776
1011
  | CryptoKeyEllipticKeyAlgorithm
777
1012
  | CryptoKeyArbitraryKeyAlgorithm;
1013
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages) */
778
1014
  readonly usages: string[];
779
1015
  }
780
1016
  declare interface CryptoKeyPair {
@@ -883,9 +1119,24 @@ declare class DigestStream extends WritableStream<
883
1119
  }
884
1120
  declare class TextDecoder {
885
1121
  constructor(decoder?: string, options?: TextDecoderConstructorOptions);
1122
+ /**
1123
+ * 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.
1124
+ *
1125
+ * ```
1126
+ * var string = "", decoder = new TextDecoder(encoding), buffer;
1127
+ * while(buffer = next_chunk()) {
1128
+ * string += decoder.decode(buffer, {stream:true});
1129
+ * }
1130
+ * string += decoder.decode(); // end-of-queue
1131
+ * ```
1132
+ *
1133
+ * If the error mode is "fatal" and encoding's decoder returns error, throws a TypeError.
1134
+ *
1135
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)
1136
+ */
886
1137
  decode(
887
1138
  input?: ArrayBuffer | ArrayBufferView,
888
- options?: TextDecoderDecodeOptions
1139
+ options?: TextDecoderDecodeOptions,
889
1140
  ): string;
890
1141
  get encoding(): string;
891
1142
  get fatal(): boolean;
@@ -893,10 +1144,20 @@ declare class TextDecoder {
893
1144
  }
894
1145
  declare class TextEncoder {
895
1146
  constructor();
1147
+ /**
1148
+ * Returns the result of running UTF-8's encoder.
1149
+ *
1150
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)
1151
+ */
896
1152
  encode(input?: string): Uint8Array;
1153
+ /**
1154
+ * 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.
1155
+ *
1156
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)
1157
+ */
897
1158
  encodeInto(
898
1159
  input: string,
899
- buffer: ArrayBuffer | ArrayBufferView
1160
+ buffer: ArrayBuffer | ArrayBufferView,
900
1161
  ): TextEncoderEncodeIntoResult;
901
1162
  get encoding(): string;
902
1163
  }
@@ -921,17 +1182,20 @@ declare class FormData {
921
1182
  has(name: string): boolean;
922
1183
  set(name: string, value: string): void;
923
1184
  set(name: string, value: Blob, filename?: string): void;
1185
+ /** Returns an array of key, value pairs for every entry in the list. */
924
1186
  entries(): IterableIterator<[key: string, value: File | string]>;
1187
+ /** Returns a list of keys in the list. */
925
1188
  keys(): IterableIterator<string>;
1189
+ /** Returns a list of values in the list. */
926
1190
  values(): IterableIterator<File | string>;
927
1191
  forEach<This = unknown>(
928
1192
  callback: (
929
1193
  this: This,
930
1194
  value: File | string,
931
1195
  key: string,
932
- parent: FormData
1196
+ parent: FormData,
933
1197
  ) => void,
934
- thisArg?: This
1198
+ thisArg?: This,
935
1199
  ): void;
936
1200
  [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>;
937
1201
  }
@@ -942,7 +1206,7 @@ declare class HTMLRewriter {
942
1206
  constructor();
943
1207
  on(
944
1208
  selector: string,
945
- handlers: HTMLRewriterElementContentHandlers
1209
+ handlers: HTMLRewriterElementContentHandlers,
946
1210
  ): HTMLRewriter;
947
1211
  onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;
948
1212
  transform(response: Response): Response;
@@ -1009,7 +1273,9 @@ declare interface DocumentEnd {
1009
1273
  append(content: string, options?: ContentOptions): DocumentEnd;
1010
1274
  }
1011
1275
  declare abstract class FetchEvent extends ExtendableEvent {
1276
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request) */
1012
1277
  readonly request: Request;
1278
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith) */
1013
1279
  respondWith(promise: Response | Promise<Response>): void;
1014
1280
  passThroughOnException(): void;
1015
1281
  }
@@ -1027,10 +1293,13 @@ declare class Headers {
1027
1293
  delete(name: string): void;
1028
1294
  forEach<This = unknown>(
1029
1295
  callback: (this: This, value: string, key: string, parent: Headers) => void,
1030
- thisArg?: This
1296
+ thisArg?: This,
1031
1297
  ): void;
1298
+ /** Returns an iterator allowing to go through all key/value pairs contained in this object. */
1032
1299
  entries(): IterableIterator<[key: string, value: string]>;
1300
+ /** Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */
1033
1301
  keys(): IterableIterator<string>;
1302
+ /** Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
1034
1303
  values(): IterableIterator<string>;
1035
1304
  [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
1036
1305
  }
@@ -1053,14 +1322,23 @@ declare abstract class Body {
1053
1322
  }
1054
1323
  declare class Response extends Body {
1055
1324
  constructor(body?: BodyInit | null, init?: ResponseInit);
1325
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirect_static) */
1056
1326
  static redirect(url: string, status?: number): Response;
1327
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/json_static) */
1057
1328
  static json(any: any, maybeInit?: ResponseInit | Response): Response;
1329
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) */
1058
1330
  clone(): Response;
1331
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) */
1059
1332
  get status(): number;
1333
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText) */
1060
1334
  get statusText(): string;
1335
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) */
1061
1336
  get headers(): Headers;
1337
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok) */
1062
1338
  get ok(): boolean;
1339
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected) */
1063
1340
  get redirected(): boolean;
1341
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) */
1064
1342
  get url(): string;
1065
1343
  get webSocket(): WebSocket | null;
1066
1344
  get cf(): any | undefined;
@@ -1075,22 +1353,58 @@ declare interface ResponseInit {
1075
1353
  }
1076
1354
  declare type RequestInfo<
1077
1355
  CfHostMetadata = unknown,
1078
- Cf = CfProperties<CfHostMetadata>
1356
+ Cf = CfProperties<CfHostMetadata>,
1079
1357
  > = Request<CfHostMetadata, Cf> | string | URL;
1080
1358
  declare class Request<
1081
1359
  CfHostMetadata = unknown,
1082
- Cf = CfProperties<CfHostMetadata>
1360
+ Cf = CfProperties<CfHostMetadata>,
1083
1361
  > extends Body {
1084
1362
  constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
1363
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) */
1085
1364
  clone(): Request<CfHostMetadata, Cf>;
1365
+ /**
1366
+ * Returns request's HTTP method, which is "GET" by default.
1367
+ *
1368
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
1369
+ */
1086
1370
  get method(): string;
1371
+ /**
1372
+ * Returns the URL of request as a string.
1373
+ *
1374
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)
1375
+ */
1087
1376
  get url(): string;
1377
+ /**
1378
+ * 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.
1379
+ *
1380
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
1381
+ */
1088
1382
  get headers(): Headers;
1383
+ /**
1384
+ * 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.
1385
+ *
1386
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)
1387
+ */
1089
1388
  get redirect(): string;
1090
1389
  get fetcher(): Fetcher | null;
1390
+ /**
1391
+ * Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.
1392
+ *
1393
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)
1394
+ */
1091
1395
  get signal(): AbortSignal;
1092
1396
  get cf(): Cf | undefined;
1397
+ /**
1398
+ * 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]
1399
+ *
1400
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)
1401
+ */
1093
1402
  get integrity(): string;
1403
+ /**
1404
+ * Returns a boolean indicating whether or not request can outlive the global in which it was created.
1405
+ *
1406
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
1407
+ */
1094
1408
  get keepalive(): boolean;
1095
1409
  }
1096
1410
  declare interface RequestInit<Cf = CfProperties> {
@@ -1109,10 +1423,18 @@ declare interface RequestInit<Cf = CfProperties> {
1109
1423
  /** An AbortSignal to set request's signal. */
1110
1424
  signal?: AbortSignal | null;
1111
1425
  }
1112
- declare abstract class Fetcher {
1426
+ declare type Service<
1427
+ T extends Rpc.WorkerEntrypointBranded | undefined = undefined,
1428
+ > = Fetcher<T>;
1429
+ declare type Fetcher<
1430
+ T extends Rpc.EntrypointBranded | undefined = undefined,
1431
+ Reserved extends string = never,
1432
+ > = (T extends Rpc.EntrypointBranded
1433
+ ? Rpc.Provider<T, Reserved | "fetch" | "connect">
1434
+ : unknown) & {
1113
1435
  fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1114
1436
  connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1115
- }
1437
+ };
1116
1438
  declare interface FetcherPutOptions {
1117
1439
  expiration?: number;
1118
1440
  expirationTtl?: number;
@@ -1137,74 +1459,74 @@ declare type KVNamespaceListResult<Metadata, Key extends string = string> =
1137
1459
  declare interface KVNamespace<Key extends string = string> {
1138
1460
  get(
1139
1461
  key: Key,
1140
- options?: Partial<KVNamespaceGetOptions<undefined>>
1462
+ options?: Partial<KVNamespaceGetOptions<undefined>>,
1141
1463
  ): Promise<string | null>;
1142
1464
  get(key: Key, type: "text"): Promise<string | null>;
1143
1465
  get<ExpectedValue = unknown>(
1144
1466
  key: Key,
1145
- type: "json"
1467
+ type: "json",
1146
1468
  ): Promise<ExpectedValue | null>;
1147
1469
  get(key: Key, type: "arrayBuffer"): Promise<ArrayBuffer | null>;
1148
1470
  get(key: Key, type: "stream"): Promise<ReadableStream | null>;
1149
1471
  get(
1150
1472
  key: Key,
1151
- options?: KVNamespaceGetOptions<"text">
1473
+ options?: KVNamespaceGetOptions<"text">,
1152
1474
  ): Promise<string | null>;
1153
1475
  get<ExpectedValue = unknown>(
1154
1476
  key: Key,
1155
- options?: KVNamespaceGetOptions<"json">
1477
+ options?: KVNamespaceGetOptions<"json">,
1156
1478
  ): Promise<ExpectedValue | null>;
1157
1479
  get(
1158
1480
  key: Key,
1159
- options?: KVNamespaceGetOptions<"arrayBuffer">
1481
+ options?: KVNamespaceGetOptions<"arrayBuffer">,
1160
1482
  ): Promise<ArrayBuffer | null>;
1161
1483
  get(
1162
1484
  key: Key,
1163
- options?: KVNamespaceGetOptions<"stream">
1485
+ options?: KVNamespaceGetOptions<"stream">,
1164
1486
  ): Promise<ReadableStream | null>;
1165
1487
  list<Metadata = unknown>(
1166
- options?: KVNamespaceListOptions
1488
+ options?: KVNamespaceListOptions,
1167
1489
  ): Promise<KVNamespaceListResult<Metadata, Key>>;
1168
1490
  put(
1169
1491
  key: Key,
1170
1492
  value: string | ArrayBuffer | ArrayBufferView | ReadableStream,
1171
- options?: KVNamespacePutOptions
1493
+ options?: KVNamespacePutOptions,
1172
1494
  ): Promise<void>;
1173
1495
  getWithMetadata<Metadata = unknown>(
1174
1496
  key: Key,
1175
- options?: Partial<KVNamespaceGetOptions<undefined>>
1497
+ options?: Partial<KVNamespaceGetOptions<undefined>>,
1176
1498
  ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1177
1499
  getWithMetadata<Metadata = unknown>(
1178
1500
  key: Key,
1179
- type: "text"
1501
+ type: "text",
1180
1502
  ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1181
1503
  getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
1182
1504
  key: Key,
1183
- type: "json"
1505
+ type: "json",
1184
1506
  ): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
1185
1507
  getWithMetadata<Metadata = unknown>(
1186
1508
  key: Key,
1187
- type: "arrayBuffer"
1509
+ type: "arrayBuffer",
1188
1510
  ): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
1189
1511
  getWithMetadata<Metadata = unknown>(
1190
1512
  key: Key,
1191
- type: "stream"
1513
+ type: "stream",
1192
1514
  ): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
1193
1515
  getWithMetadata<Metadata = unknown>(
1194
1516
  key: Key,
1195
- options: KVNamespaceGetOptions<"text">
1517
+ options: KVNamespaceGetOptions<"text">,
1196
1518
  ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1197
1519
  getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
1198
1520
  key: Key,
1199
- options: KVNamespaceGetOptions<"json">
1521
+ options: KVNamespaceGetOptions<"json">,
1200
1522
  ): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
1201
1523
  getWithMetadata<Metadata = unknown>(
1202
1524
  key: Key,
1203
- options: KVNamespaceGetOptions<"arrayBuffer">
1525
+ options: KVNamespaceGetOptions<"arrayBuffer">,
1204
1526
  ): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
1205
1527
  getWithMetadata<Metadata = unknown>(
1206
1528
  key: Key,
1207
- options: KVNamespaceGetOptions<"stream">
1529
+ options: KVNamespaceGetOptions<"stream">,
1208
1530
  ): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
1209
1531
  delete(key: Key): Promise<void>;
1210
1532
  }
@@ -1232,7 +1554,7 @@ declare interface Queue<Body = unknown> {
1232
1554
  send(message: Body, options?: QueueSendOptions): Promise<void>;
1233
1555
  sendBatch(
1234
1556
  messages: Iterable<MessageSendRequest<Body>>,
1235
- options?: QueueSendBatchOptions
1557
+ options?: QueueSendBatchOptions,
1236
1558
  ): Promise<void>;
1237
1559
  }
1238
1560
  declare interface QueueSendOptions {
@@ -1254,6 +1576,7 @@ declare interface Message<Body = unknown> {
1254
1576
  readonly id: string;
1255
1577
  readonly timestamp: Date;
1256
1578
  readonly body: Body;
1579
+ readonly attempts: number;
1257
1580
  retry(options?: QueueRetryOptions): void;
1258
1581
  ack(): void;
1259
1582
  }
@@ -1289,7 +1612,7 @@ declare abstract class R2Bucket {
1289
1612
  key: string,
1290
1613
  options: R2GetOptions & {
1291
1614
  onlyIf: R2Conditional | Headers;
1292
- }
1615
+ },
1293
1616
  ): Promise<R2ObjectBody | R2Object | null>;
1294
1617
  get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;
1295
1618
  put(
@@ -1303,7 +1626,7 @@ declare abstract class R2Bucket {
1303
1626
  | Blob,
1304
1627
  options?: R2PutOptions & {
1305
1628
  onlyIf: R2Conditional | Headers;
1306
- }
1629
+ },
1307
1630
  ): Promise<R2Object | null>;
1308
1631
  put(
1309
1632
  key: string,
@@ -1314,11 +1637,11 @@ declare abstract class R2Bucket {
1314
1637
  | string
1315
1638
  | null
1316
1639
  | Blob,
1317
- options?: R2PutOptions
1640
+ options?: R2PutOptions,
1318
1641
  ): Promise<R2Object>;
1319
1642
  createMultipartUpload(
1320
1643
  key: string,
1321
- options?: R2MultipartOptions
1644
+ options?: R2MultipartOptions,
1322
1645
  ): Promise<R2MultipartUpload>;
1323
1646
  resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;
1324
1647
  delete(keys: string | string[]): Promise<void>;
@@ -1329,7 +1652,7 @@ declare interface R2MultipartUpload {
1329
1652
  readonly uploadId: string;
1330
1653
  uploadPart(
1331
1654
  partNumber: number,
1332
- value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob
1655
+ value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob,
1333
1656
  ): Promise<R2UploadedPart>;
1334
1657
  abort(): Promise<void>;
1335
1658
  complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
@@ -1450,7 +1773,7 @@ declare interface UnderlyingSink<W = any> {
1450
1773
  start?: (controller: WritableStreamDefaultController) => void | Promise<void>;
1451
1774
  write?: (
1452
1775
  chunk: W,
1453
- controller: WritableStreamDefaultController
1776
+ controller: WritableStreamDefaultController,
1454
1777
  ) => void | Promise<void>;
1455
1778
  abort?: (reason: any) => void | Promise<void>;
1456
1779
  close?: () => void | Promise<void>;
@@ -1465,10 +1788,10 @@ declare interface UnderlyingByteSource {
1465
1788
  declare interface UnderlyingSource<R = any> {
1466
1789
  type?: "" | undefined;
1467
1790
  start?: (
1468
- controller: ReadableStreamDefaultController<R>
1791
+ controller: ReadableStreamDefaultController<R>,
1469
1792
  ) => void | Promise<void>;
1470
1793
  pull?: (
1471
- controller: ReadableStreamDefaultController<R>
1794
+ controller: ReadableStreamDefaultController<R>,
1472
1795
  ) => void | Promise<void>;
1473
1796
  cancel?: (reason: any) => void | Promise<void>;
1474
1797
  expectedLength?: number | bigint;
@@ -1477,14 +1800,14 @@ declare interface Transformer<I = any, O = any> {
1477
1800
  readableType?: string;
1478
1801
  writableType?: string;
1479
1802
  start?: (
1480
- controller: TransformStreamDefaultController<O>
1803
+ controller: TransformStreamDefaultController<O>,
1481
1804
  ) => void | Promise<void>;
1482
1805
  transform?: (
1483
1806
  chunk: I,
1484
- controller: TransformStreamDefaultController<O>
1807
+ controller: TransformStreamDefaultController<O>,
1485
1808
  ) => void | Promise<void>;
1486
1809
  flush?: (
1487
- controller: TransformStreamDefaultController<O>
1810
+ controller: TransformStreamDefaultController<O>,
1488
1811
  ) => void | Promise<void>;
1489
1812
  cancel?: (reason: any) => void | Promise<void>;
1490
1813
  expectedLength?: number;
@@ -1521,91 +1844,137 @@ declare type ReadableStreamReadResult<R = any> =
1521
1844
  done: true;
1522
1845
  value?: undefined;
1523
1846
  };
1524
- /** 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. */
1847
+ /**
1848
+ * 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
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
1851
+ */
1525
1852
  declare interface ReadableStream<R = any> {
1853
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked) */
1526
1854
  get locked(): boolean;
1855
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel) */
1527
1856
  cancel(reason?: any): Promise<void>;
1857
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
1528
1858
  getReader(): ReadableStreamDefaultReader<R>;
1859
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
1529
1860
  getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
1861
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough) */
1530
1862
  pipeThrough<T>(
1531
1863
  transform: ReadableWritablePair<T, R>,
1532
- options?: StreamPipeOptions
1864
+ options?: StreamPipeOptions,
1533
1865
  ): ReadableStream<T>;
1866
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo) */
1534
1867
  pipeTo(
1535
1868
  destination: WritableStream<R>,
1536
- options?: StreamPipeOptions
1869
+ options?: StreamPipeOptions,
1537
1870
  ): Promise<void>;
1871
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee) */
1538
1872
  tee(): [ReadableStream<R>, ReadableStream<R>];
1539
1873
  values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
1540
1874
  [Symbol.asyncIterator](
1541
- options?: ReadableStreamValuesOptions
1875
+ options?: ReadableStreamValuesOptions,
1542
1876
  ): AsyncIterableIterator<R>;
1543
1877
  }
1544
1878
  declare const ReadableStream: {
1545
1879
  prototype: ReadableStream;
1546
1880
  new (
1547
1881
  underlyingSource: UnderlyingByteSource,
1548
- strategy?: QueuingStrategy<Uint8Array>
1882
+ strategy?: QueuingStrategy<Uint8Array>,
1549
1883
  ): ReadableStream<Uint8Array>;
1550
1884
  new <R = any>(
1551
1885
  underlyingSource?: UnderlyingSource<R>,
1552
- strategy?: QueuingStrategy<R>
1886
+ strategy?: QueuingStrategy<R>,
1553
1887
  ): ReadableStream<R>;
1554
1888
  };
1555
1889
  declare class ReadableStreamDefaultReader<R = any> {
1556
1890
  constructor(stream: ReadableStream);
1557
1891
  get closed(): Promise<void>;
1558
1892
  cancel(reason?: any): Promise<void>;
1893
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read) */
1559
1894
  read(): Promise<ReadableStreamReadResult<R>>;
1895
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock) */
1560
1896
  releaseLock(): void;
1561
1897
  }
1562
1898
  declare class ReadableStreamBYOBReader {
1563
1899
  constructor(stream: ReadableStream);
1564
1900
  get closed(): Promise<void>;
1565
1901
  cancel(reason?: any): Promise<void>;
1902
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) */
1566
1903
  read<T extends ArrayBufferView>(
1567
- view: T
1904
+ view: T,
1568
1905
  ): Promise<ReadableStreamReadResult<T>>;
1906
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) */
1569
1907
  releaseLock(): void;
1570
1908
  readAtLeast<T extends ArrayBufferView>(
1571
1909
  minElements: number,
1572
- view: T
1910
+ view: T,
1573
1911
  ): Promise<ReadableStreamReadResult<T>>;
1574
1912
  }
1575
1913
  declare interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
1576
1914
  min?: number;
1577
1915
  }
1578
1916
  declare interface ReadableStreamGetReaderOptions {
1917
+ /**
1918
+ * Creates a ReadableStreamBYOBReader and locks the stream to the new reader.
1919
+ *
1920
+ * 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.
1921
+ */
1579
1922
  mode: "byob";
1580
1923
  }
1924
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest) */
1581
1925
  declare interface ReadableStreamBYOBRequest {
1926
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view) */
1582
1927
  readonly view: Uint8Array | null;
1928
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond) */
1583
1929
  respond(bytesWritten: number): void;
1930
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView) */
1584
1931
  respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;
1585
1932
  readonly atLeast: number | null;
1586
1933
  }
1934
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController) */
1587
1935
  declare interface ReadableStreamDefaultController<R = any> {
1936
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize) */
1588
1937
  readonly desiredSize: number | null;
1938
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close) */
1589
1939
  close(): void;
1940
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue) */
1590
1941
  enqueue(chunk?: R): void;
1942
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error) */
1591
1943
  error(reason: any): void;
1592
1944
  }
1945
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController) */
1593
1946
  declare interface ReadableByteStreamController {
1947
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest) */
1594
1948
  readonly byobRequest: ReadableStreamBYOBRequest | null;
1949
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize) */
1595
1950
  readonly desiredSize: number | null;
1951
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close) */
1596
1952
  close(): void;
1953
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue) */
1597
1954
  enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
1955
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error) */
1598
1956
  error(reason: any): void;
1599
1957
  }
1600
- /** 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. */
1958
+ /**
1959
+ * 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
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)
1962
+ */
1601
1963
  declare interface WritableStreamDefaultController {
1964
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal) */
1602
1965
  readonly signal: AbortSignal;
1966
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error) */
1603
1967
  error(reason?: any): void;
1604
1968
  }
1969
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController) */
1605
1970
  declare interface TransformStreamDefaultController<O = any> {
1971
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize) */
1606
1972
  get desiredSize(): number | null;
1973
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue) */
1607
1974
  enqueue(chunk?: O): void;
1975
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error) */
1608
1976
  error(reason: any): void;
1977
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate) */
1609
1978
  terminate(): void;
1610
1979
  }
1611
1980
  declare interface ReadableWritablePair<R = any, W = any> {
@@ -1620,36 +1989,49 @@ declare interface ReadableWritablePair<R = any, W = any> {
1620
1989
  declare class WritableStream<W = any> {
1621
1990
  constructor(
1622
1991
  underlyingSink?: UnderlyingSink,
1623
- queuingStrategy?: QueuingStrategy
1992
+ queuingStrategy?: QueuingStrategy,
1624
1993
  );
1994
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked) */
1625
1995
  get locked(): boolean;
1996
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort) */
1626
1997
  abort(reason?: any): Promise<void>;
1998
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close) */
1627
1999
  close(): Promise<void>;
2000
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter) */
1628
2001
  getWriter(): WritableStreamDefaultWriter<W>;
1629
2002
  }
1630
2003
  declare class WritableStreamDefaultWriter<W = any> {
1631
2004
  constructor(stream: WritableStream);
2005
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed) */
1632
2006
  get closed(): Promise<void>;
2007
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready) */
1633
2008
  get ready(): Promise<void>;
2009
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize) */
1634
2010
  get desiredSize(): number | null;
2011
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort) */
1635
2012
  abort(reason?: any): Promise<void>;
2013
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close) */
1636
2014
  close(): Promise<void>;
2015
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write) */
1637
2016
  write(chunk?: W): Promise<void>;
2017
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock) */
1638
2018
  releaseLock(): void;
1639
2019
  }
1640
2020
  declare class TransformStream<I = any, O = any> {
1641
2021
  constructor(
1642
2022
  transformer?: Transformer<I, O>,
1643
2023
  writableStrategy?: QueuingStrategy<I>,
1644
- readableStrategy?: QueuingStrategy<O>
2024
+ readableStrategy?: QueuingStrategy<O>,
1645
2025
  );
2026
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable) */
1646
2027
  get readable(): ReadableStream<O>;
2028
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable) */
1647
2029
  get writable(): WritableStream<I>;
1648
2030
  }
1649
2031
  declare class FixedLengthStream extends IdentityTransformStream {
1650
2032
  constructor(
1651
2033
  expectedLength: number | bigint,
1652
- queuingStrategy?: IdentityTransformStreamQueuingStrategy
2034
+ queuingStrategy?: IdentityTransformStreamQueuingStrategy,
1653
2035
  );
1654
2036
  }
1655
2037
  declare class IdentityTransformStream extends TransformStream<
@@ -1692,12 +2074,16 @@ declare class ByteLengthQueuingStrategy
1692
2074
  implements QueuingStrategy<ArrayBufferView>
1693
2075
  {
1694
2076
  constructor(init: QueuingStrategyInit);
2077
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark) */
1695
2078
  get highWaterMark(): number;
2079
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */
1696
2080
  get size(): (chunk?: any) => number;
1697
2081
  }
1698
2082
  declare class CountQueuingStrategy implements QueuingStrategy {
1699
2083
  constructor(init: QueuingStrategyInit);
2084
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark) */
1700
2085
  get highWaterMark(): number;
2086
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */
1701
2087
  get size(): (chunk?: any) => number;
1702
2088
  }
1703
2089
  declare interface QueuingStrategyInit {
@@ -1721,6 +2107,7 @@ declare interface TraceItem {
1721
2107
  readonly event:
1722
2108
  | (
1723
2109
  | TraceItemFetchEventInfo
2110
+ | TraceItemJsRpcEventInfo
1724
2111
  | TraceItemScheduledEventInfo
1725
2112
  | TraceItemAlarmEventInfo
1726
2113
  | TraceItemQueueEventInfo
@@ -1735,6 +2122,7 @@ declare interface TraceItem {
1735
2122
  readonly exceptions: TraceException[];
1736
2123
  readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
1737
2124
  readonly scriptName: string | null;
2125
+ readonly entrypoint?: string;
1738
2126
  readonly scriptVersion?: ScriptVersion;
1739
2127
  readonly dispatchNamespace?: string;
1740
2128
  readonly scriptTags?: string[];
@@ -1777,6 +2165,9 @@ declare interface TraceItemFetchEventInfoRequest {
1777
2165
  declare interface TraceItemFetchEventInfoResponse {
1778
2166
  readonly status: number;
1779
2167
  }
2168
+ declare interface TraceItemJsRpcEventInfo {
2169
+ readonly rpcMethod: string;
2170
+ }
1780
2171
  declare interface TraceItemHibernatableWebSocketEventInfo {
1781
2172
  readonly getWebSocketEvent:
1782
2173
  | TraceItemHibernatableWebSocketEventInfoMessage
@@ -1803,6 +2194,7 @@ declare interface TraceException {
1803
2194
  readonly timestamp: number;
1804
2195
  readonly message: string;
1805
2196
  readonly name: string;
2197
+ readonly stack?: string;
1806
2198
  }
1807
2199
  declare interface TraceDiagnosticChannelEvent {
1808
2200
  readonly timestamp: number;
@@ -1818,29 +2210,52 @@ declare interface UnsafeTraceMetrics {
1818
2210
  }
1819
2211
  declare class URL {
1820
2212
  constructor(url: string | URL, base?: string | URL);
2213
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) */
1821
2214
  get href(): string;
2215
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) */
1822
2216
  set href(value: string);
2217
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin) */
1823
2218
  get origin(): string;
2219
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) */
1824
2220
  get protocol(): string;
2221
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) */
1825
2222
  set protocol(value: string);
2223
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */
1826
2224
  get username(): string;
2225
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */
1827
2226
  set username(value: string);
2227
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */
1828
2228
  get password(): string;
2229
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */
1829
2230
  set password(value: string);
2231
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */
1830
2232
  get host(): string;
2233
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */
1831
2234
  set host(value: string);
2235
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */
1832
2236
  get hostname(): string;
2237
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */
1833
2238
  set hostname(value: string);
2239
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */
1834
2240
  get port(): string;
2241
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */
1835
2242
  set port(value: string);
2243
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */
1836
2244
  get pathname(): string;
2245
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */
1837
2246
  set pathname(value: string);
2247
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */
1838
2248
  get search(): string;
2249
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */
1839
2250
  set search(value: string);
2251
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams) */
1840
2252
  get searchParams(): URLSearchParams;
2253
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */
1841
2254
  get hash(): string;
2255
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */
1842
2256
  set hash(value: string);
1843
2257
  toString(): string;
2258
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON) */
1844
2259
  toJSON(): string;
1845
2260
  }
1846
2261
  declare class URLSearchParams {
@@ -1849,7 +2264,7 @@ declare class URLSearchParams {
1849
2264
  | URLSearchParams
1850
2265
  | string
1851
2266
  | Record<string, string>
1852
- | [key: string, value: string][]
2267
+ | [key: string, value: string][],
1853
2268
  );
1854
2269
  get size(): number;
1855
2270
  append(name: string, value: string): void;
@@ -1859,17 +2274,20 @@ declare class URLSearchParams {
1859
2274
  has(name: string): boolean;
1860
2275
  set(name: string, value: string): void;
1861
2276
  sort(): void;
2277
+ /** Returns an array of key, value pairs for every entry in the search params. */
1862
2278
  entries(): IterableIterator<[key: string, value: string]>;
2279
+ /** Returns a list of keys in the search params. */
1863
2280
  keys(): IterableIterator<string>;
2281
+ /** Returns a list of values in the search params. */
1864
2282
  values(): IterableIterator<string>;
1865
2283
  forEach<This = unknown>(
1866
2284
  callback: (
1867
2285
  this: This,
1868
2286
  value: string,
1869
2287
  key: string,
1870
- parent: URLSearchParams
2288
+ parent: URLSearchParams,
1871
2289
  ) => void,
1872
- thisArg?: This
2290
+ thisArg?: This,
1873
2291
  ): void;
1874
2292
  toString(): string;
1875
2293
  [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
@@ -1878,7 +2296,7 @@ declare class URLPattern {
1878
2296
  constructor(
1879
2297
  input?: string | URLPatternURLPatternInit,
1880
2298
  baseURL?: string,
1881
- patternOptions?: URLPatternURLPatternOptions
2299
+ patternOptions?: URLPatternURLPatternOptions,
1882
2300
  );
1883
2301
  get protocol(): string;
1884
2302
  get username(): string;
@@ -1891,7 +2309,7 @@ declare class URLPattern {
1891
2309
  test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean;
1892
2310
  exec(
1893
2311
  input?: string | URLPatternURLPatternInit,
1894
- baseURL?: string
2312
+ baseURL?: string,
1895
2313
  ): URLPatternURLPatternResult | null;
1896
2314
  }
1897
2315
  declare interface URLPatternURLPatternInit {
@@ -1925,11 +2343,23 @@ declare interface URLPatternURLPatternOptions {
1925
2343
  }
1926
2344
  declare class CloseEvent extends Event {
1927
2345
  constructor(type: string, initializer?: CloseEventInit);
1928
- /** Returns the WebSocket connection close code provided by the server. */
2346
+ /**
2347
+ * Returns the WebSocket connection close code provided by the server.
2348
+ *
2349
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)
2350
+ */
1929
2351
  readonly code: number;
1930
- /** Returns the WebSocket connection close reason provided by the server. */
2352
+ /**
2353
+ * Returns the WebSocket connection close reason provided by the server.
2354
+ *
2355
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)
2356
+ */
1931
2357
  readonly reason: string;
1932
- /** Returns true if the connection closed cleanly; false otherwise. */
2358
+ /**
2359
+ * Returns true if the connection closed cleanly; false otherwise.
2360
+ *
2361
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)
2362
+ */
1933
2363
  readonly wasClean: boolean;
1934
2364
  }
1935
2365
  declare interface CloseEventInit {
@@ -1944,12 +2374,21 @@ declare class MessageEvent extends Event {
1944
2374
  declare interface MessageEventInit {
1945
2375
  data: ArrayBuffer | string;
1946
2376
  }
1947
- /** Events providing information related to errors in scripts or in files. */
2377
+ /**
2378
+ * Events providing information related to errors in scripts or in files.
2379
+ *
2380
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)
2381
+ */
1948
2382
  declare interface ErrorEvent extends Event {
2383
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename) */
1949
2384
  readonly filename: string;
2385
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message) */
1950
2386
  readonly message: string;
2387
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno) */
1951
2388
  readonly lineno: number;
2389
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno) */
1952
2390
  readonly colno: number;
2391
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error) */
1953
2392
  readonly error: any;
1954
2393
  }
1955
2394
  declare type WebSocketEventMap = {
@@ -1961,7 +2400,17 @@ declare type WebSocketEventMap = {
1961
2400
  declare class WebSocket extends EventTarget<WebSocketEventMap> {
1962
2401
  constructor(url: string, protocols?: string[] | string);
1963
2402
  accept(): void;
2403
+ /**
2404
+ * Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
2405
+ *
2406
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
2407
+ */
1964
2408
  send(message: (ArrayBuffer | ArrayBufferView) | string): void;
2409
+ /**
2410
+ * Closes the WebSocket connection, optionally using code as the the WebSocket connection close code and reason as the the WebSocket connection close reason.
2411
+ *
2412
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)
2413
+ */
1965
2414
  close(code?: number, reason?: string): void;
1966
2415
  serializeAttachment(attachment: any): void;
1967
2416
  deserializeAttachment(): any | null;
@@ -1973,9 +2422,29 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
1973
2422
  static readonly CLOSING: number;
1974
2423
  static readonly READY_STATE_CLOSED: number;
1975
2424
  static readonly CLOSED: number;
2425
+ /**
2426
+ * Returns the state of the WebSocket object's connection. It can have the values described below.
2427
+ *
2428
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)
2429
+ */
1976
2430
  get readyState(): number;
2431
+ /**
2432
+ * Returns the URL that was used to establish the WebSocket connection.
2433
+ *
2434
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)
2435
+ */
1977
2436
  get url(): string | null;
2437
+ /**
2438
+ * 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.
2439
+ *
2440
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)
2441
+ */
1978
2442
  get protocol(): string | null;
2443
+ /**
2444
+ * Returns the extensions selected by the server, if any.
2445
+ *
2446
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
2447
+ */
1979
2448
  get extensions(): string | null;
1980
2449
  }
1981
2450
  declare const WebSocketPair: {
@@ -2016,24 +2485,24 @@ declare abstract class gpuGPUAdapter {
2016
2485
  declare interface gpuGPUDevice extends EventTarget {
2017
2486
  createBuffer(param1: gpuGPUBufferDescriptor): gpuGPUBuffer;
2018
2487
  createBindGroupLayout(
2019
- descriptor: gpuGPUBindGroupLayoutDescriptor
2488
+ descriptor: gpuGPUBindGroupLayoutDescriptor,
2020
2489
  ): gpuGPUBindGroupLayout;
2021
2490
  createBindGroup(descriptor: gpuGPUBindGroupDescriptor): gpuGPUBindGroup;
2022
2491
  createSampler(descriptor: gpuGPUSamplerDescriptor): gpuGPUSampler;
2023
2492
  createShaderModule(
2024
- descriptor: gpuGPUShaderModuleDescriptor
2493
+ descriptor: gpuGPUShaderModuleDescriptor,
2025
2494
  ): gpuGPUShaderModule;
2026
2495
  createPipelineLayout(
2027
- descriptor: gpuGPUPipelineLayoutDescriptor
2496
+ descriptor: gpuGPUPipelineLayoutDescriptor,
2028
2497
  ): gpuGPUPipelineLayout;
2029
2498
  createComputePipeline(
2030
- descriptor: gpuGPUComputePipelineDescriptor
2499
+ descriptor: gpuGPUComputePipelineDescriptor,
2031
2500
  ): gpuGPUComputePipeline;
2032
2501
  createRenderPipeline(
2033
- descriptor: gpuGPURenderPipelineDescriptor
2502
+ descriptor: gpuGPURenderPipelineDescriptor,
2034
2503
  ): gpuGPURenderPipeline;
2035
2504
  createCommandEncoder(
2036
- descriptor?: gpuGPUCommandEncoderDescriptor
2505
+ descriptor?: gpuGPUCommandEncoderDescriptor,
2037
2506
  ): gpuGPUCommandEncoder;
2038
2507
  createTexture(param1: gpuGPUTextureDescriptor): gpuGPUTexture;
2039
2508
  destroy(): void;
@@ -2079,7 +2548,7 @@ declare interface gpuGPUBuffer {
2079
2548
  mapAsync(
2080
2549
  offset: number,
2081
2550
  size?: number | bigint,
2082
- param3?: number | bigint
2551
+ param3?: number | bigint,
2083
2552
  ): Promise<void>;
2084
2553
  get size(): number | bigint;
2085
2554
  get usage(): number;
@@ -2178,38 +2647,38 @@ declare interface gpuGPUProgrammableStage {
2178
2647
  declare interface gpuGPUCommandEncoder {
2179
2648
  get label(): string;
2180
2649
  beginComputePass(
2181
- descriptor?: gpuGPUComputePassDescriptor
2650
+ descriptor?: gpuGPUComputePassDescriptor,
2182
2651
  ): gpuGPUComputePassEncoder;
2183
2652
  beginRenderPass(
2184
- descriptor: gpuGPURenderPassDescriptor
2653
+ descriptor: gpuGPURenderPassDescriptor,
2185
2654
  ): gpuGPURenderPassEncoder;
2186
2655
  copyBufferToBuffer(
2187
2656
  source: gpuGPUBuffer,
2188
2657
  sourceOffset: number | bigint,
2189
2658
  destination: gpuGPUBuffer,
2190
2659
  destinationOffset: number | bigint,
2191
- size: number | bigint
2660
+ size: number | bigint,
2192
2661
  ): void;
2193
2662
  finish(param0?: gpuGPUCommandBufferDescriptor): gpuGPUCommandBuffer;
2194
2663
  copyTextureToBuffer(
2195
2664
  source: gpuGPUImageCopyTexture,
2196
2665
  destination: gpuGPUImageCopyBuffer,
2197
- copySize: Iterable<number> | gpuGPUExtent3DDict
2666
+ copySize: Iterable<number> | gpuGPUExtent3DDict,
2198
2667
  ): void;
2199
2668
  copyBufferToTexture(
2200
2669
  source: gpuGPUImageCopyBuffer,
2201
2670
  destination: gpuGPUImageCopyTexture,
2202
- copySize: Iterable<number> | gpuGPUExtent3DDict
2671
+ copySize: Iterable<number> | gpuGPUExtent3DDict,
2203
2672
  ): void;
2204
2673
  copyTextureToTexture(
2205
2674
  source: gpuGPUImageCopyTexture,
2206
2675
  destination: gpuGPUImageCopyTexture,
2207
- copySize: Iterable<number> | gpuGPUExtent3DDict
2676
+ copySize: Iterable<number> | gpuGPUExtent3DDict,
2208
2677
  ): void;
2209
2678
  clearBuffer(
2210
2679
  buffer: gpuGPUBuffer,
2211
2680
  offset?: number | bigint,
2212
- size?: number | bigint
2681
+ size?: number | bigint,
2213
2682
  ): void;
2214
2683
  }
2215
2684
  declare interface gpuGPUCommandEncoderDescriptor {
@@ -2220,12 +2689,12 @@ declare interface gpuGPUComputePassEncoder {
2220
2689
  setBindGroup(
2221
2690
  index: number,
2222
2691
  bindGroup: gpuGPUBindGroup | null,
2223
- dynamicOffsets?: Iterable<number>
2692
+ dynamicOffsets?: Iterable<number>,
2224
2693
  ): void;
2225
2694
  dispatchWorkgroups(
2226
2695
  workgroupCountX: number,
2227
2696
  workgroupCountY?: number,
2228
- workgroupCountZ?: number
2697
+ workgroupCountZ?: number,
2229
2698
  ): void;
2230
2699
  end(): void;
2231
2700
  }
@@ -2253,7 +2722,7 @@ declare interface gpuGPUQueue {
2253
2722
  bufferOffset: number | bigint,
2254
2723
  data: ArrayBuffer | ArrayBufferView,
2255
2724
  dataOffset?: number | bigint,
2256
- size?: number | bigint
2725
+ size?: number | bigint,
2257
2726
  ): void;
2258
2727
  }
2259
2728
  declare abstract class gpuGPUMapMode {
@@ -2457,7 +2926,7 @@ declare interface gpuGPURenderPassEncoder {
2457
2926
  vertexCount: number,
2458
2927
  instanceCount?: number,
2459
2928
  firstVertex?: number,
2460
- firstInstance?: number
2929
+ firstInstance?: number,
2461
2930
  ): void;
2462
2931
  end(): void;
2463
2932
  }
@@ -2955,7 +3424,7 @@ declare interface IncomingRequestCfPropertiesBotManagementEnterprise
2955
3424
  };
2956
3425
  }
2957
3426
  declare interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<
2958
- HostMetadata
3427
+ HostMetadata,
2959
3428
  > {
2960
3429
  /**
2961
3430
  * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/).
@@ -3525,6 +3994,13 @@ declare abstract class D1PreparedStatement {
3525
3994
  }): Promise<[string[], ...T[]]>;
3526
3995
  raw<T = unknown[]>(options?: { columnNames?: false }): Promise<T[]>;
3527
3996
  }
3997
+ // `Disposable` was added to TypeScript's standard lib types in version 5.2.
3998
+ // To support older TypeScript versions, define an empty `Disposable` interface.
3999
+ // Users won't be able to use `using`/`Symbol.dispose` without upgrading to 5.2,
4000
+ // but this will ensure type checking on older versions still passes.
4001
+ // TypeScript's interface merging will ensure our empty interface is effectively
4002
+ // ignored when `Disposable` is included in the standard lib.
4003
+ declare interface Disposable {}
3528
4004
  /**
3529
4005
  * An email message that can be sent from a Worker.
3530
4006
  */
@@ -3580,7 +4056,7 @@ declare abstract class EmailEvent extends ExtendableEvent {
3580
4056
  declare type EmailExportedHandler<Env = unknown> = (
3581
4057
  message: ForwardableEmailMessage,
3582
4058
  env: Env,
3583
- ctx: ExecutionContext
4059
+ ctx: ExecutionContext,
3584
4060
  ) => void | Promise<void>;
3585
4061
  declare module "cloudflare:email" {
3586
4062
  let _EmailMessage: {
@@ -3654,7 +4130,7 @@ declare type EventContext<Env, P extends string, Data> = {
3654
4130
  declare type PagesFunction<
3655
4131
  Env = unknown,
3656
4132
  Params extends string = any,
3657
- Data extends Record<string, unknown> = Record<string, unknown>
4133
+ Data extends Record<string, unknown> = Record<string, unknown>,
3658
4134
  > = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
3659
4135
  declare type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
3660
4136
  request: Request<unknown, IncomingRequestCfProperties<unknown>>;
@@ -3675,9 +4151,9 @@ declare type PagesPluginFunction<
3675
4151
  Env = unknown,
3676
4152
  Params extends string = any,
3677
4153
  Data extends Record<string, unknown> = Record<string, unknown>,
3678
- PluginArgs = unknown
4154
+ PluginArgs = unknown,
3679
4155
  > = (
3680
- context: EventPluginContext<Env, Params, Data, PluginArgs>
4156
+ context: EventPluginContext<Env, Params, Data, PluginArgs>,
3681
4157
  ) => Response | Promise<Response>;
3682
4158
  declare module "assets:*" {
3683
4159
  export const onRequest: PagesFunction;
@@ -3716,10 +4192,207 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
3716
4192
  // Key Identifier of the JWK
3717
4193
  readonly kid: string;
3718
4194
  }
4195
+ // Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need
4196
+ // to referenced by `Fetcher`. This is included in the "importable" version of the types which
4197
+ // strips all `module` blocks.
4198
+ declare namespace Rpc {
4199
+ // Branded types for identifying `WorkerEntrypoint`/`DurableObject`/`Target`s.
4200
+ // TypeScript uses *structural* typing meaning anything with the same shape as type `T` is a `T`.
4201
+ // For the classes exported by `cloudflare:workers` we want *nominal* typing (i.e. we only want to
4202
+ // accept `WorkerEntrypoint` from `cloudflare:workers`, not any other class with the same shape)
4203
+ export const __RPC_STUB_BRAND: unique symbol;
4204
+ export const __RPC_TARGET_BRAND: unique symbol;
4205
+ export const __WORKER_ENTRYPOINT_BRAND: unique symbol;
4206
+ export const __DURABLE_OBJECT_BRAND: unique symbol;
4207
+ export interface RpcTargetBranded {
4208
+ [__RPC_TARGET_BRAND]: never;
4209
+ }
4210
+ export interface WorkerEntrypointBranded {
4211
+ [__WORKER_ENTRYPOINT_BRAND]: never;
4212
+ }
4213
+ export interface DurableObjectBranded {
4214
+ [__DURABLE_OBJECT_BRAND]: never;
4215
+ }
4216
+ export type EntrypointBranded =
4217
+ | WorkerEntrypointBranded
4218
+ | DurableObjectBranded;
4219
+ // Types that can be used through `Stub`s
4220
+ export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
4221
+ // Types that can be passed over RPC
4222
+ type Serializable =
4223
+ // Structured cloneables
4224
+ | void
4225
+ | undefined
4226
+ | null
4227
+ | boolean
4228
+ | number
4229
+ | bigint
4230
+ | string
4231
+ | TypedArray
4232
+ | ArrayBuffer
4233
+ | DataView
4234
+ | Date
4235
+ | Error
4236
+ | RegExp
4237
+ // Structured cloneable composites
4238
+ | Map<Serializable, Serializable>
4239
+ | Set<Serializable>
4240
+ | ReadonlyArray<Serializable>
4241
+ | {
4242
+ [key: string | number]: Serializable;
4243
+ }
4244
+ // Special types
4245
+ | ReadableStream<Uint8Array>
4246
+ | WritableStream<Uint8Array>
4247
+ | Request
4248
+ | Response
4249
+ | Headers
4250
+ | Stub<Stubable>
4251
+ // Serialized as stubs, see `Stubify`
4252
+ | Stubable;
4253
+ // Base type for all RPC stubs, including common memory management methods.
4254
+ // `T` is used as a marker type for unwrapping `Stub`s later.
4255
+ interface StubBase<T extends Stubable> extends Disposable {
4256
+ [__RPC_STUB_BRAND]: T;
4257
+ dup(): this;
4258
+ }
4259
+ export type Stub<T extends Stubable> = Provider<T> & StubBase<T>;
4260
+ // Recursively rewrite all `Stubable` types with `Stub`s
4261
+ type Stubify<T> = T extends Stubable
4262
+ ? Stub<T>
4263
+ : T extends Map<infer K, infer V>
4264
+ ? Map<Stubify<K>, Stubify<V>>
4265
+ : T extends Set<infer V>
4266
+ ? Set<Stubify<V>>
4267
+ : T extends Array<infer V>
4268
+ ? Array<Stubify<V>>
4269
+ : T extends ReadonlyArray<infer V>
4270
+ ? ReadonlyArray<Stubify<V>>
4271
+ : T extends {
4272
+ [key: string | number]: unknown;
4273
+ }
4274
+ ? {
4275
+ [K in keyof T]: Stubify<T[K]>;
4276
+ }
4277
+ : T;
4278
+ // Recursively rewrite all `Stub<T>`s with the corresponding `T`s.
4279
+ // Note we use `StubBase` instead of `Stub` here to avoid circular dependencies:
4280
+ // `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`.
4281
+ type Unstubify<T> =
4282
+ T extends StubBase<infer V>
4283
+ ? V
4284
+ : T extends Map<infer K, infer V>
4285
+ ? Map<Unstubify<K>, Unstubify<V>>
4286
+ : T extends Set<infer V>
4287
+ ? Set<Unstubify<V>>
4288
+ : T extends Array<infer V>
4289
+ ? Array<Unstubify<V>>
4290
+ : T extends ReadonlyArray<infer V>
4291
+ ? ReadonlyArray<Unstubify<V>>
4292
+ : T extends {
4293
+ [key: string | number]: unknown;
4294
+ }
4295
+ ? {
4296
+ [K in keyof T]: Unstubify<T[K]>;
4297
+ }
4298
+ : T;
4299
+ type UnstubifyAll<A extends any[]> = {
4300
+ [I in keyof A]: Unstubify<A[I]>;
4301
+ };
4302
+ // Utility type for adding `Provider`/`Disposable`s to `object` types only.
4303
+ // Note `unknown & T` is equivalent to `T`.
4304
+ type MaybeProvider<T> = T extends object ? Provider<T> : unknown;
4305
+ type MaybeDisposable<T> = T extends object ? Disposable : unknown;
4306
+ // Type for method return or property on an RPC interface.
4307
+ // - Stubable types are replaced by stubs.
4308
+ // - Serializable types are passed by value, with stubable types replaced by stubs
4309
+ // and a top-level `Disposer`.
4310
+ // Everything else can't be passed over PRC.
4311
+ // Technically, we use custom thenables here, but they quack like `Promise`s.
4312
+ // Intersecting with `(Maybe)Provider` allows pipelining.
4313
+ type Result<R> = R extends Stubable
4314
+ ? Promise<Stub<R>> & Provider<R>
4315
+ : R extends Serializable
4316
+ ? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R>
4317
+ : never;
4318
+ // Type for method or property on an RPC interface.
4319
+ // For methods, unwrap `Stub`s in parameters, and rewrite returns to be `Result`s.
4320
+ // Unwrapping `Stub`s allows calling with `Stubable` arguments.
4321
+ // For properties, rewrite types to be `Result`s.
4322
+ // In each case, unwrap `Promise`s.
4323
+ type MethodOrProperty<V> = V extends (...args: infer P) => infer R
4324
+ ? (...args: UnstubifyAll<P>) => Result<Awaited<R>>
4325
+ : Result<Awaited<V>>;
4326
+ // Type for the callable part of an `Provider` if `T` is callable.
4327
+ // This is intersected with methods/properties.
4328
+ type MaybeCallableProvider<T> = T extends (...args: any[]) => any
4329
+ ? MethodOrProperty<T>
4330
+ : unknown;
4331
+ // Base type for all other types providing RPC-like interfaces.
4332
+ // Rewrites all methods/properties to be `MethodOrProperty`s, while preserving callable types.
4333
+ // `Reserved` names (e.g. stub method names like `dup()`) and symbols can't be accessed over RPC.
4334
+ export type Provider<
4335
+ T extends object,
4336
+ Reserved extends string = never,
4337
+ > = MaybeCallableProvider<T> & {
4338
+ [K in Exclude<
4339
+ keyof T,
4340
+ Reserved | symbol | keyof StubBase<never>
4341
+ >]: MethodOrProperty<T[K]>;
4342
+ };
4343
+ }
4344
+ declare module "cloudflare:workers" {
4345
+ export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;
4346
+ export const RpcStub: {
4347
+ new <T extends Rpc.Stubable>(value: T): Rpc.Stub<T>;
4348
+ };
4349
+ export abstract class RpcTarget implements Rpc.RpcTargetBranded {
4350
+ [Rpc.__RPC_TARGET_BRAND]: never;
4351
+ [Symbol.dispose]?(): void;
4352
+ }
4353
+ // `protected` fields don't appear in `keyof`s, so can't be accessed over RPC
4354
+ export abstract class WorkerEntrypoint<Env = unknown>
4355
+ implements Rpc.WorkerEntrypointBranded
4356
+ {
4357
+ [Rpc.__WORKER_ENTRYPOINT_BRAND]: never;
4358
+ protected ctx: ExecutionContext;
4359
+ protected env: Env;
4360
+ constructor(ctx: ExecutionContext, env: Env);
4361
+ [Symbol.dispose]?(): void;
4362
+ fetch?(request: Request): Response | Promise<Response>;
4363
+ tail?(events: TraceItem[]): void | Promise<void>;
4364
+ trace?(traces: TraceItem[]): void | Promise<void>;
4365
+ scheduled?(controller: ScheduledController): void | Promise<void>;
4366
+ queue?(batch: MessageBatch<unknown>): void | Promise<void>;
4367
+ test?(controller: TestController): void | Promise<void>;
4368
+ }
4369
+ export abstract class DurableObject<Env = unknown>
4370
+ implements Rpc.DurableObjectBranded
4371
+ {
4372
+ [Rpc.__DURABLE_OBJECT_BRAND]: never;
4373
+ protected ctx: DurableObjectState;
4374
+ protected env: Env;
4375
+ constructor(ctx: DurableObjectState, env: Env);
4376
+ [Symbol.dispose]?(): void;
4377
+ fetch?(request: Request): Response | Promise<Response>;
4378
+ alarm?(): void | Promise<void>;
4379
+ webSocketMessage?(
4380
+ ws: WebSocket,
4381
+ message: string | ArrayBuffer,
4382
+ ): void | Promise<void>;
4383
+ webSocketClose?(
4384
+ ws: WebSocket,
4385
+ code: number,
4386
+ reason: string,
4387
+ wasClean: boolean,
4388
+ ): void | Promise<void>;
4389
+ webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
4390
+ }
4391
+ }
3719
4392
  declare module "cloudflare:sockets" {
3720
4393
  function _connect(
3721
4394
  address: string | SocketAddress,
3722
- options?: SocketOptions
4395
+ options?: SocketOptions,
3723
4396
  ): Socket;
3724
4397
  export { _connect as connect };
3725
4398
  }
@@ -3855,7 +4528,7 @@ declare abstract class VectorizeIndex {
3855
4528
  */
3856
4529
  public query(
3857
4530
  vector: VectorFloatArray | number[],
3858
- options: VectorizeQueryOptions
4531
+ options: VectorizeQueryOptions,
3859
4532
  ): Promise<VectorizeMatches>;
3860
4533
  /**
3861
4534
  * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
@@ -3882,6 +4555,16 @@ declare abstract class VectorizeIndex {
3882
4555
  */
3883
4556
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
3884
4557
  }
4558
+ /**
4559
+ * The interface for "version_metadata" binding
4560
+ * providing metadata about the Worker Version using this binding.
4561
+ */
4562
+ declare type WorkerVersionMetadata = {
4563
+ /** The ID of the Worker Version using this binding */
4564
+ id: string;
4565
+ /** The tag of the Worker Version using this binding */
4566
+ tag: string;
4567
+ };
3885
4568
  declare interface DynamicDispatchLimits {
3886
4569
  /**
3887
4570
  * Limit CPU time in milliseconds.
@@ -3917,6 +4600,6 @@ declare interface DispatchNamespace {
3917
4600
  args?: {
3918
4601
  [key: string]: any;
3919
4602
  },
3920
- options?: DynamicDispatchOptions
4603
+ options?: DynamicDispatchOptions,
3921
4604
  ): Fetcher;
3922
4605
  }