@cloudflare/workers-types 0.20230518.0 → 0.20240405.1

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