@cloudflare/workers-types 4.20240320.1 → 4.20240402.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,8 +16,15 @@ and limitations under the License.
16
16
  // noinspection JSUnusedGlobalSymbols
17
17
  declare class DOMException extends Error {
18
18
  constructor(message?: string, name?: string);
19
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */
19
20
  readonly message: string;
21
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */
20
22
  readonly name: string;
23
+ /**
24
+ * @deprecated
25
+ *
26
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
27
+ */
21
28
  readonly code: number;
22
29
  readonly stack: any;
23
30
  static readonly INDEX_SIZE_ERR: number;
@@ -56,30 +63,61 @@ declare type WorkerGlobalScopeEventMap = {
56
63
  declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {
57
64
  EventTarget: typeof EventTarget;
58
65
  }
66
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console) */
59
67
  declare interface Console {
60
68
  "assert"(condition?: boolean, ...data: any[]): void;
69
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static) */
61
70
  clear(): void;
71
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static) */
62
72
  count(label?: string): void;
73
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static) */
63
74
  countReset(label?: string): void;
75
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static) */
64
76
  debug(...data: any[]): void;
77
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static) */
65
78
  dir(item?: any, options?: any): void;
79
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static) */
66
80
  dirxml(...data: any[]): void;
81
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static) */
67
82
  error(...data: any[]): void;
83
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static) */
68
84
  group(...data: any[]): void;
85
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static) */
69
86
  groupCollapsed(...data: any[]): void;
87
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static) */
70
88
  groupEnd(): void;
89
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static) */
71
90
  info(...data: any[]): void;
91
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static) */
72
92
  log(...data: any[]): void;
93
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static) */
73
94
  table(tabularData?: any, properties?: string[]): void;
95
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static) */
74
96
  time(label?: string): void;
97
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static) */
75
98
  timeEnd(label?: string): void;
99
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static) */
76
100
  timeLog(label?: string, ...data: any[]): void;
77
101
  timeStamp(label?: string): void;
102
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static) */
78
103
  trace(...data: any[]): void;
104
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static) */
79
105
  warn(...data: any[]): void;
80
106
  }
81
107
  declare const console: Console;
82
108
  declare type BufferSource = ArrayBufferView | ArrayBuffer;
109
+ declare type TypedArray =
110
+ | Int8Array
111
+ | Uint8Array
112
+ | Uint8ClampedArray
113
+ | Int16Array
114
+ | Uint16Array
115
+ | Int32Array
116
+ | Uint32Array
117
+ | Float32Array
118
+ | Float64Array
119
+ | BigInt64Array
120
+ | BigUint64Array;
83
121
  declare namespace WebAssembly {
84
122
  class CompileError extends Error {
85
123
  constructor(message?: string);
@@ -154,7 +192,11 @@ declare namespace WebAssembly {
154
192
  function instantiate(module: Module, imports?: Imports): Promise<Instance>;
155
193
  function validate(bytes: BufferSource): boolean;
156
194
  }
157
- /** This ServiceWorker API interface represents the global execution context of a service worker. */
195
+ /**
196
+ * This ServiceWorker API interface represents the global execution context of a service worker.
197
+ *
198
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope)
199
+ */
158
200
  declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
159
201
  DOMException: typeof DOMException;
160
202
  WorkerGlobalScope: typeof WorkerGlobalScope;
@@ -178,7 +220,7 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
178
220
  structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
179
221
  fetch(
180
222
  input: RequestInfo,
181
- init?: RequestInit<RequestInitCfProperties>
223
+ init?: RequestInit<RequestInitCfProperties>,
182
224
  ): Promise<Response>;
183
225
  self: ServiceWorkerGlobalScope;
184
226
  crypto: Crypto;
@@ -253,49 +295,64 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
253
295
  declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
254
296
  type: Type,
255
297
  handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
256
- options?: EventTargetAddEventListenerOptions | boolean
298
+ options?: EventTargetAddEventListenerOptions | boolean,
257
299
  ): void;
258
300
  declare function removeEventListener<
259
- Type extends keyof WorkerGlobalScopeEventMap
301
+ Type extends keyof WorkerGlobalScopeEventMap,
260
302
  >(
261
303
  type: Type,
262
304
  handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
263
- options?: EventTargetEventListenerOptions | boolean
305
+ options?: EventTargetEventListenerOptions | boolean,
264
306
  ): void;
265
- /** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */
307
+ /**
308
+ * Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
309
+ *
310
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
311
+ */
266
312
  declare function dispatchEvent(
267
- event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]
313
+ event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap],
268
314
  ): boolean;
315
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/btoa) */
269
316
  declare function btoa(data: string): string;
317
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/atob) */
270
318
  declare function atob(data: string): string;
319
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
271
320
  declare function setTimeout(
272
321
  callback: (...args: any[]) => void,
273
- msDelay?: number
322
+ msDelay?: number,
274
323
  ): number;
324
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
275
325
  declare function setTimeout<Args extends any[]>(
276
326
  callback: (...args: Args) => void,
277
327
  msDelay?: number,
278
328
  ...args: Args
279
329
  ): number;
330
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearTimeout) */
280
331
  declare function clearTimeout(timeoutId: number | null): void;
332
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
281
333
  declare function setInterval(
282
334
  callback: (...args: any[]) => void,
283
- msDelay?: number
335
+ msDelay?: number,
284
336
  ): number;
337
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
285
338
  declare function setInterval<Args extends any[]>(
286
339
  callback: (...args: Args) => void,
287
340
  msDelay?: number,
288
341
  ...args: Args
289
342
  ): number;
343
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearInterval) */
290
344
  declare function clearInterval(timeoutId: number | null): void;
345
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/queueMicrotask) */
291
346
  declare function queueMicrotask(task: Function): void;
347
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/structuredClone) */
292
348
  declare function structuredClone<T>(
293
349
  value: T,
294
- options?: StructuredSerializeOptions
350
+ options?: StructuredSerializeOptions,
295
351
  ): T;
352
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
296
353
  declare function fetch(
297
354
  input: RequestInfo,
298
- init?: RequestInit<RequestInitCfProperties>
355
+ init?: RequestInit<RequestInitCfProperties>,
299
356
  ): Promise<Response>;
300
357
  declare const self: ServiceWorkerGlobalScope;
301
358
  declare const crypto: Crypto;
@@ -312,41 +369,41 @@ declare interface ExecutionContext {
312
369
  }
313
370
  declare type ExportedHandlerFetchHandler<
314
371
  Env = unknown,
315
- CfHostMetadata = unknown
372
+ CfHostMetadata = unknown,
316
373
  > = (
317
374
  request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
318
375
  env: Env,
319
- ctx: ExecutionContext
376
+ ctx: ExecutionContext,
320
377
  ) => Response | Promise<Response>;
321
378
  declare type ExportedHandlerTailHandler<Env = unknown> = (
322
379
  events: TraceItem[],
323
380
  env: Env,
324
- ctx: ExecutionContext
381
+ ctx: ExecutionContext,
325
382
  ) => void | Promise<void>;
326
383
  declare type ExportedHandlerTraceHandler<Env = unknown> = (
327
384
  traces: TraceItem[],
328
385
  env: Env,
329
- ctx: ExecutionContext
386
+ ctx: ExecutionContext,
330
387
  ) => void | Promise<void>;
331
388
  declare type ExportedHandlerScheduledHandler<Env = unknown> = (
332
389
  controller: ScheduledController,
333
390
  env: Env,
334
- ctx: ExecutionContext
391
+ ctx: ExecutionContext,
335
392
  ) => void | Promise<void>;
336
393
  declare type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
337
394
  batch: MessageBatch<Message>,
338
395
  env: Env,
339
- ctx: ExecutionContext
396
+ ctx: ExecutionContext,
340
397
  ) => void | Promise<void>;
341
398
  declare type ExportedHandlerTestHandler<Env = unknown> = (
342
399
  controller: TestController,
343
400
  env: Env,
344
- ctx: ExecutionContext
401
+ ctx: ExecutionContext,
345
402
  ) => void | Promise<void>;
346
403
  declare interface ExportedHandler<
347
404
  Env = unknown,
348
405
  QueueHandlerMessage = unknown,
349
- CfHostMetadata = unknown
406
+ CfHostMetadata = unknown,
350
407
  > {
351
408
  fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
352
409
  tail?: ExportedHandlerTailHandler<Env>;
@@ -360,7 +417,9 @@ declare interface StructuredSerializeOptions {
360
417
  transfer?: any[];
361
418
  }
362
419
  declare abstract class PromiseRejectionEvent extends Event {
420
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise) */
363
421
  readonly promise: Promise<any>;
422
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason) */
364
423
  readonly reason: any;
365
424
  }
366
425
  declare abstract class Navigator {
@@ -372,14 +431,20 @@ declare abstract class Navigator {
372
431
  | (ArrayBuffer | ArrayBufferView)
373
432
  | Blob
374
433
  | URLSearchParams
375
- | FormData
434
+ | FormData,
376
435
  ): boolean;
377
436
  readonly userAgent: string;
378
437
  readonly gpu: gpuGPU;
379
438
  }
380
- /** 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. */
439
+ /**
440
+ * 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.
441
+ *
442
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance)
443
+ */
381
444
  declare interface Performance {
445
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/timeOrigin) */
382
446
  readonly timeOrigin: number;
447
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/now) */
383
448
  now(): number;
384
449
  }
385
450
  declare interface AlarmInvocationInfo {
@@ -391,40 +456,46 @@ declare interface DurableObject {
391
456
  alarm?(): void | Promise<void>;
392
457
  webSocketMessage?(
393
458
  ws: WebSocket,
394
- message: string | ArrayBuffer
459
+ message: string | ArrayBuffer,
395
460
  ): void | Promise<void>;
396
461
  webSocketClose?(
397
462
  ws: WebSocket,
398
463
  code: number,
399
464
  reason: string,
400
- wasClean: boolean
465
+ wasClean: boolean,
401
466
  ): void | Promise<void>;
402
467
  webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
403
468
  }
404
- declare interface DurableObjectStub extends Fetcher {
469
+ declare type DurableObjectStub<
470
+ T extends Rpc.DurableObjectBranded | undefined = undefined,
471
+ > = Fetcher<
472
+ T,
473
+ "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
474
+ > & {
405
475
  readonly id: DurableObjectId;
406
476
  readonly name?: string;
407
- }
477
+ };
408
478
  declare interface DurableObjectId {
409
479
  toString(): string;
410
480
  equals(other: DurableObjectId): boolean;
411
481
  readonly name?: string;
412
482
  }
413
- declare interface DurableObjectNamespace {
483
+ declare interface DurableObjectNamespace<
484
+ T extends Rpc.DurableObjectBranded | undefined = undefined,
485
+ > {
414
486
  newUniqueId(
415
- options?: DurableObjectNamespaceNewUniqueIdOptions
487
+ options?: DurableObjectNamespaceNewUniqueIdOptions,
416
488
  ): DurableObjectId;
417
489
  idFromName(name: string): DurableObjectId;
418
490
  idFromString(id: string): DurableObjectId;
419
- get(
420
- id: DurableObjectId,
421
- options?: DurableObjectNamespaceGetDurableObjectOptions
422
- ): DurableObjectStub;
491
+ get(id: DurableObjectId): DurableObjectStub<T>;
423
492
  getExisting(
424
493
  id: DurableObjectId,
425
- options?: DurableObjectNamespaceGetDurableObjectOptions
426
- ): DurableObjectStub;
427
- jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
494
+ options?: DurableObjectNamespaceGetDurableObjectOptions,
495
+ ): DurableObjectStub<T>;
496
+ jurisdiction(
497
+ jurisdiction: DurableObjectJurisdiction,
498
+ ): DurableObjectNamespace<T>;
428
499
  }
429
500
  declare type DurableObjectJurisdiction = "eu" | "fedramp";
430
501
  declare interface DurableObjectNamespaceNewUniqueIdOptions {
@@ -461,23 +532,23 @@ declare interface DurableObjectState {
461
532
  declare interface DurableObjectTransaction {
462
533
  get<T = unknown>(
463
534
  key: string,
464
- options?: DurableObjectGetOptions
535
+ options?: DurableObjectGetOptions,
465
536
  ): Promise<T | undefined>;
466
537
  get<T = unknown>(
467
538
  keys: string[],
468
- options?: DurableObjectGetOptions
539
+ options?: DurableObjectGetOptions,
469
540
  ): Promise<Map<string, T>>;
470
541
  list<T = unknown>(
471
- options?: DurableObjectListOptions
542
+ options?: DurableObjectListOptions,
472
543
  ): Promise<Map<string, T>>;
473
544
  put<T>(
474
545
  key: string,
475
546
  value: T,
476
- options?: DurableObjectPutOptions
547
+ options?: DurableObjectPutOptions,
477
548
  ): Promise<void>;
478
549
  put<T>(
479
550
  entries: Record<string, T>,
480
- options?: DurableObjectPutOptions
551
+ options?: DurableObjectPutOptions,
481
552
  ): Promise<void>;
482
553
  delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
483
554
  delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
@@ -485,41 +556,41 @@ declare interface DurableObjectTransaction {
485
556
  getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
486
557
  setAlarm(
487
558
  scheduledTime: number | Date,
488
- options?: DurableObjectSetAlarmOptions
559
+ options?: DurableObjectSetAlarmOptions,
489
560
  ): Promise<void>;
490
561
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
491
562
  }
492
563
  declare interface DurableObjectStorage {
493
564
  get<T = unknown>(
494
565
  key: string,
495
- options?: DurableObjectGetOptions
566
+ options?: DurableObjectGetOptions,
496
567
  ): Promise<T | undefined>;
497
568
  get<T = unknown>(
498
569
  keys: string[],
499
- options?: DurableObjectGetOptions
570
+ options?: DurableObjectGetOptions,
500
571
  ): Promise<Map<string, T>>;
501
572
  list<T = unknown>(
502
- options?: DurableObjectListOptions
573
+ options?: DurableObjectListOptions,
503
574
  ): Promise<Map<string, T>>;
504
575
  put<T>(
505
576
  key: string,
506
577
  value: T,
507
- options?: DurableObjectPutOptions
578
+ options?: DurableObjectPutOptions,
508
579
  ): Promise<void>;
509
580
  put<T>(
510
581
  entries: Record<string, T>,
511
- options?: DurableObjectPutOptions
582
+ options?: DurableObjectPutOptions,
512
583
  ): Promise<void>;
513
584
  delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
514
585
  delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
515
586
  deleteAll(options?: DurableObjectPutOptions): Promise<void>;
516
587
  transaction<T>(
517
- closure: (txn: DurableObjectTransaction) => Promise<T>
588
+ closure: (txn: DurableObjectTransaction) => Promise<T>,
518
589
  ): Promise<T>;
519
590
  getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
520
591
  setAlarm(
521
592
  scheduledTime: number | Date,
522
- options?: DurableObjectSetAlarmOptions
593
+ options?: DurableObjectSetAlarmOptions,
523
594
  ): Promise<void>;
524
595
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
525
596
  sync(): Promise<void>;
@@ -570,22 +641,107 @@ declare interface AnalyticsEngineDataPoint {
570
641
  }
571
642
  declare class Event {
572
643
  constructor(type: string, init?: EventInit);
644
+ /**
645
+ * Returns the type of event, e.g. "click", "hashchange", or "submit".
646
+ *
647
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
648
+ */
573
649
  get type(): string;
650
+ /**
651
+ * Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE.
652
+ *
653
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
654
+ */
574
655
  get eventPhase(): number;
656
+ /**
657
+ * 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.
658
+ *
659
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
660
+ */
575
661
  get composed(): boolean;
662
+ /**
663
+ * 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.
664
+ *
665
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)
666
+ */
576
667
  get bubbles(): boolean;
668
+ /**
669
+ * 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.
670
+ *
671
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)
672
+ */
577
673
  get cancelable(): boolean;
674
+ /**
675
+ * Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise.
676
+ *
677
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)
678
+ */
578
679
  get defaultPrevented(): boolean;
680
+ /**
681
+ * @deprecated
682
+ *
683
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)
684
+ */
579
685
  get returnValue(): boolean;
686
+ /**
687
+ * Returns the object whose event listener's callback is currently being invoked.
688
+ *
689
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
690
+ */
580
691
  get currentTarget(): EventTarget | undefined;
692
+ /**
693
+ * @deprecated
694
+ *
695
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
696
+ */
581
697
  get srcElement(): EventTarget | undefined;
698
+ /**
699
+ * Returns the event's timestamp as the number of milliseconds measured relative to the time origin.
700
+ *
701
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)
702
+ */
582
703
  get timeStamp(): number;
704
+ /**
705
+ * Returns true if event was dispatched by the user agent, and false otherwise.
706
+ *
707
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
708
+ */
583
709
  get isTrusted(): boolean;
710
+ /**
711
+ * @deprecated
712
+ *
713
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
714
+ */
584
715
  get cancelBubble(): boolean;
716
+ /**
717
+ * @deprecated
718
+ *
719
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
720
+ */
585
721
  set cancelBubble(value: boolean);
722
+ /**
723
+ * 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.
724
+ *
725
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
726
+ */
586
727
  stopImmediatePropagation(): void;
728
+ /**
729
+ * 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.
730
+ *
731
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
732
+ */
587
733
  preventDefault(): void;
734
+ /**
735
+ * When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object.
736
+ *
737
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
738
+ */
588
739
  stopPropagation(): void;
740
+ /**
741
+ * 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.
742
+ *
743
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
744
+ */
589
745
  composedPath(): EventTarget[];
590
746
  static readonly NONE: number;
591
747
  static readonly CAPTURING_PHASE: number;
@@ -598,28 +754,55 @@ declare interface EventInit {
598
754
  composed?: boolean;
599
755
  }
600
756
  declare type EventListener<EventType extends Event = Event> = (
601
- event: EventType
757
+ event: EventType,
602
758
  ) => void;
603
759
  declare interface EventListenerObject<EventType extends Event = Event> {
604
760
  handleEvent(event: EventType): void;
605
761
  }
606
762
  declare type EventListenerOrEventListenerObject<
607
- EventType extends Event = Event
763
+ EventType extends Event = Event,
608
764
  > = EventListener<EventType> | EventListenerObject<EventType>;
609
765
  declare class EventTarget<
610
- EventMap extends Record<string, Event> = Record<string, Event>
766
+ EventMap extends Record<string, Event> = Record<string, Event>,
611
767
  > {
612
768
  constructor();
769
+ /**
770
+ * 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.
771
+ *
772
+ * 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.
773
+ *
774
+ * 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.
775
+ *
776
+ * 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.
777
+ *
778
+ * When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
779
+ *
780
+ * If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
781
+ *
782
+ * The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
783
+ *
784
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
785
+ */
613
786
  addEventListener<Type extends keyof EventMap>(
614
787
  type: Type,
615
788
  handler: EventListenerOrEventListenerObject<EventMap[Type]>,
616
- options?: EventTargetAddEventListenerOptions | boolean
789
+ options?: EventTargetAddEventListenerOptions | boolean,
617
790
  ): void;
791
+ /**
792
+ * Removes the event listener in target's event listener list with the same type, callback, and options.
793
+ *
794
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
795
+ */
618
796
  removeEventListener<Type extends keyof EventMap>(
619
797
  type: Type,
620
798
  handler: EventListenerOrEventListenerObject<EventMap[Type]>,
621
- options?: EventTargetEventListenerOptions | boolean
799
+ options?: EventTargetEventListenerOptions | boolean,
622
800
  ): void;
801
+ /**
802
+ * 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.
803
+ *
804
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
805
+ */
623
806
  dispatchEvent(event: EventMap[keyof EventMap]): boolean;
624
807
  }
625
808
  declare interface EventTargetEventListenerOptions {
@@ -636,15 +819,34 @@ declare interface EventTargetHandlerObject {
636
819
  }
637
820
  declare class AbortController {
638
821
  constructor();
822
+ /**
823
+ * Returns the AbortSignal object associated with this object.
824
+ *
825
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)
826
+ */
639
827
  get signal(): AbortSignal;
828
+ /**
829
+ * 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.
830
+ *
831
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)
832
+ */
640
833
  abort(reason?: any): void;
641
834
  }
642
835
  declare abstract class AbortSignal extends EventTarget {
836
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) */
643
837
  static abort(reason?: any): AbortSignal;
838
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static) */
644
839
  static timeout(delay: number): AbortSignal;
645
840
  static any(signals: AbortSignal[]): AbortSignal;
841
+ /**
842
+ * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
843
+ *
844
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)
845
+ */
646
846
  get aborted(): boolean;
847
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason) */
647
848
  get reason(): any;
849
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted) */
648
850
  throwIfAborted(): void;
649
851
  }
650
852
  declare interface Scheduler {
@@ -654,10 +856,16 @@ declare interface SchedulerWaitOptions {
654
856
  signal?: AbortSignal;
655
857
  }
656
858
  declare abstract class ExtendableEvent extends Event {
859
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil) */
657
860
  waitUntil(promise: Promise<any>): void;
658
861
  }
659
862
  declare class CustomEvent<T = any> extends Event {
660
863
  constructor(type: string, init?: CustomEventCustomEventInit);
864
+ /**
865
+ * Returns any custom data event was created with. Typically used for synthetic events.
866
+ *
867
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
868
+ */
661
869
  get detail(): T;
662
870
  }
663
871
  declare interface CustomEventCustomEventInit {
@@ -669,13 +877,19 @@ declare interface CustomEventCustomEventInit {
669
877
  declare class Blob {
670
878
  constructor(
671
879
  bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[],
672
- options?: BlobOptions
880
+ options?: BlobOptions,
673
881
  );
882
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
674
883
  get size(): number;
884
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
675
885
  get type(): string;
886
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
676
887
  slice(start?: number, end?: number, type?: string): Blob;
888
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) */
677
889
  arrayBuffer(): Promise<ArrayBuffer>;
890
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
678
891
  text(): Promise<string>;
892
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream) */
679
893
  stream(): ReadableStream;
680
894
  }
681
895
  declare interface BlobOptions {
@@ -685,9 +899,11 @@ declare class File extends Blob {
685
899
  constructor(
686
900
  bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined,
687
901
  name: string,
688
- options?: FileOptions
902
+ options?: FileOptions,
689
903
  );
904
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
690
905
  get name(): string;
906
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
691
907
  get lastModified(): number;
692
908
  }
693
909
  declare interface FileOptions {
@@ -695,6 +911,7 @@ declare interface FileOptions {
695
911
  lastModified?: number;
696
912
  }
697
913
  declare abstract class CacheStorage {
914
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open) */
698
915
  open(cacheName: string): Promise<Cache>;
699
916
  readonly default: Cache;
700
917
  }
@@ -702,7 +919,7 @@ declare abstract class Cache {
702
919
  delete(request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>;
703
920
  match(
704
921
  request: RequestInfo,
705
- options?: CacheQueryOptions
922
+ options?: CacheQueryOptions,
706
923
  ): Promise<Response | undefined>;
707
924
  put(request: RequestInfo, response: Response): Promise<void>;
708
925
  }
@@ -710,7 +927,13 @@ declare interface CacheQueryOptions {
710
927
  ignoreMethod?: boolean;
711
928
  }
712
929
  declare abstract class Crypto {
930
+ /**
931
+ * Available only in secure contexts.
932
+ *
933
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
934
+ */
713
935
  get subtle(): SubtleCrypto;
936
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */
714
937
  getRandomValues<
715
938
  T extends
716
939
  | Int8Array
@@ -720,8 +943,13 @@ declare abstract class Crypto {
720
943
  | Int32Array
721
944
  | Uint32Array
722
945
  | BigInt64Array
723
- | BigUint64Array
946
+ | BigUint64Array,
724
947
  >(buffer: T): T;
948
+ /**
949
+ * Available only in secure contexts.
950
+ *
951
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)
952
+ */
725
953
  randomUUID(): string;
726
954
  DigestStream: typeof DigestStream;
727
955
  }
@@ -729,59 +957,63 @@ declare abstract class SubtleCrypto {
729
957
  encrypt(
730
958
  algorithm: string | SubtleCryptoEncryptAlgorithm,
731
959
  key: CryptoKey,
732
- plainText: ArrayBuffer | ArrayBufferView
960
+ plainText: ArrayBuffer | ArrayBufferView,
733
961
  ): Promise<ArrayBuffer>;
734
962
  decrypt(
735
963
  algorithm: string | SubtleCryptoEncryptAlgorithm,
736
964
  key: CryptoKey,
737
- cipherText: ArrayBuffer | ArrayBufferView
965
+ cipherText: ArrayBuffer | ArrayBufferView,
738
966
  ): Promise<ArrayBuffer>;
739
967
  sign(
740
968
  algorithm: string | SubtleCryptoSignAlgorithm,
741
969
  key: CryptoKey,
742
- data: ArrayBuffer | ArrayBufferView
970
+ data: ArrayBuffer | ArrayBufferView,
743
971
  ): Promise<ArrayBuffer>;
744
972
  verify(
745
973
  algorithm: string | SubtleCryptoSignAlgorithm,
746
974
  key: CryptoKey,
747
975
  signature: ArrayBuffer | ArrayBufferView,
748
- data: ArrayBuffer | ArrayBufferView
976
+ data: ArrayBuffer | ArrayBufferView,
749
977
  ): Promise<boolean>;
750
978
  digest(
751
979
  algorithm: string | SubtleCryptoHashAlgorithm,
752
- data: ArrayBuffer | ArrayBufferView
980
+ data: ArrayBuffer | ArrayBufferView,
753
981
  ): Promise<ArrayBuffer>;
982
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) */
754
983
  generateKey(
755
984
  algorithm: string | SubtleCryptoGenerateKeyAlgorithm,
756
985
  extractable: boolean,
757
- keyUsages: string[]
986
+ keyUsages: string[],
758
987
  ): Promise<CryptoKey | CryptoKeyPair>;
988
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey) */
759
989
  deriveKey(
760
990
  algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
761
991
  baseKey: CryptoKey,
762
992
  derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
763
993
  extractable: boolean,
764
- keyUsages: string[]
994
+ keyUsages: string[],
765
995
  ): Promise<CryptoKey>;
766
996
  deriveBits(
767
997
  algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
768
998
  baseKey: CryptoKey,
769
- length: number | null
999
+ length: number | null,
770
1000
  ): Promise<ArrayBuffer>;
1001
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) */
771
1002
  importKey(
772
1003
  format: string,
773
1004
  keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey,
774
1005
  algorithm: string | SubtleCryptoImportKeyAlgorithm,
775
1006
  extractable: boolean,
776
- keyUsages: string[]
1007
+ keyUsages: string[],
777
1008
  ): Promise<CryptoKey>;
778
1009
  exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
779
1010
  wrapKey(
780
1011
  format: string,
781
1012
  key: CryptoKey,
782
1013
  wrappingKey: CryptoKey,
783
- wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm
1014
+ wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
784
1015
  ): Promise<ArrayBuffer>;
1016
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey) */
785
1017
  unwrapKey(
786
1018
  format: string,
787
1019
  wrappedKey: ArrayBuffer | ArrayBufferView,
@@ -789,16 +1021,19 @@ declare abstract class SubtleCrypto {
789
1021
  unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
790
1022
  unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
791
1023
  extractable: boolean,
792
- keyUsages: string[]
1024
+ keyUsages: string[],
793
1025
  ): Promise<CryptoKey>;
794
1026
  timingSafeEqual(
795
1027
  a: ArrayBuffer | ArrayBufferView,
796
- b: ArrayBuffer | ArrayBufferView
1028
+ b: ArrayBuffer | ArrayBufferView,
797
1029
  ): boolean;
798
1030
  }
799
1031
  declare abstract class CryptoKey {
1032
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) */
800
1033
  readonly type: string;
1034
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable) */
801
1035
  readonly extractable: boolean;
1036
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm) */
802
1037
  readonly algorithm:
803
1038
  | CryptoKeyKeyAlgorithm
804
1039
  | CryptoKeyAesKeyAlgorithm
@@ -806,6 +1041,7 @@ declare abstract class CryptoKey {
806
1041
  | CryptoKeyRsaKeyAlgorithm
807
1042
  | CryptoKeyEllipticKeyAlgorithm
808
1043
  | CryptoKeyArbitraryKeyAlgorithm;
1044
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages) */
809
1045
  readonly usages: string[];
810
1046
  }
811
1047
  declare interface CryptoKeyPair {
@@ -914,9 +1150,24 @@ declare class DigestStream extends WritableStream<
914
1150
  }
915
1151
  declare class TextDecoder {
916
1152
  constructor(decoder?: string, options?: TextDecoderConstructorOptions);
1153
+ /**
1154
+ * 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.
1155
+ *
1156
+ * ```
1157
+ * var string = "", decoder = new TextDecoder(encoding), buffer;
1158
+ * while(buffer = next_chunk()) {
1159
+ * string += decoder.decode(buffer, {stream:true});
1160
+ * }
1161
+ * string += decoder.decode(); // end-of-queue
1162
+ * ```
1163
+ *
1164
+ * If the error mode is "fatal" and encoding's decoder returns error, throws a TypeError.
1165
+ *
1166
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)
1167
+ */
917
1168
  decode(
918
1169
  input?: ArrayBuffer | ArrayBufferView,
919
- options?: TextDecoderDecodeOptions
1170
+ options?: TextDecoderDecodeOptions,
920
1171
  ): string;
921
1172
  get encoding(): string;
922
1173
  get fatal(): boolean;
@@ -924,10 +1175,20 @@ declare class TextDecoder {
924
1175
  }
925
1176
  declare class TextEncoder {
926
1177
  constructor();
1178
+ /**
1179
+ * Returns the result of running UTF-8's encoder.
1180
+ *
1181
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)
1182
+ */
927
1183
  encode(input?: string): Uint8Array;
1184
+ /**
1185
+ * 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.
1186
+ *
1187
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)
1188
+ */
928
1189
  encodeInto(
929
1190
  input: string,
930
- buffer: ArrayBuffer | ArrayBufferView
1191
+ buffer: ArrayBuffer | ArrayBufferView,
931
1192
  ): TextEncoderEncodeIntoResult;
932
1193
  get encoding(): string;
933
1194
  }
@@ -952,17 +1213,20 @@ declare class FormData {
952
1213
  has(name: string): boolean;
953
1214
  set(name: string, value: string): void;
954
1215
  set(name: string, value: Blob, filename?: string): void;
1216
+ /** Returns an array of key, value pairs for every entry in the list. */
955
1217
  entries(): IterableIterator<[key: string, value: File | string]>;
1218
+ /** Returns a list of keys in the list. */
956
1219
  keys(): IterableIterator<string>;
1220
+ /** Returns a list of values in the list. */
957
1221
  values(): IterableIterator<File | string>;
958
1222
  forEach<This = unknown>(
959
1223
  callback: (
960
1224
  this: This,
961
1225
  value: File | string,
962
1226
  key: string,
963
- parent: FormData
1227
+ parent: FormData,
964
1228
  ) => void,
965
- thisArg?: This
1229
+ thisArg?: This,
966
1230
  ): void;
967
1231
  [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>;
968
1232
  }
@@ -973,7 +1237,7 @@ declare class HTMLRewriter {
973
1237
  constructor();
974
1238
  on(
975
1239
  selector: string,
976
- handlers: HTMLRewriterElementContentHandlers
1240
+ handlers: HTMLRewriterElementContentHandlers,
977
1241
  ): HTMLRewriter;
978
1242
  onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;
979
1243
  transform(response: Response): Response;
@@ -1040,7 +1304,9 @@ declare interface DocumentEnd {
1040
1304
  append(content: string, options?: ContentOptions): DocumentEnd;
1041
1305
  }
1042
1306
  declare abstract class FetchEvent extends ExtendableEvent {
1307
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request) */
1043
1308
  readonly request: Request;
1309
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith) */
1044
1310
  respondWith(promise: Response | Promise<Response>): void;
1045
1311
  passThroughOnException(): void;
1046
1312
  }
@@ -1059,10 +1325,13 @@ declare class Headers {
1059
1325
  delete(name: string): void;
1060
1326
  forEach<This = unknown>(
1061
1327
  callback: (this: This, value: string, key: string, parent: Headers) => void,
1062
- thisArg?: This
1328
+ thisArg?: This,
1063
1329
  ): void;
1330
+ /** Returns an iterator allowing to go through all key/value pairs contained in this object. */
1064
1331
  entries(): IterableIterator<[key: string, value: string]>;
1332
+ /** Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */
1065
1333
  keys(): IterableIterator<string>;
1334
+ /** Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
1066
1335
  values(): IterableIterator<string>;
1067
1336
  [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
1068
1337
  }
@@ -1085,14 +1354,23 @@ declare abstract class Body {
1085
1354
  }
1086
1355
  declare class Response extends Body {
1087
1356
  constructor(body?: BodyInit | null, init?: ResponseInit);
1357
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirect_static) */
1088
1358
  static redirect(url: string, status?: number): Response;
1359
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/json_static) */
1089
1360
  static json(any: any, maybeInit?: ResponseInit | Response): Response;
1361
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) */
1090
1362
  clone(): Response;
1363
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) */
1091
1364
  get status(): number;
1365
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText) */
1092
1366
  get statusText(): string;
1367
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) */
1093
1368
  get headers(): Headers;
1369
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok) */
1094
1370
  get ok(): boolean;
1371
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected) */
1095
1372
  get redirected(): boolean;
1373
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) */
1096
1374
  get url(): string;
1097
1375
  get webSocket(): WebSocket | null;
1098
1376
  get cf(): any | undefined;
@@ -1107,22 +1385,58 @@ declare interface ResponseInit {
1107
1385
  }
1108
1386
  declare type RequestInfo<
1109
1387
  CfHostMetadata = unknown,
1110
- Cf = CfProperties<CfHostMetadata>
1388
+ Cf = CfProperties<CfHostMetadata>,
1111
1389
  > = Request<CfHostMetadata, Cf> | string | URL;
1112
1390
  declare class Request<
1113
1391
  CfHostMetadata = unknown,
1114
- Cf = CfProperties<CfHostMetadata>
1392
+ Cf = CfProperties<CfHostMetadata>,
1115
1393
  > extends Body {
1116
1394
  constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
1395
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) */
1117
1396
  clone(): Request<CfHostMetadata, Cf>;
1397
+ /**
1398
+ * Returns request's HTTP method, which is "GET" by default.
1399
+ *
1400
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
1401
+ */
1118
1402
  get method(): string;
1403
+ /**
1404
+ * Returns the URL of request as a string.
1405
+ *
1406
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)
1407
+ */
1119
1408
  get url(): string;
1409
+ /**
1410
+ * 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.
1411
+ *
1412
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
1413
+ */
1120
1414
  get headers(): Headers;
1415
+ /**
1416
+ * 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.
1417
+ *
1418
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)
1419
+ */
1121
1420
  get redirect(): string;
1122
1421
  get fetcher(): Fetcher | null;
1422
+ /**
1423
+ * Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.
1424
+ *
1425
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)
1426
+ */
1123
1427
  get signal(): AbortSignal;
1124
1428
  get cf(): Cf | undefined;
1429
+ /**
1430
+ * 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]
1431
+ *
1432
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)
1433
+ */
1125
1434
  get integrity(): string;
1435
+ /**
1436
+ * Returns a boolean indicating whether or not request can outlive the global in which it was created.
1437
+ *
1438
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
1439
+ */
1126
1440
  get keepalive(): boolean;
1127
1441
  }
1128
1442
  declare interface RequestInit<Cf = CfProperties> {
@@ -1141,16 +1455,23 @@ declare interface RequestInit<Cf = CfProperties> {
1141
1455
  /** An AbortSignal to set request's signal. */
1142
1456
  signal?: AbortSignal | null;
1143
1457
  }
1144
- declare abstract class Fetcher {
1458
+ declare type Service<
1459
+ T extends Rpc.WorkerEntrypointBranded | undefined = undefined,
1460
+ > = Fetcher<T>;
1461
+ declare type Fetcher<
1462
+ T extends Rpc.EntrypointBranded | undefined = undefined,
1463
+ Reserved extends string = never,
1464
+ > = (T extends Rpc.EntrypointBranded
1465
+ ? Rpc.Provider<T, Reserved | "fetch" | "connect" | "queue" | "scheduled">
1466
+ : unknown) & {
1145
1467
  fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1146
1468
  connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1147
1469
  queue(
1148
1470
  queueName: string,
1149
- messages: ServiceBindingQueueMessage[]
1471
+ messages: ServiceBindingQueueMessage[],
1150
1472
  ): Promise<FetcherQueueResult>;
1151
1473
  scheduled(options?: FetcherScheduledOptions): Promise<FetcherScheduledResult>;
1152
- getRpcMethodForTestOnly(name: string): JsRpcProperty | null;
1153
- }
1474
+ };
1154
1475
  declare interface FetcherScheduledOptions {
1155
1476
  scheduledTime?: Date;
1156
1477
  cron?: string;
@@ -1169,6 +1490,7 @@ declare interface FetcherQueueResult {
1169
1490
  declare type ServiceBindingQueueMessage<Body = unknown> = {
1170
1491
  id: string;
1171
1492
  timestamp: Date;
1493
+ attempts: number;
1172
1494
  } & (
1173
1495
  | {
1174
1496
  body: Body;
@@ -1197,74 +1519,74 @@ declare type KVNamespaceListResult<Metadata, Key extends string = string> =
1197
1519
  declare interface KVNamespace<Key extends string = string> {
1198
1520
  get(
1199
1521
  key: Key,
1200
- options?: Partial<KVNamespaceGetOptions<undefined>>
1522
+ options?: Partial<KVNamespaceGetOptions<undefined>>,
1201
1523
  ): Promise<string | null>;
1202
1524
  get(key: Key, type: "text"): Promise<string | null>;
1203
1525
  get<ExpectedValue = unknown>(
1204
1526
  key: Key,
1205
- type: "json"
1527
+ type: "json",
1206
1528
  ): Promise<ExpectedValue | null>;
1207
1529
  get(key: Key, type: "arrayBuffer"): Promise<ArrayBuffer | null>;
1208
1530
  get(key: Key, type: "stream"): Promise<ReadableStream | null>;
1209
1531
  get(
1210
1532
  key: Key,
1211
- options?: KVNamespaceGetOptions<"text">
1533
+ options?: KVNamespaceGetOptions<"text">,
1212
1534
  ): Promise<string | null>;
1213
1535
  get<ExpectedValue = unknown>(
1214
1536
  key: Key,
1215
- options?: KVNamespaceGetOptions<"json">
1537
+ options?: KVNamespaceGetOptions<"json">,
1216
1538
  ): Promise<ExpectedValue | null>;
1217
1539
  get(
1218
1540
  key: Key,
1219
- options?: KVNamespaceGetOptions<"arrayBuffer">
1541
+ options?: KVNamespaceGetOptions<"arrayBuffer">,
1220
1542
  ): Promise<ArrayBuffer | null>;
1221
1543
  get(
1222
1544
  key: Key,
1223
- options?: KVNamespaceGetOptions<"stream">
1545
+ options?: KVNamespaceGetOptions<"stream">,
1224
1546
  ): Promise<ReadableStream | null>;
1225
1547
  list<Metadata = unknown>(
1226
- options?: KVNamespaceListOptions
1548
+ options?: KVNamespaceListOptions,
1227
1549
  ): Promise<KVNamespaceListResult<Metadata, Key>>;
1228
1550
  put(
1229
1551
  key: Key,
1230
1552
  value: string | ArrayBuffer | ArrayBufferView | ReadableStream,
1231
- options?: KVNamespacePutOptions
1553
+ options?: KVNamespacePutOptions,
1232
1554
  ): Promise<void>;
1233
1555
  getWithMetadata<Metadata = unknown>(
1234
1556
  key: Key,
1235
- options?: Partial<KVNamespaceGetOptions<undefined>>
1557
+ options?: Partial<KVNamespaceGetOptions<undefined>>,
1236
1558
  ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1237
1559
  getWithMetadata<Metadata = unknown>(
1238
1560
  key: Key,
1239
- type: "text"
1561
+ type: "text",
1240
1562
  ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1241
1563
  getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
1242
1564
  key: Key,
1243
- type: "json"
1565
+ type: "json",
1244
1566
  ): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
1245
1567
  getWithMetadata<Metadata = unknown>(
1246
1568
  key: Key,
1247
- type: "arrayBuffer"
1569
+ type: "arrayBuffer",
1248
1570
  ): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
1249
1571
  getWithMetadata<Metadata = unknown>(
1250
1572
  key: Key,
1251
- type: "stream"
1573
+ type: "stream",
1252
1574
  ): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
1253
1575
  getWithMetadata<Metadata = unknown>(
1254
1576
  key: Key,
1255
- options: KVNamespaceGetOptions<"text">
1577
+ options: KVNamespaceGetOptions<"text">,
1256
1578
  ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1257
1579
  getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
1258
1580
  key: Key,
1259
- options: KVNamespaceGetOptions<"json">
1581
+ options: KVNamespaceGetOptions<"json">,
1260
1582
  ): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
1261
1583
  getWithMetadata<Metadata = unknown>(
1262
1584
  key: Key,
1263
- options: KVNamespaceGetOptions<"arrayBuffer">
1585
+ options: KVNamespaceGetOptions<"arrayBuffer">,
1264
1586
  ): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
1265
1587
  getWithMetadata<Metadata = unknown>(
1266
1588
  key: Key,
1267
- options: KVNamespaceGetOptions<"stream">
1589
+ options: KVNamespaceGetOptions<"stream">,
1268
1590
  ): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
1269
1591
  delete(key: Key): Promise<void>;
1270
1592
  }
@@ -1292,7 +1614,7 @@ declare interface Queue<Body = unknown> {
1292
1614
  send(message: Body, options?: QueueSendOptions): Promise<void>;
1293
1615
  sendBatch(
1294
1616
  messages: Iterable<MessageSendRequest<Body>>,
1295
- options?: QueueSendBatchOptions
1617
+ options?: QueueSendBatchOptions,
1296
1618
  ): Promise<void>;
1297
1619
  }
1298
1620
  declare interface QueueSendOptions {
@@ -1322,6 +1644,7 @@ declare interface Message<Body = unknown> {
1322
1644
  readonly id: string;
1323
1645
  readonly timestamp: Date;
1324
1646
  readonly body: Body;
1647
+ readonly attempts: number;
1325
1648
  retry(options?: QueueRetryOptions): void;
1326
1649
  ack(): void;
1327
1650
  }
@@ -1358,7 +1681,7 @@ declare abstract class R2Bucket {
1358
1681
  key: string,
1359
1682
  options: R2GetOptions & {
1360
1683
  onlyIf: R2Conditional | Headers;
1361
- }
1684
+ },
1362
1685
  ): Promise<R2ObjectBody | R2Object | null>;
1363
1686
  get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;
1364
1687
  put(
@@ -1372,7 +1695,7 @@ declare abstract class R2Bucket {
1372
1695
  | Blob,
1373
1696
  options?: R2PutOptions & {
1374
1697
  onlyIf: R2Conditional | Headers;
1375
- }
1698
+ },
1376
1699
  ): Promise<R2Object | null>;
1377
1700
  put(
1378
1701
  key: string,
@@ -1383,11 +1706,11 @@ declare abstract class R2Bucket {
1383
1706
  | string
1384
1707
  | null
1385
1708
  | Blob,
1386
- options?: R2PutOptions
1709
+ options?: R2PutOptions,
1387
1710
  ): Promise<R2Object>;
1388
1711
  createMultipartUpload(
1389
1712
  key: string,
1390
- options?: R2MultipartOptions
1713
+ options?: R2MultipartOptions,
1391
1714
  ): Promise<R2MultipartUpload>;
1392
1715
  resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;
1393
1716
  delete(keys: string | string[]): Promise<void>;
@@ -1398,7 +1721,7 @@ declare interface R2MultipartUpload {
1398
1721
  readonly uploadId: string;
1399
1722
  uploadPart(
1400
1723
  partNumber: number,
1401
- value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob
1724
+ value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob,
1402
1725
  ): Promise<R2UploadedPart>;
1403
1726
  abort(): Promise<void>;
1404
1727
  complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
@@ -1500,7 +1823,7 @@ declare type R2Objects = {
1500
1823
  truncated: false;
1501
1824
  }
1502
1825
  );
1503
- declare interface JsRpcProperty {
1826
+ declare abstract class JsRpcProperty {
1504
1827
  then(handler: Function, errorHandler?: Function): any;
1505
1828
  catch(errorHandler: Function): any;
1506
1829
  finally(onFinally: Function): any;
@@ -1524,7 +1847,7 @@ declare interface UnderlyingSink<W = any> {
1524
1847
  start?: (controller: WritableStreamDefaultController) => void | Promise<void>;
1525
1848
  write?: (
1526
1849
  chunk: W,
1527
- controller: WritableStreamDefaultController
1850
+ controller: WritableStreamDefaultController,
1528
1851
  ) => void | Promise<void>;
1529
1852
  abort?: (reason: any) => void | Promise<void>;
1530
1853
  close?: () => void | Promise<void>;
@@ -1539,10 +1862,10 @@ declare interface UnderlyingByteSource {
1539
1862
  declare interface UnderlyingSource<R = any> {
1540
1863
  type?: "" | undefined;
1541
1864
  start?: (
1542
- controller: ReadableStreamDefaultController<R>
1865
+ controller: ReadableStreamDefaultController<R>,
1543
1866
  ) => void | Promise<void>;
1544
1867
  pull?: (
1545
- controller: ReadableStreamDefaultController<R>
1868
+ controller: ReadableStreamDefaultController<R>,
1546
1869
  ) => void | Promise<void>;
1547
1870
  cancel?: (reason: any) => void | Promise<void>;
1548
1871
  expectedLength?: number | bigint;
@@ -1551,14 +1874,14 @@ declare interface Transformer<I = any, O = any> {
1551
1874
  readableType?: string;
1552
1875
  writableType?: string;
1553
1876
  start?: (
1554
- controller: TransformStreamDefaultController<O>
1877
+ controller: TransformStreamDefaultController<O>,
1555
1878
  ) => void | Promise<void>;
1556
1879
  transform?: (
1557
1880
  chunk: I,
1558
- controller: TransformStreamDefaultController<O>
1881
+ controller: TransformStreamDefaultController<O>,
1559
1882
  ) => void | Promise<void>;
1560
1883
  flush?: (
1561
- controller: TransformStreamDefaultController<O>
1884
+ controller: TransformStreamDefaultController<O>,
1562
1885
  ) => void | Promise<void>;
1563
1886
  cancel?: (reason: any) => void | Promise<void>;
1564
1887
  expectedLength?: number;
@@ -1595,90 +1918,129 @@ declare type ReadableStreamReadResult<R = any> =
1595
1918
  done: true;
1596
1919
  value?: undefined;
1597
1920
  };
1598
- /** 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. */
1921
+ /**
1922
+ * 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.
1923
+ *
1924
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
1925
+ */
1599
1926
  declare interface ReadableStream<R = any> {
1927
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked) */
1600
1928
  get locked(): boolean;
1929
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel) */
1601
1930
  cancel(reason?: any): Promise<void>;
1931
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
1602
1932
  getReader(): ReadableStreamDefaultReader<R>;
1933
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
1603
1934
  getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
1935
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough) */
1604
1936
  pipeThrough<T>(
1605
1937
  transform: ReadableWritablePair<T, R>,
1606
- options?: StreamPipeOptions
1938
+ options?: StreamPipeOptions,
1607
1939
  ): ReadableStream<T>;
1940
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo) */
1608
1941
  pipeTo(
1609
1942
  destination: WritableStream<R>,
1610
- options?: StreamPipeOptions
1943
+ options?: StreamPipeOptions,
1611
1944
  ): Promise<void>;
1945
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee) */
1612
1946
  tee(): [ReadableStream<R>, ReadableStream<R>];
1613
1947
  values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
1614
1948
  [Symbol.asyncIterator](
1615
- options?: ReadableStreamValuesOptions
1949
+ options?: ReadableStreamValuesOptions,
1616
1950
  ): AsyncIterableIterator<R>;
1617
1951
  }
1618
1952
  declare const ReadableStream: {
1619
1953
  prototype: ReadableStream;
1620
1954
  new (
1621
1955
  underlyingSource: UnderlyingByteSource,
1622
- strategy?: QueuingStrategy<Uint8Array>
1956
+ strategy?: QueuingStrategy<Uint8Array>,
1623
1957
  ): ReadableStream<Uint8Array>;
1624
1958
  new <R = any>(
1625
1959
  underlyingSource?: UnderlyingSource<R>,
1626
- strategy?: QueuingStrategy<R>
1960
+ strategy?: QueuingStrategy<R>,
1627
1961
  ): ReadableStream<R>;
1628
1962
  };
1629
1963
  declare class ReadableStreamDefaultReader<R = any> {
1630
1964
  constructor(stream: ReadableStream);
1631
1965
  get closed(): Promise<void>;
1632
1966
  cancel(reason?: any): Promise<void>;
1967
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read) */
1633
1968
  read(): Promise<ReadableStreamReadResult<R>>;
1969
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock) */
1634
1970
  releaseLock(): void;
1635
1971
  }
1636
1972
  declare class ReadableStreamBYOBReader {
1637
1973
  constructor(stream: ReadableStream);
1638
1974
  get closed(): Promise<void>;
1639
1975
  cancel(reason?: any): Promise<void>;
1976
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) */
1640
1977
  read<T extends ArrayBufferView>(
1641
- view: T
1978
+ view: T,
1642
1979
  ): Promise<ReadableStreamReadResult<T>>;
1980
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) */
1643
1981
  releaseLock(): void;
1644
1982
  readAtLeast<T extends ArrayBufferView>(
1645
1983
  minElements: number,
1646
- view: T
1984
+ view: T,
1647
1985
  ): Promise<ReadableStreamReadResult<T>>;
1648
1986
  }
1649
1987
  declare interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
1650
1988
  min?: number;
1651
1989
  }
1652
1990
  declare interface ReadableStreamGetReaderOptions {
1991
+ /**
1992
+ * Creates a ReadableStreamBYOBReader and locks the stream to the new reader.
1993
+ *
1994
+ * 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.
1995
+ */
1653
1996
  mode: "byob";
1654
1997
  }
1655
1998
  declare abstract class ReadableStreamBYOBRequest {
1999
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view) */
1656
2000
  readonly view: Uint8Array | null;
2001
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond) */
1657
2002
  respond(bytesWritten: number): void;
2003
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView) */
1658
2004
  respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;
1659
2005
  readonly atLeast: number | null;
1660
2006
  }
1661
2007
  declare abstract class ReadableStreamDefaultController<R = any> {
2008
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize) */
1662
2009
  readonly desiredSize: number | null;
2010
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close) */
1663
2011
  close(): void;
2012
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue) */
1664
2013
  enqueue(chunk?: R): void;
2014
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error) */
1665
2015
  error(reason: any): void;
1666
2016
  }
1667
2017
  declare abstract class ReadableByteStreamController {
2018
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest) */
1668
2019
  readonly byobRequest: ReadableStreamBYOBRequest | null;
2020
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize) */
1669
2021
  readonly desiredSize: number | null;
2022
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close) */
1670
2023
  close(): void;
2024
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue) */
1671
2025
  enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
2026
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error) */
1672
2027
  error(reason: any): void;
1673
2028
  }
1674
2029
  declare abstract class WritableStreamDefaultController {
2030
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal) */
1675
2031
  readonly signal: AbortSignal;
2032
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error) */
1676
2033
  error(reason?: any): void;
1677
2034
  }
2035
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController) */
1678
2036
  declare interface TransformStreamDefaultController<O = any> {
2037
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize) */
1679
2038
  get desiredSize(): number | null;
2039
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue) */
1680
2040
  enqueue(chunk?: O): void;
2041
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error) */
1681
2042
  error(reason: any): void;
2043
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate) */
1682
2044
  terminate(): void;
1683
2045
  }
1684
2046
  declare interface ReadableWritablePair<R = any, W = any> {
@@ -1693,36 +2055,49 @@ declare interface ReadableWritablePair<R = any, W = any> {
1693
2055
  declare class WritableStream<W = any> {
1694
2056
  constructor(
1695
2057
  underlyingSink?: UnderlyingSink,
1696
- queuingStrategy?: QueuingStrategy
2058
+ queuingStrategy?: QueuingStrategy,
1697
2059
  );
2060
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked) */
1698
2061
  get locked(): boolean;
2062
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort) */
1699
2063
  abort(reason?: any): Promise<void>;
2064
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close) */
1700
2065
  close(): Promise<void>;
2066
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter) */
1701
2067
  getWriter(): WritableStreamDefaultWriter<W>;
1702
2068
  }
1703
2069
  declare class WritableStreamDefaultWriter<W = any> {
1704
2070
  constructor(stream: WritableStream);
2071
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed) */
1705
2072
  get closed(): Promise<void>;
2073
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready) */
1706
2074
  get ready(): Promise<void>;
2075
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize) */
1707
2076
  get desiredSize(): number | null;
2077
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort) */
1708
2078
  abort(reason?: any): Promise<void>;
2079
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close) */
1709
2080
  close(): Promise<void>;
2081
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write) */
1710
2082
  write(chunk?: W): Promise<void>;
2083
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock) */
1711
2084
  releaseLock(): void;
1712
2085
  }
1713
2086
  declare class TransformStream<I = any, O = any> {
1714
2087
  constructor(
1715
2088
  transformer?: Transformer<I, O>,
1716
2089
  writableStrategy?: QueuingStrategy<I>,
1717
- readableStrategy?: QueuingStrategy<O>
2090
+ readableStrategy?: QueuingStrategy<O>,
1718
2091
  );
2092
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable) */
1719
2093
  get readable(): ReadableStream<O>;
2094
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable) */
1720
2095
  get writable(): WritableStream<I>;
1721
2096
  }
1722
2097
  declare class FixedLengthStream extends IdentityTransformStream {
1723
2098
  constructor(
1724
2099
  expectedLength: number | bigint,
1725
- queuingStrategy?: IdentityTransformStreamQueuingStrategy
2100
+ queuingStrategy?: IdentityTransformStreamQueuingStrategy,
1726
2101
  );
1727
2102
  }
1728
2103
  declare class IdentityTransformStream extends TransformStream<
@@ -1765,12 +2140,16 @@ declare class ByteLengthQueuingStrategy
1765
2140
  implements QueuingStrategy<ArrayBufferView>
1766
2141
  {
1767
2142
  constructor(init: QueuingStrategyInit);
2143
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark) */
1768
2144
  get highWaterMark(): number;
2145
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */
1769
2146
  get size(): (chunk?: any) => number;
1770
2147
  }
1771
2148
  declare class CountQueuingStrategy implements QueuingStrategy {
1772
2149
  constructor(init: QueuingStrategyInit);
2150
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark) */
1773
2151
  get highWaterMark(): number;
2152
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */
1774
2153
  get size(): (chunk?: any) => number;
1775
2154
  }
1776
2155
  declare interface QueuingStrategyInit {
@@ -1794,6 +2173,7 @@ declare interface TraceItem {
1794
2173
  readonly event:
1795
2174
  | (
1796
2175
  | TraceItemFetchEventInfo
2176
+ | TraceItemJsRpcEventInfo
1797
2177
  | TraceItemScheduledEventInfo
1798
2178
  | TraceItemAlarmEventInfo
1799
2179
  | TraceItemQueueEventInfo
@@ -1808,6 +2188,7 @@ declare interface TraceItem {
1808
2188
  readonly exceptions: TraceException[];
1809
2189
  readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
1810
2190
  readonly scriptName: string | null;
2191
+ readonly entrypoint?: string;
1811
2192
  readonly scriptVersion?: ScriptVersion;
1812
2193
  readonly dispatchNamespace?: string;
1813
2194
  readonly scriptTags?: string[];
@@ -1850,6 +2231,9 @@ declare interface TraceItemFetchEventInfoRequest {
1850
2231
  declare interface TraceItemFetchEventInfoResponse {
1851
2232
  readonly status: number;
1852
2233
  }
2234
+ declare interface TraceItemJsRpcEventInfo {
2235
+ readonly rpcMethod: string;
2236
+ }
1853
2237
  declare interface TraceItemHibernatableWebSocketEventInfo {
1854
2238
  readonly getWebSocketEvent:
1855
2239
  | TraceItemHibernatableWebSocketEventInfoMessage
@@ -1876,6 +2260,7 @@ declare interface TraceException {
1876
2260
  readonly timestamp: number;
1877
2261
  readonly message: string;
1878
2262
  readonly name: string;
2263
+ readonly stack?: string;
1879
2264
  }
1880
2265
  declare interface TraceDiagnosticChannelEvent {
1881
2266
  readonly timestamp: number;
@@ -1891,35 +2276,59 @@ declare interface UnsafeTraceMetrics {
1891
2276
  }
1892
2277
  declare class URL {
1893
2278
  constructor(url: string | URL, base?: string | URL);
2279
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin) */
1894
2280
  get origin(): string;
2281
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) */
1895
2282
  get href(): string;
2283
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) */
1896
2284
  set href(value: string);
2285
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) */
1897
2286
  get protocol(): string;
2287
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) */
1898
2288
  set protocol(value: string);
2289
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */
1899
2290
  get username(): string;
2291
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */
1900
2292
  set username(value: string);
2293
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */
1901
2294
  get password(): string;
2295
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */
1902
2296
  set password(value: string);
2297
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */
1903
2298
  get host(): string;
2299
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */
1904
2300
  set host(value: string);
2301
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */
1905
2302
  get hostname(): string;
2303
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */
1906
2304
  set hostname(value: string);
2305
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */
1907
2306
  get port(): string;
2307
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */
1908
2308
  set port(value: string);
2309
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */
1909
2310
  get pathname(): string;
2311
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */
1910
2312
  set pathname(value: string);
2313
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */
1911
2314
  get search(): string;
2315
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */
1912
2316
  set search(value: string);
2317
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */
1913
2318
  get hash(): string;
2319
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */
1914
2320
  set hash(value: string);
2321
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams) */
1915
2322
  get searchParams(): URLSearchParams;
2323
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON) */
1916
2324
  toJSON(): string;
1917
2325
  toString(): string;
2326
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) */
1918
2327
  static canParse(url: string, base?: string): boolean;
1919
2328
  }
1920
2329
  declare class URLSearchParams {
1921
2330
  constructor(
1922
- init?: Iterable<Iterable<string>> | Record<string, string> | string
2331
+ init?: Iterable<Iterable<string>> | Record<string, string> | string,
1923
2332
  );
1924
2333
  get size(): number;
1925
2334
  append(name: string, value: string): void;
@@ -1929,17 +2338,20 @@ declare class URLSearchParams {
1929
2338
  has(name: string, value?: string): boolean;
1930
2339
  set(name: string, value: string): void;
1931
2340
  sort(): void;
2341
+ /** Returns an array of key, value pairs for every entry in the search params. */
1932
2342
  entries(): IterableIterator<[key: string, value: string]>;
2343
+ /** Returns a list of keys in the search params. */
1933
2344
  keys(): IterableIterator<string>;
2345
+ /** Returns a list of values in the search params. */
1934
2346
  values(): IterableIterator<string>;
1935
2347
  forEach<This = unknown>(
1936
2348
  callback: (
1937
2349
  this: This,
1938
2350
  value: string,
1939
2351
  key: string,
1940
- parent: URLSearchParams
2352
+ parent: URLSearchParams,
1941
2353
  ) => void,
1942
- thisArg?: This
2354
+ thisArg?: This,
1943
2355
  ): void;
1944
2356
  toString(): string;
1945
2357
  [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
@@ -1948,7 +2360,7 @@ declare class URLPattern {
1948
2360
  constructor(
1949
2361
  input?: string | URLPatternURLPatternInit,
1950
2362
  baseURL?: string,
1951
- patternOptions?: URLPatternURLPatternOptions
2363
+ patternOptions?: URLPatternURLPatternOptions,
1952
2364
  );
1953
2365
  get protocol(): string;
1954
2366
  get username(): string;
@@ -1961,7 +2373,7 @@ declare class URLPattern {
1961
2373
  test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean;
1962
2374
  exec(
1963
2375
  input?: string | URLPatternURLPatternInit,
1964
- baseURL?: string
2376
+ baseURL?: string,
1965
2377
  ): URLPatternURLPatternResult | null;
1966
2378
  }
1967
2379
  declare interface URLPatternURLPatternInit {
@@ -1995,11 +2407,23 @@ declare interface URLPatternURLPatternOptions {
1995
2407
  }
1996
2408
  declare class CloseEvent extends Event {
1997
2409
  constructor(type: string, initializer?: CloseEventInit);
1998
- /** Returns the WebSocket connection close code provided by the server. */
2410
+ /**
2411
+ * Returns the WebSocket connection close code provided by the server.
2412
+ *
2413
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)
2414
+ */
1999
2415
  readonly code: number;
2000
- /** Returns the WebSocket connection close reason provided by the server. */
2416
+ /**
2417
+ * Returns the WebSocket connection close reason provided by the server.
2418
+ *
2419
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)
2420
+ */
2001
2421
  readonly reason: string;
2002
- /** Returns true if the connection closed cleanly; false otherwise. */
2422
+ /**
2423
+ * Returns true if the connection closed cleanly; false otherwise.
2424
+ *
2425
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)
2426
+ */
2003
2427
  readonly wasClean: boolean;
2004
2428
  }
2005
2429
  declare interface CloseEventInit {
@@ -2014,12 +2438,21 @@ declare class MessageEvent extends Event {
2014
2438
  declare interface MessageEventInit {
2015
2439
  data: ArrayBuffer | string;
2016
2440
  }
2017
- /** Events providing information related to errors in scripts or in files. */
2441
+ /**
2442
+ * Events providing information related to errors in scripts or in files.
2443
+ *
2444
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)
2445
+ */
2018
2446
  declare interface ErrorEvent extends Event {
2447
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename) */
2019
2448
  readonly filename: string;
2449
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message) */
2020
2450
  readonly message: string;
2451
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno) */
2021
2452
  readonly lineno: number;
2453
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno) */
2022
2454
  readonly colno: number;
2455
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error) */
2023
2456
  readonly error: any;
2024
2457
  }
2025
2458
  declare type WebSocketEventMap = {
@@ -2031,7 +2464,17 @@ declare type WebSocketEventMap = {
2031
2464
  declare class WebSocket extends EventTarget<WebSocketEventMap> {
2032
2465
  constructor(url: string, protocols?: string[] | string);
2033
2466
  accept(): void;
2467
+ /**
2468
+ * Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
2469
+ *
2470
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
2471
+ */
2034
2472
  send(message: (ArrayBuffer | ArrayBufferView) | string): void;
2473
+ /**
2474
+ * Closes the WebSocket connection, optionally using code as the the WebSocket connection close code and reason as the the WebSocket connection close reason.
2475
+ *
2476
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)
2477
+ */
2035
2478
  close(code?: number, reason?: string): void;
2036
2479
  serializeAttachment(attachment: any): void;
2037
2480
  deserializeAttachment(): any | null;
@@ -2043,9 +2486,29 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
2043
2486
  static readonly CLOSING: number;
2044
2487
  static readonly READY_STATE_CLOSED: number;
2045
2488
  static readonly CLOSED: number;
2489
+ /**
2490
+ * Returns the state of the WebSocket object's connection. It can have the values described below.
2491
+ *
2492
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)
2493
+ */
2046
2494
  get readyState(): number;
2495
+ /**
2496
+ * Returns the URL that was used to establish the WebSocket connection.
2497
+ *
2498
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)
2499
+ */
2047
2500
  get url(): string | null;
2501
+ /**
2502
+ * 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.
2503
+ *
2504
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)
2505
+ */
2048
2506
  get protocol(): string | null;
2507
+ /**
2508
+ * Returns the extensions selected by the server, if any.
2509
+ *
2510
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
2511
+ */
2049
2512
  get extensions(): string | null;
2050
2513
  }
2051
2514
  declare const WebSocketPair: {
@@ -2097,7 +2560,7 @@ declare interface SocketInfo {
2097
2560
  }
2098
2561
  declare interface gpuGPU {
2099
2562
  requestAdapter(
2100
- param1?: gpuGPURequestAdapterOptions
2563
+ param1?: gpuGPURequestAdapterOptions,
2101
2564
  ): Promise<gpuGPUAdapter | null>;
2102
2565
  }
2103
2566
  declare abstract class gpuGPUAdapter {
@@ -2109,24 +2572,24 @@ declare abstract class gpuGPUAdapter {
2109
2572
  declare interface gpuGPUDevice extends EventTarget {
2110
2573
  createBuffer(param1: gpuGPUBufferDescriptor): gpuGPUBuffer;
2111
2574
  createBindGroupLayout(
2112
- descriptor: gpuGPUBindGroupLayoutDescriptor
2575
+ descriptor: gpuGPUBindGroupLayoutDescriptor,
2113
2576
  ): gpuGPUBindGroupLayout;
2114
2577
  createBindGroup(descriptor: gpuGPUBindGroupDescriptor): gpuGPUBindGroup;
2115
2578
  createSampler(descriptor: gpuGPUSamplerDescriptor): gpuGPUSampler;
2116
2579
  createShaderModule(
2117
- descriptor: gpuGPUShaderModuleDescriptor
2580
+ descriptor: gpuGPUShaderModuleDescriptor,
2118
2581
  ): gpuGPUShaderModule;
2119
2582
  createPipelineLayout(
2120
- descriptor: gpuGPUPipelineLayoutDescriptor
2583
+ descriptor: gpuGPUPipelineLayoutDescriptor,
2121
2584
  ): gpuGPUPipelineLayout;
2122
2585
  createComputePipeline(
2123
- descriptor: gpuGPUComputePipelineDescriptor
2586
+ descriptor: gpuGPUComputePipelineDescriptor,
2124
2587
  ): gpuGPUComputePipeline;
2125
2588
  createRenderPipeline(
2126
- descriptor: gpuGPURenderPipelineDescriptor
2589
+ descriptor: gpuGPURenderPipelineDescriptor,
2127
2590
  ): gpuGPURenderPipeline;
2128
2591
  createCommandEncoder(
2129
- descriptor?: gpuGPUCommandEncoderDescriptor
2592
+ descriptor?: gpuGPUCommandEncoderDescriptor,
2130
2593
  ): gpuGPUCommandEncoder;
2131
2594
  createTexture(param1: gpuGPUTextureDescriptor): gpuGPUTexture;
2132
2595
  destroy(): void;
@@ -2172,7 +2635,7 @@ declare interface gpuGPUBuffer {
2172
2635
  mapAsync(
2173
2636
  offset: number,
2174
2637
  size?: number | bigint,
2175
- param3?: number | bigint
2638
+ param3?: number | bigint,
2176
2639
  ): Promise<void>;
2177
2640
  get size(): number | bigint;
2178
2641
  get usage(): number;
@@ -2271,38 +2734,38 @@ declare interface gpuGPUProgrammableStage {
2271
2734
  declare interface gpuGPUCommandEncoder {
2272
2735
  get label(): string;
2273
2736
  beginComputePass(
2274
- descriptor?: gpuGPUComputePassDescriptor
2737
+ descriptor?: gpuGPUComputePassDescriptor,
2275
2738
  ): gpuGPUComputePassEncoder;
2276
2739
  beginRenderPass(
2277
- descriptor: gpuGPURenderPassDescriptor
2740
+ descriptor: gpuGPURenderPassDescriptor,
2278
2741
  ): gpuGPURenderPassEncoder;
2279
2742
  copyBufferToBuffer(
2280
2743
  source: gpuGPUBuffer,
2281
2744
  sourceOffset: number | bigint,
2282
2745
  destination: gpuGPUBuffer,
2283
2746
  destinationOffset: number | bigint,
2284
- size: number | bigint
2747
+ size: number | bigint,
2285
2748
  ): void;
2286
2749
  finish(param0?: gpuGPUCommandBufferDescriptor): gpuGPUCommandBuffer;
2287
2750
  copyTextureToBuffer(
2288
2751
  source: gpuGPUImageCopyTexture,
2289
2752
  destination: gpuGPUImageCopyBuffer,
2290
- copySize: Iterable<number> | gpuGPUExtent3DDict
2753
+ copySize: Iterable<number> | gpuGPUExtent3DDict,
2291
2754
  ): void;
2292
2755
  copyBufferToTexture(
2293
2756
  source: gpuGPUImageCopyBuffer,
2294
2757
  destination: gpuGPUImageCopyTexture,
2295
- copySize: Iterable<number> | gpuGPUExtent3DDict
2758
+ copySize: Iterable<number> | gpuGPUExtent3DDict,
2296
2759
  ): void;
2297
2760
  copyTextureToTexture(
2298
2761
  source: gpuGPUImageCopyTexture,
2299
2762
  destination: gpuGPUImageCopyTexture,
2300
- copySize: Iterable<number> | gpuGPUExtent3DDict
2763
+ copySize: Iterable<number> | gpuGPUExtent3DDict,
2301
2764
  ): void;
2302
2765
  clearBuffer(
2303
2766
  buffer: gpuGPUBuffer,
2304
2767
  offset?: number | bigint,
2305
- size?: number | bigint
2768
+ size?: number | bigint,
2306
2769
  ): void;
2307
2770
  }
2308
2771
  declare interface gpuGPUCommandEncoderDescriptor {
@@ -2313,12 +2776,12 @@ declare interface gpuGPUComputePassEncoder {
2313
2776
  setBindGroup(
2314
2777
  index: number,
2315
2778
  bindGroup: gpuGPUBindGroup | null,
2316
- dynamicOffsets?: Iterable<number>
2779
+ dynamicOffsets?: Iterable<number>,
2317
2780
  ): void;
2318
2781
  dispatchWorkgroups(
2319
2782
  workgroupCountX: number,
2320
2783
  workgroupCountY?: number,
2321
- workgroupCountZ?: number
2784
+ workgroupCountZ?: number,
2322
2785
  ): void;
2323
2786
  end(): void;
2324
2787
  }
@@ -2346,7 +2809,7 @@ declare interface gpuGPUQueue {
2346
2809
  bufferOffset: number | bigint,
2347
2810
  data: ArrayBuffer | ArrayBufferView,
2348
2811
  dataOffset?: number | bigint,
2349
- size?: number | bigint
2812
+ size?: number | bigint,
2350
2813
  ): void;
2351
2814
  }
2352
2815
  declare abstract class gpuGPUMapMode {
@@ -2554,7 +3017,7 @@ declare interface gpuGPURenderPassEncoder {
2554
3017
  vertexCount: number,
2555
3018
  instanceCount?: number,
2556
3019
  firstVertex?: number,
2557
- firstInstance?: number
3020
+ firstInstance?: number,
2558
3021
  ): void;
2559
3022
  end(): void;
2560
3023
  }
@@ -3052,7 +3515,7 @@ declare interface IncomingRequestCfPropertiesBotManagementEnterprise
3052
3515
  };
3053
3516
  }
3054
3517
  declare interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<
3055
- HostMetadata
3518
+ HostMetadata,
3056
3519
  > {
3057
3520
  /**
3058
3521
  * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/).
@@ -3622,6 +4085,13 @@ declare abstract class D1PreparedStatement {
3622
4085
  }): Promise<[string[], ...T[]]>;
3623
4086
  raw<T = unknown[]>(options?: { columnNames?: false }): Promise<T[]>;
3624
4087
  }
4088
+ // `Disposable` was added to TypeScript's standard lib types in version 5.2.
4089
+ // To support older TypeScript versions, define an empty `Disposable` interface.
4090
+ // Users won't be able to use `using`/`Symbol.dispose` without upgrading to 5.2,
4091
+ // but this will ensure type checking on older versions still passes.
4092
+ // TypeScript's interface merging will ensure our empty interface is effectively
4093
+ // ignored when `Disposable` is included in the standard lib.
4094
+ declare interface Disposable {}
3625
4095
  /**
3626
4096
  * An email message that can be sent from a Worker.
3627
4097
  */
@@ -3677,7 +4147,7 @@ declare abstract class EmailEvent extends ExtendableEvent {
3677
4147
  declare type EmailExportedHandler<Env = unknown> = (
3678
4148
  message: ForwardableEmailMessage,
3679
4149
  env: Env,
3680
- ctx: ExecutionContext
4150
+ ctx: ExecutionContext,
3681
4151
  ) => void | Promise<void>;
3682
4152
  declare module "cloudflare:email" {
3683
4153
  let _EmailMessage: {
@@ -3751,7 +4221,7 @@ declare type EventContext<Env, P extends string, Data> = {
3751
4221
  declare type PagesFunction<
3752
4222
  Env = unknown,
3753
4223
  Params extends string = any,
3754
- Data extends Record<string, unknown> = Record<string, unknown>
4224
+ Data extends Record<string, unknown> = Record<string, unknown>,
3755
4225
  > = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
3756
4226
  declare type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
3757
4227
  request: Request<unknown, IncomingRequestCfProperties<unknown>>;
@@ -3772,9 +4242,9 @@ declare type PagesPluginFunction<
3772
4242
  Env = unknown,
3773
4243
  Params extends string = any,
3774
4244
  Data extends Record<string, unknown> = Record<string, unknown>,
3775
- PluginArgs = unknown
4245
+ PluginArgs = unknown,
3776
4246
  > = (
3777
- context: EventPluginContext<Env, Params, Data, PluginArgs>
4247
+ context: EventPluginContext<Env, Params, Data, PluginArgs>,
3778
4248
  ) => Response | Promise<Response>;
3779
4249
  declare module "assets:*" {
3780
4250
  export const onRequest: PagesFunction;
@@ -3813,10 +4283,204 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
3813
4283
  // Key Identifier of the JWK
3814
4284
  readonly kid: string;
3815
4285
  }
4286
+ // Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need
4287
+ // to referenced by `Fetcher`. This is included in the "importable" version of the types which
4288
+ // strips all `module` blocks.
4289
+ declare namespace Rpc {
4290
+ // Branded types for identifying `WorkerEntrypoint`/`DurableObject`/`Target`s.
4291
+ // TypeScript uses *structural* typing meaning anything with the same shape as type `T` is a `T`.
4292
+ // For the classes exported by `cloudflare:workers` we want *nominal* typing (i.e. we only want to
4293
+ // accept `WorkerEntrypoint` from `cloudflare:workers`, not any other class with the same shape)
4294
+ export const __RPC_STUB_BRAND: unique symbol;
4295
+ export const __RPC_TARGET_BRAND: unique symbol;
4296
+ export const __WORKER_ENTRYPOINT_BRAND: unique symbol;
4297
+ export const __DURABLE_OBJECT_BRAND: unique symbol;
4298
+ export interface RpcTargetBranded {
4299
+ [__RPC_TARGET_BRAND]: never;
4300
+ }
4301
+ export interface WorkerEntrypointBranded {
4302
+ [__WORKER_ENTRYPOINT_BRAND]: never;
4303
+ }
4304
+ export interface DurableObjectBranded {
4305
+ [__DURABLE_OBJECT_BRAND]: never;
4306
+ }
4307
+ export type EntrypointBranded =
4308
+ | WorkerEntrypointBranded
4309
+ | DurableObjectBranded;
4310
+ // Types that can be used through `Stub`s
4311
+ export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
4312
+ // Types that can be passed over RPC
4313
+ type Serializable =
4314
+ // Structured cloneables
4315
+ | void
4316
+ | undefined
4317
+ | null
4318
+ | boolean
4319
+ | number
4320
+ | bigint
4321
+ | string
4322
+ | TypedArray
4323
+ | ArrayBuffer
4324
+ | DataView
4325
+ | Date
4326
+ | Error
4327
+ | RegExp
4328
+ // Structured cloneable composites
4329
+ | Map<Serializable, Serializable>
4330
+ | Set<Serializable>
4331
+ | ReadonlyArray<Serializable>
4332
+ | {
4333
+ [key: string | number]: Serializable;
4334
+ }
4335
+ // Special types
4336
+ | ReadableStream<Uint8Array>
4337
+ | WritableStream<Uint8Array>
4338
+ | Request
4339
+ | Response
4340
+ | Headers
4341
+ | Stub<Stubable>
4342
+ // Serialized as stubs, see `Stubify`
4343
+ | Stubable;
4344
+ // Base type for all RPC stubs, including common memory management methods.
4345
+ // `T` is used as a marker type for unwrapping `Stub`s later.
4346
+ interface StubBase<T extends Stubable> extends Disposable {
4347
+ [__RPC_STUB_BRAND]: T;
4348
+ dup(): this;
4349
+ }
4350
+ export type Stub<T extends Stubable> = Provider<T> & StubBase<T>;
4351
+ // Recursively rewrite all `Stubable` types with `Stub`s
4352
+ type Stubify<T> = T extends Stubable
4353
+ ? Stub<T>
4354
+ : T extends Map<infer K, infer V>
4355
+ ? Map<Stubify<K>, Stubify<V>>
4356
+ : T extends Set<infer V>
4357
+ ? Set<Stubify<V>>
4358
+ : T extends Array<infer V>
4359
+ ? Array<Stubify<V>>
4360
+ : T extends ReadonlyArray<infer V>
4361
+ ? ReadonlyArray<Stubify<V>>
4362
+ : T extends {
4363
+ [key: string | number]: unknown;
4364
+ }
4365
+ ? {
4366
+ [K in keyof T]: Stubify<T[K]>;
4367
+ }
4368
+ : T;
4369
+ // Recursively rewrite all `Stub<T>`s with the corresponding `T`s.
4370
+ // Note we use `StubBase` instead of `Stub` here to avoid circular dependencies:
4371
+ // `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`.
4372
+ type Unstubify<T> =
4373
+ T extends StubBase<infer V>
4374
+ ? V
4375
+ : T extends Map<infer K, infer V>
4376
+ ? Map<Unstubify<K>, Unstubify<V>>
4377
+ : T extends Set<infer V>
4378
+ ? Set<Unstubify<V>>
4379
+ : T extends Array<infer V>
4380
+ ? Array<Unstubify<V>>
4381
+ : T extends ReadonlyArray<infer V>
4382
+ ? ReadonlyArray<Unstubify<V>>
4383
+ : T extends {
4384
+ [key: string | number]: unknown;
4385
+ }
4386
+ ? {
4387
+ [K in keyof T]: Unstubify<T[K]>;
4388
+ }
4389
+ : T;
4390
+ type UnstubifyAll<A extends any[]> = {
4391
+ [I in keyof A]: Unstubify<A[I]>;
4392
+ };
4393
+ // Utility type for adding `Provider`/`Disposable`s to `object` types only.
4394
+ // Note `unknown & T` is equivalent to `T`.
4395
+ type MaybeProvider<T> = T extends object ? Provider<T> : unknown;
4396
+ type MaybeDisposable<T> = T extends object ? Disposable : unknown;
4397
+ // Type for method return or property on an RPC interface.
4398
+ // - Stubable types are replaced by stubs.
4399
+ // - Serializable types are passed by value, with stubable types replaced by stubs
4400
+ // and a top-level `Disposer`.
4401
+ // Everything else can't be passed over PRC.
4402
+ // Technically, we use custom thenables here, but they quack like `Promise`s.
4403
+ // Intersecting with `(Maybe)Provider` allows pipelining.
4404
+ type Result<R> = R extends Stubable
4405
+ ? Promise<Stub<R>> & Provider<R>
4406
+ : R extends Serializable
4407
+ ? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R>
4408
+ : never;
4409
+ // Type for method or property on an RPC interface.
4410
+ // For methods, unwrap `Stub`s in parameters, and rewrite returns to be `Result`s.
4411
+ // Unwrapping `Stub`s allows calling with `Stubable` arguments.
4412
+ // For properties, rewrite types to be `Result`s.
4413
+ // In each case, unwrap `Promise`s.
4414
+ type MethodOrProperty<V> = V extends (...args: infer P) => infer R
4415
+ ? (...args: UnstubifyAll<P>) => Result<Awaited<R>>
4416
+ : Result<Awaited<V>>;
4417
+ // Type for the callable part of an `Provider` if `T` is callable.
4418
+ // This is intersected with methods/properties.
4419
+ type MaybeCallableProvider<T> = T extends (...args: any[]) => any
4420
+ ? MethodOrProperty<T>
4421
+ : unknown;
4422
+ // Base type for all other types providing RPC-like interfaces.
4423
+ // Rewrites all methods/properties to be `MethodOrProperty`s, while preserving callable types.
4424
+ // `Reserved` names (e.g. stub method names like `dup()`) and symbols can't be accessed over RPC.
4425
+ export type Provider<
4426
+ T extends object,
4427
+ Reserved extends string = never,
4428
+ > = MaybeCallableProvider<T> & {
4429
+ [K in Exclude<
4430
+ keyof T,
4431
+ Reserved | symbol | keyof StubBase<never>
4432
+ >]: MethodOrProperty<T[K]>;
4433
+ };
4434
+ }
4435
+ declare module "cloudflare:workers" {
4436
+ export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;
4437
+ export const RpcStub: {
4438
+ new <T extends Rpc.Stubable>(value: T): Rpc.Stub<T>;
4439
+ };
4440
+ export abstract class RpcTarget implements Rpc.RpcTargetBranded {
4441
+ [Rpc.__RPC_TARGET_BRAND]: never;
4442
+ }
4443
+ // `protected` fields don't appear in `keyof`s, so can't be accessed over RPC
4444
+ export abstract class WorkerEntrypoint<Env = unknown>
4445
+ implements Rpc.WorkerEntrypointBranded
4446
+ {
4447
+ [Rpc.__WORKER_ENTRYPOINT_BRAND]: never;
4448
+ protected ctx: ExecutionContext;
4449
+ protected env: Env;
4450
+ constructor(ctx: ExecutionContext, env: Env);
4451
+ fetch?(request: Request): Response | Promise<Response>;
4452
+ tail?(events: TraceItem[]): void | Promise<void>;
4453
+ trace?(traces: TraceItem[]): void | Promise<void>;
4454
+ scheduled?(controller: ScheduledController): void | Promise<void>;
4455
+ queue?(batch: MessageBatch<unknown>): void | Promise<void>;
4456
+ test?(controller: TestController): void | Promise<void>;
4457
+ }
4458
+ export abstract class DurableObject<Env = unknown>
4459
+ implements Rpc.DurableObjectBranded
4460
+ {
4461
+ [Rpc.__DURABLE_OBJECT_BRAND]: never;
4462
+ protected ctx: DurableObjectState;
4463
+ protected env: Env;
4464
+ constructor(ctx: DurableObjectState, env: Env);
4465
+ fetch?(request: Request): Response | Promise<Response>;
4466
+ alarm?(): void | Promise<void>;
4467
+ webSocketMessage?(
4468
+ ws: WebSocket,
4469
+ message: string | ArrayBuffer,
4470
+ ): void | Promise<void>;
4471
+ webSocketClose?(
4472
+ ws: WebSocket,
4473
+ code: number,
4474
+ reason: string,
4475
+ wasClean: boolean,
4476
+ ): void | Promise<void>;
4477
+ webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
4478
+ }
4479
+ }
3816
4480
  declare module "cloudflare:sockets" {
3817
4481
  function _connect(
3818
4482
  address: string | SocketAddress,
3819
- options?: SocketOptions
4483
+ options?: SocketOptions,
3820
4484
  ): Socket;
3821
4485
  export { _connect as connect };
3822
4486
  }
@@ -3952,7 +4616,7 @@ declare abstract class VectorizeIndex {
3952
4616
  */
3953
4617
  public query(
3954
4618
  vector: VectorFloatArray | number[],
3955
- options: VectorizeQueryOptions
4619
+ options: VectorizeQueryOptions,
3956
4620
  ): Promise<VectorizeMatches>;
3957
4621
  /**
3958
4622
  * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
@@ -3979,6 +4643,16 @@ declare abstract class VectorizeIndex {
3979
4643
  */
3980
4644
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
3981
4645
  }
4646
+ /**
4647
+ * The interface for "version_metadata" binding
4648
+ * providing metadata about the Worker Version using this binding.
4649
+ */
4650
+ declare type WorkerVersionMetadata = {
4651
+ /** The ID of the Worker Version using this binding */
4652
+ id: string;
4653
+ /** The tag of the Worker Version using this binding */
4654
+ tag: string;
4655
+ };
3982
4656
  declare interface DynamicDispatchLimits {
3983
4657
  /**
3984
4658
  * Limit CPU time in milliseconds.
@@ -4014,6 +4688,6 @@ declare interface DispatchNamespace {
4014
4688
  args?: {
4015
4689
  [key: string]: any;
4016
4690
  },
4017
- options?: DynamicDispatchOptions
4691
+ options?: DynamicDispatchOptions,
4018
4692
  ): Fetcher;
4019
4693
  }