@cloudflare/workers-types 4.20230404.0 → 4.20230511.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 +79 -74
- package/2021-11-03/index.ts +79 -74
- package/2022-01-31/index.d.ts +79 -74
- package/2022-01-31/index.ts +79 -74
- package/2022-03-21/index.d.ts +79 -74
- package/2022-03-21/index.ts +79 -74
- package/2022-08-04/index.d.ts +79 -74
- package/2022-08-04/index.ts +79 -74
- package/2022-10-31/index.d.ts +79 -74
- package/2022-10-31/index.ts +79 -74
- package/2022-11-30/index.d.ts +79 -74
- package/2022-11-30/index.ts +79 -74
- package/experimental/index.d.ts +117 -74
- package/experimental/index.ts +117 -74
- package/index.d.ts +79 -74
- package/index.ts +79 -74
- package/oldest/index.d.ts +79 -74
- package/oldest/index.ts +79 -74
- package/package.json +1 -1
package/2022-01-31/index.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ declare class DOMException extends Error {
|
|
|
49
49
|
declare type WorkerGlobalScopeEventMap = {
|
|
50
50
|
fetch: FetchEvent;
|
|
51
51
|
scheduled: ScheduledEvent;
|
|
52
|
+
queue: QueueEvent;
|
|
52
53
|
unhandledrejection: PromiseRejectionEvent;
|
|
53
54
|
rejectionhandled: PromiseRejectionEvent;
|
|
54
55
|
};
|
|
@@ -183,11 +184,14 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
183
184
|
crypto: Crypto;
|
|
184
185
|
caches: CacheStorage;
|
|
185
186
|
scheduler: Scheduler;
|
|
187
|
+
performance: Performance;
|
|
188
|
+
readonly origin: string;
|
|
186
189
|
Event: typeof Event;
|
|
187
190
|
ExtendableEvent: typeof ExtendableEvent;
|
|
188
191
|
PromiseRejectionEvent: typeof PromiseRejectionEvent;
|
|
189
192
|
FetchEvent: typeof FetchEvent;
|
|
190
|
-
|
|
193
|
+
TailEvent: typeof TailEvent;
|
|
194
|
+
TraceEvent: typeof TailEvent;
|
|
191
195
|
ScheduledEvent: typeof ScheduledEvent;
|
|
192
196
|
MessageEvent: typeof MessageEvent;
|
|
193
197
|
CloseEvent: typeof CloseEvent;
|
|
@@ -279,6 +283,8 @@ declare const self: ServiceWorkerGlobalScope;
|
|
|
279
283
|
declare const crypto: Crypto;
|
|
280
284
|
declare const caches: CacheStorage;
|
|
281
285
|
declare const scheduler: Scheduler;
|
|
286
|
+
declare const performance: Performance;
|
|
287
|
+
declare const origin: string;
|
|
282
288
|
declare interface TestController {}
|
|
283
289
|
declare interface ExecutionContext {
|
|
284
290
|
waitUntil(promise: Promise<any>): void;
|
|
@@ -292,6 +298,11 @@ declare type ExportedHandlerFetchHandler<
|
|
|
292
298
|
env: Env,
|
|
293
299
|
ctx: ExecutionContext
|
|
294
300
|
) => Response | Promise<Response>;
|
|
301
|
+
declare type ExportedHandlerTailHandler<Env = unknown> = (
|
|
302
|
+
events: TraceItem[],
|
|
303
|
+
env: Env,
|
|
304
|
+
ctx: ExecutionContext
|
|
305
|
+
) => void | Promise<void>;
|
|
295
306
|
declare type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
296
307
|
traces: TraceItem[],
|
|
297
308
|
env: Env,
|
|
@@ -318,10 +329,11 @@ declare interface ExportedHandler<
|
|
|
318
329
|
CfHostMetadata = unknown
|
|
319
330
|
> {
|
|
320
331
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
332
|
+
tail?: ExportedHandlerTailHandler<Env>;
|
|
321
333
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
322
334
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
323
335
|
test?: ExportedHandlerTestHandler<Env>;
|
|
324
|
-
queue?: ExportedHandlerQueueHandler<Env,
|
|
336
|
+
queue?: ExportedHandlerQueueHandler<Env, Message>;
|
|
325
337
|
}
|
|
326
338
|
declare interface StructuredSerializeOptions {
|
|
327
339
|
transfer?: any[];
|
|
@@ -330,6 +342,11 @@ declare abstract class PromiseRejectionEvent extends Event {
|
|
|
330
342
|
readonly promise: Promise<any>;
|
|
331
343
|
readonly reason: any;
|
|
332
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
|
+
}
|
|
333
350
|
declare interface DurableObject {
|
|
334
351
|
fetch(request: Request): Response | Promise<Response>;
|
|
335
352
|
alarm?(): void | Promise<void>;
|
|
@@ -377,6 +394,8 @@ declare interface DurableObjectState {
|
|
|
377
394
|
readonly id: DurableObjectId;
|
|
378
395
|
readonly storage: DurableObjectStorage;
|
|
379
396
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
397
|
+
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
398
|
+
getWebSockets(tag?: string): WebSocket[];
|
|
380
399
|
}
|
|
381
400
|
declare interface DurableObjectTransaction {
|
|
382
401
|
get<T = unknown>(
|
|
@@ -552,6 +571,7 @@ declare class AbortController {
|
|
|
552
571
|
declare abstract class AbortSignal extends EventTarget {
|
|
553
572
|
static abort(reason?: any): AbortSignal;
|
|
554
573
|
static timeout(delay: number): AbortSignal;
|
|
574
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
555
575
|
get aborted(): boolean;
|
|
556
576
|
get reason(): any;
|
|
557
577
|
throwIfAborted(): void;
|
|
@@ -1038,6 +1058,7 @@ declare interface RequestInit<Cf = CfProperties> {
|
|
|
1038
1058
|
}
|
|
1039
1059
|
declare abstract class Fetcher {
|
|
1040
1060
|
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1061
|
+
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1041
1062
|
}
|
|
1042
1063
|
declare interface FetcherPutOptions {
|
|
1043
1064
|
expiration?: number;
|
|
@@ -1150,6 +1171,33 @@ declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1150
1171
|
value: Value | null;
|
|
1151
1172
|
metadata: Metadata | null;
|
|
1152
1173
|
}
|
|
1174
|
+
declare interface Queue<Body> {
|
|
1175
|
+
send(message: Body): Promise<void>;
|
|
1176
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1177
|
+
}
|
|
1178
|
+
declare interface QueueSendOptions {}
|
|
1179
|
+
declare interface MessageSendRequest<Body = unknown> {
|
|
1180
|
+
body: Body;
|
|
1181
|
+
}
|
|
1182
|
+
declare interface Message<Body = unknown> {
|
|
1183
|
+
readonly id: string;
|
|
1184
|
+
readonly timestamp: Date;
|
|
1185
|
+
readonly body: Body;
|
|
1186
|
+
retry(): void;
|
|
1187
|
+
ack(): void;
|
|
1188
|
+
}
|
|
1189
|
+
declare interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1190
|
+
readonly messages: readonly Message<Body>[];
|
|
1191
|
+
readonly queue: string;
|
|
1192
|
+
retryAll(): void;
|
|
1193
|
+
ackAll(): void;
|
|
1194
|
+
}
|
|
1195
|
+
declare interface MessageBatch<Body = unknown> {
|
|
1196
|
+
readonly messages: readonly Message<Body>[];
|
|
1197
|
+
readonly queue: string;
|
|
1198
|
+
retryAll(): void;
|
|
1199
|
+
ackAll(): void;
|
|
1200
|
+
}
|
|
1153
1201
|
declare interface R2Error extends Error {
|
|
1154
1202
|
readonly name: string;
|
|
1155
1203
|
readonly code: number;
|
|
@@ -1583,7 +1631,8 @@ declare interface QueuingStrategyInit {
|
|
|
1583
1631
|
*/
|
|
1584
1632
|
highWaterMark: number;
|
|
1585
1633
|
}
|
|
1586
|
-
declare abstract class
|
|
1634
|
+
declare abstract class TailEvent extends ExtendableEvent {
|
|
1635
|
+
readonly events: TraceItem[];
|
|
1587
1636
|
readonly traces: TraceItem[];
|
|
1588
1637
|
}
|
|
1589
1638
|
declare interface TraceItem {
|
|
@@ -1793,6 +1842,8 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1793
1842
|
accept(): void;
|
|
1794
1843
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1795
1844
|
close(code?: number, reason?: string): void;
|
|
1845
|
+
serializeAttachment(attachment: any): void;
|
|
1846
|
+
deserializeAttachment(): any | null;
|
|
1796
1847
|
static readonly READY_STATE_CONNECTING: number;
|
|
1797
1848
|
static readonly READY_STATE_OPEN: number;
|
|
1798
1849
|
static readonly READY_STATE_CLOSING: number;
|
|
@@ -1808,6 +1859,24 @@ declare const WebSocketPair: {
|
|
|
1808
1859
|
1: WebSocket;
|
|
1809
1860
|
};
|
|
1810
1861
|
};
|
|
1862
|
+
declare interface Socket {
|
|
1863
|
+
get readable(): ReadableStream;
|
|
1864
|
+
get writable(): WritableStream;
|
|
1865
|
+
get closed(): Promise<void>;
|
|
1866
|
+
close(): Promise<void>;
|
|
1867
|
+
startTls(options?: TlsOptions): Socket;
|
|
1868
|
+
}
|
|
1869
|
+
declare interface SocketOptions {
|
|
1870
|
+
secureTransport?: string;
|
|
1871
|
+
allowHalfOpen: boolean;
|
|
1872
|
+
}
|
|
1873
|
+
declare interface SocketAddress {
|
|
1874
|
+
hostname: string;
|
|
1875
|
+
port: number;
|
|
1876
|
+
}
|
|
1877
|
+
declare interface TlsOptions {
|
|
1878
|
+
expectedServerHostname?: string;
|
|
1879
|
+
}
|
|
1811
1880
|
declare interface BasicImageTransformations {
|
|
1812
1881
|
/**
|
|
1813
1882
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2197,8 +2266,7 @@ declare interface IncomingRequestCfPropertiesBase
|
|
|
2197
2266
|
declare interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2198
2267
|
/**
|
|
2199
2268
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2200
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2201
|
-
* and `99` (almost certainly a bot).
|
|
2269
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2202
2270
|
*
|
|
2203
2271
|
* @example 54
|
|
2204
2272
|
*/
|
|
@@ -2943,75 +3011,12 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2943
3011
|
// Key Identifier of the JWK
|
|
2944
3012
|
readonly kid: string;
|
|
2945
3013
|
}
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
*/
|
|
2949
|
-
declare interface Message<Body = unknown> {
|
|
2950
|
-
/**
|
|
2951
|
-
* A unique, system-generated ID for the message.
|
|
2952
|
-
*/
|
|
2953
|
-
readonly id: string;
|
|
2954
|
-
/**
|
|
2955
|
-
* A timestamp when the message was sent.
|
|
2956
|
-
*/
|
|
2957
|
-
readonly timestamp: Date;
|
|
2958
|
-
/**
|
|
2959
|
-
* The body of the message.
|
|
2960
|
-
*/
|
|
2961
|
-
readonly body: Body;
|
|
2962
|
-
/**
|
|
2963
|
-
* Marks message to be retried.
|
|
2964
|
-
*/
|
|
2965
|
-
retry(): void;
|
|
2966
|
-
/**
|
|
2967
|
-
* Marks message acknowledged.
|
|
2968
|
-
*/
|
|
2969
|
-
ack(): void;
|
|
2970
|
-
}
|
|
2971
|
-
/**
|
|
2972
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2973
|
-
*/
|
|
2974
|
-
declare interface MessageBatch<Body = unknown> {
|
|
2975
|
-
/**
|
|
2976
|
-
* The name of the Queue that belongs to this batch.
|
|
2977
|
-
*/
|
|
2978
|
-
readonly queue: string;
|
|
2979
|
-
/**
|
|
2980
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2981
|
-
*/
|
|
2982
|
-
readonly messages: readonly Message<Body>[];
|
|
2983
|
-
/**
|
|
2984
|
-
* Marks every message to be retried in the next batch.
|
|
2985
|
-
*/
|
|
2986
|
-
retryAll(): void;
|
|
2987
|
-
/**
|
|
2988
|
-
* Marks every message acknowledged in the batch.
|
|
2989
|
-
*/
|
|
2990
|
-
ackAll(): void;
|
|
2991
|
-
}
|
|
2992
|
-
/**
|
|
2993
|
-
* A wrapper class used to structure message batches.
|
|
2994
|
-
*/
|
|
2995
|
-
declare type MessageSendRequest<Body = unknown> = {
|
|
3014
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3015
|
+
declare interface DispatchNamespace {
|
|
2996
3016
|
/**
|
|
2997
|
-
*
|
|
3017
|
+
* @param name Name of the Worker script.
|
|
3018
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
3019
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2998
3020
|
*/
|
|
2999
|
-
|
|
3000
|
-
};
|
|
3001
|
-
/**
|
|
3002
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
3003
|
-
*/
|
|
3004
|
-
declare interface Queue<Body = any> {
|
|
3005
|
-
/**
|
|
3006
|
-
* Sends a message to the Queue.
|
|
3007
|
-
* @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB.
|
|
3008
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
3009
|
-
*/
|
|
3010
|
-
send(message: Body): Promise<void>;
|
|
3011
|
-
/**
|
|
3012
|
-
* Sends a batch of messages to the Queue.
|
|
3013
|
-
* @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB.
|
|
3014
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
3015
|
-
*/
|
|
3016
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
3021
|
+
get(name: string): Fetcher;
|
|
3017
3022
|
}
|
package/2022-01-31/index.ts
CHANGED
|
@@ -49,6 +49,7 @@ export declare class DOMException extends Error {
|
|
|
49
49
|
export type WorkerGlobalScopeEventMap = {
|
|
50
50
|
fetch: FetchEvent;
|
|
51
51
|
scheduled: ScheduledEvent;
|
|
52
|
+
queue: QueueEvent;
|
|
52
53
|
unhandledrejection: PromiseRejectionEvent;
|
|
53
54
|
rejectionhandled: PromiseRejectionEvent;
|
|
54
55
|
};
|
|
@@ -183,11 +184,14 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
183
184
|
crypto: Crypto;
|
|
184
185
|
caches: CacheStorage;
|
|
185
186
|
scheduler: Scheduler;
|
|
187
|
+
performance: Performance;
|
|
188
|
+
readonly origin: string;
|
|
186
189
|
Event: typeof Event;
|
|
187
190
|
ExtendableEvent: typeof ExtendableEvent;
|
|
188
191
|
PromiseRejectionEvent: typeof PromiseRejectionEvent;
|
|
189
192
|
FetchEvent: typeof FetchEvent;
|
|
190
|
-
|
|
193
|
+
TailEvent: typeof TailEvent;
|
|
194
|
+
TraceEvent: typeof TailEvent;
|
|
191
195
|
ScheduledEvent: typeof ScheduledEvent;
|
|
192
196
|
MessageEvent: typeof MessageEvent;
|
|
193
197
|
CloseEvent: typeof CloseEvent;
|
|
@@ -281,6 +285,8 @@ export declare const self: ServiceWorkerGlobalScope;
|
|
|
281
285
|
export declare const crypto: Crypto;
|
|
282
286
|
export declare const caches: CacheStorage;
|
|
283
287
|
export declare const scheduler: Scheduler;
|
|
288
|
+
export declare const performance: Performance;
|
|
289
|
+
export declare const origin: string;
|
|
284
290
|
export interface TestController {}
|
|
285
291
|
export interface ExecutionContext {
|
|
286
292
|
waitUntil(promise: Promise<any>): void;
|
|
@@ -294,6 +300,11 @@ export type ExportedHandlerFetchHandler<
|
|
|
294
300
|
env: Env,
|
|
295
301
|
ctx: ExecutionContext
|
|
296
302
|
) => Response | Promise<Response>;
|
|
303
|
+
export type ExportedHandlerTailHandler<Env = unknown> = (
|
|
304
|
+
events: TraceItem[],
|
|
305
|
+
env: Env,
|
|
306
|
+
ctx: ExecutionContext
|
|
307
|
+
) => void | Promise<void>;
|
|
297
308
|
export type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
298
309
|
traces: TraceItem[],
|
|
299
310
|
env: Env,
|
|
@@ -320,10 +331,11 @@ export interface ExportedHandler<
|
|
|
320
331
|
CfHostMetadata = unknown
|
|
321
332
|
> {
|
|
322
333
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
334
|
+
tail?: ExportedHandlerTailHandler<Env>;
|
|
323
335
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
324
336
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
325
337
|
test?: ExportedHandlerTestHandler<Env>;
|
|
326
|
-
queue?: ExportedHandlerQueueHandler<Env,
|
|
338
|
+
queue?: ExportedHandlerQueueHandler<Env, Message>;
|
|
327
339
|
}
|
|
328
340
|
export interface StructuredSerializeOptions {
|
|
329
341
|
transfer?: any[];
|
|
@@ -332,6 +344,11 @@ export declare abstract class PromiseRejectionEvent extends Event {
|
|
|
332
344
|
readonly promise: Promise<any>;
|
|
333
345
|
readonly reason: any;
|
|
334
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
|
+
}
|
|
335
352
|
export interface DurableObject {
|
|
336
353
|
fetch(request: Request): Response | Promise<Response>;
|
|
337
354
|
alarm?(): void | Promise<void>;
|
|
@@ -379,6 +396,8 @@ export interface DurableObjectState {
|
|
|
379
396
|
readonly id: DurableObjectId;
|
|
380
397
|
readonly storage: DurableObjectStorage;
|
|
381
398
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
399
|
+
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
400
|
+
getWebSockets(tag?: string): WebSocket[];
|
|
382
401
|
}
|
|
383
402
|
export interface DurableObjectTransaction {
|
|
384
403
|
get<T = unknown>(
|
|
@@ -554,6 +573,7 @@ export declare class AbortController {
|
|
|
554
573
|
export declare abstract class AbortSignal extends EventTarget {
|
|
555
574
|
static abort(reason?: any): AbortSignal;
|
|
556
575
|
static timeout(delay: number): AbortSignal;
|
|
576
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
557
577
|
get aborted(): boolean;
|
|
558
578
|
get reason(): any;
|
|
559
579
|
throwIfAborted(): void;
|
|
@@ -1040,6 +1060,7 @@ export interface RequestInit<Cf = CfProperties> {
|
|
|
1040
1060
|
}
|
|
1041
1061
|
export declare abstract class Fetcher {
|
|
1042
1062
|
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1063
|
+
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1043
1064
|
}
|
|
1044
1065
|
export interface FetcherPutOptions {
|
|
1045
1066
|
expiration?: number;
|
|
@@ -1152,6 +1173,33 @@ export interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1152
1173
|
value: Value | null;
|
|
1153
1174
|
metadata: Metadata | null;
|
|
1154
1175
|
}
|
|
1176
|
+
export interface Queue<Body> {
|
|
1177
|
+
send(message: Body): Promise<void>;
|
|
1178
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1179
|
+
}
|
|
1180
|
+
export interface QueueSendOptions {}
|
|
1181
|
+
export interface MessageSendRequest<Body = unknown> {
|
|
1182
|
+
body: Body;
|
|
1183
|
+
}
|
|
1184
|
+
export interface Message<Body = unknown> {
|
|
1185
|
+
readonly id: string;
|
|
1186
|
+
readonly timestamp: Date;
|
|
1187
|
+
readonly body: Body;
|
|
1188
|
+
retry(): void;
|
|
1189
|
+
ack(): void;
|
|
1190
|
+
}
|
|
1191
|
+
export interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1192
|
+
readonly messages: readonly Message<Body>[];
|
|
1193
|
+
readonly queue: string;
|
|
1194
|
+
retryAll(): void;
|
|
1195
|
+
ackAll(): void;
|
|
1196
|
+
}
|
|
1197
|
+
export interface MessageBatch<Body = unknown> {
|
|
1198
|
+
readonly messages: readonly Message<Body>[];
|
|
1199
|
+
readonly queue: string;
|
|
1200
|
+
retryAll(): void;
|
|
1201
|
+
ackAll(): void;
|
|
1202
|
+
}
|
|
1155
1203
|
export interface R2Error extends Error {
|
|
1156
1204
|
readonly name: string;
|
|
1157
1205
|
readonly code: number;
|
|
@@ -1588,7 +1636,8 @@ export interface QueuingStrategyInit {
|
|
|
1588
1636
|
*/
|
|
1589
1637
|
highWaterMark: number;
|
|
1590
1638
|
}
|
|
1591
|
-
export declare abstract class
|
|
1639
|
+
export declare abstract class TailEvent extends ExtendableEvent {
|
|
1640
|
+
readonly events: TraceItem[];
|
|
1592
1641
|
readonly traces: TraceItem[];
|
|
1593
1642
|
}
|
|
1594
1643
|
export interface TraceItem {
|
|
@@ -1798,6 +1847,8 @@ export declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1798
1847
|
accept(): void;
|
|
1799
1848
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1800
1849
|
close(code?: number, reason?: string): void;
|
|
1850
|
+
serializeAttachment(attachment: any): void;
|
|
1851
|
+
deserializeAttachment(): any | null;
|
|
1801
1852
|
static readonly READY_STATE_CONNECTING: number;
|
|
1802
1853
|
static readonly READY_STATE_OPEN: number;
|
|
1803
1854
|
static readonly READY_STATE_CLOSING: number;
|
|
@@ -1813,6 +1864,24 @@ export declare const WebSocketPair: {
|
|
|
1813
1864
|
1: WebSocket;
|
|
1814
1865
|
};
|
|
1815
1866
|
};
|
|
1867
|
+
export interface Socket {
|
|
1868
|
+
get readable(): ReadableStream;
|
|
1869
|
+
get writable(): WritableStream;
|
|
1870
|
+
get closed(): Promise<void>;
|
|
1871
|
+
close(): Promise<void>;
|
|
1872
|
+
startTls(options?: TlsOptions): Socket;
|
|
1873
|
+
}
|
|
1874
|
+
export interface SocketOptions {
|
|
1875
|
+
secureTransport?: string;
|
|
1876
|
+
allowHalfOpen: boolean;
|
|
1877
|
+
}
|
|
1878
|
+
export interface SocketAddress {
|
|
1879
|
+
hostname: string;
|
|
1880
|
+
port: number;
|
|
1881
|
+
}
|
|
1882
|
+
export interface TlsOptions {
|
|
1883
|
+
expectedServerHostname?: string;
|
|
1884
|
+
}
|
|
1816
1885
|
export interface BasicImageTransformations {
|
|
1817
1886
|
/**
|
|
1818
1887
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2202,8 +2271,7 @@ export interface IncomingRequestCfPropertiesBase
|
|
|
2202
2271
|
export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2203
2272
|
/**
|
|
2204
2273
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2205
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2206
|
-
* and `99` (almost certainly a bot).
|
|
2274
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2207
2275
|
*
|
|
2208
2276
|
* @example 54
|
|
2209
2277
|
*/
|
|
@@ -2938,75 +3006,12 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2938
3006
|
// Key Identifier of the JWK
|
|
2939
3007
|
readonly kid: string;
|
|
2940
3008
|
}
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
*/
|
|
2944
|
-
export interface Message<Body = unknown> {
|
|
2945
|
-
/**
|
|
2946
|
-
* A unique, system-generated ID for the message.
|
|
2947
|
-
*/
|
|
2948
|
-
readonly id: string;
|
|
2949
|
-
/**
|
|
2950
|
-
* A timestamp when the message was sent.
|
|
2951
|
-
*/
|
|
2952
|
-
readonly timestamp: Date;
|
|
2953
|
-
/**
|
|
2954
|
-
* The body of the message.
|
|
2955
|
-
*/
|
|
2956
|
-
readonly body: Body;
|
|
2957
|
-
/**
|
|
2958
|
-
* Marks message to be retried.
|
|
2959
|
-
*/
|
|
2960
|
-
retry(): void;
|
|
2961
|
-
/**
|
|
2962
|
-
* Marks message acknowledged.
|
|
2963
|
-
*/
|
|
2964
|
-
ack(): void;
|
|
2965
|
-
}
|
|
2966
|
-
/**
|
|
2967
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2968
|
-
*/
|
|
2969
|
-
export interface MessageBatch<Body = unknown> {
|
|
2970
|
-
/**
|
|
2971
|
-
* The name of the Queue that belongs to this batch.
|
|
2972
|
-
*/
|
|
2973
|
-
readonly queue: string;
|
|
2974
|
-
/**
|
|
2975
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2976
|
-
*/
|
|
2977
|
-
readonly messages: readonly Message<Body>[];
|
|
2978
|
-
/**
|
|
2979
|
-
* Marks every message to be retried in the next batch.
|
|
2980
|
-
*/
|
|
2981
|
-
retryAll(): void;
|
|
2982
|
-
/**
|
|
2983
|
-
* Marks every message acknowledged in the batch.
|
|
2984
|
-
*/
|
|
2985
|
-
ackAll(): void;
|
|
2986
|
-
}
|
|
2987
|
-
/**
|
|
2988
|
-
* A wrapper class used to structure message batches.
|
|
2989
|
-
*/
|
|
2990
|
-
export type MessageSendRequest<Body = unknown> = {
|
|
3009
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3010
|
+
export interface DispatchNamespace {
|
|
2991
3011
|
/**
|
|
2992
|
-
*
|
|
3012
|
+
* @param name Name of the Worker script.
|
|
3013
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
3014
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2993
3015
|
*/
|
|
2994
|
-
|
|
2995
|
-
};
|
|
2996
|
-
/**
|
|
2997
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
2998
|
-
*/
|
|
2999
|
-
export interface Queue<Body = any> {
|
|
3000
|
-
/**
|
|
3001
|
-
* Sends a message to the Queue.
|
|
3002
|
-
* @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB.
|
|
3003
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
3004
|
-
*/
|
|
3005
|
-
send(message: Body): Promise<void>;
|
|
3006
|
-
/**
|
|
3007
|
-
* Sends a batch of messages to the Queue.
|
|
3008
|
-
* @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB.
|
|
3009
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
3010
|
-
*/
|
|
3011
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
3016
|
+
get(name: string): Fetcher;
|
|
3012
3017
|
}
|