@cloudflare/workers-types 4.20230419.0 → 4.20230511.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,6 +184,8 @@ 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;
@@ -281,6 +283,8 @@ declare const self: ServiceWorkerGlobalScope;
281
283
  declare const crypto: Crypto;
282
284
  declare const caches: CacheStorage;
283
285
  declare const scheduler: Scheduler;
286
+ declare const performance: Performance;
287
+ declare const origin: string;
284
288
  declare interface TestController {}
285
289
  declare interface ExecutionContext {
286
290
  waitUntil(promise: Promise<any>): void;
@@ -338,6 +342,11 @@ declare abstract class PromiseRejectionEvent extends Event {
338
342
  readonly promise: Promise<any>;
339
343
  readonly reason: any;
340
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
+ }
341
350
  declare interface DurableObject {
342
351
  fetch(request: Request): Response | Promise<Response>;
343
352
  alarm?(): void | Promise<void>;
@@ -385,6 +394,8 @@ declare interface DurableObjectState {
385
394
  readonly id: DurableObjectId;
386
395
  readonly storage: DurableObjectStorage;
387
396
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
397
+ acceptWebSocket(ws: WebSocket, tags?: string[]): void;
398
+ getWebSockets(tag?: string): WebSocket[];
388
399
  }
389
400
  declare interface DurableObjectTransaction {
390
401
  get<T = unknown>(
@@ -571,6 +582,7 @@ declare class AbortController {
571
582
  declare abstract class AbortSignal extends EventTarget {
572
583
  static abort(reason?: any): AbortSignal;
573
584
  static timeout(delay: number): AbortSignal;
585
+ static any(signals: AbortSignal[]): AbortSignal;
574
586
  /** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */
575
587
  readonly aborted: boolean;
576
588
  readonly reason: any;
@@ -1066,6 +1078,7 @@ declare interface RequestInit<Cf = CfProperties> {
1066
1078
  }
1067
1079
  declare abstract class Fetcher {
1068
1080
  fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1081
+ connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1069
1082
  }
1070
1083
  declare interface FetcherPutOptions {
1071
1084
  expiration?: number;
@@ -1839,6 +1852,8 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
1839
1852
  accept(): void;
1840
1853
  send(message: (ArrayBuffer | ArrayBufferView) | string): void;
1841
1854
  close(code?: number, reason?: string): void;
1855
+ serializeAttachment(attachment: any): void;
1856
+ deserializeAttachment(): any | null;
1842
1857
  static readonly READY_STATE_CONNECTING: number;
1843
1858
  static readonly READY_STATE_OPEN: number;
1844
1859
  static readonly READY_STATE_CLOSING: number;
@@ -1858,6 +1873,24 @@ declare const WebSocketPair: {
1858
1873
  1: WebSocket;
1859
1874
  };
1860
1875
  };
1876
+ declare interface Socket {
1877
+ get readable(): ReadableStream;
1878
+ get writable(): WritableStream;
1879
+ get closed(): Promise<void>;
1880
+ close(): Promise<void>;
1881
+ startTls(options?: TlsOptions): Socket;
1882
+ }
1883
+ declare interface SocketOptions {
1884
+ secureTransport?: string;
1885
+ allowHalfOpen: boolean;
1886
+ }
1887
+ declare interface SocketAddress {
1888
+ hostname: string;
1889
+ port: number;
1890
+ }
1891
+ declare interface TlsOptions {
1892
+ expectedServerHostname?: string;
1893
+ }
1861
1894
  declare interface BasicImageTransformations {
1862
1895
  /**
1863
1896
  * Maximum width in image pixels. The value must be an integer.
@@ -184,6 +184,8 @@ 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;
@@ -283,6 +285,8 @@ export declare const self: ServiceWorkerGlobalScope;
283
285
  export declare const crypto: Crypto;
284
286
  export declare const caches: CacheStorage;
285
287
  export declare const scheduler: Scheduler;
288
+ export declare const performance: Performance;
289
+ export declare const origin: string;
286
290
  export interface TestController {}
287
291
  export interface ExecutionContext {
288
292
  waitUntil(promise: Promise<any>): void;
@@ -340,6 +344,11 @@ export declare abstract class PromiseRejectionEvent extends Event {
340
344
  readonly promise: Promise<any>;
341
345
  readonly reason: any;
342
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
+ }
343
352
  export interface DurableObject {
344
353
  fetch(request: Request): Response | Promise<Response>;
345
354
  alarm?(): void | Promise<void>;
@@ -387,6 +396,8 @@ export interface DurableObjectState {
387
396
  readonly id: DurableObjectId;
388
397
  readonly storage: DurableObjectStorage;
389
398
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
399
+ acceptWebSocket(ws: WebSocket, tags?: string[]): void;
400
+ getWebSockets(tag?: string): WebSocket[];
390
401
  }
391
402
  export interface DurableObjectTransaction {
392
403
  get<T = unknown>(
@@ -573,6 +584,7 @@ export declare class AbortController {
573
584
  export declare abstract class AbortSignal extends EventTarget {
574
585
  static abort(reason?: any): AbortSignal;
575
586
  static timeout(delay: number): AbortSignal;
587
+ static any(signals: AbortSignal[]): AbortSignal;
576
588
  /** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */
577
589
  readonly aborted: boolean;
578
590
  readonly reason: any;
@@ -1068,6 +1080,7 @@ export interface RequestInit<Cf = CfProperties> {
1068
1080
  }
1069
1081
  export declare abstract class Fetcher {
1070
1082
  fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1083
+ connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1071
1084
  }
1072
1085
  export interface FetcherPutOptions {
1073
1086
  expiration?: number;
@@ -1844,6 +1857,8 @@ export declare class WebSocket extends EventTarget<WebSocketEventMap> {
1844
1857
  accept(): void;
1845
1858
  send(message: (ArrayBuffer | ArrayBufferView) | string): void;
1846
1859
  close(code?: number, reason?: string): void;
1860
+ serializeAttachment(attachment: any): void;
1861
+ deserializeAttachment(): any | null;
1847
1862
  static readonly READY_STATE_CONNECTING: number;
1848
1863
  static readonly READY_STATE_OPEN: number;
1849
1864
  static readonly READY_STATE_CLOSING: number;
@@ -1863,6 +1878,24 @@ export declare const WebSocketPair: {
1863
1878
  1: WebSocket;
1864
1879
  };
1865
1880
  };
1881
+ export interface Socket {
1882
+ get readable(): ReadableStream;
1883
+ get writable(): WritableStream;
1884
+ get closed(): Promise<void>;
1885
+ close(): Promise<void>;
1886
+ startTls(options?: TlsOptions): Socket;
1887
+ }
1888
+ export interface SocketOptions {
1889
+ secureTransport?: string;
1890
+ allowHalfOpen: boolean;
1891
+ }
1892
+ export interface SocketAddress {
1893
+ hostname: string;
1894
+ port: number;
1895
+ }
1896
+ export interface TlsOptions {
1897
+ expectedServerHostname?: string;
1898
+ }
1866
1899
  export interface BasicImageTransformations {
1867
1900
  /**
1868
1901
  * Maximum width in image pixels. The value must be an integer.
@@ -184,6 +184,8 @@ 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;
@@ -281,6 +283,8 @@ declare const self: ServiceWorkerGlobalScope;
281
283
  declare const crypto: Crypto;
282
284
  declare const caches: CacheStorage;
283
285
  declare const scheduler: Scheduler;
286
+ declare const performance: Performance;
287
+ declare const origin: string;
284
288
  declare interface TestController {}
285
289
  declare interface ExecutionContext {
286
290
  waitUntil(promise: Promise<any>): void;
@@ -338,6 +342,11 @@ declare abstract class PromiseRejectionEvent extends Event {
338
342
  readonly promise: Promise<any>;
339
343
  readonly reason: any;
340
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
+ }
341
350
  declare interface DurableObject {
342
351
  fetch(request: Request): Response | Promise<Response>;
343
352
  alarm?(): void | Promise<void>;
@@ -385,6 +394,8 @@ declare interface DurableObjectState {
385
394
  readonly id: DurableObjectId;
386
395
  readonly storage: DurableObjectStorage;
387
396
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
397
+ acceptWebSocket(ws: WebSocket, tags?: string[]): void;
398
+ getWebSockets(tag?: string): WebSocket[];
388
399
  }
389
400
  declare interface DurableObjectTransaction {
390
401
  get<T = unknown>(
@@ -560,6 +571,7 @@ declare class AbortController {
560
571
  declare abstract class AbortSignal extends EventTarget {
561
572
  static abort(reason?: any): AbortSignal;
562
573
  static timeout(delay: number): AbortSignal;
574
+ static any(signals: AbortSignal[]): AbortSignal;
563
575
  get aborted(): boolean;
564
576
  get reason(): any;
565
577
  throwIfAborted(): void;
@@ -1046,6 +1058,7 @@ declare interface RequestInit<Cf = CfProperties> {
1046
1058
  }
1047
1059
  declare abstract class Fetcher {
1048
1060
  fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1061
+ connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1049
1062
  }
1050
1063
  declare interface FetcherPutOptions {
1051
1064
  expiration?: number;
@@ -1829,6 +1842,8 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
1829
1842
  accept(): void;
1830
1843
  send(message: (ArrayBuffer | ArrayBufferView) | string): void;
1831
1844
  close(code?: number, reason?: string): void;
1845
+ serializeAttachment(attachment: any): void;
1846
+ deserializeAttachment(): any | null;
1832
1847
  static readonly READY_STATE_CONNECTING: number;
1833
1848
  static readonly READY_STATE_OPEN: number;
1834
1849
  static readonly READY_STATE_CLOSING: number;
@@ -1844,6 +1859,24 @@ declare const WebSocketPair: {
1844
1859
  1: WebSocket;
1845
1860
  };
1846
1861
  };
1862
+ declare interface Socket {
1863
+ get readable(): ReadableStream;
1864
+ get writable(): WritableStream;
1865
+ get closed(): Promise<void>;
1866
+ close(): Promise<void>;
1867
+ startTls(options?: TlsOptions): Socket;
1868
+ }
1869
+ declare interface SocketOptions {
1870
+ secureTransport?: string;
1871
+ allowHalfOpen: boolean;
1872
+ }
1873
+ declare interface SocketAddress {
1874
+ hostname: string;
1875
+ port: number;
1876
+ }
1877
+ declare interface TlsOptions {
1878
+ expectedServerHostname?: string;
1879
+ }
1847
1880
  declare interface BasicImageTransformations {
1848
1881
  /**
1849
1882
  * Maximum width in image pixels. The value must be an integer.
@@ -184,6 +184,8 @@ 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;
@@ -283,6 +285,8 @@ export declare const self: ServiceWorkerGlobalScope;
283
285
  export declare const crypto: Crypto;
284
286
  export declare const caches: CacheStorage;
285
287
  export declare const scheduler: Scheduler;
288
+ export declare const performance: Performance;
289
+ export declare const origin: string;
286
290
  export interface TestController {}
287
291
  export interface ExecutionContext {
288
292
  waitUntil(promise: Promise<any>): void;
@@ -340,6 +344,11 @@ export declare abstract class PromiseRejectionEvent extends Event {
340
344
  readonly promise: Promise<any>;
341
345
  readonly reason: any;
342
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
+ }
343
352
  export interface DurableObject {
344
353
  fetch(request: Request): Response | Promise<Response>;
345
354
  alarm?(): void | Promise<void>;
@@ -387,6 +396,8 @@ export interface DurableObjectState {
387
396
  readonly id: DurableObjectId;
388
397
  readonly storage: DurableObjectStorage;
389
398
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
399
+ acceptWebSocket(ws: WebSocket, tags?: string[]): void;
400
+ getWebSockets(tag?: string): WebSocket[];
390
401
  }
391
402
  export interface DurableObjectTransaction {
392
403
  get<T = unknown>(
@@ -562,6 +573,7 @@ export declare class AbortController {
562
573
  export declare abstract class AbortSignal extends EventTarget {
563
574
  static abort(reason?: any): AbortSignal;
564
575
  static timeout(delay: number): AbortSignal;
576
+ static any(signals: AbortSignal[]): AbortSignal;
565
577
  get aborted(): boolean;
566
578
  get reason(): any;
567
579
  throwIfAborted(): void;
@@ -1048,6 +1060,7 @@ export interface RequestInit<Cf = CfProperties> {
1048
1060
  }
1049
1061
  export declare abstract class Fetcher {
1050
1062
  fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1063
+ connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1051
1064
  }
1052
1065
  export interface FetcherPutOptions {
1053
1066
  expiration?: number;
@@ -1834,6 +1847,8 @@ export declare class WebSocket extends EventTarget<WebSocketEventMap> {
1834
1847
  accept(): void;
1835
1848
  send(message: (ArrayBuffer | ArrayBufferView) | string): void;
1836
1849
  close(code?: number, reason?: string): void;
1850
+ serializeAttachment(attachment: any): void;
1851
+ deserializeAttachment(): any | null;
1837
1852
  static readonly READY_STATE_CONNECTING: number;
1838
1853
  static readonly READY_STATE_OPEN: number;
1839
1854
  static readonly READY_STATE_CLOSING: number;
@@ -1849,6 +1864,24 @@ export declare const WebSocketPair: {
1849
1864
  1: WebSocket;
1850
1865
  };
1851
1866
  };
1867
+ export interface Socket {
1868
+ get readable(): ReadableStream;
1869
+ get writable(): WritableStream;
1870
+ get closed(): Promise<void>;
1871
+ close(): Promise<void>;
1872
+ startTls(options?: TlsOptions): Socket;
1873
+ }
1874
+ export interface SocketOptions {
1875
+ secureTransport?: string;
1876
+ allowHalfOpen: boolean;
1877
+ }
1878
+ export interface SocketAddress {
1879
+ hostname: string;
1880
+ port: number;
1881
+ }
1882
+ export interface TlsOptions {
1883
+ expectedServerHostname?: string;
1884
+ }
1852
1885
  export interface BasicImageTransformations {
1853
1886
  /**
1854
1887
  * Maximum width in image pixels. The value must be an integer.
@@ -184,6 +184,8 @@ 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;
@@ -283,6 +285,8 @@ declare const self: ServiceWorkerGlobalScope;
283
285
  declare const crypto: Crypto;
284
286
  declare const caches: CacheStorage;
285
287
  declare const scheduler: Scheduler;
288
+ declare const performance: Performance;
289
+ declare const origin: string;
286
290
  declare const navigator: Navigator;
287
291
  declare interface TestController {}
288
292
  declare interface ExecutionContext {
@@ -344,6 +348,11 @@ declare abstract class PromiseRejectionEvent extends Event {
344
348
  declare abstract class Navigator {
345
349
  readonly userAgent: string;
346
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
+ }
347
356
  declare interface DurableObject {
348
357
  fetch(request: Request): Response | Promise<Response>;
349
358
  alarm?(): void | Promise<void>;
@@ -391,6 +400,8 @@ declare interface DurableObjectState {
391
400
  readonly id: DurableObjectId;
392
401
  readonly storage: DurableObjectStorage;
393
402
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
403
+ acceptWebSocket(ws: WebSocket, tags?: string[]): void;
404
+ getWebSockets(tag?: string): WebSocket[];
394
405
  }
395
406
  declare interface DurableObjectTransaction {
396
407
  get<T = unknown>(
@@ -566,6 +577,7 @@ declare class AbortController {
566
577
  declare abstract class AbortSignal extends EventTarget {
567
578
  static abort(reason?: any): AbortSignal;
568
579
  static timeout(delay: number): AbortSignal;
580
+ static any(signals: AbortSignal[]): AbortSignal;
569
581
  get aborted(): boolean;
570
582
  get reason(): any;
571
583
  throwIfAborted(): void;
@@ -1052,6 +1064,7 @@ declare interface RequestInit<Cf = CfProperties> {
1052
1064
  }
1053
1065
  declare abstract class Fetcher {
1054
1066
  fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1067
+ connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1055
1068
  }
1056
1069
  declare interface FetcherPutOptions {
1057
1070
  expiration?: number;
@@ -1835,6 +1848,8 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
1835
1848
  accept(): void;
1836
1849
  send(message: (ArrayBuffer | ArrayBufferView) | string): void;
1837
1850
  close(code?: number, reason?: string): void;
1851
+ serializeAttachment(attachment: any): void;
1852
+ deserializeAttachment(): any | null;
1838
1853
  static readonly READY_STATE_CONNECTING: number;
1839
1854
  static readonly READY_STATE_OPEN: number;
1840
1855
  static readonly READY_STATE_CLOSING: number;
@@ -1850,6 +1865,24 @@ declare const WebSocketPair: {
1850
1865
  1: WebSocket;
1851
1866
  };
1852
1867
  };
1868
+ declare 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
+ declare interface SocketOptions {
1876
+ secureTransport?: string;
1877
+ allowHalfOpen: boolean;
1878
+ }
1879
+ declare interface SocketAddress {
1880
+ hostname: string;
1881
+ port: number;
1882
+ }
1883
+ declare interface TlsOptions {
1884
+ expectedServerHostname?: string;
1885
+ }
1853
1886
  declare interface BasicImageTransformations {
1854
1887
  /**
1855
1888
  * Maximum width in image pixels. The value must be an integer.
@@ -184,6 +184,8 @@ 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;
@@ -285,6 +287,8 @@ export declare const self: ServiceWorkerGlobalScope;
285
287
  export declare const crypto: Crypto;
286
288
  export declare const caches: CacheStorage;
287
289
  export declare const scheduler: Scheduler;
290
+ export declare const performance: Performance;
291
+ export declare const origin: string;
288
292
  export declare const navigator: Navigator;
289
293
  export interface TestController {}
290
294
  export interface ExecutionContext {
@@ -346,6 +350,11 @@ export declare abstract class PromiseRejectionEvent extends Event {
346
350
  export declare abstract class Navigator {
347
351
  readonly userAgent: string;
348
352
  }
353
+ /** 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. */
354
+ export interface Performance {
355
+ readonly timeOrigin: number;
356
+ now(): number;
357
+ }
349
358
  export interface DurableObject {
350
359
  fetch(request: Request): Response | Promise<Response>;
351
360
  alarm?(): void | Promise<void>;
@@ -393,6 +402,8 @@ export interface DurableObjectState {
393
402
  readonly id: DurableObjectId;
394
403
  readonly storage: DurableObjectStorage;
395
404
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
405
+ acceptWebSocket(ws: WebSocket, tags?: string[]): void;
406
+ getWebSockets(tag?: string): WebSocket[];
396
407
  }
397
408
  export interface DurableObjectTransaction {
398
409
  get<T = unknown>(
@@ -568,6 +579,7 @@ export declare class AbortController {
568
579
  export declare abstract class AbortSignal extends EventTarget {
569
580
  static abort(reason?: any): AbortSignal;
570
581
  static timeout(delay: number): AbortSignal;
582
+ static any(signals: AbortSignal[]): AbortSignal;
571
583
  get aborted(): boolean;
572
584
  get reason(): any;
573
585
  throwIfAborted(): void;
@@ -1054,6 +1066,7 @@ export interface RequestInit<Cf = CfProperties> {
1054
1066
  }
1055
1067
  export declare abstract class Fetcher {
1056
1068
  fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1069
+ connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1057
1070
  }
1058
1071
  export interface FetcherPutOptions {
1059
1072
  expiration?: number;
@@ -1840,6 +1853,8 @@ export declare class WebSocket extends EventTarget<WebSocketEventMap> {
1840
1853
  accept(): void;
1841
1854
  send(message: (ArrayBuffer | ArrayBufferView) | string): void;
1842
1855
  close(code?: number, reason?: string): void;
1856
+ serializeAttachment(attachment: any): void;
1857
+ deserializeAttachment(): any | null;
1843
1858
  static readonly READY_STATE_CONNECTING: number;
1844
1859
  static readonly READY_STATE_OPEN: number;
1845
1860
  static readonly READY_STATE_CLOSING: number;
@@ -1855,6 +1870,24 @@ export declare const WebSocketPair: {
1855
1870
  1: WebSocket;
1856
1871
  };
1857
1872
  };
1873
+ export interface Socket {
1874
+ get readable(): ReadableStream;
1875
+ get writable(): WritableStream;
1876
+ get closed(): Promise<void>;
1877
+ close(): Promise<void>;
1878
+ startTls(options?: TlsOptions): Socket;
1879
+ }
1880
+ export interface SocketOptions {
1881
+ secureTransport?: string;
1882
+ allowHalfOpen: boolean;
1883
+ }
1884
+ export interface SocketAddress {
1885
+ hostname: string;
1886
+ port: number;
1887
+ }
1888
+ export interface TlsOptions {
1889
+ expectedServerHostname?: string;
1890
+ }
1858
1891
  export interface BasicImageTransformations {
1859
1892
  /**
1860
1893
  * Maximum width in image pixels. The value must be an integer.
@@ -184,6 +184,8 @@ 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;
@@ -283,6 +285,8 @@ declare const self: ServiceWorkerGlobalScope;
283
285
  declare const crypto: Crypto;
284
286
  declare const caches: CacheStorage;
285
287
  declare const scheduler: Scheduler;
288
+ declare const performance: Performance;
289
+ declare const origin: string;
286
290
  declare const navigator: Navigator;
287
291
  declare interface TestController {}
288
292
  declare interface ExecutionContext {
@@ -344,6 +348,11 @@ declare abstract class PromiseRejectionEvent extends Event {
344
348
  declare abstract class Navigator {
345
349
  readonly userAgent: string;
346
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
+ }
347
356
  declare interface DurableObject {
348
357
  fetch(request: Request): Response | Promise<Response>;
349
358
  alarm?(): void | Promise<void>;
@@ -391,6 +400,8 @@ declare interface DurableObjectState {
391
400
  readonly id: DurableObjectId;
392
401
  readonly storage: DurableObjectStorage;
393
402
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
403
+ acceptWebSocket(ws: WebSocket, tags?: string[]): void;
404
+ getWebSockets(tag?: string): WebSocket[];
394
405
  }
395
406
  declare interface DurableObjectTransaction {
396
407
  get<T = unknown>(
@@ -566,6 +577,7 @@ declare class AbortController {
566
577
  declare abstract class AbortSignal extends EventTarget {
567
578
  static abort(reason?: any): AbortSignal;
568
579
  static timeout(delay: number): AbortSignal;
580
+ static any(signals: AbortSignal[]): AbortSignal;
569
581
  get aborted(): boolean;
570
582
  get reason(): any;
571
583
  throwIfAborted(): void;
@@ -1052,6 +1064,7 @@ declare interface RequestInit<Cf = CfProperties> {
1052
1064
  }
1053
1065
  declare abstract class Fetcher {
1054
1066
  fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1067
+ connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1055
1068
  }
1056
1069
  declare interface FetcherPutOptions {
1057
1070
  expiration?: number;
@@ -1836,6 +1849,8 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
1836
1849
  accept(): void;
1837
1850
  send(message: (ArrayBuffer | ArrayBufferView) | string): void;
1838
1851
  close(code?: number, reason?: string): void;
1852
+ serializeAttachment(attachment: any): void;
1853
+ deserializeAttachment(): any | null;
1839
1854
  static readonly READY_STATE_CONNECTING: number;
1840
1855
  static readonly READY_STATE_OPEN: number;
1841
1856
  static readonly READY_STATE_CLOSING: number;
@@ -1851,6 +1866,24 @@ declare const WebSocketPair: {
1851
1866
  1: WebSocket;
1852
1867
  };
1853
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
+ }
1854
1887
  declare interface BasicImageTransformations {
1855
1888
  /**
1856
1889
  * Maximum width in image pixels. The value must be an integer.
@@ -184,6 +184,8 @@ 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;
@@ -285,6 +287,8 @@ export declare const self: ServiceWorkerGlobalScope;
285
287
  export declare const crypto: Crypto;
286
288
  export declare const caches: CacheStorage;
287
289
  export declare const scheduler: Scheduler;
290
+ export declare const performance: Performance;
291
+ export declare const origin: string;
288
292
  export declare const navigator: Navigator;
289
293
  export interface TestController {}
290
294
  export interface ExecutionContext {
@@ -346,6 +350,11 @@ export declare abstract class PromiseRejectionEvent extends Event {
346
350
  export declare abstract class Navigator {
347
351
  readonly userAgent: string;
348
352
  }
353
+ /** 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. */
354
+ export interface Performance {
355
+ readonly timeOrigin: number;
356
+ now(): number;
357
+ }
349
358
  export interface DurableObject {
350
359
  fetch(request: Request): Response | Promise<Response>;
351
360
  alarm?(): void | Promise<void>;
@@ -393,6 +402,8 @@ export interface DurableObjectState {
393
402
  readonly id: DurableObjectId;
394
403
  readonly storage: DurableObjectStorage;
395
404
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
405
+ acceptWebSocket(ws: WebSocket, tags?: string[]): void;
406
+ getWebSockets(tag?: string): WebSocket[];
396
407
  }
397
408
  export interface DurableObjectTransaction {
398
409
  get<T = unknown>(
@@ -568,6 +579,7 @@ export declare class AbortController {
568
579
  export declare abstract class AbortSignal extends EventTarget {
569
580
  static abort(reason?: any): AbortSignal;
570
581
  static timeout(delay: number): AbortSignal;
582
+ static any(signals: AbortSignal[]): AbortSignal;
571
583
  get aborted(): boolean;
572
584
  get reason(): any;
573
585
  throwIfAborted(): void;
@@ -1054,6 +1066,7 @@ export interface RequestInit<Cf = CfProperties> {
1054
1066
  }
1055
1067
  export declare abstract class Fetcher {
1056
1068
  fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1069
+ connect(address: SocketAddress | string, options?: SocketOptions): Socket;
1057
1070
  }
1058
1071
  export interface FetcherPutOptions {
1059
1072
  expiration?: number;
@@ -1841,6 +1854,8 @@ export declare class WebSocket extends EventTarget<WebSocketEventMap> {
1841
1854
  accept(): void;
1842
1855
  send(message: (ArrayBuffer | ArrayBufferView) | string): void;
1843
1856
  close(code?: number, reason?: string): void;
1857
+ serializeAttachment(attachment: any): void;
1858
+ deserializeAttachment(): any | null;
1844
1859
  static readonly READY_STATE_CONNECTING: number;
1845
1860
  static readonly READY_STATE_OPEN: number;
1846
1861
  static readonly READY_STATE_CLOSING: number;
@@ -1856,6 +1871,24 @@ export declare const WebSocketPair: {
1856
1871
  1: WebSocket;
1857
1872
  };
1858
1873
  };
1874
+ export interface Socket {
1875
+ get readable(): ReadableStream;
1876
+ get writable(): WritableStream;
1877
+ get closed(): Promise<void>;
1878
+ close(): Promise<void>;
1879
+ startTls(options?: TlsOptions): Socket;
1880
+ }
1881
+ export interface SocketOptions {
1882
+ secureTransport?: string;
1883
+ allowHalfOpen: boolean;
1884
+ }
1885
+ export interface SocketAddress {
1886
+ hostname: string;
1887
+ port: number;
1888
+ }
1889
+ export interface TlsOptions {
1890
+ expectedServerHostname?: string;
1891
+ }
1859
1892
  export interface BasicImageTransformations {
1860
1893
  /**
1861
1894
  * Maximum width in image pixels. The value must be an integer.