@cloudflare/workers-types 0.20240405.1 → 0.20250124.2

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.
@@ -14,11 +14,17 @@ and limitations under the License.
14
14
  ***************************************************************************** */
15
15
  /* eslint-disable */
16
16
  // noinspection JSUnusedGlobalSymbols
17
+ export declare var onmessage: never;
18
+ /**
19
+ * An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API.
20
+ *
21
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
22
+ */
17
23
  export declare class DOMException extends Error {
18
24
  constructor(message?: string, name?: string);
19
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */
25
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */
20
26
  readonly message: string;
21
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */
27
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */
22
28
  readonly name: string;
23
29
  /**
24
30
  * @deprecated
@@ -26,7 +32,6 @@ export declare class DOMException extends Error {
26
32
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
27
33
  */
28
34
  readonly code: number;
29
- readonly stack: any;
30
35
  static readonly INDEX_SIZE_ERR: number;
31
36
  static readonly DOMSTRING_SIZE_ERR: number;
32
37
  static readonly HIERARCHY_REQUEST_ERR: number;
@@ -52,6 +57,8 @@ export declare class DOMException extends Error {
52
57
  static readonly TIMEOUT_ERR: number;
53
58
  static readonly INVALID_NODE_TYPE_ERR: number;
54
59
  static readonly DATA_CLONE_ERR: number;
60
+ get stack(): any;
61
+ set stack(value: any);
55
62
  }
56
63
  export type WorkerGlobalScopeEventMap = {
57
64
  fetch: FetchEvent;
@@ -63,45 +70,45 @@ export type WorkerGlobalScopeEventMap = {
63
70
  export declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {
64
71
  EventTarget: typeof EventTarget;
65
72
  }
66
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console) */
73
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console) */
67
74
  export interface Console {
68
75
  "assert"(condition?: boolean, ...data: any[]): void;
69
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static) */
76
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static) */
70
77
  clear(): void;
71
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static) */
78
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static) */
72
79
  count(label?: string): void;
73
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static) */
80
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static) */
74
81
  countReset(label?: string): void;
75
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static) */
82
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static) */
76
83
  debug(...data: any[]): void;
77
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static) */
84
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static) */
78
85
  dir(item?: any, options?: any): void;
79
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static) */
86
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static) */
80
87
  dirxml(...data: any[]): void;
81
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static) */
88
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static) */
82
89
  error(...data: any[]): void;
83
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static) */
90
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static) */
84
91
  group(...data: any[]): void;
85
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static) */
92
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static) */
86
93
  groupCollapsed(...data: any[]): void;
87
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static) */
94
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static) */
88
95
  groupEnd(): void;
89
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static) */
96
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static) */
90
97
  info(...data: any[]): void;
91
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static) */
98
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static) */
92
99
  log(...data: any[]): void;
93
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static) */
100
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static) */
94
101
  table(tabularData?: any, properties?: string[]): void;
95
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static) */
102
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static) */
96
103
  time(label?: string): void;
97
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static) */
104
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static) */
98
105
  timeEnd(label?: string): void;
99
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static) */
106
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static) */
100
107
  timeLog(label?: string, ...data: any[]): void;
101
108
  timeStamp(label?: string): void;
102
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static) */
109
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static) */
103
110
  trace(...data: any[]): void;
104
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static) */
111
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static) */
105
112
  warn(...data: any[]): void;
106
113
  }
107
114
  export declare const console: Console;
@@ -194,6 +201,7 @@ export declare namespace WebAssembly {
194
201
  }
195
202
  /**
196
203
  * This ServiceWorker API interface represents the global execution context of a service worker.
204
+ * Available only in secure contexts.
197
205
  *
198
206
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope)
199
207
  */
@@ -218,8 +226,9 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
218
226
  clearInterval(timeoutId: number | null): void;
219
227
  queueMicrotask(task: Function): void;
220
228
  structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
229
+ reportError(error: any): void;
221
230
  fetch(
222
- input: RequestInfo,
231
+ input: RequestInfo | URL,
223
232
  init?: RequestInit<RequestInitCfProperties>,
224
233
  ): Promise<Response>;
225
234
  self: ServiceWorkerGlobalScope;
@@ -227,6 +236,7 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
227
236
  caches: CacheStorage;
228
237
  scheduler: Scheduler;
229
238
  performance: Performance;
239
+ Cloudflare: Cloudflare;
230
240
  readonly origin: string;
231
241
  Event: typeof Event;
232
242
  ExtendableEvent: typeof ExtendableEvent;
@@ -246,6 +256,8 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
246
256
  TransformStream: typeof TransformStream;
247
257
  ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;
248
258
  CountQueuingStrategy: typeof CountQueuingStrategy;
259
+ ErrorEvent: typeof ErrorEvent;
260
+ EventSource: typeof EventSource;
249
261
  CompressionStream: typeof CompressionStream;
250
262
  DecompressionStream: typeof DecompressionStream;
251
263
  TextEncoderStream: typeof TextEncoderStream;
@@ -275,16 +287,16 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
275
287
  FixedLengthStream: typeof FixedLengthStream;
276
288
  IdentityTransformStream: typeof IdentityTransformStream;
277
289
  HTMLRewriter: typeof HTMLRewriter;
278
- GPUAdapter: typeof gpuGPUAdapter;
279
- GPUOutOfMemoryError: typeof gpuGPUOutOfMemoryError;
280
- GPUValidationError: typeof gpuGPUValidationError;
281
- GPUInternalError: typeof gpuGPUInternalError;
282
- GPUDeviceLostInfo: typeof gpuGPUDeviceLostInfo;
283
- GPUBufferUsage: typeof gpuGPUBufferUsage;
284
- GPUShaderStage: typeof gpuGPUShaderStage;
285
- GPUMapMode: typeof gpuGPUMapMode;
286
- GPUTextureUsage: typeof gpuGPUTextureUsage;
287
- GPUColorWrite: typeof gpuGPUColorWrite;
290
+ GPUAdapter: typeof GPUAdapter;
291
+ GPUOutOfMemoryError: typeof GPUOutOfMemoryError;
292
+ GPUValidationError: typeof GPUValidationError;
293
+ GPUInternalError: typeof GPUInternalError;
294
+ GPUDeviceLostInfo: typeof GPUDeviceLostInfo;
295
+ GPUBufferUsage: typeof GPUBufferUsage;
296
+ GPUShaderStage: typeof GPUShaderStage;
297
+ GPUMapMode: typeof GPUMapMode;
298
+ GPUTextureUsage: typeof GPUTextureUsage;
299
+ GPUColorWrite: typeof GPUColorWrite;
288
300
  }
289
301
  export declare function addEventListener<
290
302
  Type extends keyof WorkerGlobalScopeEventMap,
@@ -308,58 +320,81 @@ export declare function removeEventListener<
308
320
  export declare function dispatchEvent(
309
321
  event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap],
310
322
  ): boolean;
311
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/btoa) */
323
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/btoa) */
312
324
  export declare function btoa(data: string): string;
313
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/atob) */
325
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/atob) */
314
326
  export declare function atob(data: string): string;
315
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
327
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
316
328
  export declare function setTimeout(
317
329
  callback: (...args: any[]) => void,
318
330
  msDelay?: number,
319
331
  ): number;
320
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
332
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
321
333
  export declare function setTimeout<Args extends any[]>(
322
334
  callback: (...args: Args) => void,
323
335
  msDelay?: number,
324
336
  ...args: Args
325
337
  ): number;
326
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearTimeout) */
338
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearTimeout) */
327
339
  export declare function clearTimeout(timeoutId: number | null): void;
328
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
340
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
329
341
  export declare function setInterval(
330
342
  callback: (...args: any[]) => void,
331
343
  msDelay?: number,
332
344
  ): number;
333
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
345
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
334
346
  export declare function setInterval<Args extends any[]>(
335
347
  callback: (...args: Args) => void,
336
348
  msDelay?: number,
337
349
  ...args: Args
338
350
  ): number;
339
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearInterval) */
351
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearInterval) */
340
352
  export declare function clearInterval(timeoutId: number | null): void;
341
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/queueMicrotask) */
353
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/queueMicrotask) */
342
354
  export declare function queueMicrotask(task: Function): void;
343
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/structuredClone) */
355
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/structuredClone) */
344
356
  export declare function structuredClone<T>(
345
357
  value: T,
346
358
  options?: StructuredSerializeOptions,
347
359
  ): T;
348
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
360
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/reportError) */
361
+ export declare function reportError(error: any): void;
362
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
349
363
  export declare function fetch(
350
- input: RequestInfo,
364
+ input: RequestInfo | URL,
351
365
  init?: RequestInit<RequestInitCfProperties>,
352
366
  ): Promise<Response>;
353
367
  export declare const self: ServiceWorkerGlobalScope;
368
+ /**
369
+ * The Web Crypto API provides a set of low-level functions for common cryptographic tasks.
370
+ * The Workers runtime implements the full surface of this API, but with some differences in
371
+ * the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)
372
+ * compared to those implemented in most browsers.
373
+ *
374
+ * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)
375
+ */
354
376
  export declare const crypto: Crypto;
377
+ /**
378
+ * The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
379
+ *
380
+ * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)
381
+ */
355
382
  export declare const caches: CacheStorage;
356
383
  export declare const scheduler: Scheduler;
384
+ /**
385
+ * The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
386
+ * as well as timing of subrequests and other operations.
387
+ *
388
+ * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
389
+ */
357
390
  export declare const performance: Performance;
391
+ export declare const Cloudflare: Cloudflare;
358
392
  export declare const origin: string;
359
393
  export interface TestController {}
360
394
  export interface ExecutionContext {
361
395
  waitUntil(promise: Promise<any>): void;
362
396
  passThroughOnException(): void;
397
+ props: any;
363
398
  }
364
399
  export type ExportedHandlerFetchHandler<
365
400
  Env = unknown,
@@ -379,6 +414,11 @@ export type ExportedHandlerTraceHandler<Env = unknown> = (
379
414
  env: Env,
380
415
  ctx: ExecutionContext,
381
416
  ) => void | Promise<void>;
417
+ export type ExportedHandlerTailStreamHandler<Env = unknown> = (
418
+ event: TailStream.TailEvent,
419
+ env: Env,
420
+ ctx: ExecutionContext,
421
+ ) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
382
422
  export type ExportedHandlerScheduledHandler<Env = unknown> = (
383
423
  controller: ScheduledController,
384
424
  env: Env,
@@ -402,6 +442,7 @@ export interface ExportedHandler<
402
442
  fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
403
443
  tail?: ExportedHandlerTailHandler<Env>;
404
444
  trace?: ExportedHandlerTraceHandler<Env>;
445
+ tailStream?: ExportedHandlerTailStreamHandler<Env>;
405
446
  scheduled?: ExportedHandlerScheduledHandler<Env>;
406
447
  test?: ExportedHandlerTestHandler<Env>;
407
448
  email?: EmailExportedHandler<Env>;
@@ -410,30 +451,35 @@ export interface ExportedHandler<
410
451
  export interface StructuredSerializeOptions {
411
452
  transfer?: any[];
412
453
  }
454
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent) */
413
455
  export declare abstract class PromiseRejectionEvent extends Event {
414
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise) */
456
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise) */
415
457
  readonly promise: Promise<any>;
416
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason) */
458
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason) */
417
459
  readonly reason: any;
418
460
  }
419
461
  /**
420
- * 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.
462
+ * The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
463
+ * as well as timing of subrequests and other operations.
421
464
  *
422
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance)
465
+ * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
423
466
  */
424
467
  export interface Performance {
425
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/timeOrigin) */
468
+ /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */
426
469
  readonly timeOrigin: number;
427
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/now) */
470
+ /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
428
471
  now(): number;
429
472
  }
430
473
  export interface AlarmInvocationInfo {
431
474
  readonly isRetry: boolean;
432
475
  readonly retryCount: number;
433
476
  }
477
+ export interface Cloudflare {
478
+ readonly compatibilityFlags: Record<string, boolean>;
479
+ }
434
480
  export interface DurableObject {
435
481
  fetch(request: Request): Response | Promise<Response>;
436
- alarm?(): void | Promise<void>;
482
+ alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
437
483
  webSocketMessage?(
438
484
  ws: WebSocket,
439
485
  message: string | ArrayBuffer,
@@ -506,6 +552,7 @@ export interface DurableObjectState {
506
552
  setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
507
553
  getHibernatableWebSocketEventTimeout(): number | null;
508
554
  getTags(ws: WebSocket): string[];
555
+ abort(reason?: string): void;
509
556
  }
510
557
  export interface DurableObjectTransaction {
511
558
  get<T = unknown>(
@@ -572,7 +619,11 @@ export interface DurableObjectStorage {
572
619
  ): Promise<void>;
573
620
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
574
621
  sync(): Promise<void>;
622
+ sql: SqlStorage;
575
623
  transactionSync<T>(closure: () => T): T;
624
+ getCurrentBookmark(): Promise<string>;
625
+ getBookmarkForTime(timestamp: number | Date): Promise<string>;
626
+ onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
576
627
  }
577
628
  export interface DurableObjectListOptions {
578
629
  start?: string;
@@ -613,6 +664,11 @@ export interface AnalyticsEngineDataPoint {
613
664
  doubles?: number[];
614
665
  blobs?: ((ArrayBuffer | string) | null)[];
615
666
  }
667
+ /**
668
+ * An event which takes place in the DOM.
669
+ *
670
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)
671
+ */
616
672
  export declare class Event {
617
673
  constructor(type: string, init?: EventInit);
618
674
  /**
@@ -730,6 +786,11 @@ export interface EventListenerObject<EventType extends Event = Event> {
730
786
  export type EventListenerOrEventListenerObject<
731
787
  EventType extends Event = Event,
732
788
  > = EventListener<EventType> | EventListenerObject<EventType>;
789
+ /**
790
+ * EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them.
791
+ *
792
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)
793
+ */
733
794
  export declare class EventTarget<
734
795
  EventMap extends Record<string, Event> = Record<string, Event>,
735
796
  > {
@@ -785,6 +846,11 @@ export interface EventTargetAddEventListenerOptions {
785
846
  export interface EventTargetHandlerObject {
786
847
  handleEvent: (event: Event) => any | undefined;
787
848
  }
849
+ /**
850
+ * A controller object that allows you to abort one or more DOM requests as and when desired.
851
+ *
852
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController)
853
+ */
788
854
  export declare class AbortController {
789
855
  constructor();
790
856
  /**
@@ -800,11 +866,17 @@ export declare class AbortController {
800
866
  */
801
867
  abort(reason?: any): void;
802
868
  }
869
+ /**
870
+ * A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object.
871
+ *
872
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal)
873
+ */
803
874
  export declare abstract class AbortSignal extends EventTarget {
804
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) */
875
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) */
805
876
  static abort(reason?: any): AbortSignal;
806
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static) */
877
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static) */
807
878
  static timeout(delay: number): AbortSignal;
879
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static) */
808
880
  static any(signals: AbortSignal[]): AbortSignal;
809
881
  /**
810
882
  * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
@@ -812,13 +884,13 @@ export declare abstract class AbortSignal extends EventTarget {
812
884
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)
813
885
  */
814
886
  readonly aborted: boolean;
815
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason) */
887
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason) */
816
888
  readonly reason: any;
817
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
889
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
818
890
  get onabort(): any | null;
819
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
891
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
820
892
  set onabort(value: any | null);
821
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted) */
893
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted) */
822
894
  throwIfAborted(): void;
823
895
  }
824
896
  export interface Scheduler {
@@ -827,10 +899,16 @@ export interface Scheduler {
827
899
  export interface SchedulerWaitOptions {
828
900
  signal?: AbortSignal;
829
901
  }
902
+ /**
903
+ * Extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries.
904
+ *
905
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)
906
+ */
830
907
  export declare abstract class ExtendableEvent extends Event {
831
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil) */
908
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil) */
832
909
  waitUntil(promise: Promise<any>): void;
833
910
  }
911
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent) */
834
912
  export declare class CustomEvent<T = any> extends Event {
835
913
  constructor(type: string, init?: CustomEventCustomEventInit);
836
914
  /**
@@ -846,58 +924,93 @@ export interface CustomEventCustomEventInit {
846
924
  composed?: boolean;
847
925
  detail?: any;
848
926
  }
927
+ /**
928
+ * A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system.
929
+ *
930
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob)
931
+ */
849
932
  export declare class Blob {
850
933
  constructor(
851
- bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[],
934
+ type?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[],
852
935
  options?: BlobOptions,
853
936
  );
854
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
937
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
855
938
  readonly size: number;
856
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
939
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
857
940
  readonly type: string;
858
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
941
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
859
942
  slice(start?: number, end?: number, type?: string): Blob;
860
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) */
943
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) */
861
944
  arrayBuffer(): Promise<ArrayBuffer>;
862
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
945
+ bytes(): Promise<Uint8Array>;
946
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
863
947
  text(): Promise<string>;
864
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream) */
948
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream) */
865
949
  stream(): ReadableStream;
866
950
  }
867
951
  export interface BlobOptions {
868
952
  type?: string;
869
953
  }
954
+ /**
955
+ * Provides information about files and allows JavaScript in a web page to access their content.
956
+ *
957
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File)
958
+ */
870
959
  export declare class File extends Blob {
871
960
  constructor(
872
961
  bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined,
873
962
  name: string,
874
963
  options?: FileOptions,
875
964
  );
876
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
965
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
877
966
  readonly name: string;
878
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
967
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
879
968
  readonly lastModified: number;
880
969
  }
881
970
  export interface FileOptions {
882
971
  type?: string;
883
972
  lastModified?: number;
884
973
  }
974
+ /**
975
+ * The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
976
+ *
977
+ * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)
978
+ */
885
979
  export declare abstract class CacheStorage {
886
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open) */
980
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open) */
887
981
  open(cacheName: string): Promise<Cache>;
888
982
  readonly default: Cache;
889
983
  }
984
+ /**
985
+ * The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.
986
+ *
987
+ * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)
988
+ */
890
989
  export declare abstract class Cache {
891
- delete(request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>;
990
+ /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */
991
+ delete(
992
+ request: RequestInfo | URL,
993
+ options?: CacheQueryOptions,
994
+ ): Promise<boolean>;
995
+ /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */
892
996
  match(
893
- request: RequestInfo,
997
+ request: RequestInfo | URL,
894
998
  options?: CacheQueryOptions,
895
999
  ): Promise<Response | undefined>;
896
- put(request: RequestInfo, response: Response): Promise<void>;
1000
+ /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */
1001
+ put(request: RequestInfo | URL, response: Response): Promise<void>;
897
1002
  }
898
1003
  export interface CacheQueryOptions {
899
1004
  ignoreMethod?: boolean;
900
1005
  }
1006
+ /**
1007
+ * The Web Crypto API provides a set of low-level functions for common cryptographic tasks.
1008
+ * The Workers runtime implements the full surface of this API, but with some differences in
1009
+ * the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)
1010
+ * compared to those implemented in most browsers.
1011
+ *
1012
+ * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)
1013
+ */
901
1014
  export declare abstract class Crypto {
902
1015
  /**
903
1016
  * Available only in secure contexts.
@@ -905,7 +1018,7 @@ export declare abstract class Crypto {
905
1018
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
906
1019
  */
907
1020
  readonly subtle: SubtleCrypto;
908
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */
1021
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */
909
1022
  getRandomValues<
910
1023
  T extends
911
1024
  | Int8Array
@@ -925,39 +1038,50 @@ export declare abstract class Crypto {
925
1038
  randomUUID(): string;
926
1039
  DigestStream: typeof DigestStream;
927
1040
  }
1041
+ /**
1042
+ * This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto).
1043
+ * Available only in secure contexts.
1044
+ *
1045
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto)
1046
+ */
928
1047
  export declare abstract class SubtleCrypto {
1048
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt) */
929
1049
  encrypt(
930
1050
  algorithm: string | SubtleCryptoEncryptAlgorithm,
931
1051
  key: CryptoKey,
932
1052
  plainText: ArrayBuffer | ArrayBufferView,
933
1053
  ): Promise<ArrayBuffer>;
1054
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt) */
934
1055
  decrypt(
935
1056
  algorithm: string | SubtleCryptoEncryptAlgorithm,
936
1057
  key: CryptoKey,
937
1058
  cipherText: ArrayBuffer | ArrayBufferView,
938
1059
  ): Promise<ArrayBuffer>;
1060
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign) */
939
1061
  sign(
940
1062
  algorithm: string | SubtleCryptoSignAlgorithm,
941
1063
  key: CryptoKey,
942
1064
  data: ArrayBuffer | ArrayBufferView,
943
1065
  ): Promise<ArrayBuffer>;
1066
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify) */
944
1067
  verify(
945
1068
  algorithm: string | SubtleCryptoSignAlgorithm,
946
1069
  key: CryptoKey,
947
1070
  signature: ArrayBuffer | ArrayBufferView,
948
1071
  data: ArrayBuffer | ArrayBufferView,
949
1072
  ): Promise<boolean>;
1073
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest) */
950
1074
  digest(
951
1075
  algorithm: string | SubtleCryptoHashAlgorithm,
952
1076
  data: ArrayBuffer | ArrayBufferView,
953
1077
  ): Promise<ArrayBuffer>;
954
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) */
1078
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) */
955
1079
  generateKey(
956
1080
  algorithm: string | SubtleCryptoGenerateKeyAlgorithm,
957
1081
  extractable: boolean,
958
1082
  keyUsages: string[],
959
1083
  ): Promise<CryptoKey | CryptoKeyPair>;
960
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey) */
1084
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey) */
961
1085
  deriveKey(
962
1086
  algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
963
1087
  baseKey: CryptoKey,
@@ -965,12 +1089,13 @@ export declare abstract class SubtleCrypto {
965
1089
  extractable: boolean,
966
1090
  keyUsages: string[],
967
1091
  ): Promise<CryptoKey>;
1092
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits) */
968
1093
  deriveBits(
969
1094
  algorithm: string | SubtleCryptoDeriveKeyAlgorithm,
970
1095
  baseKey: CryptoKey,
971
- length: number | null,
1096
+ length?: number | null,
972
1097
  ): Promise<ArrayBuffer>;
973
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) */
1098
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) */
974
1099
  importKey(
975
1100
  format: string,
976
1101
  keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey,
@@ -978,14 +1103,16 @@ export declare abstract class SubtleCrypto {
978
1103
  extractable: boolean,
979
1104
  keyUsages: string[],
980
1105
  ): Promise<CryptoKey>;
1106
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey) */
981
1107
  exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
1108
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey) */
982
1109
  wrapKey(
983
1110
  format: string,
984
1111
  key: CryptoKey,
985
1112
  wrappingKey: CryptoKey,
986
1113
  wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm,
987
1114
  ): Promise<ArrayBuffer>;
988
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey) */
1115
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey) */
989
1116
  unwrapKey(
990
1117
  format: string,
991
1118
  wrappedKey: ArrayBuffer | ArrayBufferView,
@@ -1000,12 +1127,18 @@ export declare abstract class SubtleCrypto {
1000
1127
  b: ArrayBuffer | ArrayBufferView,
1001
1128
  ): boolean;
1002
1129
  }
1130
+ /**
1131
+ * The CryptoKey dictionary of the Web Crypto API represents a cryptographic key.
1132
+ * Available only in secure contexts.
1133
+ *
1134
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)
1135
+ */
1003
1136
  export declare abstract class CryptoKey {
1004
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) */
1137
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) */
1005
1138
  readonly type: string;
1006
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable) */
1139
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable) */
1007
1140
  readonly extractable: boolean;
1008
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm) */
1141
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm) */
1009
1142
  readonly algorithm:
1010
1143
  | CryptoKeyKeyAlgorithm
1011
1144
  | CryptoKeyAesKeyAlgorithm
@@ -1013,7 +1146,7 @@ export declare abstract class CryptoKey {
1013
1146
  | CryptoKeyRsaKeyAlgorithm
1014
1147
  | CryptoKeyEllipticKeyAlgorithm
1015
1148
  | CryptoKeyArbitraryKeyAlgorithm;
1016
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages) */
1149
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages) */
1017
1150
  readonly usages: string[];
1018
1151
  }
1019
1152
  export interface CryptoKeyPair {
@@ -1119,7 +1252,13 @@ export declare class DigestStream extends WritableStream<
1119
1252
  > {
1120
1253
  constructor(algorithm: string | SubtleCryptoHashAlgorithm);
1121
1254
  readonly digest: Promise<ArrayBuffer>;
1255
+ get bytesWritten(): number | bigint;
1122
1256
  }
1257
+ /**
1258
+ * A decoder for a specific method, that is a specific character encoding, like utf-8, iso-8859-2, koi8, cp1261, gbk, etc. A decoder takes a stream of bytes as input and emits a stream of code points. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays.
1259
+ *
1260
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)
1261
+ */
1123
1262
  export declare class TextDecoder {
1124
1263
  constructor(decoder?: string, options?: TextDecoderConstructorOptions);
1125
1264
  /**
@@ -1145,6 +1284,11 @@ export declare class TextDecoder {
1145
1284
  readonly fatal: boolean;
1146
1285
  readonly ignoreBOM: boolean;
1147
1286
  }
1287
+ /**
1288
+ * TextEncoder takes a stream of code points as input and emits a stream of bytes. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays.
1289
+ *
1290
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder)
1291
+ */
1148
1292
  export declare class TextEncoder {
1149
1293
  constructor();
1150
1294
  /**
@@ -1175,21 +1319,59 @@ export interface TextEncoderEncodeIntoResult {
1175
1319
  read: number;
1176
1320
  written: number;
1177
1321
  }
1322
+ /**
1323
+ * Events providing information related to errors in scripts or in files.
1324
+ *
1325
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)
1326
+ */
1327
+ export declare class ErrorEvent extends Event {
1328
+ constructor(type: string, init?: ErrorEventErrorEventInit);
1329
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename) */
1330
+ get filename(): string;
1331
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message) */
1332
+ get message(): string;
1333
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno) */
1334
+ get lineno(): number;
1335
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno) */
1336
+ get colno(): number;
1337
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error) */
1338
+ get error(): any;
1339
+ }
1340
+ export interface ErrorEventErrorEventInit {
1341
+ message?: string;
1342
+ filename?: string;
1343
+ lineno?: number;
1344
+ colno?: number;
1345
+ error?: any;
1346
+ }
1347
+ /**
1348
+ * Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data".
1349
+ *
1350
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData)
1351
+ */
1178
1352
  export declare class FormData {
1179
1353
  constructor();
1354
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) */
1180
1355
  append(name: string, value: string): void;
1356
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) */
1181
1357
  append(name: string, value: Blob, filename?: string): void;
1358
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete) */
1182
1359
  delete(name: string): void;
1360
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get) */
1183
1361
  get(name: string): (File | string) | null;
1362
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll) */
1184
1363
  getAll(name: string): (File | string)[];
1364
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has) */
1185
1365
  has(name: string): boolean;
1366
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set) */
1186
1367
  set(name: string, value: string): void;
1368
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set) */
1187
1369
  set(name: string, value: Blob, filename?: string): void;
1188
- /** Returns an array of key, value pairs for every entry in the list. */
1370
+ /* Returns an array of key, value pairs for every entry in the list. */
1189
1371
  entries(): IterableIterator<[key: string, value: File | string]>;
1190
- /** Returns a list of keys in the list. */
1372
+ /* Returns a list of keys in the list. */
1191
1373
  keys(): IterableIterator<string>;
1192
- /** Returns a list of values in the list. */
1374
+ /* Returns a list of values in the list. */
1193
1375
  values(): IterableIterator<File | string>;
1194
1376
  forEach<This = unknown>(
1195
1377
  callback: (
@@ -1239,20 +1421,44 @@ export interface Element {
1239
1421
  hasAttribute(name: string): boolean;
1240
1422
  setAttribute(name: string, value: string): Element;
1241
1423
  removeAttribute(name: string): Element;
1242
- before(content: string, options?: ContentOptions): Element;
1243
- after(content: string, options?: ContentOptions): Element;
1244
- prepend(content: string, options?: ContentOptions): Element;
1245
- append(content: string, options?: ContentOptions): Element;
1246
- replace(content: string, options?: ContentOptions): Element;
1424
+ before(
1425
+ content: string | ReadableStream | Response,
1426
+ options?: ContentOptions,
1427
+ ): Element;
1428
+ after(
1429
+ content: string | ReadableStream | Response,
1430
+ options?: ContentOptions,
1431
+ ): Element;
1432
+ prepend(
1433
+ content: string | ReadableStream | Response,
1434
+ options?: ContentOptions,
1435
+ ): Element;
1436
+ append(
1437
+ content: string | ReadableStream | Response,
1438
+ options?: ContentOptions,
1439
+ ): Element;
1440
+ replace(
1441
+ content: string | ReadableStream | Response,
1442
+ options?: ContentOptions,
1443
+ ): Element;
1247
1444
  remove(): Element;
1248
1445
  removeAndKeepContent(): Element;
1249
- setInnerContent(content: string, options?: ContentOptions): Element;
1446
+ setInnerContent(
1447
+ content: string | ReadableStream | Response,
1448
+ options?: ContentOptions,
1449
+ ): Element;
1250
1450
  onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;
1251
1451
  }
1252
1452
  export interface EndTag {
1253
1453
  name: string;
1254
- before(content: string, options?: ContentOptions): EndTag;
1255
- after(content: string, options?: ContentOptions): EndTag;
1454
+ before(
1455
+ content: string | ReadableStream | Response,
1456
+ options?: ContentOptions,
1457
+ ): EndTag;
1458
+ after(
1459
+ content: string | ReadableStream | Response,
1460
+ options?: ContentOptions,
1461
+ ): EndTag;
1256
1462
  remove(): EndTag;
1257
1463
  }
1258
1464
  export interface Comment {
@@ -1267,18 +1473,32 @@ export interface Text {
1267
1473
  readonly text: string;
1268
1474
  readonly lastInTextNode: boolean;
1269
1475
  readonly removed: boolean;
1270
- before(content: string, options?: ContentOptions): Text;
1271
- after(content: string, options?: ContentOptions): Text;
1272
- replace(content: string, options?: ContentOptions): Text;
1476
+ before(
1477
+ content: string | ReadableStream | Response,
1478
+ options?: ContentOptions,
1479
+ ): Text;
1480
+ after(
1481
+ content: string | ReadableStream | Response,
1482
+ options?: ContentOptions,
1483
+ ): Text;
1484
+ replace(
1485
+ content: string | ReadableStream | Response,
1486
+ options?: ContentOptions,
1487
+ ): Text;
1273
1488
  remove(): Text;
1274
1489
  }
1275
1490
  export interface DocumentEnd {
1276
1491
  append(content: string, options?: ContentOptions): DocumentEnd;
1277
1492
  }
1493
+ /**
1494
+ * This is the event type for fetch events dispatched on the service worker global scope. It contains information about the fetch, including the request and how the receiver will treat the response. It provides the event.respondWith() method, which allows us to provide a response to this fetch.
1495
+ *
1496
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent)
1497
+ */
1278
1498
  export declare abstract class FetchEvent extends ExtendableEvent {
1279
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request) */
1499
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request) */
1280
1500
  readonly request: Request;
1281
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith) */
1501
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith) */
1282
1502
  respondWith(promise: Response | Promise<Response>): void;
1283
1503
  passThroughOnException(): void;
1284
1504
  }
@@ -1286,23 +1506,33 @@ export type HeadersInit =
1286
1506
  | Headers
1287
1507
  | Iterable<Iterable<string>>
1288
1508
  | Record<string, string>;
1509
+ /**
1510
+ * This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.
1511
+ *
1512
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers)
1513
+ */
1289
1514
  export declare class Headers {
1290
1515
  constructor(init?: HeadersInit);
1516
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get) */
1291
1517
  get(name: string): string | null;
1292
1518
  getAll(name: string): string[];
1519
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/has) */
1293
1520
  has(name: string): boolean;
1521
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/set) */
1294
1522
  set(name: string, value: string): void;
1523
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/append) */
1295
1524
  append(name: string, value: string): void;
1525
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/delete) */
1296
1526
  delete(name: string): void;
1297
1527
  forEach<This = unknown>(
1298
1528
  callback: (this: This, value: string, key: string, parent: Headers) => void,
1299
1529
  thisArg?: This,
1300
1530
  ): void;
1301
- /** Returns an iterator allowing to go through all key/value pairs contained in this object. */
1531
+ /* Returns an iterator allowing to go through all key/value pairs contained in this object. */
1302
1532
  entries(): IterableIterator<[key: string, value: string]>;
1303
- /** Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */
1533
+ /* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */
1304
1534
  keys(): IterableIterator<string>;
1305
- /** Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
1535
+ /* Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
1306
1536
  values(): IterableIterator<string>;
1307
1537
  [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
1308
1538
  }
@@ -1315,33 +1545,52 @@ export type BodyInit =
1315
1545
  | URLSearchParams
1316
1546
  | FormData;
1317
1547
  export declare abstract class Body {
1548
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */
1318
1549
  readonly body: ReadableStream | null;
1550
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */
1319
1551
  readonly bodyUsed: boolean;
1552
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */
1320
1553
  arrayBuffer(): Promise<ArrayBuffer>;
1554
+ bytes(): Promise<Uint8Array>;
1555
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */
1321
1556
  text(): Promise<string>;
1557
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) */
1322
1558
  json<T>(): Promise<T>;
1559
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) */
1323
1560
  formData(): Promise<FormData>;
1561
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */
1324
1562
  blob(): Promise<Blob>;
1325
1563
  }
1326
- export declare class Response extends Body {
1327
- constructor(body?: BodyInit | null, init?: ResponseInit);
1328
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirect_static) */
1329
- static redirect(url: string, status?: number): Response;
1330
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/json_static) */
1331
- static json(any: any, maybeInit?: ResponseInit | Response): Response;
1332
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) */
1564
+ /**
1565
+ * This Fetch API interface represents the response to a request.
1566
+ *
1567
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
1568
+ */
1569
+ export declare var Response: {
1570
+ prototype: Response;
1571
+ new (body?: BodyInit | null, init?: ResponseInit): Response;
1572
+ redirect(url: string, status?: number): Response;
1573
+ json(any: any, maybeInit?: ResponseInit | Response): Response;
1574
+ };
1575
+ /**
1576
+ * This Fetch API interface represents the response to a request.
1577
+ *
1578
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
1579
+ */
1580
+ export interface Response extends Body {
1581
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) */
1333
1582
  clone(): Response;
1334
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) */
1583
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) */
1335
1584
  readonly status: number;
1336
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText) */
1585
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText) */
1337
1586
  readonly statusText: string;
1338
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) */
1587
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) */
1339
1588
  readonly headers: Headers;
1340
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok) */
1589
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok) */
1341
1590
  readonly ok: boolean;
1342
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected) */
1591
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected) */
1343
1592
  readonly redirected: boolean;
1344
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) */
1593
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) */
1345
1594
  readonly url: string;
1346
1595
  readonly webSocket: WebSocket | null;
1347
1596
  readonly cf?: any;
@@ -1357,13 +1606,29 @@ export interface ResponseInit {
1357
1606
  export type RequestInfo<
1358
1607
  CfHostMetadata = unknown,
1359
1608
  Cf = CfProperties<CfHostMetadata>,
1360
- > = Request<CfHostMetadata, Cf> | string | URL;
1361
- export declare class Request<
1609
+ > = Request<CfHostMetadata, Cf> | string;
1610
+ /**
1611
+ * This Fetch API interface represents a resource request.
1612
+ *
1613
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
1614
+ */
1615
+ export declare var Request: {
1616
+ prototype: Request;
1617
+ new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(
1618
+ input: RequestInfo<CfProperties> | URL,
1619
+ init?: RequestInit<Cf>,
1620
+ ): Request<CfHostMetadata, Cf>;
1621
+ };
1622
+ /**
1623
+ * This Fetch API interface represents a resource request.
1624
+ *
1625
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
1626
+ */
1627
+ export interface Request<
1362
1628
  CfHostMetadata = unknown,
1363
1629
  Cf = CfProperties<CfHostMetadata>,
1364
1630
  > extends Body {
1365
- constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
1366
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) */
1631
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) */
1367
1632
  clone(): Request<CfHostMetadata, Cf>;
1368
1633
  /**
1369
1634
  * Returns request's HTTP method, which is "GET" by default.
@@ -1411,19 +1676,19 @@ export declare class Request<
1411
1676
  readonly keepalive: boolean;
1412
1677
  }
1413
1678
  export interface RequestInit<Cf = CfProperties> {
1414
- /** A string to set request's method. */
1679
+ /* A string to set request's method. */
1415
1680
  method?: string;
1416
- /** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
1681
+ /* A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
1417
1682
  headers?: HeadersInit;
1418
- /** A BodyInit object or null to set request's body. */
1683
+ /* A BodyInit object or null to set request's body. */
1419
1684
  body?: BodyInit | null;
1420
- /** A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */
1685
+ /* A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */
1421
1686
  redirect?: string;
1422
1687
  fetcher?: Fetcher | null;
1423
1688
  cf?: Cf;
1424
- /** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1689
+ /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1425
1690
  integrity?: string;
1426
- /** An AbortSignal to set request's signal. */
1691
+ /* An AbortSignal to set request's signal. */
1427
1692
  signal?: AbortSignal | null;
1428
1693
  }
1429
1694
  export type Service<
@@ -1435,7 +1700,7 @@ export type Fetcher<
1435
1700
  > = (T extends Rpc.EntrypointBranded
1436
1701
  ? Rpc.Provider<T, Reserved | "fetch" | "connect">
1437
1702
  : unknown) & {
1438
- fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1703
+ fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
1439
1704
  connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1440
1705
  };
1441
1706
  export interface FetcherPutOptions {
@@ -1656,6 +1921,7 @@ export interface R2MultipartUpload {
1656
1921
  uploadPart(
1657
1922
  partNumber: number,
1658
1923
  value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob,
1924
+ options?: R2UploadPartOptions,
1659
1925
  ): Promise<R2UploadedPart>;
1660
1926
  abort(): Promise<void>;
1661
1927
  complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
@@ -1676,6 +1942,7 @@ export declare abstract class R2Object {
1676
1942
  readonly customMetadata?: Record<string, string>;
1677
1943
  readonly range?: R2Range;
1678
1944
  readonly storageClass: string;
1945
+ readonly ssecKeyMd5?: string;
1679
1946
  writeHttpMetadata(headers: Headers): void;
1680
1947
  }
1681
1948
  export interface R2ObjectBody extends R2Object {
@@ -1708,6 +1975,7 @@ export interface R2Conditional {
1708
1975
  export interface R2GetOptions {
1709
1976
  onlyIf?: R2Conditional | Headers;
1710
1977
  range?: R2Range | Headers;
1978
+ ssecKey?: ArrayBuffer | string;
1711
1979
  }
1712
1980
  export interface R2PutOptions {
1713
1981
  onlyIf?: R2Conditional | Headers;
@@ -1719,11 +1987,13 @@ export interface R2PutOptions {
1719
1987
  sha384?: ArrayBuffer | string;
1720
1988
  sha512?: ArrayBuffer | string;
1721
1989
  storageClass?: string;
1990
+ ssecKey?: ArrayBuffer | string;
1722
1991
  }
1723
1992
  export interface R2MultipartOptions {
1724
1993
  httpMetadata?: R2HTTPMetadata | Headers;
1725
1994
  customMetadata?: Record<string, string>;
1726
1995
  storageClass?: string;
1996
+ ssecKey?: ArrayBuffer | string;
1727
1997
  }
1728
1998
  export interface R2Checksums {
1729
1999
  readonly md5?: ArrayBuffer;
@@ -1760,6 +2030,9 @@ export type R2Objects = {
1760
2030
  truncated: false;
1761
2031
  }
1762
2032
  );
2033
+ export interface R2UploadPartOptions {
2034
+ ssecKey?: ArrayBuffer | string;
2035
+ }
1763
2036
  export declare abstract class ScheduledEvent extends ExtendableEvent {
1764
2037
  readonly scheduledTime: number;
1765
2038
  readonly cron: string;
@@ -1856,31 +2129,36 @@ export type ReadableStreamReadResult<R = any> =
1856
2129
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
1857
2130
  */
1858
2131
  export interface ReadableStream<R = any> {
1859
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked) */
2132
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked) */
1860
2133
  readonly locked: boolean;
1861
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel) */
2134
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel) */
1862
2135
  cancel(reason?: any): Promise<void>;
1863
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
2136
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
1864
2137
  getReader(): ReadableStreamDefaultReader<R>;
1865
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
2138
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
1866
2139
  getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
1867
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough) */
2140
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough) */
1868
2141
  pipeThrough<T>(
1869
2142
  transform: ReadableWritablePair<T, R>,
1870
2143
  options?: StreamPipeOptions,
1871
2144
  ): ReadableStream<T>;
1872
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo) */
2145
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo) */
1873
2146
  pipeTo(
1874
2147
  destination: WritableStream<R>,
1875
2148
  options?: StreamPipeOptions,
1876
2149
  ): Promise<void>;
1877
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee) */
2150
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee) */
1878
2151
  tee(): [ReadableStream<R>, ReadableStream<R>];
1879
2152
  values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
1880
2153
  [Symbol.asyncIterator](
1881
2154
  options?: ReadableStreamValuesOptions,
1882
2155
  ): AsyncIterableIterator<R>;
1883
2156
  }
2157
+ /**
2158
+ * 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.
2159
+ *
2160
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
2161
+ */
1884
2162
  export declare const ReadableStream: {
1885
2163
  prototype: ReadableStream;
1886
2164
  new (
@@ -1892,24 +2170,26 @@ export declare const ReadableStream: {
1892
2170
  strategy?: QueuingStrategy<R>,
1893
2171
  ): ReadableStream<R>;
1894
2172
  };
2173
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader) */
1895
2174
  export declare class ReadableStreamDefaultReader<R = any> {
1896
2175
  constructor(stream: ReadableStream);
1897
2176
  readonly closed: Promise<void>;
1898
2177
  cancel(reason?: any): Promise<void>;
1899
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read) */
2178
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read) */
1900
2179
  read(): Promise<ReadableStreamReadResult<R>>;
1901
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock) */
2180
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock) */
1902
2181
  releaseLock(): void;
1903
2182
  }
2183
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader) */
1904
2184
  export declare class ReadableStreamBYOBReader {
1905
2185
  constructor(stream: ReadableStream);
1906
2186
  readonly closed: Promise<void>;
1907
2187
  cancel(reason?: any): Promise<void>;
1908
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) */
2188
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) */
1909
2189
  read<T extends ArrayBufferView>(
1910
2190
  view: T,
1911
2191
  ): Promise<ReadableStreamReadResult<T>>;
1912
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) */
2192
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) */
1913
2193
  releaseLock(): void;
1914
2194
  readAtLeast<T extends ArrayBufferView>(
1915
2195
  minElements: number,
@@ -1927,38 +2207,38 @@ export interface ReadableStreamGetReaderOptions {
1927
2207
  */
1928
2208
  mode: "byob";
1929
2209
  }
1930
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest) */
2210
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest) */
1931
2211
  export interface ReadableStreamBYOBRequest {
1932
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view) */
2212
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view) */
1933
2213
  get view(): Uint8Array | null;
1934
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond) */
2214
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond) */
1935
2215
  respond(bytesWritten: number): void;
1936
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView) */
2216
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView) */
1937
2217
  respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;
1938
2218
  get atLeast(): number | null;
1939
2219
  }
1940
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController) */
2220
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController) */
1941
2221
  export interface ReadableStreamDefaultController<R = any> {
1942
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize) */
2222
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize) */
1943
2223
  get desiredSize(): number | null;
1944
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close) */
2224
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close) */
1945
2225
  close(): void;
1946
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue) */
2226
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue) */
1947
2227
  enqueue(chunk?: R): void;
1948
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error) */
2228
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error) */
1949
2229
  error(reason: any): void;
1950
2230
  }
1951
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController) */
2231
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController) */
1952
2232
  export interface ReadableByteStreamController {
1953
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest) */
2233
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest) */
1954
2234
  get byobRequest(): ReadableStreamBYOBRequest | null;
1955
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize) */
2235
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize) */
1956
2236
  get desiredSize(): number | null;
1957
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close) */
2237
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close) */
1958
2238
  close(): void;
1959
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue) */
2239
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue) */
1960
2240
  enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
1961
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error) */
2241
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error) */
1962
2242
  error(reason: any): void;
1963
2243
  }
1964
2244
  /**
@@ -1967,20 +2247,20 @@ export interface ReadableByteStreamController {
1967
2247
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)
1968
2248
  */
1969
2249
  export interface WritableStreamDefaultController {
1970
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal) */
2250
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal) */
1971
2251
  get signal(): AbortSignal;
1972
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error) */
2252
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error) */
1973
2253
  error(reason?: any): void;
1974
2254
  }
1975
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController) */
2255
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController) */
1976
2256
  export interface TransformStreamDefaultController<O = any> {
1977
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize) */
2257
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize) */
1978
2258
  get desiredSize(): number | null;
1979
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue) */
2259
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue) */
1980
2260
  enqueue(chunk?: O): void;
1981
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error) */
2261
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error) */
1982
2262
  error(reason: any): void;
1983
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate) */
2263
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate) */
1984
2264
  terminate(): void;
1985
2265
  }
1986
2266
  export interface ReadableWritablePair<R = any, W = any> {
@@ -1992,46 +2272,57 @@ export interface ReadableWritablePair<R = any, W = any> {
1992
2272
  writable: WritableStream<W>;
1993
2273
  readable: ReadableStream<R>;
1994
2274
  }
2275
+ /**
2276
+ * This Streams API interface provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing.
2277
+ *
2278
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream)
2279
+ */
1995
2280
  export declare class WritableStream<W = any> {
1996
2281
  constructor(
1997
2282
  underlyingSink?: UnderlyingSink,
1998
2283
  queuingStrategy?: QueuingStrategy,
1999
2284
  );
2000
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked) */
2285
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked) */
2001
2286
  readonly locked: boolean;
2002
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort) */
2287
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort) */
2003
2288
  abort(reason?: any): Promise<void>;
2004
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close) */
2289
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close) */
2005
2290
  close(): Promise<void>;
2006
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter) */
2291
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter) */
2007
2292
  getWriter(): WritableStreamDefaultWriter<W>;
2008
2293
  }
2294
+ /**
2295
+ * This Streams API interface is the object returned by WritableStream.getWriter() and once created locks the < writer to the WritableStream ensuring that no other streams can write to the underlying sink.
2296
+ *
2297
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter)
2298
+ */
2009
2299
  export declare class WritableStreamDefaultWriter<W = any> {
2010
2300
  constructor(stream: WritableStream);
2011
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed) */
2301
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed) */
2012
2302
  readonly closed: Promise<void>;
2013
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready) */
2303
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready) */
2014
2304
  readonly ready: Promise<void>;
2015
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize) */
2305
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize) */
2016
2306
  readonly desiredSize: number | null;
2017
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort) */
2307
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort) */
2018
2308
  abort(reason?: any): Promise<void>;
2019
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close) */
2309
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close) */
2020
2310
  close(): Promise<void>;
2021
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write) */
2311
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write) */
2022
2312
  write(chunk?: W): Promise<void>;
2023
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock) */
2313
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock) */
2024
2314
  releaseLock(): void;
2025
2315
  }
2316
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream) */
2026
2317
  export declare class TransformStream<I = any, O = any> {
2027
2318
  constructor(
2028
2319
  transformer?: Transformer<I, O>,
2029
2320
  writableStrategy?: QueuingStrategy<I>,
2030
2321
  readableStrategy?: QueuingStrategy<O>,
2031
2322
  );
2032
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable) */
2323
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable) */
2033
2324
  readonly readable: ReadableStream<O>;
2034
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable) */
2325
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable) */
2035
2326
  readonly writable: WritableStream<I>;
2036
2327
  }
2037
2328
  export declare class FixedLengthStream extends IdentityTransformStream {
@@ -2052,18 +2343,21 @@ export interface IdentityTransformStreamQueuingStrategy {
2052
2343
  export interface ReadableStreamValuesOptions {
2053
2344
  preventCancel?: boolean;
2054
2345
  }
2346
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream) */
2055
2347
  export declare class CompressionStream extends TransformStream<
2056
2348
  ArrayBuffer | ArrayBufferView,
2057
2349
  Uint8Array
2058
2350
  > {
2059
2351
  constructor(format: "gzip" | "deflate" | "deflate-raw");
2060
2352
  }
2353
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream) */
2061
2354
  export declare class DecompressionStream extends TransformStream<
2062
2355
  ArrayBuffer | ArrayBufferView,
2063
2356
  Uint8Array
2064
2357
  > {
2065
2358
  constructor(format: "gzip" | "deflate" | "deflate-raw");
2066
2359
  }
2360
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream) */
2067
2361
  export declare class TextEncoderStream extends TransformStream<
2068
2362
  string,
2069
2363
  Uint8Array
@@ -2071,6 +2365,7 @@ export declare class TextEncoderStream extends TransformStream<
2071
2365
  constructor();
2072
2366
  get encoding(): string;
2073
2367
  }
2368
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream) */
2074
2369
  export declare class TextDecoderStream extends TransformStream<
2075
2370
  ArrayBuffer | ArrayBufferView,
2076
2371
  string
@@ -2084,20 +2379,30 @@ export interface TextDecoderStreamTextDecoderStreamInit {
2084
2379
  fatal?: boolean;
2085
2380
  ignoreBOM?: boolean;
2086
2381
  }
2382
+ /**
2383
+ * This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams.
2384
+ *
2385
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy)
2386
+ */
2087
2387
  export declare class ByteLengthQueuingStrategy
2088
2388
  implements QueuingStrategy<ArrayBufferView>
2089
2389
  {
2090
2390
  constructor(init: QueuingStrategyInit);
2091
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark) */
2391
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark) */
2092
2392
  get highWaterMark(): number;
2093
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */
2393
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */
2094
2394
  get size(): (chunk?: any) => number;
2095
2395
  }
2396
+ /**
2397
+ * This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams.
2398
+ *
2399
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy)
2400
+ */
2096
2401
  export declare class CountQueuingStrategy implements QueuingStrategy {
2097
2402
  constructor(init: QueuingStrategyInit);
2098
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark) */
2403
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark) */
2099
2404
  get highWaterMark(): number;
2100
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */
2405
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */
2101
2406
  get size(): (chunk?: any) => number;
2102
2407
  }
2103
2408
  export interface QueuingStrategyInit {
@@ -2141,6 +2446,8 @@ export interface TraceItem {
2141
2446
  readonly dispatchNamespace?: string;
2142
2447
  readonly scriptTags?: string[];
2143
2448
  readonly outcome: string;
2449
+ readonly executionModel: string;
2450
+ readonly truncated: boolean;
2144
2451
  }
2145
2452
  export interface TraceItemAlarmEventInfo {
2146
2453
  readonly scheduledTime: Date;
@@ -2222,36 +2529,43 @@ export interface TraceMetrics {
2222
2529
  export interface UnsafeTraceMetrics {
2223
2530
  fromTrace(item: TraceItem): TraceMetrics;
2224
2531
  }
2532
+ /**
2533
+ * The URL interface represents an object providing static methods used for creating object URLs.
2534
+ *
2535
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL)
2536
+ */
2225
2537
  export declare class URL {
2226
2538
  constructor(url: string | URL, base?: string | URL);
2227
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) */
2539
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) */
2228
2540
  href: string;
2229
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin) */
2541
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin) */
2230
2542
  readonly origin: string;
2231
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) */
2543
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) */
2232
2544
  protocol: string;
2233
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */
2545
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */
2234
2546
  username: string;
2235
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */
2547
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */
2236
2548
  password: string;
2237
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */
2549
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */
2238
2550
  host: string;
2239
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */
2551
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */
2240
2552
  hostname: string;
2241
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */
2553
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */
2242
2554
  port: string;
2243
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */
2555
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */
2244
2556
  pathname: string;
2245
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */
2557
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */
2246
2558
  search: string;
2247
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams) */
2559
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams) */
2248
2560
  readonly searchParams: URLSearchParams;
2249
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */
2561
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */
2250
2562
  hash: string;
2563
+ /*function toString() { [native code] }*/
2251
2564
  toString(): string;
2252
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON) */
2565
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON) */
2253
2566
  toJSON(): string;
2254
2567
  }
2568
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams) */
2255
2569
  export declare class URLSearchParams {
2256
2570
  constructor(
2257
2571
  init?:
@@ -2260,19 +2574,51 @@ export declare class URLSearchParams {
2260
2574
  | Record<string, string>
2261
2575
  | [key: string, value: string][],
2262
2576
  );
2577
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size) */
2263
2578
  get size(): number;
2579
+ /**
2580
+ * Appends a specified key/value pair as a new search parameter.
2581
+ *
2582
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)
2583
+ */
2264
2584
  append(name: string, value: string): void;
2585
+ /**
2586
+ * Deletes the given search parameter, and its associated value, from the list of all search parameters.
2587
+ *
2588
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)
2589
+ */
2265
2590
  delete(name: string): void;
2591
+ /**
2592
+ * Returns the first value associated to the given search parameter.
2593
+ *
2594
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)
2595
+ */
2266
2596
  get(name: string): string | null;
2597
+ /**
2598
+ * Returns all the values association with a given search parameter.
2599
+ *
2600
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)
2601
+ */
2267
2602
  getAll(name: string): string[];
2603
+ /**
2604
+ * Returns a Boolean indicating if such a search parameter exists.
2605
+ *
2606
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)
2607
+ */
2268
2608
  has(name: string): boolean;
2609
+ /**
2610
+ * Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
2611
+ *
2612
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
2613
+ */
2269
2614
  set(name: string, value: string): void;
2615
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort) */
2270
2616
  sort(): void;
2271
- /** Returns an array of key, value pairs for every entry in the search params. */
2617
+ /* Returns an array of key, value pairs for every entry in the search params. */
2272
2618
  entries(): IterableIterator<[key: string, value: string]>;
2273
- /** Returns a list of keys in the search params. */
2619
+ /* Returns a list of keys in the search params. */
2274
2620
  keys(): IterableIterator<string>;
2275
- /** Returns a list of values in the search params. */
2621
+ /* Returns a list of values in the search params. */
2276
2622
  values(): IterableIterator<string>;
2277
2623
  forEach<This = unknown>(
2278
2624
  callback: (
@@ -2283,6 +2629,7 @@ export declare class URLSearchParams {
2283
2629
  ) => void,
2284
2630
  thisArg?: This,
2285
2631
  ): void;
2632
+ /*function toString() { [native code] } Returns a string containing a query string suitable for use in a URL. Does not include the question mark. */
2286
2633
  toString(): string;
2287
2634
  [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
2288
2635
  }
@@ -2335,6 +2682,11 @@ export interface URLPatternURLPatternResult {
2335
2682
  export interface URLPatternURLPatternOptions {
2336
2683
  ignoreCase?: boolean;
2337
2684
  }
2685
+ /**
2686
+ * A CloseEvent is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute.
2687
+ *
2688
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)
2689
+ */
2338
2690
  export declare class CloseEvent extends Event {
2339
2691
  constructor(type: string, initializer?: CloseEventInit);
2340
2692
  /**
@@ -2361,38 +2713,52 @@ export interface CloseEventInit {
2361
2713
  reason?: string;
2362
2714
  wasClean?: boolean;
2363
2715
  }
2716
+ /**
2717
+ * A message received by a target object.
2718
+ *
2719
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
2720
+ */
2364
2721
  export declare class MessageEvent extends Event {
2365
2722
  constructor(type: string, initializer: MessageEventInit);
2723
+ /**
2724
+ * Returns the data of the message.
2725
+ *
2726
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
2727
+ */
2366
2728
  readonly data: ArrayBuffer | string;
2367
2729
  }
2368
2730
  export interface MessageEventInit {
2369
2731
  data: ArrayBuffer | string;
2370
2732
  }
2371
- /**
2372
- * Events providing information related to errors in scripts or in files.
2373
- *
2374
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)
2375
- */
2376
- export interface ErrorEvent extends Event {
2377
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename) */
2378
- readonly filename: string;
2379
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message) */
2380
- readonly message: string;
2381
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno) */
2382
- readonly lineno: number;
2383
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno) */
2384
- readonly colno: number;
2385
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error) */
2386
- readonly error: any;
2387
- }
2388
2733
  export type WebSocketEventMap = {
2389
2734
  close: CloseEvent;
2390
2735
  message: MessageEvent;
2391
2736
  open: Event;
2392
2737
  error: ErrorEvent;
2393
2738
  };
2394
- export declare class WebSocket extends EventTarget<WebSocketEventMap> {
2395
- constructor(url: string, protocols?: string[] | string);
2739
+ /**
2740
+ * Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.
2741
+ *
2742
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
2743
+ */
2744
+ export declare var WebSocket: {
2745
+ prototype: WebSocket;
2746
+ new (url: string, protocols?: string[] | string): WebSocket;
2747
+ readonly READY_STATE_CONNECTING: number;
2748
+ readonly CONNECTING: number;
2749
+ readonly READY_STATE_OPEN: number;
2750
+ readonly OPEN: number;
2751
+ readonly READY_STATE_CLOSING: number;
2752
+ readonly CLOSING: number;
2753
+ readonly READY_STATE_CLOSED: number;
2754
+ readonly CLOSED: number;
2755
+ };
2756
+ /**
2757
+ * Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.
2758
+ *
2759
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
2760
+ */
2761
+ export interface WebSocket extends EventTarget<WebSocketEventMap> {
2396
2762
  accept(): void;
2397
2763
  /**
2398
2764
  * Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
@@ -2408,14 +2774,6 @@ export declare class WebSocket extends EventTarget<WebSocketEventMap> {
2408
2774
  close(code?: number, reason?: string): void;
2409
2775
  serializeAttachment(attachment: any): void;
2410
2776
  deserializeAttachment(): any | null;
2411
- static readonly READY_STATE_CONNECTING: number;
2412
- static readonly CONNECTING: number;
2413
- static readonly READY_STATE_OPEN: number;
2414
- static readonly OPEN: number;
2415
- static readonly READY_STATE_CLOSING: number;
2416
- static readonly CLOSING: number;
2417
- static readonly READY_STATE_CLOSED: number;
2418
- static readonly CLOSED: number;
2419
2777
  /**
2420
2778
  * Returns the state of the WebSocket object's connection. It can have the values described below.
2421
2779
  *
@@ -2447,6 +2805,37 @@ export declare const WebSocketPair: {
2447
2805
  1: WebSocket;
2448
2806
  };
2449
2807
  };
2808
+ export interface SqlStorage {
2809
+ exec<T extends Record<string, SqlStorageValue>>(
2810
+ query: string,
2811
+ ...bindings: any[]
2812
+ ): SqlStorageCursor<T>;
2813
+ get databaseSize(): number;
2814
+ Cursor: typeof SqlStorageCursor;
2815
+ Statement: typeof SqlStorageStatement;
2816
+ }
2817
+ export declare abstract class SqlStorageStatement {}
2818
+ export type SqlStorageValue = ArrayBuffer | string | number | null;
2819
+ export declare abstract class SqlStorageCursor<
2820
+ T extends Record<string, SqlStorageValue>,
2821
+ > {
2822
+ next():
2823
+ | {
2824
+ done?: false;
2825
+ value: T;
2826
+ }
2827
+ | {
2828
+ done: true;
2829
+ value?: never;
2830
+ };
2831
+ toArray(): T[];
2832
+ one(): T;
2833
+ raw<U extends SqlStorageValue[]>(): IterableIterator<U>;
2834
+ columnNames: string[];
2835
+ get rowsRead(): number;
2836
+ get rowsWritten(): number;
2837
+ [Symbol.iterator](): IterableIterator<T>;
2838
+ }
2450
2839
  export interface Socket {
2451
2840
  get readable(): ReadableStream;
2452
2841
  get writable(): WritableStream;
@@ -2458,6 +2847,7 @@ export interface Socket {
2458
2847
  export interface SocketOptions {
2459
2848
  secureTransport?: string;
2460
2849
  allowHalfOpen: boolean;
2850
+ highWaterMark?: number | bigint;
2461
2851
  }
2462
2852
  export interface SocketAddress {
2463
2853
  hostname: string;
@@ -2470,60 +2860,58 @@ export interface SocketInfo {
2470
2860
  remoteAddress?: string;
2471
2861
  localAddress?: string;
2472
2862
  }
2473
- export declare abstract class gpuGPUAdapter {
2474
- requestDevice(param1?: gpuGPUDeviceDescriptor): Promise<gpuGPUDevice>;
2475
- requestAdapterInfo(unmaskHints?: string[]): Promise<gpuGPUAdapterInfo>;
2476
- get features(): gpuGPUSupportedFeatures;
2477
- get limits(): gpuGPUSupportedLimits;
2863
+ export declare abstract class GPUAdapter {
2864
+ requestDevice(param1?: GPUDeviceDescriptor): Promise<GPUDevice>;
2865
+ requestAdapterInfo(unmaskHints?: string[]): Promise<GPUAdapterInfo>;
2866
+ get features(): GPUSupportedFeatures;
2867
+ get limits(): GPUSupportedLimits;
2478
2868
  }
2479
- export interface gpuGPUDevice extends EventTarget {
2480
- createBuffer(param1: gpuGPUBufferDescriptor): gpuGPUBuffer;
2869
+ export interface GPUDevice extends EventTarget {
2870
+ createBuffer(param1: GPUBufferDescriptor): GPUBuffer;
2481
2871
  createBindGroupLayout(
2482
- descriptor: gpuGPUBindGroupLayoutDescriptor,
2483
- ): gpuGPUBindGroupLayout;
2484
- createBindGroup(descriptor: gpuGPUBindGroupDescriptor): gpuGPUBindGroup;
2485
- createSampler(descriptor: gpuGPUSamplerDescriptor): gpuGPUSampler;
2486
- createShaderModule(
2487
- descriptor: gpuGPUShaderModuleDescriptor,
2488
- ): gpuGPUShaderModule;
2872
+ descriptor: GPUBindGroupLayoutDescriptor,
2873
+ ): GPUBindGroupLayout;
2874
+ createBindGroup(descriptor: GPUBindGroupDescriptor): GPUBindGroup;
2875
+ createSampler(descriptor: GPUSamplerDescriptor): GPUSampler;
2876
+ createShaderModule(descriptor: GPUShaderModuleDescriptor): GPUShaderModule;
2489
2877
  createPipelineLayout(
2490
- descriptor: gpuGPUPipelineLayoutDescriptor,
2491
- ): gpuGPUPipelineLayout;
2878
+ descriptor: GPUPipelineLayoutDescriptor,
2879
+ ): GPUPipelineLayout;
2492
2880
  createComputePipeline(
2493
- descriptor: gpuGPUComputePipelineDescriptor,
2494
- ): gpuGPUComputePipeline;
2881
+ descriptor: GPUComputePipelineDescriptor,
2882
+ ): GPUComputePipeline;
2495
2883
  createRenderPipeline(
2496
- descriptor: gpuGPURenderPipelineDescriptor,
2497
- ): gpuGPURenderPipeline;
2884
+ descriptor: GPURenderPipelineDescriptor,
2885
+ ): GPURenderPipeline;
2498
2886
  createCommandEncoder(
2499
- descriptor?: gpuGPUCommandEncoderDescriptor,
2500
- ): gpuGPUCommandEncoder;
2501
- createTexture(param1: gpuGPUTextureDescriptor): gpuGPUTexture;
2887
+ descriptor?: GPUCommandEncoderDescriptor,
2888
+ ): GPUCommandEncoder;
2889
+ createTexture(param1: GPUTextureDescriptor): GPUTexture;
2502
2890
  destroy(): void;
2503
- createQuerySet(descriptor: gpuGPUQuerySetDescriptor): gpuGPUQuerySet;
2891
+ createQuerySet(descriptor: GPUQuerySetDescriptor): GPUQuerySet;
2504
2892
  pushErrorScope(filter: string): void;
2505
- popErrorScope(): Promise<gpuGPUError | null>;
2506
- get queue(): gpuGPUQueue;
2507
- get lost(): Promise<gpuGPUDeviceLostInfo>;
2508
- get features(): gpuGPUSupportedFeatures;
2509
- get limits(): gpuGPUSupportedLimits;
2893
+ popErrorScope(): Promise<GPUError | null>;
2894
+ get queue(): GPUQueue;
2895
+ get lost(): Promise<GPUDeviceLostInfo>;
2896
+ get features(): GPUSupportedFeatures;
2897
+ get limits(): GPUSupportedLimits;
2510
2898
  }
2511
- export interface gpuGPUDeviceDescriptor {
2899
+ export interface GPUDeviceDescriptor {
2512
2900
  label?: string;
2513
2901
  requiredFeatures?: string[];
2514
2902
  requiredLimits?: Record<string, number | bigint>;
2515
- defaultQueue?: gpuGPUQueueDescriptor;
2903
+ defaultQueue?: GPUQueueDescriptor;
2516
2904
  }
2517
- export interface gpuGPUBufferDescriptor {
2905
+ export interface GPUBufferDescriptor {
2518
2906
  label: string;
2519
2907
  size: number | bigint;
2520
2908
  usage: number;
2521
2909
  mappedAtCreation: boolean;
2522
2910
  }
2523
- export interface gpuGPUQueueDescriptor {
2911
+ export interface GPUQueueDescriptor {
2524
2912
  label?: string;
2525
2913
  }
2526
- export declare abstract class gpuGPUBufferUsage {
2914
+ export declare abstract class GPUBufferUsage {
2527
2915
  static readonly MAP_READ: number;
2528
2916
  static readonly MAP_WRITE: number;
2529
2917
  static readonly COPY_SRC: number;
@@ -2535,7 +2923,7 @@ export declare abstract class gpuGPUBufferUsage {
2535
2923
  static readonly INDIRECT: number;
2536
2924
  static readonly QUERY_RESOLVE: number;
2537
2925
  }
2538
- export interface gpuGPUBuffer {
2926
+ export interface GPUBuffer {
2539
2927
  getMappedRange(size?: number | bigint, param2?: number | bigint): ArrayBuffer;
2540
2928
  unmap(): void;
2541
2929
  destroy(): void;
@@ -2548,59 +2936,59 @@ export interface gpuGPUBuffer {
2548
2936
  get usage(): number;
2549
2937
  get mapState(): string;
2550
2938
  }
2551
- export declare abstract class gpuGPUShaderStage {
2939
+ export declare abstract class GPUShaderStage {
2552
2940
  static readonly VERTEX: number;
2553
2941
  static readonly FRAGMENT: number;
2554
2942
  static readonly COMPUTE: number;
2555
2943
  }
2556
- export interface gpuGPUBindGroupLayoutDescriptor {
2944
+ export interface GPUBindGroupLayoutDescriptor {
2557
2945
  label?: string;
2558
- entries: gpuGPUBindGroupLayoutEntry[];
2946
+ entries: GPUBindGroupLayoutEntry[];
2559
2947
  }
2560
- export interface gpuGPUBindGroupLayoutEntry {
2948
+ export interface GPUBindGroupLayoutEntry {
2561
2949
  binding: number;
2562
2950
  visibility: number;
2563
- buffer?: gpuGPUBufferBindingLayout;
2564
- sampler?: gpuGPUSamplerBindingLayout;
2565
- texture?: gpuGPUTextureBindingLayout;
2566
- storageTexture?: gpuGPUStorageTextureBindingLayout;
2951
+ buffer?: GPUBufferBindingLayout;
2952
+ sampler?: GPUSamplerBindingLayout;
2953
+ texture?: GPUTextureBindingLayout;
2954
+ storageTexture?: GPUStorageTextureBindingLayout;
2567
2955
  }
2568
- export interface gpuGPUStorageTextureBindingLayout {
2956
+ export interface GPUStorageTextureBindingLayout {
2569
2957
  access?: string;
2570
2958
  format: string;
2571
2959
  viewDimension?: string;
2572
2960
  }
2573
- export interface gpuGPUTextureBindingLayout {
2961
+ export interface GPUTextureBindingLayout {
2574
2962
  sampleType?: string;
2575
2963
  viewDimension?: string;
2576
2964
  multisampled?: boolean;
2577
2965
  }
2578
- export interface gpuGPUSamplerBindingLayout {
2966
+ export interface GPUSamplerBindingLayout {
2579
2967
  type?: string;
2580
2968
  }
2581
- export interface gpuGPUBufferBindingLayout {
2969
+ export interface GPUBufferBindingLayout {
2582
2970
  type?: string;
2583
2971
  hasDynamicOffset?: boolean;
2584
2972
  minBindingSize?: number | bigint;
2585
2973
  }
2586
- export interface gpuGPUBindGroupLayout {}
2587
- export interface gpuGPUBindGroup {}
2588
- export interface gpuGPUBindGroupDescriptor {
2974
+ export interface GPUBindGroupLayout {}
2975
+ export interface GPUBindGroup {}
2976
+ export interface GPUBindGroupDescriptor {
2589
2977
  label?: string;
2590
- layout: gpuGPUBindGroupLayout;
2591
- entries: gpuGPUBindGroupEntry[];
2978
+ layout: GPUBindGroupLayout;
2979
+ entries: GPUBindGroupEntry[];
2592
2980
  }
2593
- export interface gpuGPUBindGroupEntry {
2981
+ export interface GPUBindGroupEntry {
2594
2982
  binding: number;
2595
- resource: gpuGPUBufferBinding | gpuGPUSampler;
2983
+ resource: GPUBufferBinding | GPUSampler;
2596
2984
  }
2597
- export interface gpuGPUBufferBinding {
2598
- buffer: gpuGPUBuffer;
2985
+ export interface GPUBufferBinding {
2986
+ buffer: GPUBuffer;
2599
2987
  offset?: number | bigint;
2600
2988
  size?: number | bigint;
2601
2989
  }
2602
- export interface gpuGPUSampler {}
2603
- export interface gpuGPUSamplerDescriptor {
2990
+ export interface GPUSampler {}
2991
+ export interface GPUSamplerDescriptor {
2604
2992
  label?: string;
2605
2993
  addressModeU?: string;
2606
2994
  addressModeV?: string;
@@ -2613,76 +3001,74 @@ export interface gpuGPUSamplerDescriptor {
2613
3001
  compare: string;
2614
3002
  maxAnisotropy?: number;
2615
3003
  }
2616
- export interface gpuGPUShaderModule {
2617
- getCompilationInfo(): Promise<gpuGPUCompilationInfo>;
3004
+ export interface GPUShaderModule {
3005
+ getCompilationInfo(): Promise<GPUCompilationInfo>;
2618
3006
  }
2619
- export interface gpuGPUShaderModuleDescriptor {
3007
+ export interface GPUShaderModuleDescriptor {
2620
3008
  label?: string;
2621
3009
  code: string;
2622
3010
  }
2623
- export interface gpuGPUPipelineLayout {}
2624
- export interface gpuGPUPipelineLayoutDescriptor {
3011
+ export interface GPUPipelineLayout {}
3012
+ export interface GPUPipelineLayoutDescriptor {
2625
3013
  label?: string;
2626
- bindGroupLayouts: gpuGPUBindGroupLayout[];
3014
+ bindGroupLayouts: GPUBindGroupLayout[];
2627
3015
  }
2628
- export interface gpuGPUComputePipeline {
2629
- getBindGroupLayout(index: number): gpuGPUBindGroupLayout;
3016
+ export interface GPUComputePipeline {
3017
+ getBindGroupLayout(index: number): GPUBindGroupLayout;
2630
3018
  }
2631
- export interface gpuGPUComputePipelineDescriptor {
3019
+ export interface GPUComputePipelineDescriptor {
2632
3020
  label?: string;
2633
- compute: gpuGPUProgrammableStage;
2634
- layout: string | gpuGPUPipelineLayout;
3021
+ compute: GPUProgrammableStage;
3022
+ layout: string | GPUPipelineLayout;
2635
3023
  }
2636
- export interface gpuGPUProgrammableStage {
2637
- module: gpuGPUShaderModule;
3024
+ export interface GPUProgrammableStage {
3025
+ module: GPUShaderModule;
2638
3026
  entryPoint: string;
2639
3027
  constants?: Record<string, number>;
2640
3028
  }
2641
- export interface gpuGPUCommandEncoder {
3029
+ export interface GPUCommandEncoder {
2642
3030
  get label(): string;
2643
3031
  beginComputePass(
2644
- descriptor?: gpuGPUComputePassDescriptor,
2645
- ): gpuGPUComputePassEncoder;
2646
- beginRenderPass(
2647
- descriptor: gpuGPURenderPassDescriptor,
2648
- ): gpuGPURenderPassEncoder;
3032
+ descriptor?: GPUComputePassDescriptor,
3033
+ ): GPUComputePassEncoder;
3034
+ beginRenderPass(descriptor: GPURenderPassDescriptor): GPURenderPassEncoder;
2649
3035
  copyBufferToBuffer(
2650
- source: gpuGPUBuffer,
3036
+ source: GPUBuffer,
2651
3037
  sourceOffset: number | bigint,
2652
- destination: gpuGPUBuffer,
3038
+ destination: GPUBuffer,
2653
3039
  destinationOffset: number | bigint,
2654
3040
  size: number | bigint,
2655
3041
  ): void;
2656
- finish(param0?: gpuGPUCommandBufferDescriptor): gpuGPUCommandBuffer;
3042
+ finish(param0?: GPUCommandBufferDescriptor): GPUCommandBuffer;
2657
3043
  copyTextureToBuffer(
2658
- source: gpuGPUImageCopyTexture,
2659
- destination: gpuGPUImageCopyBuffer,
2660
- copySize: Iterable<number> | gpuGPUExtent3DDict,
3044
+ source: GPUImageCopyTexture,
3045
+ destination: GPUImageCopyBuffer,
3046
+ copySize: Iterable<number> | GPUExtent3DDict,
2661
3047
  ): void;
2662
3048
  copyBufferToTexture(
2663
- source: gpuGPUImageCopyBuffer,
2664
- destination: gpuGPUImageCopyTexture,
2665
- copySize: Iterable<number> | gpuGPUExtent3DDict,
3049
+ source: GPUImageCopyBuffer,
3050
+ destination: GPUImageCopyTexture,
3051
+ copySize: Iterable<number> | GPUExtent3DDict,
2666
3052
  ): void;
2667
3053
  copyTextureToTexture(
2668
- source: gpuGPUImageCopyTexture,
2669
- destination: gpuGPUImageCopyTexture,
2670
- copySize: Iterable<number> | gpuGPUExtent3DDict,
3054
+ source: GPUImageCopyTexture,
3055
+ destination: GPUImageCopyTexture,
3056
+ copySize: Iterable<number> | GPUExtent3DDict,
2671
3057
  ): void;
2672
3058
  clearBuffer(
2673
- buffer: gpuGPUBuffer,
3059
+ buffer: GPUBuffer,
2674
3060
  offset?: number | bigint,
2675
3061
  size?: number | bigint,
2676
3062
  ): void;
2677
3063
  }
2678
- export interface gpuGPUCommandEncoderDescriptor {
3064
+ export interface GPUCommandEncoderDescriptor {
2679
3065
  label?: string;
2680
3066
  }
2681
- export interface gpuGPUComputePassEncoder {
2682
- setPipeline(pipeline: gpuGPUComputePipeline): void;
3067
+ export interface GPUComputePassEncoder {
3068
+ setPipeline(pipeline: GPUComputePipeline): void;
2683
3069
  setBindGroup(
2684
3070
  index: number,
2685
- bindGroup: gpuGPUBindGroup | null,
3071
+ bindGroup: GPUBindGroup | null,
2686
3072
  dynamicOffsets?: Iterable<number>,
2687
3073
  ): void;
2688
3074
  dispatchWorkgroups(
@@ -2692,48 +3078,48 @@ export interface gpuGPUComputePassEncoder {
2692
3078
  ): void;
2693
3079
  end(): void;
2694
3080
  }
2695
- export interface gpuGPUComputePassDescriptor {
3081
+ export interface GPUComputePassDescriptor {
2696
3082
  label?: string;
2697
- timestampWrites?: gpuGPUComputePassTimestampWrites;
3083
+ timestampWrites?: GPUComputePassTimestampWrites;
2698
3084
  }
2699
- export interface gpuGPUQuerySet {}
2700
- export interface gpuGPUQuerySetDescriptor {
3085
+ export interface GPUQuerySet {}
3086
+ export interface GPUQuerySetDescriptor {
2701
3087
  label?: string;
2702
3088
  }
2703
- export interface gpuGPUComputePassTimestampWrites {
2704
- querySet: gpuGPUQuerySet;
3089
+ export interface GPUComputePassTimestampWrites {
3090
+ querySet: GPUQuerySet;
2705
3091
  beginningOfPassWriteIndex?: number;
2706
3092
  endOfPassWriteIndex?: number;
2707
3093
  }
2708
- export interface gpuGPUCommandBufferDescriptor {
3094
+ export interface GPUCommandBufferDescriptor {
2709
3095
  label?: string;
2710
3096
  }
2711
- export interface gpuGPUCommandBuffer {}
2712
- export interface gpuGPUQueue {
2713
- submit(commandBuffers: gpuGPUCommandBuffer[]): void;
3097
+ export interface GPUCommandBuffer {}
3098
+ export interface GPUQueue {
3099
+ submit(commandBuffers: GPUCommandBuffer[]): void;
2714
3100
  writeBuffer(
2715
- buffer: gpuGPUBuffer,
3101
+ buffer: GPUBuffer,
2716
3102
  bufferOffset: number | bigint,
2717
3103
  data: ArrayBuffer | ArrayBufferView,
2718
3104
  dataOffset?: number | bigint,
2719
3105
  size?: number | bigint,
2720
3106
  ): void;
2721
3107
  }
2722
- export declare abstract class gpuGPUMapMode {
3108
+ export declare abstract class GPUMapMode {
2723
3109
  static readonly READ: number;
2724
3110
  static readonly WRITE: number;
2725
3111
  }
2726
- export interface gpuGPUAdapterInfo {
3112
+ export interface GPUAdapterInfo {
2727
3113
  get vendor(): string;
2728
3114
  get architecture(): string;
2729
3115
  get device(): string;
2730
3116
  get description(): string;
2731
3117
  }
2732
- export interface gpuGPUSupportedFeatures {
3118
+ export interface GPUSupportedFeatures {
2733
3119
  has(name: string): boolean;
2734
3120
  keys(): string[];
2735
3121
  }
2736
- export interface gpuGPUSupportedLimits {
3122
+ export interface GPUSupportedLimits {
2737
3123
  get maxTextureDimension1D(): number;
2738
3124
  get maxTextureDimension2D(): number;
2739
3125
  get maxTextureDimension3D(): number;
@@ -2766,17 +3152,17 @@ export interface gpuGPUSupportedLimits {
2766
3152
  get maxComputeWorkgroupSizeZ(): number;
2767
3153
  get maxComputeWorkgroupsPerDimension(): number;
2768
3154
  }
2769
- export declare abstract class gpuGPUError {
3155
+ export declare abstract class GPUError {
2770
3156
  get message(): string;
2771
3157
  }
2772
- export declare abstract class gpuGPUOutOfMemoryError extends gpuGPUError {}
2773
- export declare abstract class gpuGPUInternalError extends gpuGPUError {}
2774
- export declare abstract class gpuGPUValidationError extends gpuGPUError {}
2775
- export declare abstract class gpuGPUDeviceLostInfo {
3158
+ export declare abstract class GPUOutOfMemoryError extends GPUError {}
3159
+ export declare abstract class GPUInternalError extends GPUError {}
3160
+ export declare abstract class GPUValidationError extends GPUError {}
3161
+ export declare abstract class GPUDeviceLostInfo {
2776
3162
  get message(): string;
2777
3163
  get reason(): string;
2778
3164
  }
2779
- export interface gpuGPUCompilationMessage {
3165
+ export interface GPUCompilationMessage {
2780
3166
  get message(): string;
2781
3167
  get type(): string;
2782
3168
  get lineNum(): number;
@@ -2784,19 +3170,19 @@ export interface gpuGPUCompilationMessage {
2784
3170
  get offset(): number;
2785
3171
  get length(): number;
2786
3172
  }
2787
- export interface gpuGPUCompilationInfo {
2788
- get messages(): gpuGPUCompilationMessage[];
3173
+ export interface GPUCompilationInfo {
3174
+ get messages(): GPUCompilationMessage[];
2789
3175
  }
2790
- export declare abstract class gpuGPUTextureUsage {
3176
+ export declare abstract class GPUTextureUsage {
2791
3177
  static readonly COPY_SRC: number;
2792
3178
  static readonly COPY_DST: number;
2793
3179
  static readonly TEXTURE_BINDING: number;
2794
3180
  static readonly STORAGE_BINDING: number;
2795
3181
  static readonly RENDER_ATTACHMENT: number;
2796
3182
  }
2797
- export interface gpuGPUTextureDescriptor {
3183
+ export interface GPUTextureDescriptor {
2798
3184
  label: string;
2799
- size: number[] | gpuGPUExtent3DDict;
3185
+ size: number[] | GPUExtent3DDict;
2800
3186
  mipLevelCount?: number;
2801
3187
  sampleCount?: number;
2802
3188
  dimension?: string;
@@ -2804,13 +3190,13 @@ export interface gpuGPUTextureDescriptor {
2804
3190
  usage: number;
2805
3191
  viewFormats?: string[];
2806
3192
  }
2807
- export interface gpuGPUExtent3DDict {
3193
+ export interface GPUExtent3DDict {
2808
3194
  width: number;
2809
3195
  height?: number;
2810
3196
  depthOrArrayLayers?: number;
2811
3197
  }
2812
- export interface gpuGPUTexture {
2813
- createView(descriptor?: gpuGPUTextureViewDescriptor): gpuGPUTextureView;
3198
+ export interface GPUTexture {
3199
+ createView(descriptor?: GPUTextureViewDescriptor): GPUTextureView;
2814
3200
  destroy(): void;
2815
3201
  get width(): number;
2816
3202
  get height(): number;
@@ -2820,8 +3206,8 @@ export interface gpuGPUTexture {
2820
3206
  get format(): string;
2821
3207
  get usage(): number;
2822
3208
  }
2823
- export interface gpuGPUTextureView {}
2824
- export interface gpuGPUTextureViewDescriptor {
3209
+ export interface GPUTextureView {}
3210
+ export interface GPUTextureViewDescriptor {
2825
3211
  label: string;
2826
3212
  format: string;
2827
3213
  dimension: string;
@@ -2831,91 +3217,91 @@ export interface gpuGPUTextureViewDescriptor {
2831
3217
  baseArrayLayer?: number;
2832
3218
  arrayLayerCount: number;
2833
3219
  }
2834
- export declare abstract class gpuGPUColorWrite {
3220
+ export declare abstract class GPUColorWrite {
2835
3221
  static readonly RED: number;
2836
3222
  static readonly GREEN: number;
2837
3223
  static readonly BLUE: number;
2838
3224
  static readonly ALPHA: number;
2839
3225
  static readonly ALL: number;
2840
3226
  }
2841
- export interface gpuGPURenderPipeline {}
2842
- export interface gpuGPURenderPipelineDescriptor {
3227
+ export interface GPURenderPipeline {}
3228
+ export interface GPURenderPipelineDescriptor {
2843
3229
  label?: string;
2844
- layout: string | gpuGPUPipelineLayout;
2845
- vertex: gpuGPUVertexState;
2846
- primitive?: gpuGPUPrimitiveState;
2847
- depthStencil?: gpuGPUDepthStencilState;
2848
- multisample?: gpuGPUMultisampleState;
2849
- fragment?: gpuGPUFragmentState;
2850
- }
2851
- export interface gpuGPUVertexState {
2852
- module: gpuGPUShaderModule;
3230
+ layout: string | GPUPipelineLayout;
3231
+ vertex: GPUVertexState;
3232
+ primitive?: GPUPrimitiveState;
3233
+ depthStencil?: GPUDepthStencilState;
3234
+ multisample?: GPUMultisampleState;
3235
+ fragment?: GPUFragmentState;
3236
+ }
3237
+ export interface GPUVertexState {
3238
+ module: GPUShaderModule;
2853
3239
  entryPoint: string;
2854
3240
  constants?: Record<string, number>;
2855
- buffers?: gpuGPUVertexBufferLayout[];
3241
+ buffers?: GPUVertexBufferLayout[];
2856
3242
  }
2857
- export interface gpuGPUVertexBufferLayout {
3243
+ export interface GPUVertexBufferLayout {
2858
3244
  arrayStride: number | bigint;
2859
3245
  stepMode?: string;
2860
- attributes: gpuGPUVertexAttribute[];
3246
+ attributes: GPUVertexAttribute[];
2861
3247
  }
2862
- export interface gpuGPUVertexAttribute {
3248
+ export interface GPUVertexAttribute {
2863
3249
  format: string;
2864
3250
  offset: number | bigint;
2865
3251
  shaderLocation: number;
2866
3252
  }
2867
- export interface gpuGPUPrimitiveState {
3253
+ export interface GPUPrimitiveState {
2868
3254
  topology?: string;
2869
3255
  stripIndexFormat?: string;
2870
3256
  frontFace?: string;
2871
3257
  cullMode?: string;
2872
3258
  unclippedDepth?: boolean;
2873
3259
  }
2874
- export interface gpuGPUStencilFaceState {
3260
+ export interface GPUStencilFaceState {
2875
3261
  compare?: string;
2876
3262
  failOp?: string;
2877
3263
  depthFailOp?: string;
2878
3264
  passOp?: string;
2879
3265
  }
2880
- export interface gpuGPUDepthStencilState {
3266
+ export interface GPUDepthStencilState {
2881
3267
  format: string;
2882
3268
  depthWriteEnabled: boolean;
2883
3269
  depthCompare: string;
2884
- stencilFront?: gpuGPUStencilFaceState;
2885
- stencilBack?: gpuGPUStencilFaceState;
3270
+ stencilFront?: GPUStencilFaceState;
3271
+ stencilBack?: GPUStencilFaceState;
2886
3272
  stencilReadMask?: number;
2887
3273
  stencilWriteMask?: number;
2888
3274
  depthBias?: number;
2889
3275
  depthBiasSlopeScale?: number;
2890
3276
  depthBiasClamp?: number;
2891
3277
  }
2892
- export interface gpuGPUMultisampleState {
3278
+ export interface GPUMultisampleState {
2893
3279
  count?: number;
2894
3280
  mask?: number;
2895
3281
  alphaToCoverageEnabled?: boolean;
2896
3282
  }
2897
- export interface gpuGPUFragmentState {
2898
- module: gpuGPUShaderModule;
3283
+ export interface GPUFragmentState {
3284
+ module: GPUShaderModule;
2899
3285
  entryPoint: string;
2900
3286
  constants?: Record<string, number>;
2901
- targets: gpuGPUColorTargetState[];
3287
+ targets: GPUColorTargetState[];
2902
3288
  }
2903
- export interface gpuGPUColorTargetState {
3289
+ export interface GPUColorTargetState {
2904
3290
  format: string;
2905
- blend: gpuGPUBlendState;
3291
+ blend: GPUBlendState;
2906
3292
  writeMask?: number;
2907
3293
  }
2908
- export interface gpuGPUBlendState {
2909
- color: gpuGPUBlendComponent;
2910
- alpha: gpuGPUBlendComponent;
3294
+ export interface GPUBlendState {
3295
+ color: GPUBlendComponent;
3296
+ alpha: GPUBlendComponent;
2911
3297
  }
2912
- export interface gpuGPUBlendComponent {
3298
+ export interface GPUBlendComponent {
2913
3299
  operation?: string;
2914
3300
  srcFactor?: string;
2915
3301
  dstFactor?: string;
2916
3302
  }
2917
- export interface gpuGPURenderPassEncoder {
2918
- setPipeline(pipeline: gpuGPURenderPipeline): void;
3303
+ export interface GPURenderPassEncoder {
3304
+ setPipeline(pipeline: GPURenderPipeline): void;
2919
3305
  draw(
2920
3306
  vertexCount: number,
2921
3307
  instanceCount?: number,
@@ -2924,30 +3310,30 @@ export interface gpuGPURenderPassEncoder {
2924
3310
  ): void;
2925
3311
  end(): void;
2926
3312
  }
2927
- export interface gpuGPURenderPassDescriptor {
3313
+ export interface GPURenderPassDescriptor {
2928
3314
  label?: string;
2929
- colorAttachments: gpuGPURenderPassColorAttachment[];
2930
- depthStencilAttachment?: gpuGPURenderPassDepthStencilAttachment;
2931
- occlusionQuerySet?: gpuGPUQuerySet;
2932
- timestampWrites?: gpuGPURenderPassTimestampWrites;
3315
+ colorAttachments: GPURenderPassColorAttachment[];
3316
+ depthStencilAttachment?: GPURenderPassDepthStencilAttachment;
3317
+ occlusionQuerySet?: GPUQuerySet;
3318
+ timestampWrites?: GPURenderPassTimestampWrites;
2933
3319
  maxDrawCount?: number | bigint;
2934
3320
  }
2935
- export interface gpuGPURenderPassColorAttachment {
2936
- view: gpuGPUTextureView;
3321
+ export interface GPURenderPassColorAttachment {
3322
+ view: GPUTextureView;
2937
3323
  depthSlice?: number;
2938
- resolveTarget?: gpuGPUTextureView;
2939
- clearValue?: number[] | gpuGPUColorDict;
3324
+ resolveTarget?: GPUTextureView;
3325
+ clearValue?: number[] | GPUColorDict;
2940
3326
  loadOp: string;
2941
3327
  storeOp: string;
2942
3328
  }
2943
- export interface gpuGPUColorDict {
3329
+ export interface GPUColorDict {
2944
3330
  r: number;
2945
3331
  g: number;
2946
3332
  b: number;
2947
3333
  a: number;
2948
3334
  }
2949
- export interface gpuGPURenderPassDepthStencilAttachment {
2950
- view: gpuGPUTextureView;
3335
+ export interface GPURenderPassDepthStencilAttachment {
3336
+ view: GPUTextureView;
2951
3337
  depthClearValue?: number;
2952
3338
  depthLoadOp?: string;
2953
3339
  depthStoreOp?: string;
@@ -2957,127 +3343,1006 @@ export interface gpuGPURenderPassDepthStencilAttachment {
2957
3343
  stencilStoreOp?: string;
2958
3344
  stencilReadOnly?: boolean;
2959
3345
  }
2960
- export interface gpuGPURenderPassTimestampWrites {
2961
- querySet: gpuGPUQuerySet;
3346
+ export interface GPURenderPassTimestampWrites {
3347
+ querySet: GPUQuerySet;
2962
3348
  beginningOfPassWriteIndex?: number;
2963
3349
  endOfPassWriteIndex?: number;
2964
3350
  }
2965
- export interface gpuGPUImageCopyTexture {
2966
- texture: gpuGPUTexture;
3351
+ export interface GPUImageCopyTexture {
3352
+ texture: GPUTexture;
2967
3353
  mipLevel?: number;
2968
- origin?: number[] | gpuGPUOrigin3DDict;
3354
+ origin?: number[] | GPUOrigin3DDict;
2969
3355
  aspect?: string;
2970
3356
  }
2971
- export interface gpuGPUImageCopyBuffer {
2972
- buffer: gpuGPUBuffer;
3357
+ export interface GPUImageCopyBuffer {
3358
+ buffer: GPUBuffer;
2973
3359
  offset?: number | bigint;
2974
3360
  bytesPerRow?: number;
2975
3361
  rowsPerImage?: number;
2976
3362
  }
2977
- export interface gpuGPUOrigin3DDict {
3363
+ export interface GPUOrigin3DDict {
2978
3364
  x?: number;
2979
3365
  y?: number;
2980
3366
  z?: number;
2981
3367
  }
2982
- export interface BasicImageTransformations {
2983
- /**
2984
- * Maximum width in image pixels. The value must be an integer.
2985
- */
2986
- width?: number;
2987
- /**
2988
- * Maximum height in image pixels. The value must be an integer.
2989
- */
2990
- height?: number;
2991
- /**
2992
- * Resizing mode as a string. It affects interpretation of width and height
2993
- * options:
2994
- * - scale-down: Similar to contain, but the image is never enlarged. If
2995
- * the image is larger than given width or height, it will be resized.
2996
- * Otherwise its original size will be kept.
2997
- * - contain: Resizes to maximum size that fits within the given width and
2998
- * height. If only a single dimension is given (e.g. only width), the
2999
- * image will be shrunk or enlarged to exactly match that dimension.
3000
- * Aspect ratio is always preserved.
3001
- * - cover: Resizes (shrinks or enlarges) to fill the entire area of width
3002
- * and height. If the image has an aspect ratio different from the ratio
3003
- * of width and height, it will be cropped to fit.
3004
- * - crop: The image will be shrunk and cropped to fit within the area
3005
- * specified by width and height. The image will not be enlarged. For images
3006
- * smaller than the given dimensions it's the same as scale-down. For
3007
- * images larger than the given dimensions, it's the same as cover.
3008
- * See also trim.
3009
- * - pad: Resizes to the maximum size that fits within the given width and
3010
- * height, and then fills the remaining area with a background color
3011
- * (white by default). Use of this mode is not recommended, as the same
3012
- * effect can be more efficiently achieved with the contain mode and the
3013
- * CSS object-fit: contain property.
3014
- */
3015
- fit?: "scale-down" | "contain" | "cover" | "crop" | "pad";
3016
- /**
3017
- * When cropping with fit: "cover", this defines the side or point that should
3018
- * be left uncropped. The value is either a string
3019
- * "left", "right", "top", "bottom", "auto", or "center" (the default),
3020
- * or an object {x, y} containing focal point coordinates in the original
3021
- * image expressed as fractions ranging from 0.0 (top or left) to 1.0
3022
- * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will
3023
- * crop bottom or left and right sides as necessary, but won’t crop anything
3024
- * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to
3025
- * preserve as much as possible around a point at 20% of the height of the
3026
- * source image.
3027
- */
3028
- gravity?:
3029
- | "left"
3030
- | "right"
3031
- | "top"
3032
- | "bottom"
3033
- | "center"
3034
- | "auto"
3035
- | BasicImageTransformationsGravityCoordinates;
3036
- /**
3037
- * Background color to add underneath the image. Applies only to images with
3038
- * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),
3039
- * hsl(…), etc.)
3040
- */
3041
- background?: string;
3368
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) */
3369
+ export declare class EventSource extends EventTarget {
3370
+ constructor(url: string, init?: EventSourceEventSourceInit);
3042
3371
  /**
3043
- * Number of degrees (90, 180, 270) to rotate the image by. width and height
3044
- * options refer to axes after rotation.
3372
+ * Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
3373
+ *
3374
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
3045
3375
  */
3046
- rotate?: 0 | 90 | 180 | 270 | 360;
3047
- }
3048
- export interface BasicImageTransformationsGravityCoordinates {
3049
- x: number;
3050
- y: number;
3051
- }
3052
- /**
3053
- * In addition to the properties you can set in the RequestInit dict
3054
- * that you pass as an argument to the Request constructor, you can
3055
- * set certain properties of a `cf` object to control how Cloudflare
3056
- * features are applied to that new Request.
3057
- *
3058
- * Note: Currently, these properties cannot be tested in the
3059
- * playground.
3060
- */
3061
- export interface RequestInitCfProperties extends Record<string, unknown> {
3062
- cacheEverything?: boolean;
3376
+ close(): void;
3063
3377
  /**
3064
- * A request's cache key is what determines if two requests are
3065
- * "the same" for caching purposes. If a request has the same cache key
3066
- * as some previous request, then we can serve the same cached response for
3067
- * both. (e.g. 'some-key')
3378
+ * Returns the URL providing the event stream.
3068
3379
  *
3069
- * Only available for Enterprise customers.
3380
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)
3070
3381
  */
3071
- cacheKey?: string;
3382
+ get url(): string;
3072
3383
  /**
3073
- * This allows you to append additional Cache-Tag response headers
3074
- * to the origin response without modifications to the origin server.
3075
- * This will allow for greater control over the Purge by Cache Tag feature
3076
- * utilizing changes only in the Workers process.
3384
+ * Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise.
3077
3385
  *
3078
- * Only available for Enterprise customers.
3386
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
3079
3387
  */
3080
- cacheTags?: string[];
3388
+ get withCredentials(): boolean;
3389
+ /**
3390
+ * Returns the state of this EventSource object's connection. It can have the values described below.
3391
+ *
3392
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)
3393
+ */
3394
+ get readyState(): number;
3395
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
3396
+ get onopen(): any | null;
3397
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
3398
+ set onopen(value: any | null);
3399
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
3400
+ get onmessage(): any | null;
3401
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
3402
+ set onmessage(value: any | null);
3403
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
3404
+ get onerror(): any | null;
3405
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
3406
+ set onerror(value: any | null);
3407
+ static readonly CONNECTING: number;
3408
+ static readonly OPEN: number;
3409
+ static readonly CLOSED: number;
3410
+ static from(stream: ReadableStream): EventSource;
3411
+ }
3412
+ export interface EventSourceEventSourceInit {
3413
+ withCredentials?: boolean;
3414
+ fetcher?: Fetcher;
3415
+ }
3416
+ export type AiImageClassificationInput = {
3417
+ image: number[];
3418
+ };
3419
+ export type AiImageClassificationOutput = {
3420
+ score?: number;
3421
+ label?: string;
3422
+ }[];
3423
+ export declare abstract class BaseAiImageClassification {
3424
+ inputs: AiImageClassificationInput;
3425
+ postProcessedOutputs: AiImageClassificationOutput;
3426
+ }
3427
+ export type AiImageToTextInput = {
3428
+ image: number[];
3429
+ prompt?: string;
3430
+ max_tokens?: number;
3431
+ temperature?: number;
3432
+ top_p?: number;
3433
+ top_k?: number;
3434
+ seed?: number;
3435
+ repetition_penalty?: number;
3436
+ frequency_penalty?: number;
3437
+ presence_penalty?: number;
3438
+ raw?: boolean;
3439
+ messages?: RoleScopedChatInput[];
3440
+ };
3441
+ export type AiImageToTextOutput = {
3442
+ description: string;
3443
+ };
3444
+ export declare abstract class BaseAiImageToText {
3445
+ inputs: AiImageToTextInput;
3446
+ postProcessedOutputs: AiImageToTextOutput;
3447
+ }
3448
+ export type AiObjectDetectionInput = {
3449
+ image: number[];
3450
+ };
3451
+ export type AiObjectDetectionOutput = {
3452
+ score?: number;
3453
+ label?: string;
3454
+ }[];
3455
+ export declare abstract class BaseAiObjectDetection {
3456
+ inputs: AiObjectDetectionInput;
3457
+ postProcessedOutputs: AiObjectDetectionOutput;
3458
+ }
3459
+ export type AiSentenceSimilarityInput = {
3460
+ source: string;
3461
+ sentences: string[];
3462
+ };
3463
+ export type AiSentenceSimilarityOutput = number[];
3464
+ export declare abstract class BaseAiSentenceSimilarity {
3465
+ inputs: AiSentenceSimilarityInput;
3466
+ postProcessedOutputs: AiSentenceSimilarityOutput;
3467
+ }
3468
+ export type AiAutomaticSpeechRecognitionInput = {
3469
+ audio: number[];
3470
+ };
3471
+ export type AiAutomaticSpeechRecognitionOutput = {
3472
+ text?: string;
3473
+ words?: {
3474
+ word: string;
3475
+ start: number;
3476
+ end: number;
3477
+ }[];
3478
+ vtt?: string;
3479
+ };
3480
+ export declare abstract class BaseAiAutomaticSpeechRecognition {
3481
+ inputs: AiAutomaticSpeechRecognitionInput;
3482
+ postProcessedOutputs: AiAutomaticSpeechRecognitionOutput;
3483
+ }
3484
+ export type AiSummarizationInput = {
3485
+ input_text: string;
3486
+ max_length?: number;
3487
+ };
3488
+ export type AiSummarizationOutput = {
3489
+ summary: string;
3490
+ };
3491
+ export declare abstract class BaseAiSummarization {
3492
+ inputs: AiSummarizationInput;
3493
+ postProcessedOutputs: AiSummarizationOutput;
3494
+ }
3495
+ export type AiTextClassificationInput = {
3496
+ text: string;
3497
+ };
3498
+ export type AiTextClassificationOutput = {
3499
+ score?: number;
3500
+ label?: string;
3501
+ }[];
3502
+ export declare abstract class BaseAiTextClassification {
3503
+ inputs: AiTextClassificationInput;
3504
+ postProcessedOutputs: AiTextClassificationOutput;
3505
+ }
3506
+ export type AiTextEmbeddingsInput = {
3507
+ text: string | string[];
3508
+ };
3509
+ export type AiTextEmbeddingsOutput = {
3510
+ shape: number[];
3511
+ data: number[][];
3512
+ };
3513
+ export declare abstract class BaseAiTextEmbeddings {
3514
+ inputs: AiTextEmbeddingsInput;
3515
+ postProcessedOutputs: AiTextEmbeddingsOutput;
3516
+ }
3517
+ export type RoleScopedChatInput = {
3518
+ role:
3519
+ | "user"
3520
+ | "assistant"
3521
+ | "system"
3522
+ | "tool"
3523
+ | (string & NonNullable<unknown>);
3524
+ content: string;
3525
+ name?: string;
3526
+ };
3527
+ export type AiTextGenerationToolLegacyInput = {
3528
+ name: string;
3529
+ description: string;
3530
+ parameters?: {
3531
+ type: "object" | (string & NonNullable<unknown>);
3532
+ properties: {
3533
+ [key: string]: {
3534
+ type: string;
3535
+ description?: string;
3536
+ };
3537
+ };
3538
+ required: string[];
3539
+ };
3540
+ };
3541
+ export type AiTextGenerationToolInput = {
3542
+ type: "function" | (string & NonNullable<unknown>);
3543
+ function: {
3544
+ name: string;
3545
+ description: string;
3546
+ parameters?: {
3547
+ type: "object" | (string & NonNullable<unknown>);
3548
+ properties: {
3549
+ [key: string]: {
3550
+ type: string;
3551
+ description?: string;
3552
+ };
3553
+ };
3554
+ required: string[];
3555
+ };
3556
+ };
3557
+ };
3558
+ export type AiTextGenerationFunctionsInput = {
3559
+ name: string;
3560
+ code: string;
3561
+ };
3562
+ export type AiTextGenerationInput = {
3563
+ prompt?: string;
3564
+ raw?: boolean;
3565
+ stream?: boolean;
3566
+ max_tokens?: number;
3567
+ temperature?: number;
3568
+ top_p?: number;
3569
+ top_k?: number;
3570
+ seed?: number;
3571
+ repetition_penalty?: number;
3572
+ frequency_penalty?: number;
3573
+ presence_penalty?: number;
3574
+ messages?: RoleScopedChatInput[];
3575
+ tools?:
3576
+ | AiTextGenerationToolInput[]
3577
+ | AiTextGenerationToolLegacyInput[]
3578
+ | (object & NonNullable<unknown>);
3579
+ functions?: AiTextGenerationFunctionsInput[];
3580
+ };
3581
+ export type AiTextGenerationOutput =
3582
+ | {
3583
+ response?: string;
3584
+ tool_calls?: {
3585
+ name: string;
3586
+ arguments: unknown;
3587
+ }[];
3588
+ }
3589
+ | ReadableStream;
3590
+ export declare abstract class BaseAiTextGeneration {
3591
+ inputs: AiTextGenerationInput;
3592
+ postProcessedOutputs: AiTextGenerationOutput;
3593
+ }
3594
+ export type AiTextToSpeechInput = {
3595
+ prompt: string;
3596
+ lang?: string;
3597
+ };
3598
+ export type AiTextToSpeechOutput =
3599
+ | Uint8Array
3600
+ | {
3601
+ audio: string;
3602
+ };
3603
+ export declare abstract class BaseAiTextToSpeech {
3604
+ inputs: AiTextToSpeechInput;
3605
+ postProcessedOutputs: AiTextToSpeechOutput;
3606
+ }
3607
+ export type AiTextToImageInput = {
3608
+ prompt: string;
3609
+ negative_prompt?: string;
3610
+ height?: number;
3611
+ width?: number;
3612
+ image?: number[];
3613
+ image_b64?: string;
3614
+ mask?: number[];
3615
+ num_steps?: number;
3616
+ strength?: number;
3617
+ guidance?: number;
3618
+ seed?: number;
3619
+ };
3620
+ export type AiTextToImageOutput = ReadableStream<Uint8Array>;
3621
+ export declare abstract class BaseAiTextToImage {
3622
+ inputs: AiTextToImageInput;
3623
+ postProcessedOutputs: AiTextToImageOutput;
3624
+ }
3625
+ export type AiTranslationInput = {
3626
+ text: string;
3627
+ target_lang: string;
3628
+ source_lang?: string;
3629
+ };
3630
+ export type AiTranslationOutput = {
3631
+ translated_text?: string;
3632
+ };
3633
+ export declare abstract class BaseAiTranslation {
3634
+ inputs: AiTranslationInput;
3635
+ postProcessedOutputs: AiTranslationOutput;
3636
+ }
3637
+ export type Ai_Cf_Openai_Whisper_Input =
3638
+ | string
3639
+ | {
3640
+ /**
3641
+ * An array of integers that represent the audio data constrained to 8-bit unsigned integer values
3642
+ */
3643
+ audio: number[];
3644
+ };
3645
+ export interface Ai_Cf_Openai_Whisper_Output {
3646
+ /**
3647
+ * The transcription
3648
+ */
3649
+ text: string;
3650
+ word_count?: number;
3651
+ words?: {
3652
+ word?: string;
3653
+ /**
3654
+ * The second this word begins in the recording
3655
+ */
3656
+ start?: number;
3657
+ /**
3658
+ * The ending second when the word completes
3659
+ */
3660
+ end?: number;
3661
+ }[];
3662
+ vtt?: string;
3663
+ }
3664
+ export declare abstract class Base_Ai_Cf_Openai_Whisper {
3665
+ inputs: Ai_Cf_Openai_Whisper_Input;
3666
+ postProcessedOutputs: Ai_Cf_Openai_Whisper_Output;
3667
+ }
3668
+ export type Ai_Cf_Openai_Whisper_Tiny_En_Input =
3669
+ | string
3670
+ | {
3671
+ /**
3672
+ * An array of integers that represent the audio data constrained to 8-bit unsigned integer values
3673
+ */
3674
+ audio: number[];
3675
+ };
3676
+ export interface Ai_Cf_Openai_Whisper_Tiny_En_Output {
3677
+ /**
3678
+ * The transcription
3679
+ */
3680
+ text: string;
3681
+ word_count?: number;
3682
+ words?: {
3683
+ word?: string;
3684
+ /**
3685
+ * The second this word begins in the recording
3686
+ */
3687
+ start?: number;
3688
+ /**
3689
+ * The ending second when the word completes
3690
+ */
3691
+ end?: number;
3692
+ }[];
3693
+ vtt?: string;
3694
+ }
3695
+ export declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {
3696
+ inputs: Ai_Cf_Openai_Whisper_Tiny_En_Input;
3697
+ postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;
3698
+ }
3699
+ export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
3700
+ /**
3701
+ * Base64 encoded value of the audio data.
3702
+ */
3703
+ audio: string;
3704
+ /**
3705
+ * Supported tasks are 'translate' or 'transcribe'.
3706
+ */
3707
+ task?: string;
3708
+ /**
3709
+ * The language of the audio being transcribed or translated.
3710
+ */
3711
+ language?: string;
3712
+ /**
3713
+ * Preprocess the audio with a voice activity detection model.
3714
+ */
3715
+ vad_filter?: string;
3716
+ /**
3717
+ * A text prompt to help provide context to the model on the contents of the audio.
3718
+ */
3719
+ initial_prompt?: string;
3720
+ /**
3721
+ * The prefix it appended the the beginning of the output of the transcription and can guide the transcription result.
3722
+ */
3723
+ prefix?: string;
3724
+ }
3725
+ export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
3726
+ transcription_info?: {
3727
+ /**
3728
+ * The language of the audio being transcribed or translated.
3729
+ */
3730
+ language?: string;
3731
+ /**
3732
+ * The confidence level or probability of the detected language being accurate, represented as a decimal between 0 and 1.
3733
+ */
3734
+ language_probability?: number;
3735
+ /**
3736
+ * The total duration of the original audio file, in seconds.
3737
+ */
3738
+ duration?: number;
3739
+ /**
3740
+ * The duration of the audio after applying Voice Activity Detection (VAD) to remove silent or irrelevant sections, in seconds.
3741
+ */
3742
+ duration_after_vad?: number;
3743
+ };
3744
+ /**
3745
+ * The complete transcription of the audio.
3746
+ */
3747
+ text: string;
3748
+ /**
3749
+ * The total number of words in the transcription.
3750
+ */
3751
+ word_count?: number;
3752
+ segments?: {
3753
+ /**
3754
+ * The starting time of the segment within the audio, in seconds.
3755
+ */
3756
+ start?: number;
3757
+ /**
3758
+ * The ending time of the segment within the audio, in seconds.
3759
+ */
3760
+ end?: number;
3761
+ /**
3762
+ * The transcription of the segment.
3763
+ */
3764
+ text?: string;
3765
+ /**
3766
+ * The temperature used in the decoding process, controlling randomness in predictions. Lower values result in more deterministic outputs.
3767
+ */
3768
+ temperature?: number;
3769
+ /**
3770
+ * The average log probability of the predictions for the words in this segment, indicating overall confidence.
3771
+ */
3772
+ avg_logprob?: number;
3773
+ /**
3774
+ * The compression ratio of the input to the output, measuring how much the text was compressed during the transcription process.
3775
+ */
3776
+ compression_ratio?: number;
3777
+ /**
3778
+ * The probability that the segment contains no speech, represented as a decimal between 0 and 1.
3779
+ */
3780
+ no_speech_prob?: number;
3781
+ words?: {
3782
+ /**
3783
+ * The individual word transcribed from the audio.
3784
+ */
3785
+ word?: string;
3786
+ /**
3787
+ * The starting time of the word within the audio, in seconds.
3788
+ */
3789
+ start?: number;
3790
+ /**
3791
+ * The ending time of the word within the audio, in seconds.
3792
+ */
3793
+ end?: number;
3794
+ }[];
3795
+ };
3796
+ /**
3797
+ * The transcription in WebVTT format, which includes timing and text information for use in subtitles.
3798
+ */
3799
+ vtt?: string;
3800
+ }
3801
+ export declare abstract class Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo {
3802
+ inputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input;
3803
+ postProcessedOutputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output;
3804
+ }
3805
+ export interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input {
3806
+ /**
3807
+ * A text description of the image you want to generate.
3808
+ */
3809
+ prompt: string;
3810
+ /**
3811
+ * The number of diffusion steps; higher values can improve quality but take longer.
3812
+ */
3813
+ steps?: number;
3814
+ }
3815
+ export interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output {
3816
+ /**
3817
+ * The generated image in Base64 format.
3818
+ */
3819
+ image?: string;
3820
+ }
3821
+ export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell {
3822
+ inputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input;
3823
+ postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output;
3824
+ }
3825
+ export type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input = Prompt | Messages;
3826
+ export interface Prompt {
3827
+ /**
3828
+ * The input text prompt for the model to generate a response.
3829
+ */
3830
+ prompt: string;
3831
+ image?: number[] | (string & NonNullable<unknown>);
3832
+ /**
3833
+ * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
3834
+ */
3835
+ raw?: boolean;
3836
+ /**
3837
+ * If true, the response will be streamed back incrementally using SSE, Server Sent Events.
3838
+ */
3839
+ stream?: boolean;
3840
+ /**
3841
+ * The maximum number of tokens to generate in the response.
3842
+ */
3843
+ max_tokens?: number;
3844
+ /**
3845
+ * Controls the randomness of the output; higher values produce more random results.
3846
+ */
3847
+ temperature?: number;
3848
+ /**
3849
+ * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
3850
+ */
3851
+ top_p?: number;
3852
+ /**
3853
+ * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
3854
+ */
3855
+ top_k?: number;
3856
+ /**
3857
+ * Random seed for reproducibility of the generation.
3858
+ */
3859
+ seed?: number;
3860
+ /**
3861
+ * Penalty for repeated tokens; higher values discourage repetition.
3862
+ */
3863
+ repetition_penalty?: number;
3864
+ /**
3865
+ * Decreases the likelihood of the model repeating the same lines verbatim.
3866
+ */
3867
+ frequency_penalty?: number;
3868
+ /**
3869
+ * Increases the likelihood of the model introducing new topics.
3870
+ */
3871
+ presence_penalty?: number;
3872
+ /**
3873
+ * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
3874
+ */
3875
+ lora?: string;
3876
+ }
3877
+ export interface Messages {
3878
+ /**
3879
+ * An array of message objects representing the conversation history.
3880
+ */
3881
+ messages: {
3882
+ /**
3883
+ * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
3884
+ */
3885
+ role: string;
3886
+ /**
3887
+ * The content of the message as a string.
3888
+ */
3889
+ content: string;
3890
+ }[];
3891
+ image?: number[] | string;
3892
+ functions?: {
3893
+ name: string;
3894
+ code: string;
3895
+ }[];
3896
+ /**
3897
+ * A list of tools available for the assistant to use.
3898
+ */
3899
+ tools?: (
3900
+ | {
3901
+ /**
3902
+ * The name of the tool. More descriptive the better.
3903
+ */
3904
+ name: string;
3905
+ /**
3906
+ * A brief description of what the tool does.
3907
+ */
3908
+ description: string;
3909
+ /**
3910
+ * Schema defining the parameters accepted by the tool.
3911
+ */
3912
+ parameters: {
3913
+ /**
3914
+ * The type of the parameters object (usually 'object').
3915
+ */
3916
+ type: string;
3917
+ /**
3918
+ * List of required parameter names.
3919
+ */
3920
+ required?: string[];
3921
+ /**
3922
+ * Definitions of each parameter.
3923
+ */
3924
+ properties: {
3925
+ [k: string]: {
3926
+ /**
3927
+ * The data type of the parameter.
3928
+ */
3929
+ type: string;
3930
+ /**
3931
+ * A description of the expected parameter.
3932
+ */
3933
+ description: string;
3934
+ };
3935
+ };
3936
+ };
3937
+ }
3938
+ | {
3939
+ /**
3940
+ * Specifies the type of tool (e.g., 'function').
3941
+ */
3942
+ type: string;
3943
+ /**
3944
+ * Details of the function tool.
3945
+ */
3946
+ function: {
3947
+ /**
3948
+ * The name of the function.
3949
+ */
3950
+ name: string;
3951
+ /**
3952
+ * A brief description of what the function does.
3953
+ */
3954
+ description: string;
3955
+ /**
3956
+ * Schema defining the parameters accepted by the function.
3957
+ */
3958
+ parameters: {
3959
+ /**
3960
+ * The type of the parameters object (usually 'object').
3961
+ */
3962
+ type: string;
3963
+ /**
3964
+ * List of required parameter names.
3965
+ */
3966
+ required?: string[];
3967
+ /**
3968
+ * Definitions of each parameter.
3969
+ */
3970
+ properties: {
3971
+ [k: string]: {
3972
+ /**
3973
+ * The data type of the parameter.
3974
+ */
3975
+ type: string;
3976
+ /**
3977
+ * A description of the expected parameter.
3978
+ */
3979
+ description: string;
3980
+ };
3981
+ };
3982
+ };
3983
+ };
3984
+ }
3985
+ )[];
3986
+ /**
3987
+ * If true, the response will be streamed back incrementally.
3988
+ */
3989
+ stream?: boolean;
3990
+ /**
3991
+ * The maximum number of tokens to generate in the response.
3992
+ */
3993
+ max_tokens?: number;
3994
+ /**
3995
+ * Controls the randomness of the output; higher values produce more random results.
3996
+ */
3997
+ temperature?: number;
3998
+ /**
3999
+ * Controls the creativity of the AI's responses by adjusting how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
4000
+ */
4001
+ top_p?: number;
4002
+ /**
4003
+ * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
4004
+ */
4005
+ top_k?: number;
4006
+ /**
4007
+ * Random seed for reproducibility of the generation.
4008
+ */
4009
+ seed?: number;
4010
+ /**
4011
+ * Penalty for repeated tokens; higher values discourage repetition.
4012
+ */
4013
+ repetition_penalty?: number;
4014
+ /**
4015
+ * Decreases the likelihood of the model repeating the same lines verbatim.
4016
+ */
4017
+ frequency_penalty?: number;
4018
+ /**
4019
+ * Increases the likelihood of the model introducing new topics.
4020
+ */
4021
+ presence_penalty?: number;
4022
+ }
4023
+ export type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output =
4024
+ | {
4025
+ /**
4026
+ * The generated text response from the model
4027
+ */
4028
+ response?: string;
4029
+ /**
4030
+ * An array of tool calls requests made during the response generation
4031
+ */
4032
+ tool_calls?: {
4033
+ /**
4034
+ * The arguments passed to be passed to the tool call request
4035
+ */
4036
+ arguments?: object;
4037
+ /**
4038
+ * The name of the tool to be called
4039
+ */
4040
+ name?: string;
4041
+ }[];
4042
+ }
4043
+ | ReadableStream;
4044
+ export declare abstract class Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct {
4045
+ inputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input;
4046
+ postProcessedOutputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output;
4047
+ }
4048
+ export interface AiModels {
4049
+ "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
4050
+ "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
4051
+ "@cf/runwayml/stable-diffusion-v1-5-inpainting": BaseAiTextToImage;
4052
+ "@cf/runwayml/stable-diffusion-v1-5-img2img": BaseAiTextToImage;
4053
+ "@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage;
4054
+ "@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage;
4055
+ "@cf/baai/bge-base-en-v1.5": BaseAiTextEmbeddings;
4056
+ "@cf/baai/bge-small-en-v1.5": BaseAiTextEmbeddings;
4057
+ "@cf/baai/bge-large-en-v1.5": BaseAiTextEmbeddings;
4058
+ "@cf/microsoft/resnet-50": BaseAiImageClassification;
4059
+ "@cf/facebook/detr-resnet-50": BaseAiObjectDetection;
4060
+ "@cf/meta/llama-2-7b-chat-int8": BaseAiTextGeneration;
4061
+ "@cf/mistral/mistral-7b-instruct-v0.1": BaseAiTextGeneration;
4062
+ "@cf/meta/llama-2-7b-chat-fp16": BaseAiTextGeneration;
4063
+ "@hf/thebloke/llama-2-13b-chat-awq": BaseAiTextGeneration;
4064
+ "@hf/thebloke/mistral-7b-instruct-v0.1-awq": BaseAiTextGeneration;
4065
+ "@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;
4066
+ "@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;
4067
+ "@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;
4068
+ "@hf/thebloke/llamaguard-7b-awq": BaseAiTextGeneration;
4069
+ "@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;
4070
+ "@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;
4071
+ "@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;
4072
+ "@cf/defog/sqlcoder-7b-2": BaseAiTextGeneration;
4073
+ "@cf/openchat/openchat-3.5-0106": BaseAiTextGeneration;
4074
+ "@cf/tiiuae/falcon-7b-instruct": BaseAiTextGeneration;
4075
+ "@cf/thebloke/discolm-german-7b-v1-awq": BaseAiTextGeneration;
4076
+ "@cf/qwen/qwen1.5-0.5b-chat": BaseAiTextGeneration;
4077
+ "@cf/qwen/qwen1.5-7b-chat-awq": BaseAiTextGeneration;
4078
+ "@cf/qwen/qwen1.5-14b-chat-awq": BaseAiTextGeneration;
4079
+ "@cf/tinyllama/tinyllama-1.1b-chat-v1.0": BaseAiTextGeneration;
4080
+ "@cf/microsoft/phi-2": BaseAiTextGeneration;
4081
+ "@cf/qwen/qwen1.5-1.8b-chat": BaseAiTextGeneration;
4082
+ "@cf/mistral/mistral-7b-instruct-v0.2-lora": BaseAiTextGeneration;
4083
+ "@hf/nousresearch/hermes-2-pro-mistral-7b": BaseAiTextGeneration;
4084
+ "@hf/nexusflow/starling-lm-7b-beta": BaseAiTextGeneration;
4085
+ "@hf/google/gemma-7b-it": BaseAiTextGeneration;
4086
+ "@cf/meta-llama/llama-2-7b-chat-hf-lora": BaseAiTextGeneration;
4087
+ "@cf/google/gemma-2b-it-lora": BaseAiTextGeneration;
4088
+ "@cf/google/gemma-7b-it-lora": BaseAiTextGeneration;
4089
+ "@hf/mistral/mistral-7b-instruct-v0.2": BaseAiTextGeneration;
4090
+ "@cf/meta/llama-3-8b-instruct": BaseAiTextGeneration;
4091
+ "@cf/fblgit/una-cybertron-7b-v2-bf16": BaseAiTextGeneration;
4092
+ "@cf/meta/llama-3-8b-instruct-awq": BaseAiTextGeneration;
4093
+ "@hf/meta-llama/meta-llama-3-8b-instruct": BaseAiTextGeneration;
4094
+ "@cf/meta/llama-3.1-8b-instruct": BaseAiTextGeneration;
4095
+ "@cf/meta/llama-3.1-8b-instruct-fp8": BaseAiTextGeneration;
4096
+ "@cf/meta/llama-3.1-8b-instruct-awq": BaseAiTextGeneration;
4097
+ "@cf/meta/llama-3.2-3b-instruct": BaseAiTextGeneration;
4098
+ "@cf/meta/llama-3.2-1b-instruct": BaseAiTextGeneration;
4099
+ "@cf/meta/llama-3.3-70b-instruct-fp8-fast": BaseAiTextGeneration;
4100
+ "@cf/meta/m2m100-1.2b": BaseAiTranslation;
4101
+ "@cf/facebook/bart-large-cnn": BaseAiSummarization;
4102
+ "@cf/unum/uform-gen2-qwen-500m": BaseAiImageToText;
4103
+ "@cf/llava-hf/llava-1.5-7b-hf": BaseAiImageToText;
4104
+ "@cf/openai/whisper": Base_Ai_Cf_Openai_Whisper;
4105
+ "@cf/openai/whisper-tiny-en": Base_Ai_Cf_Openai_Whisper_Tiny_En;
4106
+ "@cf/openai/whisper-large-v3-turbo": Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo;
4107
+ "@cf/black-forest-labs/flux-1-schnell": Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell;
4108
+ "@cf/meta/llama-3.2-11b-vision-instruct": Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct;
4109
+ }
4110
+ export type AiOptions = {
4111
+ gateway?: GatewayOptions;
4112
+ prefix?: string;
4113
+ extraHeaders?: object;
4114
+ };
4115
+ export type AiModelsSearchParams = {
4116
+ author?: string;
4117
+ hide_experimental?: boolean;
4118
+ page?: number;
4119
+ per_page?: number;
4120
+ search?: string;
4121
+ source?: number;
4122
+ task?: string;
4123
+ };
4124
+ export type AiModelsSearchObject = {
4125
+ id: string;
4126
+ source: number;
4127
+ name: string;
4128
+ description: string;
4129
+ task: {
4130
+ id: string;
4131
+ name: string;
4132
+ description: string;
4133
+ };
4134
+ tags: string[];
4135
+ properties: {
4136
+ property_id: string;
4137
+ value: string;
4138
+ }[];
4139
+ };
4140
+ export interface InferenceUpstreamError extends Error {}
4141
+ export interface AiInternalError extends Error {}
4142
+ export type AiModelListType = Record<string, any>;
4143
+ export declare abstract class Ai<
4144
+ AiModelList extends AiModelListType = AiModels,
4145
+ > {
4146
+ aiGatewayLogId: string | null;
4147
+ gateway(gatewayId: string): AiGateway;
4148
+ run<Name extends keyof AiModelList>(
4149
+ model: Name,
4150
+ inputs: AiModelList[Name]["inputs"],
4151
+ options?: AiOptions,
4152
+ ): Promise<AiModelList[Name]["postProcessedOutputs"]>;
4153
+ public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
4154
+ }
4155
+ export type GatewayOptions = {
4156
+ id: string;
4157
+ cacheKey?: string;
4158
+ cacheTtl?: number;
4159
+ skipCache?: boolean;
4160
+ metadata?: Record<string, number | string | boolean | null | bigint>;
4161
+ collectLog?: boolean;
4162
+ };
4163
+ export type AiGatewayPatchLog = {
4164
+ score?: number | null;
4165
+ feedback?: -1 | 1 | null;
4166
+ metadata?: Record<string, number | string | boolean | null | bigint> | null;
4167
+ };
4168
+ export type AiGatewayLog = {
4169
+ id: string;
4170
+ provider: string;
4171
+ model: string;
4172
+ model_type?: string;
4173
+ path: string;
4174
+ duration: number;
4175
+ request_type?: string;
4176
+ request_content_type?: string;
4177
+ status_code: number;
4178
+ response_content_type?: string;
4179
+ success: boolean;
4180
+ cached: boolean;
4181
+ tokens_in?: number;
4182
+ tokens_out?: number;
4183
+ metadata?: Record<string, number | string | boolean | null | bigint>;
4184
+ step?: number;
4185
+ cost?: number;
4186
+ custom_cost?: boolean;
4187
+ request_size: number;
4188
+ request_head?: string;
4189
+ request_head_complete: boolean;
4190
+ response_size: number;
4191
+ response_head?: string;
4192
+ response_head_complete: boolean;
4193
+ created_at: Date;
4194
+ };
4195
+ export type AIGatewayProviders =
4196
+ | "workers-ai"
4197
+ | "anthropic"
4198
+ | "aws-bedrock"
4199
+ | "azure-openai"
4200
+ | "google-vertex-ai"
4201
+ | "huggingface"
4202
+ | "openai"
4203
+ | "perplexity-ai"
4204
+ | "replicate"
4205
+ | "groq"
4206
+ | "cohere"
4207
+ | "google-ai-studio"
4208
+ | "mistral"
4209
+ | "grok"
4210
+ | "openrouter";
4211
+ export type AIGatewayHeaders = {
4212
+ "cf-aig-metadata":
4213
+ | Record<string, number | string | boolean | null | bigint>
4214
+ | string;
4215
+ "cf-aig-custom-cost":
4216
+ | {
4217
+ per_token_in?: number;
4218
+ per_token_out?: number;
4219
+ }
4220
+ | {
4221
+ total_cost?: number;
4222
+ }
4223
+ | string;
4224
+ "cf-aig-cache-ttl": number | string;
4225
+ "cf-aig-skip-cache": boolean | string;
4226
+ "cf-aig-cache-key": string;
4227
+ "cf-aig-collect-log": boolean | string;
4228
+ Authorization: string;
4229
+ "Content-Type": string;
4230
+ [key: string]: string | number | boolean | object;
4231
+ };
4232
+ export type AIGatewayUniversalRequest = {
4233
+ provider: AIGatewayProviders | string; // eslint-disable-line
4234
+ endpoint: string;
4235
+ headers: Partial<AIGatewayHeaders>;
4236
+ query: unknown;
4237
+ };
4238
+ export interface AiGatewayInternalError extends Error {}
4239
+ export interface AiGatewayLogNotFound extends Error {}
4240
+ export declare abstract class AiGateway {
4241
+ patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;
4242
+ getLog(logId: string): Promise<AiGatewayLog>;
4243
+ run(
4244
+ data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[],
4245
+ ): Promise<Response>;
4246
+ }
4247
+ export interface BasicImageTransformations {
4248
+ /**
4249
+ * Maximum width in image pixels. The value must be an integer.
4250
+ */
4251
+ width?: number;
4252
+ /**
4253
+ * Maximum height in image pixels. The value must be an integer.
4254
+ */
4255
+ height?: number;
4256
+ /**
4257
+ * Resizing mode as a string. It affects interpretation of width and height
4258
+ * options:
4259
+ * - scale-down: Similar to contain, but the image is never enlarged. If
4260
+ * the image is larger than given width or height, it will be resized.
4261
+ * Otherwise its original size will be kept.
4262
+ * - contain: Resizes to maximum size that fits within the given width and
4263
+ * height. If only a single dimension is given (e.g. only width), the
4264
+ * image will be shrunk or enlarged to exactly match that dimension.
4265
+ * Aspect ratio is always preserved.
4266
+ * - cover: Resizes (shrinks or enlarges) to fill the entire area of width
4267
+ * and height. If the image has an aspect ratio different from the ratio
4268
+ * of width and height, it will be cropped to fit.
4269
+ * - crop: The image will be shrunk and cropped to fit within the area
4270
+ * specified by width and height. The image will not be enlarged. For images
4271
+ * smaller than the given dimensions it's the same as scale-down. For
4272
+ * images larger than the given dimensions, it's the same as cover.
4273
+ * See also trim.
4274
+ * - pad: Resizes to the maximum size that fits within the given width and
4275
+ * height, and then fills the remaining area with a background color
4276
+ * (white by default). Use of this mode is not recommended, as the same
4277
+ * effect can be more efficiently achieved with the contain mode and the
4278
+ * CSS object-fit: contain property.
4279
+ */
4280
+ fit?: "scale-down" | "contain" | "cover" | "crop" | "pad";
4281
+ /**
4282
+ * When cropping with fit: "cover", this defines the side or point that should
4283
+ * be left uncropped. The value is either a string
4284
+ * "left", "right", "top", "bottom", "auto", or "center" (the default),
4285
+ * or an object {x, y} containing focal point coordinates in the original
4286
+ * image expressed as fractions ranging from 0.0 (top or left) to 1.0
4287
+ * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will
4288
+ * crop bottom or left and right sides as necessary, but won’t crop anything
4289
+ * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to
4290
+ * preserve as much as possible around a point at 20% of the height of the
4291
+ * source image.
4292
+ */
4293
+ gravity?:
4294
+ | "left"
4295
+ | "right"
4296
+ | "top"
4297
+ | "bottom"
4298
+ | "center"
4299
+ | "auto"
4300
+ | BasicImageTransformationsGravityCoordinates;
4301
+ /**
4302
+ * Background color to add underneath the image. Applies only to images with
4303
+ * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),
4304
+ * hsl(…), etc.)
4305
+ */
4306
+ background?: string;
4307
+ /**
4308
+ * Number of degrees (90, 180, 270) to rotate the image by. width and height
4309
+ * options refer to axes after rotation.
4310
+ */
4311
+ rotate?: 0 | 90 | 180 | 270 | 360;
4312
+ }
4313
+ export interface BasicImageTransformationsGravityCoordinates {
4314
+ x: number;
4315
+ y: number;
4316
+ }
4317
+ /**
4318
+ * In addition to the properties you can set in the RequestInit dict
4319
+ * that you pass as an argument to the Request constructor, you can
4320
+ * set certain properties of a `cf` object to control how Cloudflare
4321
+ * features are applied to that new Request.
4322
+ *
4323
+ * Note: Currently, these properties cannot be tested in the
4324
+ * playground.
4325
+ */
4326
+ export interface RequestInitCfProperties extends Record<string, unknown> {
4327
+ cacheEverything?: boolean;
4328
+ /**
4329
+ * A request's cache key is what determines if two requests are
4330
+ * "the same" for caching purposes. If a request has the same cache key
4331
+ * as some previous request, then we can serve the same cached response for
4332
+ * both. (e.g. 'some-key')
4333
+ *
4334
+ * Only available for Enterprise customers.
4335
+ */
4336
+ cacheKey?: string;
4337
+ /**
4338
+ * This allows you to append additional Cache-Tag response headers
4339
+ * to the origin response without modifications to the origin server.
4340
+ * This will allow for greater control over the Purge by Cache Tag feature
4341
+ * utilizing changes only in the Workers process.
4342
+ *
4343
+ * Only available for Enterprise customers.
4344
+ */
4345
+ cacheTags?: string[];
3081
4346
  /**
3082
4347
  * Force response to be cached for a given number of seconds. (e.g. 300)
3083
4348
  */
@@ -3093,6 +4358,7 @@ export interface RequestInitCfProperties extends Record<string, unknown> {
3093
4358
  minify?: RequestInitCfPropertiesImageMinify;
3094
4359
  mirage?: boolean;
3095
4360
  polish?: "lossy" | "lossless" | "off";
4361
+ r2?: RequestInitCfPropertiesR2;
3096
4362
  /**
3097
4363
  * Redirects the request to an alternate origin server. You can use this,
3098
4364
  * for example, to implement load balancing across several origins.
@@ -3277,6 +4543,12 @@ export interface RequestInitCfPropertiesImageMinify {
3277
4543
  css?: boolean;
3278
4544
  html?: boolean;
3279
4545
  }
4546
+ export interface RequestInitCfPropertiesR2 {
4547
+ /**
4548
+ * Colo id of bucket that an object is stored in
4549
+ */
4550
+ bucketColoId?: number;
4551
+ }
3280
4552
  /**
3281
4553
  * Request metadata provided by Cloudflare's edge.
3282
4554
  */
@@ -3669,7 +4941,7 @@ export interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {
3669
4941
  certNotAfter: "";
3670
4942
  }
3671
4943
  /** Possible outcomes of TLS verification */
3672
- export type CertVerificationStatus =
4944
+ export declare type CertVerificationStatus =
3673
4945
  /** Authentication succeeded */
3674
4946
  | "SUCCESS"
3675
4947
  /** No certificate was presented */
@@ -3687,7 +4959,7 @@ export type CertVerificationStatus =
3687
4959
  /**
3688
4960
  * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare.
3689
4961
  */
3690
- export type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus =
4962
+ export declare type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus =
3691
4963
  | 0 /** Unknown */
3692
4964
  | 1 /** no keepalives (not found) */
3693
4965
  | 2 /** no connection re-use, opening keepalive connection failed */
@@ -3695,7 +4967,7 @@ export type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus =
3695
4967
  | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */
3696
4968
  | 5; /** connection re-use, accepted by the origin server */
3697
4969
  /** ISO 3166-1 Alpha-2 codes */
3698
- export type Iso3166Alpha2Code =
4970
+ export declare type Iso3166Alpha2Code =
3699
4971
  | "AD"
3700
4972
  | "AE"
3701
4973
  | "AF"
@@ -3946,7 +5218,14 @@ export type Iso3166Alpha2Code =
3946
5218
  | "ZM"
3947
5219
  | "ZW";
3948
5220
  /** The 2-letter continent codes Cloudflare uses */
3949
- export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
5221
+ export declare type ContinentCode =
5222
+ | "AF"
5223
+ | "AN"
5224
+ | "AS"
5225
+ | "EU"
5226
+ | "NA"
5227
+ | "OC"
5228
+ | "SA";
3950
5229
  export type CfProperties<HostMetadata = unknown> =
3951
5230
  | IncomingRequestCfProperties<HostMetadata>
3952
5231
  | RequestInitCfProperties;
@@ -3981,7 +5260,7 @@ export declare abstract class D1PreparedStatement {
3981
5260
  bind(...values: unknown[]): D1PreparedStatement;
3982
5261
  first<T = unknown>(colName: string): Promise<T | null>;
3983
5262
  first<T = Record<string, unknown>>(): Promise<T | null>;
3984
- run(): Promise<D1Response>;
5263
+ run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
3985
5264
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
3986
5265
  raw<T = unknown[]>(options: {
3987
5266
  columnNames: true;
@@ -4037,6 +5316,12 @@ export interface ForwardableEmailMessage extends EmailMessage {
4037
5316
  * @returns A promise that resolves when the email message is forwarded.
4038
5317
  */
4039
5318
  forward(rcptTo: string, headers?: Headers): Promise<void>;
5319
+ /**
5320
+ * Reply to the sender of this email message with a new EmailMessage object.
5321
+ * @param message The reply message.
5322
+ * @returns A promise that resolves when the email message is replied.
5323
+ */
5324
+ reply(message: EmailMessage): Promise<void>;
4040
5325
  }
4041
5326
  /**
4042
5327
  * A binding that allows a Worker to send email messages.
@@ -4047,7 +5332,7 @@ export interface SendEmail {
4047
5332
  export declare abstract class EmailEvent extends ExtendableEvent {
4048
5333
  readonly message: ForwardableEmailMessage;
4049
5334
  }
4050
- export type EmailExportedHandler<Env = unknown> = (
5335
+ export declare type EmailExportedHandler<Env = unknown> = (
4051
5336
  message: ForwardableEmailMessage,
4052
5337
  env: Env,
4053
5338
  ctx: ExecutionContext,
@@ -4099,6 +5384,128 @@ export interface Hyperdrive {
4099
5384
  */
4100
5385
  readonly database: string;
4101
5386
  }
5387
+ // Copyright (c) 2024 Cloudflare, Inc.
5388
+ // Licensed under the Apache 2.0 license found in the LICENSE file or at:
5389
+ // https://opensource.org/licenses/Apache-2.0
5390
+ export type ImageInfoResponse =
5391
+ | {
5392
+ format: "image/svg+xml";
5393
+ }
5394
+ | {
5395
+ format: string;
5396
+ fileSize: number;
5397
+ width: number;
5398
+ height: number;
5399
+ };
5400
+ export type ImageTransform = {
5401
+ fit?: "scale-down" | "contain" | "pad" | "squeeze" | "cover" | "crop";
5402
+ gravity?:
5403
+ | "left"
5404
+ | "right"
5405
+ | "top"
5406
+ | "bottom"
5407
+ | "center"
5408
+ | "auto"
5409
+ | "entropy"
5410
+ | "face"
5411
+ | {
5412
+ x?: number;
5413
+ y?: number;
5414
+ mode: "remainder" | "box-center";
5415
+ };
5416
+ trim?: {
5417
+ top?: number;
5418
+ bottom?: number;
5419
+ left?: number;
5420
+ right?: number;
5421
+ width?: number;
5422
+ height?: number;
5423
+ border?:
5424
+ | boolean
5425
+ | {
5426
+ color?: string;
5427
+ tolerance?: number;
5428
+ keep?: number;
5429
+ };
5430
+ };
5431
+ width?: number;
5432
+ height?: number;
5433
+ background?: string;
5434
+ rotate?: number;
5435
+ sharpen?: number;
5436
+ blur?: number;
5437
+ contrast?: number;
5438
+ brightness?: number;
5439
+ gamma?: number;
5440
+ border?: {
5441
+ color?: string;
5442
+ width?: number;
5443
+ top?: number;
5444
+ bottom?: number;
5445
+ left?: number;
5446
+ right?: number;
5447
+ };
5448
+ zoom?: number;
5449
+ };
5450
+ export type ImageOutputOptions = {
5451
+ format:
5452
+ | "image/jpeg"
5453
+ | "image/png"
5454
+ | "image/gif"
5455
+ | "image/webp"
5456
+ | "image/avif"
5457
+ | "rgb"
5458
+ | "rgba";
5459
+ quality?: number;
5460
+ background?: string;
5461
+ };
5462
+ export interface ImagesBinding {
5463
+ /**
5464
+ * Get image metadata (type, width and height)
5465
+ * @throws {@link ImagesError} with code 9412 if input is not an image
5466
+ * @param stream The image bytes
5467
+ */
5468
+ info(stream: ReadableStream<Uint8Array>): Promise<ImageInfoResponse>;
5469
+ /**
5470
+ * Begin applying a series of transformations to an image
5471
+ * @param stream The image bytes
5472
+ * @returns A transform handle
5473
+ */
5474
+ input(stream: ReadableStream<Uint8Array>): ImageTransformer;
5475
+ }
5476
+ export interface ImageTransformer {
5477
+ /**
5478
+ * Apply transform next, returning a transform handle.
5479
+ * You can then apply more transformations or retrieve the output.
5480
+ * @param transform
5481
+ */
5482
+ transform(transform: ImageTransform): ImageTransformer;
5483
+ /**
5484
+ * Retrieve the image that results from applying the transforms to the
5485
+ * provided input
5486
+ * @param options Options that apply to the output e.g. output format
5487
+ */
5488
+ output(options: ImageOutputOptions): Promise<ImageTransformationResult>;
5489
+ }
5490
+ export interface ImageTransformationResult {
5491
+ /**
5492
+ * The image as a response, ready to store in cache or return to users
5493
+ */
5494
+ response(): Response;
5495
+ /**
5496
+ * The content type of the returned image
5497
+ */
5498
+ contentType(): string;
5499
+ /**
5500
+ * The bytes of the response
5501
+ */
5502
+ image(): ReadableStream<Uint8Array>;
5503
+ }
5504
+ export interface ImagesError extends Error {
5505
+ readonly code: number;
5506
+ readonly message: string;
5507
+ readonly stack?: string;
5508
+ }
4102
5509
  export type Params<P extends string = any> = Record<P, string | string[]>;
4103
5510
  export type EventContext<Env, P extends string, Data> = {
4104
5511
  request: Request<unknown, IncomingRequestCfProperties<unknown>>;
@@ -4142,6 +5549,30 @@ export type PagesPluginFunction<
4142
5549
  > = (
4143
5550
  context: EventPluginContext<Env, Params, Data, PluginArgs>,
4144
5551
  ) => Response | Promise<Response>;
5552
+ // Copyright (c) 2022-2023 Cloudflare, Inc.
5553
+ // Licensed under the Apache 2.0 license found in the LICENSE file or at:
5554
+ // https://opensource.org/licenses/Apache-2.0
5555
+ export declare abstract class PipelineTransform {
5556
+ /**
5557
+ * transformJson recieves an array of javascript objects which can be
5558
+ * mutated and returned to the pipeline
5559
+ * @param data The data to be mutated
5560
+ * @returns A promise containing the mutated data
5561
+ */
5562
+ public transformJson(data: object[]): Promise<object[]>;
5563
+ }
5564
+ // Copyright (c) 2022-2023 Cloudflare, Inc.
5565
+ // Licensed under the Apache 2.0 license found in the LICENSE file or at:
5566
+ // https://opensource.org/licenses/Apache-2.0
5567
+ export interface Pipeline {
5568
+ /**
5569
+ * send takes an array of javascript objects which are
5570
+ * then received by the pipeline for processing
5571
+ *
5572
+ * @param data The data to be sent
5573
+ */
5574
+ send(data: object[]): Promise<void>;
5575
+ }
4145
5576
  // PubSubMessage represents an incoming PubSub message.
4146
5577
  // The message includes metadata about the broker, the client, and the payload
4147
5578
  // itself.
@@ -4176,6 +5607,20 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
4176
5607
  // Key Identifier of the JWK
4177
5608
  readonly kid: string;
4178
5609
  }
5610
+ export interface RateLimitOptions {
5611
+ key: string;
5612
+ }
5613
+ export interface RateLimitOutcome {
5614
+ success: boolean;
5615
+ }
5616
+ export interface RateLimit {
5617
+ /**
5618
+ * Rate limit a request based on the provided options.
5619
+ * @see https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit/
5620
+ * @returns A promise that resolves with the outcome of the rate limit.
5621
+ */
5622
+ limit(options: RateLimitOptions): Promise<RateLimitOutcome>;
5623
+ }
4179
5624
  // Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need
4180
5625
  // to referenced by `Fetcher`. This is included in the "importable" version of the types which
4181
5626
  // strips all `module` blocks.
@@ -4188,6 +5633,7 @@ export declare namespace Rpc {
4188
5633
  export const __RPC_TARGET_BRAND: "__RPC_TARGET_BRAND";
4189
5634
  export const __WORKER_ENTRYPOINT_BRAND: "__WORKER_ENTRYPOINT_BRAND";
4190
5635
  export const __DURABLE_OBJECT_BRAND: "__DURABLE_OBJECT_BRAND";
5636
+ export const __WORKFLOW_ENTRYPOINT_BRAND: "__WORKFLOW_ENTRYPOINT_BRAND";
4191
5637
  export interface RpcTargetBranded {
4192
5638
  [__RPC_TARGET_BRAND]: never;
4193
5639
  }
@@ -4197,13 +5643,20 @@ export declare namespace Rpc {
4197
5643
  export interface DurableObjectBranded {
4198
5644
  [__DURABLE_OBJECT_BRAND]: never;
4199
5645
  }
5646
+ export interface WorkflowEntrypointBranded {
5647
+ [__WORKFLOW_ENTRYPOINT_BRAND]: never;
5648
+ }
4200
5649
  export type EntrypointBranded =
4201
5650
  | WorkerEntrypointBranded
4202
- | DurableObjectBranded;
5651
+ | DurableObjectBranded
5652
+ | WorkflowEntrypointBranded;
4203
5653
  // Types that can be used through `Stub`s
4204
5654
  export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
4205
5655
  // Types that can be passed over RPC
4206
- type Serializable =
5656
+ // The reason for using a generic type here is to build a serializable subset of structured
5657
+ // cloneable composite types. This allows types defined with the "interface" keyword to pass the
5658
+ // serializable check as well. Otherwise, only types defined with the "type" keyword would pass.
5659
+ type Serializable<T> =
4207
5660
  // Structured cloneables
4208
5661
  | void
4209
5662
  | undefined
@@ -4219,11 +5672,14 @@ export declare namespace Rpc {
4219
5672
  | Error
4220
5673
  | RegExp
4221
5674
  // Structured cloneable composites
4222
- | Map<Serializable, Serializable>
4223
- | Set<Serializable>
4224
- | ReadonlyArray<Serializable>
5675
+ | Map<
5676
+ T extends Map<infer U, unknown> ? Serializable<U> : never,
5677
+ T extends Map<unknown, infer U> ? Serializable<U> : never
5678
+ >
5679
+ | Set<T extends Set<infer U> ? Serializable<U> : never>
5680
+ | ReadonlyArray<T extends ReadonlyArray<infer U> ? Serializable<U> : never>
4225
5681
  | {
4226
- [key: string | number]: Serializable;
5682
+ [K in keyof T]: K extends number | string ? Serializable<T[K]> : never;
4227
5683
  }
4228
5684
  // Special types
4229
5685
  | ReadableStream<Uint8Array>
@@ -4253,7 +5709,7 @@ export declare namespace Rpc {
4253
5709
  : T extends ReadonlyArray<infer V>
4254
5710
  ? ReadonlyArray<Stubify<V>>
4255
5711
  : T extends {
4256
- [key: string | number]: unknown;
5712
+ [key: string | number]: any;
4257
5713
  }
4258
5714
  ? {
4259
5715
  [K in keyof T]: Stubify<T[K]>;
@@ -4296,7 +5752,7 @@ export declare namespace Rpc {
4296
5752
  // Intersecting with `(Maybe)Provider` allows pipelining.
4297
5753
  type Result<R> = R extends Stubable
4298
5754
  ? Promise<Stub<R>> & Provider<R>
4299
- : R extends Serializable
5755
+ : R extends Serializable<R>
4300
5756
  ? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R>
4301
5757
  : never;
4302
5758
  // Type for method or property on an RPC interface.
@@ -4325,6 +5781,198 @@ export declare namespace Rpc {
4325
5781
  >]: MethodOrProperty<T[K]>;
4326
5782
  };
4327
5783
  }
5784
+ export declare namespace TailStream {
5785
+ interface Header {
5786
+ readonly name: string;
5787
+ readonly value: string;
5788
+ }
5789
+ interface FetchEventInfo {
5790
+ readonly type: "fetch";
5791
+ readonly method: string;
5792
+ readonly url: string;
5793
+ readonly cfJson: string;
5794
+ readonly headers: Header[];
5795
+ }
5796
+ interface JsRpcEventInfo {
5797
+ readonly type: "jsrpc";
5798
+ readonly methodName: string;
5799
+ }
5800
+ interface ScheduledEventInfo {
5801
+ readonly type: "scheduled";
5802
+ readonly scheduledTime: Date;
5803
+ readonly cron: string;
5804
+ }
5805
+ interface AlarmEventInfo {
5806
+ readonly type: "alarm";
5807
+ readonly scheduledTime: Date;
5808
+ }
5809
+ interface QueueEventInfo {
5810
+ readonly type: "queue";
5811
+ readonly queueName: string;
5812
+ readonly batchSize: number;
5813
+ }
5814
+ interface EmailEventInfo {
5815
+ readonly type: "email";
5816
+ readonly mailFrom: string;
5817
+ readonly rcptTo: string;
5818
+ readonly rawSize: number;
5819
+ }
5820
+ interface TraceEventInfo {
5821
+ readonly type: "trace";
5822
+ readonly traces: (string | null)[];
5823
+ }
5824
+ interface HibernatableWebSocketEventInfoMessage {
5825
+ readonly type: "message";
5826
+ }
5827
+ interface HibernatableWebSocketEventInfoError {
5828
+ readonly type: "error";
5829
+ }
5830
+ interface HibernatableWebSocketEventInfoClose {
5831
+ readonly type: "close";
5832
+ readonly code: number;
5833
+ readonly wasClean: boolean;
5834
+ }
5835
+ interface HibernatableWebSocketEventInfo {
5836
+ readonly type: "hibernatableWebSocket";
5837
+ readonly info:
5838
+ | HibernatableWebSocketEventInfoClose
5839
+ | HibernatableWebSocketEventInfoError
5840
+ | HibernatableWebSocketEventInfoMessage;
5841
+ }
5842
+ interface Resume {
5843
+ readonly type: "resume";
5844
+ readonly attachment?: any;
5845
+ }
5846
+ interface CustomEventInfo {
5847
+ readonly type: "custom";
5848
+ }
5849
+ interface FetchResponseInfo {
5850
+ readonly type: "fetch";
5851
+ readonly statusCode: number;
5852
+ }
5853
+ type EventOutcome =
5854
+ | "ok"
5855
+ | "canceled"
5856
+ | "exception"
5857
+ | "unknown"
5858
+ | "killSwitch"
5859
+ | "daemonDown"
5860
+ | "exceededCpu"
5861
+ | "exceededMemory"
5862
+ | "loadShed"
5863
+ | "responseStreamDisconnected"
5864
+ | "scriptNotFound";
5865
+ interface ScriptVersion {
5866
+ readonly id: string;
5867
+ readonly tag?: string;
5868
+ readonly message?: string;
5869
+ }
5870
+ interface Trigger {
5871
+ readonly traceId: string;
5872
+ readonly invocationId: string;
5873
+ readonly spanId: string;
5874
+ }
5875
+ interface Onset {
5876
+ readonly type: "onset";
5877
+ readonly dispatchNamespace?: string;
5878
+ readonly entrypoint?: string;
5879
+ readonly scriptName?: string;
5880
+ readonly scriptTags?: string[];
5881
+ readonly scriptVersion?: ScriptVersion;
5882
+ readonly trigger?: Trigger;
5883
+ readonly info:
5884
+ | FetchEventInfo
5885
+ | JsRpcEventInfo
5886
+ | ScheduledEventInfo
5887
+ | AlarmEventInfo
5888
+ | QueueEventInfo
5889
+ | EmailEventInfo
5890
+ | TraceEventInfo
5891
+ | HibernatableWebSocketEventInfo
5892
+ | Resume
5893
+ | CustomEventInfo;
5894
+ }
5895
+ interface Outcome {
5896
+ readonly type: "outcome";
5897
+ readonly outcome: EventOutcome;
5898
+ readonly cpuTime: number;
5899
+ readonly wallTime: number;
5900
+ }
5901
+ interface Hibernate {
5902
+ readonly type: "hibernate";
5903
+ }
5904
+ interface SpanOpen {
5905
+ readonly type: "spanOpen";
5906
+ readonly op?: string;
5907
+ readonly info?: FetchEventInfo | JsRpcEventInfo | Attribute[];
5908
+ }
5909
+ interface SpanClose {
5910
+ readonly type: "spanClose";
5911
+ readonly outcome: EventOutcome;
5912
+ }
5913
+ interface DiagnosticChannelEvent {
5914
+ readonly type: "diagnosticChannel";
5915
+ readonly channel: string;
5916
+ readonly message: any;
5917
+ }
5918
+ interface Exception {
5919
+ readonly type: "exception";
5920
+ readonly name: string;
5921
+ readonly message: string;
5922
+ readonly stack?: string;
5923
+ }
5924
+ interface Log {
5925
+ readonly type: "log";
5926
+ readonly level: "debug" | "error" | "info" | "log" | "warn";
5927
+ readonly message: string;
5928
+ }
5929
+ interface Return {
5930
+ readonly type: "return";
5931
+ readonly info?: FetchResponseInfo | Attribute[];
5932
+ }
5933
+ interface Link {
5934
+ readonly type: "link";
5935
+ readonly label?: string;
5936
+ readonly traceId: string;
5937
+ readonly invocationId: string;
5938
+ readonly spanId: string;
5939
+ }
5940
+ interface Attribute {
5941
+ readonly type: "attribute";
5942
+ readonly name: string;
5943
+ readonly value: string | string[] | boolean | boolean[] | number | number[];
5944
+ }
5945
+ type Mark =
5946
+ | DiagnosticChannelEvent
5947
+ | Exception
5948
+ | Log
5949
+ | Return
5950
+ | Link
5951
+ | Attribute[];
5952
+ interface TailEvent {
5953
+ readonly traceId: string;
5954
+ readonly invocationId: string;
5955
+ readonly spanId: string;
5956
+ readonly timestamp: Date;
5957
+ readonly sequence: number;
5958
+ readonly event: Onset | Outcome | Hibernate | SpanOpen | SpanClose | Mark;
5959
+ }
5960
+ type TailEventHandler = (event: TailEvent) => void | Promise<void>;
5961
+ type TailEventHandlerName =
5962
+ | "onset"
5963
+ | "outcome"
5964
+ | "hibernate"
5965
+ | "spanOpen"
5966
+ | "spanClose"
5967
+ | "diagnosticChannel"
5968
+ | "exception"
5969
+ | "log"
5970
+ | "return"
5971
+ | "link"
5972
+ | "attribute";
5973
+ type TailEventHandlerObject = Record<TailEventHandlerName, TailEventHandler>;
5974
+ type TailEventHandlerType = TailEventHandler | TailEventHandlerObject;
5975
+ }
4328
5976
  // Copyright (c) 2022-2023 Cloudflare, Inc.
4329
5977
  // Licensed under the Apache 2.0 license found in the LICENSE file or at:
4330
5978
  // https://opensource.org/licenses/Apache-2.0
@@ -4368,11 +6016,21 @@ export type VectorizeVectorMetadataFilter = {
4368
6016
  * Distance metrics determine how other "similar" vectors are determined.
4369
6017
  */
4370
6018
  export type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
6019
+ /**
6020
+ * Metadata return levels for a Vectorize query.
6021
+ *
6022
+ * Default to "none".
6023
+ *
6024
+ * @property all Full metadata for the vector return set, including all fields (including those un-indexed) without truncation. This is a more expensive retrieval, as it requires additional fetching & reading of un-indexed data.
6025
+ * @property indexed Return all metadata fields configured for indexing in the vector return set. This level of retrieval is "free" in that no additional overhead is incurred returning this data. However, note that indexed metadata is subject to truncation (especially for larger strings).
6026
+ * @property none No indexed metadata will be returned.
6027
+ */
6028
+ export type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
4371
6029
  export interface VectorizeQueryOptions {
4372
6030
  topK?: number;
4373
6031
  namespace?: string;
4374
6032
  returnValues?: boolean;
4375
- returnMetadata?: boolean;
6033
+ returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;
4376
6034
  filter?: VectorizeVectorMetadataFilter;
4377
6035
  }
4378
6036
  /**
@@ -4388,6 +6046,9 @@ export type VectorizeIndexConfig =
4388
6046
  };
4389
6047
  /**
4390
6048
  * Metadata about an existing index.
6049
+ *
6050
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
6051
+ * See {@link VectorizeIndexInfo} for its post-beta equivalent.
4391
6052
  */
4392
6053
  export interface VectorizeIndexDetails {
4393
6054
  /** The unique ID of the index */
@@ -4401,6 +6062,19 @@ export interface VectorizeIndexDetails {
4401
6062
  /** The number of records containing vectors within the index. */
4402
6063
  vectorsCount: number;
4403
6064
  }
6065
+ /**
6066
+ * Metadata about an existing index.
6067
+ */
6068
+ export interface VectorizeIndexInfo {
6069
+ /** The number of records containing vectors within the index. */
6070
+ vectorCount: number;
6071
+ /** Number of dimensions the index has been configured for. */
6072
+ dimensions: number;
6073
+ /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */
6074
+ processedUpToDatetime: number;
6075
+ /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */
6076
+ processedUpToMutation: number;
6077
+ }
4404
6078
  /**
4405
6079
  * Represents a single vector value set along with its associated metadata.
4406
6080
  */
@@ -4411,7 +6085,7 @@ export interface VectorizeVector {
4411
6085
  values: VectorFloatArray | number[];
4412
6086
  /** The namespace this vector belongs to. */
4413
6087
  namespace?: string;
4414
- /** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
6088
+ /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
4415
6089
  metadata?: Record<string, VectorizeVectorMetadata>;
4416
6090
  }
4417
6091
  /**
@@ -4423,7 +6097,7 @@ export type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
4423
6097
  score: number;
4424
6098
  };
4425
6099
  /**
4426
- * A set of vector {@link VectorizeMatch} for a particular query.
6100
+ * A set of matching {@link VectorizeMatch} for a particular query.
4427
6101
  */
4428
6102
  export interface VectorizeMatches {
4429
6103
  matches: VectorizeMatch[];
@@ -4432,6 +6106,9 @@ export interface VectorizeMatches {
4432
6106
  /**
4433
6107
  * Results of an operation that performed a mutation on a set of vectors.
4434
6108
  * Here, `ids` is a list of vectors that were successfully processed.
6109
+ *
6110
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
6111
+ * See {@link VectorizeAsyncMutation} for its post-beta equivalent.
4435
6112
  */
4436
6113
  export interface VectorizeVectorMutation {
4437
6114
  /* List of ids of vectors that were successfully processed. */
@@ -4439,6 +6116,20 @@ export interface VectorizeVectorMutation {
4439
6116
  /* Total count of the number of processed vectors. */
4440
6117
  count: number;
4441
6118
  }
6119
+ /**
6120
+ * Result type indicating a mutation on the Vectorize Index.
6121
+ * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
6122
+ */
6123
+ export interface VectorizeAsyncMutation {
6124
+ /** The unique identifier for the async mutation operation containing the changeset. */
6125
+ mutationId: string;
6126
+ }
6127
+ /**
6128
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
6129
+ *
6130
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
6131
+ * See {@link Vectorize} for its new implementation.
6132
+ */
4442
6133
  export declare abstract class VectorizeIndex {
4443
6134
  /**
4444
6135
  * Get information about the currently bound index.
@@ -4453,7 +6144,7 @@ export declare abstract class VectorizeIndex {
4453
6144
  */
4454
6145
  public query(
4455
6146
  vector: VectorFloatArray | number[],
4456
- options: VectorizeQueryOptions,
6147
+ options?: VectorizeQueryOptions,
4457
6148
  ): Promise<VectorizeMatches>;
4458
6149
  /**
4459
6150
  * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
@@ -4480,6 +6171,62 @@ export declare abstract class VectorizeIndex {
4480
6171
  */
4481
6172
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
4482
6173
  }
6174
+ /**
6175
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
6176
+ *
6177
+ * Mutations in this version are async, returning a mutation id.
6178
+ */
6179
+ export declare abstract class Vectorize {
6180
+ /**
6181
+ * Get information about the currently bound index.
6182
+ * @returns A promise that resolves with information about the current index.
6183
+ */
6184
+ public describe(): Promise<VectorizeIndexInfo>;
6185
+ /**
6186
+ * Use the provided vector to perform a similarity search across the index.
6187
+ * @param vector Input vector that will be used to drive the similarity search.
6188
+ * @param options Configuration options to massage the returned data.
6189
+ * @returns A promise that resolves with matched and scored vectors.
6190
+ */
6191
+ public query(
6192
+ vector: VectorFloatArray | number[],
6193
+ options?: VectorizeQueryOptions,
6194
+ ): Promise<VectorizeMatches>;
6195
+ /**
6196
+ * Use the provided vector-id to perform a similarity search across the index.
6197
+ * @param vectorId Id for a vector in the index against which the index should be queried.
6198
+ * @param options Configuration options to massage the returned data.
6199
+ * @returns A promise that resolves with matched and scored vectors.
6200
+ */
6201
+ public queryById(
6202
+ vectorId: string,
6203
+ options?: VectorizeQueryOptions,
6204
+ ): Promise<VectorizeMatches>;
6205
+ /**
6206
+ * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
6207
+ * @param vectors List of vectors that will be inserted.
6208
+ * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
6209
+ */
6210
+ public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
6211
+ /**
6212
+ * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
6213
+ * @param vectors List of vectors that will be upserted.
6214
+ * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
6215
+ */
6216
+ public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
6217
+ /**
6218
+ * Delete a list of vectors with a matching id.
6219
+ * @param ids List of vector ids that should be deleted.
6220
+ * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
6221
+ */
6222
+ public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
6223
+ /**
6224
+ * Get a list of vectors with a matching id.
6225
+ * @param ids List of vector ids that should be returned.
6226
+ * @returns A promise that resolves with the raw unscored vectors matching the id set.
6227
+ */
6228
+ public getByIds(ids: string[]): Promise<VectorizeVector[]>;
6229
+ }
4483
6230
  /**
4484
6231
  * The interface for "version_metadata" binding
4485
6232
  * providing metadata about the Worker Version using this binding.
@@ -4489,6 +6236,8 @@ export type WorkerVersionMetadata = {
4489
6236
  id: string;
4490
6237
  /** The tag of the Worker Version using this binding */
4491
6238
  tag: string;
6239
+ /** The timestamp of when the Worker Version was uploaded */
6240
+ timestamp: string;
4492
6241
  };
4493
6242
  export interface DynamicDispatchLimits {
4494
6243
  /**
@@ -4528,3 +6277,70 @@ export interface DispatchNamespace {
4528
6277
  options?: DynamicDispatchOptions,
4529
6278
  ): Fetcher;
4530
6279
  }
6280
+ export declare abstract class Workflow<PARAMS = unknown> {
6281
+ /**
6282
+ * Get a handle to an existing instance of the Workflow.
6283
+ * @param id Id for the instance of this Workflow
6284
+ * @returns A promise that resolves with a handle for the Instance
6285
+ */
6286
+ public get(id: string): Promise<WorkflowInstance>;
6287
+ /**
6288
+ * Create a new instance and return a handle to it. If a provided id exists, an error will be thrown.
6289
+ * @param options Options when creating an instance including id and params
6290
+ * @returns A promise that resolves with a handle for the Instance
6291
+ */
6292
+ public create(
6293
+ options?: WorkflowInstanceCreateOptions<PARAMS>,
6294
+ ): Promise<WorkflowInstance>;
6295
+ }
6296
+ export interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
6297
+ /**
6298
+ * An id for your Workflow instance. Must be unique within the Workflow.
6299
+ */
6300
+ id?: string;
6301
+ /**
6302
+ * The event payload the Workflow instance is triggered with
6303
+ */
6304
+ params?: PARAMS;
6305
+ }
6306
+ export type InstanceStatus = {
6307
+ status:
6308
+ | "queued" // means that instance is waiting to be started (see concurrency limits)
6309
+ | "running"
6310
+ | "paused"
6311
+ | "errored"
6312
+ | "terminated" // user terminated the instance while it was running
6313
+ | "complete"
6314
+ | "waiting" // instance is hibernating and waiting for sleep or event to finish
6315
+ | "waitingForPause" // instance is finishing the current work to pause
6316
+ | "unknown";
6317
+ error?: string;
6318
+ output?: object;
6319
+ };
6320
+ export interface WorkflowError {
6321
+ code?: number;
6322
+ message: string;
6323
+ }
6324
+ export declare abstract class WorkflowInstance {
6325
+ public id: string;
6326
+ /**
6327
+ * Pause the instance.
6328
+ */
6329
+ public pause(): Promise<void>;
6330
+ /**
6331
+ * Resume the instance. If it is already running, an error will be thrown.
6332
+ */
6333
+ public resume(): Promise<void>;
6334
+ /**
6335
+ * Terminate the instance. If it is errored, terminated or complete, an error will be thrown.
6336
+ */
6337
+ public terminate(): Promise<void>;
6338
+ /**
6339
+ * Restart the instance.
6340
+ */
6341
+ public restart(): Promise<void>;
6342
+ /**
6343
+ * Returns the current status of the instance.
6344
+ */
6345
+ public status(): Promise<InstanceStatus>;
6346
+ }