@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;
@@ -247,49 +289,64 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
247
289
  declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
248
290
  type: Type,
249
291
  handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
250
- options?: EventTargetAddEventListenerOptions | boolean
292
+ options?: EventTargetAddEventListenerOptions | boolean,
251
293
  ): void;
252
294
  declare function removeEventListener<
253
- Type extends keyof WorkerGlobalScopeEventMap
295
+ Type extends keyof WorkerGlobalScopeEventMap,
254
296
  >(
255
297
  type: Type,
256
298
  handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
257
- options?: EventTargetEventListenerOptions | boolean
299
+ options?: EventTargetEventListenerOptions | boolean,
258
300
  ): void;
259
- /** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */
301
+ /**
302
+ * Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
303
+ *
304
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
305
+ */
260
306
  declare function dispatchEvent(
261
- event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]
307
+ event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap],
262
308
  ): boolean;
309
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/btoa) */
263
310
  declare function btoa(data: string): string;
311
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/atob) */
264
312
  declare function atob(data: string): string;
313
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
265
314
  declare function setTimeout(
266
315
  callback: (...args: any[]) => void,
267
- msDelay?: number
316
+ msDelay?: number,
268
317
  ): number;
318
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
269
319
  declare function setTimeout<Args extends any[]>(
270
320
  callback: (...args: Args) => void,
271
321
  msDelay?: number,
272
322
  ...args: Args
273
323
  ): number;
324
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearTimeout) */
274
325
  declare function clearTimeout(timeoutId: number | null): void;
326
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
275
327
  declare function setInterval(
276
328
  callback: (...args: any[]) => void,
277
- msDelay?: number
329
+ msDelay?: number,
278
330
  ): number;
331
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
279
332
  declare function setInterval<Args extends any[]>(
280
333
  callback: (...args: Args) => void,
281
334
  msDelay?: number,
282
335
  ...args: Args
283
336
  ): number;
337
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearInterval) */
284
338
  declare function clearInterval(timeoutId: number | null): void;
339
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/queueMicrotask) */
285
340
  declare function queueMicrotask(task: Function): void;
341
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/structuredClone) */
286
342
  declare function structuredClone<T>(
287
343
  value: T,
288
- options?: StructuredSerializeOptions
344
+ options?: StructuredSerializeOptions,
289
345
  ): T;
346
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
290
347
  declare function fetch(
291
348
  input: RequestInfo,
292
- init?: RequestInit<RequestInitCfProperties>
349
+ init?: RequestInit<RequestInitCfProperties>,
293
350
  ): Promise<Response>;
294
351
  declare const self: ServiceWorkerGlobalScope;
295
352
  declare const crypto: Crypto;
@@ -304,41 +361,41 @@ declare interface ExecutionContext {
304
361
  }
305
362
  declare type ExportedHandlerFetchHandler<
306
363
  Env = unknown,
307
- CfHostMetadata = unknown
364
+ CfHostMetadata = unknown,
308
365
  > = (
309
366
  request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
310
367
  env: Env,
311
- ctx: ExecutionContext
368
+ ctx: ExecutionContext,
312
369
  ) => Response | Promise<Response>;
313
370
  declare type ExportedHandlerTailHandler<Env = unknown> = (
314
371
  events: TraceItem[],
315
372
  env: Env,
316
- ctx: ExecutionContext
373
+ ctx: ExecutionContext,
317
374
  ) => void | Promise<void>;
318
375
  declare type ExportedHandlerTraceHandler<Env = unknown> = (
319
376
  traces: TraceItem[],
320
377
  env: Env,
321
- ctx: ExecutionContext
378
+ ctx: ExecutionContext,
322
379
  ) => void | Promise<void>;
323
380
  declare type ExportedHandlerScheduledHandler<Env = unknown> = (
324
381
  controller: ScheduledController,
325
382
  env: Env,
326
- ctx: ExecutionContext
383
+ ctx: ExecutionContext,
327
384
  ) => void | Promise<void>;
328
385
  declare type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
329
386
  batch: MessageBatch<Message>,
330
387
  env: Env,
331
- ctx: ExecutionContext
388
+ ctx: ExecutionContext,
332
389
  ) => void | Promise<void>;
333
390
  declare type ExportedHandlerTestHandler<Env = unknown> = (
334
391
  controller: TestController,
335
392
  env: Env,
336
- ctx: ExecutionContext
393
+ ctx: ExecutionContext,
337
394
  ) => void | Promise<void>;
338
395
  declare interface ExportedHandler<
339
396
  Env = unknown,
340
397
  QueueHandlerMessage = unknown,
341
- CfHostMetadata = unknown
398
+ CfHostMetadata = unknown,
342
399
  > {
343
400
  fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
344
401
  tail?: ExportedHandlerTailHandler<Env>;
@@ -352,12 +409,20 @@ declare interface StructuredSerializeOptions {
352
409
  transfer?: any[];
353
410
  }
354
411
  declare abstract class PromiseRejectionEvent extends Event {
412
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise) */
355
413
  readonly promise: Promise<any>;
414
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason) */
356
415
  readonly reason: any;
357
416
  }
358
- /** Provides access to performance-related information for the current page. It's part of the High Resolution Time API, but is enhanced by the Performance Timeline API, the Navigation Timing API, the User Timing API, and the Resource Timing API. */
417
+ /**
418
+ * Provides access to performance-related information for the current page. It's part of the High Resolution Time API, but is enhanced by the Performance Timeline API, the Navigation Timing API, the User Timing API, and the Resource Timing API.
419
+ *
420
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance)
421
+ */
359
422
  declare interface Performance {
423
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/timeOrigin) */
360
424
  readonly timeOrigin: number;
425
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/now) */
361
426
  now(): number;
362
427
  }
363
428
  declare interface AlarmInvocationInfo {
@@ -369,36 +434,42 @@ declare interface DurableObject {
369
434
  alarm?(): void | Promise<void>;
370
435
  webSocketMessage?(
371
436
  ws: WebSocket,
372
- message: string | ArrayBuffer
437
+ message: string | ArrayBuffer,
373
438
  ): void | Promise<void>;
374
439
  webSocketClose?(
375
440
  ws: WebSocket,
376
441
  code: number,
377
442
  reason: string,
378
- wasClean: boolean
443
+ wasClean: boolean,
379
444
  ): void | Promise<void>;
380
445
  webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
381
446
  }
382
- declare interface DurableObjectStub extends Fetcher {
447
+ declare type DurableObjectStub<
448
+ T extends Rpc.DurableObjectBranded | undefined = undefined,
449
+ > = Fetcher<
450
+ T,
451
+ "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
452
+ > & {
383
453
  readonly id: DurableObjectId;
384
454
  readonly name?: string;
385
- }
455
+ };
386
456
  declare interface DurableObjectId {
387
457
  toString(): string;
388
458
  equals(other: DurableObjectId): boolean;
389
459
  readonly name?: string;
390
460
  }
391
- declare interface DurableObjectNamespace {
461
+ declare interface DurableObjectNamespace<
462
+ T extends Rpc.DurableObjectBranded | undefined = undefined,
463
+ > {
392
464
  newUniqueId(
393
- options?: DurableObjectNamespaceNewUniqueIdOptions
465
+ options?: DurableObjectNamespaceNewUniqueIdOptions,
394
466
  ): DurableObjectId;
395
467
  idFromName(name: string): DurableObjectId;
396
468
  idFromString(id: string): DurableObjectId;
397
- get(
398
- id: DurableObjectId,
399
- options?: DurableObjectNamespaceGetDurableObjectOptions
400
- ): DurableObjectStub;
401
- jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
469
+ get(id: DurableObjectId): DurableObjectStub<T>;
470
+ jurisdiction(
471
+ jurisdiction: DurableObjectJurisdiction,
472
+ ): DurableObjectNamespace<T>;
402
473
  }
403
474
  declare type DurableObjectJurisdiction = "eu" | "fedramp";
404
475
  declare interface DurableObjectNamespaceNewUniqueIdOptions {
@@ -434,23 +505,23 @@ declare interface DurableObjectState {
434
505
  declare interface DurableObjectTransaction {
435
506
  get<T = unknown>(
436
507
  key: string,
437
- options?: DurableObjectGetOptions
508
+ options?: DurableObjectGetOptions,
438
509
  ): Promise<T | undefined>;
439
510
  get<T = unknown>(
440
511
  keys: string[],
441
- options?: DurableObjectGetOptions
512
+ options?: DurableObjectGetOptions,
442
513
  ): Promise<Map<string, T>>;
443
514
  list<T = unknown>(
444
- options?: DurableObjectListOptions
515
+ options?: DurableObjectListOptions,
445
516
  ): Promise<Map<string, T>>;
446
517
  put<T>(
447
518
  key: string,
448
519
  value: T,
449
- options?: DurableObjectPutOptions
520
+ options?: DurableObjectPutOptions,
450
521
  ): Promise<void>;
451
522
  put<T>(
452
523
  entries: Record<string, T>,
453
- options?: DurableObjectPutOptions
524
+ options?: DurableObjectPutOptions,
454
525
  ): Promise<void>;
455
526
  delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
456
527
  delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
@@ -458,41 +529,41 @@ declare interface DurableObjectTransaction {
458
529
  getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
459
530
  setAlarm(
460
531
  scheduledTime: number | Date,
461
- options?: DurableObjectSetAlarmOptions
532
+ options?: DurableObjectSetAlarmOptions,
462
533
  ): Promise<void>;
463
534
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
464
535
  }
465
536
  declare interface DurableObjectStorage {
466
537
  get<T = unknown>(
467
538
  key: string,
468
- options?: DurableObjectGetOptions
539
+ options?: DurableObjectGetOptions,
469
540
  ): Promise<T | undefined>;
470
541
  get<T = unknown>(
471
542
  keys: string[],
472
- options?: DurableObjectGetOptions
543
+ options?: DurableObjectGetOptions,
473
544
  ): Promise<Map<string, T>>;
474
545
  list<T = unknown>(
475
- options?: DurableObjectListOptions
546
+ options?: DurableObjectListOptions,
476
547
  ): Promise<Map<string, T>>;
477
548
  put<T>(
478
549
  key: string,
479
550
  value: T,
480
- options?: DurableObjectPutOptions
551
+ options?: DurableObjectPutOptions,
481
552
  ): Promise<void>;
482
553
  put<T>(
483
554
  entries: Record<string, T>,
484
- options?: DurableObjectPutOptions
555
+ options?: DurableObjectPutOptions,
485
556
  ): Promise<void>;
486
557
  delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
487
558
  delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
488
559
  deleteAll(options?: DurableObjectPutOptions): Promise<void>;
489
560
  transaction<T>(
490
- closure: (txn: DurableObjectTransaction) => Promise<T>
561
+ closure: (txn: DurableObjectTransaction) => Promise<T>,
491
562
  ): Promise<T>;
492
563
  getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
493
564
  setAlarm(
494
565
  scheduledTime: number | Date,
495
- options?: DurableObjectSetAlarmOptions
566
+ options?: DurableObjectSetAlarmOptions,
496
567
  ): Promise<void>;
497
568
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
498
569
  sync(): Promise<void>;
@@ -539,32 +610,101 @@ declare interface AnalyticsEngineDataPoint {
539
610
  }
540
611
  declare class Event {
541
612
  constructor(type: string, init?: EventInit);
542
- /** Returns the type of event, e.g. "click", "hashchange", or "submit". */
613
+ /**
614
+ * Returns the type of event, e.g. "click", "hashchange", or "submit".
615
+ *
616
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
617
+ */
543
618
  readonly type: string;
544
- /** Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. */
619
+ /**
620
+ * Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE.
621
+ *
622
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
623
+ */
545
624
  readonly eventPhase: number;
546
- /** 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. */
625
+ /**
626
+ * Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise.
627
+ *
628
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
629
+ */
547
630
  readonly composed: boolean;
548
- /** 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. */
631
+ /**
632
+ * Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise.
633
+ *
634
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)
635
+ */
549
636
  readonly bubbles: boolean;
550
- /** 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. */
637
+ /**
638
+ * Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method.
639
+ *
640
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)
641
+ */
551
642
  readonly cancelable: boolean;
552
- /** Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. */
643
+ /**
644
+ * Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise.
645
+ *
646
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)
647
+ */
553
648
  readonly defaultPrevented: boolean;
554
- /** @deprecated */
649
+ /**
650
+ * @deprecated
651
+ *
652
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)
653
+ */
555
654
  readonly returnValue: boolean;
556
- /** Returns the object whose event listener's callback is currently being invoked. */
655
+ /**
656
+ * Returns the object whose event listener's callback is currently being invoked.
657
+ *
658
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
659
+ */
557
660
  readonly currentTarget?: EventTarget;
558
- /** @deprecated */
661
+ /**
662
+ * @deprecated
663
+ *
664
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
665
+ */
559
666
  readonly srcElement?: EventTarget;
560
- /** Returns the event's timestamp as the number of milliseconds measured relative to the time origin. */
667
+ /**
668
+ * Returns the event's timestamp as the number of milliseconds measured relative to the time origin.
669
+ *
670
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)
671
+ */
561
672
  readonly timeStamp: number;
562
- /** Returns true if event was dispatched by the user agent, and false otherwise. */
673
+ /**
674
+ * Returns true if event was dispatched by the user agent, and false otherwise.
675
+ *
676
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
677
+ */
563
678
  readonly isTrusted: boolean;
679
+ /**
680
+ * @deprecated
681
+ *
682
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
683
+ */
564
684
  cancelBubble: boolean;
685
+ /**
686
+ * 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.
687
+ *
688
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
689
+ */
565
690
  stopImmediatePropagation(): void;
691
+ /**
692
+ * 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.
693
+ *
694
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
695
+ */
566
696
  preventDefault(): void;
697
+ /**
698
+ * When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object.
699
+ *
700
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
701
+ */
567
702
  stopPropagation(): void;
703
+ /**
704
+ * 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.
705
+ *
706
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
707
+ */
568
708
  composedPath(): EventTarget[];
569
709
  static readonly NONE: number;
570
710
  static readonly CAPTURING_PHASE: number;
@@ -577,28 +717,55 @@ declare interface EventInit {
577
717
  composed?: boolean;
578
718
  }
579
719
  declare type EventListener<EventType extends Event = Event> = (
580
- event: EventType
720
+ event: EventType,
581
721
  ) => void;
582
722
  declare interface EventListenerObject<EventType extends Event = Event> {
583
723
  handleEvent(event: EventType): void;
584
724
  }
585
725
  declare type EventListenerOrEventListenerObject<
586
- EventType extends Event = Event
726
+ EventType extends Event = Event,
587
727
  > = EventListener<EventType> | EventListenerObject<EventType>;
588
728
  declare class EventTarget<
589
- EventMap extends Record<string, Event> = Record<string, Event>
729
+ EventMap extends Record<string, Event> = Record<string, Event>,
590
730
  > {
591
731
  constructor();
732
+ /**
733
+ * 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.
734
+ *
735
+ * 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.
736
+ *
737
+ * 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.
738
+ *
739
+ * 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.
740
+ *
741
+ * When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
742
+ *
743
+ * If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
744
+ *
745
+ * The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
746
+ *
747
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
748
+ */
592
749
  addEventListener<Type extends keyof EventMap>(
593
750
  type: Type,
594
751
  handler: EventListenerOrEventListenerObject<EventMap[Type]>,
595
- options?: EventTargetAddEventListenerOptions | boolean
752
+ options?: EventTargetAddEventListenerOptions | boolean,
596
753
  ): void;
754
+ /**
755
+ * Removes the event listener in target's event listener list with the same type, callback, and options.
756
+ *
757
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
758
+ */
597
759
  removeEventListener<Type extends keyof EventMap>(
598
760
  type: Type,
599
761
  handler: EventListenerOrEventListenerObject<EventMap[Type]>,
600
- options?: EventTargetEventListenerOptions | boolean
762
+ options?: EventTargetEventListenerOptions | boolean,
601
763
  ): void;
764
+ /**
765
+ * 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.
766
+ *
767
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
768
+ */
602
769
  dispatchEvent(event: EventMap[keyof EventMap]): boolean;
603
770
  }
604
771
  declare interface EventTargetEventListenerOptions {
@@ -615,17 +782,34 @@ declare interface EventTargetHandlerObject {
615
782
  }
616
783
  declare class AbortController {
617
784
  constructor();
618
- /** Returns the AbortSignal object associated with this object. */
785
+ /**
786
+ * Returns the AbortSignal object associated with this object.
787
+ *
788
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)
789
+ */
619
790
  readonly signal: AbortSignal;
791
+ /**
792
+ * 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.
793
+ *
794
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)
795
+ */
620
796
  abort(reason?: any): void;
621
797
  }
622
798
  declare abstract class AbortSignal extends EventTarget {
799
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) */
623
800
  static abort(reason?: any): AbortSignal;
801
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static) */
624
802
  static timeout(delay: number): AbortSignal;
625
803
  static any(signals: AbortSignal[]): AbortSignal;
626
- /** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */
804
+ /**
805
+ * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
806
+ *
807
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)
808
+ */
627
809
  readonly aborted: boolean;
810
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason) */
628
811
  readonly reason: any;
812
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted) */
629
813
  throwIfAborted(): void;
630
814
  }
631
815
  declare interface Scheduler {
@@ -635,10 +819,16 @@ declare interface SchedulerWaitOptions {
635
819
  signal?: AbortSignal;
636
820
  }
637
821
  declare abstract class ExtendableEvent extends Event {
822
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil) */
638
823
  waitUntil(promise: Promise<any>): void;
639
824
  }
640
825
  declare class CustomEvent<T = any> extends Event {
641
826
  constructor(type: string, init?: CustomEventCustomEventInit);
827
+ /**
828
+ * Returns any custom data event was created with. Typically used for synthetic events.
829
+ *
830
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
831
+ */
642
832
  get detail(): T;
643
833
  }
644
834
  declare interface CustomEventCustomEventInit {
@@ -650,13 +840,19 @@ declare interface CustomEventCustomEventInit {
650
840
  declare class Blob {
651
841
  constructor(
652
842
  bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[],
653
- options?: BlobOptions
843
+ options?: BlobOptions,
654
844
  );
845
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
655
846
  readonly size: number;
847
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
656
848
  readonly type: string;
849
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
657
850
  slice(start?: number, end?: number, type?: string): Blob;
851
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) */
658
852
  arrayBuffer(): Promise<ArrayBuffer>;
853
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
659
854
  text(): Promise<string>;
855
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream) */
660
856
  stream(): ReadableStream;
661
857
  }
662
858
  declare interface BlobOptions {
@@ -666,9 +862,11 @@ declare class File extends Blob {
666
862
  constructor(
667
863
  bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined,
668
864
  name: string,
669
- options?: FileOptions
865
+ options?: FileOptions,
670
866
  );
867
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
671
868
  readonly name: string;
869
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
672
870
  readonly lastModified: number;
673
871
  }
674
872
  declare interface FileOptions {
@@ -676,6 +874,7 @@ declare interface FileOptions {
676
874
  lastModified?: number;
677
875
  }
678
876
  declare abstract class CacheStorage {
877
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open) */
679
878
  open(cacheName: string): Promise<Cache>;
680
879
  readonly default: Cache;
681
880
  }
@@ -683,7 +882,7 @@ declare abstract class Cache {
683
882
  delete(request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>;
684
883
  match(
685
884
  request: RequestInfo,
686
- options?: CacheQueryOptions
885
+ options?: CacheQueryOptions,
687
886
  ): Promise<Response | undefined>;
688
887
  put(request: RequestInfo, response: Response): Promise<void>;
689
888
  }
@@ -691,8 +890,13 @@ declare interface CacheQueryOptions {
691
890
  ignoreMethod?: boolean;
692
891
  }
693
892
  declare abstract class Crypto {
694
- /** Available only in secure contexts. */
893
+ /**
894
+ * Available only in secure contexts.
895
+ *
896
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
897
+ */
695
898
  readonly subtle: SubtleCrypto;
899
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */
696
900
  getRandomValues<
697
901
  T extends
698
902
  | Int8Array
@@ -702,8 +906,13 @@ declare abstract class Crypto {
702
906
  | Int32Array
703
907
  | Uint32Array
704
908
  | BigInt64Array
705
- | BigUint64Array
909
+ | BigUint64Array,
706
910
  >(buffer: T): T;
911
+ /**
912
+ * Available only in secure contexts.
913
+ *
914
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)
915
+ */
707
916
  randomUUID(): string;
708
917
  DigestStream: typeof DigestStream;
709
918
  }
@@ -711,59 +920,63 @@ declare abstract class SubtleCrypto {
711
920
  encrypt(
712
921
  algorithm: string | SubtleCryptoEncryptAlgorithm,
713
922
  key: CryptoKey,
714
- plainText: ArrayBuffer | ArrayBufferView
923
+ plainText: ArrayBuffer | ArrayBufferView,
715
924
  ): Promise<ArrayBuffer>;
716
925
  decrypt(
717
926
  algorithm: string | SubtleCryptoEncryptAlgorithm,
718
927
  key: CryptoKey,
719
- cipherText: ArrayBuffer | ArrayBufferView
928
+ cipherText: ArrayBuffer | ArrayBufferView,
720
929
  ): Promise<ArrayBuffer>;
721
930
  sign(
722
931
  algorithm: string | SubtleCryptoSignAlgorithm,
723
932
  key: CryptoKey,
724
- data: ArrayBuffer | ArrayBufferView
933
+ data: ArrayBuffer | ArrayBufferView,
725
934
  ): Promise<ArrayBuffer>;
726
935
  verify(
727
936
  algorithm: string | SubtleCryptoSignAlgorithm,
728
937
  key: CryptoKey,
729
938
  signature: ArrayBuffer | ArrayBufferView,
730
- data: ArrayBuffer | ArrayBufferView
939
+ data: ArrayBuffer | ArrayBufferView,
731
940
  ): Promise<boolean>;
732
941
  digest(
733
942
  algorithm: string | SubtleCryptoHashAlgorithm,
734
- data: ArrayBuffer | ArrayBufferView
943
+ data: ArrayBuffer | ArrayBufferView,
735
944
  ): Promise<ArrayBuffer>;
945
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) */
736
946
  generateKey(
737
947
  algorithm: string | SubtleCryptoGenerateKeyAlgorithm,
738
948
  extractable: boolean,
739
- keyUsages: string[]
949
+ keyUsages: string[],
740
950
  ): Promise<CryptoKey | CryptoKeyPair>;
951
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey) */
741
952
  deriveKey(
742
953
  algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
743
954
  baseKey: CryptoKey,
744
955
  derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
745
956
  extractable: boolean,
746
- keyUsages: string[]
957
+ keyUsages: string[],
747
958
  ): Promise<CryptoKey>;
748
959
  deriveBits(
749
960
  algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
750
961
  baseKey: CryptoKey,
751
- length: number | null
962
+ length: number | null,
752
963
  ): Promise<ArrayBuffer>;
964
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) */
753
965
  importKey(
754
966
  format: string,
755
967
  keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey,
756
968
  algorithm: string | SubtleCryptoImportKeyAlgorithm,
757
969
  extractable: boolean,
758
- keyUsages: string[]
970
+ keyUsages: string[],
759
971
  ): Promise<CryptoKey>;
760
972
  exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
761
973
  wrapKey(
762
974
  format: string,
763
975
  key: CryptoKey,
764
976
  wrappingKey: CryptoKey,
765
- wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm
977
+ wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
766
978
  ): Promise<ArrayBuffer>;
979
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey) */
767
980
  unwrapKey(
768
981
  format: string,
769
982
  wrappedKey: ArrayBuffer | ArrayBufferView,
@@ -771,16 +984,19 @@ declare abstract class SubtleCrypto {
771
984
  unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
772
985
  unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
773
986
  extractable: boolean,
774
- keyUsages: string[]
987
+ keyUsages: string[],
775
988
  ): Promise<CryptoKey>;
776
989
  timingSafeEqual(
777
990
  a: ArrayBuffer | ArrayBufferView,
778
- b: ArrayBuffer | ArrayBufferView
991
+ b: ArrayBuffer | ArrayBufferView,
779
992
  ): boolean;
780
993
  }
781
994
  declare abstract class CryptoKey {
995
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) */
782
996
  readonly type: string;
997
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable) */
783
998
  readonly extractable: boolean;
999
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm) */
784
1000
  readonly algorithm:
785
1001
  | CryptoKeyKeyAlgorithm
786
1002
  | CryptoKeyAesKeyAlgorithm
@@ -788,6 +1004,7 @@ declare abstract class CryptoKey {
788
1004
  | CryptoKeyRsaKeyAlgorithm
789
1005
  | CryptoKeyEllipticKeyAlgorithm
790
1006
  | CryptoKeyArbitraryKeyAlgorithm;
1007
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages) */
791
1008
  readonly usages: string[];
792
1009
  }
793
1010
  declare interface CryptoKeyPair {
@@ -896,9 +1113,24 @@ declare class DigestStream extends WritableStream<
896
1113
  }
897
1114
  declare class TextDecoder {
898
1115
  constructor(decoder?: string, options?: TextDecoderConstructorOptions);
1116
+ /**
1117
+ * 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.
1118
+ *
1119
+ * ```
1120
+ * var string = "", decoder = new TextDecoder(encoding), buffer;
1121
+ * while(buffer = next_chunk()) {
1122
+ * string += decoder.decode(buffer, {stream:true});
1123
+ * }
1124
+ * string += decoder.decode(); // end-of-queue
1125
+ * ```
1126
+ *
1127
+ * If the error mode is "fatal" and encoding's decoder returns error, throws a TypeError.
1128
+ *
1129
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)
1130
+ */
899
1131
  decode(
900
1132
  input?: ArrayBuffer | ArrayBufferView,
901
- options?: TextDecoderDecodeOptions
1133
+ options?: TextDecoderDecodeOptions,
902
1134
  ): string;
903
1135
  readonly encoding: string;
904
1136
  readonly fatal: boolean;
@@ -906,10 +1138,20 @@ declare class TextDecoder {
906
1138
  }
907
1139
  declare class TextEncoder {
908
1140
  constructor();
1141
+ /**
1142
+ * Returns the result of running UTF-8's encoder.
1143
+ *
1144
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)
1145
+ */
909
1146
  encode(input?: string): Uint8Array;
1147
+ /**
1148
+ * 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.
1149
+ *
1150
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)
1151
+ */
910
1152
  encodeInto(
911
1153
  input: string,
912
- buffer: ArrayBuffer | ArrayBufferView
1154
+ buffer: ArrayBuffer | ArrayBufferView,
913
1155
  ): TextEncoderEncodeIntoResult;
914
1156
  readonly encoding: string;
915
1157
  }
@@ -934,17 +1176,20 @@ declare class FormData {
934
1176
  has(name: string): boolean;
935
1177
  set(name: string, value: string): void;
936
1178
  set(name: string, value: Blob, filename?: string): void;
1179
+ /** Returns an array of key, value pairs for every entry in the list. */
937
1180
  entries(): IterableIterator<[key: string, value: File | string]>;
1181
+ /** Returns a list of keys in the list. */
938
1182
  keys(): IterableIterator<string>;
1183
+ /** Returns a list of values in the list. */
939
1184
  values(): IterableIterator<File | string>;
940
1185
  forEach<This = unknown>(
941
1186
  callback: (
942
1187
  this: This,
943
1188
  value: File | string,
944
1189
  key: string,
945
- parent: FormData
1190
+ parent: FormData,
946
1191
  ) => void,
947
- thisArg?: This
1192
+ thisArg?: This,
948
1193
  ): void;
949
1194
  [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>;
950
1195
  }
@@ -955,7 +1200,7 @@ declare class HTMLRewriter {
955
1200
  constructor();
956
1201
  on(
957
1202
  selector: string,
958
- handlers: HTMLRewriterElementContentHandlers
1203
+ handlers: HTMLRewriterElementContentHandlers,
959
1204
  ): HTMLRewriter;
960
1205
  onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;
961
1206
  transform(response: Response): Response;
@@ -1022,7 +1267,9 @@ declare interface DocumentEnd {
1022
1267
  append(content: string, options?: ContentOptions): DocumentEnd;
1023
1268
  }
1024
1269
  declare abstract class FetchEvent extends ExtendableEvent {
1270
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request) */
1025
1271
  readonly request: Request;
1272
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith) */
1026
1273
  respondWith(promise: Response | Promise<Response>): void;
1027
1274
  passThroughOnException(): void;
1028
1275
  }
@@ -1040,10 +1287,13 @@ declare class Headers {
1040
1287
  delete(name: string): void;
1041
1288
  forEach<This = unknown>(
1042
1289
  callback: (this: This, value: string, key: string, parent: Headers) => void,
1043
- thisArg?: This
1290
+ thisArg?: This,
1044
1291
  ): void;
1292
+ /** Returns an iterator allowing to go through all key/value pairs contained in this object. */
1045
1293
  entries(): IterableIterator<[key: string, value: string]>;
1294
+ /** Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */
1046
1295
  keys(): IterableIterator<string>;
1296
+ /** Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
1047
1297
  values(): IterableIterator<string>;
1048
1298
  [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
1049
1299
  }
@@ -1066,14 +1316,23 @@ declare abstract class Body {
1066
1316
  }
1067
1317
  declare class Response extends Body {
1068
1318
  constructor(body?: BodyInit | null, init?: ResponseInit);
1319
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirect_static) */
1069
1320
  static redirect(url: string, status?: number): Response;
1321
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/json_static) */
1070
1322
  static json(any: any, maybeInit?: ResponseInit | Response): Response;
1323
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) */
1071
1324
  clone(): Response;
1325
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) */
1072
1326
  readonly status: number;
1327
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText) */
1073
1328
  readonly statusText: string;
1329
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) */
1074
1330
  readonly headers: Headers;
1331
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok) */
1075
1332
  readonly ok: boolean;
1333
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected) */
1076
1334
  readonly redirected: boolean;
1335
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) */
1077
1336
  readonly url: string;
1078
1337
  readonly webSocket: WebSocket | null;
1079
1338
  readonly cf?: any;
@@ -1088,29 +1347,58 @@ declare interface ResponseInit {
1088
1347
  }
1089
1348
  declare type RequestInfo<
1090
1349
  CfHostMetadata = unknown,
1091
- Cf = CfProperties<CfHostMetadata>
1350
+ Cf = CfProperties<CfHostMetadata>,
1092
1351
  > = Request<CfHostMetadata, Cf> | string | URL;
1093
1352
  declare class Request<
1094
1353
  CfHostMetadata = unknown,
1095
- Cf = CfProperties<CfHostMetadata>
1354
+ Cf = CfProperties<CfHostMetadata>,
1096
1355
  > extends Body {
1097
1356
  constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
1357
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) */
1098
1358
  clone(): Request<CfHostMetadata, Cf>;
1099
- /** Returns request's HTTP method, which is "GET" by default. */
1359
+ /**
1360
+ * Returns request's HTTP method, which is "GET" by default.
1361
+ *
1362
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
1363
+ */
1100
1364
  readonly method: string;
1101
- /** Returns the URL of request as a string. */
1365
+ /**
1366
+ * Returns the URL of request as a string.
1367
+ *
1368
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)
1369
+ */
1102
1370
  readonly url: string;
1103
- /** 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. */
1371
+ /**
1372
+ * 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.
1373
+ *
1374
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
1375
+ */
1104
1376
  readonly headers: Headers;
1105
- /** 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. */
1377
+ /**
1378
+ * 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.
1379
+ *
1380
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)
1381
+ */
1106
1382
  readonly redirect: string;
1107
1383
  readonly fetcher: Fetcher | null;
1108
- /** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. */
1384
+ /**
1385
+ * Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.
1386
+ *
1387
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)
1388
+ */
1109
1389
  readonly signal: AbortSignal;
1110
1390
  readonly cf?: Cf;
1111
- /** 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] */
1391
+ /**
1392
+ * 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]
1393
+ *
1394
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)
1395
+ */
1112
1396
  readonly integrity: string;
1113
- /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
1397
+ /**
1398
+ * Returns a boolean indicating whether or not request can outlive the global in which it was created.
1399
+ *
1400
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
1401
+ */
1114
1402
  readonly keepalive: boolean;
1115
1403
  }
1116
1404
  declare interface RequestInit<Cf = CfProperties> {
@@ -1129,10 +1417,18 @@ declare interface RequestInit<Cf = CfProperties> {
1129
1417
  /** An AbortSignal to set request's signal. */
1130
1418
  signal?: AbortSignal | null;
1131
1419
  }
1132
- declare abstract class Fetcher {
1420
+ declare type Service<
1421
+ T extends Rpc.WorkerEntrypointBranded | undefined = undefined,
1422
+ > = Fetcher<T>;
1423
+ declare type Fetcher<
1424
+ T extends Rpc.EntrypointBranded | undefined = undefined,
1425
+ Reserved extends string = never,
1426
+ > = (T extends Rpc.EntrypointBranded
1427
+ ? Rpc.Provider<T, Reserved | "fetch" | "connect">
1428
+ : unknown) & {
1133
1429
  fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1134
1430
  connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1135
- }
1431
+ };
1136
1432
  declare interface FetcherPutOptions {
1137
1433
  expiration?: number;
1138
1434
  expirationTtl?: number;
@@ -1157,74 +1453,74 @@ declare type KVNamespaceListResult<Metadata, Key extends string = string> =
1157
1453
  declare interface KVNamespace<Key extends string = string> {
1158
1454
  get(
1159
1455
  key: Key,
1160
- options?: Partial<KVNamespaceGetOptions<undefined>>
1456
+ options?: Partial<KVNamespaceGetOptions<undefined>>,
1161
1457
  ): Promise<string | null>;
1162
1458
  get(key: Key, type: "text"): Promise<string | null>;
1163
1459
  get<ExpectedValue = unknown>(
1164
1460
  key: Key,
1165
- type: "json"
1461
+ type: "json",
1166
1462
  ): Promise<ExpectedValue | null>;
1167
1463
  get(key: Key, type: "arrayBuffer"): Promise<ArrayBuffer | null>;
1168
1464
  get(key: Key, type: "stream"): Promise<ReadableStream | null>;
1169
1465
  get(
1170
1466
  key: Key,
1171
- options?: KVNamespaceGetOptions<"text">
1467
+ options?: KVNamespaceGetOptions<"text">,
1172
1468
  ): Promise<string | null>;
1173
1469
  get<ExpectedValue = unknown>(
1174
1470
  key: Key,
1175
- options?: KVNamespaceGetOptions<"json">
1471
+ options?: KVNamespaceGetOptions<"json">,
1176
1472
  ): Promise<ExpectedValue | null>;
1177
1473
  get(
1178
1474
  key: Key,
1179
- options?: KVNamespaceGetOptions<"arrayBuffer">
1475
+ options?: KVNamespaceGetOptions<"arrayBuffer">,
1180
1476
  ): Promise<ArrayBuffer | null>;
1181
1477
  get(
1182
1478
  key: Key,
1183
- options?: KVNamespaceGetOptions<"stream">
1479
+ options?: KVNamespaceGetOptions<"stream">,
1184
1480
  ): Promise<ReadableStream | null>;
1185
1481
  list<Metadata = unknown>(
1186
- options?: KVNamespaceListOptions
1482
+ options?: KVNamespaceListOptions,
1187
1483
  ): Promise<KVNamespaceListResult<Metadata, Key>>;
1188
1484
  put(
1189
1485
  key: Key,
1190
1486
  value: string | ArrayBuffer | ArrayBufferView | ReadableStream,
1191
- options?: KVNamespacePutOptions
1487
+ options?: KVNamespacePutOptions,
1192
1488
  ): Promise<void>;
1193
1489
  getWithMetadata<Metadata = unknown>(
1194
1490
  key: Key,
1195
- options?: Partial<KVNamespaceGetOptions<undefined>>
1491
+ options?: Partial<KVNamespaceGetOptions<undefined>>,
1196
1492
  ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1197
1493
  getWithMetadata<Metadata = unknown>(
1198
1494
  key: Key,
1199
- type: "text"
1495
+ type: "text",
1200
1496
  ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1201
1497
  getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
1202
1498
  key: Key,
1203
- type: "json"
1499
+ type: "json",
1204
1500
  ): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
1205
1501
  getWithMetadata<Metadata = unknown>(
1206
1502
  key: Key,
1207
- type: "arrayBuffer"
1503
+ type: "arrayBuffer",
1208
1504
  ): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
1209
1505
  getWithMetadata<Metadata = unknown>(
1210
1506
  key: Key,
1211
- type: "stream"
1507
+ type: "stream",
1212
1508
  ): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
1213
1509
  getWithMetadata<Metadata = unknown>(
1214
1510
  key: Key,
1215
- options: KVNamespaceGetOptions<"text">
1511
+ options: KVNamespaceGetOptions<"text">,
1216
1512
  ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1217
1513
  getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
1218
1514
  key: Key,
1219
- options: KVNamespaceGetOptions<"json">
1515
+ options: KVNamespaceGetOptions<"json">,
1220
1516
  ): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
1221
1517
  getWithMetadata<Metadata = unknown>(
1222
1518
  key: Key,
1223
- options: KVNamespaceGetOptions<"arrayBuffer">
1519
+ options: KVNamespaceGetOptions<"arrayBuffer">,
1224
1520
  ): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
1225
1521
  getWithMetadata<Metadata = unknown>(
1226
1522
  key: Key,
1227
- options: KVNamespaceGetOptions<"stream">
1523
+ options: KVNamespaceGetOptions<"stream">,
1228
1524
  ): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
1229
1525
  delete(key: Key): Promise<void>;
1230
1526
  }
@@ -1252,7 +1548,7 @@ declare interface Queue<Body = unknown> {
1252
1548
  send(message: Body, options?: QueueSendOptions): Promise<void>;
1253
1549
  sendBatch(
1254
1550
  messages: Iterable<MessageSendRequest<Body>>,
1255
- options?: QueueSendBatchOptions
1551
+ options?: QueueSendBatchOptions,
1256
1552
  ): Promise<void>;
1257
1553
  }
1258
1554
  declare interface QueueSendOptions {
@@ -1274,6 +1570,7 @@ declare interface Message<Body = unknown> {
1274
1570
  readonly id: string;
1275
1571
  readonly timestamp: Date;
1276
1572
  readonly body: Body;
1573
+ readonly attempts: number;
1277
1574
  retry(options?: QueueRetryOptions): void;
1278
1575
  ack(): void;
1279
1576
  }
@@ -1309,7 +1606,7 @@ declare abstract class R2Bucket {
1309
1606
  key: string,
1310
1607
  options: R2GetOptions & {
1311
1608
  onlyIf: R2Conditional | Headers;
1312
- }
1609
+ },
1313
1610
  ): Promise<R2ObjectBody | R2Object | null>;
1314
1611
  get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;
1315
1612
  put(
@@ -1323,7 +1620,7 @@ declare abstract class R2Bucket {
1323
1620
  | Blob,
1324
1621
  options?: R2PutOptions & {
1325
1622
  onlyIf: R2Conditional | Headers;
1326
- }
1623
+ },
1327
1624
  ): Promise<R2Object | null>;
1328
1625
  put(
1329
1626
  key: string,
@@ -1334,11 +1631,11 @@ declare abstract class R2Bucket {
1334
1631
  | string
1335
1632
  | null
1336
1633
  | Blob,
1337
- options?: R2PutOptions
1634
+ options?: R2PutOptions,
1338
1635
  ): Promise<R2Object>;
1339
1636
  createMultipartUpload(
1340
1637
  key: string,
1341
- options?: R2MultipartOptions
1638
+ options?: R2MultipartOptions,
1342
1639
  ): Promise<R2MultipartUpload>;
1343
1640
  resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;
1344
1641
  delete(keys: string | string[]): Promise<void>;
@@ -1349,7 +1646,7 @@ declare interface R2MultipartUpload {
1349
1646
  readonly uploadId: string;
1350
1647
  uploadPart(
1351
1648
  partNumber: number,
1352
- value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob
1649
+ value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob,
1353
1650
  ): Promise<R2UploadedPart>;
1354
1651
  abort(): Promise<void>;
1355
1652
  complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
@@ -1470,7 +1767,7 @@ declare interface UnderlyingSink<W = any> {
1470
1767
  start?: (controller: WritableStreamDefaultController) => void | Promise<void>;
1471
1768
  write?: (
1472
1769
  chunk: W,
1473
- controller: WritableStreamDefaultController
1770
+ controller: WritableStreamDefaultController,
1474
1771
  ) => void | Promise<void>;
1475
1772
  abort?: (reason: any) => void | Promise<void>;
1476
1773
  close?: () => void | Promise<void>;
@@ -1485,10 +1782,10 @@ declare interface UnderlyingByteSource {
1485
1782
  declare interface UnderlyingSource<R = any> {
1486
1783
  type?: "" | undefined;
1487
1784
  start?: (
1488
- controller: ReadableStreamDefaultController<R>
1785
+ controller: ReadableStreamDefaultController<R>,
1489
1786
  ) => void | Promise<void>;
1490
1787
  pull?: (
1491
- controller: ReadableStreamDefaultController<R>
1788
+ controller: ReadableStreamDefaultController<R>,
1492
1789
  ) => void | Promise<void>;
1493
1790
  cancel?: (reason: any) => void | Promise<void>;
1494
1791
  expectedLength?: number | bigint;
@@ -1497,14 +1794,14 @@ declare interface Transformer<I = any, O = any> {
1497
1794
  readableType?: string;
1498
1795
  writableType?: string;
1499
1796
  start?: (
1500
- controller: TransformStreamDefaultController<O>
1797
+ controller: TransformStreamDefaultController<O>,
1501
1798
  ) => void | Promise<void>;
1502
1799
  transform?: (
1503
1800
  chunk: I,
1504
- controller: TransformStreamDefaultController<O>
1801
+ controller: TransformStreamDefaultController<O>,
1505
1802
  ) => void | Promise<void>;
1506
1803
  flush?: (
1507
- controller: TransformStreamDefaultController<O>
1804
+ controller: TransformStreamDefaultController<O>,
1508
1805
  ) => void | Promise<void>;
1509
1806
  cancel?: (reason: any) => void | Promise<void>;
1510
1807
  expectedLength?: number;
@@ -1541,91 +1838,137 @@ declare type ReadableStreamReadResult<R = any> =
1541
1838
  done: true;
1542
1839
  value?: undefined;
1543
1840
  };
1544
- /** 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. */
1841
+ /**
1842
+ * 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.
1843
+ *
1844
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
1845
+ */
1545
1846
  declare interface ReadableStream<R = any> {
1847
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked) */
1546
1848
  readonly locked: boolean;
1849
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel) */
1547
1850
  cancel(reason?: any): Promise<void>;
1851
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
1548
1852
  getReader(): ReadableStreamDefaultReader<R>;
1853
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
1549
1854
  getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
1855
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough) */
1550
1856
  pipeThrough<T>(
1551
1857
  transform: ReadableWritablePair<T, R>,
1552
- options?: StreamPipeOptions
1858
+ options?: StreamPipeOptions,
1553
1859
  ): ReadableStream<T>;
1860
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo) */
1554
1861
  pipeTo(
1555
1862
  destination: WritableStream<R>,
1556
- options?: StreamPipeOptions
1863
+ options?: StreamPipeOptions,
1557
1864
  ): Promise<void>;
1865
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee) */
1558
1866
  tee(): [ReadableStream<R>, ReadableStream<R>];
1559
1867
  values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
1560
1868
  [Symbol.asyncIterator](
1561
- options?: ReadableStreamValuesOptions
1869
+ options?: ReadableStreamValuesOptions,
1562
1870
  ): AsyncIterableIterator<R>;
1563
1871
  }
1564
1872
  declare const ReadableStream: {
1565
1873
  prototype: ReadableStream;
1566
1874
  new (
1567
1875
  underlyingSource: UnderlyingByteSource,
1568
- strategy?: QueuingStrategy<Uint8Array>
1876
+ strategy?: QueuingStrategy<Uint8Array>,
1569
1877
  ): ReadableStream<Uint8Array>;
1570
1878
  new <R = any>(
1571
1879
  underlyingSource?: UnderlyingSource<R>,
1572
- strategy?: QueuingStrategy<R>
1880
+ strategy?: QueuingStrategy<R>,
1573
1881
  ): ReadableStream<R>;
1574
1882
  };
1575
1883
  declare class ReadableStreamDefaultReader<R = any> {
1576
1884
  constructor(stream: ReadableStream);
1577
1885
  readonly closed: Promise<void>;
1578
1886
  cancel(reason?: any): Promise<void>;
1887
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read) */
1579
1888
  read(): Promise<ReadableStreamReadResult<R>>;
1889
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock) */
1580
1890
  releaseLock(): void;
1581
1891
  }
1582
1892
  declare class ReadableStreamBYOBReader {
1583
1893
  constructor(stream: ReadableStream);
1584
1894
  readonly closed: Promise<void>;
1585
1895
  cancel(reason?: any): Promise<void>;
1896
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) */
1586
1897
  read<T extends ArrayBufferView>(
1587
- view: T
1898
+ view: T,
1588
1899
  ): Promise<ReadableStreamReadResult<T>>;
1900
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) */
1589
1901
  releaseLock(): void;
1590
1902
  readAtLeast<T extends ArrayBufferView>(
1591
1903
  minElements: number,
1592
- view: T
1904
+ view: T,
1593
1905
  ): Promise<ReadableStreamReadResult<T>>;
1594
1906
  }
1595
1907
  declare interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
1596
1908
  min?: number;
1597
1909
  }
1598
1910
  declare interface ReadableStreamGetReaderOptions {
1911
+ /**
1912
+ * Creates a ReadableStreamBYOBReader and locks the stream to the new reader.
1913
+ *
1914
+ * 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.
1915
+ */
1599
1916
  mode: "byob";
1600
1917
  }
1918
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest) */
1601
1919
  declare interface ReadableStreamBYOBRequest {
1920
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view) */
1602
1921
  readonly view: Uint8Array | null;
1922
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond) */
1603
1923
  respond(bytesWritten: number): void;
1924
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView) */
1604
1925
  respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;
1605
1926
  readonly atLeast: number | null;
1606
1927
  }
1928
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController) */
1607
1929
  declare interface ReadableStreamDefaultController<R = any> {
1930
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize) */
1608
1931
  readonly desiredSize: number | null;
1932
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close) */
1609
1933
  close(): void;
1934
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue) */
1610
1935
  enqueue(chunk?: R): void;
1936
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error) */
1611
1937
  error(reason: any): void;
1612
1938
  }
1939
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController) */
1613
1940
  declare interface ReadableByteStreamController {
1941
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest) */
1614
1942
  readonly byobRequest: ReadableStreamBYOBRequest | null;
1943
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize) */
1615
1944
  readonly desiredSize: number | null;
1945
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close) */
1616
1946
  close(): void;
1947
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue) */
1617
1948
  enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
1949
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error) */
1618
1950
  error(reason: any): void;
1619
1951
  }
1620
- /** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */
1952
+ /**
1953
+ * This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate.
1954
+ *
1955
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)
1956
+ */
1621
1957
  declare interface WritableStreamDefaultController {
1958
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal) */
1622
1959
  readonly signal: AbortSignal;
1960
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error) */
1623
1961
  error(reason?: any): void;
1624
1962
  }
1963
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController) */
1625
1964
  declare interface TransformStreamDefaultController<O = any> {
1965
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize) */
1626
1966
  get desiredSize(): number | null;
1967
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue) */
1627
1968
  enqueue(chunk?: O): void;
1969
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error) */
1628
1970
  error(reason: any): void;
1971
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate) */
1629
1972
  terminate(): void;
1630
1973
  }
1631
1974
  declare interface ReadableWritablePair<R = any, W = any> {
@@ -1640,36 +1983,49 @@ declare interface ReadableWritablePair<R = any, W = any> {
1640
1983
  declare class WritableStream<W = any> {
1641
1984
  constructor(
1642
1985
  underlyingSink?: UnderlyingSink,
1643
- queuingStrategy?: QueuingStrategy
1986
+ queuingStrategy?: QueuingStrategy,
1644
1987
  );
1988
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked) */
1645
1989
  readonly locked: boolean;
1990
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort) */
1646
1991
  abort(reason?: any): Promise<void>;
1992
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close) */
1647
1993
  close(): Promise<void>;
1994
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter) */
1648
1995
  getWriter(): WritableStreamDefaultWriter<W>;
1649
1996
  }
1650
1997
  declare class WritableStreamDefaultWriter<W = any> {
1651
1998
  constructor(stream: WritableStream);
1999
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed) */
1652
2000
  readonly closed: Promise<void>;
2001
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready) */
1653
2002
  readonly ready: Promise<void>;
2003
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize) */
1654
2004
  readonly desiredSize: number | null;
2005
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort) */
1655
2006
  abort(reason?: any): Promise<void>;
2007
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close) */
1656
2008
  close(): Promise<void>;
2009
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write) */
1657
2010
  write(chunk?: W): Promise<void>;
2011
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock) */
1658
2012
  releaseLock(): void;
1659
2013
  }
1660
2014
  declare class TransformStream<I = any, O = any> {
1661
2015
  constructor(
1662
2016
  transformer?: Transformer<I, O>,
1663
2017
  writableStrategy?: QueuingStrategy<I>,
1664
- readableStrategy?: QueuingStrategy<O>
2018
+ readableStrategy?: QueuingStrategy<O>,
1665
2019
  );
2020
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable) */
1666
2021
  readonly readable: ReadableStream<O>;
2022
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable) */
1667
2023
  readonly writable: WritableStream<I>;
1668
2024
  }
1669
2025
  declare class FixedLengthStream extends IdentityTransformStream {
1670
2026
  constructor(
1671
2027
  expectedLength: number | bigint,
1672
- queuingStrategy?: IdentityTransformStreamQueuingStrategy
2028
+ queuingStrategy?: IdentityTransformStreamQueuingStrategy,
1673
2029
  );
1674
2030
  }
1675
2031
  declare class IdentityTransformStream extends TransformStream<
@@ -1712,12 +2068,16 @@ declare class ByteLengthQueuingStrategy
1712
2068
  implements QueuingStrategy<ArrayBufferView>
1713
2069
  {
1714
2070
  constructor(init: QueuingStrategyInit);
2071
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark) */
1715
2072
  get highWaterMark(): number;
2073
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */
1716
2074
  get size(): (chunk?: any) => number;
1717
2075
  }
1718
2076
  declare class CountQueuingStrategy implements QueuingStrategy {
1719
2077
  constructor(init: QueuingStrategyInit);
2078
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark) */
1720
2079
  get highWaterMark(): number;
2080
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */
1721
2081
  get size(): (chunk?: any) => number;
1722
2082
  }
1723
2083
  declare interface QueuingStrategyInit {
@@ -1741,6 +2101,7 @@ declare interface TraceItem {
1741
2101
  readonly event:
1742
2102
  | (
1743
2103
  | TraceItemFetchEventInfo
2104
+ | TraceItemJsRpcEventInfo
1744
2105
  | TraceItemScheduledEventInfo
1745
2106
  | TraceItemAlarmEventInfo
1746
2107
  | TraceItemQueueEventInfo
@@ -1755,6 +2116,7 @@ declare interface TraceItem {
1755
2116
  readonly exceptions: TraceException[];
1756
2117
  readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
1757
2118
  readonly scriptName: string | null;
2119
+ readonly entrypoint?: string;
1758
2120
  readonly scriptVersion?: ScriptVersion;
1759
2121
  readonly dispatchNamespace?: string;
1760
2122
  readonly scriptTags?: string[];
@@ -1797,6 +2159,9 @@ declare interface TraceItemFetchEventInfoRequest {
1797
2159
  declare interface TraceItemFetchEventInfoResponse {
1798
2160
  readonly status: number;
1799
2161
  }
2162
+ declare interface TraceItemJsRpcEventInfo {
2163
+ readonly rpcMethod: string;
2164
+ }
1800
2165
  declare interface TraceItemHibernatableWebSocketEventInfo {
1801
2166
  readonly getWebSocketEvent:
1802
2167
  | TraceItemHibernatableWebSocketEventInfoMessage
@@ -1823,6 +2188,7 @@ declare interface TraceException {
1823
2188
  readonly timestamp: number;
1824
2189
  readonly message: string;
1825
2190
  readonly name: string;
2191
+ readonly stack?: string;
1826
2192
  }
1827
2193
  declare interface TraceDiagnosticChannelEvent {
1828
2194
  readonly timestamp: number;
@@ -1838,19 +2204,32 @@ declare interface UnsafeTraceMetrics {
1838
2204
  }
1839
2205
  declare class URL {
1840
2206
  constructor(url: string | URL, base?: string | URL);
2207
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) */
1841
2208
  href: string;
2209
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin) */
1842
2210
  readonly origin: string;
2211
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) */
1843
2212
  protocol: string;
2213
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */
1844
2214
  username: string;
2215
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */
1845
2216
  password: string;
2217
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */
1846
2218
  host: string;
2219
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */
1847
2220
  hostname: string;
2221
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */
1848
2222
  port: string;
2223
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */
1849
2224
  pathname: string;
2225
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */
1850
2226
  search: string;
2227
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams) */
1851
2228
  readonly searchParams: URLSearchParams;
2229
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */
1852
2230
  hash: string;
1853
2231
  toString(): string;
2232
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON) */
1854
2233
  toJSON(): string;
1855
2234
  }
1856
2235
  declare class URLSearchParams {
@@ -1859,7 +2238,7 @@ declare class URLSearchParams {
1859
2238
  | URLSearchParams
1860
2239
  | string
1861
2240
  | Record<string, string>
1862
- | [key: string, value: string][]
2241
+ | [key: string, value: string][],
1863
2242
  );
1864
2243
  get size(): number;
1865
2244
  append(name: string, value: string): void;
@@ -1869,17 +2248,20 @@ declare class URLSearchParams {
1869
2248
  has(name: string): boolean;
1870
2249
  set(name: string, value: string): void;
1871
2250
  sort(): void;
2251
+ /** Returns an array of key, value pairs for every entry in the search params. */
1872
2252
  entries(): IterableIterator<[key: string, value: string]>;
2253
+ /** Returns a list of keys in the search params. */
1873
2254
  keys(): IterableIterator<string>;
2255
+ /** Returns a list of values in the search params. */
1874
2256
  values(): IterableIterator<string>;
1875
2257
  forEach<This = unknown>(
1876
2258
  callback: (
1877
2259
  this: This,
1878
2260
  value: string,
1879
2261
  key: string,
1880
- parent: URLSearchParams
2262
+ parent: URLSearchParams,
1881
2263
  ) => void,
1882
- thisArg?: This
2264
+ thisArg?: This,
1883
2265
  ): void;
1884
2266
  toString(): string;
1885
2267
  [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
@@ -1888,7 +2270,7 @@ declare class URLPattern {
1888
2270
  constructor(
1889
2271
  input?: string | URLPatternURLPatternInit,
1890
2272
  baseURL?: string,
1891
- patternOptions?: URLPatternURLPatternOptions
2273
+ patternOptions?: URLPatternURLPatternOptions,
1892
2274
  );
1893
2275
  get protocol(): string;
1894
2276
  get username(): string;
@@ -1901,7 +2283,7 @@ declare class URLPattern {
1901
2283
  test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean;
1902
2284
  exec(
1903
2285
  input?: string | URLPatternURLPatternInit,
1904
- baseURL?: string
2286
+ baseURL?: string,
1905
2287
  ): URLPatternURLPatternResult | null;
1906
2288
  }
1907
2289
  declare interface URLPatternURLPatternInit {
@@ -1935,11 +2317,23 @@ declare interface URLPatternURLPatternOptions {
1935
2317
  }
1936
2318
  declare class CloseEvent extends Event {
1937
2319
  constructor(type: string, initializer?: CloseEventInit);
1938
- /** Returns the WebSocket connection close code provided by the server. */
2320
+ /**
2321
+ * Returns the WebSocket connection close code provided by the server.
2322
+ *
2323
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)
2324
+ */
1939
2325
  readonly code: number;
1940
- /** Returns the WebSocket connection close reason provided by the server. */
2326
+ /**
2327
+ * Returns the WebSocket connection close reason provided by the server.
2328
+ *
2329
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)
2330
+ */
1941
2331
  readonly reason: string;
1942
- /** Returns true if the connection closed cleanly; false otherwise. */
2332
+ /**
2333
+ * Returns true if the connection closed cleanly; false otherwise.
2334
+ *
2335
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)
2336
+ */
1943
2337
  readonly wasClean: boolean;
1944
2338
  }
1945
2339
  declare interface CloseEventInit {
@@ -1954,12 +2348,21 @@ declare class MessageEvent extends Event {
1954
2348
  declare interface MessageEventInit {
1955
2349
  data: ArrayBuffer | string;
1956
2350
  }
1957
- /** Events providing information related to errors in scripts or in files. */
2351
+ /**
2352
+ * Events providing information related to errors in scripts or in files.
2353
+ *
2354
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)
2355
+ */
1958
2356
  declare interface ErrorEvent extends Event {
2357
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename) */
1959
2358
  readonly filename: string;
2359
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message) */
1960
2360
  readonly message: string;
2361
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno) */
1961
2362
  readonly lineno: number;
2363
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno) */
1962
2364
  readonly colno: number;
2365
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error) */
1963
2366
  readonly error: any;
1964
2367
  }
1965
2368
  declare type WebSocketEventMap = {
@@ -1971,7 +2374,17 @@ declare type WebSocketEventMap = {
1971
2374
  declare class WebSocket extends EventTarget<WebSocketEventMap> {
1972
2375
  constructor(url: string, protocols?: string[] | string);
1973
2376
  accept(): void;
2377
+ /**
2378
+ * Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
2379
+ *
2380
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
2381
+ */
1974
2382
  send(message: (ArrayBuffer | ArrayBufferView) | string): void;
2383
+ /**
2384
+ * Closes the WebSocket connection, optionally using code as the the WebSocket connection close code and reason as the the WebSocket connection close reason.
2385
+ *
2386
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)
2387
+ */
1975
2388
  close(code?: number, reason?: string): void;
1976
2389
  serializeAttachment(attachment: any): void;
1977
2390
  deserializeAttachment(): any | null;
@@ -1983,13 +2396,29 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
1983
2396
  static readonly CLOSING: number;
1984
2397
  static readonly READY_STATE_CLOSED: number;
1985
2398
  static readonly CLOSED: number;
1986
- /** Returns the state of the WebSocket object's connection. It can have the values described below. */
2399
+ /**
2400
+ * Returns the state of the WebSocket object's connection. It can have the values described below.
2401
+ *
2402
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)
2403
+ */
1987
2404
  readonly readyState: number;
1988
- /** Returns the URL that was used to establish the WebSocket connection. */
2405
+ /**
2406
+ * Returns the URL that was used to establish the WebSocket connection.
2407
+ *
2408
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)
2409
+ */
1989
2410
  readonly url: string | null;
1990
- /** 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. */
2411
+ /**
2412
+ * 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.
2413
+ *
2414
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)
2415
+ */
1991
2416
  readonly protocol: string | null;
1992
- /** Returns the extensions selected by the server, if any. */
2417
+ /**
2418
+ * Returns the extensions selected by the server, if any.
2419
+ *
2420
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
2421
+ */
1993
2422
  readonly extensions: string | null;
1994
2423
  }
1995
2424
  declare const WebSocketPair: {
@@ -2030,24 +2459,24 @@ declare abstract class gpuGPUAdapter {
2030
2459
  declare interface gpuGPUDevice extends EventTarget {
2031
2460
  createBuffer(param1: gpuGPUBufferDescriptor): gpuGPUBuffer;
2032
2461
  createBindGroupLayout(
2033
- descriptor: gpuGPUBindGroupLayoutDescriptor
2462
+ descriptor: gpuGPUBindGroupLayoutDescriptor,
2034
2463
  ): gpuGPUBindGroupLayout;
2035
2464
  createBindGroup(descriptor: gpuGPUBindGroupDescriptor): gpuGPUBindGroup;
2036
2465
  createSampler(descriptor: gpuGPUSamplerDescriptor): gpuGPUSampler;
2037
2466
  createShaderModule(
2038
- descriptor: gpuGPUShaderModuleDescriptor
2467
+ descriptor: gpuGPUShaderModuleDescriptor,
2039
2468
  ): gpuGPUShaderModule;
2040
2469
  createPipelineLayout(
2041
- descriptor: gpuGPUPipelineLayoutDescriptor
2470
+ descriptor: gpuGPUPipelineLayoutDescriptor,
2042
2471
  ): gpuGPUPipelineLayout;
2043
2472
  createComputePipeline(
2044
- descriptor: gpuGPUComputePipelineDescriptor
2473
+ descriptor: gpuGPUComputePipelineDescriptor,
2045
2474
  ): gpuGPUComputePipeline;
2046
2475
  createRenderPipeline(
2047
- descriptor: gpuGPURenderPipelineDescriptor
2476
+ descriptor: gpuGPURenderPipelineDescriptor,
2048
2477
  ): gpuGPURenderPipeline;
2049
2478
  createCommandEncoder(
2050
- descriptor?: gpuGPUCommandEncoderDescriptor
2479
+ descriptor?: gpuGPUCommandEncoderDescriptor,
2051
2480
  ): gpuGPUCommandEncoder;
2052
2481
  createTexture(param1: gpuGPUTextureDescriptor): gpuGPUTexture;
2053
2482
  destroy(): void;
@@ -2093,7 +2522,7 @@ declare interface gpuGPUBuffer {
2093
2522
  mapAsync(
2094
2523
  offset: number,
2095
2524
  size?: number | bigint,
2096
- param3?: number | bigint
2525
+ param3?: number | bigint,
2097
2526
  ): Promise<void>;
2098
2527
  get size(): number | bigint;
2099
2528
  get usage(): number;
@@ -2192,38 +2621,38 @@ declare interface gpuGPUProgrammableStage {
2192
2621
  declare interface gpuGPUCommandEncoder {
2193
2622
  get label(): string;
2194
2623
  beginComputePass(
2195
- descriptor?: gpuGPUComputePassDescriptor
2624
+ descriptor?: gpuGPUComputePassDescriptor,
2196
2625
  ): gpuGPUComputePassEncoder;
2197
2626
  beginRenderPass(
2198
- descriptor: gpuGPURenderPassDescriptor
2627
+ descriptor: gpuGPURenderPassDescriptor,
2199
2628
  ): gpuGPURenderPassEncoder;
2200
2629
  copyBufferToBuffer(
2201
2630
  source: gpuGPUBuffer,
2202
2631
  sourceOffset: number | bigint,
2203
2632
  destination: gpuGPUBuffer,
2204
2633
  destinationOffset: number | bigint,
2205
- size: number | bigint
2634
+ size: number | bigint,
2206
2635
  ): void;
2207
2636
  finish(param0?: gpuGPUCommandBufferDescriptor): gpuGPUCommandBuffer;
2208
2637
  copyTextureToBuffer(
2209
2638
  source: gpuGPUImageCopyTexture,
2210
2639
  destination: gpuGPUImageCopyBuffer,
2211
- copySize: Iterable<number> | gpuGPUExtent3DDict
2640
+ copySize: Iterable<number> | gpuGPUExtent3DDict,
2212
2641
  ): void;
2213
2642
  copyBufferToTexture(
2214
2643
  source: gpuGPUImageCopyBuffer,
2215
2644
  destination: gpuGPUImageCopyTexture,
2216
- copySize: Iterable<number> | gpuGPUExtent3DDict
2645
+ copySize: Iterable<number> | gpuGPUExtent3DDict,
2217
2646
  ): void;
2218
2647
  copyTextureToTexture(
2219
2648
  source: gpuGPUImageCopyTexture,
2220
2649
  destination: gpuGPUImageCopyTexture,
2221
- copySize: Iterable<number> | gpuGPUExtent3DDict
2650
+ copySize: Iterable<number> | gpuGPUExtent3DDict,
2222
2651
  ): void;
2223
2652
  clearBuffer(
2224
2653
  buffer: gpuGPUBuffer,
2225
2654
  offset?: number | bigint,
2226
- size?: number | bigint
2655
+ size?: number | bigint,
2227
2656
  ): void;
2228
2657
  }
2229
2658
  declare interface gpuGPUCommandEncoderDescriptor {
@@ -2234,12 +2663,12 @@ declare interface gpuGPUComputePassEncoder {
2234
2663
  setBindGroup(
2235
2664
  index: number,
2236
2665
  bindGroup: gpuGPUBindGroup | null,
2237
- dynamicOffsets?: Iterable<number>
2666
+ dynamicOffsets?: Iterable<number>,
2238
2667
  ): void;
2239
2668
  dispatchWorkgroups(
2240
2669
  workgroupCountX: number,
2241
2670
  workgroupCountY?: number,
2242
- workgroupCountZ?: number
2671
+ workgroupCountZ?: number,
2243
2672
  ): void;
2244
2673
  end(): void;
2245
2674
  }
@@ -2267,7 +2696,7 @@ declare interface gpuGPUQueue {
2267
2696
  bufferOffset: number | bigint,
2268
2697
  data: ArrayBuffer | ArrayBufferView,
2269
2698
  dataOffset?: number | bigint,
2270
- size?: number | bigint
2699
+ size?: number | bigint,
2271
2700
  ): void;
2272
2701
  }
2273
2702
  declare abstract class gpuGPUMapMode {
@@ -2471,7 +2900,7 @@ declare interface gpuGPURenderPassEncoder {
2471
2900
  vertexCount: number,
2472
2901
  instanceCount?: number,
2473
2902
  firstVertex?: number,
2474
- firstInstance?: number
2903
+ firstInstance?: number,
2475
2904
  ): void;
2476
2905
  end(): void;
2477
2906
  }
@@ -2969,7 +3398,7 @@ declare interface IncomingRequestCfPropertiesBotManagementEnterprise
2969
3398
  };
2970
3399
  }
2971
3400
  declare interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<
2972
- HostMetadata
3401
+ HostMetadata,
2973
3402
  > {
2974
3403
  /**
2975
3404
  * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/).
@@ -3539,6 +3968,13 @@ declare abstract class D1PreparedStatement {
3539
3968
  }): Promise<[string[], ...T[]]>;
3540
3969
  raw<T = unknown[]>(options?: { columnNames?: false }): Promise<T[]>;
3541
3970
  }
3971
+ // `Disposable` was added to TypeScript's standard lib types in version 5.2.
3972
+ // To support older TypeScript versions, define an empty `Disposable` interface.
3973
+ // Users won't be able to use `using`/`Symbol.dispose` without upgrading to 5.2,
3974
+ // but this will ensure type checking on older versions still passes.
3975
+ // TypeScript's interface merging will ensure our empty interface is effectively
3976
+ // ignored when `Disposable` is included in the standard lib.
3977
+ declare interface Disposable {}
3542
3978
  /**
3543
3979
  * An email message that can be sent from a Worker.
3544
3980
  */
@@ -3594,7 +4030,7 @@ declare abstract class EmailEvent extends ExtendableEvent {
3594
4030
  declare type EmailExportedHandler<Env = unknown> = (
3595
4031
  message: ForwardableEmailMessage,
3596
4032
  env: Env,
3597
- ctx: ExecutionContext
4033
+ ctx: ExecutionContext,
3598
4034
  ) => void | Promise<void>;
3599
4035
  declare module "cloudflare:email" {
3600
4036
  let _EmailMessage: {
@@ -3668,7 +4104,7 @@ declare type EventContext<Env, P extends string, Data> = {
3668
4104
  declare type PagesFunction<
3669
4105
  Env = unknown,
3670
4106
  Params extends string = any,
3671
- Data extends Record<string, unknown> = Record<string, unknown>
4107
+ Data extends Record<string, unknown> = Record<string, unknown>,
3672
4108
  > = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
3673
4109
  declare type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
3674
4110
  request: Request<unknown, IncomingRequestCfProperties<unknown>>;
@@ -3689,9 +4125,9 @@ declare type PagesPluginFunction<
3689
4125
  Env = unknown,
3690
4126
  Params extends string = any,
3691
4127
  Data extends Record<string, unknown> = Record<string, unknown>,
3692
- PluginArgs = unknown
4128
+ PluginArgs = unknown,
3693
4129
  > = (
3694
- context: EventPluginContext<Env, Params, Data, PluginArgs>
4130
+ context: EventPluginContext<Env, Params, Data, PluginArgs>,
3695
4131
  ) => Response | Promise<Response>;
3696
4132
  declare module "assets:*" {
3697
4133
  export const onRequest: PagesFunction;
@@ -3730,10 +4166,204 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
3730
4166
  // Key Identifier of the JWK
3731
4167
  readonly kid: string;
3732
4168
  }
4169
+ // Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need
4170
+ // to referenced by `Fetcher`. This is included in the "importable" version of the types which
4171
+ // strips all `module` blocks.
4172
+ declare namespace Rpc {
4173
+ // Branded types for identifying `WorkerEntrypoint`/`DurableObject`/`Target`s.
4174
+ // TypeScript uses *structural* typing meaning anything with the same shape as type `T` is a `T`.
4175
+ // For the classes exported by `cloudflare:workers` we want *nominal* typing (i.e. we only want to
4176
+ // accept `WorkerEntrypoint` from `cloudflare:workers`, not any other class with the same shape)
4177
+ export const __RPC_STUB_BRAND: unique symbol;
4178
+ export const __RPC_TARGET_BRAND: unique symbol;
4179
+ export const __WORKER_ENTRYPOINT_BRAND: unique symbol;
4180
+ export const __DURABLE_OBJECT_BRAND: unique symbol;
4181
+ export interface RpcTargetBranded {
4182
+ [__RPC_TARGET_BRAND]: never;
4183
+ }
4184
+ export interface WorkerEntrypointBranded {
4185
+ [__WORKER_ENTRYPOINT_BRAND]: never;
4186
+ }
4187
+ export interface DurableObjectBranded {
4188
+ [__DURABLE_OBJECT_BRAND]: never;
4189
+ }
4190
+ export type EntrypointBranded =
4191
+ | WorkerEntrypointBranded
4192
+ | DurableObjectBranded;
4193
+ // Types that can be used through `Stub`s
4194
+ export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
4195
+ // Types that can be passed over RPC
4196
+ type Serializable =
4197
+ // Structured cloneables
4198
+ | void
4199
+ | undefined
4200
+ | null
4201
+ | boolean
4202
+ | number
4203
+ | bigint
4204
+ | string
4205
+ | TypedArray
4206
+ | ArrayBuffer
4207
+ | DataView
4208
+ | Date
4209
+ | Error
4210
+ | RegExp
4211
+ // Structured cloneable composites
4212
+ | Map<Serializable, Serializable>
4213
+ | Set<Serializable>
4214
+ | ReadonlyArray<Serializable>
4215
+ | {
4216
+ [key: string | number]: Serializable;
4217
+ }
4218
+ // Special types
4219
+ | ReadableStream<Uint8Array>
4220
+ | WritableStream<Uint8Array>
4221
+ | Request
4222
+ | Response
4223
+ | Headers
4224
+ | Stub<Stubable>
4225
+ // Serialized as stubs, see `Stubify`
4226
+ | Stubable;
4227
+ // Base type for all RPC stubs, including common memory management methods.
4228
+ // `T` is used as a marker type for unwrapping `Stub`s later.
4229
+ interface StubBase<T extends Stubable> extends Disposable {
4230
+ [__RPC_STUB_BRAND]: T;
4231
+ dup(): this;
4232
+ }
4233
+ export type Stub<T extends Stubable> = Provider<T> & StubBase<T>;
4234
+ // Recursively rewrite all `Stubable` types with `Stub`s
4235
+ type Stubify<T> = T extends Stubable
4236
+ ? Stub<T>
4237
+ : T extends Map<infer K, infer V>
4238
+ ? Map<Stubify<K>, Stubify<V>>
4239
+ : T extends Set<infer V>
4240
+ ? Set<Stubify<V>>
4241
+ : T extends Array<infer V>
4242
+ ? Array<Stubify<V>>
4243
+ : T extends ReadonlyArray<infer V>
4244
+ ? ReadonlyArray<Stubify<V>>
4245
+ : T extends {
4246
+ [key: string | number]: unknown;
4247
+ }
4248
+ ? {
4249
+ [K in keyof T]: Stubify<T[K]>;
4250
+ }
4251
+ : T;
4252
+ // Recursively rewrite all `Stub<T>`s with the corresponding `T`s.
4253
+ // Note we use `StubBase` instead of `Stub` here to avoid circular dependencies:
4254
+ // `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`.
4255
+ type Unstubify<T> =
4256
+ T extends StubBase<infer V>
4257
+ ? V
4258
+ : T extends Map<infer K, infer V>
4259
+ ? Map<Unstubify<K>, Unstubify<V>>
4260
+ : T extends Set<infer V>
4261
+ ? Set<Unstubify<V>>
4262
+ : T extends Array<infer V>
4263
+ ? Array<Unstubify<V>>
4264
+ : T extends ReadonlyArray<infer V>
4265
+ ? ReadonlyArray<Unstubify<V>>
4266
+ : T extends {
4267
+ [key: string | number]: unknown;
4268
+ }
4269
+ ? {
4270
+ [K in keyof T]: Unstubify<T[K]>;
4271
+ }
4272
+ : T;
4273
+ type UnstubifyAll<A extends any[]> = {
4274
+ [I in keyof A]: Unstubify<A[I]>;
4275
+ };
4276
+ // Utility type for adding `Provider`/`Disposable`s to `object` types only.
4277
+ // Note `unknown & T` is equivalent to `T`.
4278
+ type MaybeProvider<T> = T extends object ? Provider<T> : unknown;
4279
+ type MaybeDisposable<T> = T extends object ? Disposable : unknown;
4280
+ // Type for method return or property on an RPC interface.
4281
+ // - Stubable types are replaced by stubs.
4282
+ // - Serializable types are passed by value, with stubable types replaced by stubs
4283
+ // and a top-level `Disposer`.
4284
+ // Everything else can't be passed over PRC.
4285
+ // Technically, we use custom thenables here, but they quack like `Promise`s.
4286
+ // Intersecting with `(Maybe)Provider` allows pipelining.
4287
+ type Result<R> = R extends Stubable
4288
+ ? Promise<Stub<R>> & Provider<R>
4289
+ : R extends Serializable
4290
+ ? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R>
4291
+ : never;
4292
+ // Type for method or property on an RPC interface.
4293
+ // For methods, unwrap `Stub`s in parameters, and rewrite returns to be `Result`s.
4294
+ // Unwrapping `Stub`s allows calling with `Stubable` arguments.
4295
+ // For properties, rewrite types to be `Result`s.
4296
+ // In each case, unwrap `Promise`s.
4297
+ type MethodOrProperty<V> = V extends (...args: infer P) => infer R
4298
+ ? (...args: UnstubifyAll<P>) => Result<Awaited<R>>
4299
+ : Result<Awaited<V>>;
4300
+ // Type for the callable part of an `Provider` if `T` is callable.
4301
+ // This is intersected with methods/properties.
4302
+ type MaybeCallableProvider<T> = T extends (...args: any[]) => any
4303
+ ? MethodOrProperty<T>
4304
+ : unknown;
4305
+ // Base type for all other types providing RPC-like interfaces.
4306
+ // Rewrites all methods/properties to be `MethodOrProperty`s, while preserving callable types.
4307
+ // `Reserved` names (e.g. stub method names like `dup()`) and symbols can't be accessed over RPC.
4308
+ export type Provider<
4309
+ T extends object,
4310
+ Reserved extends string = never,
4311
+ > = MaybeCallableProvider<T> & {
4312
+ [K in Exclude<
4313
+ keyof T,
4314
+ Reserved | symbol | keyof StubBase<never>
4315
+ >]: MethodOrProperty<T[K]>;
4316
+ };
4317
+ }
4318
+ declare module "cloudflare:workers" {
4319
+ export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;
4320
+ export const RpcStub: {
4321
+ new <T extends Rpc.Stubable>(value: T): Rpc.Stub<T>;
4322
+ };
4323
+ export abstract class RpcTarget implements Rpc.RpcTargetBranded {
4324
+ [Rpc.__RPC_TARGET_BRAND]: never;
4325
+ }
4326
+ // `protected` fields don't appear in `keyof`s, so can't be accessed over RPC
4327
+ export abstract class WorkerEntrypoint<Env = unknown>
4328
+ implements Rpc.WorkerEntrypointBranded
4329
+ {
4330
+ [Rpc.__WORKER_ENTRYPOINT_BRAND]: never;
4331
+ protected ctx: ExecutionContext;
4332
+ protected env: Env;
4333
+ constructor(ctx: ExecutionContext, env: Env);
4334
+ fetch?(request: Request): Response | Promise<Response>;
4335
+ tail?(events: TraceItem[]): void | Promise<void>;
4336
+ trace?(traces: TraceItem[]): void | Promise<void>;
4337
+ scheduled?(controller: ScheduledController): void | Promise<void>;
4338
+ queue?(batch: MessageBatch<unknown>): void | Promise<void>;
4339
+ test?(controller: TestController): void | Promise<void>;
4340
+ }
4341
+ export abstract class DurableObject<Env = unknown>
4342
+ implements Rpc.DurableObjectBranded
4343
+ {
4344
+ [Rpc.__DURABLE_OBJECT_BRAND]: never;
4345
+ protected ctx: DurableObjectState;
4346
+ protected env: Env;
4347
+ constructor(ctx: DurableObjectState, env: Env);
4348
+ fetch?(request: Request): Response | Promise<Response>;
4349
+ alarm?(): void | Promise<void>;
4350
+ webSocketMessage?(
4351
+ ws: WebSocket,
4352
+ message: string | ArrayBuffer,
4353
+ ): void | Promise<void>;
4354
+ webSocketClose?(
4355
+ ws: WebSocket,
4356
+ code: number,
4357
+ reason: string,
4358
+ wasClean: boolean,
4359
+ ): void | Promise<void>;
4360
+ webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
4361
+ }
4362
+ }
3733
4363
  declare module "cloudflare:sockets" {
3734
4364
  function _connect(
3735
4365
  address: string | SocketAddress,
3736
- options?: SocketOptions
4366
+ options?: SocketOptions,
3737
4367
  ): Socket;
3738
4368
  export { _connect as connect };
3739
4369
  }
@@ -3869,7 +4499,7 @@ declare abstract class VectorizeIndex {
3869
4499
  */
3870
4500
  public query(
3871
4501
  vector: VectorFloatArray | number[],
3872
- options: VectorizeQueryOptions
4502
+ options: VectorizeQueryOptions,
3873
4503
  ): Promise<VectorizeMatches>;
3874
4504
  /**
3875
4505
  * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
@@ -3896,6 +4526,16 @@ declare abstract class VectorizeIndex {
3896
4526
  */
3897
4527
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
3898
4528
  }
4529
+ /**
4530
+ * The interface for "version_metadata" binding
4531
+ * providing metadata about the Worker Version using this binding.
4532
+ */
4533
+ declare type WorkerVersionMetadata = {
4534
+ /** The ID of the Worker Version using this binding */
4535
+ id: string;
4536
+ /** The tag of the Worker Version using this binding */
4537
+ tag: string;
4538
+ };
3899
4539
  declare interface DynamicDispatchLimits {
3900
4540
  /**
3901
4541
  * Limit CPU time in milliseconds.
@@ -3931,6 +4571,6 @@ declare interface DispatchNamespace {
3931
4571
  args?: {
3932
4572
  [key: string]: any;
3933
4573
  },
3934
- options?: DynamicDispatchOptions
4574
+ options?: DynamicDispatchOptions,
3935
4575
  ): Fetcher;
3936
4576
  }