@cloudflare/workers-types 0.20230115.0 → 0.20230215.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.
@@ -1004,6 +1004,10 @@ declare class Request<CfHostMetadata = unknown> extends Body {
1004
1004
  /** 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
1005
  readonly signal: AbortSignal;
1006
1006
  readonly cf?: IncomingRequestCfProperties<CfHostMetadata>;
1007
+ /** 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] */
1008
+ readonly integrity: string;
1009
+ /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
1010
+ readonly keepalive: boolean;
1007
1011
  }
1008
1012
  declare interface RequestInit<
1009
1013
  CfType = IncomingRequestCfProperties | RequestInitCfProperties
@@ -1018,6 +1022,8 @@ declare interface RequestInit<
1018
1022
  redirect?: string;
1019
1023
  fetcher?: Fetcher | null;
1020
1024
  cf?: CfType;
1025
+ /** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1026
+ integrity?: string;
1021
1027
  /** An AbortSignal to set request's signal. */
1022
1028
  signal?: AbortSignal | null;
1023
1029
  }
@@ -1069,11 +1075,11 @@ declare interface KVNamespace<Key extends string = string> {
1069
1075
  get(
1070
1076
  key: Key,
1071
1077
  options?: KVNamespaceGetOptions<"arrayBuffer">
1072
- ): Promise<string | null>;
1078
+ ): Promise<ArrayBuffer | null>;
1073
1079
  get(
1074
1080
  key: Key,
1075
1081
  options?: KVNamespaceGetOptions<"stream">
1076
- ): Promise<string | null>;
1082
+ ): Promise<ReadableStream | null>;
1077
1083
  list<Metadata = unknown>(
1078
1084
  options?: KVNamespaceListOptions
1079
1085
  ): Promise<KVNamespaceListResult<Metadata, Key>>;
@@ -2813,6 +2819,40 @@ declare type PagesPluginFunction<
2813
2819
  declare module "assets:*" {
2814
2820
  export const onRequest: PagesFunction;
2815
2821
  }
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
+ declare 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
+ declare interface JsonWebKeyWithKid extends JsonWebKey {
2853
+ // Key Identifier of the JWK
2854
+ readonly kid: string;
2855
+ }
2816
2856
  /**
2817
2857
  * A message that is sent to a consumer Worker.
2818
2858
  */
@@ -2829,6 +2869,14 @@ declare interface Message<Body = unknown> {
2829
2869
  * The body of the message.
2830
2870
  */
2831
2871
  readonly body: Body;
2872
+ /**
2873
+ * Marks message to be retried.
2874
+ */
2875
+ retry(): void;
2876
+ /**
2877
+ * Marks message acknowledged.
2878
+ */
2879
+ ack(): void;
2832
2880
  }
2833
2881
  /**
2834
2882
  * A batch of messages that are sent to a consumer Worker.
@@ -2846,6 +2894,10 @@ declare interface MessageBatch<Body = unknown> {
2846
2894
  * Marks every message to be retried in the next batch.
2847
2895
  */
2848
2896
  retryAll(): void;
2897
+ /**
2898
+ * Marks every message acknowledged in the batch.
2899
+ */
2900
+ ackAll(): void;
2849
2901
  }
2850
2902
  /**
2851
2903
  * A wrapper class used to structure message batches.
@@ -1006,6 +1006,10 @@ export declare class Request<CfHostMetadata = unknown> extends Body {
1006
1006
  /** 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
1007
  readonly signal: AbortSignal;
1008
1008
  readonly cf?: IncomingRequestCfProperties<CfHostMetadata>;
1009
+ /** 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] */
1010
+ readonly integrity: string;
1011
+ /** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
1012
+ readonly keepalive: boolean;
1009
1013
  }
1010
1014
  export interface RequestInit<
1011
1015
  CfType = IncomingRequestCfProperties | RequestInitCfProperties
@@ -1020,6 +1024,8 @@ export interface RequestInit<
1020
1024
  redirect?: string;
1021
1025
  fetcher?: Fetcher | null;
1022
1026
  cf?: CfType;
1027
+ /** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1028
+ integrity?: string;
1023
1029
  /** An AbortSignal to set request's signal. */
1024
1030
  signal?: AbortSignal | null;
1025
1031
  }
@@ -1071,11 +1077,11 @@ export interface KVNamespace<Key extends string = string> {
1071
1077
  get(
1072
1078
  key: Key,
1073
1079
  options?: KVNamespaceGetOptions<"arrayBuffer">
1074
- ): Promise<string | null>;
1080
+ ): Promise<ArrayBuffer | null>;
1075
1081
  get(
1076
1082
  key: Key,
1077
1083
  options?: KVNamespaceGetOptions<"stream">
1078
- ): Promise<string | null>;
1084
+ ): Promise<ReadableStream | null>;
1079
1085
  list<Metadata = unknown>(
1080
1086
  options?: KVNamespaceListOptions
1081
1087
  ): Promise<KVNamespaceListResult<Metadata, Key>>;
@@ -2815,6 +2821,40 @@ export type PagesPluginFunction<
2815
2821
  > = (
2816
2822
  context: EventPluginContext<Env, Params, Data, PluginArgs>
2817
2823
  ) => Response | Promise<Response>;
2824
+ // https://developers.cloudflare.com/pub-sub/
2825
+ // PubSubMessage represents an incoming PubSub message.
2826
+ // The message includes metadata about the broker, the client, and the payload
2827
+ // itself.
2828
+ export interface PubSubMessage {
2829
+ // Message ID
2830
+ readonly mid: number;
2831
+ // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
2832
+ readonly broker: string;
2833
+ // The MQTT topic the message was sent on.
2834
+ readonly topic: string;
2835
+ // The client ID of the client that published this message.
2836
+ readonly clientId: string;
2837
+ // The unique identifier (JWT ID) used by the client to authenticate, if token
2838
+ // auth was used.
2839
+ readonly jti?: string;
2840
+ // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
2841
+ // received the message from the client.
2842
+ readonly receivedAt: number;
2843
+ // An (optional) string with the MIME type of the payload, if set by the
2844
+ // client.
2845
+ readonly contentType: string;
2846
+ // Set to 1 when the payload is a UTF-8 string
2847
+ // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
2848
+ readonly payloadFormatIndicator: number;
2849
+ // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
2850
+ // You can use payloadFormatIndicator to inspect this before decoding.
2851
+ payload: string | Uint8Array;
2852
+ }
2853
+ // JsonWebKey extended by kid parameter
2854
+ export interface JsonWebKeyWithKid extends JsonWebKey {
2855
+ // Key Identifier of the JWK
2856
+ readonly kid: string;
2857
+ }
2818
2858
  /**
2819
2859
  * A message that is sent to a consumer Worker.
2820
2860
  */
@@ -2831,6 +2871,14 @@ export interface Message<Body = unknown> {
2831
2871
  * The body of the message.
2832
2872
  */
2833
2873
  readonly body: Body;
2874
+ /**
2875
+ * Marks message to be retried.
2876
+ */
2877
+ retry(): void;
2878
+ /**
2879
+ * Marks message acknowledged.
2880
+ */
2881
+ ack(): void;
2834
2882
  }
2835
2883
  /**
2836
2884
  * A batch of messages that are sent to a consumer Worker.
@@ -2848,6 +2896,10 @@ export interface MessageBatch<Body = unknown> {
2848
2896
  * Marks every message to be retried in the next batch.
2849
2897
  */
2850
2898
  retryAll(): void;
2899
+ /**
2900
+ * Marks every message acknowledged in the batch.
2901
+ */
2902
+ ackAll(): void;
2851
2903
  }
2852
2904
  /**
2853
2905
  * A wrapper class used to structure message batches.
@@ -986,6 +986,8 @@ declare class Request<CfHostMetadata = unknown> extends Body {
986
986
  get fetcher(): Fetcher | null;
987
987
  get signal(): AbortSignal;
988
988
  get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
989
+ get integrity(): string;
990
+ get keepalive(): boolean;
989
991
  }
990
992
  declare interface RequestInit<
991
993
  CfType = IncomingRequestCfProperties | RequestInitCfProperties
@@ -1000,6 +1002,8 @@ declare interface RequestInit<
1000
1002
  redirect?: string;
1001
1003
  fetcher?: Fetcher | null;
1002
1004
  cf?: CfType;
1005
+ /** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1006
+ integrity?: string;
1003
1007
  /** An AbortSignal to set request's signal. */
1004
1008
  signal?: AbortSignal | null;
1005
1009
  }
@@ -1051,11 +1055,11 @@ declare interface KVNamespace<Key extends string = string> {
1051
1055
  get(
1052
1056
  key: Key,
1053
1057
  options?: KVNamespaceGetOptions<"arrayBuffer">
1054
- ): Promise<string | null>;
1058
+ ): Promise<ArrayBuffer | null>;
1055
1059
  get(
1056
1060
  key: Key,
1057
1061
  options?: KVNamespaceGetOptions<"stream">
1058
- ): Promise<string | null>;
1062
+ ): Promise<ReadableStream | null>;
1059
1063
  list<Metadata = unknown>(
1060
1064
  options?: KVNamespaceListOptions
1061
1065
  ): Promise<KVNamespaceListResult<Metadata, Key>>;
@@ -2801,6 +2805,40 @@ declare type PagesPluginFunction<
2801
2805
  declare module "assets:*" {
2802
2806
  export const onRequest: PagesFunction;
2803
2807
  }
2808
+ // https://developers.cloudflare.com/pub-sub/
2809
+ // PubSubMessage represents an incoming PubSub message.
2810
+ // The message includes metadata about the broker, the client, and the payload
2811
+ // itself.
2812
+ declare interface PubSubMessage {
2813
+ // Message ID
2814
+ readonly mid: number;
2815
+ // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
2816
+ readonly broker: string;
2817
+ // The MQTT topic the message was sent on.
2818
+ readonly topic: string;
2819
+ // The client ID of the client that published this message.
2820
+ readonly clientId: string;
2821
+ // The unique identifier (JWT ID) used by the client to authenticate, if token
2822
+ // auth was used.
2823
+ readonly jti?: string;
2824
+ // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
2825
+ // received the message from the client.
2826
+ readonly receivedAt: number;
2827
+ // An (optional) string with the MIME type of the payload, if set by the
2828
+ // client.
2829
+ readonly contentType: string;
2830
+ // Set to 1 when the payload is a UTF-8 string
2831
+ // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
2832
+ readonly payloadFormatIndicator: number;
2833
+ // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
2834
+ // You can use payloadFormatIndicator to inspect this before decoding.
2835
+ payload: string | Uint8Array;
2836
+ }
2837
+ // JsonWebKey extended by kid parameter
2838
+ declare interface JsonWebKeyWithKid extends JsonWebKey {
2839
+ // Key Identifier of the JWK
2840
+ readonly kid: string;
2841
+ }
2804
2842
  /**
2805
2843
  * A message that is sent to a consumer Worker.
2806
2844
  */
@@ -2817,6 +2855,14 @@ declare interface Message<Body = unknown> {
2817
2855
  * The body of the message.
2818
2856
  */
2819
2857
  readonly body: Body;
2858
+ /**
2859
+ * Marks message to be retried.
2860
+ */
2861
+ retry(): void;
2862
+ /**
2863
+ * Marks message acknowledged.
2864
+ */
2865
+ ack(): void;
2820
2866
  }
2821
2867
  /**
2822
2868
  * A batch of messages that are sent to a consumer Worker.
@@ -2834,6 +2880,10 @@ declare interface MessageBatch<Body = unknown> {
2834
2880
  * Marks every message to be retried in the next batch.
2835
2881
  */
2836
2882
  retryAll(): void;
2883
+ /**
2884
+ * Marks every message acknowledged in the batch.
2885
+ */
2886
+ ackAll(): void;
2837
2887
  }
2838
2888
  /**
2839
2889
  * A wrapper class used to structure message batches.
@@ -988,6 +988,8 @@ export declare class Request<CfHostMetadata = unknown> extends Body {
988
988
  get fetcher(): Fetcher | null;
989
989
  get signal(): AbortSignal;
990
990
  get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
991
+ get integrity(): string;
992
+ get keepalive(): boolean;
991
993
  }
992
994
  export interface RequestInit<
993
995
  CfType = IncomingRequestCfProperties | RequestInitCfProperties
@@ -1002,6 +1004,8 @@ export interface RequestInit<
1002
1004
  redirect?: string;
1003
1005
  fetcher?: Fetcher | null;
1004
1006
  cf?: CfType;
1007
+ /** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1008
+ integrity?: string;
1005
1009
  /** An AbortSignal to set request's signal. */
1006
1010
  signal?: AbortSignal | null;
1007
1011
  }
@@ -1053,11 +1057,11 @@ export interface KVNamespace<Key extends string = string> {
1053
1057
  get(
1054
1058
  key: Key,
1055
1059
  options?: KVNamespaceGetOptions<"arrayBuffer">
1056
- ): Promise<string | null>;
1060
+ ): Promise<ArrayBuffer | null>;
1057
1061
  get(
1058
1062
  key: Key,
1059
1063
  options?: KVNamespaceGetOptions<"stream">
1060
- ): Promise<string | null>;
1064
+ ): Promise<ReadableStream | null>;
1061
1065
  list<Metadata = unknown>(
1062
1066
  options?: KVNamespaceListOptions
1063
1067
  ): Promise<KVNamespaceListResult<Metadata, Key>>;
@@ -2803,6 +2807,40 @@ export type PagesPluginFunction<
2803
2807
  > = (
2804
2808
  context: EventPluginContext<Env, Params, Data, PluginArgs>
2805
2809
  ) => Response | Promise<Response>;
2810
+ // https://developers.cloudflare.com/pub-sub/
2811
+ // PubSubMessage represents an incoming PubSub message.
2812
+ // The message includes metadata about the broker, the client, and the payload
2813
+ // itself.
2814
+ export interface PubSubMessage {
2815
+ // Message ID
2816
+ readonly mid: number;
2817
+ // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
2818
+ readonly broker: string;
2819
+ // The MQTT topic the message was sent on.
2820
+ readonly topic: string;
2821
+ // The client ID of the client that published this message.
2822
+ readonly clientId: string;
2823
+ // The unique identifier (JWT ID) used by the client to authenticate, if token
2824
+ // auth was used.
2825
+ readonly jti?: string;
2826
+ // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
2827
+ // received the message from the client.
2828
+ readonly receivedAt: number;
2829
+ // An (optional) string with the MIME type of the payload, if set by the
2830
+ // client.
2831
+ readonly contentType: string;
2832
+ // Set to 1 when the payload is a UTF-8 string
2833
+ // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
2834
+ readonly payloadFormatIndicator: number;
2835
+ // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
2836
+ // You can use payloadFormatIndicator to inspect this before decoding.
2837
+ payload: string | Uint8Array;
2838
+ }
2839
+ // JsonWebKey extended by kid parameter
2840
+ export interface JsonWebKeyWithKid extends JsonWebKey {
2841
+ // Key Identifier of the JWK
2842
+ readonly kid: string;
2843
+ }
2806
2844
  /**
2807
2845
  * A message that is sent to a consumer Worker.
2808
2846
  */
@@ -2819,6 +2857,14 @@ export interface Message<Body = unknown> {
2819
2857
  * The body of the message.
2820
2858
  */
2821
2859
  readonly body: Body;
2860
+ /**
2861
+ * Marks message to be retried.
2862
+ */
2863
+ retry(): void;
2864
+ /**
2865
+ * Marks message acknowledged.
2866
+ */
2867
+ ack(): void;
2822
2868
  }
2823
2869
  /**
2824
2870
  * A batch of messages that are sent to a consumer Worker.
@@ -2836,6 +2882,10 @@ export interface MessageBatch<Body = unknown> {
2836
2882
  * Marks every message to be retried in the next batch.
2837
2883
  */
2838
2884
  retryAll(): void;
2885
+ /**
2886
+ * Marks every message acknowledged in the batch.
2887
+ */
2888
+ ackAll(): void;
2839
2889
  }
2840
2890
  /**
2841
2891
  * A wrapper class used to structure message batches.
@@ -992,6 +992,8 @@ declare class Request<CfHostMetadata = unknown> extends Body {
992
992
  get fetcher(): Fetcher | null;
993
993
  get signal(): AbortSignal;
994
994
  get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
995
+ get integrity(): string;
996
+ get keepalive(): boolean;
995
997
  }
996
998
  declare interface RequestInit<
997
999
  CfType = IncomingRequestCfProperties | RequestInitCfProperties
@@ -1006,6 +1008,8 @@ declare interface RequestInit<
1006
1008
  redirect?: string;
1007
1009
  fetcher?: Fetcher | null;
1008
1010
  cf?: CfType;
1011
+ /** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1012
+ integrity?: string;
1009
1013
  /** An AbortSignal to set request's signal. */
1010
1014
  signal?: AbortSignal | null;
1011
1015
  }
@@ -1057,11 +1061,11 @@ declare interface KVNamespace<Key extends string = string> {
1057
1061
  get(
1058
1062
  key: Key,
1059
1063
  options?: KVNamespaceGetOptions<"arrayBuffer">
1060
- ): Promise<string | null>;
1064
+ ): Promise<ArrayBuffer | null>;
1061
1065
  get(
1062
1066
  key: Key,
1063
1067
  options?: KVNamespaceGetOptions<"stream">
1064
- ): Promise<string | null>;
1068
+ ): Promise<ReadableStream | null>;
1065
1069
  list<Metadata = unknown>(
1066
1070
  options?: KVNamespaceListOptions
1067
1071
  ): Promise<KVNamespaceListResult<Metadata, Key>>;
@@ -2807,6 +2811,40 @@ declare type PagesPluginFunction<
2807
2811
  declare module "assets:*" {
2808
2812
  export const onRequest: PagesFunction;
2809
2813
  }
2814
+ // https://developers.cloudflare.com/pub-sub/
2815
+ // PubSubMessage represents an incoming PubSub message.
2816
+ // The message includes metadata about the broker, the client, and the payload
2817
+ // itself.
2818
+ declare interface PubSubMessage {
2819
+ // Message ID
2820
+ readonly mid: number;
2821
+ // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
2822
+ readonly broker: string;
2823
+ // The MQTT topic the message was sent on.
2824
+ readonly topic: string;
2825
+ // The client ID of the client that published this message.
2826
+ readonly clientId: string;
2827
+ // The unique identifier (JWT ID) used by the client to authenticate, if token
2828
+ // auth was used.
2829
+ readonly jti?: string;
2830
+ // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
2831
+ // received the message from the client.
2832
+ readonly receivedAt: number;
2833
+ // An (optional) string with the MIME type of the payload, if set by the
2834
+ // client.
2835
+ readonly contentType: string;
2836
+ // Set to 1 when the payload is a UTF-8 string
2837
+ // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
2838
+ readonly payloadFormatIndicator: number;
2839
+ // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
2840
+ // You can use payloadFormatIndicator to inspect this before decoding.
2841
+ payload: string | Uint8Array;
2842
+ }
2843
+ // JsonWebKey extended by kid parameter
2844
+ declare interface JsonWebKeyWithKid extends JsonWebKey {
2845
+ // Key Identifier of the JWK
2846
+ readonly kid: string;
2847
+ }
2810
2848
  /**
2811
2849
  * A message that is sent to a consumer Worker.
2812
2850
  */
@@ -2823,6 +2861,14 @@ declare interface Message<Body = unknown> {
2823
2861
  * The body of the message.
2824
2862
  */
2825
2863
  readonly body: Body;
2864
+ /**
2865
+ * Marks message to be retried.
2866
+ */
2867
+ retry(): void;
2868
+ /**
2869
+ * Marks message acknowledged.
2870
+ */
2871
+ ack(): void;
2826
2872
  }
2827
2873
  /**
2828
2874
  * A batch of messages that are sent to a consumer Worker.
@@ -2840,6 +2886,10 @@ declare interface MessageBatch<Body = unknown> {
2840
2886
  * Marks every message to be retried in the next batch.
2841
2887
  */
2842
2888
  retryAll(): void;
2889
+ /**
2890
+ * Marks every message acknowledged in the batch.
2891
+ */
2892
+ ackAll(): void;
2843
2893
  }
2844
2894
  /**
2845
2895
  * A wrapper class used to structure message batches.
@@ -994,6 +994,8 @@ export declare class Request<CfHostMetadata = unknown> extends Body {
994
994
  get fetcher(): Fetcher | null;
995
995
  get signal(): AbortSignal;
996
996
  get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
997
+ get integrity(): string;
998
+ get keepalive(): boolean;
997
999
  }
998
1000
  export interface RequestInit<
999
1001
  CfType = IncomingRequestCfProperties | RequestInitCfProperties
@@ -1008,6 +1010,8 @@ export interface RequestInit<
1008
1010
  redirect?: string;
1009
1011
  fetcher?: Fetcher | null;
1010
1012
  cf?: CfType;
1013
+ /** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1014
+ integrity?: string;
1011
1015
  /** An AbortSignal to set request's signal. */
1012
1016
  signal?: AbortSignal | null;
1013
1017
  }
@@ -1059,11 +1063,11 @@ export interface KVNamespace<Key extends string = string> {
1059
1063
  get(
1060
1064
  key: Key,
1061
1065
  options?: KVNamespaceGetOptions<"arrayBuffer">
1062
- ): Promise<string | null>;
1066
+ ): Promise<ArrayBuffer | null>;
1063
1067
  get(
1064
1068
  key: Key,
1065
1069
  options?: KVNamespaceGetOptions<"stream">
1066
- ): Promise<string | null>;
1070
+ ): Promise<ReadableStream | null>;
1067
1071
  list<Metadata = unknown>(
1068
1072
  options?: KVNamespaceListOptions
1069
1073
  ): Promise<KVNamespaceListResult<Metadata, Key>>;
@@ -2809,6 +2813,40 @@ export type PagesPluginFunction<
2809
2813
  > = (
2810
2814
  context: EventPluginContext<Env, Params, Data, PluginArgs>
2811
2815
  ) => Response | Promise<Response>;
2816
+ // https://developers.cloudflare.com/pub-sub/
2817
+ // PubSubMessage represents an incoming PubSub message.
2818
+ // The message includes metadata about the broker, the client, and the payload
2819
+ // itself.
2820
+ export interface PubSubMessage {
2821
+ // Message ID
2822
+ readonly mid: number;
2823
+ // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
2824
+ readonly broker: string;
2825
+ // The MQTT topic the message was sent on.
2826
+ readonly topic: string;
2827
+ // The client ID of the client that published this message.
2828
+ readonly clientId: string;
2829
+ // The unique identifier (JWT ID) used by the client to authenticate, if token
2830
+ // auth was used.
2831
+ readonly jti?: string;
2832
+ // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
2833
+ // received the message from the client.
2834
+ readonly receivedAt: number;
2835
+ // An (optional) string with the MIME type of the payload, if set by the
2836
+ // client.
2837
+ readonly contentType: string;
2838
+ // Set to 1 when the payload is a UTF-8 string
2839
+ // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
2840
+ readonly payloadFormatIndicator: number;
2841
+ // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
2842
+ // You can use payloadFormatIndicator to inspect this before decoding.
2843
+ payload: string | Uint8Array;
2844
+ }
2845
+ // JsonWebKey extended by kid parameter
2846
+ export interface JsonWebKeyWithKid extends JsonWebKey {
2847
+ // Key Identifier of the JWK
2848
+ readonly kid: string;
2849
+ }
2812
2850
  /**
2813
2851
  * A message that is sent to a consumer Worker.
2814
2852
  */
@@ -2825,6 +2863,14 @@ export interface Message<Body = unknown> {
2825
2863
  * The body of the message.
2826
2864
  */
2827
2865
  readonly body: Body;
2866
+ /**
2867
+ * Marks message to be retried.
2868
+ */
2869
+ retry(): void;
2870
+ /**
2871
+ * Marks message acknowledged.
2872
+ */
2873
+ ack(): void;
2828
2874
  }
2829
2875
  /**
2830
2876
  * A batch of messages that are sent to a consumer Worker.
@@ -2842,6 +2888,10 @@ export interface MessageBatch<Body = unknown> {
2842
2888
  * Marks every message to be retried in the next batch.
2843
2889
  */
2844
2890
  retryAll(): void;
2891
+ /**
2892
+ * Marks every message acknowledged in the batch.
2893
+ */
2894
+ ackAll(): void;
2845
2895
  }
2846
2896
  /**
2847
2897
  * A wrapper class used to structure message batches.
@@ -992,6 +992,8 @@ declare class Request<CfHostMetadata = unknown> extends Body {
992
992
  get fetcher(): Fetcher | null;
993
993
  get signal(): AbortSignal;
994
994
  get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
995
+ get integrity(): string;
996
+ get keepalive(): boolean;
995
997
  }
996
998
  declare interface RequestInit<
997
999
  CfType = IncomingRequestCfProperties | RequestInitCfProperties
@@ -1006,6 +1008,8 @@ declare interface RequestInit<
1006
1008
  redirect?: string;
1007
1009
  fetcher?: Fetcher | null;
1008
1010
  cf?: CfType;
1011
+ /** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1012
+ integrity?: string;
1009
1013
  /** An AbortSignal to set request's signal. */
1010
1014
  signal?: AbortSignal | null;
1011
1015
  }
@@ -1057,11 +1061,11 @@ declare interface KVNamespace<Key extends string = string> {
1057
1061
  get(
1058
1062
  key: Key,
1059
1063
  options?: KVNamespaceGetOptions<"arrayBuffer">
1060
- ): Promise<string | null>;
1064
+ ): Promise<ArrayBuffer | null>;
1061
1065
  get(
1062
1066
  key: Key,
1063
1067
  options?: KVNamespaceGetOptions<"stream">
1064
- ): Promise<string | null>;
1068
+ ): Promise<ReadableStream | null>;
1065
1069
  list<Metadata = unknown>(
1066
1070
  options?: KVNamespaceListOptions
1067
1071
  ): Promise<KVNamespaceListResult<Metadata, Key>>;
@@ -2808,6 +2812,40 @@ declare type PagesPluginFunction<
2808
2812
  declare module "assets:*" {
2809
2813
  export const onRequest: PagesFunction;
2810
2814
  }
2815
+ // https://developers.cloudflare.com/pub-sub/
2816
+ // PubSubMessage represents an incoming PubSub message.
2817
+ // The message includes metadata about the broker, the client, and the payload
2818
+ // itself.
2819
+ declare interface PubSubMessage {
2820
+ // Message ID
2821
+ readonly mid: number;
2822
+ // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
2823
+ readonly broker: string;
2824
+ // The MQTT topic the message was sent on.
2825
+ readonly topic: string;
2826
+ // The client ID of the client that published this message.
2827
+ readonly clientId: string;
2828
+ // The unique identifier (JWT ID) used by the client to authenticate, if token
2829
+ // auth was used.
2830
+ readonly jti?: string;
2831
+ // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
2832
+ // received the message from the client.
2833
+ readonly receivedAt: number;
2834
+ // An (optional) string with the MIME type of the payload, if set by the
2835
+ // client.
2836
+ readonly contentType: string;
2837
+ // Set to 1 when the payload is a UTF-8 string
2838
+ // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
2839
+ readonly payloadFormatIndicator: number;
2840
+ // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
2841
+ // You can use payloadFormatIndicator to inspect this before decoding.
2842
+ payload: string | Uint8Array;
2843
+ }
2844
+ // JsonWebKey extended by kid parameter
2845
+ declare interface JsonWebKeyWithKid extends JsonWebKey {
2846
+ // Key Identifier of the JWK
2847
+ readonly kid: string;
2848
+ }
2811
2849
  /**
2812
2850
  * A message that is sent to a consumer Worker.
2813
2851
  */
@@ -2824,6 +2862,14 @@ declare interface Message<Body = unknown> {
2824
2862
  * The body of the message.
2825
2863
  */
2826
2864
  readonly body: Body;
2865
+ /**
2866
+ * Marks message to be retried.
2867
+ */
2868
+ retry(): void;
2869
+ /**
2870
+ * Marks message acknowledged.
2871
+ */
2872
+ ack(): void;
2827
2873
  }
2828
2874
  /**
2829
2875
  * A batch of messages that are sent to a consumer Worker.
@@ -2841,6 +2887,10 @@ declare interface MessageBatch<Body = unknown> {
2841
2887
  * Marks every message to be retried in the next batch.
2842
2888
  */
2843
2889
  retryAll(): void;
2890
+ /**
2891
+ * Marks every message acknowledged in the batch.
2892
+ */
2893
+ ackAll(): void;
2844
2894
  }
2845
2895
  /**
2846
2896
  * A wrapper class used to structure message batches.