@cloudflare/workers-types 4.20230404.0 → 4.20230419.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 +46 -74
- package/2021-11-03/index.ts +46 -74
- package/2022-01-31/index.d.ts +46 -74
- package/2022-01-31/index.ts +46 -74
- package/2022-03-21/index.d.ts +46 -74
- package/2022-03-21/index.ts +46 -74
- package/2022-08-04/index.d.ts +46 -74
- package/2022-08-04/index.ts +46 -74
- package/2022-10-31/index.d.ts +46 -74
- package/2022-10-31/index.ts +46 -74
- package/2022-11-30/index.d.ts +46 -74
- package/2022-11-30/index.ts +46 -74
- package/experimental/index.d.ts +99 -74
- package/experimental/index.ts +99 -74
- package/index.d.ts +46 -74
- package/index.ts +46 -74
- package/oldest/index.d.ts +46 -74
- package/oldest/index.ts +46 -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
|
};
|
|
@@ -187,7 +188,8 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
187
188
|
ExtendableEvent: typeof ExtendableEvent;
|
|
188
189
|
PromiseRejectionEvent: typeof PromiseRejectionEvent;
|
|
189
190
|
FetchEvent: typeof FetchEvent;
|
|
190
|
-
|
|
191
|
+
TailEvent: typeof TailEvent;
|
|
192
|
+
TraceEvent: typeof TailEvent;
|
|
191
193
|
ScheduledEvent: typeof ScheduledEvent;
|
|
192
194
|
MessageEvent: typeof MessageEvent;
|
|
193
195
|
CloseEvent: typeof CloseEvent;
|
|
@@ -292,6 +294,11 @@ declare type ExportedHandlerFetchHandler<
|
|
|
292
294
|
env: Env,
|
|
293
295
|
ctx: ExecutionContext
|
|
294
296
|
) => Response | Promise<Response>;
|
|
297
|
+
declare type ExportedHandlerTailHandler<Env = unknown> = (
|
|
298
|
+
events: TraceItem[],
|
|
299
|
+
env: Env,
|
|
300
|
+
ctx: ExecutionContext
|
|
301
|
+
) => void | Promise<void>;
|
|
295
302
|
declare type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
296
303
|
traces: TraceItem[],
|
|
297
304
|
env: Env,
|
|
@@ -318,10 +325,11 @@ declare interface ExportedHandler<
|
|
|
318
325
|
CfHostMetadata = unknown
|
|
319
326
|
> {
|
|
320
327
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
328
|
+
tail?: ExportedHandlerTailHandler<Env>;
|
|
321
329
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
322
330
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
323
331
|
test?: ExportedHandlerTestHandler<Env>;
|
|
324
|
-
queue?: ExportedHandlerQueueHandler<Env,
|
|
332
|
+
queue?: ExportedHandlerQueueHandler<Env, Message>;
|
|
325
333
|
}
|
|
326
334
|
declare interface StructuredSerializeOptions {
|
|
327
335
|
transfer?: any[];
|
|
@@ -1170,6 +1178,33 @@ declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1170
1178
|
value: Value | null;
|
|
1171
1179
|
metadata: Metadata | null;
|
|
1172
1180
|
}
|
|
1181
|
+
declare interface Queue<Body> {
|
|
1182
|
+
send(message: Body): Promise<void>;
|
|
1183
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1184
|
+
}
|
|
1185
|
+
declare interface QueueSendOptions {}
|
|
1186
|
+
declare interface MessageSendRequest<Body = unknown> {
|
|
1187
|
+
body: Body;
|
|
1188
|
+
}
|
|
1189
|
+
declare interface Message<Body = unknown> {
|
|
1190
|
+
readonly id: string;
|
|
1191
|
+
readonly timestamp: Date;
|
|
1192
|
+
readonly body: Body;
|
|
1193
|
+
retry(): void;
|
|
1194
|
+
ack(): void;
|
|
1195
|
+
}
|
|
1196
|
+
declare interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1197
|
+
readonly messages: readonly Message<Body>[];
|
|
1198
|
+
readonly queue: string;
|
|
1199
|
+
retryAll(): void;
|
|
1200
|
+
ackAll(): void;
|
|
1201
|
+
}
|
|
1202
|
+
declare interface MessageBatch<Body = unknown> {
|
|
1203
|
+
readonly messages: readonly Message<Body>[];
|
|
1204
|
+
readonly queue: string;
|
|
1205
|
+
retryAll(): void;
|
|
1206
|
+
ackAll(): void;
|
|
1207
|
+
}
|
|
1173
1208
|
declare interface R2Error extends Error {
|
|
1174
1209
|
readonly name: string;
|
|
1175
1210
|
readonly code: number;
|
|
@@ -1603,7 +1638,8 @@ declare interface QueuingStrategyInit {
|
|
|
1603
1638
|
*/
|
|
1604
1639
|
highWaterMark: number;
|
|
1605
1640
|
}
|
|
1606
|
-
declare abstract class
|
|
1641
|
+
declare abstract class TailEvent extends ExtendableEvent {
|
|
1642
|
+
readonly events: TraceItem[];
|
|
1607
1643
|
readonly traces: TraceItem[];
|
|
1608
1644
|
}
|
|
1609
1645
|
declare interface TraceItem {
|
|
@@ -2211,8 +2247,7 @@ declare interface IncomingRequestCfPropertiesBase
|
|
|
2211
2247
|
declare interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2212
2248
|
/**
|
|
2213
2249
|
* 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).
|
|
2250
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2216
2251
|
*
|
|
2217
2252
|
* @example 54
|
|
2218
2253
|
*/
|
|
@@ -2957,75 +2992,12 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2957
2992
|
// Key Identifier of the JWK
|
|
2958
2993
|
readonly kid: string;
|
|
2959
2994
|
}
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
*/
|
|
2963
|
-
declare interface Message<Body = unknown> {
|
|
2995
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
2996
|
+
declare interface DispatchNamespace {
|
|
2964
2997
|
/**
|
|
2965
|
-
*
|
|
2998
|
+
* @param name Name of the Worker script.
|
|
2999
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
3000
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2966
3001
|
*/
|
|
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>;
|
|
3002
|
+
get(name: string): Fetcher;
|
|
3031
3003
|
}
|
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
|
};
|
|
@@ -187,7 +188,8 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
187
188
|
ExtendableEvent: typeof ExtendableEvent;
|
|
188
189
|
PromiseRejectionEvent: typeof PromiseRejectionEvent;
|
|
189
190
|
FetchEvent: typeof FetchEvent;
|
|
190
|
-
|
|
191
|
+
TailEvent: typeof TailEvent;
|
|
192
|
+
TraceEvent: typeof TailEvent;
|
|
191
193
|
ScheduledEvent: typeof ScheduledEvent;
|
|
192
194
|
MessageEvent: typeof MessageEvent;
|
|
193
195
|
CloseEvent: typeof CloseEvent;
|
|
@@ -294,6 +296,11 @@ export type ExportedHandlerFetchHandler<
|
|
|
294
296
|
env: Env,
|
|
295
297
|
ctx: ExecutionContext
|
|
296
298
|
) => Response | Promise<Response>;
|
|
299
|
+
export type ExportedHandlerTailHandler<Env = unknown> = (
|
|
300
|
+
events: TraceItem[],
|
|
301
|
+
env: Env,
|
|
302
|
+
ctx: ExecutionContext
|
|
303
|
+
) => void | Promise<void>;
|
|
297
304
|
export type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
298
305
|
traces: TraceItem[],
|
|
299
306
|
env: Env,
|
|
@@ -320,10 +327,11 @@ export interface ExportedHandler<
|
|
|
320
327
|
CfHostMetadata = unknown
|
|
321
328
|
> {
|
|
322
329
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
330
|
+
tail?: ExportedHandlerTailHandler<Env>;
|
|
323
331
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
324
332
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
325
333
|
test?: ExportedHandlerTestHandler<Env>;
|
|
326
|
-
queue?: ExportedHandlerQueueHandler<Env,
|
|
334
|
+
queue?: ExportedHandlerQueueHandler<Env, Message>;
|
|
327
335
|
}
|
|
328
336
|
export interface StructuredSerializeOptions {
|
|
329
337
|
transfer?: any[];
|
|
@@ -1172,6 +1180,33 @@ export interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1172
1180
|
value: Value | null;
|
|
1173
1181
|
metadata: Metadata | null;
|
|
1174
1182
|
}
|
|
1183
|
+
export interface Queue<Body> {
|
|
1184
|
+
send(message: Body): Promise<void>;
|
|
1185
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1186
|
+
}
|
|
1187
|
+
export interface QueueSendOptions {}
|
|
1188
|
+
export interface MessageSendRequest<Body = unknown> {
|
|
1189
|
+
body: Body;
|
|
1190
|
+
}
|
|
1191
|
+
export interface Message<Body = unknown> {
|
|
1192
|
+
readonly id: string;
|
|
1193
|
+
readonly timestamp: Date;
|
|
1194
|
+
readonly body: Body;
|
|
1195
|
+
retry(): void;
|
|
1196
|
+
ack(): void;
|
|
1197
|
+
}
|
|
1198
|
+
export interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1199
|
+
readonly messages: readonly Message<Body>[];
|
|
1200
|
+
readonly queue: string;
|
|
1201
|
+
retryAll(): void;
|
|
1202
|
+
ackAll(): void;
|
|
1203
|
+
}
|
|
1204
|
+
export interface MessageBatch<Body = unknown> {
|
|
1205
|
+
readonly messages: readonly Message<Body>[];
|
|
1206
|
+
readonly queue: string;
|
|
1207
|
+
retryAll(): void;
|
|
1208
|
+
ackAll(): void;
|
|
1209
|
+
}
|
|
1175
1210
|
export interface R2Error extends Error {
|
|
1176
1211
|
readonly name: string;
|
|
1177
1212
|
readonly code: number;
|
|
@@ -1608,7 +1643,8 @@ export interface QueuingStrategyInit {
|
|
|
1608
1643
|
*/
|
|
1609
1644
|
highWaterMark: number;
|
|
1610
1645
|
}
|
|
1611
|
-
export declare abstract class
|
|
1646
|
+
export declare abstract class TailEvent extends ExtendableEvent {
|
|
1647
|
+
readonly events: TraceItem[];
|
|
1612
1648
|
readonly traces: TraceItem[];
|
|
1613
1649
|
}
|
|
1614
1650
|
export interface TraceItem {
|
|
@@ -2216,8 +2252,7 @@ export interface IncomingRequestCfPropertiesBase
|
|
|
2216
2252
|
export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2217
2253
|
/**
|
|
2218
2254
|
* 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).
|
|
2255
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2221
2256
|
*
|
|
2222
2257
|
* @example 54
|
|
2223
2258
|
*/
|
|
@@ -2952,75 +2987,12 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2952
2987
|
// Key Identifier of the JWK
|
|
2953
2988
|
readonly kid: string;
|
|
2954
2989
|
}
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
*/
|
|
2958
|
-
export interface Message<Body = unknown> {
|
|
2990
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
2991
|
+
export interface DispatchNamespace {
|
|
2959
2992
|
/**
|
|
2960
|
-
*
|
|
2993
|
+
* @param name Name of the Worker script.
|
|
2994
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
2995
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2961
2996
|
*/
|
|
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>;
|
|
2997
|
+
get(name: string): Fetcher;
|
|
3026
2998
|
}
|
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
|
};
|
|
@@ -187,7 +188,8 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
187
188
|
ExtendableEvent: typeof ExtendableEvent;
|
|
188
189
|
PromiseRejectionEvent: typeof PromiseRejectionEvent;
|
|
189
190
|
FetchEvent: typeof FetchEvent;
|
|
190
|
-
|
|
191
|
+
TailEvent: typeof TailEvent;
|
|
192
|
+
TraceEvent: typeof TailEvent;
|
|
191
193
|
ScheduledEvent: typeof ScheduledEvent;
|
|
192
194
|
MessageEvent: typeof MessageEvent;
|
|
193
195
|
CloseEvent: typeof CloseEvent;
|
|
@@ -292,6 +294,11 @@ declare type ExportedHandlerFetchHandler<
|
|
|
292
294
|
env: Env,
|
|
293
295
|
ctx: ExecutionContext
|
|
294
296
|
) => Response | Promise<Response>;
|
|
297
|
+
declare type ExportedHandlerTailHandler<Env = unknown> = (
|
|
298
|
+
events: TraceItem[],
|
|
299
|
+
env: Env,
|
|
300
|
+
ctx: ExecutionContext
|
|
301
|
+
) => void | Promise<void>;
|
|
295
302
|
declare type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
296
303
|
traces: TraceItem[],
|
|
297
304
|
env: Env,
|
|
@@ -318,10 +325,11 @@ declare interface ExportedHandler<
|
|
|
318
325
|
CfHostMetadata = unknown
|
|
319
326
|
> {
|
|
320
327
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
328
|
+
tail?: ExportedHandlerTailHandler<Env>;
|
|
321
329
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
322
330
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
323
331
|
test?: ExportedHandlerTestHandler<Env>;
|
|
324
|
-
queue?: ExportedHandlerQueueHandler<Env,
|
|
332
|
+
queue?: ExportedHandlerQueueHandler<Env, Message>;
|
|
325
333
|
}
|
|
326
334
|
declare interface StructuredSerializeOptions {
|
|
327
335
|
transfer?: any[];
|
|
@@ -1150,6 +1158,33 @@ declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1150
1158
|
value: Value | null;
|
|
1151
1159
|
metadata: Metadata | null;
|
|
1152
1160
|
}
|
|
1161
|
+
declare interface Queue<Body> {
|
|
1162
|
+
send(message: Body): Promise<void>;
|
|
1163
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1164
|
+
}
|
|
1165
|
+
declare interface QueueSendOptions {}
|
|
1166
|
+
declare interface MessageSendRequest<Body = unknown> {
|
|
1167
|
+
body: Body;
|
|
1168
|
+
}
|
|
1169
|
+
declare interface Message<Body = unknown> {
|
|
1170
|
+
readonly id: string;
|
|
1171
|
+
readonly timestamp: Date;
|
|
1172
|
+
readonly body: Body;
|
|
1173
|
+
retry(): void;
|
|
1174
|
+
ack(): void;
|
|
1175
|
+
}
|
|
1176
|
+
declare interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1177
|
+
readonly messages: readonly Message<Body>[];
|
|
1178
|
+
readonly queue: string;
|
|
1179
|
+
retryAll(): void;
|
|
1180
|
+
ackAll(): void;
|
|
1181
|
+
}
|
|
1182
|
+
declare interface MessageBatch<Body = unknown> {
|
|
1183
|
+
readonly messages: readonly Message<Body>[];
|
|
1184
|
+
readonly queue: string;
|
|
1185
|
+
retryAll(): void;
|
|
1186
|
+
ackAll(): void;
|
|
1187
|
+
}
|
|
1153
1188
|
declare interface R2Error extends Error {
|
|
1154
1189
|
readonly name: string;
|
|
1155
1190
|
readonly code: number;
|
|
@@ -1583,7 +1618,8 @@ declare interface QueuingStrategyInit {
|
|
|
1583
1618
|
*/
|
|
1584
1619
|
highWaterMark: number;
|
|
1585
1620
|
}
|
|
1586
|
-
declare abstract class
|
|
1621
|
+
declare abstract class TailEvent extends ExtendableEvent {
|
|
1622
|
+
readonly events: TraceItem[];
|
|
1587
1623
|
readonly traces: TraceItem[];
|
|
1588
1624
|
}
|
|
1589
1625
|
declare interface TraceItem {
|
|
@@ -2197,8 +2233,7 @@ declare interface IncomingRequestCfPropertiesBase
|
|
|
2197
2233
|
declare interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2198
2234
|
/**
|
|
2199
2235
|
* 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).
|
|
2236
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2202
2237
|
*
|
|
2203
2238
|
* @example 54
|
|
2204
2239
|
*/
|
|
@@ -2943,75 +2978,12 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2943
2978
|
// Key Identifier of the JWK
|
|
2944
2979
|
readonly kid: string;
|
|
2945
2980
|
}
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
*/
|
|
2949
|
-
declare interface Message<Body = unknown> {
|
|
2981
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
2982
|
+
declare interface DispatchNamespace {
|
|
2950
2983
|
/**
|
|
2951
|
-
*
|
|
2984
|
+
* @param name Name of the Worker script.
|
|
2985
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
2986
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2952
2987
|
*/
|
|
2953
|
-
|
|
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> = {
|
|
2996
|
-
/**
|
|
2997
|
-
* The body of the message.
|
|
2998
|
-
*/
|
|
2999
|
-
body: Body;
|
|
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>;
|
|
2988
|
+
get(name: string): Fetcher;
|
|
3017
2989
|
}
|