@cloudflare/workers-types 4.20230115.0 → 4.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.
@@ -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<string | null>;
1085
+ ): Promise<ArrayBuffer | null>;
1073
1086
  get(
1074
1087
  key: Key,
1075
1088
  options?: KVNamespaceGetOptions<"stream">
1076
- ): Promise<string | null>;
1089
+ ): Promise<ReadableStream | null>;
1077
1090
  list<Metadata = unknown>(
1078
1091
  options?: KVNamespaceListOptions
1079
1092
  ): Promise<KVNamespaceListResult<Metadata, Key>>;
@@ -2863,6 +2876,14 @@ declare interface Message<Body = unknown> {
2863
2876
  * The body of the message.
2864
2877
  */
2865
2878
  readonly body: Body;
2879
+ /**
2880
+ * Marks message to be retried.
2881
+ */
2882
+ retry(): void;
2883
+ /**
2884
+ * Marks message acknowledged.
2885
+ */
2886
+ ack(): void;
2866
2887
  }
2867
2888
  /**
2868
2889
  * A batch of messages that are sent to a consumer Worker.
@@ -2880,6 +2901,10 @@ declare interface MessageBatch<Body = unknown> {
2880
2901
  * Marks every message to be retried in the next batch.
2881
2902
  */
2882
2903
  retryAll(): void;
2904
+ /**
2905
+ * Marks every message acknowledged in the batch.
2906
+ */
2907
+ ackAll(): void;
2883
2908
  }
2884
2909
  /**
2885
2910
  * A wrapper class used to structure message batches.
@@ -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<string | null>;
1087
+ ): Promise<ArrayBuffer | null>;
1075
1088
  get(
1076
1089
  key: Key,
1077
1090
  options?: KVNamespaceGetOptions<"stream">
1078
- ): Promise<string | null>;
1091
+ ): Promise<ReadableStream | null>;
1079
1092
  list<Metadata = unknown>(
1080
1093
  options?: KVNamespaceListOptions
1081
1094
  ): Promise<KVNamespaceListResult<Metadata, Key>>;
@@ -2865,6 +2878,14 @@ export interface Message<Body = unknown> {
2865
2878
  * The body of the message.
2866
2879
  */
2867
2880
  readonly body: Body;
2881
+ /**
2882
+ * Marks message to be retried.
2883
+ */
2884
+ retry(): void;
2885
+ /**
2886
+ * Marks message acknowledged.
2887
+ */
2888
+ ack(): void;
2868
2889
  }
2869
2890
  /**
2870
2891
  * A batch of messages that are sent to a consumer Worker.
@@ -2882,6 +2903,10 @@ export interface MessageBatch<Body = unknown> {
2882
2903
  * Marks every message to be retried in the next batch.
2883
2904
  */
2884
2905
  retryAll(): void;
2906
+ /**
2907
+ * Marks every message acknowledged in the batch.
2908
+ */
2909
+ ackAll(): void;
2885
2910
  }
2886
2911
  /**
2887
2912
  * A wrapper class used to structure message batches.
@@ -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<string | null>;
1065
+ ): Promise<ArrayBuffer | null>;
1055
1066
  get(
1056
1067
  key: Key,
1057
1068
  options?: KVNamespaceGetOptions<"stream">
1058
- ): Promise<string | null>;
1069
+ ): Promise<ReadableStream | null>;
1059
1070
  list<Metadata = unknown>(
1060
1071
  options?: KVNamespaceListOptions
1061
1072
  ): Promise<KVNamespaceListResult<Metadata, Key>>;
@@ -2851,6 +2862,14 @@ declare interface Message<Body = unknown> {
2851
2862
  * The body of the message.
2852
2863
  */
2853
2864
  readonly body: Body;
2865
+ /**
2866
+ * Marks message to be retried.
2867
+ */
2868
+ retry(): void;
2869
+ /**
2870
+ * Marks message acknowledged.
2871
+ */
2872
+ ack(): void;
2854
2873
  }
2855
2874
  /**
2856
2875
  * A batch of messages that are sent to a consumer Worker.
@@ -2868,6 +2887,10 @@ declare interface MessageBatch<Body = unknown> {
2868
2887
  * Marks every message to be retried in the next batch.
2869
2888
  */
2870
2889
  retryAll(): void;
2890
+ /**
2891
+ * Marks every message acknowledged in the batch.
2892
+ */
2893
+ ackAll(): void;
2871
2894
  }
2872
2895
  /**
2873
2896
  * A wrapper class used to structure message batches.
@@ -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<string | null>;
1067
+ ): Promise<ArrayBuffer | null>;
1057
1068
  get(
1058
1069
  key: Key,
1059
1070
  options?: KVNamespaceGetOptions<"stream">
1060
- ): Promise<string | null>;
1071
+ ): Promise<ReadableStream | null>;
1061
1072
  list<Metadata = unknown>(
1062
1073
  options?: KVNamespaceListOptions
1063
1074
  ): Promise<KVNamespaceListResult<Metadata, Key>>;
@@ -2853,6 +2864,14 @@ export interface Message<Body = unknown> {
2853
2864
  * The body of the message.
2854
2865
  */
2855
2866
  readonly body: Body;
2867
+ /**
2868
+ * Marks message to be retried.
2869
+ */
2870
+ retry(): void;
2871
+ /**
2872
+ * Marks message acknowledged.
2873
+ */
2874
+ ack(): void;
2856
2875
  }
2857
2876
  /**
2858
2877
  * A batch of messages that are sent to a consumer Worker.
@@ -2870,6 +2889,10 @@ export interface MessageBatch<Body = unknown> {
2870
2889
  * Marks every message to be retried in the next batch.
2871
2890
  */
2872
2891
  retryAll(): void;
2892
+ /**
2893
+ * Marks every message acknowledged in the batch.
2894
+ */
2895
+ ackAll(): void;
2873
2896
  }
2874
2897
  /**
2875
2898
  * A wrapper class used to structure message batches.
@@ -282,6 +282,7 @@ declare const crypto: Crypto;
282
282
  declare const caches: CacheStorage;
283
283
  declare const scheduler: Scheduler;
284
284
  declare const navigator: Navigator;
285
+ declare interface TestController {}
285
286
  declare interface ExecutionContext {
286
287
  waitUntil(promise: Promise<any>): void;
287
288
  passThroughOnException(): void;
@@ -306,10 +307,16 @@ declare type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
306
307
  env: Env,
307
308
  ctx: ExecutionContext
308
309
  ) => void | Promise<void>;
310
+ declare type ExportedHandlerTestHandler<Env = unknown> = (
311
+ controller: TestController,
312
+ env: Env,
313
+ ctx: ExecutionContext
314
+ ) => void | Promise<void>;
309
315
  declare interface ExportedHandler<Env = unknown, QueueMessage = unknown> {
310
316
  fetch?: ExportedHandlerFetchHandler<Env>;
311
317
  trace?: ExportedHandlerTraceHandler<Env>;
312
318
  scheduled?: ExportedHandlerScheduledHandler<Env>;
319
+ test?: ExportedHandlerTestHandler<Env>;
313
320
  queue?: ExportedHandlerQueueHandler<Env, QueueMessage>;
314
321
  }
315
322
  declare interface StructuredSerializeOptions {
@@ -992,6 +999,8 @@ declare class Request<CfHostMetadata = unknown> extends Body {
992
999
  get fetcher(): Fetcher | null;
993
1000
  get signal(): AbortSignal;
994
1001
  get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
1002
+ get integrity(): string;
1003
+ get keepalive(): boolean;
995
1004
  }
996
1005
  declare interface RequestInit<
997
1006
  CfType = IncomingRequestCfProperties | RequestInitCfProperties
@@ -1006,6 +1015,8 @@ declare interface RequestInit<
1006
1015
  redirect?: string;
1007
1016
  fetcher?: Fetcher | null;
1008
1017
  cf?: CfType;
1018
+ /** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1019
+ integrity?: string;
1009
1020
  /** An AbortSignal to set request's signal. */
1010
1021
  signal?: AbortSignal | null;
1011
1022
  }
@@ -1057,11 +1068,11 @@ declare interface KVNamespace<Key extends string = string> {
1057
1068
  get(
1058
1069
  key: Key,
1059
1070
  options?: KVNamespaceGetOptions<"arrayBuffer">
1060
- ): Promise<string | null>;
1071
+ ): Promise<ArrayBuffer | null>;
1061
1072
  get(
1062
1073
  key: Key,
1063
1074
  options?: KVNamespaceGetOptions<"stream">
1064
- ): Promise<string | null>;
1075
+ ): Promise<ReadableStream | null>;
1065
1076
  list<Metadata = unknown>(
1066
1077
  options?: KVNamespaceListOptions
1067
1078
  ): Promise<KVNamespaceListResult<Metadata, Key>>;
@@ -2857,6 +2868,14 @@ declare interface Message<Body = unknown> {
2857
2868
  * The body of the message.
2858
2869
  */
2859
2870
  readonly body: Body;
2871
+ /**
2872
+ * Marks message to be retried.
2873
+ */
2874
+ retry(): void;
2875
+ /**
2876
+ * Marks message acknowledged.
2877
+ */
2878
+ ack(): void;
2860
2879
  }
2861
2880
  /**
2862
2881
  * A batch of messages that are sent to a consumer Worker.
@@ -2874,6 +2893,10 @@ declare interface MessageBatch<Body = unknown> {
2874
2893
  * Marks every message to be retried in the next batch.
2875
2894
  */
2876
2895
  retryAll(): void;
2896
+ /**
2897
+ * Marks every message acknowledged in the batch.
2898
+ */
2899
+ ackAll(): void;
2877
2900
  }
2878
2901
  /**
2879
2902
  * A wrapper class used to structure message batches.
@@ -284,6 +284,7 @@ export declare const crypto: Crypto;
284
284
  export declare const caches: CacheStorage;
285
285
  export declare const scheduler: Scheduler;
286
286
  export declare const navigator: Navigator;
287
+ export interface TestController {}
287
288
  export interface ExecutionContext {
288
289
  waitUntil(promise: Promise<any>): void;
289
290
  passThroughOnException(): void;
@@ -308,10 +309,16 @@ export type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
308
309
  env: Env,
309
310
  ctx: ExecutionContext
310
311
  ) => void | Promise<void>;
312
+ export type ExportedHandlerTestHandler<Env = unknown> = (
313
+ controller: TestController,
314
+ env: Env,
315
+ ctx: ExecutionContext
316
+ ) => void | Promise<void>;
311
317
  export interface ExportedHandler<Env = unknown, QueueMessage = unknown> {
312
318
  fetch?: ExportedHandlerFetchHandler<Env>;
313
319
  trace?: ExportedHandlerTraceHandler<Env>;
314
320
  scheduled?: ExportedHandlerScheduledHandler<Env>;
321
+ test?: ExportedHandlerTestHandler<Env>;
315
322
  queue?: ExportedHandlerQueueHandler<Env, QueueMessage>;
316
323
  }
317
324
  export interface StructuredSerializeOptions {
@@ -994,6 +1001,8 @@ export declare class Request<CfHostMetadata = unknown> extends Body {
994
1001
  get fetcher(): Fetcher | null;
995
1002
  get signal(): AbortSignal;
996
1003
  get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
1004
+ get integrity(): string;
1005
+ get keepalive(): boolean;
997
1006
  }
998
1007
  export interface RequestInit<
999
1008
  CfType = IncomingRequestCfProperties | RequestInitCfProperties
@@ -1008,6 +1017,8 @@ export interface RequestInit<
1008
1017
  redirect?: string;
1009
1018
  fetcher?: Fetcher | null;
1010
1019
  cf?: CfType;
1020
+ /** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1021
+ integrity?: string;
1011
1022
  /** An AbortSignal to set request's signal. */
1012
1023
  signal?: AbortSignal | null;
1013
1024
  }
@@ -1059,11 +1070,11 @@ export interface KVNamespace<Key extends string = string> {
1059
1070
  get(
1060
1071
  key: Key,
1061
1072
  options?: KVNamespaceGetOptions<"arrayBuffer">
1062
- ): Promise<string | null>;
1073
+ ): Promise<ArrayBuffer | null>;
1063
1074
  get(
1064
1075
  key: Key,
1065
1076
  options?: KVNamespaceGetOptions<"stream">
1066
- ): Promise<string | null>;
1077
+ ): Promise<ReadableStream | null>;
1067
1078
  list<Metadata = unknown>(
1068
1079
  options?: KVNamespaceListOptions
1069
1080
  ): Promise<KVNamespaceListResult<Metadata, Key>>;
@@ -2859,6 +2870,14 @@ export interface Message<Body = unknown> {
2859
2870
  * The body of the message.
2860
2871
  */
2861
2872
  readonly body: Body;
2873
+ /**
2874
+ * Marks message to be retried.
2875
+ */
2876
+ retry(): void;
2877
+ /**
2878
+ * Marks message acknowledged.
2879
+ */
2880
+ ack(): void;
2862
2881
  }
2863
2882
  /**
2864
2883
  * A batch of messages that are sent to a consumer Worker.
@@ -2876,6 +2895,10 @@ export interface MessageBatch<Body = unknown> {
2876
2895
  * Marks every message to be retried in the next batch.
2877
2896
  */
2878
2897
  retryAll(): void;
2898
+ /**
2899
+ * Marks every message acknowledged in the batch.
2900
+ */
2901
+ ackAll(): void;
2879
2902
  }
2880
2903
  /**
2881
2904
  * A wrapper class used to structure message batches.
@@ -282,6 +282,7 @@ declare const crypto: Crypto;
282
282
  declare const caches: CacheStorage;
283
283
  declare const scheduler: Scheduler;
284
284
  declare const navigator: Navigator;
285
+ declare interface TestController {}
285
286
  declare interface ExecutionContext {
286
287
  waitUntil(promise: Promise<any>): void;
287
288
  passThroughOnException(): void;
@@ -306,10 +307,16 @@ declare type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
306
307
  env: Env,
307
308
  ctx: ExecutionContext
308
309
  ) => void | Promise<void>;
310
+ declare type ExportedHandlerTestHandler<Env = unknown> = (
311
+ controller: TestController,
312
+ env: Env,
313
+ ctx: ExecutionContext
314
+ ) => void | Promise<void>;
309
315
  declare interface ExportedHandler<Env = unknown, QueueMessage = unknown> {
310
316
  fetch?: ExportedHandlerFetchHandler<Env>;
311
317
  trace?: ExportedHandlerTraceHandler<Env>;
312
318
  scheduled?: ExportedHandlerScheduledHandler<Env>;
319
+ test?: ExportedHandlerTestHandler<Env>;
313
320
  queue?: ExportedHandlerQueueHandler<Env, QueueMessage>;
314
321
  }
315
322
  declare interface StructuredSerializeOptions {
@@ -992,6 +999,8 @@ declare class Request<CfHostMetadata = unknown> extends Body {
992
999
  get fetcher(): Fetcher | null;
993
1000
  get signal(): AbortSignal;
994
1001
  get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
1002
+ get integrity(): string;
1003
+ get keepalive(): boolean;
995
1004
  }
996
1005
  declare interface RequestInit<
997
1006
  CfType = IncomingRequestCfProperties | RequestInitCfProperties
@@ -1006,6 +1015,8 @@ declare interface RequestInit<
1006
1015
  redirect?: string;
1007
1016
  fetcher?: Fetcher | null;
1008
1017
  cf?: CfType;
1018
+ /** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1019
+ integrity?: string;
1009
1020
  /** An AbortSignal to set request's signal. */
1010
1021
  signal?: AbortSignal | null;
1011
1022
  }
@@ -1057,11 +1068,11 @@ declare interface KVNamespace<Key extends string = string> {
1057
1068
  get(
1058
1069
  key: Key,
1059
1070
  options?: KVNamespaceGetOptions<"arrayBuffer">
1060
- ): Promise<string | null>;
1071
+ ): Promise<ArrayBuffer | null>;
1061
1072
  get(
1062
1073
  key: Key,
1063
1074
  options?: KVNamespaceGetOptions<"stream">
1064
- ): Promise<string | null>;
1075
+ ): Promise<ReadableStream | null>;
1065
1076
  list<Metadata = unknown>(
1066
1077
  options?: KVNamespaceListOptions
1067
1078
  ): Promise<KVNamespaceListResult<Metadata, Key>>;
@@ -2858,6 +2869,14 @@ declare interface Message<Body = unknown> {
2858
2869
  * The body of the message.
2859
2870
  */
2860
2871
  readonly body: Body;
2872
+ /**
2873
+ * Marks message to be retried.
2874
+ */
2875
+ retry(): void;
2876
+ /**
2877
+ * Marks message acknowledged.
2878
+ */
2879
+ ack(): void;
2861
2880
  }
2862
2881
  /**
2863
2882
  * A batch of messages that are sent to a consumer Worker.
@@ -2875,6 +2894,10 @@ declare interface MessageBatch<Body = unknown> {
2875
2894
  * Marks every message to be retried in the next batch.
2876
2895
  */
2877
2896
  retryAll(): void;
2897
+ /**
2898
+ * Marks every message acknowledged in the batch.
2899
+ */
2900
+ ackAll(): void;
2878
2901
  }
2879
2902
  /**
2880
2903
  * A wrapper class used to structure message batches.
@@ -284,6 +284,7 @@ export declare const crypto: Crypto;
284
284
  export declare const caches: CacheStorage;
285
285
  export declare const scheduler: Scheduler;
286
286
  export declare const navigator: Navigator;
287
+ export interface TestController {}
287
288
  export interface ExecutionContext {
288
289
  waitUntil(promise: Promise<any>): void;
289
290
  passThroughOnException(): void;
@@ -308,10 +309,16 @@ export type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
308
309
  env: Env,
309
310
  ctx: ExecutionContext
310
311
  ) => void | Promise<void>;
312
+ export type ExportedHandlerTestHandler<Env = unknown> = (
313
+ controller: TestController,
314
+ env: Env,
315
+ ctx: ExecutionContext
316
+ ) => void | Promise<void>;
311
317
  export interface ExportedHandler<Env = unknown, QueueMessage = unknown> {
312
318
  fetch?: ExportedHandlerFetchHandler<Env>;
313
319
  trace?: ExportedHandlerTraceHandler<Env>;
314
320
  scheduled?: ExportedHandlerScheduledHandler<Env>;
321
+ test?: ExportedHandlerTestHandler<Env>;
315
322
  queue?: ExportedHandlerQueueHandler<Env, QueueMessage>;
316
323
  }
317
324
  export interface StructuredSerializeOptions {
@@ -994,6 +1001,8 @@ export declare class Request<CfHostMetadata = unknown> extends Body {
994
1001
  get fetcher(): Fetcher | null;
995
1002
  get signal(): AbortSignal;
996
1003
  get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
1004
+ get integrity(): string;
1005
+ get keepalive(): boolean;
997
1006
  }
998
1007
  export interface RequestInit<
999
1008
  CfType = IncomingRequestCfProperties | RequestInitCfProperties
@@ -1008,6 +1017,8 @@ export interface RequestInit<
1008
1017
  redirect?: string;
1009
1018
  fetcher?: Fetcher | null;
1010
1019
  cf?: CfType;
1020
+ /** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1021
+ integrity?: string;
1011
1022
  /** An AbortSignal to set request's signal. */
1012
1023
  signal?: AbortSignal | null;
1013
1024
  }
@@ -1059,11 +1070,11 @@ export interface KVNamespace<Key extends string = string> {
1059
1070
  get(
1060
1071
  key: Key,
1061
1072
  options?: KVNamespaceGetOptions<"arrayBuffer">
1062
- ): Promise<string | null>;
1073
+ ): Promise<ArrayBuffer | null>;
1063
1074
  get(
1064
1075
  key: Key,
1065
1076
  options?: KVNamespaceGetOptions<"stream">
1066
- ): Promise<string | null>;
1077
+ ): Promise<ReadableStream | null>;
1067
1078
  list<Metadata = unknown>(
1068
1079
  options?: KVNamespaceListOptions
1069
1080
  ): Promise<KVNamespaceListResult<Metadata, Key>>;
@@ -2860,6 +2871,14 @@ export interface Message<Body = unknown> {
2860
2871
  * The body of the message.
2861
2872
  */
2862
2873
  readonly body: Body;
2874
+ /**
2875
+ * Marks message to be retried.
2876
+ */
2877
+ retry(): void;
2878
+ /**
2879
+ * Marks message acknowledged.
2880
+ */
2881
+ ack(): void;
2863
2882
  }
2864
2883
  /**
2865
2884
  * A batch of messages that are sent to a consumer Worker.
@@ -2877,6 +2896,10 @@ export interface MessageBatch<Body = unknown> {
2877
2896
  * Marks every message to be retried in the next batch.
2878
2897
  */
2879
2898
  retryAll(): void;
2899
+ /**
2900
+ * Marks every message acknowledged in the batch.
2901
+ */
2902
+ ackAll(): void;
2880
2903
  }
2881
2904
  /**
2882
2905
  * A wrapper class used to structure message batches.