@cloudflare/workers-types 4.20240314.0 → 4.20240329.0

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