@cloudflare/workers-types 0.20230518.0 → 0.20240405.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,8 +16,15 @@ and limitations under the License.
16
16
  // noinspection JSUnusedGlobalSymbols
17
17
  declare class DOMException extends Error {
18
18
  constructor(message?: string, name?: string);
19
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */
19
20
  readonly message: string;
21
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */
20
22
  readonly name: string;
23
+ /**
24
+ * @deprecated
25
+ *
26
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
27
+ */
21
28
  readonly code: number;
22
29
  readonly stack: any;
23
30
  static readonly INDEX_SIZE_ERR: number;
@@ -56,30 +63,61 @@ declare type WorkerGlobalScopeEventMap = {
56
63
  declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {
57
64
  EventTarget: typeof EventTarget;
58
65
  }
66
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console) */
59
67
  declare interface Console {
60
68
  "assert"(condition?: boolean, ...data: any[]): void;
69
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static) */
61
70
  clear(): void;
71
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static) */
62
72
  count(label?: string): void;
73
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static) */
63
74
  countReset(label?: string): void;
75
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static) */
64
76
  debug(...data: any[]): void;
77
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static) */
65
78
  dir(item?: any, options?: any): void;
79
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static) */
66
80
  dirxml(...data: any[]): void;
81
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static) */
67
82
  error(...data: any[]): void;
83
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static) */
68
84
  group(...data: any[]): void;
85
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static) */
69
86
  groupCollapsed(...data: any[]): void;
87
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static) */
70
88
  groupEnd(): void;
89
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static) */
71
90
  info(...data: any[]): void;
91
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static) */
72
92
  log(...data: any[]): void;
93
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static) */
73
94
  table(tabularData?: any, properties?: string[]): void;
95
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static) */
74
96
  time(label?: string): void;
97
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static) */
75
98
  timeEnd(label?: string): void;
99
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static) */
76
100
  timeLog(label?: string, ...data: any[]): void;
77
101
  timeStamp(label?: string): void;
102
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static) */
78
103
  trace(...data: any[]): void;
104
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static) */
79
105
  warn(...data: any[]): void;
80
106
  }
81
107
  declare const console: Console;
82
108
  declare type BufferSource = ArrayBufferView | ArrayBuffer;
109
+ declare type TypedArray =
110
+ | Int8Array
111
+ | Uint8Array
112
+ | Uint8ClampedArray
113
+ | Int16Array
114
+ | Uint16Array
115
+ | Int32Array
116
+ | Uint32Array
117
+ | Float32Array
118
+ | Float64Array
119
+ | BigInt64Array
120
+ | BigUint64Array;
83
121
  declare namespace WebAssembly {
84
122
  class CompileError extends Error {
85
123
  constructor(message?: string);
@@ -154,7 +192,11 @@ declare namespace WebAssembly {
154
192
  function instantiate(module: Module, imports?: Imports): Promise<Instance>;
155
193
  function validate(bytes: BufferSource): boolean;
156
194
  }
157
- /** This ServiceWorker API interface represents the global execution context of a service worker. */
195
+ /**
196
+ * This ServiceWorker API interface represents the global execution context of a service worker.
197
+ *
198
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope)
199
+ */
158
200
  declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
159
201
  DOMException: typeof DOMException;
160
202
  WorkerGlobalScope: typeof WorkerGlobalScope;
@@ -178,7 +220,7 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
178
220
  structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
179
221
  fetch(
180
222
  input: RequestInfo,
181
- init?: RequestInit<RequestInitCfProperties>
223
+ init?: RequestInit<RequestInitCfProperties>,
182
224
  ): Promise<Response>;
183
225
  self: ServiceWorkerGlobalScope;
184
226
  crypto: Crypto;
@@ -188,6 +230,7 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
188
230
  readonly origin: string;
189
231
  Event: typeof Event;
190
232
  ExtendableEvent: typeof ExtendableEvent;
233
+ CustomEvent: typeof CustomEvent;
191
234
  PromiseRejectionEvent: typeof PromiseRejectionEvent;
192
235
  FetchEvent: typeof FetchEvent;
193
236
  TailEvent: typeof TailEvent;
@@ -217,6 +260,7 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
217
260
  Response: typeof Response;
218
261
  WebSocket: typeof WebSocket;
219
262
  WebSocketPair: typeof WebSocketPair;
263
+ WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;
220
264
  AbortController: typeof AbortController;
221
265
  AbortSignal: typeof AbortSignal;
222
266
  TextDecoder: typeof TextDecoder;
@@ -237,53 +281,78 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
237
281
  FixedLengthStream: typeof FixedLengthStream;
238
282
  IdentityTransformStream: typeof IdentityTransformStream;
239
283
  HTMLRewriter: typeof HTMLRewriter;
284
+ GPUAdapter: typeof gpuGPUAdapter;
285
+ GPUOutOfMemoryError: typeof gpuGPUOutOfMemoryError;
286
+ GPUValidationError: typeof gpuGPUValidationError;
287
+ GPUInternalError: typeof gpuGPUInternalError;
288
+ GPUDeviceLostInfo: typeof gpuGPUDeviceLostInfo;
289
+ GPUBufferUsage: typeof gpuGPUBufferUsage;
290
+ GPUShaderStage: typeof gpuGPUShaderStage;
291
+ GPUMapMode: typeof gpuGPUMapMode;
292
+ GPUTextureUsage: typeof gpuGPUTextureUsage;
293
+ GPUColorWrite: typeof gpuGPUColorWrite;
240
294
  }
241
295
  declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
242
296
  type: Type,
243
297
  handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
244
- options?: EventTargetAddEventListenerOptions | boolean
298
+ options?: EventTargetAddEventListenerOptions | boolean,
245
299
  ): void;
246
300
  declare function removeEventListener<
247
- Type extends keyof WorkerGlobalScopeEventMap
301
+ Type extends keyof WorkerGlobalScopeEventMap,
248
302
  >(
249
303
  type: Type,
250
304
  handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>,
251
- options?: EventTargetEventListenerOptions | boolean
305
+ options?: EventTargetEventListenerOptions | boolean,
252
306
  ): void;
253
- /** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */
307
+ /**
308
+ * Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
309
+ *
310
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
311
+ */
254
312
  declare function dispatchEvent(
255
- event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]
313
+ event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap],
256
314
  ): boolean;
315
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/btoa) */
257
316
  declare function btoa(data: string): string;
317
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/atob) */
258
318
  declare function atob(data: string): string;
319
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
259
320
  declare function setTimeout(
260
321
  callback: (...args: any[]) => void,
261
- msDelay?: number
322
+ msDelay?: number,
262
323
  ): number;
324
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
263
325
  declare function setTimeout<Args extends any[]>(
264
326
  callback: (...args: Args) => void,
265
327
  msDelay?: number,
266
328
  ...args: Args
267
329
  ): number;
330
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearTimeout) */
268
331
  declare function clearTimeout(timeoutId: number | null): void;
332
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
269
333
  declare function setInterval(
270
334
  callback: (...args: any[]) => void,
271
- msDelay?: number
335
+ msDelay?: number,
272
336
  ): number;
337
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
273
338
  declare function setInterval<Args extends any[]>(
274
339
  callback: (...args: Args) => void,
275
340
  msDelay?: number,
276
341
  ...args: Args
277
342
  ): number;
343
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearInterval) */
278
344
  declare function clearInterval(timeoutId: number | null): void;
345
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/queueMicrotask) */
279
346
  declare function queueMicrotask(task: Function): void;
347
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/structuredClone) */
280
348
  declare function structuredClone<T>(
281
349
  value: T,
282
- options?: StructuredSerializeOptions
350
+ options?: StructuredSerializeOptions,
283
351
  ): T;
352
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
284
353
  declare function fetch(
285
354
  input: RequestInfo,
286
- init?: RequestInit<RequestInitCfProperties>
355
+ init?: RequestInit<RequestInitCfProperties>,
287
356
  ): Promise<Response>;
288
357
  declare const self: ServiceWorkerGlobalScope;
289
358
  declare const crypto: Crypto;
@@ -299,88 +368,132 @@ declare interface ExecutionContext {
299
368
  }
300
369
  declare type ExportedHandlerFetchHandler<
301
370
  Env = unknown,
302
- CfHostMetadata = unknown
371
+ CfHostMetadata = unknown,
303
372
  > = (
304
373
  request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
305
374
  env: Env,
306
- ctx: ExecutionContext
375
+ ctx: ExecutionContext,
307
376
  ) => Response | Promise<Response>;
308
377
  declare type ExportedHandlerTailHandler<Env = unknown> = (
309
378
  events: TraceItem[],
310
379
  env: Env,
311
- ctx: ExecutionContext
380
+ ctx: ExecutionContext,
312
381
  ) => void | Promise<void>;
313
382
  declare type ExportedHandlerTraceHandler<Env = unknown> = (
314
383
  traces: TraceItem[],
315
384
  env: Env,
316
- ctx: ExecutionContext
385
+ ctx: ExecutionContext,
317
386
  ) => void | Promise<void>;
318
387
  declare type ExportedHandlerScheduledHandler<Env = unknown> = (
319
388
  controller: ScheduledController,
320
389
  env: Env,
321
- ctx: ExecutionContext
390
+ ctx: ExecutionContext,
322
391
  ) => void | Promise<void>;
323
392
  declare type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
324
393
  batch: MessageBatch<Message>,
325
394
  env: Env,
326
- ctx: ExecutionContext
395
+ ctx: ExecutionContext,
327
396
  ) => void | Promise<void>;
328
397
  declare type ExportedHandlerTestHandler<Env = unknown> = (
329
398
  controller: TestController,
330
399
  env: Env,
331
- ctx: ExecutionContext
400
+ ctx: ExecutionContext,
332
401
  ) => void | Promise<void>;
333
402
  declare interface ExportedHandler<
334
403
  Env = unknown,
335
- QueueMessage = unknown,
336
- CfHostMetadata = unknown
404
+ QueueHandlerMessage = unknown,
405
+ CfHostMetadata = unknown,
337
406
  > {
338
407
  fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
339
408
  tail?: ExportedHandlerTailHandler<Env>;
340
409
  trace?: ExportedHandlerTraceHandler<Env>;
341
410
  scheduled?: ExportedHandlerScheduledHandler<Env>;
342
411
  test?: ExportedHandlerTestHandler<Env>;
343
- queue?: ExportedHandlerQueueHandler<Env, Message>;
412
+ email?: EmailExportedHandler<Env>;
413
+ queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
344
414
  }
345
415
  declare interface StructuredSerializeOptions {
346
416
  transfer?: any[];
347
417
  }
348
418
  declare abstract class PromiseRejectionEvent extends Event {
419
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise) */
349
420
  readonly promise: Promise<any>;
421
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason) */
350
422
  readonly reason: any;
351
423
  }
352
424
  declare abstract class Navigator {
425
+ sendBeacon(
426
+ url: string,
427
+ body?:
428
+ | ReadableStream
429
+ | string
430
+ | (ArrayBuffer | ArrayBufferView)
431
+ | Blob
432
+ | URLSearchParams
433
+ | FormData,
434
+ ): boolean;
353
435
  readonly userAgent: string;
436
+ readonly gpu: gpuGPU;
354
437
  }
355
- /** Provides access to performance-related information for the current page. It's part of the High Resolution Time API, but is enhanced by the Performance Timeline API, the Navigation Timing API, the User Timing API, and the Resource Timing API. */
438
+ /**
439
+ * Provides access to performance-related information for the current page. It's part of the High Resolution Time API, but is enhanced by the Performance Timeline API, the Navigation Timing API, the User Timing API, and the Resource Timing API.
440
+ *
441
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance)
442
+ */
356
443
  declare interface Performance {
444
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/timeOrigin) */
357
445
  readonly timeOrigin: number;
446
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/now) */
358
447
  now(): number;
359
448
  }
449
+ declare interface AlarmInvocationInfo {
450
+ readonly isRetry: boolean;
451
+ readonly retryCount: number;
452
+ }
360
453
  declare interface DurableObject {
361
454
  fetch(request: Request): Response | Promise<Response>;
362
455
  alarm?(): void | Promise<void>;
363
- }
364
- declare interface DurableObjectStub extends Fetcher {
456
+ webSocketMessage?(
457
+ ws: WebSocket,
458
+ message: string | ArrayBuffer,
459
+ ): void | Promise<void>;
460
+ webSocketClose?(
461
+ ws: WebSocket,
462
+ code: number,
463
+ reason: string,
464
+ wasClean: boolean,
465
+ ): void | Promise<void>;
466
+ webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
467
+ }
468
+ declare type DurableObjectStub<
469
+ T extends Rpc.DurableObjectBranded | undefined = undefined,
470
+ > = Fetcher<
471
+ T,
472
+ "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
473
+ > & {
365
474
  readonly id: DurableObjectId;
366
475
  readonly name?: string;
367
- }
476
+ };
368
477
  declare interface DurableObjectId {
369
478
  toString(): string;
370
479
  equals(other: DurableObjectId): boolean;
371
480
  readonly name?: string;
372
481
  }
373
- declare interface DurableObjectNamespace {
482
+ declare interface DurableObjectNamespace<
483
+ T extends Rpc.DurableObjectBranded | undefined = undefined,
484
+ > {
374
485
  newUniqueId(
375
- options?: DurableObjectNamespaceNewUniqueIdOptions
486
+ options?: DurableObjectNamespaceNewUniqueIdOptions,
376
487
  ): DurableObjectId;
377
488
  idFromName(name: string): DurableObjectId;
378
489
  idFromString(id: string): DurableObjectId;
379
490
  get(
380
491
  id: DurableObjectId,
381
- options?: DurableObjectNamespaceGetDurableObjectOptions
382
- ): DurableObjectStub;
383
- jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
492
+ options?: DurableObjectNamespaceGetDurableObjectOptions,
493
+ ): DurableObjectStub<T>;
494
+ jurisdiction(
495
+ jurisdiction: DurableObjectJurisdiction,
496
+ ): DurableObjectNamespace<T>;
384
497
  }
385
498
  declare type DurableObjectJurisdiction = "eu" | "fedramp";
386
499
  declare interface DurableObjectNamespaceNewUniqueIdOptions {
@@ -406,27 +519,33 @@ declare interface DurableObjectState {
406
519
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
407
520
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
408
521
  getWebSockets(tag?: string): WebSocket[];
522
+ setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
523
+ getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
524
+ getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
525
+ setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
526
+ getHibernatableWebSocketEventTimeout(): number | null;
527
+ getTags(ws: WebSocket): string[];
409
528
  }
410
529
  declare interface DurableObjectTransaction {
411
530
  get<T = unknown>(
412
531
  key: string,
413
- options?: DurableObjectGetOptions
532
+ options?: DurableObjectGetOptions,
414
533
  ): Promise<T | undefined>;
415
534
  get<T = unknown>(
416
535
  keys: string[],
417
- options?: DurableObjectGetOptions
536
+ options?: DurableObjectGetOptions,
418
537
  ): Promise<Map<string, T>>;
419
538
  list<T = unknown>(
420
- options?: DurableObjectListOptions
539
+ options?: DurableObjectListOptions,
421
540
  ): Promise<Map<string, T>>;
422
541
  put<T>(
423
542
  key: string,
424
543
  value: T,
425
- options?: DurableObjectPutOptions
544
+ options?: DurableObjectPutOptions,
426
545
  ): Promise<void>;
427
546
  put<T>(
428
547
  entries: Record<string, T>,
429
- options?: DurableObjectPutOptions
548
+ options?: DurableObjectPutOptions,
430
549
  ): Promise<void>;
431
550
  delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
432
551
  delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
@@ -434,41 +553,41 @@ declare interface DurableObjectTransaction {
434
553
  getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
435
554
  setAlarm(
436
555
  scheduledTime: number | Date,
437
- options?: DurableObjectSetAlarmOptions
556
+ options?: DurableObjectSetAlarmOptions,
438
557
  ): Promise<void>;
439
558
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
440
559
  }
441
560
  declare interface DurableObjectStorage {
442
561
  get<T = unknown>(
443
562
  key: string,
444
- options?: DurableObjectGetOptions
563
+ options?: DurableObjectGetOptions,
445
564
  ): Promise<T | undefined>;
446
565
  get<T = unknown>(
447
566
  keys: string[],
448
- options?: DurableObjectGetOptions
567
+ options?: DurableObjectGetOptions,
449
568
  ): Promise<Map<string, T>>;
450
569
  list<T = unknown>(
451
- options?: DurableObjectListOptions
570
+ options?: DurableObjectListOptions,
452
571
  ): Promise<Map<string, T>>;
453
572
  put<T>(
454
573
  key: string,
455
574
  value: T,
456
- options?: DurableObjectPutOptions
575
+ options?: DurableObjectPutOptions,
457
576
  ): Promise<void>;
458
577
  put<T>(
459
578
  entries: Record<string, T>,
460
- options?: DurableObjectPutOptions
579
+ options?: DurableObjectPutOptions,
461
580
  ): Promise<void>;
462
581
  delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
463
582
  delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
464
583
  deleteAll(options?: DurableObjectPutOptions): Promise<void>;
465
584
  transaction<T>(
466
- closure: (txn: DurableObjectTransaction) => Promise<T>
585
+ closure: (txn: DurableObjectTransaction) => Promise<T>,
467
586
  ): Promise<T>;
468
587
  getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;
469
588
  setAlarm(
470
589
  scheduledTime: number | Date,
471
- options?: DurableObjectSetAlarmOptions
590
+ options?: DurableObjectSetAlarmOptions,
472
591
  ): Promise<void>;
473
592
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
474
593
  sync(): Promise<void>;
@@ -500,6 +619,11 @@ declare interface DurableObjectSetAlarmOptions {
500
619
  allowConcurrency?: boolean;
501
620
  allowUnconfirmed?: boolean;
502
621
  }
622
+ declare class WebSocketRequestResponsePair {
623
+ constructor(request: string, response: string);
624
+ get request(): string;
625
+ get response(): string;
626
+ }
503
627
  declare interface AnalyticsEngineDataset {
504
628
  writeDataPoint(event?: AnalyticsEngineDataPoint): void;
505
629
  }
@@ -510,22 +634,107 @@ declare interface AnalyticsEngineDataPoint {
510
634
  }
511
635
  declare class Event {
512
636
  constructor(type: string, init?: EventInit);
637
+ /**
638
+ * Returns the type of event, e.g. "click", "hashchange", or "submit".
639
+ *
640
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
641
+ */
513
642
  get type(): string;
643
+ /**
644
+ * Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE.
645
+ *
646
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
647
+ */
514
648
  get eventPhase(): number;
649
+ /**
650
+ * 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.
651
+ *
652
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
653
+ */
515
654
  get composed(): boolean;
655
+ /**
656
+ * 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.
657
+ *
658
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)
659
+ */
516
660
  get bubbles(): boolean;
661
+ /**
662
+ * 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.
663
+ *
664
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)
665
+ */
517
666
  get cancelable(): boolean;
667
+ /**
668
+ * Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise.
669
+ *
670
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)
671
+ */
518
672
  get defaultPrevented(): boolean;
673
+ /**
674
+ * @deprecated
675
+ *
676
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)
677
+ */
519
678
  get returnValue(): boolean;
679
+ /**
680
+ * Returns the object whose event listener's callback is currently being invoked.
681
+ *
682
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
683
+ */
520
684
  get currentTarget(): EventTarget | undefined;
685
+ /**
686
+ * @deprecated
687
+ *
688
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
689
+ */
521
690
  get srcElement(): EventTarget | undefined;
691
+ /**
692
+ * Returns the event's timestamp as the number of milliseconds measured relative to the time origin.
693
+ *
694
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)
695
+ */
522
696
  get timeStamp(): number;
697
+ /**
698
+ * Returns true if event was dispatched by the user agent, and false otherwise.
699
+ *
700
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
701
+ */
523
702
  get isTrusted(): boolean;
703
+ /**
704
+ * @deprecated
705
+ *
706
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
707
+ */
524
708
  get cancelBubble(): boolean;
709
+ /**
710
+ * @deprecated
711
+ *
712
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
713
+ */
525
714
  set cancelBubble(value: boolean);
715
+ /**
716
+ * 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.
717
+ *
718
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
719
+ */
526
720
  stopImmediatePropagation(): void;
721
+ /**
722
+ * 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.
723
+ *
724
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
725
+ */
527
726
  preventDefault(): void;
727
+ /**
728
+ * When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object.
729
+ *
730
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
731
+ */
528
732
  stopPropagation(): void;
733
+ /**
734
+ * 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.
735
+ *
736
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
737
+ */
529
738
  composedPath(): EventTarget[];
530
739
  static readonly NONE: number;
531
740
  static readonly CAPTURING_PHASE: number;
@@ -538,28 +747,55 @@ declare interface EventInit {
538
747
  composed?: boolean;
539
748
  }
540
749
  declare type EventListener<EventType extends Event = Event> = (
541
- event: EventType
750
+ event: EventType,
542
751
  ) => void;
543
752
  declare interface EventListenerObject<EventType extends Event = Event> {
544
753
  handleEvent(event: EventType): void;
545
754
  }
546
755
  declare type EventListenerOrEventListenerObject<
547
- EventType extends Event = Event
756
+ EventType extends Event = Event,
548
757
  > = EventListener<EventType> | EventListenerObject<EventType>;
549
758
  declare class EventTarget<
550
- EventMap extends Record<string, Event> = Record<string, Event>
759
+ EventMap extends Record<string, Event> = Record<string, Event>,
551
760
  > {
552
761
  constructor();
762
+ /**
763
+ * 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.
764
+ *
765
+ * 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.
766
+ *
767
+ * 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.
768
+ *
769
+ * 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.
770
+ *
771
+ * When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
772
+ *
773
+ * If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
774
+ *
775
+ * The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
776
+ *
777
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
778
+ */
553
779
  addEventListener<Type extends keyof EventMap>(
554
780
  type: Type,
555
781
  handler: EventListenerOrEventListenerObject<EventMap[Type]>,
556
- options?: EventTargetAddEventListenerOptions | boolean
782
+ options?: EventTargetAddEventListenerOptions | boolean,
557
783
  ): void;
784
+ /**
785
+ * Removes the event listener in target's event listener list with the same type, callback, and options.
786
+ *
787
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
788
+ */
558
789
  removeEventListener<Type extends keyof EventMap>(
559
790
  type: Type,
560
791
  handler: EventListenerOrEventListenerObject<EventMap[Type]>,
561
- options?: EventTargetEventListenerOptions | boolean
792
+ options?: EventTargetEventListenerOptions | boolean,
562
793
  ): void;
794
+ /**
795
+ * 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.
796
+ *
797
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
798
+ */
563
799
  dispatchEvent(event: EventMap[keyof EventMap]): boolean;
564
800
  }
565
801
  declare interface EventTargetEventListenerOptions {
@@ -576,15 +812,38 @@ declare interface EventTargetHandlerObject {
576
812
  }
577
813
  declare class AbortController {
578
814
  constructor();
815
+ /**
816
+ * Returns the AbortSignal object associated with this object.
817
+ *
818
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)
819
+ */
579
820
  get signal(): AbortSignal;
821
+ /**
822
+ * 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.
823
+ *
824
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)
825
+ */
580
826
  abort(reason?: any): void;
581
827
  }
582
828
  declare abstract class AbortSignal extends EventTarget {
829
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) */
583
830
  static abort(reason?: any): AbortSignal;
831
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static) */
584
832
  static timeout(delay: number): AbortSignal;
585
833
  static any(signals: AbortSignal[]): AbortSignal;
834
+ /**
835
+ * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
836
+ *
837
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)
838
+ */
586
839
  get aborted(): boolean;
840
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason) */
587
841
  get reason(): any;
842
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
843
+ get onabort(): any | null;
844
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
845
+ set onabort(value: any | null);
846
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted) */
588
847
  throwIfAborted(): void;
589
848
  }
590
849
  declare interface Scheduler {
@@ -594,18 +853,40 @@ declare interface SchedulerWaitOptions {
594
853
  signal?: AbortSignal;
595
854
  }
596
855
  declare abstract class ExtendableEvent extends Event {
856
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil) */
597
857
  waitUntil(promise: Promise<any>): void;
598
858
  }
859
+ declare class CustomEvent<T = any> extends Event {
860
+ constructor(type: string, init?: CustomEventCustomEventInit);
861
+ /**
862
+ * Returns any custom data event was created with. Typically used for synthetic events.
863
+ *
864
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
865
+ */
866
+ get detail(): T;
867
+ }
868
+ declare interface CustomEventCustomEventInit {
869
+ bubbles?: boolean;
870
+ cancelable?: boolean;
871
+ composed?: boolean;
872
+ detail?: any;
873
+ }
599
874
  declare class Blob {
600
875
  constructor(
601
876
  bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[],
602
- options?: BlobOptions
877
+ options?: BlobOptions,
603
878
  );
879
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
604
880
  get size(): number;
881
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
605
882
  get type(): string;
883
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
606
884
  slice(start?: number, end?: number, type?: string): Blob;
885
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) */
607
886
  arrayBuffer(): Promise<ArrayBuffer>;
887
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
608
888
  text(): Promise<string>;
889
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream) */
609
890
  stream(): ReadableStream;
610
891
  }
611
892
  declare interface BlobOptions {
@@ -615,9 +896,11 @@ declare class File extends Blob {
615
896
  constructor(
616
897
  bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined,
617
898
  name: string,
618
- options?: FileOptions
899
+ options?: FileOptions,
619
900
  );
901
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
620
902
  get name(): string;
903
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
621
904
  get lastModified(): number;
622
905
  }
623
906
  declare interface FileOptions {
@@ -625,6 +908,7 @@ declare interface FileOptions {
625
908
  lastModified?: number;
626
909
  }
627
910
  declare abstract class CacheStorage {
911
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open) */
628
912
  open(cacheName: string): Promise<Cache>;
629
913
  readonly default: Cache;
630
914
  }
@@ -632,7 +916,7 @@ declare abstract class Cache {
632
916
  delete(request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>;
633
917
  match(
634
918
  request: RequestInfo,
635
- options?: CacheQueryOptions
919
+ options?: CacheQueryOptions,
636
920
  ): Promise<Response | undefined>;
637
921
  put(request: RequestInfo, response: Response): Promise<void>;
638
922
  }
@@ -640,7 +924,13 @@ declare interface CacheQueryOptions {
640
924
  ignoreMethod?: boolean;
641
925
  }
642
926
  declare abstract class Crypto {
927
+ /**
928
+ * Available only in secure contexts.
929
+ *
930
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
931
+ */
643
932
  get subtle(): SubtleCrypto;
933
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */
644
934
  getRandomValues<
645
935
  T extends
646
936
  | Int8Array
@@ -650,8 +940,13 @@ declare abstract class Crypto {
650
940
  | Int32Array
651
941
  | Uint32Array
652
942
  | BigInt64Array
653
- | BigUint64Array
943
+ | BigUint64Array,
654
944
  >(buffer: T): T;
945
+ /**
946
+ * Available only in secure contexts.
947
+ *
948
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)
949
+ */
655
950
  randomUUID(): string;
656
951
  DigestStream: typeof DigestStream;
657
952
  }
@@ -659,59 +954,63 @@ declare abstract class SubtleCrypto {
659
954
  encrypt(
660
955
  algorithm: string | SubtleCryptoEncryptAlgorithm,
661
956
  key: CryptoKey,
662
- plainText: ArrayBuffer | ArrayBufferView
957
+ plainText: ArrayBuffer | ArrayBufferView,
663
958
  ): Promise<ArrayBuffer>;
664
959
  decrypt(
665
960
  algorithm: string | SubtleCryptoEncryptAlgorithm,
666
961
  key: CryptoKey,
667
- cipherText: ArrayBuffer | ArrayBufferView
962
+ cipherText: ArrayBuffer | ArrayBufferView,
668
963
  ): Promise<ArrayBuffer>;
669
964
  sign(
670
965
  algorithm: string | SubtleCryptoSignAlgorithm,
671
966
  key: CryptoKey,
672
- data: ArrayBuffer | ArrayBufferView
967
+ data: ArrayBuffer | ArrayBufferView,
673
968
  ): Promise<ArrayBuffer>;
674
969
  verify(
675
970
  algorithm: string | SubtleCryptoSignAlgorithm,
676
971
  key: CryptoKey,
677
972
  signature: ArrayBuffer | ArrayBufferView,
678
- data: ArrayBuffer | ArrayBufferView
973
+ data: ArrayBuffer | ArrayBufferView,
679
974
  ): Promise<boolean>;
680
975
  digest(
681
976
  algorithm: string | SubtleCryptoHashAlgorithm,
682
- data: ArrayBuffer | ArrayBufferView
977
+ data: ArrayBuffer | ArrayBufferView,
683
978
  ): Promise<ArrayBuffer>;
979
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) */
684
980
  generateKey(
685
981
  algorithm: string | SubtleCryptoGenerateKeyAlgorithm,
686
982
  extractable: boolean,
687
- keyUsages: string[]
983
+ keyUsages: string[],
688
984
  ): Promise<CryptoKey | CryptoKeyPair>;
985
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey) */
689
986
  deriveKey(
690
987
  algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
691
988
  baseKey: CryptoKey,
692
989
  derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
693
990
  extractable: boolean,
694
- keyUsages: string[]
991
+ keyUsages: string[],
695
992
  ): Promise<CryptoKey>;
696
993
  deriveBits(
697
994
  algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
698
995
  baseKey: CryptoKey,
699
- length: number | null
996
+ length: number | null,
700
997
  ): Promise<ArrayBuffer>;
998
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) */
701
999
  importKey(
702
1000
  format: string,
703
1001
  keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey,
704
1002
  algorithm: string | SubtleCryptoImportKeyAlgorithm,
705
1003
  extractable: boolean,
706
- keyUsages: string[]
1004
+ keyUsages: string[],
707
1005
  ): Promise<CryptoKey>;
708
1006
  exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
709
1007
  wrapKey(
710
1008
  format: string,
711
1009
  key: CryptoKey,
712
1010
  wrappingKey: CryptoKey,
713
- wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm
1011
+ wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
714
1012
  ): Promise<ArrayBuffer>;
1013
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey) */
715
1014
  unwrapKey(
716
1015
  format: string,
717
1016
  wrappedKey: ArrayBuffer | ArrayBufferView,
@@ -719,16 +1018,19 @@ declare abstract class SubtleCrypto {
719
1018
  unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
720
1019
  unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm,
721
1020
  extractable: boolean,
722
- keyUsages: string[]
1021
+ keyUsages: string[],
723
1022
  ): Promise<CryptoKey>;
724
1023
  timingSafeEqual(
725
1024
  a: ArrayBuffer | ArrayBufferView,
726
- b: ArrayBuffer | ArrayBufferView
1025
+ b: ArrayBuffer | ArrayBufferView,
727
1026
  ): boolean;
728
1027
  }
729
1028
  declare abstract class CryptoKey {
1029
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) */
730
1030
  readonly type: string;
1031
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable) */
731
1032
  readonly extractable: boolean;
1033
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm) */
732
1034
  readonly algorithm:
733
1035
  | CryptoKeyKeyAlgorithm
734
1036
  | CryptoKeyAesKeyAlgorithm
@@ -736,6 +1038,7 @@ declare abstract class CryptoKey {
736
1038
  | CryptoKeyRsaKeyAlgorithm
737
1039
  | CryptoKeyEllipticKeyAlgorithm
738
1040
  | CryptoKeyArbitraryKeyAlgorithm;
1041
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages) */
739
1042
  readonly usages: string[];
740
1043
  }
741
1044
  declare interface CryptoKeyPair {
@@ -823,7 +1126,7 @@ declare interface CryptoKeyHmacKeyAlgorithm {
823
1126
  declare interface CryptoKeyRsaKeyAlgorithm {
824
1127
  name: string;
825
1128
  modulusLength: number;
826
- publicExponent: ArrayBuffer;
1129
+ publicExponent: ArrayBuffer | (ArrayBuffer | ArrayBufferView);
827
1130
  hash?: CryptoKeyKeyAlgorithm;
828
1131
  }
829
1132
  declare interface CryptoKeyEllipticKeyAlgorithm {
@@ -844,9 +1147,24 @@ declare class DigestStream extends WritableStream<
844
1147
  }
845
1148
  declare class TextDecoder {
846
1149
  constructor(decoder?: string, options?: TextDecoderConstructorOptions);
1150
+ /**
1151
+ * 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.
1152
+ *
1153
+ * ```
1154
+ * var string = "", decoder = new TextDecoder(encoding), buffer;
1155
+ * while(buffer = next_chunk()) {
1156
+ * string += decoder.decode(buffer, {stream:true});
1157
+ * }
1158
+ * string += decoder.decode(); // end-of-queue
1159
+ * ```
1160
+ *
1161
+ * If the error mode is "fatal" and encoding's decoder returns error, throws a TypeError.
1162
+ *
1163
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)
1164
+ */
847
1165
  decode(
848
1166
  input?: ArrayBuffer | ArrayBufferView,
849
- options?: TextDecoderDecodeOptions
1167
+ options?: TextDecoderDecodeOptions,
850
1168
  ): string;
851
1169
  get encoding(): string;
852
1170
  get fatal(): boolean;
@@ -854,8 +1172,21 @@ declare class TextDecoder {
854
1172
  }
855
1173
  declare class TextEncoder {
856
1174
  constructor();
1175
+ /**
1176
+ * Returns the result of running UTF-8's encoder.
1177
+ *
1178
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)
1179
+ */
857
1180
  encode(input?: string): Uint8Array;
858
- encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult;
1181
+ /**
1182
+ * 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.
1183
+ *
1184
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)
1185
+ */
1186
+ encodeInto(
1187
+ input: string,
1188
+ buffer: ArrayBuffer | ArrayBufferView,
1189
+ ): TextEncoderEncodeIntoResult;
859
1190
  get encoding(): string;
860
1191
  }
861
1192
  declare interface TextDecoderConstructorOptions {
@@ -879,17 +1210,20 @@ declare class FormData {
879
1210
  has(name: string): boolean;
880
1211
  set(name: string, value: string): void;
881
1212
  set(name: string, value: Blob, filename?: string): void;
1213
+ /** Returns an array of key, value pairs for every entry in the list. */
882
1214
  entries(): IterableIterator<[key: string, value: File | string]>;
1215
+ /** Returns a list of keys in the list. */
883
1216
  keys(): IterableIterator<string>;
1217
+ /** Returns a list of values in the list. */
884
1218
  values(): IterableIterator<File | string>;
885
1219
  forEach<This = unknown>(
886
1220
  callback: (
887
1221
  this: This,
888
1222
  value: File | string,
889
1223
  key: string,
890
- parent: FormData
1224
+ parent: FormData,
891
1225
  ) => void,
892
- thisArg?: This
1226
+ thisArg?: This,
893
1227
  ): void;
894
1228
  [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>;
895
1229
  }
@@ -900,7 +1234,7 @@ declare class HTMLRewriter {
900
1234
  constructor();
901
1235
  on(
902
1236
  selector: string,
903
- handlers: HTMLRewriterElementContentHandlers
1237
+ handlers: HTMLRewriterElementContentHandlers,
904
1238
  ): HTMLRewriter;
905
1239
  onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;
906
1240
  transform(response: Response): Response;
@@ -967,7 +1301,9 @@ declare interface DocumentEnd {
967
1301
  append(content: string, options?: ContentOptions): DocumentEnd;
968
1302
  }
969
1303
  declare abstract class FetchEvent extends ExtendableEvent {
1304
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request) */
970
1305
  readonly request: Request;
1306
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith) */
971
1307
  respondWith(promise: Response | Promise<Response>): void;
972
1308
  passThroughOnException(): void;
973
1309
  }
@@ -985,10 +1321,13 @@ declare class Headers {
985
1321
  delete(name: string): void;
986
1322
  forEach<This = unknown>(
987
1323
  callback: (this: This, value: string, key: string, parent: Headers) => void,
988
- thisArg?: This
1324
+ thisArg?: This,
989
1325
  ): void;
1326
+ /** Returns an iterator allowing to go through all key/value pairs contained in this object. */
990
1327
  entries(): IterableIterator<[key: string, value: string]>;
1328
+ /** Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */
991
1329
  keys(): IterableIterator<string>;
1330
+ /** Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
992
1331
  values(): IterableIterator<string>;
993
1332
  [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
994
1333
  }
@@ -1011,14 +1350,23 @@ declare abstract class Body {
1011
1350
  }
1012
1351
  declare class Response extends Body {
1013
1352
  constructor(body?: BodyInit | null, init?: ResponseInit);
1353
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirect_static) */
1014
1354
  static redirect(url: string, status?: number): Response;
1355
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/json_static) */
1015
1356
  static json(any: any, maybeInit?: ResponseInit | Response): Response;
1357
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) */
1016
1358
  clone(): Response;
1359
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) */
1017
1360
  get status(): number;
1361
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText) */
1018
1362
  get statusText(): string;
1363
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) */
1019
1364
  get headers(): Headers;
1365
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok) */
1020
1366
  get ok(): boolean;
1367
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected) */
1021
1368
  get redirected(): boolean;
1369
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) */
1022
1370
  get url(): string;
1023
1371
  get webSocket(): WebSocket | null;
1024
1372
  get cf(): any | undefined;
@@ -1033,22 +1381,58 @@ declare interface ResponseInit {
1033
1381
  }
1034
1382
  declare type RequestInfo<
1035
1383
  CfHostMetadata = unknown,
1036
- Cf = CfProperties<CfHostMetadata>
1384
+ Cf = CfProperties<CfHostMetadata>,
1037
1385
  > = Request<CfHostMetadata, Cf> | string | URL;
1038
1386
  declare class Request<
1039
1387
  CfHostMetadata = unknown,
1040
- Cf = CfProperties<CfHostMetadata>
1388
+ Cf = CfProperties<CfHostMetadata>,
1041
1389
  > extends Body {
1042
1390
  constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
1391
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) */
1043
1392
  clone(): Request<CfHostMetadata, Cf>;
1393
+ /**
1394
+ * Returns request's HTTP method, which is "GET" by default.
1395
+ *
1396
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
1397
+ */
1044
1398
  get method(): string;
1399
+ /**
1400
+ * Returns the URL of request as a string.
1401
+ *
1402
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)
1403
+ */
1045
1404
  get url(): string;
1405
+ /**
1406
+ * 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.
1407
+ *
1408
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
1409
+ */
1046
1410
  get headers(): Headers;
1411
+ /**
1412
+ * 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.
1413
+ *
1414
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)
1415
+ */
1047
1416
  get redirect(): string;
1048
1417
  get fetcher(): Fetcher | null;
1418
+ /**
1419
+ * Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.
1420
+ *
1421
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)
1422
+ */
1049
1423
  get signal(): AbortSignal;
1050
1424
  get cf(): Cf | undefined;
1425
+ /**
1426
+ * 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]
1427
+ *
1428
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)
1429
+ */
1051
1430
  get integrity(): string;
1431
+ /**
1432
+ * Returns a boolean indicating whether or not request can outlive the global in which it was created.
1433
+ *
1434
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
1435
+ */
1052
1436
  get keepalive(): boolean;
1053
1437
  }
1054
1438
  declare interface RequestInit<Cf = CfProperties> {
@@ -1067,10 +1451,18 @@ declare interface RequestInit<Cf = CfProperties> {
1067
1451
  /** An AbortSignal to set request's signal. */
1068
1452
  signal?: AbortSignal | null;
1069
1453
  }
1070
- declare abstract class Fetcher {
1454
+ declare type Service<
1455
+ T extends Rpc.WorkerEntrypointBranded | undefined = undefined,
1456
+ > = Fetcher<T>;
1457
+ declare type Fetcher<
1458
+ T extends Rpc.EntrypointBranded | undefined = undefined,
1459
+ Reserved extends string = never,
1460
+ > = (T extends Rpc.EntrypointBranded
1461
+ ? Rpc.Provider<T, Reserved | "fetch" | "connect">
1462
+ : unknown) & {
1071
1463
  fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1072
1464
  connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1073
- }
1465
+ };
1074
1466
  declare interface FetcherPutOptions {
1075
1467
  expiration?: number;
1076
1468
  expirationTtl?: number;
@@ -1085,82 +1477,84 @@ declare type KVNamespaceListResult<Metadata, Key extends string = string> =
1085
1477
  list_complete: false;
1086
1478
  keys: KVNamespaceListKey<Metadata, Key>[];
1087
1479
  cursor: string;
1480
+ cacheStatus: string | null;
1088
1481
  }
1089
1482
  | {
1090
1483
  list_complete: true;
1091
1484
  keys: KVNamespaceListKey<Metadata, Key>[];
1485
+ cacheStatus: string | null;
1092
1486
  };
1093
1487
  declare interface KVNamespace<Key extends string = string> {
1094
1488
  get(
1095
1489
  key: Key,
1096
- options?: Partial<KVNamespaceGetOptions<undefined>>
1490
+ options?: Partial<KVNamespaceGetOptions<undefined>>,
1097
1491
  ): Promise<string | null>;
1098
1492
  get(key: Key, type: "text"): Promise<string | null>;
1099
1493
  get<ExpectedValue = unknown>(
1100
1494
  key: Key,
1101
- type: "json"
1495
+ type: "json",
1102
1496
  ): Promise<ExpectedValue | null>;
1103
1497
  get(key: Key, type: "arrayBuffer"): Promise<ArrayBuffer | null>;
1104
1498
  get(key: Key, type: "stream"): Promise<ReadableStream | null>;
1105
1499
  get(
1106
1500
  key: Key,
1107
- options?: KVNamespaceGetOptions<"text">
1501
+ options?: KVNamespaceGetOptions<"text">,
1108
1502
  ): Promise<string | null>;
1109
1503
  get<ExpectedValue = unknown>(
1110
1504
  key: Key,
1111
- options?: KVNamespaceGetOptions<"json">
1505
+ options?: KVNamespaceGetOptions<"json">,
1112
1506
  ): Promise<ExpectedValue | null>;
1113
1507
  get(
1114
1508
  key: Key,
1115
- options?: KVNamespaceGetOptions<"arrayBuffer">
1509
+ options?: KVNamespaceGetOptions<"arrayBuffer">,
1116
1510
  ): Promise<ArrayBuffer | null>;
1117
1511
  get(
1118
1512
  key: Key,
1119
- options?: KVNamespaceGetOptions<"stream">
1513
+ options?: KVNamespaceGetOptions<"stream">,
1120
1514
  ): Promise<ReadableStream | null>;
1121
1515
  list<Metadata = unknown>(
1122
- options?: KVNamespaceListOptions
1516
+ options?: KVNamespaceListOptions,
1123
1517
  ): Promise<KVNamespaceListResult<Metadata, Key>>;
1124
1518
  put(
1125
1519
  key: Key,
1126
1520
  value: string | ArrayBuffer | ArrayBufferView | ReadableStream,
1127
- options?: KVNamespacePutOptions
1521
+ options?: KVNamespacePutOptions,
1128
1522
  ): Promise<void>;
1129
1523
  getWithMetadata<Metadata = unknown>(
1130
1524
  key: Key,
1131
- options?: Partial<KVNamespaceGetOptions<undefined>>
1525
+ options?: Partial<KVNamespaceGetOptions<undefined>>,
1132
1526
  ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1133
1527
  getWithMetadata<Metadata = unknown>(
1134
1528
  key: Key,
1135
- type: "text"
1529
+ type: "text",
1136
1530
  ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1137
1531
  getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
1138
1532
  key: Key,
1139
- type: "json"
1533
+ type: "json",
1140
1534
  ): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
1141
1535
  getWithMetadata<Metadata = unknown>(
1142
1536
  key: Key,
1143
- type: "arrayBuffer"
1537
+ type: "arrayBuffer",
1144
1538
  ): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
1145
1539
  getWithMetadata<Metadata = unknown>(
1146
1540
  key: Key,
1147
- type: "stream"
1541
+ type: "stream",
1148
1542
  ): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
1149
1543
  getWithMetadata<Metadata = unknown>(
1150
1544
  key: Key,
1151
- options: KVNamespaceGetOptions<"text">
1545
+ options: KVNamespaceGetOptions<"text">,
1152
1546
  ): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;
1153
1547
  getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(
1154
1548
  key: Key,
1155
- options: KVNamespaceGetOptions<"json">
1549
+ options: KVNamespaceGetOptions<"json">,
1156
1550
  ): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
1157
1551
  getWithMetadata<Metadata = unknown>(
1158
1552
  key: Key,
1159
- options: KVNamespaceGetOptions<"arrayBuffer">
1553
+ options: KVNamespaceGetOptions<"arrayBuffer">,
1160
1554
  ): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;
1161
1555
  getWithMetadata<Metadata = unknown>(
1162
1556
  key: Key,
1163
- options: KVNamespaceGetOptions<"stream">
1557
+ options: KVNamespaceGetOptions<"stream">,
1164
1558
  ): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;
1165
1559
  delete(key: Key): Promise<void>;
1166
1560
  }
@@ -1181,32 +1575,49 @@ declare interface KVNamespacePutOptions {
1181
1575
  declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
1182
1576
  value: Value | null;
1183
1577
  metadata: Metadata | null;
1578
+ cacheStatus: string | null;
1579
+ }
1580
+ declare type QueueContentType = "text" | "bytes" | "json" | "v8";
1581
+ declare interface Queue<Body = unknown> {
1582
+ send(message: Body, options?: QueueSendOptions): Promise<void>;
1583
+ sendBatch(
1584
+ messages: Iterable<MessageSendRequest<Body>>,
1585
+ options?: QueueSendBatchOptions,
1586
+ ): Promise<void>;
1184
1587
  }
1185
- declare interface Queue<Body> {
1186
- send(message: Body): Promise<void>;
1187
- sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
1588
+ declare interface QueueSendOptions {
1589
+ contentType?: QueueContentType;
1590
+ delaySeconds?: number;
1591
+ }
1592
+ declare interface QueueSendBatchOptions {
1593
+ delaySeconds?: number;
1188
1594
  }
1189
- declare interface QueueSendOptions {}
1190
1595
  declare interface MessageSendRequest<Body = unknown> {
1191
1596
  body: Body;
1597
+ contentType?: QueueContentType;
1598
+ delaySeconds?: number;
1599
+ }
1600
+ declare interface QueueRetryOptions {
1601
+ delaySeconds?: number;
1192
1602
  }
1193
1603
  declare interface Message<Body = unknown> {
1194
1604
  readonly id: string;
1195
1605
  readonly timestamp: Date;
1196
1606
  readonly body: Body;
1197
- retry(): void;
1607
+ readonly attempts: number;
1608
+ retry(options?: QueueRetryOptions): void;
1198
1609
  ack(): void;
1199
1610
  }
1200
1611
  declare interface QueueEvent<Body = unknown> extends ExtendableEvent {
1201
1612
  readonly messages: readonly Message<Body>[];
1202
1613
  readonly queue: string;
1203
- retryAll(): void;
1614
+ retryAll(options?: QueueRetryOptions): void;
1204
1615
  ackAll(): void;
1205
1616
  }
1206
1617
  declare interface MessageBatch<Body = unknown> {
1207
1618
  readonly messages: readonly Message<Body>[];
1208
1619
  readonly queue: string;
1209
- retryAll(): void;
1620
+ retryAll(options?: QueueRetryOptions): void;
1210
1621
  ackAll(): void;
1211
1622
  }
1212
1623
  declare interface R2Error extends Error {
@@ -1230,7 +1641,7 @@ declare abstract class R2Bucket {
1230
1641
  key: string,
1231
1642
  options: R2GetOptions & {
1232
1643
  onlyIf: R2Conditional | Headers;
1233
- }
1644
+ },
1234
1645
  ): Promise<R2ObjectBody | R2Object | null>;
1235
1646
  get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;
1236
1647
  put(
@@ -1242,8 +1653,10 @@ declare abstract class R2Bucket {
1242
1653
  | string
1243
1654
  | null
1244
1655
  | Blob,
1245
- options?: R2PutOptions
1246
- ): Promise<R2Object>;
1656
+ options?: R2PutOptions & {
1657
+ onlyIf: R2Conditional | Headers;
1658
+ },
1659
+ ): Promise<R2Object | null>;
1247
1660
  put(
1248
1661
  key: string,
1249
1662
  value:
@@ -1253,13 +1666,11 @@ declare abstract class R2Bucket {
1253
1666
  | string
1254
1667
  | null
1255
1668
  | Blob,
1256
- options?: R2PutOptions & {
1257
- onlyIf: R2Conditional | Headers;
1258
- }
1259
- ): Promise<R2Object | null>;
1669
+ options?: R2PutOptions,
1670
+ ): Promise<R2Object>;
1260
1671
  createMultipartUpload(
1261
1672
  key: string,
1262
- options?: R2MultipartOptions
1673
+ options?: R2MultipartOptions,
1263
1674
  ): Promise<R2MultipartUpload>;
1264
1675
  resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;
1265
1676
  delete(keys: string | string[]): Promise<void>;
@@ -1270,7 +1681,7 @@ declare interface R2MultipartUpload {
1270
1681
  readonly uploadId: string;
1271
1682
  uploadPart(
1272
1683
  partNumber: number,
1273
- value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob
1684
+ value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob,
1274
1685
  ): Promise<R2UploadedPart>;
1275
1686
  abort(): Promise<void>;
1276
1687
  complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
@@ -1290,6 +1701,7 @@ declare abstract class R2Object {
1290
1701
  readonly httpMetadata?: R2HTTPMetadata;
1291
1702
  readonly customMetadata?: Record<string, string>;
1292
1703
  readonly range?: R2Range;
1704
+ readonly storageClass: string;
1293
1705
  writeHttpMetadata(headers: Headers): void;
1294
1706
  }
1295
1707
  declare interface R2ObjectBody extends R2Object {
@@ -1332,10 +1744,12 @@ declare interface R2PutOptions {
1332
1744
  sha256?: ArrayBuffer | string;
1333
1745
  sha384?: ArrayBuffer | string;
1334
1746
  sha512?: ArrayBuffer | string;
1747
+ storageClass?: string;
1335
1748
  }
1336
1749
  declare interface R2MultipartOptions {
1337
1750
  httpMetadata?: R2HTTPMetadata | Headers;
1338
1751
  customMetadata?: Record<string, string>;
1752
+ storageClass?: string;
1339
1753
  }
1340
1754
  declare interface R2Checksums {
1341
1755
  readonly md5?: ArrayBuffer;
@@ -1391,7 +1805,7 @@ declare interface UnderlyingSink<W = any> {
1391
1805
  start?: (controller: WritableStreamDefaultController) => void | Promise<void>;
1392
1806
  write?: (
1393
1807
  chunk: W,
1394
- controller: WritableStreamDefaultController
1808
+ controller: WritableStreamDefaultController,
1395
1809
  ) => void | Promise<void>;
1396
1810
  abort?: (reason: any) => void | Promise<void>;
1397
1811
  close?: () => void | Promise<void>;
@@ -1406,26 +1820,29 @@ declare interface UnderlyingByteSource {
1406
1820
  declare interface UnderlyingSource<R = any> {
1407
1821
  type?: "" | undefined;
1408
1822
  start?: (
1409
- controller: ReadableStreamDefaultController<R>
1823
+ controller: ReadableStreamDefaultController<R>,
1410
1824
  ) => void | Promise<void>;
1411
1825
  pull?: (
1412
- controller: ReadableStreamDefaultController<R>
1826
+ controller: ReadableStreamDefaultController<R>,
1413
1827
  ) => void | Promise<void>;
1414
1828
  cancel?: (reason: any) => void | Promise<void>;
1829
+ expectedLength?: number | bigint;
1415
1830
  }
1416
1831
  declare interface Transformer<I = any, O = any> {
1417
1832
  readableType?: string;
1418
1833
  writableType?: string;
1419
1834
  start?: (
1420
- controller: TransformStreamDefaultController<O>
1835
+ controller: TransformStreamDefaultController<O>,
1421
1836
  ) => void | Promise<void>;
1422
1837
  transform?: (
1423
1838
  chunk: I,
1424
- controller: TransformStreamDefaultController<O>
1839
+ controller: TransformStreamDefaultController<O>,
1425
1840
  ) => void | Promise<void>;
1426
1841
  flush?: (
1427
- controller: TransformStreamDefaultController<O>
1842
+ controller: TransformStreamDefaultController<O>,
1428
1843
  ) => void | Promise<void>;
1844
+ cancel?: (reason: any) => void | Promise<void>;
1845
+ expectedLength?: number;
1429
1846
  }
1430
1847
  declare interface StreamPipeOptions {
1431
1848
  /**
@@ -1459,87 +1876,129 @@ declare type ReadableStreamReadResult<R = any> =
1459
1876
  done: true;
1460
1877
  value?: undefined;
1461
1878
  };
1462
- /** 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. */
1879
+ /**
1880
+ * 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.
1881
+ *
1882
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
1883
+ */
1463
1884
  declare interface ReadableStream<R = any> {
1885
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked) */
1464
1886
  get locked(): boolean;
1887
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel) */
1465
1888
  cancel(reason?: any): Promise<void>;
1889
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
1466
1890
  getReader(): ReadableStreamDefaultReader<R>;
1891
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
1467
1892
  getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
1893
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough) */
1468
1894
  pipeThrough<T>(
1469
1895
  transform: ReadableWritablePair<T, R>,
1470
- options?: StreamPipeOptions
1896
+ options?: StreamPipeOptions,
1471
1897
  ): ReadableStream<T>;
1898
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo) */
1472
1899
  pipeTo(
1473
1900
  destination: WritableStream<R>,
1474
- options?: StreamPipeOptions
1901
+ options?: StreamPipeOptions,
1475
1902
  ): Promise<void>;
1903
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee) */
1476
1904
  tee(): [ReadableStream<R>, ReadableStream<R>];
1477
1905
  values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
1478
1906
  [Symbol.asyncIterator](
1479
- options?: ReadableStreamValuesOptions
1907
+ options?: ReadableStreamValuesOptions,
1480
1908
  ): AsyncIterableIterator<R>;
1481
1909
  }
1482
1910
  declare const ReadableStream: {
1483
1911
  prototype: ReadableStream;
1484
1912
  new (
1485
1913
  underlyingSource: UnderlyingByteSource,
1486
- strategy?: QueuingStrategy<Uint8Array>
1914
+ strategy?: QueuingStrategy<Uint8Array>,
1487
1915
  ): ReadableStream<Uint8Array>;
1488
1916
  new <R = any>(
1489
1917
  underlyingSource?: UnderlyingSource<R>,
1490
- strategy?: QueuingStrategy<R>
1918
+ strategy?: QueuingStrategy<R>,
1491
1919
  ): ReadableStream<R>;
1492
1920
  };
1493
1921
  declare class ReadableStreamDefaultReader<R = any> {
1494
1922
  constructor(stream: ReadableStream);
1495
1923
  get closed(): Promise<void>;
1496
1924
  cancel(reason?: any): Promise<void>;
1925
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read) */
1497
1926
  read(): Promise<ReadableStreamReadResult<R>>;
1927
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock) */
1498
1928
  releaseLock(): void;
1499
1929
  }
1500
1930
  declare class ReadableStreamBYOBReader {
1501
1931
  constructor(stream: ReadableStream);
1502
1932
  get closed(): Promise<void>;
1503
1933
  cancel(reason?: any): Promise<void>;
1934
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) */
1504
1935
  read<T extends ArrayBufferView>(
1505
- view: T
1936
+ view: T,
1506
1937
  ): Promise<ReadableStreamReadResult<T>>;
1938
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) */
1507
1939
  releaseLock(): void;
1508
1940
  readAtLeast<T extends ArrayBufferView>(
1509
1941
  minElements: number,
1510
- view: T
1942
+ view: T,
1511
1943
  ): Promise<ReadableStreamReadResult<T>>;
1512
1944
  }
1945
+ declare interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {
1946
+ min?: number;
1947
+ }
1513
1948
  declare interface ReadableStreamGetReaderOptions {
1949
+ /**
1950
+ * Creates a ReadableStreamBYOBReader and locks the stream to the new reader.
1951
+ *
1952
+ * 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.
1953
+ */
1514
1954
  mode: "byob";
1515
1955
  }
1516
1956
  declare abstract class ReadableStreamBYOBRequest {
1517
- readonly view: Uint8Array | null;
1957
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view) */
1958
+ get view(): Uint8Array | null;
1959
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond) */
1518
1960
  respond(bytesWritten: number): void;
1961
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView) */
1519
1962
  respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;
1520
- readonly atLeast: number | null;
1963
+ get atLeast(): number | null;
1521
1964
  }
1522
1965
  declare abstract class ReadableStreamDefaultController<R = any> {
1523
- readonly desiredSize: number | null;
1966
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize) */
1967
+ get desiredSize(): number | null;
1968
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close) */
1524
1969
  close(): void;
1970
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue) */
1525
1971
  enqueue(chunk?: R): void;
1972
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error) */
1526
1973
  error(reason: any): void;
1527
1974
  }
1528
1975
  declare abstract class ReadableByteStreamController {
1529
- readonly byobRequest: ReadableStreamBYOBRequest | null;
1530
- readonly desiredSize: number | null;
1976
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest) */
1977
+ get byobRequest(): ReadableStreamBYOBRequest | null;
1978
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize) */
1979
+ get desiredSize(): number | null;
1980
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close) */
1531
1981
  close(): void;
1982
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue) */
1532
1983
  enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
1984
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error) */
1533
1985
  error(reason: any): void;
1534
1986
  }
1535
1987
  declare abstract class WritableStreamDefaultController {
1536
- readonly signal: AbortSignal;
1988
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal) */
1989
+ get signal(): AbortSignal;
1990
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error) */
1537
1991
  error(reason?: any): void;
1538
1992
  }
1993
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController) */
1539
1994
  declare interface TransformStreamDefaultController<O = any> {
1995
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize) */
1540
1996
  get desiredSize(): number | null;
1997
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue) */
1541
1998
  enqueue(chunk?: O): void;
1999
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error) */
1542
2000
  error(reason: any): void;
2001
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate) */
1543
2002
  terminate(): void;
1544
2003
  }
1545
2004
  declare interface ReadableWritablePair<R = any, W = any> {
@@ -1554,36 +2013,49 @@ declare interface ReadableWritablePair<R = any, W = any> {
1554
2013
  declare class WritableStream<W = any> {
1555
2014
  constructor(
1556
2015
  underlyingSink?: UnderlyingSink,
1557
- queuingStrategy?: QueuingStrategy
2016
+ queuingStrategy?: QueuingStrategy,
1558
2017
  );
2018
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked) */
1559
2019
  get locked(): boolean;
2020
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort) */
1560
2021
  abort(reason?: any): Promise<void>;
2022
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close) */
1561
2023
  close(): Promise<void>;
2024
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter) */
1562
2025
  getWriter(): WritableStreamDefaultWriter<W>;
1563
2026
  }
1564
2027
  declare class WritableStreamDefaultWriter<W = any> {
1565
2028
  constructor(stream: WritableStream);
2029
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed) */
1566
2030
  get closed(): Promise<void>;
2031
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready) */
1567
2032
  get ready(): Promise<void>;
2033
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize) */
1568
2034
  get desiredSize(): number | null;
2035
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort) */
1569
2036
  abort(reason?: any): Promise<void>;
2037
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close) */
1570
2038
  close(): Promise<void>;
2039
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write) */
1571
2040
  write(chunk?: W): Promise<void>;
2041
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock) */
1572
2042
  releaseLock(): void;
1573
2043
  }
1574
2044
  declare class TransformStream<I = any, O = any> {
1575
2045
  constructor(
1576
2046
  transformer?: Transformer<I, O>,
1577
2047
  writableStrategy?: QueuingStrategy<I>,
1578
- readableStrategy?: QueuingStrategy<O>
2048
+ readableStrategy?: QueuingStrategy<O>,
1579
2049
  );
2050
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable) */
1580
2051
  get readable(): ReadableStream<O>;
2052
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable) */
1581
2053
  get writable(): WritableStream<I>;
1582
2054
  }
1583
2055
  declare class FixedLengthStream extends IdentityTransformStream {
1584
2056
  constructor(
1585
2057
  expectedLength: number | bigint,
1586
- queuingStrategy?: IdentityTransformStreamQueuingStrategy
2058
+ queuingStrategy?: IdentityTransformStreamQueuingStrategy,
1587
2059
  );
1588
2060
  }
1589
2061
  declare class IdentityTransformStream extends TransformStream<
@@ -1612,26 +2084,35 @@ declare class DecompressionStream extends TransformStream<
1612
2084
  }
1613
2085
  declare class TextEncoderStream extends TransformStream<string, Uint8Array> {
1614
2086
  constructor();
2087
+ get encoding(): string;
1615
2088
  }
1616
2089
  declare class TextDecoderStream extends TransformStream<
1617
2090
  ArrayBuffer | ArrayBufferView,
1618
2091
  string
1619
2092
  > {
1620
2093
  constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);
2094
+ get encoding(): string;
2095
+ get fatal(): boolean;
2096
+ get ignoreBOM(): boolean;
1621
2097
  }
1622
2098
  declare interface TextDecoderStreamTextDecoderStreamInit {
1623
2099
  fatal?: boolean;
2100
+ ignoreBOM?: boolean;
1624
2101
  }
1625
2102
  declare class ByteLengthQueuingStrategy
1626
2103
  implements QueuingStrategy<ArrayBufferView>
1627
2104
  {
1628
2105
  constructor(init: QueuingStrategyInit);
2106
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark) */
1629
2107
  get highWaterMark(): number;
2108
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */
1630
2109
  get size(): (chunk?: any) => number;
1631
2110
  }
1632
2111
  declare class CountQueuingStrategy implements QueuingStrategy {
1633
2112
  constructor(init: QueuingStrategyInit);
2113
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark) */
1634
2114
  get highWaterMark(): number;
2115
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */
1635
2116
  get size(): (chunk?: any) => number;
1636
2117
  }
1637
2118
  declare interface QueuingStrategyInit {
@@ -1642,6 +2123,11 @@ declare interface QueuingStrategyInit {
1642
2123
  */
1643
2124
  highWaterMark: number;
1644
2125
  }
2126
+ declare interface ScriptVersion {
2127
+ id?: string;
2128
+ tag?: string;
2129
+ message?: string;
2130
+ }
1645
2131
  declare abstract class TailEvent extends ExtendableEvent {
1646
2132
  readonly events: TraceItem[];
1647
2133
  readonly traces: TraceItem[];
@@ -1650,17 +2136,23 @@ declare interface TraceItem {
1650
2136
  readonly event:
1651
2137
  | (
1652
2138
  | TraceItemFetchEventInfo
2139
+ | TraceItemJsRpcEventInfo
1653
2140
  | TraceItemScheduledEventInfo
1654
2141
  | TraceItemAlarmEventInfo
1655
2142
  | TraceItemQueueEventInfo
1656
2143
  | TraceItemEmailEventInfo
2144
+ | TraceItemTailEventInfo
1657
2145
  | TraceItemCustomEventInfo
2146
+ | TraceItemHibernatableWebSocketEventInfo
1658
2147
  )
1659
2148
  | null;
1660
2149
  readonly eventTimestamp: number | null;
1661
2150
  readonly logs: TraceLog[];
1662
2151
  readonly exceptions: TraceException[];
2152
+ readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
1663
2153
  readonly scriptName: string | null;
2154
+ readonly entrypoint?: string;
2155
+ readonly scriptVersion?: ScriptVersion;
1664
2156
  readonly dispatchNamespace?: string;
1665
2157
  readonly scriptTags?: string[];
1666
2158
  readonly outcome: string;
@@ -1682,6 +2174,12 @@ declare interface TraceItemEmailEventInfo {
1682
2174
  readonly rcptTo: string;
1683
2175
  readonly rawSize: number;
1684
2176
  }
2177
+ declare interface TraceItemTailEventInfo {
2178
+ readonly consumedEvents: TraceItemTailEventInfoTailItem[];
2179
+ }
2180
+ declare interface TraceItemTailEventInfoTailItem {
2181
+ readonly scriptName: string | null;
2182
+ }
1685
2183
  declare interface TraceItemFetchEventInfo {
1686
2184
  readonly response?: TraceItemFetchEventInfoResponse;
1687
2185
  readonly request: TraceItemFetchEventInfoRequest;
@@ -1696,6 +2194,26 @@ declare interface TraceItemFetchEventInfoRequest {
1696
2194
  declare interface TraceItemFetchEventInfoResponse {
1697
2195
  readonly status: number;
1698
2196
  }
2197
+ declare interface TraceItemJsRpcEventInfo {
2198
+ readonly rpcMethod: string;
2199
+ }
2200
+ declare interface TraceItemHibernatableWebSocketEventInfo {
2201
+ readonly getWebSocketEvent:
2202
+ | TraceItemHibernatableWebSocketEventInfoMessage
2203
+ | TraceItemHibernatableWebSocketEventInfoClose
2204
+ | TraceItemHibernatableWebSocketEventInfoError;
2205
+ }
2206
+ declare interface TraceItemHibernatableWebSocketEventInfoMessage {
2207
+ readonly webSocketEventType: string;
2208
+ }
2209
+ declare interface TraceItemHibernatableWebSocketEventInfoClose {
2210
+ readonly webSocketEventType: string;
2211
+ readonly code: number;
2212
+ readonly wasClean: boolean;
2213
+ }
2214
+ declare interface TraceItemHibernatableWebSocketEventInfoError {
2215
+ readonly webSocketEventType: string;
2216
+ }
1699
2217
  declare interface TraceLog {
1700
2218
  readonly timestamp: number;
1701
2219
  readonly level: string;
@@ -1705,6 +2223,12 @@ declare interface TraceException {
1705
2223
  readonly timestamp: number;
1706
2224
  readonly message: string;
1707
2225
  readonly name: string;
2226
+ readonly stack?: string;
2227
+ }
2228
+ declare interface TraceDiagnosticChannelEvent {
2229
+ readonly timestamp: number;
2230
+ readonly channel: string;
2231
+ readonly message: any;
1708
2232
  }
1709
2233
  declare interface TraceMetrics {
1710
2234
  readonly cpuTime: number;
@@ -1715,61 +2239,93 @@ declare interface UnsafeTraceMetrics {
1715
2239
  }
1716
2240
  declare class URL {
1717
2241
  constructor(url: string | URL, base?: string | URL);
2242
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin) */
1718
2243
  get origin(): string;
2244
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) */
1719
2245
  get href(): string;
2246
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) */
1720
2247
  set href(value: string);
2248
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) */
1721
2249
  get protocol(): string;
2250
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) */
1722
2251
  set protocol(value: string);
2252
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */
1723
2253
  get username(): string;
2254
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */
1724
2255
  set username(value: string);
2256
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */
1725
2257
  get password(): string;
2258
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */
1726
2259
  set password(value: string);
2260
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */
1727
2261
  get host(): string;
2262
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */
1728
2263
  set host(value: string);
2264
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */
1729
2265
  get hostname(): string;
2266
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */
1730
2267
  set hostname(value: string);
2268
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */
1731
2269
  get port(): string;
2270
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */
1732
2271
  set port(value: string);
2272
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */
1733
2273
  get pathname(): string;
2274
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */
1734
2275
  set pathname(value: string);
2276
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */
1735
2277
  get search(): string;
2278
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */
1736
2279
  set search(value: string);
2280
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */
1737
2281
  get hash(): string;
2282
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */
1738
2283
  set hash(value: string);
2284
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams) */
1739
2285
  get searchParams(): URLSearchParams;
2286
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON) */
1740
2287
  toJSON(): string;
1741
2288
  toString(): string;
2289
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) */
1742
2290
  static canParse(url: string, base?: string): boolean;
2291
+ static parse(url: string, base?: string): URL | null;
1743
2292
  }
1744
2293
  declare class URLSearchParams {
1745
2294
  constructor(
1746
- init?: Iterable<Iterable<string>> | Record<string, string> | string
2295
+ init?: Iterable<Iterable<string>> | Record<string, string> | string,
1747
2296
  );
1748
2297
  get size(): number;
1749
2298
  append(name: string, value: string): void;
1750
- delete(name: string, value?: any): void;
2299
+ delete(name: string): void;
1751
2300
  get(name: string): string | null;
1752
2301
  getAll(name: string): string[];
1753
- has(name: string, value?: any): boolean;
2302
+ has(name: string): boolean;
1754
2303
  set(name: string, value: string): void;
1755
2304
  sort(): void;
2305
+ /** Returns an array of key, value pairs for every entry in the search params. */
1756
2306
  entries(): IterableIterator<[key: string, value: string]>;
2307
+ /** Returns a list of keys in the search params. */
1757
2308
  keys(): IterableIterator<string>;
2309
+ /** Returns a list of values in the search params. */
1758
2310
  values(): IterableIterator<string>;
1759
2311
  forEach<This = unknown>(
1760
2312
  callback: (
1761
2313
  this: This,
1762
2314
  value: string,
1763
2315
  key: string,
1764
- parent: URLSearchParams
2316
+ parent: URLSearchParams,
1765
2317
  ) => void,
1766
- thisArg?: This
2318
+ thisArg?: This,
1767
2319
  ): void;
1768
2320
  toString(): string;
1769
2321
  [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
1770
2322
  }
1771
2323
  declare class URLPattern {
1772
- constructor(input?: string | URLPatternURLPatternInit, baseURL?: string);
2324
+ constructor(
2325
+ input?: string | URLPatternURLPatternInit,
2326
+ baseURL?: string,
2327
+ patternOptions?: URLPatternURLPatternOptions,
2328
+ );
1773
2329
  get protocol(): string;
1774
2330
  get username(): string;
1775
2331
  get password(): string;
@@ -1781,7 +2337,7 @@ declare class URLPattern {
1781
2337
  test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean;
1782
2338
  exec(
1783
2339
  input?: string | URLPatternURLPatternInit,
1784
- baseURL?: string
2340
+ baseURL?: string,
1785
2341
  ): URLPatternURLPatternResult | null;
1786
2342
  }
1787
2343
  declare interface URLPatternURLPatternInit {
@@ -1810,13 +2366,28 @@ declare interface URLPatternURLPatternResult {
1810
2366
  search: URLPatternURLPatternComponentResult;
1811
2367
  hash: URLPatternURLPatternComponentResult;
1812
2368
  }
2369
+ declare interface URLPatternURLPatternOptions {
2370
+ ignoreCase?: boolean;
2371
+ }
1813
2372
  declare class CloseEvent extends Event {
1814
- constructor(type: string, initializer: CloseEventInit);
1815
- /** Returns the WebSocket connection close code provided by the server. */
2373
+ constructor(type: string, initializer?: CloseEventInit);
2374
+ /**
2375
+ * Returns the WebSocket connection close code provided by the server.
2376
+ *
2377
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)
2378
+ */
1816
2379
  readonly code: number;
1817
- /** Returns the WebSocket connection close reason provided by the server. */
2380
+ /**
2381
+ * Returns the WebSocket connection close reason provided by the server.
2382
+ *
2383
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)
2384
+ */
1818
2385
  readonly reason: string;
1819
- /** Returns true if the connection closed cleanly; false otherwise. */
2386
+ /**
2387
+ * Returns true if the connection closed cleanly; false otherwise.
2388
+ *
2389
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)
2390
+ */
1820
2391
  readonly wasClean: boolean;
1821
2392
  }
1822
2393
  declare interface CloseEventInit {
@@ -1831,12 +2402,21 @@ declare class MessageEvent extends Event {
1831
2402
  declare interface MessageEventInit {
1832
2403
  data: ArrayBuffer | string;
1833
2404
  }
1834
- /** Events providing information related to errors in scripts or in files. */
2405
+ /**
2406
+ * Events providing information related to errors in scripts or in files.
2407
+ *
2408
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)
2409
+ */
1835
2410
  declare interface ErrorEvent extends Event {
2411
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename) */
1836
2412
  readonly filename: string;
2413
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message) */
1837
2414
  readonly message: string;
2415
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno) */
1838
2416
  readonly lineno: number;
2417
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno) */
1839
2418
  readonly colno: number;
2419
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error) */
1840
2420
  readonly error: any;
1841
2421
  }
1842
2422
  declare type WebSocketEventMap = {
@@ -1848,17 +2428,51 @@ declare type WebSocketEventMap = {
1848
2428
  declare class WebSocket extends EventTarget<WebSocketEventMap> {
1849
2429
  constructor(url: string, protocols?: string[] | string);
1850
2430
  accept(): void;
2431
+ /**
2432
+ * Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
2433
+ *
2434
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
2435
+ */
1851
2436
  send(message: (ArrayBuffer | ArrayBufferView) | string): void;
2437
+ /**
2438
+ * Closes the WebSocket connection, optionally using code as the the WebSocket connection close code and reason as the the WebSocket connection close reason.
2439
+ *
2440
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)
2441
+ */
1852
2442
  close(code?: number, reason?: string): void;
1853
2443
  serializeAttachment(attachment: any): void;
1854
2444
  deserializeAttachment(): any | null;
1855
2445
  static readonly READY_STATE_CONNECTING: number;
2446
+ static readonly CONNECTING: number;
1856
2447
  static readonly READY_STATE_OPEN: number;
2448
+ static readonly OPEN: number;
1857
2449
  static readonly READY_STATE_CLOSING: number;
2450
+ static readonly CLOSING: number;
1858
2451
  static readonly READY_STATE_CLOSED: number;
2452
+ static readonly CLOSED: number;
2453
+ /**
2454
+ * Returns the state of the WebSocket object's connection. It can have the values described below.
2455
+ *
2456
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)
2457
+ */
1859
2458
  get readyState(): number;
2459
+ /**
2460
+ * Returns the URL that was used to establish the WebSocket connection.
2461
+ *
2462
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)
2463
+ */
1860
2464
  get url(): string | null;
2465
+ /**
2466
+ * 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.
2467
+ *
2468
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)
2469
+ */
1861
2470
  get protocol(): string | null;
2471
+ /**
2472
+ * Returns the extensions selected by the server, if any.
2473
+ *
2474
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
2475
+ */
1862
2476
  get extensions(): string | null;
1863
2477
  }
1864
2478
  declare const WebSocketPair: {
@@ -1871,6 +2485,7 @@ declare interface Socket {
1871
2485
  get readable(): ReadableStream;
1872
2486
  get writable(): WritableStream;
1873
2487
  get closed(): Promise<void>;
2488
+ get opened(): Promise<SocketInfo>;
1874
2489
  close(): Promise<void>;
1875
2490
  startTls(options?: TlsOptions): Socket;
1876
2491
  }
@@ -1885,6 +2500,528 @@ declare interface SocketAddress {
1885
2500
  declare interface TlsOptions {
1886
2501
  expectedServerHostname?: string;
1887
2502
  }
2503
+ declare interface SocketInfo {
2504
+ remoteAddress?: string;
2505
+ localAddress?: string;
2506
+ }
2507
+ declare interface gpuGPU {
2508
+ requestAdapter(
2509
+ param1?: gpuGPURequestAdapterOptions,
2510
+ ): Promise<gpuGPUAdapter | null>;
2511
+ }
2512
+ declare abstract class gpuGPUAdapter {
2513
+ requestDevice(param1?: gpuGPUDeviceDescriptor): Promise<gpuGPUDevice>;
2514
+ requestAdapterInfo(unmaskHints?: string[]): Promise<gpuGPUAdapterInfo>;
2515
+ get features(): gpuGPUSupportedFeatures;
2516
+ get limits(): gpuGPUSupportedLimits;
2517
+ }
2518
+ declare interface gpuGPUDevice extends EventTarget {
2519
+ createBuffer(param1: gpuGPUBufferDescriptor): gpuGPUBuffer;
2520
+ createBindGroupLayout(
2521
+ descriptor: gpuGPUBindGroupLayoutDescriptor,
2522
+ ): gpuGPUBindGroupLayout;
2523
+ createBindGroup(descriptor: gpuGPUBindGroupDescriptor): gpuGPUBindGroup;
2524
+ createSampler(descriptor: gpuGPUSamplerDescriptor): gpuGPUSampler;
2525
+ createShaderModule(
2526
+ descriptor: gpuGPUShaderModuleDescriptor,
2527
+ ): gpuGPUShaderModule;
2528
+ createPipelineLayout(
2529
+ descriptor: gpuGPUPipelineLayoutDescriptor,
2530
+ ): gpuGPUPipelineLayout;
2531
+ createComputePipeline(
2532
+ descriptor: gpuGPUComputePipelineDescriptor,
2533
+ ): gpuGPUComputePipeline;
2534
+ createRenderPipeline(
2535
+ descriptor: gpuGPURenderPipelineDescriptor,
2536
+ ): gpuGPURenderPipeline;
2537
+ createCommandEncoder(
2538
+ descriptor?: gpuGPUCommandEncoderDescriptor,
2539
+ ): gpuGPUCommandEncoder;
2540
+ createTexture(param1: gpuGPUTextureDescriptor): gpuGPUTexture;
2541
+ destroy(): void;
2542
+ createQuerySet(descriptor: gpuGPUQuerySetDescriptor): gpuGPUQuerySet;
2543
+ pushErrorScope(filter: string): void;
2544
+ popErrorScope(): Promise<gpuGPUError | null>;
2545
+ get queue(): gpuGPUQueue;
2546
+ get lost(): Promise<gpuGPUDeviceLostInfo>;
2547
+ get features(): gpuGPUSupportedFeatures;
2548
+ get limits(): gpuGPUSupportedLimits;
2549
+ }
2550
+ declare interface gpuGPUDeviceDescriptor {
2551
+ label?: string;
2552
+ requiredFeatures?: string[];
2553
+ requiredLimits?: Record<string, number | bigint>;
2554
+ defaultQueue?: gpuGPUQueueDescriptor;
2555
+ }
2556
+ declare interface gpuGPUBufferDescriptor {
2557
+ label: string;
2558
+ size: number | bigint;
2559
+ usage: number;
2560
+ mappedAtCreation: boolean;
2561
+ }
2562
+ declare interface gpuGPUQueueDescriptor {
2563
+ label?: string;
2564
+ }
2565
+ declare abstract class gpuGPUBufferUsage {
2566
+ static readonly MAP_READ: number;
2567
+ static readonly MAP_WRITE: number;
2568
+ static readonly COPY_SRC: number;
2569
+ static readonly COPY_DST: number;
2570
+ static readonly INDEX: number;
2571
+ static readonly VERTEX: number;
2572
+ static readonly UNIFORM: number;
2573
+ static readonly STORAGE: number;
2574
+ static readonly INDIRECT: number;
2575
+ static readonly QUERY_RESOLVE: number;
2576
+ }
2577
+ declare interface gpuGPUBuffer {
2578
+ getMappedRange(size?: number | bigint, param2?: number | bigint): ArrayBuffer;
2579
+ unmap(): void;
2580
+ destroy(): void;
2581
+ mapAsync(
2582
+ offset: number,
2583
+ size?: number | bigint,
2584
+ param3?: number | bigint,
2585
+ ): Promise<void>;
2586
+ get size(): number | bigint;
2587
+ get usage(): number;
2588
+ get mapState(): string;
2589
+ }
2590
+ declare abstract class gpuGPUShaderStage {
2591
+ static readonly VERTEX: number;
2592
+ static readonly FRAGMENT: number;
2593
+ static readonly COMPUTE: number;
2594
+ }
2595
+ declare interface gpuGPUBindGroupLayoutDescriptor {
2596
+ label?: string;
2597
+ entries: gpuGPUBindGroupLayoutEntry[];
2598
+ }
2599
+ declare interface gpuGPUBindGroupLayoutEntry {
2600
+ binding: number;
2601
+ visibility: number;
2602
+ buffer?: gpuGPUBufferBindingLayout;
2603
+ sampler?: gpuGPUSamplerBindingLayout;
2604
+ texture?: gpuGPUTextureBindingLayout;
2605
+ storageTexture?: gpuGPUStorageTextureBindingLayout;
2606
+ }
2607
+ declare interface gpuGPUStorageTextureBindingLayout {
2608
+ access?: string;
2609
+ format: string;
2610
+ viewDimension?: string;
2611
+ }
2612
+ declare interface gpuGPUTextureBindingLayout {
2613
+ sampleType?: string;
2614
+ viewDimension?: string;
2615
+ multisampled?: boolean;
2616
+ }
2617
+ declare interface gpuGPUSamplerBindingLayout {
2618
+ type?: string;
2619
+ }
2620
+ declare interface gpuGPUBufferBindingLayout {
2621
+ type?: string;
2622
+ hasDynamicOffset?: boolean;
2623
+ minBindingSize?: number | bigint;
2624
+ }
2625
+ declare interface gpuGPUBindGroupLayout {}
2626
+ declare interface gpuGPUBindGroup {}
2627
+ declare interface gpuGPUBindGroupDescriptor {
2628
+ label?: string;
2629
+ layout: gpuGPUBindGroupLayout;
2630
+ entries: gpuGPUBindGroupEntry[];
2631
+ }
2632
+ declare interface gpuGPUBindGroupEntry {
2633
+ binding: number;
2634
+ resource: gpuGPUBufferBinding | gpuGPUSampler;
2635
+ }
2636
+ declare interface gpuGPUBufferBinding {
2637
+ buffer: gpuGPUBuffer;
2638
+ offset?: number | bigint;
2639
+ size?: number | bigint;
2640
+ }
2641
+ declare interface gpuGPUSampler {}
2642
+ declare interface gpuGPUSamplerDescriptor {
2643
+ label?: string;
2644
+ addressModeU?: string;
2645
+ addressModeV?: string;
2646
+ addressModeW?: string;
2647
+ magFilter?: string;
2648
+ minFilter?: string;
2649
+ mipmapFilter?: string;
2650
+ lodMinClamp?: number;
2651
+ lodMaxClamp?: number;
2652
+ compare: string;
2653
+ maxAnisotropy?: number;
2654
+ }
2655
+ declare interface gpuGPUShaderModule {
2656
+ getCompilationInfo(): Promise<gpuGPUCompilationInfo>;
2657
+ }
2658
+ declare interface gpuGPUShaderModuleDescriptor {
2659
+ label?: string;
2660
+ code: string;
2661
+ }
2662
+ declare interface gpuGPUPipelineLayout {}
2663
+ declare interface gpuGPUPipelineLayoutDescriptor {
2664
+ label?: string;
2665
+ bindGroupLayouts: gpuGPUBindGroupLayout[];
2666
+ }
2667
+ declare interface gpuGPUComputePipeline {
2668
+ getBindGroupLayout(index: number): gpuGPUBindGroupLayout;
2669
+ }
2670
+ declare interface gpuGPUComputePipelineDescriptor {
2671
+ label?: string;
2672
+ compute: gpuGPUProgrammableStage;
2673
+ layout: string | gpuGPUPipelineLayout;
2674
+ }
2675
+ declare interface gpuGPUProgrammableStage {
2676
+ module: gpuGPUShaderModule;
2677
+ entryPoint: string;
2678
+ constants?: Record<string, number>;
2679
+ }
2680
+ declare interface gpuGPUCommandEncoder {
2681
+ get label(): string;
2682
+ beginComputePass(
2683
+ descriptor?: gpuGPUComputePassDescriptor,
2684
+ ): gpuGPUComputePassEncoder;
2685
+ beginRenderPass(
2686
+ descriptor: gpuGPURenderPassDescriptor,
2687
+ ): gpuGPURenderPassEncoder;
2688
+ copyBufferToBuffer(
2689
+ source: gpuGPUBuffer,
2690
+ sourceOffset: number | bigint,
2691
+ destination: gpuGPUBuffer,
2692
+ destinationOffset: number | bigint,
2693
+ size: number | bigint,
2694
+ ): void;
2695
+ finish(param0?: gpuGPUCommandBufferDescriptor): gpuGPUCommandBuffer;
2696
+ copyTextureToBuffer(
2697
+ source: gpuGPUImageCopyTexture,
2698
+ destination: gpuGPUImageCopyBuffer,
2699
+ copySize: Iterable<number> | gpuGPUExtent3DDict,
2700
+ ): void;
2701
+ copyBufferToTexture(
2702
+ source: gpuGPUImageCopyBuffer,
2703
+ destination: gpuGPUImageCopyTexture,
2704
+ copySize: Iterable<number> | gpuGPUExtent3DDict,
2705
+ ): void;
2706
+ copyTextureToTexture(
2707
+ source: gpuGPUImageCopyTexture,
2708
+ destination: gpuGPUImageCopyTexture,
2709
+ copySize: Iterable<number> | gpuGPUExtent3DDict,
2710
+ ): void;
2711
+ clearBuffer(
2712
+ buffer: gpuGPUBuffer,
2713
+ offset?: number | bigint,
2714
+ size?: number | bigint,
2715
+ ): void;
2716
+ }
2717
+ declare interface gpuGPUCommandEncoderDescriptor {
2718
+ label?: string;
2719
+ }
2720
+ declare interface gpuGPUComputePassEncoder {
2721
+ setPipeline(pipeline: gpuGPUComputePipeline): void;
2722
+ setBindGroup(
2723
+ index: number,
2724
+ bindGroup: gpuGPUBindGroup | null,
2725
+ dynamicOffsets?: Iterable<number>,
2726
+ ): void;
2727
+ dispatchWorkgroups(
2728
+ workgroupCountX: number,
2729
+ workgroupCountY?: number,
2730
+ workgroupCountZ?: number,
2731
+ ): void;
2732
+ end(): void;
2733
+ }
2734
+ declare interface gpuGPUComputePassDescriptor {
2735
+ label?: string;
2736
+ timestampWrites?: gpuGPUComputePassTimestampWrites;
2737
+ }
2738
+ declare interface gpuGPUQuerySet {}
2739
+ declare interface gpuGPUQuerySetDescriptor {
2740
+ label?: string;
2741
+ }
2742
+ declare interface gpuGPUComputePassTimestampWrites {
2743
+ querySet: gpuGPUQuerySet;
2744
+ beginningOfPassWriteIndex?: number;
2745
+ endOfPassWriteIndex?: number;
2746
+ }
2747
+ declare interface gpuGPUCommandBufferDescriptor {
2748
+ label?: string;
2749
+ }
2750
+ declare interface gpuGPUCommandBuffer {}
2751
+ declare interface gpuGPUQueue {
2752
+ submit(commandBuffers: gpuGPUCommandBuffer[]): void;
2753
+ writeBuffer(
2754
+ buffer: gpuGPUBuffer,
2755
+ bufferOffset: number | bigint,
2756
+ data: ArrayBuffer | ArrayBufferView,
2757
+ dataOffset?: number | bigint,
2758
+ size?: number | bigint,
2759
+ ): void;
2760
+ }
2761
+ declare abstract class gpuGPUMapMode {
2762
+ static readonly READ: number;
2763
+ static readonly WRITE: number;
2764
+ }
2765
+ declare interface gpuGPURequestAdapterOptions {
2766
+ powerPreference: string;
2767
+ forceFallbackAdapter?: boolean;
2768
+ }
2769
+ declare interface gpuGPUAdapterInfo {
2770
+ get vendor(): string;
2771
+ get architecture(): string;
2772
+ get device(): string;
2773
+ get description(): string;
2774
+ }
2775
+ declare interface gpuGPUSupportedFeatures {
2776
+ has(name: string): boolean;
2777
+ keys(): string[];
2778
+ }
2779
+ declare interface gpuGPUSupportedLimits {
2780
+ get maxTextureDimension1D(): number;
2781
+ get maxTextureDimension2D(): number;
2782
+ get maxTextureDimension3D(): number;
2783
+ get maxTextureArrayLayers(): number;
2784
+ get maxBindGroups(): number;
2785
+ get maxBindingsPerBindGroup(): number;
2786
+ get maxDynamicUniformBuffersPerPipelineLayout(): number;
2787
+ get maxDynamicStorageBuffersPerPipelineLayout(): number;
2788
+ get maxSampledTexturesPerShaderStage(): number;
2789
+ get maxSamplersPerShaderStage(): number;
2790
+ get maxStorageBuffersPerShaderStage(): number;
2791
+ get maxStorageTexturesPerShaderStage(): number;
2792
+ get maxUniformBuffersPerShaderStage(): number;
2793
+ get maxUniformBufferBindingSize(): number | bigint;
2794
+ get maxStorageBufferBindingSize(): number | bigint;
2795
+ get minUniformBufferOffsetAlignment(): number;
2796
+ get minStorageBufferOffsetAlignment(): number;
2797
+ get maxVertexBuffers(): number;
2798
+ get maxBufferSize(): number | bigint;
2799
+ get maxVertexAttributes(): number;
2800
+ get maxVertexBufferArrayStride(): number;
2801
+ get maxInterStageShaderComponents(): number;
2802
+ get maxInterStageShaderVariables(): number;
2803
+ get maxColorAttachments(): number;
2804
+ get maxColorAttachmentBytesPerSample(): number;
2805
+ get maxComputeWorkgroupStorageSize(): number;
2806
+ get maxComputeInvocationsPerWorkgroup(): number;
2807
+ get maxComputeWorkgroupSizeX(): number;
2808
+ get maxComputeWorkgroupSizeY(): number;
2809
+ get maxComputeWorkgroupSizeZ(): number;
2810
+ get maxComputeWorkgroupsPerDimension(): number;
2811
+ }
2812
+ declare abstract class gpuGPUError {
2813
+ get message(): string;
2814
+ }
2815
+ declare abstract class gpuGPUOutOfMemoryError extends gpuGPUError {}
2816
+ declare abstract class gpuGPUInternalError extends gpuGPUError {}
2817
+ declare abstract class gpuGPUValidationError extends gpuGPUError {}
2818
+ declare abstract class gpuGPUDeviceLostInfo {
2819
+ get message(): string;
2820
+ get reason(): string;
2821
+ }
2822
+ declare interface gpuGPUCompilationMessage {
2823
+ get message(): string;
2824
+ get type(): string;
2825
+ get lineNum(): number;
2826
+ get linePos(): number;
2827
+ get offset(): number;
2828
+ get length(): number;
2829
+ }
2830
+ declare interface gpuGPUCompilationInfo {
2831
+ get messages(): gpuGPUCompilationMessage[];
2832
+ }
2833
+ declare abstract class gpuGPUTextureUsage {
2834
+ static readonly COPY_SRC: number;
2835
+ static readonly COPY_DST: number;
2836
+ static readonly TEXTURE_BINDING: number;
2837
+ static readonly STORAGE_BINDING: number;
2838
+ static readonly RENDER_ATTACHMENT: number;
2839
+ }
2840
+ declare interface gpuGPUTextureDescriptor {
2841
+ label: string;
2842
+ size: number[] | gpuGPUExtent3DDict;
2843
+ mipLevelCount?: number;
2844
+ sampleCount?: number;
2845
+ dimension?: string;
2846
+ format: string;
2847
+ usage: number;
2848
+ viewFormats?: string[];
2849
+ }
2850
+ declare interface gpuGPUExtent3DDict {
2851
+ width: number;
2852
+ height?: number;
2853
+ depthOrArrayLayers?: number;
2854
+ }
2855
+ declare interface gpuGPUTexture {
2856
+ createView(descriptor?: gpuGPUTextureViewDescriptor): gpuGPUTextureView;
2857
+ destroy(): void;
2858
+ get width(): number;
2859
+ get height(): number;
2860
+ get depthOrArrayLayers(): number;
2861
+ get mipLevelCount(): number;
2862
+ get dimension(): string;
2863
+ get format(): string;
2864
+ get usage(): number;
2865
+ }
2866
+ declare interface gpuGPUTextureView {}
2867
+ declare interface gpuGPUTextureViewDescriptor {
2868
+ label: string;
2869
+ format: string;
2870
+ dimension: string;
2871
+ aspect?: string;
2872
+ baseMipLevel?: number;
2873
+ mipLevelCount: number;
2874
+ baseArrayLayer?: number;
2875
+ arrayLayerCount: number;
2876
+ }
2877
+ declare abstract class gpuGPUColorWrite {
2878
+ static readonly RED: number;
2879
+ static readonly GREEN: number;
2880
+ static readonly BLUE: number;
2881
+ static readonly ALPHA: number;
2882
+ static readonly ALL: number;
2883
+ }
2884
+ declare interface gpuGPURenderPipeline {}
2885
+ declare interface gpuGPURenderPipelineDescriptor {
2886
+ label?: string;
2887
+ layout: string | gpuGPUPipelineLayout;
2888
+ vertex: gpuGPUVertexState;
2889
+ primitive?: gpuGPUPrimitiveState;
2890
+ depthStencil?: gpuGPUDepthStencilState;
2891
+ multisample?: gpuGPUMultisampleState;
2892
+ fragment?: gpuGPUFragmentState;
2893
+ }
2894
+ declare interface gpuGPUVertexState {
2895
+ module: gpuGPUShaderModule;
2896
+ entryPoint: string;
2897
+ constants?: Record<string, number>;
2898
+ buffers?: gpuGPUVertexBufferLayout[];
2899
+ }
2900
+ declare interface gpuGPUVertexBufferLayout {
2901
+ arrayStride: number | bigint;
2902
+ stepMode?: string;
2903
+ attributes: gpuGPUVertexAttribute[];
2904
+ }
2905
+ declare interface gpuGPUVertexAttribute {
2906
+ format: string;
2907
+ offset: number | bigint;
2908
+ shaderLocation: number;
2909
+ }
2910
+ declare interface gpuGPUPrimitiveState {
2911
+ topology?: string;
2912
+ stripIndexFormat?: string;
2913
+ frontFace?: string;
2914
+ cullMode?: string;
2915
+ unclippedDepth?: boolean;
2916
+ }
2917
+ declare interface gpuGPUStencilFaceState {
2918
+ compare?: string;
2919
+ failOp?: string;
2920
+ depthFailOp?: string;
2921
+ passOp?: string;
2922
+ }
2923
+ declare interface gpuGPUDepthStencilState {
2924
+ format: string;
2925
+ depthWriteEnabled: boolean;
2926
+ depthCompare: string;
2927
+ stencilFront?: gpuGPUStencilFaceState;
2928
+ stencilBack?: gpuGPUStencilFaceState;
2929
+ stencilReadMask?: number;
2930
+ stencilWriteMask?: number;
2931
+ depthBias?: number;
2932
+ depthBiasSlopeScale?: number;
2933
+ depthBiasClamp?: number;
2934
+ }
2935
+ declare interface gpuGPUMultisampleState {
2936
+ count?: number;
2937
+ mask?: number;
2938
+ alphaToCoverageEnabled?: boolean;
2939
+ }
2940
+ declare interface gpuGPUFragmentState {
2941
+ module: gpuGPUShaderModule;
2942
+ entryPoint: string;
2943
+ constants?: Record<string, number>;
2944
+ targets: gpuGPUColorTargetState[];
2945
+ }
2946
+ declare interface gpuGPUColorTargetState {
2947
+ format: string;
2948
+ blend: gpuGPUBlendState;
2949
+ writeMask?: number;
2950
+ }
2951
+ declare interface gpuGPUBlendState {
2952
+ color: gpuGPUBlendComponent;
2953
+ alpha: gpuGPUBlendComponent;
2954
+ }
2955
+ declare interface gpuGPUBlendComponent {
2956
+ operation?: string;
2957
+ srcFactor?: string;
2958
+ dstFactor?: string;
2959
+ }
2960
+ declare interface gpuGPURenderPassEncoder {
2961
+ setPipeline(pipeline: gpuGPURenderPipeline): void;
2962
+ draw(
2963
+ vertexCount: number,
2964
+ instanceCount?: number,
2965
+ firstVertex?: number,
2966
+ firstInstance?: number,
2967
+ ): void;
2968
+ end(): void;
2969
+ }
2970
+ declare interface gpuGPURenderPassDescriptor {
2971
+ label?: string;
2972
+ colorAttachments: gpuGPURenderPassColorAttachment[];
2973
+ depthStencilAttachment?: gpuGPURenderPassDepthStencilAttachment;
2974
+ occlusionQuerySet?: gpuGPUQuerySet;
2975
+ timestampWrites?: gpuGPURenderPassTimestampWrites;
2976
+ maxDrawCount?: number | bigint;
2977
+ }
2978
+ declare interface gpuGPURenderPassColorAttachment {
2979
+ view: gpuGPUTextureView;
2980
+ depthSlice?: number;
2981
+ resolveTarget?: gpuGPUTextureView;
2982
+ clearValue?: number[] | gpuGPUColorDict;
2983
+ loadOp: string;
2984
+ storeOp: string;
2985
+ }
2986
+ declare interface gpuGPUColorDict {
2987
+ r: number;
2988
+ g: number;
2989
+ b: number;
2990
+ a: number;
2991
+ }
2992
+ declare interface gpuGPURenderPassDepthStencilAttachment {
2993
+ view: gpuGPUTextureView;
2994
+ depthClearValue?: number;
2995
+ depthLoadOp?: string;
2996
+ depthStoreOp?: string;
2997
+ depthReadOnly?: boolean;
2998
+ stencilClearValue?: number;
2999
+ stencilLoadOp?: string;
3000
+ stencilStoreOp?: string;
3001
+ stencilReadOnly?: boolean;
3002
+ }
3003
+ declare interface gpuGPURenderPassTimestampWrites {
3004
+ querySet: gpuGPUQuerySet;
3005
+ beginningOfPassWriteIndex?: number;
3006
+ endOfPassWriteIndex?: number;
3007
+ }
3008
+ declare interface gpuGPUImageCopyTexture {
3009
+ texture: gpuGPUTexture;
3010
+ mipLevel?: number;
3011
+ origin?: number[] | gpuGPUOrigin3DDict;
3012
+ aspect?: string;
3013
+ }
3014
+ declare interface gpuGPUImageCopyBuffer {
3015
+ buffer: gpuGPUBuffer;
3016
+ offset?: number | bigint;
3017
+ bytesPerRow?: number;
3018
+ rowsPerImage?: number;
3019
+ }
3020
+ declare interface gpuGPUOrigin3DDict {
3021
+ x?: number;
3022
+ y?: number;
3023
+ z?: number;
3024
+ }
1888
3025
  declare interface BasicImageTransformations {
1889
3026
  /**
1890
3027
  * Maximum width in image pixels. The value must be an integer.
@@ -2324,7 +3461,7 @@ declare interface IncomingRequestCfPropertiesBotManagementEnterprise
2324
3461
  };
2325
3462
  }
2326
3463
  declare interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<
2327
- HostMetadata
3464
+ HostMetadata,
2328
3465
  > {
2329
3466
  /**
2330
3467
  * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/).
@@ -2856,25 +3993,51 @@ declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
2856
3993
  declare type CfProperties<HostMetadata = unknown> =
2857
3994
  | IncomingRequestCfProperties<HostMetadata>
2858
3995
  | RequestInitCfProperties;
2859
- declare interface D1Result<T = unknown> {
2860
- results?: T[];
2861
- success: boolean;
2862
- error?: string;
2863
- meta: any;
3996
+ declare interface D1Meta {
3997
+ duration: number;
3998
+ size_after: number;
3999
+ rows_read: number;
4000
+ rows_written: number;
4001
+ last_row_id: number;
4002
+ changed_db: boolean;
4003
+ changes: number;
4004
+ }
4005
+ declare interface D1Response {
4006
+ success: true;
4007
+ meta: D1Meta & Record<string, unknown>;
4008
+ error?: never;
4009
+ }
4010
+ declare type D1Result<T = unknown> = D1Response & {
4011
+ results: T[];
4012
+ };
4013
+ declare interface D1ExecResult {
4014
+ count: number;
4015
+ duration: number;
2864
4016
  }
2865
4017
  declare abstract class D1Database {
2866
4018
  prepare(query: string): D1PreparedStatement;
2867
4019
  dump(): Promise<ArrayBuffer>;
2868
4020
  batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
2869
- exec<T = unknown>(query: string): Promise<D1Result<T>>;
4021
+ exec(query: string): Promise<D1ExecResult>;
2870
4022
  }
2871
4023
  declare abstract class D1PreparedStatement {
2872
- bind(...values: any[]): D1PreparedStatement;
2873
- first<T = unknown>(colName?: string): Promise<T>;
2874
- run<T = unknown>(): Promise<D1Result<T>>;
2875
- all<T = unknown>(): Promise<D1Result<T>>;
2876
- raw<T = unknown>(): Promise<T[]>;
2877
- }
4024
+ bind(...values: unknown[]): D1PreparedStatement;
4025
+ first<T = unknown>(colName: string): Promise<T | null>;
4026
+ first<T = Record<string, unknown>>(): Promise<T | null>;
4027
+ run(): Promise<D1Response>;
4028
+ all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4029
+ raw<T = unknown[]>(options: {
4030
+ columnNames: true;
4031
+ }): Promise<[string[], ...T[]]>;
4032
+ raw<T = unknown[]>(options?: { columnNames?: false }): Promise<T[]>;
4033
+ }
4034
+ // `Disposable` was added to TypeScript's standard lib types in version 5.2.
4035
+ // To support older TypeScript versions, define an empty `Disposable` interface.
4036
+ // Users won't be able to use `using`/`Symbol.dispose` without upgrading to 5.2,
4037
+ // but this will ensure type checking on older versions still passes.
4038
+ // TypeScript's interface merging will ensure our empty interface is effectively
4039
+ // ignored when `Disposable` is included in the standard lib.
4040
+ declare interface Disposable {}
2878
4041
  /**
2879
4042
  * An email message that can be sent from a Worker.
2880
4043
  */
@@ -2895,7 +4058,7 @@ declare interface ForwardableEmailMessage extends EmailMessage {
2895
4058
  /**
2896
4059
  * Stream of the email message content.
2897
4060
  */
2898
- readonly raw: ReadableStream;
4061
+ readonly raw: ReadableStream<Uint8Array>;
2899
4062
  /**
2900
4063
  * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
2901
4064
  */
@@ -2930,7 +4093,7 @@ declare abstract class EmailEvent extends ExtendableEvent {
2930
4093
  declare type EmailExportedHandler<Env = unknown> = (
2931
4094
  message: ForwardableEmailMessage,
2932
4095
  env: Env,
2933
- ctx: ExecutionContext
4096
+ ctx: ExecutionContext,
2934
4097
  ) => void | Promise<void>;
2935
4098
  declare module "cloudflare:email" {
2936
4099
  let _EmailMessage: {
@@ -2939,9 +4102,56 @@ declare module "cloudflare:email" {
2939
4102
  };
2940
4103
  export { _EmailMessage as EmailMessage };
2941
4104
  }
4105
+ declare interface Hyperdrive {
4106
+ /**
4107
+ * Connect directly to Hyperdrive as if it's your database, returning a TCP socket.
4108
+ *
4109
+ * Calling this method returns an idential socket to if you call
4110
+ * `connect("host:port")` using the `host` and `port` fields from this object.
4111
+ * Pick whichever approach works better with your preferred DB client library.
4112
+ *
4113
+ * Note that this socket is not yet authenticated -- it's expected that your
4114
+ * code (or preferably, the client library of your choice) will authenticate
4115
+ * using the information in this class's readonly fields.
4116
+ */
4117
+ connect(): Socket;
4118
+ /**
4119
+ * A valid DB connection string that can be passed straight into the typical
4120
+ * client library/driver/ORM. This will typically be the easiest way to use
4121
+ * Hyperdrive.
4122
+ */
4123
+ readonly connectionString: string;
4124
+ /*
4125
+ * A randomly generated hostname that is only valid within the context of the
4126
+ * currently running Worker which, when passed into `connect()` function from
4127
+ * the "cloudflare:sockets" module, will connect to the Hyperdrive instance
4128
+ * for your database.
4129
+ */
4130
+ readonly host: string;
4131
+ /*
4132
+ * The port that must be paired the the host field when connecting.
4133
+ */
4134
+ readonly port: number;
4135
+ /*
4136
+ * The username to use when authenticating to your database via Hyperdrive.
4137
+ * Unlike the host and password, this will be the same every time
4138
+ */
4139
+ readonly user: string;
4140
+ /*
4141
+ * The randomly generated password to use when authenticating to your
4142
+ * database via Hyperdrive. Like the host field, this password is only valid
4143
+ * within the context of the currently running Worker instance from which
4144
+ * it's read.
4145
+ */
4146
+ readonly password: string;
4147
+ /*
4148
+ * The name of the database to connect to.
4149
+ */
4150
+ readonly database: string;
4151
+ }
2942
4152
  declare type Params<P extends string = any> = Record<P, string | string[]>;
2943
4153
  declare type EventContext<Env, P extends string, Data> = {
2944
- request: Request;
4154
+ request: Request<unknown, IncomingRequestCfProperties<unknown>>;
2945
4155
  functionPath: string;
2946
4156
  waitUntil: (promise: Promise<any>) => void;
2947
4157
  passThroughOnException: () => void;
@@ -2957,10 +4167,10 @@ declare type EventContext<Env, P extends string, Data> = {
2957
4167
  declare type PagesFunction<
2958
4168
  Env = unknown,
2959
4169
  Params extends string = any,
2960
- Data extends Record<string, unknown> = Record<string, unknown>
4170
+ Data extends Record<string, unknown> = Record<string, unknown>,
2961
4171
  > = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;
2962
4172
  declare type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
2963
- request: Request;
4173
+ request: Request<unknown, IncomingRequestCfProperties<unknown>>;
2964
4174
  functionPath: string;
2965
4175
  waitUntil: (promise: Promise<any>) => void;
2966
4176
  passThroughOnException: () => void;
@@ -2978,17 +4188,17 @@ declare type PagesPluginFunction<
2978
4188
  Env = unknown,
2979
4189
  Params extends string = any,
2980
4190
  Data extends Record<string, unknown> = Record<string, unknown>,
2981
- PluginArgs = unknown
4191
+ PluginArgs = unknown,
2982
4192
  > = (
2983
- context: EventPluginContext<Env, Params, Data, PluginArgs>
4193
+ context: EventPluginContext<Env, Params, Data, PluginArgs>,
2984
4194
  ) => Response | Promise<Response>;
2985
4195
  declare module "assets:*" {
2986
4196
  export const onRequest: PagesFunction;
2987
4197
  }
2988
- // https://developers.cloudflare.com/pub-sub/
2989
4198
  // PubSubMessage represents an incoming PubSub message.
2990
4199
  // The message includes metadata about the broker, the client, and the payload
2991
4200
  // itself.
4201
+ // https://developers.cloudflare.com/pub-sub/
2992
4202
  declare interface PubSubMessage {
2993
4203
  // Message ID
2994
4204
  readonly mid: number;
@@ -3019,14 +4229,376 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
3019
4229
  // Key Identifier of the JWK
3020
4230
  readonly kid: string;
3021
4231
  }
4232
+ // Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need
4233
+ // to referenced by `Fetcher`. This is included in the "importable" version of the types which
4234
+ // strips all `module` blocks.
4235
+ declare namespace Rpc {
4236
+ // Branded types for identifying `WorkerEntrypoint`/`DurableObject`/`Target`s.
4237
+ // TypeScript uses *structural* typing meaning anything with the same shape as type `T` is a `T`.
4238
+ // For the classes exported by `cloudflare:workers` we want *nominal* typing (i.e. we only want to
4239
+ // accept `WorkerEntrypoint` from `cloudflare:workers`, not any other class with the same shape)
4240
+ export const __RPC_STUB_BRAND: "__RPC_STUB_BRAND";
4241
+ export const __RPC_TARGET_BRAND: "__RPC_TARGET_BRAND";
4242
+ export const __WORKER_ENTRYPOINT_BRAND: "__WORKER_ENTRYPOINT_BRAND";
4243
+ export const __DURABLE_OBJECT_BRAND: "__DURABLE_OBJECT_BRAND";
4244
+ export interface RpcTargetBranded {
4245
+ [__RPC_TARGET_BRAND]: never;
4246
+ }
4247
+ export interface WorkerEntrypointBranded {
4248
+ [__WORKER_ENTRYPOINT_BRAND]: never;
4249
+ }
4250
+ export interface DurableObjectBranded {
4251
+ [__DURABLE_OBJECT_BRAND]: never;
4252
+ }
4253
+ export type EntrypointBranded =
4254
+ | WorkerEntrypointBranded
4255
+ | DurableObjectBranded;
4256
+ // Types that can be used through `Stub`s
4257
+ export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
4258
+ // Types that can be passed over RPC
4259
+ type Serializable =
4260
+ // Structured cloneables
4261
+ | void
4262
+ | undefined
4263
+ | null
4264
+ | boolean
4265
+ | number
4266
+ | bigint
4267
+ | string
4268
+ | TypedArray
4269
+ | ArrayBuffer
4270
+ | DataView
4271
+ | Date
4272
+ | Error
4273
+ | RegExp
4274
+ // Structured cloneable composites
4275
+ | Map<Serializable, Serializable>
4276
+ | Set<Serializable>
4277
+ | ReadonlyArray<Serializable>
4278
+ | {
4279
+ [key: string | number]: Serializable;
4280
+ }
4281
+ // Special types
4282
+ | ReadableStream<Uint8Array>
4283
+ | WritableStream<Uint8Array>
4284
+ | Request
4285
+ | Response
4286
+ | Headers
4287
+ | Stub<Stubable>
4288
+ // Serialized as stubs, see `Stubify`
4289
+ | Stubable;
4290
+ // Base type for all RPC stubs, including common memory management methods.
4291
+ // `T` is used as a marker type for unwrapping `Stub`s later.
4292
+ interface StubBase<T extends Stubable> extends Disposable {
4293
+ [__RPC_STUB_BRAND]: T;
4294
+ dup(): this;
4295
+ }
4296
+ export type Stub<T extends Stubable> = Provider<T> & StubBase<T>;
4297
+ // Recursively rewrite all `Stubable` types with `Stub`s
4298
+ type Stubify<T> = T extends Stubable
4299
+ ? Stub<T>
4300
+ : T extends Map<infer K, infer V>
4301
+ ? Map<Stubify<K>, Stubify<V>>
4302
+ : T extends Set<infer V>
4303
+ ? Set<Stubify<V>>
4304
+ : T extends Array<infer V>
4305
+ ? Array<Stubify<V>>
4306
+ : T extends ReadonlyArray<infer V>
4307
+ ? ReadonlyArray<Stubify<V>>
4308
+ : T extends {
4309
+ [key: string | number]: unknown;
4310
+ }
4311
+ ? {
4312
+ [K in keyof T]: Stubify<T[K]>;
4313
+ }
4314
+ : T;
4315
+ // Recursively rewrite all `Stub<T>`s with the corresponding `T`s.
4316
+ // Note we use `StubBase` instead of `Stub` here to avoid circular dependencies:
4317
+ // `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`.
4318
+ type Unstubify<T> =
4319
+ T extends StubBase<infer V>
4320
+ ? V
4321
+ : T extends Map<infer K, infer V>
4322
+ ? Map<Unstubify<K>, Unstubify<V>>
4323
+ : T extends Set<infer V>
4324
+ ? Set<Unstubify<V>>
4325
+ : T extends Array<infer V>
4326
+ ? Array<Unstubify<V>>
4327
+ : T extends ReadonlyArray<infer V>
4328
+ ? ReadonlyArray<Unstubify<V>>
4329
+ : T extends {
4330
+ [key: string | number]: unknown;
4331
+ }
4332
+ ? {
4333
+ [K in keyof T]: Unstubify<T[K]>;
4334
+ }
4335
+ : T;
4336
+ type UnstubifyAll<A extends any[]> = {
4337
+ [I in keyof A]: Unstubify<A[I]>;
4338
+ };
4339
+ // Utility type for adding `Provider`/`Disposable`s to `object` types only.
4340
+ // Note `unknown & T` is equivalent to `T`.
4341
+ type MaybeProvider<T> = T extends object ? Provider<T> : unknown;
4342
+ type MaybeDisposable<T> = T extends object ? Disposable : unknown;
4343
+ // Type for method return or property on an RPC interface.
4344
+ // - Stubable types are replaced by stubs.
4345
+ // - Serializable types are passed by value, with stubable types replaced by stubs
4346
+ // and a top-level `Disposer`.
4347
+ // Everything else can't be passed over PRC.
4348
+ // Technically, we use custom thenables here, but they quack like `Promise`s.
4349
+ // Intersecting with `(Maybe)Provider` allows pipelining.
4350
+ type Result<R> = R extends Stubable
4351
+ ? Promise<Stub<R>> & Provider<R>
4352
+ : R extends Serializable
4353
+ ? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R>
4354
+ : never;
4355
+ // Type for method or property on an RPC interface.
4356
+ // For methods, unwrap `Stub`s in parameters, and rewrite returns to be `Result`s.
4357
+ // Unwrapping `Stub`s allows calling with `Stubable` arguments.
4358
+ // For properties, rewrite types to be `Result`s.
4359
+ // In each case, unwrap `Promise`s.
4360
+ type MethodOrProperty<V> = V extends (...args: infer P) => infer R
4361
+ ? (...args: UnstubifyAll<P>) => Result<Awaited<R>>
4362
+ : Result<Awaited<V>>;
4363
+ // Type for the callable part of an `Provider` if `T` is callable.
4364
+ // This is intersected with methods/properties.
4365
+ type MaybeCallableProvider<T> = T extends (...args: any[]) => any
4366
+ ? MethodOrProperty<T>
4367
+ : unknown;
4368
+ // Base type for all other types providing RPC-like interfaces.
4369
+ // Rewrites all methods/properties to be `MethodOrProperty`s, while preserving callable types.
4370
+ // `Reserved` names (e.g. stub method names like `dup()`) and symbols can't be accessed over RPC.
4371
+ export type Provider<
4372
+ T extends object,
4373
+ Reserved extends string = never,
4374
+ > = MaybeCallableProvider<T> & {
4375
+ [K in Exclude<
4376
+ keyof T,
4377
+ Reserved | symbol | keyof StubBase<never>
4378
+ >]: MethodOrProperty<T[K]>;
4379
+ };
4380
+ }
4381
+ declare module "cloudflare:workers" {
4382
+ export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;
4383
+ export const RpcStub: {
4384
+ new <T extends Rpc.Stubable>(value: T): Rpc.Stub<T>;
4385
+ };
4386
+ export abstract class RpcTarget implements Rpc.RpcTargetBranded {
4387
+ [Rpc.__RPC_TARGET_BRAND]: never;
4388
+ }
4389
+ // `protected` fields don't appear in `keyof`s, so can't be accessed over RPC
4390
+ export abstract class WorkerEntrypoint<Env = unknown>
4391
+ implements Rpc.WorkerEntrypointBranded
4392
+ {
4393
+ [Rpc.__WORKER_ENTRYPOINT_BRAND]: never;
4394
+ protected ctx: ExecutionContext;
4395
+ protected env: Env;
4396
+ constructor(ctx: ExecutionContext, env: Env);
4397
+ fetch?(request: Request): Response | Promise<Response>;
4398
+ tail?(events: TraceItem[]): void | Promise<void>;
4399
+ trace?(traces: TraceItem[]): void | Promise<void>;
4400
+ scheduled?(controller: ScheduledController): void | Promise<void>;
4401
+ queue?(batch: MessageBatch<unknown>): void | Promise<void>;
4402
+ test?(controller: TestController): void | Promise<void>;
4403
+ }
4404
+ export abstract class DurableObject<Env = unknown>
4405
+ implements Rpc.DurableObjectBranded
4406
+ {
4407
+ [Rpc.__DURABLE_OBJECT_BRAND]: never;
4408
+ protected ctx: DurableObjectState;
4409
+ protected env: Env;
4410
+ constructor(ctx: DurableObjectState, env: Env);
4411
+ fetch?(request: Request): Response | Promise<Response>;
4412
+ alarm?(): void | Promise<void>;
4413
+ webSocketMessage?(
4414
+ ws: WebSocket,
4415
+ message: string | ArrayBuffer,
4416
+ ): void | Promise<void>;
4417
+ webSocketClose?(
4418
+ ws: WebSocket,
4419
+ code: number,
4420
+ reason: string,
4421
+ wasClean: boolean,
4422
+ ): void | Promise<void>;
4423
+ webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
4424
+ }
4425
+ }
3022
4426
  declare module "cloudflare:sockets" {
3023
4427
  function _connect(
3024
4428
  address: string | SocketAddress,
3025
- options?: SocketOptions
4429
+ options?: SocketOptions,
3026
4430
  ): Socket;
3027
4431
  export { _connect as connect };
3028
4432
  }
3029
- // https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
4433
+ // Copyright (c) 2022-2023 Cloudflare, Inc.
4434
+ // Licensed under the Apache 2.0 license found in the LICENSE file or at:
4435
+ // https://opensource.org/licenses/Apache-2.0
4436
+ /**
4437
+ * Data types supported for holding vector metadata.
4438
+ */
4439
+ declare type VectorizeVectorMetadataValue =
4440
+ | string
4441
+ | number
4442
+ | boolean
4443
+ | string[];
4444
+ /**
4445
+ * Additional information to associate with a vector.
4446
+ */
4447
+ declare type VectorizeVectorMetadata =
4448
+ | VectorizeVectorMetadataValue
4449
+ | Record<string, VectorizeVectorMetadataValue>;
4450
+ declare type VectorFloatArray = Float32Array | Float64Array;
4451
+ declare interface VectorizeError {
4452
+ code?: number;
4453
+ error: string;
4454
+ }
4455
+ /**
4456
+ * Comparison logic/operation to use for metadata filtering.
4457
+ *
4458
+ * This list is expected to grow as support for more operations are released.
4459
+ */
4460
+ declare type VectorizeVectorMetadataFilterOp = "$eq" | "$ne";
4461
+ /**
4462
+ * Filter criteria for vector metadata used to limit the retrieved query result set.
4463
+ */
4464
+ declare type VectorizeVectorMetadataFilter = {
4465
+ [field: string]:
4466
+ | Exclude<VectorizeVectorMetadataValue, string[]>
4467
+ | null
4468
+ | {
4469
+ [Op in VectorizeVectorMetadataFilterOp]?: Exclude<
4470
+ VectorizeVectorMetadataValue,
4471
+ string[]
4472
+ > | null;
4473
+ };
4474
+ };
4475
+ /**
4476
+ * Supported distance metrics for an index.
4477
+ * Distance metrics determine how other "similar" vectors are determined.
4478
+ */
4479
+ declare type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
4480
+ declare interface VectorizeQueryOptions {
4481
+ topK?: number;
4482
+ namespace?: string;
4483
+ returnValues?: boolean;
4484
+ returnMetadata?: boolean;
4485
+ filter?: VectorizeVectorMetadataFilter;
4486
+ }
4487
+ /**
4488
+ * Information about the configuration of an index.
4489
+ */
4490
+ declare type VectorizeIndexConfig =
4491
+ | {
4492
+ dimensions: number;
4493
+ metric: VectorizeDistanceMetric;
4494
+ }
4495
+ | {
4496
+ preset: string; // keep this generic, as we'll be adding more presets in the future and this is only in a read capacity
4497
+ };
4498
+ /**
4499
+ * Metadata about an existing index.
4500
+ */
4501
+ declare interface VectorizeIndexDetails {
4502
+ /** The unique ID of the index */
4503
+ readonly id: string;
4504
+ /** The name of the index. */
4505
+ name: string;
4506
+ /** (optional) A human readable description for the index. */
4507
+ description?: string;
4508
+ /** The index configuration, including the dimension size and distance metric. */
4509
+ config: VectorizeIndexConfig;
4510
+ /** The number of records containing vectors within the index. */
4511
+ vectorsCount: number;
4512
+ }
4513
+ /**
4514
+ * Represents a single vector value set along with its associated metadata.
4515
+ */
4516
+ declare interface VectorizeVector {
4517
+ /** The ID for the vector. This can be user-defined, and must be unique. It should uniquely identify the object, and is best set based on the ID of what the vector represents. */
4518
+ id: string;
4519
+ /** The vector values */
4520
+ values: VectorFloatArray | number[];
4521
+ /** The namespace this vector belongs to. */
4522
+ namespace?: string;
4523
+ /** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
4524
+ metadata?: Record<string, VectorizeVectorMetadata>;
4525
+ }
4526
+ /**
4527
+ * Represents a matched vector for a query along with its score and (if specified) the matching vector information.
4528
+ */
4529
+ declare type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
4530
+ Omit<VectorizeVector, "values"> & {
4531
+ /** The score or rank for similarity, when returned as a result */
4532
+ score: number;
4533
+ };
4534
+ /**
4535
+ * A set of vector {@link VectorizeMatch} for a particular query.
4536
+ */
4537
+ declare interface VectorizeMatches {
4538
+ matches: VectorizeMatch[];
4539
+ count: number;
4540
+ }
4541
+ /**
4542
+ * Results of an operation that performed a mutation on a set of vectors.
4543
+ * Here, `ids` is a list of vectors that were successfully processed.
4544
+ */
4545
+ declare interface VectorizeVectorMutation {
4546
+ /* List of ids of vectors that were successfully processed. */
4547
+ ids: string[];
4548
+ /* Total count of the number of processed vectors. */
4549
+ count: number;
4550
+ }
4551
+ declare abstract class VectorizeIndex {
4552
+ /**
4553
+ * Get information about the currently bound index.
4554
+ * @returns A promise that resolves with information about the current index.
4555
+ */
4556
+ public describe(): Promise<VectorizeIndexDetails>;
4557
+ /**
4558
+ * Use the provided vector to perform a similarity search across the index.
4559
+ * @param vector Input vector that will be used to drive the similarity search.
4560
+ * @param options Configuration options to massage the returned data.
4561
+ * @returns A promise that resolves with matched and scored vectors.
4562
+ */
4563
+ public query(
4564
+ vector: VectorFloatArray | number[],
4565
+ options: VectorizeQueryOptions,
4566
+ ): Promise<VectorizeMatches>;
4567
+ /**
4568
+ * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
4569
+ * @param vectors List of vectors that will be inserted.
4570
+ * @returns A promise that resolves with the ids & count of records that were successfully processed.
4571
+ */
4572
+ public insert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;
4573
+ /**
4574
+ * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
4575
+ * @param vectors List of vectors that will be upserted.
4576
+ * @returns A promise that resolves with the ids & count of records that were successfully processed.
4577
+ */
4578
+ public upsert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;
4579
+ /**
4580
+ * Delete a list of vectors with a matching id.
4581
+ * @param ids List of vector ids that should be deleted.
4582
+ * @returns A promise that resolves with the ids & count of records that were successfully processed (and thus deleted).
4583
+ */
4584
+ public deleteByIds(ids: string[]): Promise<VectorizeVectorMutation>;
4585
+ /**
4586
+ * Get a list of vectors with a matching id.
4587
+ * @param ids List of vector ids that should be returned.
4588
+ * @returns A promise that resolves with the raw unscored vectors matching the id set.
4589
+ */
4590
+ public getByIds(ids: string[]): Promise<VectorizeVector[]>;
4591
+ }
4592
+ /**
4593
+ * The interface for "version_metadata" binding
4594
+ * providing metadata about the Worker Version using this binding.
4595
+ */
4596
+ declare type WorkerVersionMetadata = {
4597
+ /** The ID of the Worker Version using this binding */
4598
+ id: string;
4599
+ /** The tag of the Worker Version using this binding */
4600
+ tag: string;
4601
+ };
3030
4602
  declare interface DynamicDispatchLimits {
3031
4603
  /**
3032
4604
  * Limit CPU time in milliseconds.
@@ -3062,6 +4634,6 @@ declare interface DispatchNamespace {
3062
4634
  args?: {
3063
4635
  [key: string]: any;
3064
4636
  },
3065
- options?: DynamicDispatchOptions
4637
+ options?: DynamicDispatchOptions,
3066
4638
  ): Fetcher;
3067
4639
  }