@cloudflare/workers-types 4.20230419.0 → 4.20230518.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/2021-11-03/index.d.ts +72 -1
- package/2021-11-03/index.ts +65 -1
- package/2022-01-31/index.d.ts +72 -1
- package/2022-01-31/index.ts +65 -1
- package/2022-03-21/index.d.ts +72 -1
- package/2022-03-21/index.ts +65 -1
- package/2022-08-04/index.d.ts +72 -1
- package/2022-08-04/index.ts +65 -1
- package/2022-10-31/index.d.ts +74 -3
- package/2022-10-31/index.ts +67 -3
- package/2022-11-30/index.d.ts +74 -3
- package/2022-11-30/index.ts +67 -3
- package/experimental/index.d.ts +57 -3
- package/experimental/index.ts +50 -3
- package/index.d.ts +72 -1
- package/index.ts +65 -1
- package/oldest/index.d.ts +72 -1
- package/oldest/index.ts +65 -1
- package/package.json +1 -1
package/2022-03-21/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;
|
|
@@ -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>(
|
|
@@ -457,6 +468,7 @@ declare interface DurableObjectStorage {
|
|
|
457
468
|
): Promise<void>;
|
|
458
469
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
459
470
|
sync(): Promise<void>;
|
|
471
|
+
transactionSync<T>(closure: () => T): T;
|
|
460
472
|
}
|
|
461
473
|
declare interface DurableObjectListOptions {
|
|
462
474
|
start?: string;
|
|
@@ -566,6 +578,7 @@ declare class AbortController {
|
|
|
566
578
|
declare abstract class AbortSignal extends EventTarget {
|
|
567
579
|
static abort(reason?: any): AbortSignal;
|
|
568
580
|
static timeout(delay: number): AbortSignal;
|
|
581
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
569
582
|
get aborted(): boolean;
|
|
570
583
|
get reason(): any;
|
|
571
584
|
throwIfAborted(): void;
|
|
@@ -1052,6 +1065,7 @@ declare interface RequestInit<Cf = CfProperties> {
|
|
|
1052
1065
|
}
|
|
1053
1066
|
declare abstract class Fetcher {
|
|
1054
1067
|
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1068
|
+
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1055
1069
|
}
|
|
1056
1070
|
declare interface FetcherPutOptions {
|
|
1057
1071
|
expiration?: number;
|
|
@@ -1835,6 +1849,8 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1835
1849
|
accept(): void;
|
|
1836
1850
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1837
1851
|
close(code?: number, reason?: string): void;
|
|
1852
|
+
serializeAttachment(attachment: any): void;
|
|
1853
|
+
deserializeAttachment(): any | null;
|
|
1838
1854
|
static readonly READY_STATE_CONNECTING: number;
|
|
1839
1855
|
static readonly READY_STATE_OPEN: number;
|
|
1840
1856
|
static readonly READY_STATE_CLOSING: number;
|
|
@@ -1850,6 +1866,24 @@ declare const WebSocketPair: {
|
|
|
1850
1866
|
1: WebSocket;
|
|
1851
1867
|
};
|
|
1852
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
|
+
}
|
|
1853
1887
|
declare interface BasicImageTransformations {
|
|
1854
1888
|
/**
|
|
1855
1889
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2984,12 +3018,49 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2984
3018
|
// Key Identifier of the JWK
|
|
2985
3019
|
readonly kid: string;
|
|
2986
3020
|
}
|
|
3021
|
+
declare module "cloudflare:sockets" {
|
|
3022
|
+
function _connect(
|
|
3023
|
+
address: string | SocketAddress,
|
|
3024
|
+
options?: SocketOptions
|
|
3025
|
+
): Socket;
|
|
3026
|
+
export { _connect as connect };
|
|
3027
|
+
}
|
|
2987
3028
|
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3029
|
+
declare interface DynamicDispatchLimits {
|
|
3030
|
+
/**
|
|
3031
|
+
* Limit CPU time in milliseconds.
|
|
3032
|
+
*/
|
|
3033
|
+
cpuMs?: number;
|
|
3034
|
+
/**
|
|
3035
|
+
* Limit number of subrequests.
|
|
3036
|
+
*/
|
|
3037
|
+
subRequests?: number;
|
|
3038
|
+
}
|
|
3039
|
+
declare interface DynamicDispatchOptions {
|
|
3040
|
+
/**
|
|
3041
|
+
* Limit resources of invoked Worker script.
|
|
3042
|
+
*/
|
|
3043
|
+
limits?: DynamicDispatchLimits;
|
|
3044
|
+
/**
|
|
3045
|
+
* Arguments for outbound Worker script, if configured.
|
|
3046
|
+
*/
|
|
3047
|
+
outbound?: {
|
|
3048
|
+
[key: string]: any;
|
|
3049
|
+
};
|
|
3050
|
+
}
|
|
2988
3051
|
declare interface DispatchNamespace {
|
|
2989
3052
|
/**
|
|
2990
3053
|
* @param name Name of the Worker script.
|
|
3054
|
+
* @param args Arguments to Worker script.
|
|
3055
|
+
* @param options Options for Dynamic Dispatch invocation.
|
|
2991
3056
|
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
2992
3057
|
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2993
3058
|
*/
|
|
2994
|
-
get(
|
|
3059
|
+
get(
|
|
3060
|
+
name: string,
|
|
3061
|
+
args?: {
|
|
3062
|
+
[key: string]: any;
|
|
3063
|
+
},
|
|
3064
|
+
options?: DynamicDispatchOptions
|
|
3065
|
+
): Fetcher;
|
|
2995
3066
|
}
|
package/2022-03-21/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;
|
|
@@ -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>(
|
|
@@ -459,6 +470,7 @@ export interface DurableObjectStorage {
|
|
|
459
470
|
): Promise<void>;
|
|
460
471
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
461
472
|
sync(): Promise<void>;
|
|
473
|
+
transactionSync<T>(closure: () => T): T;
|
|
462
474
|
}
|
|
463
475
|
export interface DurableObjectListOptions {
|
|
464
476
|
start?: string;
|
|
@@ -568,6 +580,7 @@ export declare class AbortController {
|
|
|
568
580
|
export declare abstract class AbortSignal extends EventTarget {
|
|
569
581
|
static abort(reason?: any): AbortSignal;
|
|
570
582
|
static timeout(delay: number): AbortSignal;
|
|
583
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
571
584
|
get aborted(): boolean;
|
|
572
585
|
get reason(): any;
|
|
573
586
|
throwIfAborted(): void;
|
|
@@ -1054,6 +1067,7 @@ export interface RequestInit<Cf = CfProperties> {
|
|
|
1054
1067
|
}
|
|
1055
1068
|
export declare abstract class Fetcher {
|
|
1056
1069
|
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1070
|
+
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1057
1071
|
}
|
|
1058
1072
|
export interface FetcherPutOptions {
|
|
1059
1073
|
expiration?: number;
|
|
@@ -1840,6 +1854,8 @@ export declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1840
1854
|
accept(): void;
|
|
1841
1855
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1842
1856
|
close(code?: number, reason?: string): void;
|
|
1857
|
+
serializeAttachment(attachment: any): void;
|
|
1858
|
+
deserializeAttachment(): any | null;
|
|
1843
1859
|
static readonly READY_STATE_CONNECTING: number;
|
|
1844
1860
|
static readonly READY_STATE_OPEN: number;
|
|
1845
1861
|
static readonly READY_STATE_CLOSING: number;
|
|
@@ -1855,6 +1871,24 @@ export declare const WebSocketPair: {
|
|
|
1855
1871
|
1: WebSocket;
|
|
1856
1872
|
};
|
|
1857
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
|
+
}
|
|
1858
1892
|
export interface BasicImageTransformations {
|
|
1859
1893
|
/**
|
|
1860
1894
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2980,11 +3014,41 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2980
3014
|
readonly kid: string;
|
|
2981
3015
|
}
|
|
2982
3016
|
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3017
|
+
export interface DynamicDispatchLimits {
|
|
3018
|
+
/**
|
|
3019
|
+
* Limit CPU time in milliseconds.
|
|
3020
|
+
*/
|
|
3021
|
+
cpuMs?: number;
|
|
3022
|
+
/**
|
|
3023
|
+
* Limit number of subrequests.
|
|
3024
|
+
*/
|
|
3025
|
+
subRequests?: number;
|
|
3026
|
+
}
|
|
3027
|
+
export interface DynamicDispatchOptions {
|
|
3028
|
+
/**
|
|
3029
|
+
* Limit resources of invoked Worker script.
|
|
3030
|
+
*/
|
|
3031
|
+
limits?: DynamicDispatchLimits;
|
|
3032
|
+
/**
|
|
3033
|
+
* Arguments for outbound Worker script, if configured.
|
|
3034
|
+
*/
|
|
3035
|
+
outbound?: {
|
|
3036
|
+
[key: string]: any;
|
|
3037
|
+
};
|
|
3038
|
+
}
|
|
2983
3039
|
export interface DispatchNamespace {
|
|
2984
3040
|
/**
|
|
2985
3041
|
* @param name Name of the Worker script.
|
|
3042
|
+
* @param args Arguments to Worker script.
|
|
3043
|
+
* @param options Options for Dynamic Dispatch invocation.
|
|
2986
3044
|
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
2987
3045
|
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2988
3046
|
*/
|
|
2989
|
-
get(
|
|
3047
|
+
get(
|
|
3048
|
+
name: string,
|
|
3049
|
+
args?: {
|
|
3050
|
+
[key: string]: any;
|
|
3051
|
+
},
|
|
3052
|
+
options?: DynamicDispatchOptions
|
|
3053
|
+
): Fetcher;
|
|
2990
3054
|
}
|
package/2022-08-04/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;
|
|
@@ -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>(
|
|
@@ -457,6 +468,7 @@ declare interface DurableObjectStorage {
|
|
|
457
468
|
): Promise<void>;
|
|
458
469
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
459
470
|
sync(): Promise<void>;
|
|
471
|
+
transactionSync<T>(closure: () => T): T;
|
|
460
472
|
}
|
|
461
473
|
declare interface DurableObjectListOptions {
|
|
462
474
|
start?: string;
|
|
@@ -566,6 +578,7 @@ declare class AbortController {
|
|
|
566
578
|
declare abstract class AbortSignal extends EventTarget {
|
|
567
579
|
static abort(reason?: any): AbortSignal;
|
|
568
580
|
static timeout(delay: number): AbortSignal;
|
|
581
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
569
582
|
get aborted(): boolean;
|
|
570
583
|
get reason(): any;
|
|
571
584
|
throwIfAborted(): void;
|
|
@@ -1052,6 +1065,7 @@ declare interface RequestInit<Cf = CfProperties> {
|
|
|
1052
1065
|
}
|
|
1053
1066
|
declare abstract class Fetcher {
|
|
1054
1067
|
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1068
|
+
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1055
1069
|
}
|
|
1056
1070
|
declare interface FetcherPutOptions {
|
|
1057
1071
|
expiration?: number;
|
|
@@ -1836,6 +1850,8 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1836
1850
|
accept(): void;
|
|
1837
1851
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1838
1852
|
close(code?: number, reason?: string): void;
|
|
1853
|
+
serializeAttachment(attachment: any): void;
|
|
1854
|
+
deserializeAttachment(): any | null;
|
|
1839
1855
|
static readonly READY_STATE_CONNECTING: number;
|
|
1840
1856
|
static readonly READY_STATE_OPEN: number;
|
|
1841
1857
|
static readonly READY_STATE_CLOSING: number;
|
|
@@ -1851,6 +1867,24 @@ declare const WebSocketPair: {
|
|
|
1851
1867
|
1: WebSocket;
|
|
1852
1868
|
};
|
|
1853
1869
|
};
|
|
1870
|
+
declare interface Socket {
|
|
1871
|
+
get readable(): ReadableStream;
|
|
1872
|
+
get writable(): WritableStream;
|
|
1873
|
+
get closed(): Promise<void>;
|
|
1874
|
+
close(): Promise<void>;
|
|
1875
|
+
startTls(options?: TlsOptions): Socket;
|
|
1876
|
+
}
|
|
1877
|
+
declare interface SocketOptions {
|
|
1878
|
+
secureTransport?: string;
|
|
1879
|
+
allowHalfOpen: boolean;
|
|
1880
|
+
}
|
|
1881
|
+
declare interface SocketAddress {
|
|
1882
|
+
hostname: string;
|
|
1883
|
+
port: number;
|
|
1884
|
+
}
|
|
1885
|
+
declare interface TlsOptions {
|
|
1886
|
+
expectedServerHostname?: string;
|
|
1887
|
+
}
|
|
1854
1888
|
declare interface BasicImageTransformations {
|
|
1855
1889
|
/**
|
|
1856
1890
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2985,12 +3019,49 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2985
3019
|
// Key Identifier of the JWK
|
|
2986
3020
|
readonly kid: string;
|
|
2987
3021
|
}
|
|
3022
|
+
declare module "cloudflare:sockets" {
|
|
3023
|
+
function _connect(
|
|
3024
|
+
address: string | SocketAddress,
|
|
3025
|
+
options?: SocketOptions
|
|
3026
|
+
): Socket;
|
|
3027
|
+
export { _connect as connect };
|
|
3028
|
+
}
|
|
2988
3029
|
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3030
|
+
declare interface DynamicDispatchLimits {
|
|
3031
|
+
/**
|
|
3032
|
+
* Limit CPU time in milliseconds.
|
|
3033
|
+
*/
|
|
3034
|
+
cpuMs?: number;
|
|
3035
|
+
/**
|
|
3036
|
+
* Limit number of subrequests.
|
|
3037
|
+
*/
|
|
3038
|
+
subRequests?: number;
|
|
3039
|
+
}
|
|
3040
|
+
declare interface DynamicDispatchOptions {
|
|
3041
|
+
/**
|
|
3042
|
+
* Limit resources of invoked Worker script.
|
|
3043
|
+
*/
|
|
3044
|
+
limits?: DynamicDispatchLimits;
|
|
3045
|
+
/**
|
|
3046
|
+
* Arguments for outbound Worker script, if configured.
|
|
3047
|
+
*/
|
|
3048
|
+
outbound?: {
|
|
3049
|
+
[key: string]: any;
|
|
3050
|
+
};
|
|
3051
|
+
}
|
|
2989
3052
|
declare interface DispatchNamespace {
|
|
2990
3053
|
/**
|
|
2991
3054
|
* @param name Name of the Worker script.
|
|
3055
|
+
* @param args Arguments to Worker script.
|
|
3056
|
+
* @param options Options for Dynamic Dispatch invocation.
|
|
2992
3057
|
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
2993
3058
|
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2994
3059
|
*/
|
|
2995
|
-
get(
|
|
3060
|
+
get(
|
|
3061
|
+
name: string,
|
|
3062
|
+
args?: {
|
|
3063
|
+
[key: string]: any;
|
|
3064
|
+
},
|
|
3065
|
+
options?: DynamicDispatchOptions
|
|
3066
|
+
): Fetcher;
|
|
2996
3067
|
}
|
package/2022-08-04/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;
|
|
@@ -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>(
|
|
@@ -459,6 +470,7 @@ export interface DurableObjectStorage {
|
|
|
459
470
|
): Promise<void>;
|
|
460
471
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
461
472
|
sync(): Promise<void>;
|
|
473
|
+
transactionSync<T>(closure: () => T): T;
|
|
462
474
|
}
|
|
463
475
|
export interface DurableObjectListOptions {
|
|
464
476
|
start?: string;
|
|
@@ -568,6 +580,7 @@ export declare class AbortController {
|
|
|
568
580
|
export declare abstract class AbortSignal extends EventTarget {
|
|
569
581
|
static abort(reason?: any): AbortSignal;
|
|
570
582
|
static timeout(delay: number): AbortSignal;
|
|
583
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
571
584
|
get aborted(): boolean;
|
|
572
585
|
get reason(): any;
|
|
573
586
|
throwIfAborted(): void;
|
|
@@ -1054,6 +1067,7 @@ export interface RequestInit<Cf = CfProperties> {
|
|
|
1054
1067
|
}
|
|
1055
1068
|
export declare abstract class Fetcher {
|
|
1056
1069
|
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1070
|
+
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1057
1071
|
}
|
|
1058
1072
|
export interface FetcherPutOptions {
|
|
1059
1073
|
expiration?: number;
|
|
@@ -1841,6 +1855,8 @@ export declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1841
1855
|
accept(): void;
|
|
1842
1856
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1843
1857
|
close(code?: number, reason?: string): void;
|
|
1858
|
+
serializeAttachment(attachment: any): void;
|
|
1859
|
+
deserializeAttachment(): any | null;
|
|
1844
1860
|
static readonly READY_STATE_CONNECTING: number;
|
|
1845
1861
|
static readonly READY_STATE_OPEN: number;
|
|
1846
1862
|
static readonly READY_STATE_CLOSING: number;
|
|
@@ -1856,6 +1872,24 @@ export declare const WebSocketPair: {
|
|
|
1856
1872
|
1: WebSocket;
|
|
1857
1873
|
};
|
|
1858
1874
|
};
|
|
1875
|
+
export interface Socket {
|
|
1876
|
+
get readable(): ReadableStream;
|
|
1877
|
+
get writable(): WritableStream;
|
|
1878
|
+
get closed(): Promise<void>;
|
|
1879
|
+
close(): Promise<void>;
|
|
1880
|
+
startTls(options?: TlsOptions): Socket;
|
|
1881
|
+
}
|
|
1882
|
+
export interface SocketOptions {
|
|
1883
|
+
secureTransport?: string;
|
|
1884
|
+
allowHalfOpen: boolean;
|
|
1885
|
+
}
|
|
1886
|
+
export interface SocketAddress {
|
|
1887
|
+
hostname: string;
|
|
1888
|
+
port: number;
|
|
1889
|
+
}
|
|
1890
|
+
export interface TlsOptions {
|
|
1891
|
+
expectedServerHostname?: string;
|
|
1892
|
+
}
|
|
1859
1893
|
export interface BasicImageTransformations {
|
|
1860
1894
|
/**
|
|
1861
1895
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2981,11 +3015,41 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2981
3015
|
readonly kid: string;
|
|
2982
3016
|
}
|
|
2983
3017
|
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3018
|
+
export interface DynamicDispatchLimits {
|
|
3019
|
+
/**
|
|
3020
|
+
* Limit CPU time in milliseconds.
|
|
3021
|
+
*/
|
|
3022
|
+
cpuMs?: number;
|
|
3023
|
+
/**
|
|
3024
|
+
* Limit number of subrequests.
|
|
3025
|
+
*/
|
|
3026
|
+
subRequests?: number;
|
|
3027
|
+
}
|
|
3028
|
+
export interface DynamicDispatchOptions {
|
|
3029
|
+
/**
|
|
3030
|
+
* Limit resources of invoked Worker script.
|
|
3031
|
+
*/
|
|
3032
|
+
limits?: DynamicDispatchLimits;
|
|
3033
|
+
/**
|
|
3034
|
+
* Arguments for outbound Worker script, if configured.
|
|
3035
|
+
*/
|
|
3036
|
+
outbound?: {
|
|
3037
|
+
[key: string]: any;
|
|
3038
|
+
};
|
|
3039
|
+
}
|
|
2984
3040
|
export interface DispatchNamespace {
|
|
2985
3041
|
/**
|
|
2986
3042
|
* @param name Name of the Worker script.
|
|
3043
|
+
* @param args Arguments to Worker script.
|
|
3044
|
+
* @param options Options for Dynamic Dispatch invocation.
|
|
2987
3045
|
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
2988
3046
|
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2989
3047
|
*/
|
|
2990
|
-
get(
|
|
3048
|
+
get(
|
|
3049
|
+
name: string,
|
|
3050
|
+
args?: {
|
|
3051
|
+
[key: string]: any;
|
|
3052
|
+
},
|
|
3053
|
+
options?: DynamicDispatchOptions
|
|
3054
|
+
): Fetcher;
|
|
2991
3055
|
}
|