@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/2021-11-03/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>(
|
|
@@ -563,6 +582,7 @@ declare class AbortController {
|
|
|
563
582
|
declare abstract class AbortSignal extends EventTarget {
|
|
564
583
|
static abort(reason?: any): AbortSignal;
|
|
565
584
|
static timeout(delay: number): AbortSignal;
|
|
585
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
566
586
|
/** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */
|
|
567
587
|
readonly aborted: boolean;
|
|
568
588
|
readonly reason: any;
|
|
@@ -1058,6 +1078,7 @@ declare interface RequestInit<Cf = CfProperties> {
|
|
|
1058
1078
|
}
|
|
1059
1079
|
declare abstract class Fetcher {
|
|
1060
1080
|
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1081
|
+
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1061
1082
|
}
|
|
1062
1083
|
declare interface FetcherPutOptions {
|
|
1063
1084
|
expiration?: number;
|
|
@@ -1170,6 +1191,33 @@ declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1170
1191
|
value: Value | null;
|
|
1171
1192
|
metadata: Metadata | null;
|
|
1172
1193
|
}
|
|
1194
|
+
declare interface Queue<Body> {
|
|
1195
|
+
send(message: Body): Promise<void>;
|
|
1196
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1197
|
+
}
|
|
1198
|
+
declare interface QueueSendOptions {}
|
|
1199
|
+
declare interface MessageSendRequest<Body = unknown> {
|
|
1200
|
+
body: Body;
|
|
1201
|
+
}
|
|
1202
|
+
declare interface Message<Body = unknown> {
|
|
1203
|
+
readonly id: string;
|
|
1204
|
+
readonly timestamp: Date;
|
|
1205
|
+
readonly body: Body;
|
|
1206
|
+
retry(): void;
|
|
1207
|
+
ack(): void;
|
|
1208
|
+
}
|
|
1209
|
+
declare interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1210
|
+
readonly messages: readonly Message<Body>[];
|
|
1211
|
+
readonly queue: string;
|
|
1212
|
+
retryAll(): void;
|
|
1213
|
+
ackAll(): void;
|
|
1214
|
+
}
|
|
1215
|
+
declare interface MessageBatch<Body = unknown> {
|
|
1216
|
+
readonly messages: readonly Message<Body>[];
|
|
1217
|
+
readonly queue: string;
|
|
1218
|
+
retryAll(): void;
|
|
1219
|
+
ackAll(): void;
|
|
1220
|
+
}
|
|
1173
1221
|
declare interface R2Error extends Error {
|
|
1174
1222
|
readonly name: string;
|
|
1175
1223
|
readonly code: number;
|
|
@@ -1603,7 +1651,8 @@ declare interface QueuingStrategyInit {
|
|
|
1603
1651
|
*/
|
|
1604
1652
|
highWaterMark: number;
|
|
1605
1653
|
}
|
|
1606
|
-
declare abstract class
|
|
1654
|
+
declare abstract class TailEvent extends ExtendableEvent {
|
|
1655
|
+
readonly events: TraceItem[];
|
|
1607
1656
|
readonly traces: TraceItem[];
|
|
1608
1657
|
}
|
|
1609
1658
|
declare interface TraceItem {
|
|
@@ -1803,6 +1852,8 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1803
1852
|
accept(): void;
|
|
1804
1853
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1805
1854
|
close(code?: number, reason?: string): void;
|
|
1855
|
+
serializeAttachment(attachment: any): void;
|
|
1856
|
+
deserializeAttachment(): any | null;
|
|
1806
1857
|
static readonly READY_STATE_CONNECTING: number;
|
|
1807
1858
|
static readonly READY_STATE_OPEN: number;
|
|
1808
1859
|
static readonly READY_STATE_CLOSING: number;
|
|
@@ -1822,6 +1873,24 @@ declare const WebSocketPair: {
|
|
|
1822
1873
|
1: WebSocket;
|
|
1823
1874
|
};
|
|
1824
1875
|
};
|
|
1876
|
+
declare interface Socket {
|
|
1877
|
+
get readable(): ReadableStream;
|
|
1878
|
+
get writable(): WritableStream;
|
|
1879
|
+
get closed(): Promise<void>;
|
|
1880
|
+
close(): Promise<void>;
|
|
1881
|
+
startTls(options?: TlsOptions): Socket;
|
|
1882
|
+
}
|
|
1883
|
+
declare interface SocketOptions {
|
|
1884
|
+
secureTransport?: string;
|
|
1885
|
+
allowHalfOpen: boolean;
|
|
1886
|
+
}
|
|
1887
|
+
declare interface SocketAddress {
|
|
1888
|
+
hostname: string;
|
|
1889
|
+
port: number;
|
|
1890
|
+
}
|
|
1891
|
+
declare interface TlsOptions {
|
|
1892
|
+
expectedServerHostname?: string;
|
|
1893
|
+
}
|
|
1825
1894
|
declare interface BasicImageTransformations {
|
|
1826
1895
|
/**
|
|
1827
1896
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2211,8 +2280,7 @@ declare interface IncomingRequestCfPropertiesBase
|
|
|
2211
2280
|
declare interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2212
2281
|
/**
|
|
2213
2282
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2214
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2215
|
-
* and `99` (almost certainly a bot).
|
|
2283
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2216
2284
|
*
|
|
2217
2285
|
* @example 54
|
|
2218
2286
|
*/
|
|
@@ -2957,75 +3025,12 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2957
3025
|
// Key Identifier of the JWK
|
|
2958
3026
|
readonly kid: string;
|
|
2959
3027
|
}
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
*/
|
|
2963
|
-
declare interface Message<Body = unknown> {
|
|
3028
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3029
|
+
declare interface DispatchNamespace {
|
|
2964
3030
|
/**
|
|
2965
|
-
*
|
|
3031
|
+
* @param name Name of the Worker script.
|
|
3032
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
3033
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2966
3034
|
*/
|
|
2967
|
-
|
|
2968
|
-
/**
|
|
2969
|
-
* A timestamp when the message was sent.
|
|
2970
|
-
*/
|
|
2971
|
-
readonly timestamp: Date;
|
|
2972
|
-
/**
|
|
2973
|
-
* The body of the message.
|
|
2974
|
-
*/
|
|
2975
|
-
readonly body: Body;
|
|
2976
|
-
/**
|
|
2977
|
-
* Marks message to be retried.
|
|
2978
|
-
*/
|
|
2979
|
-
retry(): void;
|
|
2980
|
-
/**
|
|
2981
|
-
* Marks message acknowledged.
|
|
2982
|
-
*/
|
|
2983
|
-
ack(): void;
|
|
2984
|
-
}
|
|
2985
|
-
/**
|
|
2986
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2987
|
-
*/
|
|
2988
|
-
declare interface MessageBatch<Body = unknown> {
|
|
2989
|
-
/**
|
|
2990
|
-
* The name of the Queue that belongs to this batch.
|
|
2991
|
-
*/
|
|
2992
|
-
readonly queue: string;
|
|
2993
|
-
/**
|
|
2994
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2995
|
-
*/
|
|
2996
|
-
readonly messages: readonly Message<Body>[];
|
|
2997
|
-
/**
|
|
2998
|
-
* Marks every message to be retried in the next batch.
|
|
2999
|
-
*/
|
|
3000
|
-
retryAll(): void;
|
|
3001
|
-
/**
|
|
3002
|
-
* Marks every message acknowledged in the batch.
|
|
3003
|
-
*/
|
|
3004
|
-
ackAll(): void;
|
|
3005
|
-
}
|
|
3006
|
-
/**
|
|
3007
|
-
* A wrapper class used to structure message batches.
|
|
3008
|
-
*/
|
|
3009
|
-
declare type MessageSendRequest<Body = unknown> = {
|
|
3010
|
-
/**
|
|
3011
|
-
* The body of the message.
|
|
3012
|
-
*/
|
|
3013
|
-
body: Body;
|
|
3014
|
-
};
|
|
3015
|
-
/**
|
|
3016
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
3017
|
-
*/
|
|
3018
|
-
declare interface Queue<Body = any> {
|
|
3019
|
-
/**
|
|
3020
|
-
* Sends a message to the Queue.
|
|
3021
|
-
* @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.
|
|
3022
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
3023
|
-
*/
|
|
3024
|
-
send(message: Body): Promise<void>;
|
|
3025
|
-
/**
|
|
3026
|
-
* Sends a batch of messages to the Queue.
|
|
3027
|
-
* @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.
|
|
3028
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
3029
|
-
*/
|
|
3030
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
3035
|
+
get(name: string): Fetcher;
|
|
3031
3036
|
}
|
package/2021-11-03/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>(
|
|
@@ -565,6 +584,7 @@ export declare class AbortController {
|
|
|
565
584
|
export declare abstract class AbortSignal extends EventTarget {
|
|
566
585
|
static abort(reason?: any): AbortSignal;
|
|
567
586
|
static timeout(delay: number): AbortSignal;
|
|
587
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
568
588
|
/** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */
|
|
569
589
|
readonly aborted: boolean;
|
|
570
590
|
readonly reason: any;
|
|
@@ -1060,6 +1080,7 @@ export interface RequestInit<Cf = CfProperties> {
|
|
|
1060
1080
|
}
|
|
1061
1081
|
export declare abstract class Fetcher {
|
|
1062
1082
|
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1083
|
+
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1063
1084
|
}
|
|
1064
1085
|
export interface FetcherPutOptions {
|
|
1065
1086
|
expiration?: number;
|
|
@@ -1172,6 +1193,33 @@ export interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1172
1193
|
value: Value | null;
|
|
1173
1194
|
metadata: Metadata | null;
|
|
1174
1195
|
}
|
|
1196
|
+
export interface Queue<Body> {
|
|
1197
|
+
send(message: Body): Promise<void>;
|
|
1198
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1199
|
+
}
|
|
1200
|
+
export interface QueueSendOptions {}
|
|
1201
|
+
export interface MessageSendRequest<Body = unknown> {
|
|
1202
|
+
body: Body;
|
|
1203
|
+
}
|
|
1204
|
+
export interface Message<Body = unknown> {
|
|
1205
|
+
readonly id: string;
|
|
1206
|
+
readonly timestamp: Date;
|
|
1207
|
+
readonly body: Body;
|
|
1208
|
+
retry(): void;
|
|
1209
|
+
ack(): void;
|
|
1210
|
+
}
|
|
1211
|
+
export interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1212
|
+
readonly messages: readonly Message<Body>[];
|
|
1213
|
+
readonly queue: string;
|
|
1214
|
+
retryAll(): void;
|
|
1215
|
+
ackAll(): void;
|
|
1216
|
+
}
|
|
1217
|
+
export interface MessageBatch<Body = unknown> {
|
|
1218
|
+
readonly messages: readonly Message<Body>[];
|
|
1219
|
+
readonly queue: string;
|
|
1220
|
+
retryAll(): void;
|
|
1221
|
+
ackAll(): void;
|
|
1222
|
+
}
|
|
1175
1223
|
export interface R2Error extends Error {
|
|
1176
1224
|
readonly name: string;
|
|
1177
1225
|
readonly code: number;
|
|
@@ -1608,7 +1656,8 @@ export interface QueuingStrategyInit {
|
|
|
1608
1656
|
*/
|
|
1609
1657
|
highWaterMark: number;
|
|
1610
1658
|
}
|
|
1611
|
-
export declare abstract class
|
|
1659
|
+
export declare abstract class TailEvent extends ExtendableEvent {
|
|
1660
|
+
readonly events: TraceItem[];
|
|
1612
1661
|
readonly traces: TraceItem[];
|
|
1613
1662
|
}
|
|
1614
1663
|
export interface TraceItem {
|
|
@@ -1808,6 +1857,8 @@ export declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1808
1857
|
accept(): void;
|
|
1809
1858
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1810
1859
|
close(code?: number, reason?: string): void;
|
|
1860
|
+
serializeAttachment(attachment: any): void;
|
|
1861
|
+
deserializeAttachment(): any | null;
|
|
1811
1862
|
static readonly READY_STATE_CONNECTING: number;
|
|
1812
1863
|
static readonly READY_STATE_OPEN: number;
|
|
1813
1864
|
static readonly READY_STATE_CLOSING: number;
|
|
@@ -1827,6 +1878,24 @@ export declare const WebSocketPair: {
|
|
|
1827
1878
|
1: WebSocket;
|
|
1828
1879
|
};
|
|
1829
1880
|
};
|
|
1881
|
+
export interface Socket {
|
|
1882
|
+
get readable(): ReadableStream;
|
|
1883
|
+
get writable(): WritableStream;
|
|
1884
|
+
get closed(): Promise<void>;
|
|
1885
|
+
close(): Promise<void>;
|
|
1886
|
+
startTls(options?: TlsOptions): Socket;
|
|
1887
|
+
}
|
|
1888
|
+
export interface SocketOptions {
|
|
1889
|
+
secureTransport?: string;
|
|
1890
|
+
allowHalfOpen: boolean;
|
|
1891
|
+
}
|
|
1892
|
+
export interface SocketAddress {
|
|
1893
|
+
hostname: string;
|
|
1894
|
+
port: number;
|
|
1895
|
+
}
|
|
1896
|
+
export interface TlsOptions {
|
|
1897
|
+
expectedServerHostname?: string;
|
|
1898
|
+
}
|
|
1830
1899
|
export interface BasicImageTransformations {
|
|
1831
1900
|
/**
|
|
1832
1901
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2216,8 +2285,7 @@ export interface IncomingRequestCfPropertiesBase
|
|
|
2216
2285
|
export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2217
2286
|
/**
|
|
2218
2287
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2219
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2220
|
-
* and `99` (almost certainly a bot).
|
|
2288
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2221
2289
|
*
|
|
2222
2290
|
* @example 54
|
|
2223
2291
|
*/
|
|
@@ -2952,75 +3020,12 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2952
3020
|
// Key Identifier of the JWK
|
|
2953
3021
|
readonly kid: string;
|
|
2954
3022
|
}
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
*/
|
|
2958
|
-
export interface Message<Body = unknown> {
|
|
3023
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3024
|
+
export interface DispatchNamespace {
|
|
2959
3025
|
/**
|
|
2960
|
-
*
|
|
3026
|
+
* @param name Name of the Worker script.
|
|
3027
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
3028
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2961
3029
|
*/
|
|
2962
|
-
|
|
2963
|
-
/**
|
|
2964
|
-
* A timestamp when the message was sent.
|
|
2965
|
-
*/
|
|
2966
|
-
readonly timestamp: Date;
|
|
2967
|
-
/**
|
|
2968
|
-
* The body of the message.
|
|
2969
|
-
*/
|
|
2970
|
-
readonly body: Body;
|
|
2971
|
-
/**
|
|
2972
|
-
* Marks message to be retried.
|
|
2973
|
-
*/
|
|
2974
|
-
retry(): void;
|
|
2975
|
-
/**
|
|
2976
|
-
* Marks message acknowledged.
|
|
2977
|
-
*/
|
|
2978
|
-
ack(): void;
|
|
2979
|
-
}
|
|
2980
|
-
/**
|
|
2981
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2982
|
-
*/
|
|
2983
|
-
export interface MessageBatch<Body = unknown> {
|
|
2984
|
-
/**
|
|
2985
|
-
* The name of the Queue that belongs to this batch.
|
|
2986
|
-
*/
|
|
2987
|
-
readonly queue: string;
|
|
2988
|
-
/**
|
|
2989
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2990
|
-
*/
|
|
2991
|
-
readonly messages: readonly Message<Body>[];
|
|
2992
|
-
/**
|
|
2993
|
-
* Marks every message to be retried in the next batch.
|
|
2994
|
-
*/
|
|
2995
|
-
retryAll(): void;
|
|
2996
|
-
/**
|
|
2997
|
-
* Marks every message acknowledged in the batch.
|
|
2998
|
-
*/
|
|
2999
|
-
ackAll(): void;
|
|
3000
|
-
}
|
|
3001
|
-
/**
|
|
3002
|
-
* A wrapper class used to structure message batches.
|
|
3003
|
-
*/
|
|
3004
|
-
export type MessageSendRequest<Body = unknown> = {
|
|
3005
|
-
/**
|
|
3006
|
-
* The body of the message.
|
|
3007
|
-
*/
|
|
3008
|
-
body: Body;
|
|
3009
|
-
};
|
|
3010
|
-
/**
|
|
3011
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
3012
|
-
*/
|
|
3013
|
-
export interface Queue<Body = any> {
|
|
3014
|
-
/**
|
|
3015
|
-
* Sends a message to the Queue.
|
|
3016
|
-
* @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.
|
|
3017
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
3018
|
-
*/
|
|
3019
|
-
send(message: Body): Promise<void>;
|
|
3020
|
-
/**
|
|
3021
|
-
* Sends a batch of messages to the Queue.
|
|
3022
|
-
* @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.
|
|
3023
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
3024
|
-
*/
|
|
3025
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
3030
|
+
get(name: string): Fetcher;
|
|
3026
3031
|
}
|