@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-11-30/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;
|
|
@@ -285,6 +289,8 @@ declare const self: ServiceWorkerGlobalScope;
|
|
|
285
289
|
declare const crypto: Crypto;
|
|
286
290
|
declare const caches: CacheStorage;
|
|
287
291
|
declare const scheduler: Scheduler;
|
|
292
|
+
declare const performance: Performance;
|
|
293
|
+
declare const origin: string;
|
|
288
294
|
declare const navigator: Navigator;
|
|
289
295
|
declare interface TestController {}
|
|
290
296
|
declare interface ExecutionContext {
|
|
@@ -299,6 +305,11 @@ declare type ExportedHandlerFetchHandler<
|
|
|
299
305
|
env: Env,
|
|
300
306
|
ctx: ExecutionContext
|
|
301
307
|
) => Response | Promise<Response>;
|
|
308
|
+
declare type ExportedHandlerTailHandler<Env = unknown> = (
|
|
309
|
+
events: TraceItem[],
|
|
310
|
+
env: Env,
|
|
311
|
+
ctx: ExecutionContext
|
|
312
|
+
) => void | Promise<void>;
|
|
302
313
|
declare type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
303
314
|
traces: TraceItem[],
|
|
304
315
|
env: Env,
|
|
@@ -325,10 +336,11 @@ declare interface ExportedHandler<
|
|
|
325
336
|
CfHostMetadata = unknown
|
|
326
337
|
> {
|
|
327
338
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
339
|
+
tail?: ExportedHandlerTailHandler<Env>;
|
|
328
340
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
329
341
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
330
342
|
test?: ExportedHandlerTestHandler<Env>;
|
|
331
|
-
queue?: ExportedHandlerQueueHandler<Env,
|
|
343
|
+
queue?: ExportedHandlerQueueHandler<Env, Message>;
|
|
332
344
|
}
|
|
333
345
|
declare interface StructuredSerializeOptions {
|
|
334
346
|
transfer?: any[];
|
|
@@ -340,6 +352,11 @@ declare abstract class PromiseRejectionEvent extends Event {
|
|
|
340
352
|
declare abstract class Navigator {
|
|
341
353
|
readonly userAgent: string;
|
|
342
354
|
}
|
|
355
|
+
/** 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. */
|
|
356
|
+
declare interface Performance {
|
|
357
|
+
readonly timeOrigin: number;
|
|
358
|
+
now(): number;
|
|
359
|
+
}
|
|
343
360
|
declare interface DurableObject {
|
|
344
361
|
fetch(request: Request): Response | Promise<Response>;
|
|
345
362
|
alarm?(): void | Promise<void>;
|
|
@@ -387,6 +404,8 @@ declare interface DurableObjectState {
|
|
|
387
404
|
readonly id: DurableObjectId;
|
|
388
405
|
readonly storage: DurableObjectStorage;
|
|
389
406
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
407
|
+
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
408
|
+
getWebSockets(tag?: string): WebSocket[];
|
|
390
409
|
}
|
|
391
410
|
declare interface DurableObjectTransaction {
|
|
392
411
|
get<T = unknown>(
|
|
@@ -562,6 +581,7 @@ declare class AbortController {
|
|
|
562
581
|
declare abstract class AbortSignal extends EventTarget {
|
|
563
582
|
static abort(reason?: any): AbortSignal;
|
|
564
583
|
static timeout(delay: number): AbortSignal;
|
|
584
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
565
585
|
get aborted(): boolean;
|
|
566
586
|
get reason(): any;
|
|
567
587
|
throwIfAborted(): void;
|
|
@@ -1048,6 +1068,7 @@ declare interface RequestInit<Cf = CfProperties> {
|
|
|
1048
1068
|
}
|
|
1049
1069
|
declare abstract class Fetcher {
|
|
1050
1070
|
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1071
|
+
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1051
1072
|
}
|
|
1052
1073
|
declare interface FetcherPutOptions {
|
|
1053
1074
|
expiration?: number;
|
|
@@ -1160,6 +1181,33 @@ declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1160
1181
|
value: Value | null;
|
|
1161
1182
|
metadata: Metadata | null;
|
|
1162
1183
|
}
|
|
1184
|
+
declare interface Queue<Body> {
|
|
1185
|
+
send(message: Body): Promise<void>;
|
|
1186
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1187
|
+
}
|
|
1188
|
+
declare interface QueueSendOptions {}
|
|
1189
|
+
declare interface MessageSendRequest<Body = unknown> {
|
|
1190
|
+
body: Body;
|
|
1191
|
+
}
|
|
1192
|
+
declare interface Message<Body = unknown> {
|
|
1193
|
+
readonly id: string;
|
|
1194
|
+
readonly timestamp: Date;
|
|
1195
|
+
readonly body: Body;
|
|
1196
|
+
retry(): void;
|
|
1197
|
+
ack(): void;
|
|
1198
|
+
}
|
|
1199
|
+
declare interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1200
|
+
readonly messages: readonly Message<Body>[];
|
|
1201
|
+
readonly queue: string;
|
|
1202
|
+
retryAll(): void;
|
|
1203
|
+
ackAll(): void;
|
|
1204
|
+
}
|
|
1205
|
+
declare interface MessageBatch<Body = unknown> {
|
|
1206
|
+
readonly messages: readonly Message<Body>[];
|
|
1207
|
+
readonly queue: string;
|
|
1208
|
+
retryAll(): void;
|
|
1209
|
+
ackAll(): void;
|
|
1210
|
+
}
|
|
1163
1211
|
declare interface R2Error extends Error {
|
|
1164
1212
|
readonly name: string;
|
|
1165
1213
|
readonly code: number;
|
|
@@ -1593,7 +1641,8 @@ declare interface QueuingStrategyInit {
|
|
|
1593
1641
|
*/
|
|
1594
1642
|
highWaterMark: number;
|
|
1595
1643
|
}
|
|
1596
|
-
declare abstract class
|
|
1644
|
+
declare abstract class TailEvent extends ExtendableEvent {
|
|
1645
|
+
readonly events: TraceItem[];
|
|
1597
1646
|
readonly traces: TraceItem[];
|
|
1598
1647
|
}
|
|
1599
1648
|
declare interface TraceItem {
|
|
@@ -1800,6 +1849,8 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1800
1849
|
accept(): void;
|
|
1801
1850
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1802
1851
|
close(code?: number, reason?: string): void;
|
|
1852
|
+
serializeAttachment(attachment: any): void;
|
|
1853
|
+
deserializeAttachment(): any | null;
|
|
1803
1854
|
static readonly READY_STATE_CONNECTING: number;
|
|
1804
1855
|
static readonly READY_STATE_OPEN: number;
|
|
1805
1856
|
static readonly READY_STATE_CLOSING: number;
|
|
@@ -1815,6 +1866,24 @@ declare const WebSocketPair: {
|
|
|
1815
1866
|
1: WebSocket;
|
|
1816
1867
|
};
|
|
1817
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
|
+
}
|
|
1818
1887
|
declare interface BasicImageTransformations {
|
|
1819
1888
|
/**
|
|
1820
1889
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2204,8 +2273,7 @@ declare interface IncomingRequestCfPropertiesBase
|
|
|
2204
2273
|
declare interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2205
2274
|
/**
|
|
2206
2275
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2207
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2208
|
-
* and `99` (almost certainly a bot).
|
|
2276
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2209
2277
|
*
|
|
2210
2278
|
* @example 54
|
|
2211
2279
|
*/
|
|
@@ -2950,75 +3018,12 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2950
3018
|
// Key Identifier of the JWK
|
|
2951
3019
|
readonly kid: string;
|
|
2952
3020
|
}
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
*/
|
|
2956
|
-
declare interface Message<Body = unknown> {
|
|
2957
|
-
/**
|
|
2958
|
-
* A unique, system-generated ID for the message.
|
|
2959
|
-
*/
|
|
2960
|
-
readonly id: string;
|
|
2961
|
-
/**
|
|
2962
|
-
* A timestamp when the message was sent.
|
|
2963
|
-
*/
|
|
2964
|
-
readonly timestamp: Date;
|
|
2965
|
-
/**
|
|
2966
|
-
* The body of the message.
|
|
2967
|
-
*/
|
|
2968
|
-
readonly body: Body;
|
|
2969
|
-
/**
|
|
2970
|
-
* Marks message to be retried.
|
|
2971
|
-
*/
|
|
2972
|
-
retry(): void;
|
|
2973
|
-
/**
|
|
2974
|
-
* Marks message acknowledged.
|
|
2975
|
-
*/
|
|
2976
|
-
ack(): void;
|
|
2977
|
-
}
|
|
2978
|
-
/**
|
|
2979
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2980
|
-
*/
|
|
2981
|
-
declare interface MessageBatch<Body = unknown> {
|
|
2982
|
-
/**
|
|
2983
|
-
* The name of the Queue that belongs to this batch.
|
|
2984
|
-
*/
|
|
2985
|
-
readonly queue: string;
|
|
2986
|
-
/**
|
|
2987
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2988
|
-
*/
|
|
2989
|
-
readonly messages: readonly Message<Body>[];
|
|
2990
|
-
/**
|
|
2991
|
-
* Marks every message to be retried in the next batch.
|
|
2992
|
-
*/
|
|
2993
|
-
retryAll(): void;
|
|
2994
|
-
/**
|
|
2995
|
-
* Marks every message acknowledged in the batch.
|
|
2996
|
-
*/
|
|
2997
|
-
ackAll(): void;
|
|
2998
|
-
}
|
|
2999
|
-
/**
|
|
3000
|
-
* A wrapper class used to structure message batches.
|
|
3001
|
-
*/
|
|
3002
|
-
declare type MessageSendRequest<Body = unknown> = {
|
|
3021
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3022
|
+
declare interface DispatchNamespace {
|
|
3003
3023
|
/**
|
|
3004
|
-
*
|
|
3024
|
+
* @param name Name of the Worker script.
|
|
3025
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
3026
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
3005
3027
|
*/
|
|
3006
|
-
|
|
3007
|
-
};
|
|
3008
|
-
/**
|
|
3009
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
3010
|
-
*/
|
|
3011
|
-
declare interface Queue<Body = any> {
|
|
3012
|
-
/**
|
|
3013
|
-
* Sends a message to the Queue.
|
|
3014
|
-
* @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.
|
|
3015
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
3016
|
-
*/
|
|
3017
|
-
send(message: Body): Promise<void>;
|
|
3018
|
-
/**
|
|
3019
|
-
* Sends a batch of messages to the Queue.
|
|
3020
|
-
* @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.
|
|
3021
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
3022
|
-
*/
|
|
3023
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
3028
|
+
get(name: string): Fetcher;
|
|
3024
3029
|
}
|
package/2022-11-30/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;
|
|
@@ -287,6 +291,8 @@ export declare const self: ServiceWorkerGlobalScope;
|
|
|
287
291
|
export declare const crypto: Crypto;
|
|
288
292
|
export declare const caches: CacheStorage;
|
|
289
293
|
export declare const scheduler: Scheduler;
|
|
294
|
+
export declare const performance: Performance;
|
|
295
|
+
export declare const origin: string;
|
|
290
296
|
export declare const navigator: Navigator;
|
|
291
297
|
export interface TestController {}
|
|
292
298
|
export interface ExecutionContext {
|
|
@@ -301,6 +307,11 @@ export type ExportedHandlerFetchHandler<
|
|
|
301
307
|
env: Env,
|
|
302
308
|
ctx: ExecutionContext
|
|
303
309
|
) => Response | Promise<Response>;
|
|
310
|
+
export type ExportedHandlerTailHandler<Env = unknown> = (
|
|
311
|
+
events: TraceItem[],
|
|
312
|
+
env: Env,
|
|
313
|
+
ctx: ExecutionContext
|
|
314
|
+
) => void | Promise<void>;
|
|
304
315
|
export type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
305
316
|
traces: TraceItem[],
|
|
306
317
|
env: Env,
|
|
@@ -327,10 +338,11 @@ export interface ExportedHandler<
|
|
|
327
338
|
CfHostMetadata = unknown
|
|
328
339
|
> {
|
|
329
340
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
341
|
+
tail?: ExportedHandlerTailHandler<Env>;
|
|
330
342
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
331
343
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
332
344
|
test?: ExportedHandlerTestHandler<Env>;
|
|
333
|
-
queue?: ExportedHandlerQueueHandler<Env,
|
|
345
|
+
queue?: ExportedHandlerQueueHandler<Env, Message>;
|
|
334
346
|
}
|
|
335
347
|
export interface StructuredSerializeOptions {
|
|
336
348
|
transfer?: any[];
|
|
@@ -342,6 +354,11 @@ export declare abstract class PromiseRejectionEvent extends Event {
|
|
|
342
354
|
export declare abstract class Navigator {
|
|
343
355
|
readonly userAgent: string;
|
|
344
356
|
}
|
|
357
|
+
/** 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. */
|
|
358
|
+
export interface Performance {
|
|
359
|
+
readonly timeOrigin: number;
|
|
360
|
+
now(): number;
|
|
361
|
+
}
|
|
345
362
|
export interface DurableObject {
|
|
346
363
|
fetch(request: Request): Response | Promise<Response>;
|
|
347
364
|
alarm?(): void | Promise<void>;
|
|
@@ -389,6 +406,8 @@ export interface DurableObjectState {
|
|
|
389
406
|
readonly id: DurableObjectId;
|
|
390
407
|
readonly storage: DurableObjectStorage;
|
|
391
408
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
409
|
+
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
410
|
+
getWebSockets(tag?: string): WebSocket[];
|
|
392
411
|
}
|
|
393
412
|
export interface DurableObjectTransaction {
|
|
394
413
|
get<T = unknown>(
|
|
@@ -564,6 +583,7 @@ export declare class AbortController {
|
|
|
564
583
|
export declare abstract class AbortSignal extends EventTarget {
|
|
565
584
|
static abort(reason?: any): AbortSignal;
|
|
566
585
|
static timeout(delay: number): AbortSignal;
|
|
586
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
567
587
|
get aborted(): boolean;
|
|
568
588
|
get reason(): any;
|
|
569
589
|
throwIfAborted(): void;
|
|
@@ -1050,6 +1070,7 @@ export interface RequestInit<Cf = CfProperties> {
|
|
|
1050
1070
|
}
|
|
1051
1071
|
export declare abstract class Fetcher {
|
|
1052
1072
|
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1073
|
+
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1053
1074
|
}
|
|
1054
1075
|
export interface FetcherPutOptions {
|
|
1055
1076
|
expiration?: number;
|
|
@@ -1162,6 +1183,33 @@ export interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1162
1183
|
value: Value | null;
|
|
1163
1184
|
metadata: Metadata | null;
|
|
1164
1185
|
}
|
|
1186
|
+
export interface Queue<Body> {
|
|
1187
|
+
send(message: Body): Promise<void>;
|
|
1188
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1189
|
+
}
|
|
1190
|
+
export interface QueueSendOptions {}
|
|
1191
|
+
export interface MessageSendRequest<Body = unknown> {
|
|
1192
|
+
body: Body;
|
|
1193
|
+
}
|
|
1194
|
+
export interface Message<Body = unknown> {
|
|
1195
|
+
readonly id: string;
|
|
1196
|
+
readonly timestamp: Date;
|
|
1197
|
+
readonly body: Body;
|
|
1198
|
+
retry(): void;
|
|
1199
|
+
ack(): void;
|
|
1200
|
+
}
|
|
1201
|
+
export interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1202
|
+
readonly messages: readonly Message<Body>[];
|
|
1203
|
+
readonly queue: string;
|
|
1204
|
+
retryAll(): void;
|
|
1205
|
+
ackAll(): void;
|
|
1206
|
+
}
|
|
1207
|
+
export interface MessageBatch<Body = unknown> {
|
|
1208
|
+
readonly messages: readonly Message<Body>[];
|
|
1209
|
+
readonly queue: string;
|
|
1210
|
+
retryAll(): void;
|
|
1211
|
+
ackAll(): void;
|
|
1212
|
+
}
|
|
1165
1213
|
export interface R2Error extends Error {
|
|
1166
1214
|
readonly name: string;
|
|
1167
1215
|
readonly code: number;
|
|
@@ -1598,7 +1646,8 @@ export interface QueuingStrategyInit {
|
|
|
1598
1646
|
*/
|
|
1599
1647
|
highWaterMark: number;
|
|
1600
1648
|
}
|
|
1601
|
-
export declare abstract class
|
|
1649
|
+
export declare abstract class TailEvent extends ExtendableEvent {
|
|
1650
|
+
readonly events: TraceItem[];
|
|
1602
1651
|
readonly traces: TraceItem[];
|
|
1603
1652
|
}
|
|
1604
1653
|
export interface TraceItem {
|
|
@@ -1805,6 +1854,8 @@ export declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1805
1854
|
accept(): void;
|
|
1806
1855
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1807
1856
|
close(code?: number, reason?: string): void;
|
|
1857
|
+
serializeAttachment(attachment: any): void;
|
|
1858
|
+
deserializeAttachment(): any | null;
|
|
1808
1859
|
static readonly READY_STATE_CONNECTING: number;
|
|
1809
1860
|
static readonly READY_STATE_OPEN: number;
|
|
1810
1861
|
static readonly READY_STATE_CLOSING: number;
|
|
@@ -1820,6 +1871,24 @@ export declare const WebSocketPair: {
|
|
|
1820
1871
|
1: WebSocket;
|
|
1821
1872
|
};
|
|
1822
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
|
+
}
|
|
1823
1892
|
export interface BasicImageTransformations {
|
|
1824
1893
|
/**
|
|
1825
1894
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2209,8 +2278,7 @@ export interface IncomingRequestCfPropertiesBase
|
|
|
2209
2278
|
export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2210
2279
|
/**
|
|
2211
2280
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2212
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2213
|
-
* and `99` (almost certainly a bot).
|
|
2281
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2214
2282
|
*
|
|
2215
2283
|
* @example 54
|
|
2216
2284
|
*/
|
|
@@ -2945,75 +3013,12 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2945
3013
|
// Key Identifier of the JWK
|
|
2946
3014
|
readonly kid: string;
|
|
2947
3015
|
}
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
*/
|
|
2951
|
-
export interface Message<Body = unknown> {
|
|
2952
|
-
/**
|
|
2953
|
-
* A unique, system-generated ID for the message.
|
|
2954
|
-
*/
|
|
2955
|
-
readonly id: string;
|
|
2956
|
-
/**
|
|
2957
|
-
* A timestamp when the message was sent.
|
|
2958
|
-
*/
|
|
2959
|
-
readonly timestamp: Date;
|
|
2960
|
-
/**
|
|
2961
|
-
* The body of the message.
|
|
2962
|
-
*/
|
|
2963
|
-
readonly body: Body;
|
|
2964
|
-
/**
|
|
2965
|
-
* Marks message to be retried.
|
|
2966
|
-
*/
|
|
2967
|
-
retry(): void;
|
|
2968
|
-
/**
|
|
2969
|
-
* Marks message acknowledged.
|
|
2970
|
-
*/
|
|
2971
|
-
ack(): void;
|
|
2972
|
-
}
|
|
2973
|
-
/**
|
|
2974
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2975
|
-
*/
|
|
2976
|
-
export interface MessageBatch<Body = unknown> {
|
|
2977
|
-
/**
|
|
2978
|
-
* The name of the Queue that belongs to this batch.
|
|
2979
|
-
*/
|
|
2980
|
-
readonly queue: string;
|
|
2981
|
-
/**
|
|
2982
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2983
|
-
*/
|
|
2984
|
-
readonly messages: readonly Message<Body>[];
|
|
2985
|
-
/**
|
|
2986
|
-
* Marks every message to be retried in the next batch.
|
|
2987
|
-
*/
|
|
2988
|
-
retryAll(): void;
|
|
2989
|
-
/**
|
|
2990
|
-
* Marks every message acknowledged in the batch.
|
|
2991
|
-
*/
|
|
2992
|
-
ackAll(): void;
|
|
2993
|
-
}
|
|
2994
|
-
/**
|
|
2995
|
-
* A wrapper class used to structure message batches.
|
|
2996
|
-
*/
|
|
2997
|
-
export type MessageSendRequest<Body = unknown> = {
|
|
3016
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3017
|
+
export interface DispatchNamespace {
|
|
2998
3018
|
/**
|
|
2999
|
-
*
|
|
3019
|
+
* @param name Name of the Worker script.
|
|
3020
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
3021
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
3000
3022
|
*/
|
|
3001
|
-
|
|
3002
|
-
};
|
|
3003
|
-
/**
|
|
3004
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
3005
|
-
*/
|
|
3006
|
-
export interface Queue<Body = any> {
|
|
3007
|
-
/**
|
|
3008
|
-
* Sends a message to the Queue.
|
|
3009
|
-
* @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.
|
|
3010
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
3011
|
-
*/
|
|
3012
|
-
send(message: Body): Promise<void>;
|
|
3013
|
-
/**
|
|
3014
|
-
* Sends a batch of messages to the Queue.
|
|
3015
|
-
* @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.
|
|
3016
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
3017
|
-
*/
|
|
3018
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
3023
|
+
get(name: string): Fetcher;
|
|
3019
3024
|
}
|