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