@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/2021-11-03/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>(
|
|
@@ -451,6 +462,7 @@ declare interface DurableObjectStorage {
|
|
|
451
462
|
): Promise<void>;
|
|
452
463
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
453
464
|
sync(): Promise<void>;
|
|
465
|
+
transactionSync<T>(closure: () => T): T;
|
|
454
466
|
}
|
|
455
467
|
declare interface DurableObjectListOptions {
|
|
456
468
|
start?: string;
|
|
@@ -571,6 +583,7 @@ declare class AbortController {
|
|
|
571
583
|
declare abstract class AbortSignal extends EventTarget {
|
|
572
584
|
static abort(reason?: any): AbortSignal;
|
|
573
585
|
static timeout(delay: number): AbortSignal;
|
|
586
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
574
587
|
/** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */
|
|
575
588
|
readonly aborted: boolean;
|
|
576
589
|
readonly reason: any;
|
|
@@ -1066,6 +1079,7 @@ declare interface RequestInit<Cf = CfProperties> {
|
|
|
1066
1079
|
}
|
|
1067
1080
|
declare abstract class Fetcher {
|
|
1068
1081
|
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1082
|
+
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1069
1083
|
}
|
|
1070
1084
|
declare interface FetcherPutOptions {
|
|
1071
1085
|
expiration?: number;
|
|
@@ -1839,6 +1853,8 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1839
1853
|
accept(): void;
|
|
1840
1854
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1841
1855
|
close(code?: number, reason?: string): void;
|
|
1856
|
+
serializeAttachment(attachment: any): void;
|
|
1857
|
+
deserializeAttachment(): any | null;
|
|
1842
1858
|
static readonly READY_STATE_CONNECTING: number;
|
|
1843
1859
|
static readonly READY_STATE_OPEN: number;
|
|
1844
1860
|
static readonly READY_STATE_CLOSING: number;
|
|
@@ -1858,6 +1874,24 @@ declare const WebSocketPair: {
|
|
|
1858
1874
|
1: WebSocket;
|
|
1859
1875
|
};
|
|
1860
1876
|
};
|
|
1877
|
+
declare interface Socket {
|
|
1878
|
+
get readable(): ReadableStream;
|
|
1879
|
+
get writable(): WritableStream;
|
|
1880
|
+
get closed(): Promise<void>;
|
|
1881
|
+
close(): Promise<void>;
|
|
1882
|
+
startTls(options?: TlsOptions): Socket;
|
|
1883
|
+
}
|
|
1884
|
+
declare interface SocketOptions {
|
|
1885
|
+
secureTransport?: string;
|
|
1886
|
+
allowHalfOpen: boolean;
|
|
1887
|
+
}
|
|
1888
|
+
declare interface SocketAddress {
|
|
1889
|
+
hostname: string;
|
|
1890
|
+
port: number;
|
|
1891
|
+
}
|
|
1892
|
+
declare interface TlsOptions {
|
|
1893
|
+
expectedServerHostname?: string;
|
|
1894
|
+
}
|
|
1861
1895
|
declare interface BasicImageTransformations {
|
|
1862
1896
|
/**
|
|
1863
1897
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2992,12 +3026,49 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2992
3026
|
// Key Identifier of the JWK
|
|
2993
3027
|
readonly kid: string;
|
|
2994
3028
|
}
|
|
3029
|
+
declare module "cloudflare:sockets" {
|
|
3030
|
+
function _connect(
|
|
3031
|
+
address: string | SocketAddress,
|
|
3032
|
+
options?: SocketOptions
|
|
3033
|
+
): Socket;
|
|
3034
|
+
export { _connect as connect };
|
|
3035
|
+
}
|
|
2995
3036
|
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3037
|
+
declare interface DynamicDispatchLimits {
|
|
3038
|
+
/**
|
|
3039
|
+
* Limit CPU time in milliseconds.
|
|
3040
|
+
*/
|
|
3041
|
+
cpuMs?: number;
|
|
3042
|
+
/**
|
|
3043
|
+
* Limit number of subrequests.
|
|
3044
|
+
*/
|
|
3045
|
+
subRequests?: number;
|
|
3046
|
+
}
|
|
3047
|
+
declare interface DynamicDispatchOptions {
|
|
3048
|
+
/**
|
|
3049
|
+
* Limit resources of invoked Worker script.
|
|
3050
|
+
*/
|
|
3051
|
+
limits?: DynamicDispatchLimits;
|
|
3052
|
+
/**
|
|
3053
|
+
* Arguments for outbound Worker script, if configured.
|
|
3054
|
+
*/
|
|
3055
|
+
outbound?: {
|
|
3056
|
+
[key: string]: any;
|
|
3057
|
+
};
|
|
3058
|
+
}
|
|
2996
3059
|
declare interface DispatchNamespace {
|
|
2997
3060
|
/**
|
|
2998
3061
|
* @param name Name of the Worker script.
|
|
3062
|
+
* @param args Arguments to Worker script.
|
|
3063
|
+
* @param options Options for Dynamic Dispatch invocation.
|
|
2999
3064
|
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
3000
3065
|
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
3001
3066
|
*/
|
|
3002
|
-
get(
|
|
3067
|
+
get(
|
|
3068
|
+
name: string,
|
|
3069
|
+
args?: {
|
|
3070
|
+
[key: string]: any;
|
|
3071
|
+
},
|
|
3072
|
+
options?: DynamicDispatchOptions
|
|
3073
|
+
): Fetcher;
|
|
3003
3074
|
}
|
package/2021-11-03/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>(
|
|
@@ -453,6 +464,7 @@ export interface DurableObjectStorage {
|
|
|
453
464
|
): Promise<void>;
|
|
454
465
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
455
466
|
sync(): Promise<void>;
|
|
467
|
+
transactionSync<T>(closure: () => T): T;
|
|
456
468
|
}
|
|
457
469
|
export interface DurableObjectListOptions {
|
|
458
470
|
start?: string;
|
|
@@ -573,6 +585,7 @@ export declare class AbortController {
|
|
|
573
585
|
export declare abstract class AbortSignal extends EventTarget {
|
|
574
586
|
static abort(reason?: any): AbortSignal;
|
|
575
587
|
static timeout(delay: number): AbortSignal;
|
|
588
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
576
589
|
/** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */
|
|
577
590
|
readonly aborted: boolean;
|
|
578
591
|
readonly reason: any;
|
|
@@ -1068,6 +1081,7 @@ export interface RequestInit<Cf = CfProperties> {
|
|
|
1068
1081
|
}
|
|
1069
1082
|
export declare abstract class Fetcher {
|
|
1070
1083
|
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1084
|
+
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1071
1085
|
}
|
|
1072
1086
|
export interface FetcherPutOptions {
|
|
1073
1087
|
expiration?: number;
|
|
@@ -1844,6 +1858,8 @@ export declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1844
1858
|
accept(): void;
|
|
1845
1859
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1846
1860
|
close(code?: number, reason?: string): void;
|
|
1861
|
+
serializeAttachment(attachment: any): void;
|
|
1862
|
+
deserializeAttachment(): any | null;
|
|
1847
1863
|
static readonly READY_STATE_CONNECTING: number;
|
|
1848
1864
|
static readonly READY_STATE_OPEN: number;
|
|
1849
1865
|
static readonly READY_STATE_CLOSING: number;
|
|
@@ -1863,6 +1879,24 @@ export declare const WebSocketPair: {
|
|
|
1863
1879
|
1: WebSocket;
|
|
1864
1880
|
};
|
|
1865
1881
|
};
|
|
1882
|
+
export interface Socket {
|
|
1883
|
+
get readable(): ReadableStream;
|
|
1884
|
+
get writable(): WritableStream;
|
|
1885
|
+
get closed(): Promise<void>;
|
|
1886
|
+
close(): Promise<void>;
|
|
1887
|
+
startTls(options?: TlsOptions): Socket;
|
|
1888
|
+
}
|
|
1889
|
+
export interface SocketOptions {
|
|
1890
|
+
secureTransport?: string;
|
|
1891
|
+
allowHalfOpen: boolean;
|
|
1892
|
+
}
|
|
1893
|
+
export interface SocketAddress {
|
|
1894
|
+
hostname: string;
|
|
1895
|
+
port: number;
|
|
1896
|
+
}
|
|
1897
|
+
export interface TlsOptions {
|
|
1898
|
+
expectedServerHostname?: string;
|
|
1899
|
+
}
|
|
1866
1900
|
export interface BasicImageTransformations {
|
|
1867
1901
|
/**
|
|
1868
1902
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2988,11 +3022,41 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2988
3022
|
readonly kid: string;
|
|
2989
3023
|
}
|
|
2990
3024
|
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3025
|
+
export interface DynamicDispatchLimits {
|
|
3026
|
+
/**
|
|
3027
|
+
* Limit CPU time in milliseconds.
|
|
3028
|
+
*/
|
|
3029
|
+
cpuMs?: number;
|
|
3030
|
+
/**
|
|
3031
|
+
* Limit number of subrequests.
|
|
3032
|
+
*/
|
|
3033
|
+
subRequests?: number;
|
|
3034
|
+
}
|
|
3035
|
+
export interface DynamicDispatchOptions {
|
|
3036
|
+
/**
|
|
3037
|
+
* Limit resources of invoked Worker script.
|
|
3038
|
+
*/
|
|
3039
|
+
limits?: DynamicDispatchLimits;
|
|
3040
|
+
/**
|
|
3041
|
+
* Arguments for outbound Worker script, if configured.
|
|
3042
|
+
*/
|
|
3043
|
+
outbound?: {
|
|
3044
|
+
[key: string]: any;
|
|
3045
|
+
};
|
|
3046
|
+
}
|
|
2991
3047
|
export interface DispatchNamespace {
|
|
2992
3048
|
/**
|
|
2993
3049
|
* @param name Name of the Worker script.
|
|
3050
|
+
* @param args Arguments to Worker script.
|
|
3051
|
+
* @param options Options for Dynamic Dispatch invocation.
|
|
2994
3052
|
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
2995
3053
|
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2996
3054
|
*/
|
|
2997
|
-
get(
|
|
3055
|
+
get(
|
|
3056
|
+
name: string,
|
|
3057
|
+
args?: {
|
|
3058
|
+
[key: string]: any;
|
|
3059
|
+
},
|
|
3060
|
+
options?: DynamicDispatchOptions
|
|
3061
|
+
): Fetcher;
|
|
2998
3062
|
}
|
package/2022-01-31/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>(
|
|
@@ -451,6 +462,7 @@ declare interface DurableObjectStorage {
|
|
|
451
462
|
): Promise<void>;
|
|
452
463
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
453
464
|
sync(): Promise<void>;
|
|
465
|
+
transactionSync<T>(closure: () => T): T;
|
|
454
466
|
}
|
|
455
467
|
declare interface DurableObjectListOptions {
|
|
456
468
|
start?: string;
|
|
@@ -560,6 +572,7 @@ declare class AbortController {
|
|
|
560
572
|
declare abstract class AbortSignal extends EventTarget {
|
|
561
573
|
static abort(reason?: any): AbortSignal;
|
|
562
574
|
static timeout(delay: number): AbortSignal;
|
|
575
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
563
576
|
get aborted(): boolean;
|
|
564
577
|
get reason(): any;
|
|
565
578
|
throwIfAborted(): void;
|
|
@@ -1046,6 +1059,7 @@ declare interface RequestInit<Cf = CfProperties> {
|
|
|
1046
1059
|
}
|
|
1047
1060
|
declare abstract class Fetcher {
|
|
1048
1061
|
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1062
|
+
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1049
1063
|
}
|
|
1050
1064
|
declare interface FetcherPutOptions {
|
|
1051
1065
|
expiration?: number;
|
|
@@ -1829,6 +1843,8 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1829
1843
|
accept(): void;
|
|
1830
1844
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1831
1845
|
close(code?: number, reason?: string): void;
|
|
1846
|
+
serializeAttachment(attachment: any): void;
|
|
1847
|
+
deserializeAttachment(): any | null;
|
|
1832
1848
|
static readonly READY_STATE_CONNECTING: number;
|
|
1833
1849
|
static readonly READY_STATE_OPEN: number;
|
|
1834
1850
|
static readonly READY_STATE_CLOSING: number;
|
|
@@ -1844,6 +1860,24 @@ declare const WebSocketPair: {
|
|
|
1844
1860
|
1: WebSocket;
|
|
1845
1861
|
};
|
|
1846
1862
|
};
|
|
1863
|
+
declare interface Socket {
|
|
1864
|
+
get readable(): ReadableStream;
|
|
1865
|
+
get writable(): WritableStream;
|
|
1866
|
+
get closed(): Promise<void>;
|
|
1867
|
+
close(): Promise<void>;
|
|
1868
|
+
startTls(options?: TlsOptions): Socket;
|
|
1869
|
+
}
|
|
1870
|
+
declare interface SocketOptions {
|
|
1871
|
+
secureTransport?: string;
|
|
1872
|
+
allowHalfOpen: boolean;
|
|
1873
|
+
}
|
|
1874
|
+
declare interface SocketAddress {
|
|
1875
|
+
hostname: string;
|
|
1876
|
+
port: number;
|
|
1877
|
+
}
|
|
1878
|
+
declare interface TlsOptions {
|
|
1879
|
+
expectedServerHostname?: string;
|
|
1880
|
+
}
|
|
1847
1881
|
declare interface BasicImageTransformations {
|
|
1848
1882
|
/**
|
|
1849
1883
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2978,12 +3012,49 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2978
3012
|
// Key Identifier of the JWK
|
|
2979
3013
|
readonly kid: string;
|
|
2980
3014
|
}
|
|
3015
|
+
declare module "cloudflare:sockets" {
|
|
3016
|
+
function _connect(
|
|
3017
|
+
address: string | SocketAddress,
|
|
3018
|
+
options?: SocketOptions
|
|
3019
|
+
): Socket;
|
|
3020
|
+
export { _connect as connect };
|
|
3021
|
+
}
|
|
2981
3022
|
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3023
|
+
declare interface DynamicDispatchLimits {
|
|
3024
|
+
/**
|
|
3025
|
+
* Limit CPU time in milliseconds.
|
|
3026
|
+
*/
|
|
3027
|
+
cpuMs?: number;
|
|
3028
|
+
/**
|
|
3029
|
+
* Limit number of subrequests.
|
|
3030
|
+
*/
|
|
3031
|
+
subRequests?: number;
|
|
3032
|
+
}
|
|
3033
|
+
declare interface DynamicDispatchOptions {
|
|
3034
|
+
/**
|
|
3035
|
+
* Limit resources of invoked Worker script.
|
|
3036
|
+
*/
|
|
3037
|
+
limits?: DynamicDispatchLimits;
|
|
3038
|
+
/**
|
|
3039
|
+
* Arguments for outbound Worker script, if configured.
|
|
3040
|
+
*/
|
|
3041
|
+
outbound?: {
|
|
3042
|
+
[key: string]: any;
|
|
3043
|
+
};
|
|
3044
|
+
}
|
|
2982
3045
|
declare interface DispatchNamespace {
|
|
2983
3046
|
/**
|
|
2984
3047
|
* @param name Name of the Worker script.
|
|
3048
|
+
* @param args Arguments to Worker script.
|
|
3049
|
+
* @param options Options for Dynamic Dispatch invocation.
|
|
2985
3050
|
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
2986
3051
|
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2987
3052
|
*/
|
|
2988
|
-
get(
|
|
3053
|
+
get(
|
|
3054
|
+
name: string,
|
|
3055
|
+
args?: {
|
|
3056
|
+
[key: string]: any;
|
|
3057
|
+
},
|
|
3058
|
+
options?: DynamicDispatchOptions
|
|
3059
|
+
): Fetcher;
|
|
2989
3060
|
}
|
package/2022-01-31/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>(
|
|
@@ -453,6 +464,7 @@ export interface DurableObjectStorage {
|
|
|
453
464
|
): Promise<void>;
|
|
454
465
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
455
466
|
sync(): Promise<void>;
|
|
467
|
+
transactionSync<T>(closure: () => T): T;
|
|
456
468
|
}
|
|
457
469
|
export interface DurableObjectListOptions {
|
|
458
470
|
start?: string;
|
|
@@ -562,6 +574,7 @@ export declare class AbortController {
|
|
|
562
574
|
export declare abstract class AbortSignal extends EventTarget {
|
|
563
575
|
static abort(reason?: any): AbortSignal;
|
|
564
576
|
static timeout(delay: number): AbortSignal;
|
|
577
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
565
578
|
get aborted(): boolean;
|
|
566
579
|
get reason(): any;
|
|
567
580
|
throwIfAborted(): void;
|
|
@@ -1048,6 +1061,7 @@ export interface RequestInit<Cf = CfProperties> {
|
|
|
1048
1061
|
}
|
|
1049
1062
|
export declare abstract class Fetcher {
|
|
1050
1063
|
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1064
|
+
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1051
1065
|
}
|
|
1052
1066
|
export interface FetcherPutOptions {
|
|
1053
1067
|
expiration?: number;
|
|
@@ -1834,6 +1848,8 @@ export declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1834
1848
|
accept(): void;
|
|
1835
1849
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1836
1850
|
close(code?: number, reason?: string): void;
|
|
1851
|
+
serializeAttachment(attachment: any): void;
|
|
1852
|
+
deserializeAttachment(): any | null;
|
|
1837
1853
|
static readonly READY_STATE_CONNECTING: number;
|
|
1838
1854
|
static readonly READY_STATE_OPEN: number;
|
|
1839
1855
|
static readonly READY_STATE_CLOSING: number;
|
|
@@ -1849,6 +1865,24 @@ export declare const WebSocketPair: {
|
|
|
1849
1865
|
1: WebSocket;
|
|
1850
1866
|
};
|
|
1851
1867
|
};
|
|
1868
|
+
export interface Socket {
|
|
1869
|
+
get readable(): ReadableStream;
|
|
1870
|
+
get writable(): WritableStream;
|
|
1871
|
+
get closed(): Promise<void>;
|
|
1872
|
+
close(): Promise<void>;
|
|
1873
|
+
startTls(options?: TlsOptions): Socket;
|
|
1874
|
+
}
|
|
1875
|
+
export interface SocketOptions {
|
|
1876
|
+
secureTransport?: string;
|
|
1877
|
+
allowHalfOpen: boolean;
|
|
1878
|
+
}
|
|
1879
|
+
export interface SocketAddress {
|
|
1880
|
+
hostname: string;
|
|
1881
|
+
port: number;
|
|
1882
|
+
}
|
|
1883
|
+
export interface TlsOptions {
|
|
1884
|
+
expectedServerHostname?: string;
|
|
1885
|
+
}
|
|
1852
1886
|
export interface BasicImageTransformations {
|
|
1853
1887
|
/**
|
|
1854
1888
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2974,11 +3008,41 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2974
3008
|
readonly kid: string;
|
|
2975
3009
|
}
|
|
2976
3010
|
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3011
|
+
export interface DynamicDispatchLimits {
|
|
3012
|
+
/**
|
|
3013
|
+
* Limit CPU time in milliseconds.
|
|
3014
|
+
*/
|
|
3015
|
+
cpuMs?: number;
|
|
3016
|
+
/**
|
|
3017
|
+
* Limit number of subrequests.
|
|
3018
|
+
*/
|
|
3019
|
+
subRequests?: number;
|
|
3020
|
+
}
|
|
3021
|
+
export interface DynamicDispatchOptions {
|
|
3022
|
+
/**
|
|
3023
|
+
* Limit resources of invoked Worker script.
|
|
3024
|
+
*/
|
|
3025
|
+
limits?: DynamicDispatchLimits;
|
|
3026
|
+
/**
|
|
3027
|
+
* Arguments for outbound Worker script, if configured.
|
|
3028
|
+
*/
|
|
3029
|
+
outbound?: {
|
|
3030
|
+
[key: string]: any;
|
|
3031
|
+
};
|
|
3032
|
+
}
|
|
2977
3033
|
export interface DispatchNamespace {
|
|
2978
3034
|
/**
|
|
2979
3035
|
* @param name Name of the Worker script.
|
|
3036
|
+
* @param args Arguments to Worker script.
|
|
3037
|
+
* @param options Options for Dynamic Dispatch invocation.
|
|
2980
3038
|
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
2981
3039
|
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2982
3040
|
*/
|
|
2983
|
-
get(
|
|
3041
|
+
get(
|
|
3042
|
+
name: string,
|
|
3043
|
+
args?: {
|
|
3044
|
+
[key: string]: any;
|
|
3045
|
+
},
|
|
3046
|
+
options?: DynamicDispatchOptions
|
|
3047
|
+
): Fetcher;
|
|
2984
3048
|
}
|