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