@cloudflare/workers-types 0.20230115.0 → 0.20230307.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 +69 -5
- package/2021-11-03/index.ts +69 -5
- package/2022-01-31/index.d.ts +67 -5
- package/2022-01-31/index.ts +67 -5
- package/2022-03-21/index.d.ts +67 -5
- package/2022-03-21/index.ts +67 -5
- package/2022-08-04/index.d.ts +67 -5
- package/2022-08-04/index.ts +67 -5
- package/2022-10-31/index.d.ts +2928 -0
- package/2022-10-31/index.ts +2930 -0
- package/2022-11-30/index.d.ts +2931 -0
- package/2022-11-30/index.ts +2933 -0
- package/README.md +12 -2
- package/entrypoints.svg +53 -0
- package/experimental/index.d.ts +68 -5
- package/experimental/index.ts +68 -5
- package/index.d.ts +69 -5
- package/index.ts +69 -5
- package/oldest/index.d.ts +69 -5
- package/oldest/index.ts +69 -5
- package/package.json +1 -1
package/2021-11-03/index.d.ts
CHANGED
|
@@ -279,6 +279,7 @@ declare const self: ServiceWorkerGlobalScope;
|
|
|
279
279
|
declare const crypto: Crypto;
|
|
280
280
|
declare const caches: CacheStorage;
|
|
281
281
|
declare const scheduler: Scheduler;
|
|
282
|
+
declare interface TestController {}
|
|
282
283
|
declare interface ExecutionContext {
|
|
283
284
|
waitUntil(promise: Promise<any>): void;
|
|
284
285
|
passThroughOnException(): void;
|
|
@@ -303,10 +304,16 @@ declare type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
|
|
|
303
304
|
env: Env,
|
|
304
305
|
ctx: ExecutionContext
|
|
305
306
|
) => void | Promise<void>;
|
|
307
|
+
declare type ExportedHandlerTestHandler<Env = unknown> = (
|
|
308
|
+
controller: TestController,
|
|
309
|
+
env: Env,
|
|
310
|
+
ctx: ExecutionContext
|
|
311
|
+
) => void | Promise<void>;
|
|
306
312
|
declare interface ExportedHandler<Env = unknown, QueueMessage = unknown> {
|
|
307
313
|
fetch?: ExportedHandlerFetchHandler<Env>;
|
|
308
314
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
309
315
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
316
|
+
test?: ExportedHandlerTestHandler<Env>;
|
|
310
317
|
queue?: ExportedHandlerQueueHandler<Env, QueueMessage>;
|
|
311
318
|
}
|
|
312
319
|
declare interface StructuredSerializeOptions {
|
|
@@ -1004,6 +1011,10 @@ declare class Request<CfHostMetadata = unknown> extends Body {
|
|
|
1004
1011
|
/** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. */
|
|
1005
1012
|
readonly signal: AbortSignal;
|
|
1006
1013
|
readonly cf?: IncomingRequestCfProperties<CfHostMetadata>;
|
|
1014
|
+
/** Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI] */
|
|
1015
|
+
readonly integrity: string;
|
|
1016
|
+
/** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
|
|
1017
|
+
readonly keepalive: boolean;
|
|
1007
1018
|
}
|
|
1008
1019
|
declare interface RequestInit<
|
|
1009
1020
|
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
@@ -1018,6 +1029,8 @@ declare interface RequestInit<
|
|
|
1018
1029
|
redirect?: string;
|
|
1019
1030
|
fetcher?: Fetcher | null;
|
|
1020
1031
|
cf?: CfType;
|
|
1032
|
+
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1033
|
+
integrity?: string;
|
|
1021
1034
|
/** An AbortSignal to set request's signal. */
|
|
1022
1035
|
signal?: AbortSignal | null;
|
|
1023
1036
|
}
|
|
@@ -1069,11 +1082,11 @@ declare interface KVNamespace<Key extends string = string> {
|
|
|
1069
1082
|
get(
|
|
1070
1083
|
key: Key,
|
|
1071
1084
|
options?: KVNamespaceGetOptions<"arrayBuffer">
|
|
1072
|
-
): Promise<
|
|
1085
|
+
): Promise<ArrayBuffer | null>;
|
|
1073
1086
|
get(
|
|
1074
1087
|
key: Key,
|
|
1075
1088
|
options?: KVNamespaceGetOptions<"stream">
|
|
1076
|
-
): Promise<
|
|
1089
|
+
): Promise<ReadableStream | null>;
|
|
1077
1090
|
list<Metadata = unknown>(
|
|
1078
1091
|
options?: KVNamespaceListOptions
|
|
1079
1092
|
): Promise<KVNamespaceListResult<Metadata, Key>>;
|
|
@@ -1519,13 +1532,13 @@ declare class CompressionStream extends TransformStream<
|
|
|
1519
1532
|
ArrayBuffer | ArrayBufferView,
|
|
1520
1533
|
Uint8Array
|
|
1521
1534
|
> {
|
|
1522
|
-
constructor(format: "gzip" | "deflate");
|
|
1535
|
+
constructor(format: "gzip" | "deflate" | "deflate-raw");
|
|
1523
1536
|
}
|
|
1524
1537
|
declare class DecompressionStream extends TransformStream<
|
|
1525
1538
|
ArrayBuffer | ArrayBufferView,
|
|
1526
1539
|
Uint8Array
|
|
1527
1540
|
> {
|
|
1528
|
-
constructor(format: "gzip" | "deflate");
|
|
1541
|
+
constructor(format: "gzip" | "deflate" | "deflate-raw");
|
|
1529
1542
|
}
|
|
1530
1543
|
declare class TextEncoderStream extends TransformStream<string, Uint8Array> {
|
|
1531
1544
|
constructor();
|
|
@@ -1654,6 +1667,7 @@ declare class URLSearchParams {
|
|
|
1654
1667
|
| Record<string, string>
|
|
1655
1668
|
| [key: string, value: string][]
|
|
1656
1669
|
);
|
|
1670
|
+
get size(): number;
|
|
1657
1671
|
append(name: string, value: string): void;
|
|
1658
1672
|
delete(name: string): void;
|
|
1659
1673
|
get(name: string): string | null;
|
|
@@ -2142,6 +2156,10 @@ declare interface IncomingRequestCfPropertiesBotManagementBase {
|
|
|
2142
2156
|
* A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources.
|
|
2143
2157
|
*/
|
|
2144
2158
|
staticResource: boolean;
|
|
2159
|
+
/**
|
|
2160
|
+
* List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request).
|
|
2161
|
+
*/
|
|
2162
|
+
detectionIds: number[];
|
|
2145
2163
|
}
|
|
2146
2164
|
declare interface IncomingRequestCfPropertiesBotManagement {
|
|
2147
2165
|
/**
|
|
@@ -2724,7 +2742,7 @@ declare abstract class D1PreparedStatement {
|
|
|
2724
2742
|
/**
|
|
2725
2743
|
* A email message that is sent to a consumer Worker.
|
|
2726
2744
|
*/
|
|
2727
|
-
declare interface EmailMessage
|
|
2745
|
+
declare interface EmailMessage {
|
|
2728
2746
|
/**
|
|
2729
2747
|
* Envelope From attribute of the email message.
|
|
2730
2748
|
*/
|
|
@@ -2813,6 +2831,40 @@ declare type PagesPluginFunction<
|
|
|
2813
2831
|
declare module "assets:*" {
|
|
2814
2832
|
export const onRequest: PagesFunction;
|
|
2815
2833
|
}
|
|
2834
|
+
// https://developers.cloudflare.com/pub-sub/
|
|
2835
|
+
// PubSubMessage represents an incoming PubSub message.
|
|
2836
|
+
// The message includes metadata about the broker, the client, and the payload
|
|
2837
|
+
// itself.
|
|
2838
|
+
declare interface PubSubMessage {
|
|
2839
|
+
// Message ID
|
|
2840
|
+
readonly mid: number;
|
|
2841
|
+
// MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
|
|
2842
|
+
readonly broker: string;
|
|
2843
|
+
// The MQTT topic the message was sent on.
|
|
2844
|
+
readonly topic: string;
|
|
2845
|
+
// The client ID of the client that published this message.
|
|
2846
|
+
readonly clientId: string;
|
|
2847
|
+
// The unique identifier (JWT ID) used by the client to authenticate, if token
|
|
2848
|
+
// auth was used.
|
|
2849
|
+
readonly jti?: string;
|
|
2850
|
+
// A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
|
|
2851
|
+
// received the message from the client.
|
|
2852
|
+
readonly receivedAt: number;
|
|
2853
|
+
// An (optional) string with the MIME type of the payload, if set by the
|
|
2854
|
+
// client.
|
|
2855
|
+
readonly contentType: string;
|
|
2856
|
+
// Set to 1 when the payload is a UTF-8 string
|
|
2857
|
+
// https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
|
|
2858
|
+
readonly payloadFormatIndicator: number;
|
|
2859
|
+
// Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
|
|
2860
|
+
// You can use payloadFormatIndicator to inspect this before decoding.
|
|
2861
|
+
payload: string | Uint8Array;
|
|
2862
|
+
}
|
|
2863
|
+
// JsonWebKey extended by kid parameter
|
|
2864
|
+
declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
2865
|
+
// Key Identifier of the JWK
|
|
2866
|
+
readonly kid: string;
|
|
2867
|
+
}
|
|
2816
2868
|
/**
|
|
2817
2869
|
* A message that is sent to a consumer Worker.
|
|
2818
2870
|
*/
|
|
@@ -2829,6 +2881,14 @@ declare interface Message<Body = unknown> {
|
|
|
2829
2881
|
* The body of the message.
|
|
2830
2882
|
*/
|
|
2831
2883
|
readonly body: Body;
|
|
2884
|
+
/**
|
|
2885
|
+
* Marks message to be retried.
|
|
2886
|
+
*/
|
|
2887
|
+
retry(): void;
|
|
2888
|
+
/**
|
|
2889
|
+
* Marks message acknowledged.
|
|
2890
|
+
*/
|
|
2891
|
+
ack(): void;
|
|
2832
2892
|
}
|
|
2833
2893
|
/**
|
|
2834
2894
|
* A batch of messages that are sent to a consumer Worker.
|
|
@@ -2846,6 +2906,10 @@ declare interface MessageBatch<Body = unknown> {
|
|
|
2846
2906
|
* Marks every message to be retried in the next batch.
|
|
2847
2907
|
*/
|
|
2848
2908
|
retryAll(): void;
|
|
2909
|
+
/**
|
|
2910
|
+
* Marks every message acknowledged in the batch.
|
|
2911
|
+
*/
|
|
2912
|
+
ackAll(): void;
|
|
2849
2913
|
}
|
|
2850
2914
|
/**
|
|
2851
2915
|
* A wrapper class used to structure message batches.
|
package/2021-11-03/index.ts
CHANGED
|
@@ -281,6 +281,7 @@ export declare const self: ServiceWorkerGlobalScope;
|
|
|
281
281
|
export declare const crypto: Crypto;
|
|
282
282
|
export declare const caches: CacheStorage;
|
|
283
283
|
export declare const scheduler: Scheduler;
|
|
284
|
+
export interface TestController {}
|
|
284
285
|
export interface ExecutionContext {
|
|
285
286
|
waitUntil(promise: Promise<any>): void;
|
|
286
287
|
passThroughOnException(): void;
|
|
@@ -305,10 +306,16 @@ export type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
|
|
|
305
306
|
env: Env,
|
|
306
307
|
ctx: ExecutionContext
|
|
307
308
|
) => void | Promise<void>;
|
|
309
|
+
export type ExportedHandlerTestHandler<Env = unknown> = (
|
|
310
|
+
controller: TestController,
|
|
311
|
+
env: Env,
|
|
312
|
+
ctx: ExecutionContext
|
|
313
|
+
) => void | Promise<void>;
|
|
308
314
|
export interface ExportedHandler<Env = unknown, QueueMessage = unknown> {
|
|
309
315
|
fetch?: ExportedHandlerFetchHandler<Env>;
|
|
310
316
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
311
317
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
318
|
+
test?: ExportedHandlerTestHandler<Env>;
|
|
312
319
|
queue?: ExportedHandlerQueueHandler<Env, QueueMessage>;
|
|
313
320
|
}
|
|
314
321
|
export interface StructuredSerializeOptions {
|
|
@@ -1006,6 +1013,10 @@ export declare class Request<CfHostMetadata = unknown> extends Body {
|
|
|
1006
1013
|
/** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. */
|
|
1007
1014
|
readonly signal: AbortSignal;
|
|
1008
1015
|
readonly cf?: IncomingRequestCfProperties<CfHostMetadata>;
|
|
1016
|
+
/** Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI] */
|
|
1017
|
+
readonly integrity: string;
|
|
1018
|
+
/** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
|
|
1019
|
+
readonly keepalive: boolean;
|
|
1009
1020
|
}
|
|
1010
1021
|
export interface RequestInit<
|
|
1011
1022
|
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
@@ -1020,6 +1031,8 @@ export interface RequestInit<
|
|
|
1020
1031
|
redirect?: string;
|
|
1021
1032
|
fetcher?: Fetcher | null;
|
|
1022
1033
|
cf?: CfType;
|
|
1034
|
+
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1035
|
+
integrity?: string;
|
|
1023
1036
|
/** An AbortSignal to set request's signal. */
|
|
1024
1037
|
signal?: AbortSignal | null;
|
|
1025
1038
|
}
|
|
@@ -1071,11 +1084,11 @@ export interface KVNamespace<Key extends string = string> {
|
|
|
1071
1084
|
get(
|
|
1072
1085
|
key: Key,
|
|
1073
1086
|
options?: KVNamespaceGetOptions<"arrayBuffer">
|
|
1074
|
-
): Promise<
|
|
1087
|
+
): Promise<ArrayBuffer | null>;
|
|
1075
1088
|
get(
|
|
1076
1089
|
key: Key,
|
|
1077
1090
|
options?: KVNamespaceGetOptions<"stream">
|
|
1078
|
-
): Promise<
|
|
1091
|
+
): Promise<ReadableStream | null>;
|
|
1079
1092
|
list<Metadata = unknown>(
|
|
1080
1093
|
options?: KVNamespaceListOptions
|
|
1081
1094
|
): Promise<KVNamespaceListResult<Metadata, Key>>;
|
|
@@ -1521,13 +1534,13 @@ export declare class CompressionStream extends TransformStream<
|
|
|
1521
1534
|
ArrayBuffer | ArrayBufferView,
|
|
1522
1535
|
Uint8Array
|
|
1523
1536
|
> {
|
|
1524
|
-
constructor(format: "gzip" | "deflate");
|
|
1537
|
+
constructor(format: "gzip" | "deflate" | "deflate-raw");
|
|
1525
1538
|
}
|
|
1526
1539
|
export declare class DecompressionStream extends TransformStream<
|
|
1527
1540
|
ArrayBuffer | ArrayBufferView,
|
|
1528
1541
|
Uint8Array
|
|
1529
1542
|
> {
|
|
1530
|
-
constructor(format: "gzip" | "deflate");
|
|
1543
|
+
constructor(format: "gzip" | "deflate" | "deflate-raw");
|
|
1531
1544
|
}
|
|
1532
1545
|
export declare class TextEncoderStream extends TransformStream<
|
|
1533
1546
|
string,
|
|
@@ -1659,6 +1672,7 @@ export declare class URLSearchParams {
|
|
|
1659
1672
|
| Record<string, string>
|
|
1660
1673
|
| [key: string, value: string][]
|
|
1661
1674
|
);
|
|
1675
|
+
get size(): number;
|
|
1662
1676
|
append(name: string, value: string): void;
|
|
1663
1677
|
delete(name: string): void;
|
|
1664
1678
|
get(name: string): string | null;
|
|
@@ -2147,6 +2161,10 @@ export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
|
2147
2161
|
* A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources.
|
|
2148
2162
|
*/
|
|
2149
2163
|
staticResource: boolean;
|
|
2164
|
+
/**
|
|
2165
|
+
* List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request).
|
|
2166
|
+
*/
|
|
2167
|
+
detectionIds: number[];
|
|
2150
2168
|
}
|
|
2151
2169
|
export interface IncomingRequestCfPropertiesBotManagement {
|
|
2152
2170
|
/**
|
|
@@ -2729,7 +2747,7 @@ export declare abstract class D1PreparedStatement {
|
|
|
2729
2747
|
/**
|
|
2730
2748
|
* A email message that is sent to a consumer Worker.
|
|
2731
2749
|
*/
|
|
2732
|
-
export interface EmailMessage
|
|
2750
|
+
export interface EmailMessage {
|
|
2733
2751
|
/**
|
|
2734
2752
|
* Envelope From attribute of the email message.
|
|
2735
2753
|
*/
|
|
@@ -2815,6 +2833,40 @@ export type PagesPluginFunction<
|
|
|
2815
2833
|
> = (
|
|
2816
2834
|
context: EventPluginContext<Env, Params, Data, PluginArgs>
|
|
2817
2835
|
) => Response | Promise<Response>;
|
|
2836
|
+
// https://developers.cloudflare.com/pub-sub/
|
|
2837
|
+
// PubSubMessage represents an incoming PubSub message.
|
|
2838
|
+
// The message includes metadata about the broker, the client, and the payload
|
|
2839
|
+
// itself.
|
|
2840
|
+
export interface PubSubMessage {
|
|
2841
|
+
// Message ID
|
|
2842
|
+
readonly mid: number;
|
|
2843
|
+
// MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
|
|
2844
|
+
readonly broker: string;
|
|
2845
|
+
// The MQTT topic the message was sent on.
|
|
2846
|
+
readonly topic: string;
|
|
2847
|
+
// The client ID of the client that published this message.
|
|
2848
|
+
readonly clientId: string;
|
|
2849
|
+
// The unique identifier (JWT ID) used by the client to authenticate, if token
|
|
2850
|
+
// auth was used.
|
|
2851
|
+
readonly jti?: string;
|
|
2852
|
+
// A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
|
|
2853
|
+
// received the message from the client.
|
|
2854
|
+
readonly receivedAt: number;
|
|
2855
|
+
// An (optional) string with the MIME type of the payload, if set by the
|
|
2856
|
+
// client.
|
|
2857
|
+
readonly contentType: string;
|
|
2858
|
+
// Set to 1 when the payload is a UTF-8 string
|
|
2859
|
+
// https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
|
|
2860
|
+
readonly payloadFormatIndicator: number;
|
|
2861
|
+
// Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
|
|
2862
|
+
// You can use payloadFormatIndicator to inspect this before decoding.
|
|
2863
|
+
payload: string | Uint8Array;
|
|
2864
|
+
}
|
|
2865
|
+
// JsonWebKey extended by kid parameter
|
|
2866
|
+
export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
2867
|
+
// Key Identifier of the JWK
|
|
2868
|
+
readonly kid: string;
|
|
2869
|
+
}
|
|
2818
2870
|
/**
|
|
2819
2871
|
* A message that is sent to a consumer Worker.
|
|
2820
2872
|
*/
|
|
@@ -2831,6 +2883,14 @@ export interface Message<Body = unknown> {
|
|
|
2831
2883
|
* The body of the message.
|
|
2832
2884
|
*/
|
|
2833
2885
|
readonly body: Body;
|
|
2886
|
+
/**
|
|
2887
|
+
* Marks message to be retried.
|
|
2888
|
+
*/
|
|
2889
|
+
retry(): void;
|
|
2890
|
+
/**
|
|
2891
|
+
* Marks message acknowledged.
|
|
2892
|
+
*/
|
|
2893
|
+
ack(): void;
|
|
2834
2894
|
}
|
|
2835
2895
|
/**
|
|
2836
2896
|
* A batch of messages that are sent to a consumer Worker.
|
|
@@ -2848,6 +2908,10 @@ export interface MessageBatch<Body = unknown> {
|
|
|
2848
2908
|
* Marks every message to be retried in the next batch.
|
|
2849
2909
|
*/
|
|
2850
2910
|
retryAll(): void;
|
|
2911
|
+
/**
|
|
2912
|
+
* Marks every message acknowledged in the batch.
|
|
2913
|
+
*/
|
|
2914
|
+
ackAll(): void;
|
|
2851
2915
|
}
|
|
2852
2916
|
/**
|
|
2853
2917
|
* A wrapper class used to structure message batches.
|
package/2022-01-31/index.d.ts
CHANGED
|
@@ -279,6 +279,7 @@ declare const self: ServiceWorkerGlobalScope;
|
|
|
279
279
|
declare const crypto: Crypto;
|
|
280
280
|
declare const caches: CacheStorage;
|
|
281
281
|
declare const scheduler: Scheduler;
|
|
282
|
+
declare interface TestController {}
|
|
282
283
|
declare interface ExecutionContext {
|
|
283
284
|
waitUntil(promise: Promise<any>): void;
|
|
284
285
|
passThroughOnException(): void;
|
|
@@ -303,10 +304,16 @@ declare type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
|
|
|
303
304
|
env: Env,
|
|
304
305
|
ctx: ExecutionContext
|
|
305
306
|
) => void | Promise<void>;
|
|
307
|
+
declare type ExportedHandlerTestHandler<Env = unknown> = (
|
|
308
|
+
controller: TestController,
|
|
309
|
+
env: Env,
|
|
310
|
+
ctx: ExecutionContext
|
|
311
|
+
) => void | Promise<void>;
|
|
306
312
|
declare interface ExportedHandler<Env = unknown, QueueMessage = unknown> {
|
|
307
313
|
fetch?: ExportedHandlerFetchHandler<Env>;
|
|
308
314
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
309
315
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
316
|
+
test?: ExportedHandlerTestHandler<Env>;
|
|
310
317
|
queue?: ExportedHandlerQueueHandler<Env, QueueMessage>;
|
|
311
318
|
}
|
|
312
319
|
declare interface StructuredSerializeOptions {
|
|
@@ -986,6 +993,8 @@ declare class Request<CfHostMetadata = unknown> extends Body {
|
|
|
986
993
|
get fetcher(): Fetcher | null;
|
|
987
994
|
get signal(): AbortSignal;
|
|
988
995
|
get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
|
|
996
|
+
get integrity(): string;
|
|
997
|
+
get keepalive(): boolean;
|
|
989
998
|
}
|
|
990
999
|
declare interface RequestInit<
|
|
991
1000
|
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
@@ -1000,6 +1009,8 @@ declare interface RequestInit<
|
|
|
1000
1009
|
redirect?: string;
|
|
1001
1010
|
fetcher?: Fetcher | null;
|
|
1002
1011
|
cf?: CfType;
|
|
1012
|
+
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1013
|
+
integrity?: string;
|
|
1003
1014
|
/** An AbortSignal to set request's signal. */
|
|
1004
1015
|
signal?: AbortSignal | null;
|
|
1005
1016
|
}
|
|
@@ -1051,11 +1062,11 @@ declare interface KVNamespace<Key extends string = string> {
|
|
|
1051
1062
|
get(
|
|
1052
1063
|
key: Key,
|
|
1053
1064
|
options?: KVNamespaceGetOptions<"arrayBuffer">
|
|
1054
|
-
): Promise<
|
|
1065
|
+
): Promise<ArrayBuffer | null>;
|
|
1055
1066
|
get(
|
|
1056
1067
|
key: Key,
|
|
1057
1068
|
options?: KVNamespaceGetOptions<"stream">
|
|
1058
|
-
): Promise<
|
|
1069
|
+
): Promise<ReadableStream | null>;
|
|
1059
1070
|
list<Metadata = unknown>(
|
|
1060
1071
|
options?: KVNamespaceListOptions
|
|
1061
1072
|
): Promise<KVNamespaceListResult<Metadata, Key>>;
|
|
@@ -1501,13 +1512,13 @@ declare class CompressionStream extends TransformStream<
|
|
|
1501
1512
|
ArrayBuffer | ArrayBufferView,
|
|
1502
1513
|
Uint8Array
|
|
1503
1514
|
> {
|
|
1504
|
-
constructor(format: "gzip" | "deflate");
|
|
1515
|
+
constructor(format: "gzip" | "deflate" | "deflate-raw");
|
|
1505
1516
|
}
|
|
1506
1517
|
declare class DecompressionStream extends TransformStream<
|
|
1507
1518
|
ArrayBuffer | ArrayBufferView,
|
|
1508
1519
|
Uint8Array
|
|
1509
1520
|
> {
|
|
1510
|
-
constructor(format: "gzip" | "deflate");
|
|
1521
|
+
constructor(format: "gzip" | "deflate" | "deflate-raw");
|
|
1511
1522
|
}
|
|
1512
1523
|
declare class TextEncoderStream extends TransformStream<string, Uint8Array> {
|
|
1513
1524
|
constructor();
|
|
@@ -1646,6 +1657,7 @@ declare class URLSearchParams {
|
|
|
1646
1657
|
| Record<string, string>
|
|
1647
1658
|
| [key: string, value: string][]
|
|
1648
1659
|
);
|
|
1660
|
+
get size(): number;
|
|
1649
1661
|
append(name: string, value: string): void;
|
|
1650
1662
|
delete(name: string): void;
|
|
1651
1663
|
get(name: string): string | null;
|
|
@@ -2130,6 +2142,10 @@ declare interface IncomingRequestCfPropertiesBotManagementBase {
|
|
|
2130
2142
|
* A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources.
|
|
2131
2143
|
*/
|
|
2132
2144
|
staticResource: boolean;
|
|
2145
|
+
/**
|
|
2146
|
+
* List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request).
|
|
2147
|
+
*/
|
|
2148
|
+
detectionIds: number[];
|
|
2133
2149
|
}
|
|
2134
2150
|
declare interface IncomingRequestCfPropertiesBotManagement {
|
|
2135
2151
|
/**
|
|
@@ -2712,7 +2728,7 @@ declare abstract class D1PreparedStatement {
|
|
|
2712
2728
|
/**
|
|
2713
2729
|
* A email message that is sent to a consumer Worker.
|
|
2714
2730
|
*/
|
|
2715
|
-
declare interface EmailMessage
|
|
2731
|
+
declare interface EmailMessage {
|
|
2716
2732
|
/**
|
|
2717
2733
|
* Envelope From attribute of the email message.
|
|
2718
2734
|
*/
|
|
@@ -2801,6 +2817,40 @@ declare type PagesPluginFunction<
|
|
|
2801
2817
|
declare module "assets:*" {
|
|
2802
2818
|
export const onRequest: PagesFunction;
|
|
2803
2819
|
}
|
|
2820
|
+
// https://developers.cloudflare.com/pub-sub/
|
|
2821
|
+
// PubSubMessage represents an incoming PubSub message.
|
|
2822
|
+
// The message includes metadata about the broker, the client, and the payload
|
|
2823
|
+
// itself.
|
|
2824
|
+
declare interface PubSubMessage {
|
|
2825
|
+
// Message ID
|
|
2826
|
+
readonly mid: number;
|
|
2827
|
+
// MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
|
|
2828
|
+
readonly broker: string;
|
|
2829
|
+
// The MQTT topic the message was sent on.
|
|
2830
|
+
readonly topic: string;
|
|
2831
|
+
// The client ID of the client that published this message.
|
|
2832
|
+
readonly clientId: string;
|
|
2833
|
+
// The unique identifier (JWT ID) used by the client to authenticate, if token
|
|
2834
|
+
// auth was used.
|
|
2835
|
+
readonly jti?: string;
|
|
2836
|
+
// A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
|
|
2837
|
+
// received the message from the client.
|
|
2838
|
+
readonly receivedAt: number;
|
|
2839
|
+
// An (optional) string with the MIME type of the payload, if set by the
|
|
2840
|
+
// client.
|
|
2841
|
+
readonly contentType: string;
|
|
2842
|
+
// Set to 1 when the payload is a UTF-8 string
|
|
2843
|
+
// https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
|
|
2844
|
+
readonly payloadFormatIndicator: number;
|
|
2845
|
+
// Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
|
|
2846
|
+
// You can use payloadFormatIndicator to inspect this before decoding.
|
|
2847
|
+
payload: string | Uint8Array;
|
|
2848
|
+
}
|
|
2849
|
+
// JsonWebKey extended by kid parameter
|
|
2850
|
+
declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
2851
|
+
// Key Identifier of the JWK
|
|
2852
|
+
readonly kid: string;
|
|
2853
|
+
}
|
|
2804
2854
|
/**
|
|
2805
2855
|
* A message that is sent to a consumer Worker.
|
|
2806
2856
|
*/
|
|
@@ -2817,6 +2867,14 @@ declare interface Message<Body = unknown> {
|
|
|
2817
2867
|
* The body of the message.
|
|
2818
2868
|
*/
|
|
2819
2869
|
readonly body: Body;
|
|
2870
|
+
/**
|
|
2871
|
+
* Marks message to be retried.
|
|
2872
|
+
*/
|
|
2873
|
+
retry(): void;
|
|
2874
|
+
/**
|
|
2875
|
+
* Marks message acknowledged.
|
|
2876
|
+
*/
|
|
2877
|
+
ack(): void;
|
|
2820
2878
|
}
|
|
2821
2879
|
/**
|
|
2822
2880
|
* A batch of messages that are sent to a consumer Worker.
|
|
@@ -2834,6 +2892,10 @@ declare interface MessageBatch<Body = unknown> {
|
|
|
2834
2892
|
* Marks every message to be retried in the next batch.
|
|
2835
2893
|
*/
|
|
2836
2894
|
retryAll(): void;
|
|
2895
|
+
/**
|
|
2896
|
+
* Marks every message acknowledged in the batch.
|
|
2897
|
+
*/
|
|
2898
|
+
ackAll(): void;
|
|
2837
2899
|
}
|
|
2838
2900
|
/**
|
|
2839
2901
|
* A wrapper class used to structure message batches.
|
package/2022-01-31/index.ts
CHANGED
|
@@ -281,6 +281,7 @@ export declare const self: ServiceWorkerGlobalScope;
|
|
|
281
281
|
export declare const crypto: Crypto;
|
|
282
282
|
export declare const caches: CacheStorage;
|
|
283
283
|
export declare const scheduler: Scheduler;
|
|
284
|
+
export interface TestController {}
|
|
284
285
|
export interface ExecutionContext {
|
|
285
286
|
waitUntil(promise: Promise<any>): void;
|
|
286
287
|
passThroughOnException(): void;
|
|
@@ -305,10 +306,16 @@ export type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
|
|
|
305
306
|
env: Env,
|
|
306
307
|
ctx: ExecutionContext
|
|
307
308
|
) => void | Promise<void>;
|
|
309
|
+
export type ExportedHandlerTestHandler<Env = unknown> = (
|
|
310
|
+
controller: TestController,
|
|
311
|
+
env: Env,
|
|
312
|
+
ctx: ExecutionContext
|
|
313
|
+
) => void | Promise<void>;
|
|
308
314
|
export interface ExportedHandler<Env = unknown, QueueMessage = unknown> {
|
|
309
315
|
fetch?: ExportedHandlerFetchHandler<Env>;
|
|
310
316
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
311
317
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
318
|
+
test?: ExportedHandlerTestHandler<Env>;
|
|
312
319
|
queue?: ExportedHandlerQueueHandler<Env, QueueMessage>;
|
|
313
320
|
}
|
|
314
321
|
export interface StructuredSerializeOptions {
|
|
@@ -988,6 +995,8 @@ export declare class Request<CfHostMetadata = unknown> extends Body {
|
|
|
988
995
|
get fetcher(): Fetcher | null;
|
|
989
996
|
get signal(): AbortSignal;
|
|
990
997
|
get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
|
|
998
|
+
get integrity(): string;
|
|
999
|
+
get keepalive(): boolean;
|
|
991
1000
|
}
|
|
992
1001
|
export interface RequestInit<
|
|
993
1002
|
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
@@ -1002,6 +1011,8 @@ export interface RequestInit<
|
|
|
1002
1011
|
redirect?: string;
|
|
1003
1012
|
fetcher?: Fetcher | null;
|
|
1004
1013
|
cf?: CfType;
|
|
1014
|
+
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1015
|
+
integrity?: string;
|
|
1005
1016
|
/** An AbortSignal to set request's signal. */
|
|
1006
1017
|
signal?: AbortSignal | null;
|
|
1007
1018
|
}
|
|
@@ -1053,11 +1064,11 @@ export interface KVNamespace<Key extends string = string> {
|
|
|
1053
1064
|
get(
|
|
1054
1065
|
key: Key,
|
|
1055
1066
|
options?: KVNamespaceGetOptions<"arrayBuffer">
|
|
1056
|
-
): Promise<
|
|
1067
|
+
): Promise<ArrayBuffer | null>;
|
|
1057
1068
|
get(
|
|
1058
1069
|
key: Key,
|
|
1059
1070
|
options?: KVNamespaceGetOptions<"stream">
|
|
1060
|
-
): Promise<
|
|
1071
|
+
): Promise<ReadableStream | null>;
|
|
1061
1072
|
list<Metadata = unknown>(
|
|
1062
1073
|
options?: KVNamespaceListOptions
|
|
1063
1074
|
): Promise<KVNamespaceListResult<Metadata, Key>>;
|
|
@@ -1503,13 +1514,13 @@ export declare class CompressionStream extends TransformStream<
|
|
|
1503
1514
|
ArrayBuffer | ArrayBufferView,
|
|
1504
1515
|
Uint8Array
|
|
1505
1516
|
> {
|
|
1506
|
-
constructor(format: "gzip" | "deflate");
|
|
1517
|
+
constructor(format: "gzip" | "deflate" | "deflate-raw");
|
|
1507
1518
|
}
|
|
1508
1519
|
export declare class DecompressionStream extends TransformStream<
|
|
1509
1520
|
ArrayBuffer | ArrayBufferView,
|
|
1510
1521
|
Uint8Array
|
|
1511
1522
|
> {
|
|
1512
|
-
constructor(format: "gzip" | "deflate");
|
|
1523
|
+
constructor(format: "gzip" | "deflate" | "deflate-raw");
|
|
1513
1524
|
}
|
|
1514
1525
|
export declare class TextEncoderStream extends TransformStream<
|
|
1515
1526
|
string,
|
|
@@ -1651,6 +1662,7 @@ export declare class URLSearchParams {
|
|
|
1651
1662
|
| Record<string, string>
|
|
1652
1663
|
| [key: string, value: string][]
|
|
1653
1664
|
);
|
|
1665
|
+
get size(): number;
|
|
1654
1666
|
append(name: string, value: string): void;
|
|
1655
1667
|
delete(name: string): void;
|
|
1656
1668
|
get(name: string): string | null;
|
|
@@ -2135,6 +2147,10 @@ export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
|
2135
2147
|
* A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources.
|
|
2136
2148
|
*/
|
|
2137
2149
|
staticResource: boolean;
|
|
2150
|
+
/**
|
|
2151
|
+
* List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request).
|
|
2152
|
+
*/
|
|
2153
|
+
detectionIds: number[];
|
|
2138
2154
|
}
|
|
2139
2155
|
export interface IncomingRequestCfPropertiesBotManagement {
|
|
2140
2156
|
/**
|
|
@@ -2717,7 +2733,7 @@ export declare abstract class D1PreparedStatement {
|
|
|
2717
2733
|
/**
|
|
2718
2734
|
* A email message that is sent to a consumer Worker.
|
|
2719
2735
|
*/
|
|
2720
|
-
export interface EmailMessage
|
|
2736
|
+
export interface EmailMessage {
|
|
2721
2737
|
/**
|
|
2722
2738
|
* Envelope From attribute of the email message.
|
|
2723
2739
|
*/
|
|
@@ -2803,6 +2819,40 @@ export type PagesPluginFunction<
|
|
|
2803
2819
|
> = (
|
|
2804
2820
|
context: EventPluginContext<Env, Params, Data, PluginArgs>
|
|
2805
2821
|
) => Response | Promise<Response>;
|
|
2822
|
+
// https://developers.cloudflare.com/pub-sub/
|
|
2823
|
+
// PubSubMessage represents an incoming PubSub message.
|
|
2824
|
+
// The message includes metadata about the broker, the client, and the payload
|
|
2825
|
+
// itself.
|
|
2826
|
+
export interface PubSubMessage {
|
|
2827
|
+
// Message ID
|
|
2828
|
+
readonly mid: number;
|
|
2829
|
+
// MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
|
|
2830
|
+
readonly broker: string;
|
|
2831
|
+
// The MQTT topic the message was sent on.
|
|
2832
|
+
readonly topic: string;
|
|
2833
|
+
// The client ID of the client that published this message.
|
|
2834
|
+
readonly clientId: string;
|
|
2835
|
+
// The unique identifier (JWT ID) used by the client to authenticate, if token
|
|
2836
|
+
// auth was used.
|
|
2837
|
+
readonly jti?: string;
|
|
2838
|
+
// A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
|
|
2839
|
+
// received the message from the client.
|
|
2840
|
+
readonly receivedAt: number;
|
|
2841
|
+
// An (optional) string with the MIME type of the payload, if set by the
|
|
2842
|
+
// client.
|
|
2843
|
+
readonly contentType: string;
|
|
2844
|
+
// Set to 1 when the payload is a UTF-8 string
|
|
2845
|
+
// https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
|
|
2846
|
+
readonly payloadFormatIndicator: number;
|
|
2847
|
+
// Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
|
|
2848
|
+
// You can use payloadFormatIndicator to inspect this before decoding.
|
|
2849
|
+
payload: string | Uint8Array;
|
|
2850
|
+
}
|
|
2851
|
+
// JsonWebKey extended by kid parameter
|
|
2852
|
+
export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
2853
|
+
// Key Identifier of the JWK
|
|
2854
|
+
readonly kid: string;
|
|
2855
|
+
}
|
|
2806
2856
|
/**
|
|
2807
2857
|
* A message that is sent to a consumer Worker.
|
|
2808
2858
|
*/
|
|
@@ -2819,6 +2869,14 @@ export interface Message<Body = unknown> {
|
|
|
2819
2869
|
* The body of the message.
|
|
2820
2870
|
*/
|
|
2821
2871
|
readonly body: Body;
|
|
2872
|
+
/**
|
|
2873
|
+
* Marks message to be retried.
|
|
2874
|
+
*/
|
|
2875
|
+
retry(): void;
|
|
2876
|
+
/**
|
|
2877
|
+
* Marks message acknowledged.
|
|
2878
|
+
*/
|
|
2879
|
+
ack(): void;
|
|
2822
2880
|
}
|
|
2823
2881
|
/**
|
|
2824
2882
|
* A batch of messages that are sent to a consumer Worker.
|
|
@@ -2836,6 +2894,10 @@ export interface MessageBatch<Body = unknown> {
|
|
|
2836
2894
|
* Marks every message to be retried in the next batch.
|
|
2837
2895
|
*/
|
|
2838
2896
|
retryAll(): void;
|
|
2897
|
+
/**
|
|
2898
|
+
* Marks every message acknowledged in the batch.
|
|
2899
|
+
*/
|
|
2900
|
+
ackAll(): void;
|
|
2839
2901
|
}
|
|
2840
2902
|
/**
|
|
2841
2903
|
* A wrapper class used to structure message batches.
|