@cloudflare/workers-types 4.20240320.1 → 4.20240402.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;
@@ -253,49 +295,64 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
253
295
  declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
254
296
  type: Type,
255
297
  handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
256
- options?: EventTargetAddEventListenerOptions | boolean
298
+ options?: EventTargetAddEventListenerOptions | boolean,
257
299
  ): void;
258
300
  declare function removeEventListener<
259
- Type extends keyof WorkerGlobalScopeEventMap
301
+ Type extends keyof WorkerGlobalScopeEventMap,
260
302
  >(
261
303
  type: Type,
262
304
  handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
263
- options?: EventTargetEventListenerOptions | boolean
305
+ options?: EventTargetEventListenerOptions | boolean,
264
306
  ): void;
265
- /** 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. */
307
+ /**
308
+ * 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.
309
+ *
310
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
311
+ */
266
312
  declare function dispatchEvent(
267
- event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]
313
+ event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap],
268
314
  ): boolean;
315
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/btoa) */
269
316
  declare function btoa(data: string): string;
317
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/atob) */
270
318
  declare function atob(data: string): string;
319
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
271
320
  declare function setTimeout(
272
321
  callback: (...args: any[]) => void,
273
- msDelay?: number
322
+ msDelay?: number,
274
323
  ): number;
324
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
275
325
  declare function setTimeout<Args extends any[]>(
276
326
  callback: (...args: Args) => void,
277
327
  msDelay?: number,
278
328
  ...args: Args
279
329
  ): number;
330
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearTimeout) */
280
331
  declare function clearTimeout(timeoutId: number | null): void;
332
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
281
333
  declare function setInterval(
282
334
  callback: (...args: any[]) => void,
283
- msDelay?: number
335
+ msDelay?: number,
284
336
  ): number;
337
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
285
338
  declare function setInterval<Args extends any[]>(
286
339
  callback: (...args: Args) => void,
287
340
  msDelay?: number,
288
341
  ...args: Args
289
342
  ): number;
343
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearInterval) */
290
344
  declare function clearInterval(timeoutId: number | null): void;
345
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/queueMicrotask) */
291
346
  declare function queueMicrotask(task: Function): void;
347
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/structuredClone) */
292
348
  declare function structuredClone<T>(
293
349
  value: T,
294
- options?: StructuredSerializeOptions
350
+ options?: StructuredSerializeOptions,
295
351
  ): T;
352
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
296
353
  declare function fetch(
297
354
  input: RequestInfo,
298
- init?: RequestInit<RequestInitCfProperties>
355
+ init?: RequestInit<RequestInitCfProperties>,
299
356
  ): Promise<Response>;
300
357
  declare const self: ServiceWorkerGlobalScope;
301
358
  declare const crypto: Crypto;
@@ -311,41 +368,41 @@ declare interface ExecutionContext {
311
368
  }
312
369
  declare type ExportedHandlerFetchHandler<
313
370
  Env = unknown,
314
- CfHostMetadata = unknown
371
+ CfHostMetadata = unknown,
315
372
  > = (
316
373
  request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
317
374
  env: Env,
318
- ctx: ExecutionContext
375
+ ctx: ExecutionContext,
319
376
  ) => Response | Promise<Response>;
320
377
  declare type ExportedHandlerTailHandler<Env = unknown> = (
321
378
  events: TraceItem[],
322
379
  env: Env,
323
- ctx: ExecutionContext
380
+ ctx: ExecutionContext,
324
381
  ) => void | Promise<void>;
325
382
  declare type ExportedHandlerTraceHandler<Env = unknown> = (
326
383
  traces: TraceItem[],
327
384
  env: Env,
328
- ctx: ExecutionContext
385
+ ctx: ExecutionContext,
329
386
  ) => void | Promise<void>;
330
387
  declare type ExportedHandlerScheduledHandler<Env = unknown> = (
331
388
  controller: ScheduledController,
332
389
  env: Env,
333
- ctx: ExecutionContext
390
+ ctx: ExecutionContext,
334
391
  ) => void | Promise<void>;
335
392
  declare type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
336
393
  batch: MessageBatch<Message>,
337
394
  env: Env,
338
- ctx: ExecutionContext
395
+ ctx: ExecutionContext,
339
396
  ) => void | Promise<void>;
340
397
  declare type ExportedHandlerTestHandler<Env = unknown> = (
341
398
  controller: TestController,
342
399
  env: Env,
343
- ctx: ExecutionContext
400
+ ctx: ExecutionContext,
344
401
  ) => void | Promise<void>;
345
402
  declare interface ExportedHandler<
346
403
  Env = unknown,
347
404
  QueueHandlerMessage = unknown,
348
- CfHostMetadata = unknown
405
+ CfHostMetadata = unknown,
349
406
  > {
350
407
  fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
351
408
  tail?: ExportedHandlerTailHandler<Env>;
@@ -359,7 +416,9 @@ declare interface StructuredSerializeOptions {
359
416
  transfer?: any[];
360
417
  }
361
418
  declare abstract class PromiseRejectionEvent extends Event {
419
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise) */
362
420
  readonly promise: Promise<any>;
421
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason) */
363
422
  readonly reason: any;
364
423
  }
365
424
  declare abstract class Navigator {
@@ -371,14 +430,20 @@ declare abstract class Navigator {
371
430
  | (ArrayBuffer | ArrayBufferView)
372
431
  | Blob
373
432
  | URLSearchParams
374
- | FormData
433
+ | FormData,
375
434
  ): boolean;
376
435
  readonly userAgent: string;
377
436
  readonly gpu: gpuGPU;
378
437
  }
379
- /** 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. */
438
+ /**
439
+ * 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.
440
+ *
441
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance)
442
+ */
380
443
  declare interface Performance {
444
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/timeOrigin) */
381
445
  readonly timeOrigin: number;
446
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/now) */
382
447
  now(): number;
383
448
  }
384
449
  declare interface AlarmInvocationInfo {
@@ -390,36 +455,42 @@ declare interface DurableObject {
390
455
  alarm?(): void | Promise<void>;
391
456
  webSocketMessage?(
392
457
  ws: WebSocket,
393
- message: string | ArrayBuffer
458
+ message: string | ArrayBuffer,
394
459
  ): void | Promise<void>;
395
460
  webSocketClose?(
396
461
  ws: WebSocket,
397
462
  code: number,
398
463
  reason: string,
399
- wasClean: boolean
464
+ wasClean: boolean,
400
465
  ): void | Promise<void>;
401
466
  webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
402
467
  }
403
- declare interface DurableObjectStub extends Fetcher {
468
+ declare type DurableObjectStub<
469
+ T extends Rpc.DurableObjectBranded | undefined = undefined,
470
+ > = Fetcher<
471
+ T,
472
+ "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
473
+ > & {
404
474
  readonly id: DurableObjectId;
405
475
  readonly name?: string;
406
- }
476
+ };
407
477
  declare interface DurableObjectId {
408
478
  toString(): string;
409
479
  equals(other: DurableObjectId): boolean;
410
480
  readonly name?: string;
411
481
  }
412
- declare interface DurableObjectNamespace {
482
+ declare interface DurableObjectNamespace<
483
+ T extends Rpc.DurableObjectBranded | undefined = undefined,
484
+ > {
413
485
  newUniqueId(
414
- options?: DurableObjectNamespaceNewUniqueIdOptions
486
+ options?: DurableObjectNamespaceNewUniqueIdOptions,
415
487
  ): DurableObjectId;
416
488
  idFromName(name: string): DurableObjectId;
417
489
  idFromString(id: string): DurableObjectId;
418
- get(
419
- id: DurableObjectId,
420
- options?: DurableObjectNamespaceGetDurableObjectOptions
421
- ): DurableObjectStub;
422
- jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
490
+ get(id: DurableObjectId): DurableObjectStub<T>;
491
+ jurisdiction(
492
+ jurisdiction: DurableObjectJurisdiction,
493
+ ): DurableObjectNamespace<T>;
423
494
  }
424
495
  declare type DurableObjectJurisdiction = "eu" | "fedramp";
425
496
  declare interface DurableObjectNamespaceNewUniqueIdOptions {
@@ -455,23 +526,23 @@ declare interface DurableObjectState {
455
526
  declare interface DurableObjectTransaction {
456
527
  get<T = unknown>(
457
528
  key: string,
458
- options?: DurableObjectGetOptions
529
+ options?: DurableObjectGetOptions,
459
530
  ): Promise<T | undefined>;
460
531
  get<T = unknown>(
461
532
  keys: string[],
462
- options?: DurableObjectGetOptions
533
+ options?: DurableObjectGetOptions,
463
534
  ): Promise<Map<string, T>>;
464
535
  list<T = unknown>(
465
- options?: DurableObjectListOptions
536
+ options?: DurableObjectListOptions,
466
537
  ): Promise<Map<string, T>>;
467
538
  put<T>(
468
539
  key: string,
469
540
  value: T,
470
- options?: DurableObjectPutOptions
541
+ options?: DurableObjectPutOptions,
471
542
  ): Promise<void>;
472
543
  put<T>(
473
544
  entries: Record<string, T>,
474
- options?: DurableObjectPutOptions
545
+ options?: DurableObjectPutOptions,
475
546
  ): Promise<void>;
476
547
  delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
477
548
  delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
@@ -479,41 +550,41 @@ declare interface DurableObjectTransaction {
479
550
  getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
480
551
  setAlarm(
481
552
  scheduledTime: number | Date,
482
- options?: DurableObjectSetAlarmOptions
553
+ options?: DurableObjectSetAlarmOptions,
483
554
  ): Promise<void>;
484
555
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
485
556
  }
486
557
  declare interface DurableObjectStorage {
487
558
  get<T = unknown>(
488
559
  key: string,
489
- options?: DurableObjectGetOptions
560
+ options?: DurableObjectGetOptions,
490
561
  ): Promise<T | undefined>;
491
562
  get<T = unknown>(
492
563
  keys: string[],
493
- options?: DurableObjectGetOptions
564
+ options?: DurableObjectGetOptions,
494
565
  ): Promise<Map<string, T>>;
495
566
  list<T = unknown>(
496
- options?: DurableObjectListOptions
567
+ options?: DurableObjectListOptions,
497
568
  ): Promise<Map<string, T>>;
498
569
  put<T>(
499
570
  key: string,
500
571
  value: T,
501
- options?: DurableObjectPutOptions
572
+ options?: DurableObjectPutOptions,
502
573
  ): Promise<void>;
503
574
  put<T>(
504
575
  entries: Record<string, T>,
505
- options?: DurableObjectPutOptions
576
+ options?: DurableObjectPutOptions,
506
577
  ): Promise<void>;
507
578
  delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
508
579
  delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
509
580
  deleteAll(options?: DurableObjectPutOptions): Promise<void>;
510
581
  transaction<T>(
511
- closure: (txn: DurableObjectTransaction) => Promise<T>
582
+ closure: (txn: DurableObjectTransaction) => Promise<T>,
512
583
  ): Promise<T>;
513
584
  getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
514
585
  setAlarm(
515
586
  scheduledTime: number | Date,
516
- options?: DurableObjectSetAlarmOptions
587
+ options?: DurableObjectSetAlarmOptions,
517
588
  ): Promise<void>;
518
589
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
519
590
  sync(): Promise<void>;
@@ -560,22 +631,107 @@ declare interface AnalyticsEngineDataPoint {
560
631
  }
561
632
  declare class Event {
562
633
  constructor(type: string, init?: EventInit);
634
+ /**
635
+ * Returns the type of event, e.g. "click", "hashchange", or "submit".
636
+ *
637
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
638
+ */
563
639
  get type(): string;
640
+ /**
641
+ * Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE.
642
+ *
643
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
644
+ */
564
645
  get eventPhase(): number;
646
+ /**
647
+ * 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.
648
+ *
649
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
650
+ */
565
651
  get composed(): boolean;
652
+ /**
653
+ * 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.
654
+ *
655
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)
656
+ */
566
657
  get bubbles(): boolean;
658
+ /**
659
+ * 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.
660
+ *
661
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)
662
+ */
567
663
  get cancelable(): boolean;
664
+ /**
665
+ * Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise.
666
+ *
667
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)
668
+ */
568
669
  get defaultPrevented(): boolean;
670
+ /**
671
+ * @deprecated
672
+ *
673
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)
674
+ */
569
675
  get returnValue(): boolean;
676
+ /**
677
+ * Returns the object whose event listener's callback is currently being invoked.
678
+ *
679
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
680
+ */
570
681
  get currentTarget(): EventTarget | undefined;
682
+ /**
683
+ * @deprecated
684
+ *
685
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
686
+ */
571
687
  get srcElement(): EventTarget | undefined;
688
+ /**
689
+ * Returns the event's timestamp as the number of milliseconds measured relative to the time origin.
690
+ *
691
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)
692
+ */
572
693
  get timeStamp(): number;
694
+ /**
695
+ * Returns true if event was dispatched by the user agent, and false otherwise.
696
+ *
697
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
698
+ */
573
699
  get isTrusted(): boolean;
700
+ /**
701
+ * @deprecated
702
+ *
703
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
704
+ */
574
705
  get cancelBubble(): boolean;
706
+ /**
707
+ * @deprecated
708
+ *
709
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
710
+ */
575
711
  set cancelBubble(value: boolean);
712
+ /**
713
+ * 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.
714
+ *
715
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
716
+ */
576
717
  stopImmediatePropagation(): void;
718
+ /**
719
+ * 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.
720
+ *
721
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
722
+ */
577
723
  preventDefault(): void;
724
+ /**
725
+ * When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object.
726
+ *
727
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
728
+ */
578
729
  stopPropagation(): void;
730
+ /**
731
+ * 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.
732
+ *
733
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
734
+ */
579
735
  composedPath(): EventTarget[];
580
736
  static readonly NONE: number;
581
737
  static readonly CAPTURING_PHASE: number;
@@ -588,28 +744,55 @@ declare interface EventInit {
588
744
  composed?: boolean;
589
745
  }
590
746
  declare type EventListener<EventType extends Event = Event> = (
591
- event: EventType
747
+ event: EventType,
592
748
  ) => void;
593
749
  declare interface EventListenerObject<EventType extends Event = Event> {
594
750
  handleEvent(event: EventType): void;
595
751
  }
596
752
  declare type EventListenerOrEventListenerObject<
597
- EventType extends Event = Event
753
+ EventType extends Event = Event,
598
754
  > = EventListener<EventType> | EventListenerObject<EventType>;
599
755
  declare class EventTarget<
600
- EventMap extends Record<string, Event> = Record<string, Event>
756
+ EventMap extends Record<string, Event> = Record<string, Event>,
601
757
  > {
602
758
  constructor();
759
+ /**
760
+ * 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.
761
+ *
762
+ * 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.
763
+ *
764
+ * 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.
765
+ *
766
+ * 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.
767
+ *
768
+ * When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
769
+ *
770
+ * If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
771
+ *
772
+ * The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
773
+ *
774
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
775
+ */
603
776
  addEventListener<Type extends keyof EventMap>(
604
777
  type: Type,
605
778
  handler: EventListenerOrEventListenerObject<EventMap[Type]>,
606
- options?: EventTargetAddEventListenerOptions | boolean
779
+ options?: EventTargetAddEventListenerOptions | boolean,
607
780
  ): void;
781
+ /**
782
+ * Removes the event listener in target's event listener list with the same type, callback, and options.
783
+ *
784
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
785
+ */
608
786
  removeEventListener<Type extends keyof EventMap>(
609
787
  type: Type,
610
788
  handler: EventListenerOrEventListenerObject<EventMap[Type]>,
611
- options?: EventTargetEventListenerOptions | boolean
789
+ options?: EventTargetEventListenerOptions | boolean,
612
790
  ): void;
791
+ /**
792
+ * 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.
793
+ *
794
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
795
+ */
613
796
  dispatchEvent(event: EventMap[keyof EventMap]): boolean;
614
797
  }
615
798
  declare interface EventTargetEventListenerOptions {
@@ -626,15 +809,34 @@ declare interface EventTargetHandlerObject {
626
809
  }
627
810
  declare class AbortController {
628
811
  constructor();
812
+ /**
813
+ * Returns the AbortSignal object associated with this object.
814
+ *
815
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)
816
+ */
629
817
  get signal(): AbortSignal;
818
+ /**
819
+ * 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.
820
+ *
821
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)
822
+ */
630
823
  abort(reason?: any): void;
631
824
  }
632
825
  declare abstract class AbortSignal extends EventTarget {
826
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) */
633
827
  static abort(reason?: any): AbortSignal;
828
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static) */
634
829
  static timeout(delay: number): AbortSignal;
635
830
  static any(signals: AbortSignal[]): AbortSignal;
831
+ /**
832
+ * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
833
+ *
834
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)
835
+ */
636
836
  get aborted(): boolean;
837
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason) */
637
838
  get reason(): any;
839
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted) */
638
840
  throwIfAborted(): void;
639
841
  }
640
842
  declare interface Scheduler {
@@ -644,10 +846,16 @@ declare interface SchedulerWaitOptions {
644
846
  signal?: AbortSignal;
645
847
  }
646
848
  declare abstract class ExtendableEvent extends Event {
849
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil) */
647
850
  waitUntil(promise: Promise<any>): void;
648
851
  }
649
852
  declare class CustomEvent<T = any> extends Event {
650
853
  constructor(type: string, init?: CustomEventCustomEventInit);
854
+ /**
855
+ * Returns any custom data event was created with. Typically used for synthetic events.
856
+ *
857
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
858
+ */
651
859
  get detail(): T;
652
860
  }
653
861
  declare interface CustomEventCustomEventInit {
@@ -659,13 +867,19 @@ declare interface CustomEventCustomEventInit {
659
867
  declare class Blob {
660
868
  constructor(
661
869
  bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[],
662
- options?: BlobOptions
870
+ options?: BlobOptions,
663
871
  );
872
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
664
873
  get size(): number;
874
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
665
875
  get type(): string;
876
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
666
877
  slice(start?: number, end?: number, type?: string): Blob;
878
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) */
667
879
  arrayBuffer(): Promise<ArrayBuffer>;
880
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
668
881
  text(): Promise<string>;
882
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream) */
669
883
  stream(): ReadableStream;
670
884
  }
671
885
  declare interface BlobOptions {
@@ -675,9 +889,11 @@ declare class File extends Blob {
675
889
  constructor(
676
890
  bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined,
677
891
  name: string,
678
- options?: FileOptions
892
+ options?: FileOptions,
679
893
  );
894
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
680
895
  get name(): string;
896
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
681
897
  get lastModified(): number;
682
898
  }
683
899
  declare interface FileOptions {
@@ -685,6 +901,7 @@ declare interface FileOptions {
685
901
  lastModified?: number;
686
902
  }
687
903
  declare abstract class CacheStorage {
904
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open) */
688
905
  open(cacheName: string): Promise<Cache>;
689
906
  readonly default: Cache;
690
907
  }
@@ -692,7 +909,7 @@ declare abstract class Cache {
692
909
  delete(request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>;
693
910
  match(
694
911
  request: RequestInfo,
695
- options?: CacheQueryOptions
912
+ options?: CacheQueryOptions,
696
913
  ): Promise<Response | undefined>;
697
914
  put(request: RequestInfo, response: Response): Promise<void>;
698
915
  }
@@ -700,7 +917,13 @@ declare interface CacheQueryOptions {
700
917
  ignoreMethod?: boolean;
701
918
  }
702
919
  declare abstract class Crypto {
920
+ /**
921
+ * Available only in secure contexts.
922
+ *
923
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
924
+ */
703
925
  get subtle(): SubtleCrypto;
926
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */
704
927
  getRandomValues<
705
928
  T extends
706
929
  | Int8Array
@@ -710,8 +933,13 @@ declare abstract class Crypto {
710
933
  | Int32Array
711
934
  | Uint32Array
712
935
  | BigInt64Array
713
- | BigUint64Array
936
+ | BigUint64Array,
714
937
  >(buffer: T): T;
938
+ /**
939
+ * Available only in secure contexts.
940
+ *
941
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)
942
+ */
715
943
  randomUUID(): string;
716
944
  DigestStream: typeof DigestStream;
717
945
  }
@@ -719,59 +947,63 @@ declare abstract class SubtleCrypto {
719
947
  encrypt(
720
948
  algorithm: string | SubtleCryptoEncryptAlgorithm,
721
949
  key: CryptoKey,
722
- plainText: ArrayBuffer | ArrayBufferView
950
+ plainText: ArrayBuffer | ArrayBufferView,
723
951
  ): Promise<ArrayBuffer>;
724
952
  decrypt(
725
953
  algorithm: string | SubtleCryptoEncryptAlgorithm,
726
954
  key: CryptoKey,
727
- cipherText: ArrayBuffer | ArrayBufferView
955
+ cipherText: ArrayBuffer | ArrayBufferView,
728
956
  ): Promise<ArrayBuffer>;
729
957
  sign(
730
958
  algorithm: string | SubtleCryptoSignAlgorithm,
731
959
  key: CryptoKey,
732
- data: ArrayBuffer | ArrayBufferView
960
+ data: ArrayBuffer | ArrayBufferView,
733
961
  ): Promise<ArrayBuffer>;
734
962
  verify(
735
963
  algorithm: string | SubtleCryptoSignAlgorithm,
736
964
  key: CryptoKey,
737
965
  signature: ArrayBuffer | ArrayBufferView,
738
- data: ArrayBuffer | ArrayBufferView
966
+ data: ArrayBuffer | ArrayBufferView,
739
967
  ): Promise<boolean>;
740
968
  digest(
741
969
  algorithm: string | SubtleCryptoHashAlgorithm,
742
- data: ArrayBuffer | ArrayBufferView
970
+ data: ArrayBuffer | ArrayBufferView,
743
971
  ): Promise<ArrayBuffer>;
972
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) */
744
973
  generateKey(
745
974
  algorithm: string | SubtleCryptoGenerateKeyAlgorithm,
746
975
  extractable: boolean,
747
- keyUsages: string[]
976
+ keyUsages: string[],
748
977
  ): Promise<CryptoKey | CryptoKeyPair>;
978
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey) */
749
979
  deriveKey(
750
980
  algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
751
981
  baseKey: CryptoKey,
752
982
  derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
753
983
  extractable: boolean,
754
- keyUsages: string[]
984
+ keyUsages: string[],
755
985
  ): Promise<CryptoKey>;
756
986
  deriveBits(
757
987
  algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
758
988
  baseKey: CryptoKey,
759
- length: number | null
989
+ length: number | null,
760
990
  ): Promise<ArrayBuffer>;
991
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) */
761
992
  importKey(
762
993
  format: string,
763
994
  keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey,
764
995
  algorithm: string | SubtleCryptoImportKeyAlgorithm,
765
996
  extractable: boolean,
766
- keyUsages: string[]
997
+ keyUsages: string[],
767
998
  ): Promise<CryptoKey>;
768
999
  exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
769
1000
  wrapKey(
770
1001
  format: string,
771
1002
  key: CryptoKey,
772
1003
  wrappingKey: CryptoKey,
773
- wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm
1004
+ wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
774
1005
  ): Promise<ArrayBuffer>;
1006
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey) */
775
1007
  unwrapKey(
776
1008
  format: string,
777
1009
  wrappedKey: ArrayBuffer | ArrayBufferView,
@@ -779,16 +1011,19 @@ declare abstract class SubtleCrypto {
779
1011
  unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
780
1012
  unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
781
1013
  extractable: boolean,
782
- keyUsages: string[]
1014
+ keyUsages: string[],
783
1015
  ): Promise<CryptoKey>;
784
1016
  timingSafeEqual(
785
1017
  a: ArrayBuffer | ArrayBufferView,
786
- b: ArrayBuffer | ArrayBufferView
1018
+ b: ArrayBuffer | ArrayBufferView,
787
1019
  ): boolean;
788
1020
  }
789
1021
  declare abstract class CryptoKey {
1022
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) */
790
1023
  readonly type: string;
1024
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable) */
791
1025
  readonly extractable: boolean;
1026
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm) */
792
1027
  readonly algorithm:
793
1028
  | CryptoKeyKeyAlgorithm
794
1029
  | CryptoKeyAesKeyAlgorithm
@@ -796,6 +1031,7 @@ declare abstract class CryptoKey {
796
1031
  | CryptoKeyRsaKeyAlgorithm
797
1032
  | CryptoKeyEllipticKeyAlgorithm
798
1033
  | CryptoKeyArbitraryKeyAlgorithm;
1034
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages) */
799
1035
  readonly usages: string[];
800
1036
  }
801
1037
  declare interface CryptoKeyPair {
@@ -904,9 +1140,24 @@ declare class DigestStream extends WritableStream<
904
1140
  }
905
1141
  declare class TextDecoder {
906
1142
  constructor(decoder?: string, options?: TextDecoderConstructorOptions);
1143
+ /**
1144
+ * 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.
1145
+ *
1146
+ * ```
1147
+ * var string = "", decoder = new TextDecoder(encoding), buffer;
1148
+ * while(buffer = next_chunk()) {
1149
+ * string += decoder.decode(buffer, {stream:true});
1150
+ * }
1151
+ * string += decoder.decode(); // end-of-queue
1152
+ * ```
1153
+ *
1154
+ * If the error mode is "fatal" and encoding's decoder returns error, throws a TypeError.
1155
+ *
1156
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)
1157
+ */
907
1158
  decode(
908
1159
  input?: ArrayBuffer | ArrayBufferView,
909
- options?: TextDecoderDecodeOptions
1160
+ options?: TextDecoderDecodeOptions,
910
1161
  ): string;
911
1162
  get encoding(): string;
912
1163
  get fatal(): boolean;
@@ -914,10 +1165,20 @@ declare class TextDecoder {
914
1165
  }
915
1166
  declare class TextEncoder {
916
1167
  constructor();
1168
+ /**
1169
+ * Returns the result of running UTF-8's encoder.
1170
+ *
1171
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)
1172
+ */
917
1173
  encode(input?: string): Uint8Array;
1174
+ /**
1175
+ * 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.
1176
+ *
1177
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)
1178
+ */
918
1179
  encodeInto(
919
1180
  input: string,
920
- buffer: ArrayBuffer | ArrayBufferView
1181
+ buffer: ArrayBuffer | ArrayBufferView,
921
1182
  ): TextEncoderEncodeIntoResult;
922
1183
  get encoding(): string;
923
1184
  }
@@ -942,17 +1203,20 @@ declare class FormData {
942
1203
  has(name: string): boolean;
943
1204
  set(name: string, value: string): void;
944
1205
  set(name: string, value: Blob, filename?: string): void;
1206
+ /** Returns an array of key, value pairs for every entry in the list. */
945
1207
  entries(): IterableIterator<[key: string, value: File | string]>;
1208
+ /** Returns a list of keys in the list. */
946
1209
  keys(): IterableIterator<string>;
1210
+ /** Returns a list of values in the list. */
947
1211
  values(): IterableIterator<File | string>;
948
1212
  forEach<This = unknown>(
949
1213
  callback: (
950
1214
  this: This,
951
1215
  value: File | string,
952
1216
  key: string,
953
- parent: FormData
1217
+ parent: FormData,
954
1218
  ) => void,
955
- thisArg?: This
1219
+ thisArg?: This,
956
1220
  ): void;
957
1221
  [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>;
958
1222
  }
@@ -963,7 +1227,7 @@ declare class HTMLRewriter {
963
1227
  constructor();
964
1228
  on(
965
1229
  selector: string,
966
- handlers: HTMLRewriterElementContentHandlers
1230
+ handlers: HTMLRewriterElementContentHandlers,
967
1231
  ): HTMLRewriter;
968
1232
  onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;
969
1233
  transform(response: Response): Response;
@@ -1030,7 +1294,9 @@ declare interface DocumentEnd {
1030
1294
  append(content: string, options?: ContentOptions): DocumentEnd;
1031
1295
  }
1032
1296
  declare abstract class FetchEvent extends ExtendableEvent {
1297
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request) */
1033
1298
  readonly request: Request;
1299
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith) */
1034
1300
  respondWith(promise: Response | Promise<Response>): void;
1035
1301
  passThroughOnException(): void;
1036
1302
  }
@@ -1048,10 +1314,13 @@ declare class Headers {
1048
1314
  delete(name: string): void;
1049
1315
  forEach<This = unknown>(
1050
1316
  callback: (this: This, value: string, key: string, parent: Headers) => void,
1051
- thisArg?: This
1317
+ thisArg?: This,
1052
1318
  ): void;
1319
+ /** Returns an iterator allowing to go through all key/value pairs contained in this object. */
1053
1320
  entries(): IterableIterator<[key: string, value: string]>;
1321
+ /** Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */
1054
1322
  keys(): IterableIterator<string>;
1323
+ /** Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
1055
1324
  values(): IterableIterator<string>;
1056
1325
  [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
1057
1326
  }
@@ -1074,14 +1343,23 @@ declare abstract class Body {
1074
1343
  }
1075
1344
  declare class Response extends Body {
1076
1345
  constructor(body?: BodyInit | null, init?: ResponseInit);
1346
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirect_static) */
1077
1347
  static redirect(url: string, status?: number): Response;
1348
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/json_static) */
1078
1349
  static json(any: any, maybeInit?: ResponseInit | Response): Response;
1350
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) */
1079
1351
  clone(): Response;
1352
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) */
1080
1353
  get status(): number;
1354
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText) */
1081
1355
  get statusText(): string;
1356
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) */
1082
1357
  get headers(): Headers;
1358
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok) */
1083
1359
  get ok(): boolean;
1360
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected) */
1084
1361
  get redirected(): boolean;
1362
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) */
1085
1363
  get url(): string;
1086
1364
  get webSocket(): WebSocket | null;
1087
1365
  get cf(): any | undefined;
@@ -1096,22 +1374,58 @@ declare interface ResponseInit {
1096
1374
  }
1097
1375
  declare type RequestInfo<
1098
1376
  CfHostMetadata = unknown,
1099
- Cf = CfProperties<CfHostMetadata>
1377
+ Cf = CfProperties<CfHostMetadata>,
1100
1378
  > = Request<CfHostMetadata, Cf> | string | URL;
1101
1379
  declare class Request<
1102
1380
  CfHostMetadata = unknown,
1103
- Cf = CfProperties<CfHostMetadata>
1381
+ Cf = CfProperties<CfHostMetadata>,
1104
1382
  > extends Body {
1105
1383
  constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
1384
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) */
1106
1385
  clone(): Request<CfHostMetadata, Cf>;
1386
+ /**
1387
+ * Returns request's HTTP method, which is "GET" by default.
1388
+ *
1389
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
1390
+ */
1107
1391
  get method(): string;
1392
+ /**
1393
+ * Returns the URL of request as a string.
1394
+ *
1395
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)
1396
+ */
1108
1397
  get url(): string;
1398
+ /**
1399
+ * 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.
1400
+ *
1401
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
1402
+ */
1109
1403
  get headers(): Headers;
1404
+ /**
1405
+ * 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.
1406
+ *
1407
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)
1408
+ */
1110
1409
  get redirect(): string;
1111
1410
  get fetcher(): Fetcher | null;
1411
+ /**
1412
+ * Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.
1413
+ *
1414
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)
1415
+ */
1112
1416
  get signal(): AbortSignal;
1113
1417
  get cf(): Cf | undefined;
1418
+ /**
1419
+ * 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]
1420
+ *
1421
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)
1422
+ */
1114
1423
  get integrity(): string;
1424
+ /**
1425
+ * Returns a boolean indicating whether or not request can outlive the global in which it was created.
1426
+ *
1427
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
1428
+ */
1115
1429
  get keepalive(): boolean;
1116
1430
  }
1117
1431
  declare interface RequestInit<Cf = CfProperties> {
@@ -1130,10 +1444,18 @@ declare interface RequestInit<Cf = CfProperties> {
1130
1444
  /** An AbortSignal to set request's signal. */
1131
1445
  signal?: AbortSignal | null;
1132
1446
  }
1133
- declare abstract class Fetcher {
1447
+ declare type Service<
1448
+ T extends Rpc.WorkerEntrypointBranded | undefined = undefined,
1449
+ > = Fetcher<T>;
1450
+ declare type Fetcher<
1451
+ T extends Rpc.EntrypointBranded | undefined = undefined,
1452
+ Reserved extends string = never,
1453
+ > = (T extends Rpc.EntrypointBranded
1454
+ ? Rpc.Provider<T, Reserved | "fetch" | "connect">
1455
+ : unknown) & {
1134
1456
  fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1135
1457
  connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1136
- }
1458
+ };
1137
1459
  declare interface FetcherPutOptions {
1138
1460
  expiration?: number;
1139
1461
  expirationTtl?: number;
@@ -1158,74 +1480,74 @@ declare type KVNamespaceListResult<Metadata, Key extends string = string> =
1158
1480
  declare interface KVNamespace<Key extends string = string> {
1159
1481
  get(
1160
1482
  key: Key,
1161
- options?: Partial<KVNamespaceGetOptions<undefined>>
1483
+ options?: Partial<KVNamespaceGetOptions<undefined>>,
1162
1484
  ): Promise<string | null>;
1163
1485
  get(key: Key, type: "text"): Promise<string | null>;
1164
1486
  get<ExpectedValue = unknown>(
1165
1487
  key: Key,
1166
- type: "json"
1488
+ type: "json",
1167
1489
  ): Promise<ExpectedValue | null>;
1168
1490
  get(key: Key, type: "arrayBuffer"): Promise<ArrayBuffer | null>;
1169
1491
  get(key: Key, type: "stream"): Promise<ReadableStream | null>;
1170
1492
  get(
1171
1493
  key: Key,
1172
- options?: KVNamespaceGetOptions<"text">
1494
+ options?: KVNamespaceGetOptions<"text">,
1173
1495
  ): Promise<string | null>;
1174
1496
  get<ExpectedValue = unknown>(
1175
1497
  key: Key,
1176
- options?: KVNamespaceGetOptions<"json">
1498
+ options?: KVNamespaceGetOptions<"json">,
1177
1499
  ): Promise<ExpectedValue | null>;
1178
1500
  get(
1179
1501
  key: Key,
1180
- options?: KVNamespaceGetOptions<"arrayBuffer">
1502
+ options?: KVNamespaceGetOptions<"arrayBuffer">,
1181
1503
  ): Promise<ArrayBuffer | null>;
1182
1504
  get(
1183
1505
  key: Key,
1184
- options?: KVNamespaceGetOptions<"stream">
1506
+ options?: KVNamespaceGetOptions<"stream">,
1185
1507
  ): Promise<ReadableStream | null>;
1186
1508
  list<Metadata = unknown>(
1187
- options?: KVNamespaceListOptions
1509
+ options?: KVNamespaceListOptions,
1188
1510
  ): Promise<KVNamespaceListResult<Metadata, Key>>;
1189
1511
  put(
1190
1512
  key: Key,
1191
1513
  value: string | ArrayBuffer | ArrayBufferView | ReadableStream,
1192
- options?: KVNamespacePutOptions
1514
+ options?: KVNamespacePutOptions,
1193
1515
  ): Promise<void>;
1194
1516
  getWithMetadata<Metadata = unknown>(
1195
1517
  key: Key,
1196
- options?: Partial<KVNamespaceGetOptions<undefined>>
1518
+ options?: Partial<KVNamespaceGetOptions<undefined>>,
1197
1519
  ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1198
1520
  getWithMetadata<Metadata = unknown>(
1199
1521
  key: Key,
1200
- type: "text"
1522
+ type: "text",
1201
1523
  ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1202
1524
  getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
1203
1525
  key: Key,
1204
- type: "json"
1526
+ type: "json",
1205
1527
  ): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
1206
1528
  getWithMetadata<Metadata = unknown>(
1207
1529
  key: Key,
1208
- type: "arrayBuffer"
1530
+ type: "arrayBuffer",
1209
1531
  ): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
1210
1532
  getWithMetadata<Metadata = unknown>(
1211
1533
  key: Key,
1212
- type: "stream"
1534
+ type: "stream",
1213
1535
  ): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
1214
1536
  getWithMetadata<Metadata = unknown>(
1215
1537
  key: Key,
1216
- options: KVNamespaceGetOptions<"text">
1538
+ options: KVNamespaceGetOptions<"text">,
1217
1539
  ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1218
1540
  getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
1219
1541
  key: Key,
1220
- options: KVNamespaceGetOptions<"json">
1542
+ options: KVNamespaceGetOptions<"json">,
1221
1543
  ): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
1222
1544
  getWithMetadata<Metadata = unknown>(
1223
1545
  key: Key,
1224
- options: KVNamespaceGetOptions<"arrayBuffer">
1546
+ options: KVNamespaceGetOptions<"arrayBuffer">,
1225
1547
  ): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
1226
1548
  getWithMetadata<Metadata = unknown>(
1227
1549
  key: Key,
1228
- options: KVNamespaceGetOptions<"stream">
1550
+ options: KVNamespaceGetOptions<"stream">,
1229
1551
  ): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
1230
1552
  delete(key: Key): Promise<void>;
1231
1553
  }
@@ -1253,7 +1575,7 @@ declare interface Queue<Body = unknown> {
1253
1575
  send(message: Body, options?: QueueSendOptions): Promise<void>;
1254
1576
  sendBatch(
1255
1577
  messages: Iterable<MessageSendRequest<Body>>,
1256
- options?: QueueSendBatchOptions
1578
+ options?: QueueSendBatchOptions,
1257
1579
  ): Promise<void>;
1258
1580
  }
1259
1581
  declare interface QueueSendOptions {
@@ -1275,6 +1597,7 @@ declare interface Message<Body = unknown> {
1275
1597
  readonly id: string;
1276
1598
  readonly timestamp: Date;
1277
1599
  readonly body: Body;
1600
+ readonly attempts: number;
1278
1601
  retry(options?: QueueRetryOptions): void;
1279
1602
  ack(): void;
1280
1603
  }
@@ -1311,7 +1634,7 @@ declare abstract class R2Bucket {
1311
1634
  key: string,
1312
1635
  options: R2GetOptions & {
1313
1636
  onlyIf: R2Conditional | Headers;
1314
- }
1637
+ },
1315
1638
  ): Promise<R2ObjectBody | R2Object | null>;
1316
1639
  get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;
1317
1640
  put(
@@ -1325,7 +1648,7 @@ declare abstract class R2Bucket {
1325
1648
  | Blob,
1326
1649
  options?: R2PutOptions & {
1327
1650
  onlyIf: R2Conditional | Headers;
1328
- }
1651
+ },
1329
1652
  ): Promise<R2Object | null>;
1330
1653
  put(
1331
1654
  key: string,
@@ -1336,11 +1659,11 @@ declare abstract class R2Bucket {
1336
1659
  | string
1337
1660
  | null
1338
1661
  | Blob,
1339
- options?: R2PutOptions
1662
+ options?: R2PutOptions,
1340
1663
  ): Promise<R2Object>;
1341
1664
  createMultipartUpload(
1342
1665
  key: string,
1343
- options?: R2MultipartOptions
1666
+ options?: R2MultipartOptions,
1344
1667
  ): Promise<R2MultipartUpload>;
1345
1668
  resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;
1346
1669
  delete(keys: string | string[]): Promise<void>;
@@ -1351,7 +1674,7 @@ declare interface R2MultipartUpload {
1351
1674
  readonly uploadId: string;
1352
1675
  uploadPart(
1353
1676
  partNumber: number,
1354
- value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob
1677
+ value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob,
1355
1678
  ): Promise<R2UploadedPart>;
1356
1679
  abort(): Promise<void>;
1357
1680
  complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
@@ -1472,7 +1795,7 @@ declare interface UnderlyingSink<W = any> {
1472
1795
  start?: (controller: WritableStreamDefaultController) => void | Promise<void>;
1473
1796
  write?: (
1474
1797
  chunk: W,
1475
- controller: WritableStreamDefaultController
1798
+ controller: WritableStreamDefaultController,
1476
1799
  ) => void | Promise<void>;
1477
1800
  abort?: (reason: any) => void | Promise<void>;
1478
1801
  close?: () => void | Promise<void>;
@@ -1487,10 +1810,10 @@ declare interface UnderlyingByteSource {
1487
1810
  declare interface UnderlyingSource<R = any> {
1488
1811
  type?: "" | undefined;
1489
1812
  start?: (
1490
- controller: ReadableStreamDefaultController<R>
1813
+ controller: ReadableStreamDefaultController<R>,
1491
1814
  ) => void | Promise<void>;
1492
1815
  pull?: (
1493
- controller: ReadableStreamDefaultController<R>
1816
+ controller: ReadableStreamDefaultController<R>,
1494
1817
  ) => void | Promise<void>;
1495
1818
  cancel?: (reason: any) => void | Promise<void>;
1496
1819
  expectedLength?: number | bigint;
@@ -1499,14 +1822,14 @@ declare interface Transformer<I = any, O = any> {
1499
1822
  readableType?: string;
1500
1823
  writableType?: string;
1501
1824
  start?: (
1502
- controller: TransformStreamDefaultController<O>
1825
+ controller: TransformStreamDefaultController<O>,
1503
1826
  ) => void | Promise<void>;
1504
1827
  transform?: (
1505
1828
  chunk: I,
1506
- controller: TransformStreamDefaultController<O>
1829
+ controller: TransformStreamDefaultController<O>,
1507
1830
  ) => void | Promise<void>;
1508
1831
  flush?: (
1509
- controller: TransformStreamDefaultController<O>
1832
+ controller: TransformStreamDefaultController<O>,
1510
1833
  ) => void | Promise<void>;
1511
1834
  cancel?: (reason: any) => void | Promise<void>;
1512
1835
  expectedLength?: number;
@@ -1543,90 +1866,129 @@ declare type ReadableStreamReadResult<R = any> =
1543
1866
  done: true;
1544
1867
  value?: undefined;
1545
1868
  };
1546
- /** 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. */
1869
+ /**
1870
+ * 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.
1871
+ *
1872
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
1873
+ */
1547
1874
  declare interface ReadableStream<R = any> {
1875
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked) */
1548
1876
  get locked(): boolean;
1877
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel) */
1549
1878
  cancel(reason?: any): Promise<void>;
1879
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
1550
1880
  getReader(): ReadableStreamDefaultReader<R>;
1881
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
1551
1882
  getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
1883
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough) */
1552
1884
  pipeThrough<T>(
1553
1885
  transform: ReadableWritablePair<T, R>,
1554
- options?: StreamPipeOptions
1886
+ options?: StreamPipeOptions,
1555
1887
  ): ReadableStream<T>;
1888
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo) */
1556
1889
  pipeTo(
1557
1890
  destination: WritableStream<R>,
1558
- options?: StreamPipeOptions
1891
+ options?: StreamPipeOptions,
1559
1892
  ): Promise<void>;
1893
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee) */
1560
1894
  tee(): [ReadableStream<R>, ReadableStream<R>];
1561
1895
  values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
1562
1896
  [Symbol.asyncIterator](
1563
- options?: ReadableStreamValuesOptions
1897
+ options?: ReadableStreamValuesOptions,
1564
1898
  ): AsyncIterableIterator<R>;
1565
1899
  }
1566
1900
  declare const ReadableStream: {
1567
1901
  prototype: ReadableStream;
1568
1902
  new (
1569
1903
  underlyingSource: UnderlyingByteSource,
1570
- strategy?: QueuingStrategy<Uint8Array>
1904
+ strategy?: QueuingStrategy<Uint8Array>,
1571
1905
  ): ReadableStream<Uint8Array>;
1572
1906
  new <R = any>(
1573
1907
  underlyingSource?: UnderlyingSource<R>,
1574
- strategy?: QueuingStrategy<R>
1908
+ strategy?: QueuingStrategy<R>,
1575
1909
  ): ReadableStream<R>;
1576
1910
  };
1577
1911
  declare class ReadableStreamDefaultReader<R = any> {
1578
1912
  constructor(stream: ReadableStream);
1579
1913
  get closed(): Promise<void>;
1580
1914
  cancel(reason?: any): Promise<void>;
1915
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read) */
1581
1916
  read(): Promise<ReadableStreamReadResult<R>>;
1917
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock) */
1582
1918
  releaseLock(): void;
1583
1919
  }
1584
1920
  declare class ReadableStreamBYOBReader {
1585
1921
  constructor(stream: ReadableStream);
1586
1922
  get closed(): Promise<void>;
1587
1923
  cancel(reason?: any): Promise<void>;
1924
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) */
1588
1925
  read<T extends ArrayBufferView>(
1589
- view: T
1926
+ view: T,
1590
1927
  ): Promise<ReadableStreamReadResult<T>>;
1928
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) */
1591
1929
  releaseLock(): void;
1592
1930
  readAtLeast<T extends ArrayBufferView>(
1593
1931
  minElements: number,
1594
- view: T
1932
+ view: T,
1595
1933
  ): Promise<ReadableStreamReadResult<T>>;
1596
1934
  }
1597
1935
  declare interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
1598
1936
  min?: number;
1599
1937
  }
1600
1938
  declare interface ReadableStreamGetReaderOptions {
1939
+ /**
1940
+ * Creates a ReadableStreamBYOBReader and locks the stream to the new reader.
1941
+ *
1942
+ * 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.
1943
+ */
1601
1944
  mode: "byob";
1602
1945
  }
1603
1946
  declare abstract class ReadableStreamBYOBRequest {
1947
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view) */
1604
1948
  readonly view: Uint8Array | null;
1949
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond) */
1605
1950
  respond(bytesWritten: number): void;
1951
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView) */
1606
1952
  respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;
1607
1953
  readonly atLeast: number | null;
1608
1954
  }
1609
1955
  declare abstract class ReadableStreamDefaultController<R = any> {
1956
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize) */
1610
1957
  readonly desiredSize: number | null;
1958
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close) */
1611
1959
  close(): void;
1960
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue) */
1612
1961
  enqueue(chunk?: R): void;
1962
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error) */
1613
1963
  error(reason: any): void;
1614
1964
  }
1615
1965
  declare abstract class ReadableByteStreamController {
1966
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest) */
1616
1967
  readonly byobRequest: ReadableStreamBYOBRequest | null;
1968
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize) */
1617
1969
  readonly desiredSize: number | null;
1970
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close) */
1618
1971
  close(): void;
1972
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue) */
1619
1973
  enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
1974
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error) */
1620
1975
  error(reason: any): void;
1621
1976
  }
1622
1977
  declare abstract class WritableStreamDefaultController {
1978
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal) */
1623
1979
  readonly signal: AbortSignal;
1980
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error) */
1624
1981
  error(reason?: any): void;
1625
1982
  }
1983
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController) */
1626
1984
  declare interface TransformStreamDefaultController<O = any> {
1985
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize) */
1627
1986
  get desiredSize(): number | null;
1987
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue) */
1628
1988
  enqueue(chunk?: O): void;
1989
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error) */
1629
1990
  error(reason: any): void;
1991
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate) */
1630
1992
  terminate(): void;
1631
1993
  }
1632
1994
  declare interface ReadableWritablePair<R = any, W = any> {
@@ -1641,36 +2003,49 @@ declare interface ReadableWritablePair<R = any, W = any> {
1641
2003
  declare class WritableStream<W = any> {
1642
2004
  constructor(
1643
2005
  underlyingSink?: UnderlyingSink,
1644
- queuingStrategy?: QueuingStrategy
2006
+ queuingStrategy?: QueuingStrategy,
1645
2007
  );
2008
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked) */
1646
2009
  get locked(): boolean;
2010
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort) */
1647
2011
  abort(reason?: any): Promise<void>;
2012
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close) */
1648
2013
  close(): Promise<void>;
2014
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter) */
1649
2015
  getWriter(): WritableStreamDefaultWriter<W>;
1650
2016
  }
1651
2017
  declare class WritableStreamDefaultWriter<W = any> {
1652
2018
  constructor(stream: WritableStream);
2019
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed) */
1653
2020
  get closed(): Promise<void>;
2021
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready) */
1654
2022
  get ready(): Promise<void>;
2023
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize) */
1655
2024
  get desiredSize(): number | null;
2025
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort) */
1656
2026
  abort(reason?: any): Promise<void>;
2027
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close) */
1657
2028
  close(): Promise<void>;
2029
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write) */
1658
2030
  write(chunk?: W): Promise<void>;
2031
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock) */
1659
2032
  releaseLock(): void;
1660
2033
  }
1661
2034
  declare class TransformStream<I = any, O = any> {
1662
2035
  constructor(
1663
2036
  transformer?: Transformer<I, O>,
1664
2037
  writableStrategy?: QueuingStrategy<I>,
1665
- readableStrategy?: QueuingStrategy<O>
2038
+ readableStrategy?: QueuingStrategy<O>,
1666
2039
  );
2040
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable) */
1667
2041
  get readable(): ReadableStream<O>;
2042
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable) */
1668
2043
  get writable(): WritableStream<I>;
1669
2044
  }
1670
2045
  declare class FixedLengthStream extends IdentityTransformStream {
1671
2046
  constructor(
1672
2047
  expectedLength: number | bigint,
1673
- queuingStrategy?: IdentityTransformStreamQueuingStrategy
2048
+ queuingStrategy?: IdentityTransformStreamQueuingStrategy,
1674
2049
  );
1675
2050
  }
1676
2051
  declare class IdentityTransformStream extends TransformStream<
@@ -1713,12 +2088,16 @@ declare class ByteLengthQueuingStrategy
1713
2088
  implements QueuingStrategy<ArrayBufferView>
1714
2089
  {
1715
2090
  constructor(init: QueuingStrategyInit);
2091
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark) */
1716
2092
  get highWaterMark(): number;
2093
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */
1717
2094
  get size(): (chunk?: any) => number;
1718
2095
  }
1719
2096
  declare class CountQueuingStrategy implements QueuingStrategy {
1720
2097
  constructor(init: QueuingStrategyInit);
2098
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark) */
1721
2099
  get highWaterMark(): number;
2100
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */
1722
2101
  get size(): (chunk?: any) => number;
1723
2102
  }
1724
2103
  declare interface QueuingStrategyInit {
@@ -1742,6 +2121,7 @@ declare interface TraceItem {
1742
2121
  readonly event:
1743
2122
  | (
1744
2123
  | TraceItemFetchEventInfo
2124
+ | TraceItemJsRpcEventInfo
1745
2125
  | TraceItemScheduledEventInfo
1746
2126
  | TraceItemAlarmEventInfo
1747
2127
  | TraceItemQueueEventInfo
@@ -1756,6 +2136,7 @@ declare interface TraceItem {
1756
2136
  readonly exceptions: TraceException[];
1757
2137
  readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
1758
2138
  readonly scriptName: string | null;
2139
+ readonly entrypoint?: string;
1759
2140
  readonly scriptVersion?: ScriptVersion;
1760
2141
  readonly dispatchNamespace?: string;
1761
2142
  readonly scriptTags?: string[];
@@ -1798,6 +2179,9 @@ declare interface TraceItemFetchEventInfoRequest {
1798
2179
  declare interface TraceItemFetchEventInfoResponse {
1799
2180
  readonly status: number;
1800
2181
  }
2182
+ declare interface TraceItemJsRpcEventInfo {
2183
+ readonly rpcMethod: string;
2184
+ }
1801
2185
  declare interface TraceItemHibernatableWebSocketEventInfo {
1802
2186
  readonly getWebSocketEvent:
1803
2187
  | TraceItemHibernatableWebSocketEventInfoMessage
@@ -1824,6 +2208,7 @@ declare interface TraceException {
1824
2208
  readonly timestamp: number;
1825
2209
  readonly message: string;
1826
2210
  readonly name: string;
2211
+ readonly stack?: string;
1827
2212
  }
1828
2213
  declare interface TraceDiagnosticChannelEvent {
1829
2214
  readonly timestamp: number;
@@ -1839,35 +2224,59 @@ declare interface UnsafeTraceMetrics {
1839
2224
  }
1840
2225
  declare class URL {
1841
2226
  constructor(url: string | URL, base?: string | URL);
2227
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin) */
1842
2228
  get origin(): string;
2229
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) */
1843
2230
  get href(): string;
2231
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) */
1844
2232
  set href(value: string);
2233
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) */
1845
2234
  get protocol(): string;
2235
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) */
1846
2236
  set protocol(value: string);
2237
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */
1847
2238
  get username(): string;
2239
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */
1848
2240
  set username(value: string);
2241
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */
1849
2242
  get password(): string;
2243
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */
1850
2244
  set password(value: string);
2245
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */
1851
2246
  get host(): string;
2247
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */
1852
2248
  set host(value: string);
2249
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */
1853
2250
  get hostname(): string;
2251
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */
1854
2252
  set hostname(value: string);
2253
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */
1855
2254
  get port(): string;
2255
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */
1856
2256
  set port(value: string);
2257
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */
1857
2258
  get pathname(): string;
2259
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */
1858
2260
  set pathname(value: string);
2261
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */
1859
2262
  get search(): string;
2263
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */
1860
2264
  set search(value: string);
2265
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */
1861
2266
  get hash(): string;
2267
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */
1862
2268
  set hash(value: string);
2269
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams) */
1863
2270
  get searchParams(): URLSearchParams;
2271
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON) */
1864
2272
  toJSON(): string;
1865
2273
  toString(): string;
2274
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) */
1866
2275
  static canParse(url: string, base?: string): boolean;
1867
2276
  }
1868
2277
  declare class URLSearchParams {
1869
2278
  constructor(
1870
- init?: Iterable<Iterable<string>> | Record<string, string> | string
2279
+ init?: Iterable<Iterable<string>> | Record<string, string> | string,
1871
2280
  );
1872
2281
  get size(): number;
1873
2282
  append(name: string, value: string): void;
@@ -1877,17 +2286,20 @@ declare class URLSearchParams {
1877
2286
  has(name: string): boolean;
1878
2287
  set(name: string, value: string): void;
1879
2288
  sort(): void;
2289
+ /** Returns an array of key, value pairs for every entry in the search params. */
1880
2290
  entries(): IterableIterator<[key: string, value: string]>;
2291
+ /** Returns a list of keys in the search params. */
1881
2292
  keys(): IterableIterator<string>;
2293
+ /** Returns a list of values in the search params. */
1882
2294
  values(): IterableIterator<string>;
1883
2295
  forEach<This = unknown>(
1884
2296
  callback: (
1885
2297
  this: This,
1886
2298
  value: string,
1887
2299
  key: string,
1888
- parent: URLSearchParams
2300
+ parent: URLSearchParams,
1889
2301
  ) => void,
1890
- thisArg?: This
2302
+ thisArg?: This,
1891
2303
  ): void;
1892
2304
  toString(): string;
1893
2305
  [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
@@ -1896,7 +2308,7 @@ declare class URLPattern {
1896
2308
  constructor(
1897
2309
  input?: string | URLPatternURLPatternInit,
1898
2310
  baseURL?: string,
1899
- patternOptions?: URLPatternURLPatternOptions
2311
+ patternOptions?: URLPatternURLPatternOptions,
1900
2312
  );
1901
2313
  get protocol(): string;
1902
2314
  get username(): string;
@@ -1909,7 +2321,7 @@ declare class URLPattern {
1909
2321
  test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean;
1910
2322
  exec(
1911
2323
  input?: string | URLPatternURLPatternInit,
1912
- baseURL?: string
2324
+ baseURL?: string,
1913
2325
  ): URLPatternURLPatternResult | null;
1914
2326
  }
1915
2327
  declare interface URLPatternURLPatternInit {
@@ -1943,11 +2355,23 @@ declare interface URLPatternURLPatternOptions {
1943
2355
  }
1944
2356
  declare class CloseEvent extends Event {
1945
2357
  constructor(type: string, initializer?: CloseEventInit);
1946
- /** Returns the WebSocket connection close code provided by the server. */
2358
+ /**
2359
+ * Returns the WebSocket connection close code provided by the server.
2360
+ *
2361
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)
2362
+ */
1947
2363
  readonly code: number;
1948
- /** Returns the WebSocket connection close reason provided by the server. */
2364
+ /**
2365
+ * Returns the WebSocket connection close reason provided by the server.
2366
+ *
2367
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)
2368
+ */
1949
2369
  readonly reason: string;
1950
- /** Returns true if the connection closed cleanly; false otherwise. */
2370
+ /**
2371
+ * Returns true if the connection closed cleanly; false otherwise.
2372
+ *
2373
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)
2374
+ */
1951
2375
  readonly wasClean: boolean;
1952
2376
  }
1953
2377
  declare interface CloseEventInit {
@@ -1962,12 +2386,21 @@ declare class MessageEvent extends Event {
1962
2386
  declare interface MessageEventInit {
1963
2387
  data: ArrayBuffer | string;
1964
2388
  }
1965
- /** Events providing information related to errors in scripts or in files. */
2389
+ /**
2390
+ * Events providing information related to errors in scripts or in files.
2391
+ *
2392
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)
2393
+ */
1966
2394
  declare interface ErrorEvent extends Event {
2395
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename) */
1967
2396
  readonly filename: string;
2397
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message) */
1968
2398
  readonly message: string;
2399
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno) */
1969
2400
  readonly lineno: number;
2401
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno) */
1970
2402
  readonly colno: number;
2403
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error) */
1971
2404
  readonly error: any;
1972
2405
  }
1973
2406
  declare type WebSocketEventMap = {
@@ -1979,7 +2412,17 @@ declare type WebSocketEventMap = {
1979
2412
  declare class WebSocket extends EventTarget<WebSocketEventMap> {
1980
2413
  constructor(url: string, protocols?: string[] | string);
1981
2414
  accept(): void;
2415
+ /**
2416
+ * Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
2417
+ *
2418
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
2419
+ */
1982
2420
  send(message: (ArrayBuffer | ArrayBufferView) | string): void;
2421
+ /**
2422
+ * Closes the WebSocket connection, optionally using code as the the WebSocket connection close code and reason as the the WebSocket connection close reason.
2423
+ *
2424
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)
2425
+ */
1983
2426
  close(code?: number, reason?: string): void;
1984
2427
  serializeAttachment(attachment: any): void;
1985
2428
  deserializeAttachment(): any | null;
@@ -1991,9 +2434,29 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
1991
2434
  static readonly CLOSING: number;
1992
2435
  static readonly READY_STATE_CLOSED: number;
1993
2436
  static readonly CLOSED: number;
2437
+ /**
2438
+ * Returns the state of the WebSocket object's connection. It can have the values described below.
2439
+ *
2440
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)
2441
+ */
1994
2442
  get readyState(): number;
2443
+ /**
2444
+ * Returns the URL that was used to establish the WebSocket connection.
2445
+ *
2446
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)
2447
+ */
1995
2448
  get url(): string | null;
2449
+ /**
2450
+ * 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.
2451
+ *
2452
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)
2453
+ */
1996
2454
  get protocol(): string | null;
2455
+ /**
2456
+ * Returns the extensions selected by the server, if any.
2457
+ *
2458
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
2459
+ */
1997
2460
  get extensions(): string | null;
1998
2461
  }
1999
2462
  declare const WebSocketPair: {
@@ -2027,7 +2490,7 @@ declare interface SocketInfo {
2027
2490
  }
2028
2491
  declare interface gpuGPU {
2029
2492
  requestAdapter(
2030
- param1?: gpuGPURequestAdapterOptions
2493
+ param1?: gpuGPURequestAdapterOptions,
2031
2494
  ): Promise<gpuGPUAdapter | null>;
2032
2495
  }
2033
2496
  declare abstract class gpuGPUAdapter {
@@ -2039,24 +2502,24 @@ declare abstract class gpuGPUAdapter {
2039
2502
  declare interface gpuGPUDevice extends EventTarget {
2040
2503
  createBuffer(param1: gpuGPUBufferDescriptor): gpuGPUBuffer;
2041
2504
  createBindGroupLayout(
2042
- descriptor: gpuGPUBindGroupLayoutDescriptor
2505
+ descriptor: gpuGPUBindGroupLayoutDescriptor,
2043
2506
  ): gpuGPUBindGroupLayout;
2044
2507
  createBindGroup(descriptor: gpuGPUBindGroupDescriptor): gpuGPUBindGroup;
2045
2508
  createSampler(descriptor: gpuGPUSamplerDescriptor): gpuGPUSampler;
2046
2509
  createShaderModule(
2047
- descriptor: gpuGPUShaderModuleDescriptor
2510
+ descriptor: gpuGPUShaderModuleDescriptor,
2048
2511
  ): gpuGPUShaderModule;
2049
2512
  createPipelineLayout(
2050
- descriptor: gpuGPUPipelineLayoutDescriptor
2513
+ descriptor: gpuGPUPipelineLayoutDescriptor,
2051
2514
  ): gpuGPUPipelineLayout;
2052
2515
  createComputePipeline(
2053
- descriptor: gpuGPUComputePipelineDescriptor
2516
+ descriptor: gpuGPUComputePipelineDescriptor,
2054
2517
  ): gpuGPUComputePipeline;
2055
2518
  createRenderPipeline(
2056
- descriptor: gpuGPURenderPipelineDescriptor
2519
+ descriptor: gpuGPURenderPipelineDescriptor,
2057
2520
  ): gpuGPURenderPipeline;
2058
2521
  createCommandEncoder(
2059
- descriptor?: gpuGPUCommandEncoderDescriptor
2522
+ descriptor?: gpuGPUCommandEncoderDescriptor,
2060
2523
  ): gpuGPUCommandEncoder;
2061
2524
  createTexture(param1: gpuGPUTextureDescriptor): gpuGPUTexture;
2062
2525
  destroy(): void;
@@ -2102,7 +2565,7 @@ declare interface gpuGPUBuffer {
2102
2565
  mapAsync(
2103
2566
  offset: number,
2104
2567
  size?: number | bigint,
2105
- param3?: number | bigint
2568
+ param3?: number | bigint,
2106
2569
  ): Promise<void>;
2107
2570
  get size(): number | bigint;
2108
2571
  get usage(): number;
@@ -2201,38 +2664,38 @@ declare interface gpuGPUProgrammableStage {
2201
2664
  declare interface gpuGPUCommandEncoder {
2202
2665
  get label(): string;
2203
2666
  beginComputePass(
2204
- descriptor?: gpuGPUComputePassDescriptor
2667
+ descriptor?: gpuGPUComputePassDescriptor,
2205
2668
  ): gpuGPUComputePassEncoder;
2206
2669
  beginRenderPass(
2207
- descriptor: gpuGPURenderPassDescriptor
2670
+ descriptor: gpuGPURenderPassDescriptor,
2208
2671
  ): gpuGPURenderPassEncoder;
2209
2672
  copyBufferToBuffer(
2210
2673
  source: gpuGPUBuffer,
2211
2674
  sourceOffset: number | bigint,
2212
2675
  destination: gpuGPUBuffer,
2213
2676
  destinationOffset: number | bigint,
2214
- size: number | bigint
2677
+ size: number | bigint,
2215
2678
  ): void;
2216
2679
  finish(param0?: gpuGPUCommandBufferDescriptor): gpuGPUCommandBuffer;
2217
2680
  copyTextureToBuffer(
2218
2681
  source: gpuGPUImageCopyTexture,
2219
2682
  destination: gpuGPUImageCopyBuffer,
2220
- copySize: Iterable<number> | gpuGPUExtent3DDict
2683
+ copySize: Iterable<number> | gpuGPUExtent3DDict,
2221
2684
  ): void;
2222
2685
  copyBufferToTexture(
2223
2686
  source: gpuGPUImageCopyBuffer,
2224
2687
  destination: gpuGPUImageCopyTexture,
2225
- copySize: Iterable<number> | gpuGPUExtent3DDict
2688
+ copySize: Iterable<number> | gpuGPUExtent3DDict,
2226
2689
  ): void;
2227
2690
  copyTextureToTexture(
2228
2691
  source: gpuGPUImageCopyTexture,
2229
2692
  destination: gpuGPUImageCopyTexture,
2230
- copySize: Iterable<number> | gpuGPUExtent3DDict
2693
+ copySize: Iterable<number> | gpuGPUExtent3DDict,
2231
2694
  ): void;
2232
2695
  clearBuffer(
2233
2696
  buffer: gpuGPUBuffer,
2234
2697
  offset?: number | bigint,
2235
- size?: number | bigint
2698
+ size?: number | bigint,
2236
2699
  ): void;
2237
2700
  }
2238
2701
  declare interface gpuGPUCommandEncoderDescriptor {
@@ -2243,12 +2706,12 @@ declare interface gpuGPUComputePassEncoder {
2243
2706
  setBindGroup(
2244
2707
  index: number,
2245
2708
  bindGroup: gpuGPUBindGroup | null,
2246
- dynamicOffsets?: Iterable<number>
2709
+ dynamicOffsets?: Iterable<number>,
2247
2710
  ): void;
2248
2711
  dispatchWorkgroups(
2249
2712
  workgroupCountX: number,
2250
2713
  workgroupCountY?: number,
2251
- workgroupCountZ?: number
2714
+ workgroupCountZ?: number,
2252
2715
  ): void;
2253
2716
  end(): void;
2254
2717
  }
@@ -2276,7 +2739,7 @@ declare interface gpuGPUQueue {
2276
2739
  bufferOffset: number | bigint,
2277
2740
  data: ArrayBuffer | ArrayBufferView,
2278
2741
  dataOffset?: number | bigint,
2279
- size?: number | bigint
2742
+ size?: number | bigint,
2280
2743
  ): void;
2281
2744
  }
2282
2745
  declare abstract class gpuGPUMapMode {
@@ -2484,7 +2947,7 @@ declare interface gpuGPURenderPassEncoder {
2484
2947
  vertexCount: number,
2485
2948
  instanceCount?: number,
2486
2949
  firstVertex?: number,
2487
- firstInstance?: number
2950
+ firstInstance?: number,
2488
2951
  ): void;
2489
2952
  end(): void;
2490
2953
  }
@@ -2982,7 +3445,7 @@ declare interface IncomingRequestCfPropertiesBotManagementEnterprise
2982
3445
  };
2983
3446
  }
2984
3447
  declare interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<
2985
- HostMetadata
3448
+ HostMetadata,
2986
3449
  > {
2987
3450
  /**
2988
3451
  * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/).
@@ -3552,6 +4015,13 @@ declare abstract class D1PreparedStatement {
3552
4015
  }): Promise<[string[], ...T[]]>;
3553
4016
  raw<T = unknown[]>(options?: { columnNames?: false }): Promise<T[]>;
3554
4017
  }
4018
+ // `Disposable` was added to TypeScript's standard lib types in version 5.2.
4019
+ // To support older TypeScript versions, define an empty `Disposable` interface.
4020
+ // Users won't be able to use `using`/`Symbol.dispose` without upgrading to 5.2,
4021
+ // but this will ensure type checking on older versions still passes.
4022
+ // TypeScript's interface merging will ensure our empty interface is effectively
4023
+ // ignored when `Disposable` is included in the standard lib.
4024
+ declare interface Disposable {}
3555
4025
  /**
3556
4026
  * An email message that can be sent from a Worker.
3557
4027
  */
@@ -3607,7 +4077,7 @@ declare abstract class EmailEvent extends ExtendableEvent {
3607
4077
  declare type EmailExportedHandler<Env = unknown> = (
3608
4078
  message: ForwardableEmailMessage,
3609
4079
  env: Env,
3610
- ctx: ExecutionContext
4080
+ ctx: ExecutionContext,
3611
4081
  ) => void | Promise<void>;
3612
4082
  declare module "cloudflare:email" {
3613
4083
  let _EmailMessage: {
@@ -3681,7 +4151,7 @@ declare type EventContext<Env, P extends string, Data> = {
3681
4151
  declare type PagesFunction<
3682
4152
  Env = unknown,
3683
4153
  Params extends string = any,
3684
- Data extends Record<string, unknown> = Record<string, unknown>
4154
+ Data extends Record<string, unknown> = Record<string, unknown>,
3685
4155
  > = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
3686
4156
  declare type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
3687
4157
  request: Request<unknown, IncomingRequestCfProperties<unknown>>;
@@ -3702,9 +4172,9 @@ declare type PagesPluginFunction<
3702
4172
  Env = unknown,
3703
4173
  Params extends string = any,
3704
4174
  Data extends Record<string, unknown> = Record<string, unknown>,
3705
- PluginArgs = unknown
4175
+ PluginArgs = unknown,
3706
4176
  > = (
3707
- context: EventPluginContext<Env, Params, Data, PluginArgs>
4177
+ context: EventPluginContext<Env, Params, Data, PluginArgs>,
3708
4178
  ) => Response | Promise<Response>;
3709
4179
  declare module "assets:*" {
3710
4180
  export const onRequest: PagesFunction;
@@ -3743,10 +4213,204 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
3743
4213
  // Key Identifier of the JWK
3744
4214
  readonly kid: string;
3745
4215
  }
4216
+ // Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need
4217
+ // to referenced by `Fetcher`. This is included in the "importable" version of the types which
4218
+ // strips all `module` blocks.
4219
+ declare namespace Rpc {
4220
+ // Branded types for identifying `WorkerEntrypoint`/`DurableObject`/`Target`s.
4221
+ // TypeScript uses *structural* typing meaning anything with the same shape as type `T` is a `T`.
4222
+ // For the classes exported by `cloudflare:workers` we want *nominal* typing (i.e. we only want to
4223
+ // accept `WorkerEntrypoint` from `cloudflare:workers`, not any other class with the same shape)
4224
+ export const __RPC_STUB_BRAND: unique symbol;
4225
+ export const __RPC_TARGET_BRAND: unique symbol;
4226
+ export const __WORKER_ENTRYPOINT_BRAND: unique symbol;
4227
+ export const __DURABLE_OBJECT_BRAND: unique symbol;
4228
+ export interface RpcTargetBranded {
4229
+ [__RPC_TARGET_BRAND]: never;
4230
+ }
4231
+ export interface WorkerEntrypointBranded {
4232
+ [__WORKER_ENTRYPOINT_BRAND]: never;
4233
+ }
4234
+ export interface DurableObjectBranded {
4235
+ [__DURABLE_OBJECT_BRAND]: never;
4236
+ }
4237
+ export type EntrypointBranded =
4238
+ | WorkerEntrypointBranded
4239
+ | DurableObjectBranded;
4240
+ // Types that can be used through `Stub`s
4241
+ export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
4242
+ // Types that can be passed over RPC
4243
+ type Serializable =
4244
+ // Structured cloneables
4245
+ | void
4246
+ | undefined
4247
+ | null
4248
+ | boolean
4249
+ | number
4250
+ | bigint
4251
+ | string
4252
+ | TypedArray
4253
+ | ArrayBuffer
4254
+ | DataView
4255
+ | Date
4256
+ | Error
4257
+ | RegExp
4258
+ // Structured cloneable composites
4259
+ | Map<Serializable, Serializable>
4260
+ | Set<Serializable>
4261
+ | ReadonlyArray<Serializable>
4262
+ | {
4263
+ [key: string | number]: Serializable;
4264
+ }
4265
+ // Special types
4266
+ | ReadableStream<Uint8Array>
4267
+ | WritableStream<Uint8Array>
4268
+ | Request
4269
+ | Response
4270
+ | Headers
4271
+ | Stub<Stubable>
4272
+ // Serialized as stubs, see `Stubify`
4273
+ | Stubable;
4274
+ // Base type for all RPC stubs, including common memory management methods.
4275
+ // `T` is used as a marker type for unwrapping `Stub`s later.
4276
+ interface StubBase<T extends Stubable> extends Disposable {
4277
+ [__RPC_STUB_BRAND]: T;
4278
+ dup(): this;
4279
+ }
4280
+ export type Stub<T extends Stubable> = Provider<T> & StubBase<T>;
4281
+ // Recursively rewrite all `Stubable` types with `Stub`s
4282
+ type Stubify<T> = T extends Stubable
4283
+ ? Stub<T>
4284
+ : T extends Map<infer K, infer V>
4285
+ ? Map<Stubify<K>, Stubify<V>>
4286
+ : T extends Set<infer V>
4287
+ ? Set<Stubify<V>>
4288
+ : T extends Array<infer V>
4289
+ ? Array<Stubify<V>>
4290
+ : T extends ReadonlyArray<infer V>
4291
+ ? ReadonlyArray<Stubify<V>>
4292
+ : T extends {
4293
+ [key: string | number]: unknown;
4294
+ }
4295
+ ? {
4296
+ [K in keyof T]: Stubify<T[K]>;
4297
+ }
4298
+ : T;
4299
+ // Recursively rewrite all `Stub<T>`s with the corresponding `T`s.
4300
+ // Note we use `StubBase` instead of `Stub` here to avoid circular dependencies:
4301
+ // `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`.
4302
+ type Unstubify<T> =
4303
+ T extends StubBase<infer V>
4304
+ ? V
4305
+ : T extends Map<infer K, infer V>
4306
+ ? Map<Unstubify<K>, Unstubify<V>>
4307
+ : T extends Set<infer V>
4308
+ ? Set<Unstubify<V>>
4309
+ : T extends Array<infer V>
4310
+ ? Array<Unstubify<V>>
4311
+ : T extends ReadonlyArray<infer V>
4312
+ ? ReadonlyArray<Unstubify<V>>
4313
+ : T extends {
4314
+ [key: string | number]: unknown;
4315
+ }
4316
+ ? {
4317
+ [K in keyof T]: Unstubify<T[K]>;
4318
+ }
4319
+ : T;
4320
+ type UnstubifyAll<A extends any[]> = {
4321
+ [I in keyof A]: Unstubify<A[I]>;
4322
+ };
4323
+ // Utility type for adding `Provider`/`Disposable`s to `object` types only.
4324
+ // Note `unknown & T` is equivalent to `T`.
4325
+ type MaybeProvider<T> = T extends object ? Provider<T> : unknown;
4326
+ type MaybeDisposable<T> = T extends object ? Disposable : unknown;
4327
+ // Type for method return or property on an RPC interface.
4328
+ // - Stubable types are replaced by stubs.
4329
+ // - Serializable types are passed by value, with stubable types replaced by stubs
4330
+ // and a top-level `Disposer`.
4331
+ // Everything else can't be passed over PRC.
4332
+ // Technically, we use custom thenables here, but they quack like `Promise`s.
4333
+ // Intersecting with `(Maybe)Provider` allows pipelining.
4334
+ type Result<R> = R extends Stubable
4335
+ ? Promise<Stub<R>> & Provider<R>
4336
+ : R extends Serializable
4337
+ ? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R>
4338
+ : never;
4339
+ // Type for method or property on an RPC interface.
4340
+ // For methods, unwrap `Stub`s in parameters, and rewrite returns to be `Result`s.
4341
+ // Unwrapping `Stub`s allows calling with `Stubable` arguments.
4342
+ // For properties, rewrite types to be `Result`s.
4343
+ // In each case, unwrap `Promise`s.
4344
+ type MethodOrProperty<V> = V extends (...args: infer P) => infer R
4345
+ ? (...args: UnstubifyAll<P>) => Result<Awaited<R>>
4346
+ : Result<Awaited<V>>;
4347
+ // Type for the callable part of an `Provider` if `T` is callable.
4348
+ // This is intersected with methods/properties.
4349
+ type MaybeCallableProvider<T> = T extends (...args: any[]) => any
4350
+ ? MethodOrProperty<T>
4351
+ : unknown;
4352
+ // Base type for all other types providing RPC-like interfaces.
4353
+ // Rewrites all methods/properties to be `MethodOrProperty`s, while preserving callable types.
4354
+ // `Reserved` names (e.g. stub method names like `dup()`) and symbols can't be accessed over RPC.
4355
+ export type Provider<
4356
+ T extends object,
4357
+ Reserved extends string = never,
4358
+ > = MaybeCallableProvider<T> & {
4359
+ [K in Exclude<
4360
+ keyof T,
4361
+ Reserved | symbol | keyof StubBase<never>
4362
+ >]: MethodOrProperty<T[K]>;
4363
+ };
4364
+ }
4365
+ declare module "cloudflare:workers" {
4366
+ export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;
4367
+ export const RpcStub: {
4368
+ new <T extends Rpc.Stubable>(value: T): Rpc.Stub<T>;
4369
+ };
4370
+ export abstract class RpcTarget implements Rpc.RpcTargetBranded {
4371
+ [Rpc.__RPC_TARGET_BRAND]: never;
4372
+ }
4373
+ // `protected` fields don't appear in `keyof`s, so can't be accessed over RPC
4374
+ export abstract class WorkerEntrypoint<Env = unknown>
4375
+ implements Rpc.WorkerEntrypointBranded
4376
+ {
4377
+ [Rpc.__WORKER_ENTRYPOINT_BRAND]: never;
4378
+ protected ctx: ExecutionContext;
4379
+ protected env: Env;
4380
+ constructor(ctx: ExecutionContext, env: Env);
4381
+ fetch?(request: Request): Response | Promise<Response>;
4382
+ tail?(events: TraceItem[]): void | Promise<void>;
4383
+ trace?(traces: TraceItem[]): void | Promise<void>;
4384
+ scheduled?(controller: ScheduledController): void | Promise<void>;
4385
+ queue?(batch: MessageBatch<unknown>): void | Promise<void>;
4386
+ test?(controller: TestController): void | Promise<void>;
4387
+ }
4388
+ export abstract class DurableObject<Env = unknown>
4389
+ implements Rpc.DurableObjectBranded
4390
+ {
4391
+ [Rpc.__DURABLE_OBJECT_BRAND]: never;
4392
+ protected ctx: DurableObjectState;
4393
+ protected env: Env;
4394
+ constructor(ctx: DurableObjectState, env: Env);
4395
+ fetch?(request: Request): Response | Promise<Response>;
4396
+ alarm?(): void | Promise<void>;
4397
+ webSocketMessage?(
4398
+ ws: WebSocket,
4399
+ message: string | ArrayBuffer,
4400
+ ): void | Promise<void>;
4401
+ webSocketClose?(
4402
+ ws: WebSocket,
4403
+ code: number,
4404
+ reason: string,
4405
+ wasClean: boolean,
4406
+ ): void | Promise<void>;
4407
+ webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
4408
+ }
4409
+ }
3746
4410
  declare module "cloudflare:sockets" {
3747
4411
  function _connect(
3748
4412
  address: string | SocketAddress,
3749
- options?: SocketOptions
4413
+ options?: SocketOptions,
3750
4414
  ): Socket;
3751
4415
  export { _connect as connect };
3752
4416
  }
@@ -3882,7 +4546,7 @@ declare abstract class VectorizeIndex {
3882
4546
  */
3883
4547
  public query(
3884
4548
  vector: VectorFloatArray | number[],
3885
- options: VectorizeQueryOptions
4549
+ options: VectorizeQueryOptions,
3886
4550
  ): Promise<VectorizeMatches>;
3887
4551
  /**
3888
4552
  * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
@@ -3909,6 +4573,16 @@ declare abstract class VectorizeIndex {
3909
4573
  */
3910
4574
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
3911
4575
  }
4576
+ /**
4577
+ * The interface for "version_metadata" binding
4578
+ * providing metadata about the Worker Version using this binding.
4579
+ */
4580
+ declare type WorkerVersionMetadata = {
4581
+ /** The ID of the Worker Version using this binding */
4582
+ id: string;
4583
+ /** The tag of the Worker Version using this binding */
4584
+ tag: string;
4585
+ };
3912
4586
  declare interface DynamicDispatchLimits {
3913
4587
  /**
3914
4588
  * Limit CPU time in milliseconds.
@@ -3944,6 +4618,6 @@ declare interface DispatchNamespace {
3944
4618
  args?: {
3945
4619
  [key: string]: any;
3946
4620
  },
3947
- options?: DynamicDispatchOptions
4621
+ options?: DynamicDispatchOptions,
3948
4622
  ): Fetcher;
3949
4623
  }