npm package diff

Package: @cloudflare/workers-types

Versions: 4.20230419.0 - 4.20230511.0

File: package/2021-11-03/index.d.ts

Index: package/2021-11-03/index.d.ts
===================================================================
--- package/2021-11-03/index.d.ts
+++ package/2021-11-03/index.d.ts
@@ -183,8 +183,10 @@
   self: ServiceWorkerGlobalScope;
   crypto: Crypto;
   caches: CacheStorage;
   scheduler: Scheduler;
+  performance: Performance;
+  readonly origin: string;
   Event: typeof Event;
   ExtendableEvent: typeof ExtendableEvent;
   PromiseRejectionEvent: typeof PromiseRejectionEvent;
   FetchEvent: typeof FetchEvent;
@@ -280,8 +282,10 @@
 declare const self: ServiceWorkerGlobalScope;
 declare const crypto: Crypto;
 declare const caches: CacheStorage;
 declare const scheduler: Scheduler;
+declare const performance: Performance;
+declare const origin: string;
 declare interface TestController {}
 declare interface ExecutionContext {
   waitUntil(promise: Promise<any>): void;
   passThroughOnException(): void;
@@ -337,8 +341,13 @@
 declare abstract class PromiseRejectionEvent extends Event {
   readonly promise: Promise<any>;
   readonly reason: any;
 }
+/** 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. */
+declare interface Performance {
+  readonly timeOrigin: number;
+  now(): number;
+}
 declare interface DurableObject {
   fetch(request: Request): Response | Promise<Response>;
   alarm?(): void | Promise<void>;
 }
@@ -384,8 +393,10 @@
   waitUntil(promise: Promise<any>): void;
   readonly id: DurableObjectId;
   readonly storage: DurableObjectStorage;
   blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
+  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
+  getWebSockets(tag?: string): WebSocket[];
 }
 declare interface DurableObjectTransaction {
   get<T = unknown>(
     key: string,
@@ -570,8 +581,9 @@
 }
 declare abstract class AbortSignal extends EventTarget {
   static abort(reason?: any): AbortSignal;
   static timeout(delay: number): AbortSignal;
+  static any(signals: AbortSignal[]): AbortSignal;
   /** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */
   readonly aborted: boolean;
   readonly reason: any;
   throwIfAborted(): void;
@@ -1065,8 +1077,9 @@
   signal?: AbortSignal | null;
 }
 declare abstract class Fetcher {
   fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
+  connect(address: SocketAddress | string, options?: SocketOptions): Socket;
 }
 declare interface FetcherPutOptions {
   expiration?: number;
   expirationTtl?: number;
@@ -1838,8 +1851,10 @@
   constructor(url: string, protocols?: string[] | string);
   accept(): void;
   send(message: (ArrayBuffer | ArrayBufferView) | string): void;
   close(code?: number, reason?: string): void;
+  serializeAttachment(attachment: any): void;
+  deserializeAttachment(): any | null;
   static readonly READY_STATE_CONNECTING: number;
   static readonly READY_STATE_OPEN: number;
   static readonly READY_STATE_CLOSING: number;
   static readonly READY_STATE_CLOSED: number;
@@ -1857,8 +1872,26 @@
     0: WebSocket;
     1: WebSocket;
   };
 };
+declare interface Socket {
+  get readable(): ReadableStream;
+  get writable(): WritableStream;
+  get closed(): Promise<void>;
+  close(): Promise<void>;
+  startTls(options?: TlsOptions): Socket;
+}
+declare interface SocketOptions {
+  secureTransport?: string;
+  allowHalfOpen: boolean;
+}
+declare interface SocketAddress {
+  hostname: string;
+  port: number;
+}
+declare interface TlsOptions {
+  expectedServerHostname?: string;
+}
 declare interface BasicImageTransformations {
   /**
    * Maximum width in image pixels. The value must be an integer.
    */