@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.
package/oldest/index.d.ts CHANGED
@@ -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.
package/oldest/index.ts CHANGED
@@ -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.
package/package.json CHANGED
@@ -7,5 +7,5 @@
7
7
  },
8
8
  "author": "Cloudflare Workers DevProd Team <workers-devprod@cloudflare.com> (https://workers.cloudflare.com)",
9
9
  "license": "MIT OR Apache-2.0",
10
- "version": "4.20230419.0"
10
+ "version": "4.20230511.0"
11
11
  }