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