@cloudflare/workers-types 0.20230404.0 → 0.20230512.0

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.
@@ -184,11 +184,14 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
184
184
  crypto: Crypto;
185
185
  caches: CacheStorage;
186
186
  scheduler: Scheduler;
187
+ performance: Performance;
188
+ readonly origin: string;
187
189
  Event: typeof Event;
188
190
  ExtendableEvent: typeof ExtendableEvent;
189
191
  PromiseRejectionEvent: typeof PromiseRejectionEvent;
190
192
  FetchEvent: typeof FetchEvent;
191
- TraceEvent: typeof TraceEvent;
193
+ TailEvent: typeof TailEvent;
194
+ TraceEvent: typeof TailEvent;
192
195
  ScheduledEvent: typeof ScheduledEvent;
193
196
  MessageEvent: typeof MessageEvent;
194
197
  CloseEvent: typeof CloseEvent;
@@ -280,6 +283,8 @@ declare const self: ServiceWorkerGlobalScope;
280
283
  declare const crypto: Crypto;
281
284
  declare const caches: CacheStorage;
282
285
  declare const scheduler: Scheduler;
286
+ declare const performance: Performance;
287
+ declare const origin: string;
283
288
  declare interface TestController {}
284
289
  declare interface ExecutionContext {
285
290
  waitUntil(promise: Promise<any>): void;
@@ -293,6 +298,11 @@ declare type ExportedHandlerFetchHandler<
293
298
  env: Env,
294
299
  ctx: ExecutionContext
295
300
  ) => Response | Promise<Response>;
301
+ declare type ExportedHandlerTailHandler<Env = unknown> = (
302
+ events: TraceItem[],
303
+ env: Env,
304
+ ctx: ExecutionContext
305
+ ) => void | Promise<void>;
296
306
  declare type ExportedHandlerTraceHandler<Env = unknown> = (
297
307
  traces: TraceItem[],
298
308
  env: Env,
@@ -319,6 +329,7 @@ declare interface ExportedHandler<
319
329
  CfHostMetadata = unknown
320
330
  > {
321
331
  fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
332
+ tail?: ExportedHandlerTailHandler<Env>;
322
333
  trace?: ExportedHandlerTraceHandler<Env>;
323
334
  scheduled?: ExportedHandlerScheduledHandler<Env>;
324
335
  test?: ExportedHandlerTestHandler<Env>;
@@ -331,6 +342,11 @@ declare abstract class PromiseRejectionEvent extends Event {
331
342
  readonly promise: Promise<any>;
332
343
  readonly reason: any;
333
344
  }
345
+ /** Provides access to performance-related information for the current page. It's part of the High Resolution Time API, but is enhanced by the Performance Timeline API, the Navigation Timing API, the User Timing API, and the Resource Timing API. */
346
+ declare interface Performance {
347
+ readonly timeOrigin: number;
348
+ now(): number;
349
+ }
334
350
  declare interface DurableObject {
335
351
  fetch(request: Request): Response | Promise<Response>;
336
352
  alarm?(): void | Promise<void>;
@@ -378,6 +394,8 @@ declare interface DurableObjectState {
378
394
  readonly id: DurableObjectId;
379
395
  readonly storage: DurableObjectStorage;
380
396
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
397
+ acceptWebSocket(ws: WebSocket, tags?: string[]): void;
398
+ getWebSockets(tag?: string): WebSocket[];
381
399
  }
382
400
  declare interface DurableObjectTransaction {
383
401
  get<T = unknown>(
@@ -444,6 +462,7 @@ declare interface DurableObjectStorage {
444
462
  ): Promise<void>;
445
463
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
446
464
  sync(): Promise<void>;
465
+ transactionSync<T>(closure: () => T): T;
447
466
  }
448
467
  declare interface DurableObjectListOptions {
449
468
  start?: string;
@@ -564,6 +583,7 @@ declare class AbortController {
564
583
  declare abstract class AbortSignal extends EventTarget {
565
584
  static abort(reason?: any): AbortSignal;
566
585
  static timeout(delay: number): AbortSignal;
586
+ static any(signals: AbortSignal[]): AbortSignal;
567
587
  /** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */
568
588
  readonly aborted: boolean;
569
589
  readonly reason: any;
@@ -1059,6 +1079,7 @@ declare interface RequestInit<Cf = CfProperties> {
1059
1079
  }
1060
1080
  declare abstract class Fetcher {
1061
1081
  fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1082
+ connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1062
1083
  }
1063
1084
  declare interface FetcherPutOptions {
1064
1085
  expiration?: number;
@@ -1631,7 +1652,8 @@ declare interface QueuingStrategyInit {
1631
1652
  */
1632
1653
  highWaterMark: number;
1633
1654
  }
1634
- declare abstract class TraceEvent extends ExtendableEvent {
1655
+ declare abstract class TailEvent extends ExtendableEvent {
1656
+ readonly events: TraceItem[];
1635
1657
  readonly traces: TraceItem[];
1636
1658
  }
1637
1659
  declare interface TraceItem {
@@ -1831,6 +1853,8 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
1831
1853
  accept(): void;
1832
1854
  send(message: (ArrayBuffer | ArrayBufferView) | string): void;
1833
1855
  close(code?: number, reason?: string): void;
1856
+ serializeAttachment(attachment: any): void;
1857
+ deserializeAttachment(): any | null;
1834
1858
  static readonly READY_STATE_CONNECTING: number;
1835
1859
  static readonly READY_STATE_OPEN: number;
1836
1860
  static readonly READY_STATE_CLOSING: number;
@@ -1850,6 +1874,24 @@ declare const WebSocketPair: {
1850
1874
  1: WebSocket;
1851
1875
  };
1852
1876
  };
1877
+ declare interface Socket {
1878
+ get readable(): ReadableStream;
1879
+ get writable(): WritableStream;
1880
+ get closed(): Promise<void>;
1881
+ close(): Promise<void>;
1882
+ startTls(options?: TlsOptions): Socket;
1883
+ }
1884
+ declare interface SocketOptions {
1885
+ secureTransport?: string;
1886
+ allowHalfOpen: boolean;
1887
+ }
1888
+ declare interface SocketAddress {
1889
+ hostname: string;
1890
+ port: number;
1891
+ }
1892
+ declare interface TlsOptions {
1893
+ expectedServerHostname?: string;
1894
+ }
1853
1895
  declare interface BasicImageTransformations {
1854
1896
  /**
1855
1897
  * Maximum width in image pixels. The value must be an integer.
@@ -184,11 +184,14 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
184
184
  crypto: Crypto;
185
185
  caches: CacheStorage;
186
186
  scheduler: Scheduler;
187
+ performance: Performance;
188
+ readonly origin: string;
187
189
  Event: typeof Event;
188
190
  ExtendableEvent: typeof ExtendableEvent;
189
191
  PromiseRejectionEvent: typeof PromiseRejectionEvent;
190
192
  FetchEvent: typeof FetchEvent;
191
- TraceEvent: typeof TraceEvent;
193
+ TailEvent: typeof TailEvent;
194
+ TraceEvent: typeof TailEvent;
192
195
  ScheduledEvent: typeof ScheduledEvent;
193
196
  MessageEvent: typeof MessageEvent;
194
197
  CloseEvent: typeof CloseEvent;
@@ -282,6 +285,8 @@ export declare const self: ServiceWorkerGlobalScope;
282
285
  export declare const crypto: Crypto;
283
286
  export declare const caches: CacheStorage;
284
287
  export declare const scheduler: Scheduler;
288
+ export declare const performance: Performance;
289
+ export declare const origin: string;
285
290
  export interface TestController {}
286
291
  export interface ExecutionContext {
287
292
  waitUntil(promise: Promise<any>): void;
@@ -295,6 +300,11 @@ export type ExportedHandlerFetchHandler<
295
300
  env: Env,
296
301
  ctx: ExecutionContext
297
302
  ) => Response | Promise<Response>;
303
+ export type ExportedHandlerTailHandler<Env = unknown> = (
304
+ events: TraceItem[],
305
+ env: Env,
306
+ ctx: ExecutionContext
307
+ ) => void | Promise<void>;
298
308
  export type ExportedHandlerTraceHandler<Env = unknown> = (
299
309
  traces: TraceItem[],
300
310
  env: Env,
@@ -321,6 +331,7 @@ export interface ExportedHandler<
321
331
  CfHostMetadata = unknown
322
332
  > {
323
333
  fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
334
+ tail?: ExportedHandlerTailHandler<Env>;
324
335
  trace?: ExportedHandlerTraceHandler<Env>;
325
336
  scheduled?: ExportedHandlerScheduledHandler<Env>;
326
337
  test?: ExportedHandlerTestHandler<Env>;
@@ -333,6 +344,11 @@ export declare abstract class PromiseRejectionEvent extends Event {
333
344
  readonly promise: Promise<any>;
334
345
  readonly reason: any;
335
346
  }
347
+ /** 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. */
348
+ export interface Performance {
349
+ readonly timeOrigin: number;
350
+ now(): number;
351
+ }
336
352
  export interface DurableObject {
337
353
  fetch(request: Request): Response | Promise<Response>;
338
354
  alarm?(): void | Promise<void>;
@@ -380,6 +396,8 @@ export interface DurableObjectState {
380
396
  readonly id: DurableObjectId;
381
397
  readonly storage: DurableObjectStorage;
382
398
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
399
+ acceptWebSocket(ws: WebSocket, tags?: string[]): void;
400
+ getWebSockets(tag?: string): WebSocket[];
383
401
  }
384
402
  export interface DurableObjectTransaction {
385
403
  get<T = unknown>(
@@ -446,6 +464,7 @@ export interface DurableObjectStorage {
446
464
  ): Promise<void>;
447
465
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
448
466
  sync(): Promise<void>;
467
+ transactionSync<T>(closure: () => T): T;
449
468
  }
450
469
  export interface DurableObjectListOptions {
451
470
  start?: string;
@@ -566,6 +585,7 @@ export declare class AbortController {
566
585
  export declare abstract class AbortSignal extends EventTarget {
567
586
  static abort(reason?: any): AbortSignal;
568
587
  static timeout(delay: number): AbortSignal;
588
+ static any(signals: AbortSignal[]): AbortSignal;
569
589
  /** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */
570
590
  readonly aborted: boolean;
571
591
  readonly reason: any;
@@ -1061,6 +1081,7 @@ export interface RequestInit<Cf = CfProperties> {
1061
1081
  }
1062
1082
  export declare abstract class Fetcher {
1063
1083
  fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1084
+ connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1064
1085
  }
1065
1086
  export interface FetcherPutOptions {
1066
1087
  expiration?: number;
@@ -1636,7 +1657,8 @@ export interface QueuingStrategyInit {
1636
1657
  */
1637
1658
  highWaterMark: number;
1638
1659
  }
1639
- export declare abstract class TraceEvent extends ExtendableEvent {
1660
+ export declare abstract class TailEvent extends ExtendableEvent {
1661
+ readonly events: TraceItem[];
1640
1662
  readonly traces: TraceItem[];
1641
1663
  }
1642
1664
  export interface TraceItem {
@@ -1836,6 +1858,8 @@ export declare class WebSocket extends EventTarget<WebSocketEventMap> {
1836
1858
  accept(): void;
1837
1859
  send(message: (ArrayBuffer | ArrayBufferView) | string): void;
1838
1860
  close(code?: number, reason?: string): void;
1861
+ serializeAttachment(attachment: any): void;
1862
+ deserializeAttachment(): any | null;
1839
1863
  static readonly READY_STATE_CONNECTING: number;
1840
1864
  static readonly READY_STATE_OPEN: number;
1841
1865
  static readonly READY_STATE_CLOSING: number;
@@ -1855,6 +1879,24 @@ export declare const WebSocketPair: {
1855
1879
  1: WebSocket;
1856
1880
  };
1857
1881
  };
1882
+ export interface Socket {
1883
+ get readable(): ReadableStream;
1884
+ get writable(): WritableStream;
1885
+ get closed(): Promise<void>;
1886
+ close(): Promise<void>;
1887
+ startTls(options?: TlsOptions): Socket;
1888
+ }
1889
+ export interface SocketOptions {
1890
+ secureTransport?: string;
1891
+ allowHalfOpen: boolean;
1892
+ }
1893
+ export interface SocketAddress {
1894
+ hostname: string;
1895
+ port: number;
1896
+ }
1897
+ export interface TlsOptions {
1898
+ expectedServerHostname?: string;
1899
+ }
1858
1900
  export interface BasicImageTransformations {
1859
1901
  /**
1860
1902
  * Maximum width in image pixels. The value must be an integer.
@@ -184,11 +184,14 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
184
184
  crypto: Crypto;
185
185
  caches: CacheStorage;
186
186
  scheduler: Scheduler;
187
+ performance: Performance;
188
+ readonly origin: string;
187
189
  Event: typeof Event;
188
190
  ExtendableEvent: typeof ExtendableEvent;
189
191
  PromiseRejectionEvent: typeof PromiseRejectionEvent;
190
192
  FetchEvent: typeof FetchEvent;
191
- TraceEvent: typeof TraceEvent;
193
+ TailEvent: typeof TailEvent;
194
+ TraceEvent: typeof TailEvent;
192
195
  ScheduledEvent: typeof ScheduledEvent;
193
196
  MessageEvent: typeof MessageEvent;
194
197
  CloseEvent: typeof CloseEvent;
@@ -280,6 +283,8 @@ declare const self: ServiceWorkerGlobalScope;
280
283
  declare const crypto: Crypto;
281
284
  declare const caches: CacheStorage;
282
285
  declare const scheduler: Scheduler;
286
+ declare const performance: Performance;
287
+ declare const origin: string;
283
288
  declare interface TestController {}
284
289
  declare interface ExecutionContext {
285
290
  waitUntil(promise: Promise<any>): void;
@@ -293,6 +298,11 @@ declare type ExportedHandlerFetchHandler<
293
298
  env: Env,
294
299
  ctx: ExecutionContext
295
300
  ) => Response | Promise<Response>;
301
+ declare type ExportedHandlerTailHandler<Env = unknown> = (
302
+ events: TraceItem[],
303
+ env: Env,
304
+ ctx: ExecutionContext
305
+ ) => void | Promise<void>;
296
306
  declare type ExportedHandlerTraceHandler<Env = unknown> = (
297
307
  traces: TraceItem[],
298
308
  env: Env,
@@ -319,6 +329,7 @@ declare interface ExportedHandler<
319
329
  CfHostMetadata = unknown
320
330
  > {
321
331
  fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
332
+ tail?: ExportedHandlerTailHandler<Env>;
322
333
  trace?: ExportedHandlerTraceHandler<Env>;
323
334
  scheduled?: ExportedHandlerScheduledHandler<Env>;
324
335
  test?: ExportedHandlerTestHandler<Env>;
@@ -331,6 +342,11 @@ declare abstract class PromiseRejectionEvent extends Event {
331
342
  readonly promise: Promise<any>;
332
343
  readonly reason: any;
333
344
  }
345
+ /** Provides access to performance-related information for the current page. It's part of the High Resolution Time API, but is enhanced by the Performance Timeline API, the Navigation Timing API, the User Timing API, and the Resource Timing API. */
346
+ declare interface Performance {
347
+ readonly timeOrigin: number;
348
+ now(): number;
349
+ }
334
350
  declare interface DurableObject {
335
351
  fetch(request: Request): Response | Promise<Response>;
336
352
  alarm?(): void | Promise<void>;
@@ -378,6 +394,8 @@ declare interface DurableObjectState {
378
394
  readonly id: DurableObjectId;
379
395
  readonly storage: DurableObjectStorage;
380
396
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
397
+ acceptWebSocket(ws: WebSocket, tags?: string[]): void;
398
+ getWebSockets(tag?: string): WebSocket[];
381
399
  }
382
400
  declare interface DurableObjectTransaction {
383
401
  get<T = unknown>(
@@ -444,6 +462,7 @@ declare interface DurableObjectStorage {
444
462
  ): Promise<void>;
445
463
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
446
464
  sync(): Promise<void>;
465
+ transactionSync<T>(closure: () => T): T;
447
466
  }
448
467
  declare interface DurableObjectListOptions {
449
468
  start?: string;
@@ -553,6 +572,7 @@ declare class AbortController {
553
572
  declare abstract class AbortSignal extends EventTarget {
554
573
  static abort(reason?: any): AbortSignal;
555
574
  static timeout(delay: number): AbortSignal;
575
+ static any(signals: AbortSignal[]): AbortSignal;
556
576
  get aborted(): boolean;
557
577
  get reason(): any;
558
578
  throwIfAborted(): void;
@@ -1039,6 +1059,7 @@ declare interface RequestInit<Cf = CfProperties> {
1039
1059
  }
1040
1060
  declare abstract class Fetcher {
1041
1061
  fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1062
+ connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1042
1063
  }
1043
1064
  declare interface FetcherPutOptions {
1044
1065
  expiration?: number;
@@ -1611,7 +1632,8 @@ declare interface QueuingStrategyInit {
1611
1632
  */
1612
1633
  highWaterMark: number;
1613
1634
  }
1614
- declare abstract class TraceEvent extends ExtendableEvent {
1635
+ declare abstract class TailEvent extends ExtendableEvent {
1636
+ readonly events: TraceItem[];
1615
1637
  readonly traces: TraceItem[];
1616
1638
  }
1617
1639
  declare interface TraceItem {
@@ -1821,6 +1843,8 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
1821
1843
  accept(): void;
1822
1844
  send(message: (ArrayBuffer | ArrayBufferView) | string): void;
1823
1845
  close(code?: number, reason?: string): void;
1846
+ serializeAttachment(attachment: any): void;
1847
+ deserializeAttachment(): any | null;
1824
1848
  static readonly READY_STATE_CONNECTING: number;
1825
1849
  static readonly READY_STATE_OPEN: number;
1826
1850
  static readonly READY_STATE_CLOSING: number;
@@ -1836,6 +1860,24 @@ declare const WebSocketPair: {
1836
1860
  1: WebSocket;
1837
1861
  };
1838
1862
  };
1863
+ declare interface Socket {
1864
+ get readable(): ReadableStream;
1865
+ get writable(): WritableStream;
1866
+ get closed(): Promise<void>;
1867
+ close(): Promise<void>;
1868
+ startTls(options?: TlsOptions): Socket;
1869
+ }
1870
+ declare interface SocketOptions {
1871
+ secureTransport?: string;
1872
+ allowHalfOpen: boolean;
1873
+ }
1874
+ declare interface SocketAddress {
1875
+ hostname: string;
1876
+ port: number;
1877
+ }
1878
+ declare interface TlsOptions {
1879
+ expectedServerHostname?: string;
1880
+ }
1839
1881
  declare interface BasicImageTransformations {
1840
1882
  /**
1841
1883
  * Maximum width in image pixels. The value must be an integer.
@@ -184,11 +184,14 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
184
184
  crypto: Crypto;
185
185
  caches: CacheStorage;
186
186
  scheduler: Scheduler;
187
+ performance: Performance;
188
+ readonly origin: string;
187
189
  Event: typeof Event;
188
190
  ExtendableEvent: typeof ExtendableEvent;
189
191
  PromiseRejectionEvent: typeof PromiseRejectionEvent;
190
192
  FetchEvent: typeof FetchEvent;
191
- TraceEvent: typeof TraceEvent;
193
+ TailEvent: typeof TailEvent;
194
+ TraceEvent: typeof TailEvent;
192
195
  ScheduledEvent: typeof ScheduledEvent;
193
196
  MessageEvent: typeof MessageEvent;
194
197
  CloseEvent: typeof CloseEvent;
@@ -282,6 +285,8 @@ export declare const self: ServiceWorkerGlobalScope;
282
285
  export declare const crypto: Crypto;
283
286
  export declare const caches: CacheStorage;
284
287
  export declare const scheduler: Scheduler;
288
+ export declare const performance: Performance;
289
+ export declare const origin: string;
285
290
  export interface TestController {}
286
291
  export interface ExecutionContext {
287
292
  waitUntil(promise: Promise<any>): void;
@@ -295,6 +300,11 @@ export type ExportedHandlerFetchHandler<
295
300
  env: Env,
296
301
  ctx: ExecutionContext
297
302
  ) => Response | Promise<Response>;
303
+ export type ExportedHandlerTailHandler<Env = unknown> = (
304
+ events: TraceItem[],
305
+ env: Env,
306
+ ctx: ExecutionContext
307
+ ) => void | Promise<void>;
298
308
  export type ExportedHandlerTraceHandler<Env = unknown> = (
299
309
  traces: TraceItem[],
300
310
  env: Env,
@@ -321,6 +331,7 @@ export interface ExportedHandler<
321
331
  CfHostMetadata = unknown
322
332
  > {
323
333
  fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
334
+ tail?: ExportedHandlerTailHandler<Env>;
324
335
  trace?: ExportedHandlerTraceHandler<Env>;
325
336
  scheduled?: ExportedHandlerScheduledHandler<Env>;
326
337
  test?: ExportedHandlerTestHandler<Env>;
@@ -333,6 +344,11 @@ export declare abstract class PromiseRejectionEvent extends Event {
333
344
  readonly promise: Promise<any>;
334
345
  readonly reason: any;
335
346
  }
347
+ /** 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. */
348
+ export interface Performance {
349
+ readonly timeOrigin: number;
350
+ now(): number;
351
+ }
336
352
  export interface DurableObject {
337
353
  fetch(request: Request): Response | Promise<Response>;
338
354
  alarm?(): void | Promise<void>;
@@ -380,6 +396,8 @@ export interface DurableObjectState {
380
396
  readonly id: DurableObjectId;
381
397
  readonly storage: DurableObjectStorage;
382
398
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
399
+ acceptWebSocket(ws: WebSocket, tags?: string[]): void;
400
+ getWebSockets(tag?: string): WebSocket[];
383
401
  }
384
402
  export interface DurableObjectTransaction {
385
403
  get<T = unknown>(
@@ -446,6 +464,7 @@ export interface DurableObjectStorage {
446
464
  ): Promise<void>;
447
465
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
448
466
  sync(): Promise<void>;
467
+ transactionSync<T>(closure: () => T): T;
449
468
  }
450
469
  export interface DurableObjectListOptions {
451
470
  start?: string;
@@ -555,6 +574,7 @@ export declare class AbortController {
555
574
  export declare abstract class AbortSignal extends EventTarget {
556
575
  static abort(reason?: any): AbortSignal;
557
576
  static timeout(delay: number): AbortSignal;
577
+ static any(signals: AbortSignal[]): AbortSignal;
558
578
  get aborted(): boolean;
559
579
  get reason(): any;
560
580
  throwIfAborted(): void;
@@ -1041,6 +1061,7 @@ export interface RequestInit<Cf = CfProperties> {
1041
1061
  }
1042
1062
  export declare abstract class Fetcher {
1043
1063
  fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1064
+ connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1044
1065
  }
1045
1066
  export interface FetcherPutOptions {
1046
1067
  expiration?: number;
@@ -1616,7 +1637,8 @@ export interface QueuingStrategyInit {
1616
1637
  */
1617
1638
  highWaterMark: number;
1618
1639
  }
1619
- export declare abstract class TraceEvent extends ExtendableEvent {
1640
+ export declare abstract class TailEvent extends ExtendableEvent {
1641
+ readonly events: TraceItem[];
1620
1642
  readonly traces: TraceItem[];
1621
1643
  }
1622
1644
  export interface TraceItem {
@@ -1826,6 +1848,8 @@ export declare class WebSocket extends EventTarget<WebSocketEventMap> {
1826
1848
  accept(): void;
1827
1849
  send(message: (ArrayBuffer | ArrayBufferView) | string): void;
1828
1850
  close(code?: number, reason?: string): void;
1851
+ serializeAttachment(attachment: any): void;
1852
+ deserializeAttachment(): any | null;
1829
1853
  static readonly READY_STATE_CONNECTING: number;
1830
1854
  static readonly READY_STATE_OPEN: number;
1831
1855
  static readonly READY_STATE_CLOSING: number;
@@ -1841,6 +1865,24 @@ export declare const WebSocketPair: {
1841
1865
  1: WebSocket;
1842
1866
  };
1843
1867
  };
1868
+ export interface Socket {
1869
+ get readable(): ReadableStream;
1870
+ get writable(): WritableStream;
1871
+ get closed(): Promise<void>;
1872
+ close(): Promise<void>;
1873
+ startTls(options?: TlsOptions): Socket;
1874
+ }
1875
+ export interface SocketOptions {
1876
+ secureTransport?: string;
1877
+ allowHalfOpen: boolean;
1878
+ }
1879
+ export interface SocketAddress {
1880
+ hostname: string;
1881
+ port: number;
1882
+ }
1883
+ export interface TlsOptions {
1884
+ expectedServerHostname?: string;
1885
+ }
1844
1886
  export interface BasicImageTransformations {
1845
1887
  /**
1846
1888
  * Maximum width in image pixels. The value must be an integer.
@@ -184,11 +184,14 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
184
184
  crypto: Crypto;
185
185
  caches: CacheStorage;
186
186
  scheduler: Scheduler;
187
+ performance: Performance;
188
+ readonly origin: string;
187
189
  Event: typeof Event;
188
190
  ExtendableEvent: typeof ExtendableEvent;
189
191
  PromiseRejectionEvent: typeof PromiseRejectionEvent;
190
192
  FetchEvent: typeof FetchEvent;
191
- TraceEvent: typeof TraceEvent;
193
+ TailEvent: typeof TailEvent;
194
+ TraceEvent: typeof TailEvent;
192
195
  ScheduledEvent: typeof ScheduledEvent;
193
196
  MessageEvent: typeof MessageEvent;
194
197
  CloseEvent: typeof CloseEvent;
@@ -282,6 +285,8 @@ declare const self: ServiceWorkerGlobalScope;
282
285
  declare const crypto: Crypto;
283
286
  declare const caches: CacheStorage;
284
287
  declare const scheduler: Scheduler;
288
+ declare const performance: Performance;
289
+ declare const origin: string;
285
290
  declare const navigator: Navigator;
286
291
  declare interface TestController {}
287
292
  declare interface ExecutionContext {
@@ -296,6 +301,11 @@ declare type ExportedHandlerFetchHandler<
296
301
  env: Env,
297
302
  ctx: ExecutionContext
298
303
  ) => Response | Promise<Response>;
304
+ declare type ExportedHandlerTailHandler<Env = unknown> = (
305
+ events: TraceItem[],
306
+ env: Env,
307
+ ctx: ExecutionContext
308
+ ) => void | Promise<void>;
299
309
  declare type ExportedHandlerTraceHandler<Env = unknown> = (
300
310
  traces: TraceItem[],
301
311
  env: Env,
@@ -322,6 +332,7 @@ declare interface ExportedHandler<
322
332
  CfHostMetadata = unknown
323
333
  > {
324
334
  fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
335
+ tail?: ExportedHandlerTailHandler<Env>;
325
336
  trace?: ExportedHandlerTraceHandler<Env>;
326
337
  scheduled?: ExportedHandlerScheduledHandler<Env>;
327
338
  test?: ExportedHandlerTestHandler<Env>;
@@ -337,6 +348,11 @@ declare abstract class PromiseRejectionEvent extends Event {
337
348
  declare abstract class Navigator {
338
349
  readonly userAgent: string;
339
350
  }
351
+ /** Provides access to performance-related information for the current page. It's part of the High Resolution Time API, but is enhanced by the Performance Timeline API, the Navigation Timing API, the User Timing API, and the Resource Timing API. */
352
+ declare interface Performance {
353
+ readonly timeOrigin: number;
354
+ now(): number;
355
+ }
340
356
  declare interface DurableObject {
341
357
  fetch(request: Request): Response | Promise<Response>;
342
358
  alarm?(): void | Promise<void>;
@@ -384,6 +400,8 @@ declare interface DurableObjectState {
384
400
  readonly id: DurableObjectId;
385
401
  readonly storage: DurableObjectStorage;
386
402
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
403
+ acceptWebSocket(ws: WebSocket, tags?: string[]): void;
404
+ getWebSockets(tag?: string): WebSocket[];
387
405
  }
388
406
  declare interface DurableObjectTransaction {
389
407
  get<T = unknown>(
@@ -450,6 +468,7 @@ declare interface DurableObjectStorage {
450
468
  ): Promise<void>;
451
469
  deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
452
470
  sync(): Promise<void>;
471
+ transactionSync<T>(closure: () => T): T;
453
472
  }
454
473
  declare interface DurableObjectListOptions {
455
474
  start?: string;
@@ -559,6 +578,7 @@ declare class AbortController {
559
578
  declare abstract class AbortSignal extends EventTarget {
560
579
  static abort(reason?: any): AbortSignal;
561
580
  static timeout(delay: number): AbortSignal;
581
+ static any(signals: AbortSignal[]): AbortSignal;
562
582
  get aborted(): boolean;
563
583
  get reason(): any;
564
584
  throwIfAborted(): void;
@@ -1045,6 +1065,7 @@ declare interface RequestInit<Cf = CfProperties> {
1045
1065
  }
1046
1066
  declare abstract class Fetcher {
1047
1067
  fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1068
+ connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1048
1069
  }
1049
1070
  declare interface FetcherPutOptions {
1050
1071
  expiration?: number;
@@ -1617,7 +1638,8 @@ declare interface QueuingStrategyInit {
1617
1638
  */
1618
1639
  highWaterMark: number;
1619
1640
  }
1620
- declare abstract class TraceEvent extends ExtendableEvent {
1641
+ declare abstract class TailEvent extends ExtendableEvent {
1642
+ readonly events: TraceItem[];
1621
1643
  readonly traces: TraceItem[];
1622
1644
  }
1623
1645
  declare interface TraceItem {
@@ -1827,6 +1849,8 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
1827
1849
  accept(): void;
1828
1850
  send(message: (ArrayBuffer | ArrayBufferView) | string): void;
1829
1851
  close(code?: number, reason?: string): void;
1852
+ serializeAttachment(attachment: any): void;
1853
+ deserializeAttachment(): any | null;
1830
1854
  static readonly READY_STATE_CONNECTING: number;
1831
1855
  static readonly READY_STATE_OPEN: number;
1832
1856
  static readonly READY_STATE_CLOSING: number;
@@ -1842,6 +1866,24 @@ declare const WebSocketPair: {
1842
1866
  1: WebSocket;
1843
1867
  };
1844
1868
  };
1869
+ declare interface Socket {
1870
+ get readable(): ReadableStream;
1871
+ get writable(): WritableStream;
1872
+ get closed(): Promise<void>;
1873
+ close(): Promise<void>;
1874
+ startTls(options?: TlsOptions): Socket;
1875
+ }
1876
+ declare interface SocketOptions {
1877
+ secureTransport?: string;
1878
+ allowHalfOpen: boolean;
1879
+ }
1880
+ declare interface SocketAddress {
1881
+ hostname: string;
1882
+ port: number;
1883
+ }
1884
+ declare interface TlsOptions {
1885
+ expectedServerHostname?: string;
1886
+ }
1845
1887
  declare interface BasicImageTransformations {
1846
1888
  /**
1847
1889
  * Maximum width in image pixels. The value must be an integer.