@cloudflare/workers-types 4.20240320.1 → 4.20240402.0

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