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