@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.
- package/2021-11-03/index.d.ts +27 -2
- package/2021-11-03/index.ts +27 -2
- package/2022-01-31/index.d.ts +25 -2
- package/2022-01-31/index.ts +25 -2
- package/2022-03-21/index.d.ts +25 -2
- package/2022-03-21/index.ts +25 -2
- package/2022-08-04/index.d.ts +25 -2
- package/2022-08-04/index.ts +25 -2
- package/2022-10-31/index.d.ts +25 -2
- package/2022-10-31/index.ts +25 -2
- package/2022-11-30/index.d.ts +25 -2
- package/2022-11-30/index.ts +25 -2
- package/experimental/index.d.ts +26 -2
- package/experimental/index.ts +26 -2
- package/index.d.ts +27 -2
- package/index.ts +27 -2
- package/oldest/index.d.ts +27 -2
- package/oldest/index.ts +27 -2
- package/package.json +1 -1
package/2022-10-31/index.d.ts
CHANGED
|
@@ -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<
|
|
1071
|
+
): Promise<ArrayBuffer | null>;
|
|
1061
1072
|
get(
|
|
1062
1073
|
key: Key,
|
|
1063
1074
|
options?: KVNamespaceGetOptions<"stream">
|
|
1064
|
-
): Promise<
|
|
1075
|
+
): Promise<ReadableStream | null>;
|
|
1065
1076
|
list<Metadata = unknown>(
|
|
1066
1077
|
options?: KVNamespaceListOptions
|
|
1067
1078
|
): Promise<KVNamespaceListResult<Metadata, Key>>;
|
|
@@ -2854,6 +2865,14 @@ declare interface Message<Body = unknown> {
|
|
|
2854
2865
|
* The body of the message.
|
|
2855
2866
|
*/
|
|
2856
2867
|
readonly body: Body;
|
|
2868
|
+
/**
|
|
2869
|
+
* Marks message to be retried.
|
|
2870
|
+
*/
|
|
2871
|
+
retry(): void;
|
|
2872
|
+
/**
|
|
2873
|
+
* Marks message acknowledged.
|
|
2874
|
+
*/
|
|
2875
|
+
ack(): void;
|
|
2857
2876
|
}
|
|
2858
2877
|
/**
|
|
2859
2878
|
* A batch of messages that are sent to a consumer Worker.
|
|
@@ -2871,6 +2890,10 @@ declare interface MessageBatch<Body = unknown> {
|
|
|
2871
2890
|
* Marks every message to be retried in the next batch.
|
|
2872
2891
|
*/
|
|
2873
2892
|
retryAll(): void;
|
|
2893
|
+
/**
|
|
2894
|
+
* Marks every message acknowledged in the batch.
|
|
2895
|
+
*/
|
|
2896
|
+
ackAll(): void;
|
|
2874
2897
|
}
|
|
2875
2898
|
/**
|
|
2876
2899
|
* A wrapper class used to structure message batches.
|
package/2022-10-31/index.ts
CHANGED
|
@@ -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<
|
|
1073
|
+
): Promise<ArrayBuffer | null>;
|
|
1063
1074
|
get(
|
|
1064
1075
|
key: Key,
|
|
1065
1076
|
options?: KVNamespaceGetOptions<"stream">
|
|
1066
|
-
): Promise<
|
|
1077
|
+
): Promise<ReadableStream | null>;
|
|
1067
1078
|
list<Metadata = unknown>(
|
|
1068
1079
|
options?: KVNamespaceListOptions
|
|
1069
1080
|
): Promise<KVNamespaceListResult<Metadata, Key>>;
|
|
@@ -2856,6 +2867,14 @@ export interface Message<Body = unknown> {
|
|
|
2856
2867
|
* The body of the message.
|
|
2857
2868
|
*/
|
|
2858
2869
|
readonly body: Body;
|
|
2870
|
+
/**
|
|
2871
|
+
* Marks message to be retried.
|
|
2872
|
+
*/
|
|
2873
|
+
retry(): void;
|
|
2874
|
+
/**
|
|
2875
|
+
* Marks message acknowledged.
|
|
2876
|
+
*/
|
|
2877
|
+
ack(): void;
|
|
2859
2878
|
}
|
|
2860
2879
|
/**
|
|
2861
2880
|
* A batch of messages that are sent to a consumer Worker.
|
|
@@ -2873,6 +2892,10 @@ export interface MessageBatch<Body = unknown> {
|
|
|
2873
2892
|
* Marks every message to be retried in the next batch.
|
|
2874
2893
|
*/
|
|
2875
2894
|
retryAll(): void;
|
|
2895
|
+
/**
|
|
2896
|
+
* Marks every message acknowledged in the batch.
|
|
2897
|
+
*/
|
|
2898
|
+
ackAll(): void;
|
|
2876
2899
|
}
|
|
2877
2900
|
/**
|
|
2878
2901
|
* A wrapper class used to structure message batches.
|
package/2022-11-30/index.d.ts
CHANGED
|
@@ -286,6 +286,7 @@ declare const crypto: Crypto;
|
|
|
286
286
|
declare const caches: CacheStorage;
|
|
287
287
|
declare const scheduler: Scheduler;
|
|
288
288
|
declare const navigator: Navigator;
|
|
289
|
+
declare interface TestController {}
|
|
289
290
|
declare interface ExecutionContext {
|
|
290
291
|
waitUntil(promise: Promise<any>): void;
|
|
291
292
|
passThroughOnException(): void;
|
|
@@ -310,10 +311,16 @@ declare type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
|
|
|
310
311
|
env: Env,
|
|
311
312
|
ctx: ExecutionContext
|
|
312
313
|
) => void | Promise<void>;
|
|
314
|
+
declare type ExportedHandlerTestHandler<Env = unknown> = (
|
|
315
|
+
controller: TestController,
|
|
316
|
+
env: Env,
|
|
317
|
+
ctx: ExecutionContext
|
|
318
|
+
) => void | Promise<void>;
|
|
313
319
|
declare interface ExportedHandler<Env = unknown, QueueMessage = unknown> {
|
|
314
320
|
fetch?: ExportedHandlerFetchHandler<Env>;
|
|
315
321
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
316
322
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
323
|
+
test?: ExportedHandlerTestHandler<Env>;
|
|
317
324
|
queue?: ExportedHandlerQueueHandler<Env, QueueMessage>;
|
|
318
325
|
}
|
|
319
326
|
declare interface StructuredSerializeOptions {
|
|
@@ -996,6 +1003,8 @@ declare class Request<CfHostMetadata = unknown> extends Body {
|
|
|
996
1003
|
get fetcher(): Fetcher | null;
|
|
997
1004
|
get signal(): AbortSignal;
|
|
998
1005
|
get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
|
|
1006
|
+
get integrity(): string;
|
|
1007
|
+
get keepalive(): boolean;
|
|
999
1008
|
}
|
|
1000
1009
|
declare interface RequestInit<
|
|
1001
1010
|
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
@@ -1010,6 +1019,8 @@ declare interface RequestInit<
|
|
|
1010
1019
|
redirect?: string;
|
|
1011
1020
|
fetcher?: Fetcher | null;
|
|
1012
1021
|
cf?: CfType;
|
|
1022
|
+
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1023
|
+
integrity?: string;
|
|
1013
1024
|
/** An AbortSignal to set request's signal. */
|
|
1014
1025
|
signal?: AbortSignal | null;
|
|
1015
1026
|
}
|
|
@@ -1061,11 +1072,11 @@ declare interface KVNamespace<Key extends string = string> {
|
|
|
1061
1072
|
get(
|
|
1062
1073
|
key: Key,
|
|
1063
1074
|
options?: KVNamespaceGetOptions<"arrayBuffer">
|
|
1064
|
-
): Promise<
|
|
1075
|
+
): Promise<ArrayBuffer | null>;
|
|
1065
1076
|
get(
|
|
1066
1077
|
key: Key,
|
|
1067
1078
|
options?: KVNamespaceGetOptions<"stream">
|
|
1068
|
-
): Promise<
|
|
1079
|
+
): Promise<ReadableStream | null>;
|
|
1069
1080
|
list<Metadata = unknown>(
|
|
1070
1081
|
options?: KVNamespaceListOptions
|
|
1071
1082
|
): 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.
|
package/2022-11-30/index.ts
CHANGED
|
@@ -288,6 +288,7 @@ export declare const crypto: Crypto;
|
|
|
288
288
|
export declare const caches: CacheStorage;
|
|
289
289
|
export declare const scheduler: Scheduler;
|
|
290
290
|
export declare const navigator: Navigator;
|
|
291
|
+
export interface TestController {}
|
|
291
292
|
export interface ExecutionContext {
|
|
292
293
|
waitUntil(promise: Promise<any>): void;
|
|
293
294
|
passThroughOnException(): void;
|
|
@@ -312,10 +313,16 @@ export type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
|
|
|
312
313
|
env: Env,
|
|
313
314
|
ctx: ExecutionContext
|
|
314
315
|
) => void | Promise<void>;
|
|
316
|
+
export type ExportedHandlerTestHandler<Env = unknown> = (
|
|
317
|
+
controller: TestController,
|
|
318
|
+
env: Env,
|
|
319
|
+
ctx: ExecutionContext
|
|
320
|
+
) => void | Promise<void>;
|
|
315
321
|
export interface ExportedHandler<Env = unknown, QueueMessage = unknown> {
|
|
316
322
|
fetch?: ExportedHandlerFetchHandler<Env>;
|
|
317
323
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
318
324
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
325
|
+
test?: ExportedHandlerTestHandler<Env>;
|
|
319
326
|
queue?: ExportedHandlerQueueHandler<Env, QueueMessage>;
|
|
320
327
|
}
|
|
321
328
|
export interface StructuredSerializeOptions {
|
|
@@ -998,6 +1005,8 @@ export declare class Request<CfHostMetadata = unknown> extends Body {
|
|
|
998
1005
|
get fetcher(): Fetcher | null;
|
|
999
1006
|
get signal(): AbortSignal;
|
|
1000
1007
|
get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
|
|
1008
|
+
get integrity(): string;
|
|
1009
|
+
get keepalive(): boolean;
|
|
1001
1010
|
}
|
|
1002
1011
|
export interface RequestInit<
|
|
1003
1012
|
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
@@ -1012,6 +1021,8 @@ export interface RequestInit<
|
|
|
1012
1021
|
redirect?: string;
|
|
1013
1022
|
fetcher?: Fetcher | null;
|
|
1014
1023
|
cf?: CfType;
|
|
1024
|
+
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1025
|
+
integrity?: string;
|
|
1015
1026
|
/** An AbortSignal to set request's signal. */
|
|
1016
1027
|
signal?: AbortSignal | null;
|
|
1017
1028
|
}
|
|
@@ -1063,11 +1074,11 @@ export interface KVNamespace<Key extends string = string> {
|
|
|
1063
1074
|
get(
|
|
1064
1075
|
key: Key,
|
|
1065
1076
|
options?: KVNamespaceGetOptions<"arrayBuffer">
|
|
1066
|
-
): Promise<
|
|
1077
|
+
): Promise<ArrayBuffer | null>;
|
|
1067
1078
|
get(
|
|
1068
1079
|
key: Key,
|
|
1069
1080
|
options?: KVNamespaceGetOptions<"stream">
|
|
1070
|
-
): Promise<
|
|
1081
|
+
): Promise<ReadableStream | null>;
|
|
1071
1082
|
list<Metadata = unknown>(
|
|
1072
1083
|
options?: KVNamespaceListOptions
|
|
1073
1084
|
): 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.
|
package/experimental/index.d.ts
CHANGED
|
@@ -286,6 +286,7 @@ declare const crypto: Crypto;
|
|
|
286
286
|
declare const caches: CacheStorage;
|
|
287
287
|
declare const scheduler: Scheduler;
|
|
288
288
|
declare const navigator: Navigator;
|
|
289
|
+
declare interface TestController {}
|
|
289
290
|
declare interface ExecutionContext {
|
|
290
291
|
waitUntil(promise: Promise<any>): void;
|
|
291
292
|
passThroughOnException(): void;
|
|
@@ -310,10 +311,16 @@ declare type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
|
|
|
310
311
|
env: Env,
|
|
311
312
|
ctx: ExecutionContext
|
|
312
313
|
) => void | Promise<void>;
|
|
314
|
+
declare type ExportedHandlerTestHandler<Env = unknown> = (
|
|
315
|
+
controller: TestController,
|
|
316
|
+
env: Env,
|
|
317
|
+
ctx: ExecutionContext
|
|
318
|
+
) => void | Promise<void>;
|
|
313
319
|
declare interface ExportedHandler<Env = unknown, QueueMessage = unknown> {
|
|
314
320
|
fetch?: ExportedHandlerFetchHandler<Env>;
|
|
315
321
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
316
322
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
323
|
+
test?: ExportedHandlerTestHandler<Env>;
|
|
317
324
|
queue?: ExportedHandlerQueueHandler<Env, QueueMessage>;
|
|
318
325
|
}
|
|
319
326
|
declare interface StructuredSerializeOptions {
|
|
@@ -933,6 +940,7 @@ declare class Headers {
|
|
|
933
940
|
constructor(init?: HeadersInit);
|
|
934
941
|
get(name: string): string | null;
|
|
935
942
|
getAll(name: string): string[];
|
|
943
|
+
getSetCookie(): string[];
|
|
936
944
|
has(name: string): boolean;
|
|
937
945
|
set(name: string, value: string): void;
|
|
938
946
|
append(name: string, value: string): void;
|
|
@@ -996,6 +1004,8 @@ declare class Request<CfHostMetadata = unknown> extends Body {
|
|
|
996
1004
|
get fetcher(): Fetcher | null;
|
|
997
1005
|
get signal(): AbortSignal;
|
|
998
1006
|
get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
|
|
1007
|
+
get integrity(): string;
|
|
1008
|
+
get keepalive(): boolean;
|
|
999
1009
|
}
|
|
1000
1010
|
declare interface RequestInit<
|
|
1001
1011
|
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
@@ -1010,6 +1020,8 @@ declare interface RequestInit<
|
|
|
1010
1020
|
redirect?: string;
|
|
1011
1021
|
fetcher?: Fetcher | null;
|
|
1012
1022
|
cf?: CfType;
|
|
1023
|
+
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1024
|
+
integrity?: string;
|
|
1013
1025
|
/** An AbortSignal to set request's signal. */
|
|
1014
1026
|
signal?: AbortSignal | null;
|
|
1015
1027
|
}
|
|
@@ -1061,11 +1073,11 @@ declare interface KVNamespace<Key extends string = string> {
|
|
|
1061
1073
|
get(
|
|
1062
1074
|
key: Key,
|
|
1063
1075
|
options?: KVNamespaceGetOptions<"arrayBuffer">
|
|
1064
|
-
): Promise<
|
|
1076
|
+
): Promise<ArrayBuffer | null>;
|
|
1065
1077
|
get(
|
|
1066
1078
|
key: Key,
|
|
1067
1079
|
options?: KVNamespaceGetOptions<"stream">
|
|
1068
|
-
): Promise<
|
|
1080
|
+
): Promise<ReadableStream | null>;
|
|
1069
1081
|
list<Metadata = unknown>(
|
|
1070
1082
|
options?: KVNamespaceListOptions
|
|
1071
1083
|
): Promise<KVNamespaceListResult<Metadata, Key>>;
|
|
@@ -2857,6 +2869,14 @@ declare interface Message<Body = unknown> {
|
|
|
2857
2869
|
* The body of the message.
|
|
2858
2870
|
*/
|
|
2859
2871
|
readonly body: Body;
|
|
2872
|
+
/**
|
|
2873
|
+
* Marks message to be retried.
|
|
2874
|
+
*/
|
|
2875
|
+
retry(): void;
|
|
2876
|
+
/**
|
|
2877
|
+
* Marks message acknowledged.
|
|
2878
|
+
*/
|
|
2879
|
+
ack(): void;
|
|
2860
2880
|
}
|
|
2861
2881
|
/**
|
|
2862
2882
|
* A batch of messages that are sent to a consumer Worker.
|
|
@@ -2874,6 +2894,10 @@ declare interface MessageBatch<Body = unknown> {
|
|
|
2874
2894
|
* Marks every message to be retried in the next batch.
|
|
2875
2895
|
*/
|
|
2876
2896
|
retryAll(): void;
|
|
2897
|
+
/**
|
|
2898
|
+
* Marks every message acknowledged in the batch.
|
|
2899
|
+
*/
|
|
2900
|
+
ackAll(): void;
|
|
2877
2901
|
}
|
|
2878
2902
|
/**
|
|
2879
2903
|
* A wrapper class used to structure message batches.
|
package/experimental/index.ts
CHANGED
|
@@ -288,6 +288,7 @@ export declare const crypto: Crypto;
|
|
|
288
288
|
export declare const caches: CacheStorage;
|
|
289
289
|
export declare const scheduler: Scheduler;
|
|
290
290
|
export declare const navigator: Navigator;
|
|
291
|
+
export interface TestController {}
|
|
291
292
|
export interface ExecutionContext {
|
|
292
293
|
waitUntil(promise: Promise<any>): void;
|
|
293
294
|
passThroughOnException(): void;
|
|
@@ -312,10 +313,16 @@ export type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
|
|
|
312
313
|
env: Env,
|
|
313
314
|
ctx: ExecutionContext
|
|
314
315
|
) => void | Promise<void>;
|
|
316
|
+
export type ExportedHandlerTestHandler<Env = unknown> = (
|
|
317
|
+
controller: TestController,
|
|
318
|
+
env: Env,
|
|
319
|
+
ctx: ExecutionContext
|
|
320
|
+
) => void | Promise<void>;
|
|
315
321
|
export interface ExportedHandler<Env = unknown, QueueMessage = unknown> {
|
|
316
322
|
fetch?: ExportedHandlerFetchHandler<Env>;
|
|
317
323
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
318
324
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
325
|
+
test?: ExportedHandlerTestHandler<Env>;
|
|
319
326
|
queue?: ExportedHandlerQueueHandler<Env, QueueMessage>;
|
|
320
327
|
}
|
|
321
328
|
export interface StructuredSerializeOptions {
|
|
@@ -935,6 +942,7 @@ export declare class Headers {
|
|
|
935
942
|
constructor(init?: HeadersInit);
|
|
936
943
|
get(name: string): string | null;
|
|
937
944
|
getAll(name: string): string[];
|
|
945
|
+
getSetCookie(): string[];
|
|
938
946
|
has(name: string): boolean;
|
|
939
947
|
set(name: string, value: string): void;
|
|
940
948
|
append(name: string, value: string): void;
|
|
@@ -998,6 +1006,8 @@ export declare class Request<CfHostMetadata = unknown> extends Body {
|
|
|
998
1006
|
get fetcher(): Fetcher | null;
|
|
999
1007
|
get signal(): AbortSignal;
|
|
1000
1008
|
get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
|
|
1009
|
+
get integrity(): string;
|
|
1010
|
+
get keepalive(): boolean;
|
|
1001
1011
|
}
|
|
1002
1012
|
export interface RequestInit<
|
|
1003
1013
|
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
@@ -1012,6 +1022,8 @@ export interface RequestInit<
|
|
|
1012
1022
|
redirect?: string;
|
|
1013
1023
|
fetcher?: Fetcher | null;
|
|
1014
1024
|
cf?: CfType;
|
|
1025
|
+
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1026
|
+
integrity?: string;
|
|
1015
1027
|
/** An AbortSignal to set request's signal. */
|
|
1016
1028
|
signal?: AbortSignal | null;
|
|
1017
1029
|
}
|
|
@@ -1063,11 +1075,11 @@ export interface KVNamespace<Key extends string = string> {
|
|
|
1063
1075
|
get(
|
|
1064
1076
|
key: Key,
|
|
1065
1077
|
options?: KVNamespaceGetOptions<"arrayBuffer">
|
|
1066
|
-
): Promise<
|
|
1078
|
+
): Promise<ArrayBuffer | null>;
|
|
1067
1079
|
get(
|
|
1068
1080
|
key: Key,
|
|
1069
1081
|
options?: KVNamespaceGetOptions<"stream">
|
|
1070
|
-
): Promise<
|
|
1082
|
+
): Promise<ReadableStream | null>;
|
|
1071
1083
|
list<Metadata = unknown>(
|
|
1072
1084
|
options?: KVNamespaceListOptions
|
|
1073
1085
|
): Promise<KVNamespaceListResult<Metadata, Key>>;
|
|
@@ -2859,6 +2871,14 @@ export interface Message<Body = unknown> {
|
|
|
2859
2871
|
* The body of the message.
|
|
2860
2872
|
*/
|
|
2861
2873
|
readonly body: Body;
|
|
2874
|
+
/**
|
|
2875
|
+
* Marks message to be retried.
|
|
2876
|
+
*/
|
|
2877
|
+
retry(): void;
|
|
2878
|
+
/**
|
|
2879
|
+
* Marks message acknowledged.
|
|
2880
|
+
*/
|
|
2881
|
+
ack(): void;
|
|
2862
2882
|
}
|
|
2863
2883
|
/**
|
|
2864
2884
|
* A batch of messages that are sent to a consumer Worker.
|
|
@@ -2876,6 +2896,10 @@ export interface MessageBatch<Body = unknown> {
|
|
|
2876
2896
|
* Marks every message to be retried in the next batch.
|
|
2877
2897
|
*/
|
|
2878
2898
|
retryAll(): void;
|
|
2899
|
+
/**
|
|
2900
|
+
* Marks every message acknowledged in the batch.
|
|
2901
|
+
*/
|
|
2902
|
+
ackAll(): void;
|
|
2879
2903
|
}
|
|
2880
2904
|
/**
|
|
2881
2905
|
* A wrapper class used to structure message batches.
|
package/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>>;
|
|
@@ -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.
|
package/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>>;
|
|
@@ -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.
|