npm package diff
Package: @cloudflare/workers-types
Versions: 4.20230419.0 - 4.20230511.0
File: package/2022-01-31/index.ts
Index: package/2022-01-31/index.ts
===================================================================
--- package/2022-01-31/index.ts
+++ package/2022-01-31/index.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 @@
export declare const self: ServiceWorkerGlobalScope;
export declare const crypto: Crypto;
export declare const caches: CacheStorage;
export declare const scheduler: Scheduler;
+export declare const performance: Performance;
+export declare const origin: string;
export interface TestController {}
export interface ExecutionContext {
waitUntil(promise: Promise<any>): void;
passThroughOnException(): void;
@@ -339,8 +343,13 @@
export 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. */
+export interface Performance {
+ readonly timeOrigin: number;
+ now(): number;
+}
export interface DurableObject {
fetch(request: Request): Response | Promise<Response>;
alarm?(): void | Promise<void>;
}
@@ -386,8 +395,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[];
}
export interface DurableObjectTransaction {
get<T = unknown>(
key: string,
@@ -561,8 +572,9 @@
}
export 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;
}
@@ -1047,8 +1059,9 @@
signal?: AbortSignal | null;
}
export declare abstract class Fetcher {
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
+ connect(address: SocketAddress | string, options?: SocketOptions): Socket;
}
export interface FetcherPutOptions {
expiration?: number;
expirationTtl?: number;
@@ -1833,8 +1846,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;
@@ -1848,8 +1863,26 @@
0: WebSocket;
1: WebSocket;
};
};
+export interface Socket {
+ get readable(): ReadableStream;
+ get writable(): WritableStream;
+ get closed(): Promise<void>;
+ close(): Promise<void>;
+ startTls(options?: TlsOptions): Socket;
+}
+export interface SocketOptions {
+ secureTransport?: string;
+ allowHalfOpen: boolean;
+}
+export interface SocketAddress {
+ hostname: string;
+ port: number;
+}
+export interface TlsOptions {
+ expectedServerHostname?: string;
+}
export interface BasicImageTransformations {
/**
* Maximum width in image pixels. The value must be an integer.
*/