npm package diff
Package: @cloudflare/workers-types
Versions: 4.20230419.0 - 4.20230511.0
File: package/2022-03-21/index.d.ts
Index: package/2022-03-21/index.d.ts
===================================================================
--- package/2022-03-21/index.d.ts
+++ package/2022-03-21/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;
@@ -282,8 +284,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 const navigator: Navigator;
declare interface TestController {}
declare interface ExecutionContext {
waitUntil(promise: Promise<any>): void;
@@ -343,8 +347,13 @@
}
declare abstract class Navigator {
readonly userAgent: string;
}
+/** 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>;
}
@@ -390,8 +399,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,
@@ -565,8 +576,9 @@
}
declare abstract class AbortSignal extends EventTarget {
static abort(reason?: any): AbortSignal;
static timeout(delay: number): AbortSignal;
+ static any(signals: AbortSignal[]): AbortSignal;
get aborted(): boolean;
get reason(): any;
throwIfAborted(): void;
}
@@ -1051,8 +1063,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;
@@ -1834,8 +1847,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;
@@ -1849,8 +1864,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.
*/