@cloudflare/workers-types 0.20230307.0 → 0.20230404.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 +244 -188
- package/2021-11-03/index.ts +237 -188
- package/2022-01-31/index.d.ts +244 -188
- package/2022-01-31/index.ts +237 -188
- package/2022-03-21/index.d.ts +244 -188
- package/2022-03-21/index.ts +237 -188
- package/2022-08-04/index.d.ts +244 -188
- package/2022-08-04/index.ts +237 -188
- package/2022-10-31/index.d.ts +245 -188
- package/2022-10-31/index.ts +238 -188
- package/2022-11-30/index.d.ts +245 -188
- package/2022-11-30/index.ts +238 -188
- package/README.md +1 -1
- package/experimental/index.d.ts +298 -188
- package/experimental/index.ts +291 -188
- package/index.d.ts +244 -188
- package/index.ts +237 -188
- package/oldest/index.d.ts +244 -188
- package/oldest/index.ts +237 -188
- package/package.json +1 -1
package/oldest/index.ts
CHANGED
|
@@ -49,6 +49,7 @@ export declare class DOMException extends Error {
|
|
|
49
49
|
export type WorkerGlobalScopeEventMap = {
|
|
50
50
|
fetch: FetchEvent;
|
|
51
51
|
scheduled: ScheduledEvent;
|
|
52
|
+
queue: QueueEvent;
|
|
52
53
|
unhandledrejection: PromiseRejectionEvent;
|
|
53
54
|
rejectionhandled: PromiseRejectionEvent;
|
|
54
55
|
};
|
|
@@ -286,8 +287,11 @@ export interface ExecutionContext {
|
|
|
286
287
|
waitUntil(promise: Promise<any>): void;
|
|
287
288
|
passThroughOnException(): void;
|
|
288
289
|
}
|
|
289
|
-
export type ExportedHandlerFetchHandler<
|
|
290
|
-
|
|
290
|
+
export type ExportedHandlerFetchHandler<
|
|
291
|
+
Env = unknown,
|
|
292
|
+
CfHostMetadata = unknown
|
|
293
|
+
> = (
|
|
294
|
+
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
291
295
|
env: Env,
|
|
292
296
|
ctx: ExecutionContext
|
|
293
297
|
) => Response | Promise<Response>;
|
|
@@ -311,12 +315,16 @@ export type ExportedHandlerTestHandler<Env = unknown> = (
|
|
|
311
315
|
env: Env,
|
|
312
316
|
ctx: ExecutionContext
|
|
313
317
|
) => void | Promise<void>;
|
|
314
|
-
export interface ExportedHandler<
|
|
315
|
-
|
|
318
|
+
export interface ExportedHandler<
|
|
319
|
+
Env = unknown,
|
|
320
|
+
QueueMessage = unknown,
|
|
321
|
+
CfHostMetadata = unknown
|
|
322
|
+
> {
|
|
323
|
+
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
316
324
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
317
325
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
318
326
|
test?: ExportedHandlerTestHandler<Env>;
|
|
319
|
-
queue?: ExportedHandlerQueueHandler<Env,
|
|
327
|
+
queue?: ExportedHandlerQueueHandler<Env, Message>;
|
|
320
328
|
}
|
|
321
329
|
export interface StructuredSerializeOptions {
|
|
322
330
|
transfer?: any[];
|
|
@@ -348,13 +356,24 @@ export interface DurableObjectNamespace {
|
|
|
348
356
|
id: DurableObjectId,
|
|
349
357
|
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
350
358
|
): DurableObjectStub;
|
|
351
|
-
jurisdiction(jurisdiction:
|
|
359
|
+
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
|
|
352
360
|
}
|
|
361
|
+
export type DurableObjectJurisdiction = "eu" | "fedramp";
|
|
353
362
|
export interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
354
|
-
jurisdiction?:
|
|
355
|
-
}
|
|
363
|
+
jurisdiction?: DurableObjectJurisdiction;
|
|
364
|
+
}
|
|
365
|
+
export type DurableObjectLocationHint =
|
|
366
|
+
| "wnam"
|
|
367
|
+
| "enam"
|
|
368
|
+
| "sam"
|
|
369
|
+
| "weur"
|
|
370
|
+
| "eeur"
|
|
371
|
+
| "apac"
|
|
372
|
+
| "oc"
|
|
373
|
+
| "afr"
|
|
374
|
+
| "me";
|
|
356
375
|
export interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
357
|
-
locationHint?:
|
|
376
|
+
locationHint?: DurableObjectLocationHint;
|
|
358
377
|
}
|
|
359
378
|
export interface DurableObjectState {
|
|
360
379
|
waitUntil(promise: Promise<any>): void;
|
|
@@ -997,10 +1016,16 @@ export interface ResponseInit {
|
|
|
997
1016
|
webSocket?: WebSocket | null;
|
|
998
1017
|
encodeBody?: "automatic" | "manual";
|
|
999
1018
|
}
|
|
1000
|
-
export type RequestInfo
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1019
|
+
export type RequestInfo<
|
|
1020
|
+
CfHostMetadata = unknown,
|
|
1021
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1022
|
+
> = Request<CfHostMetadata, Cf> | string | URL;
|
|
1023
|
+
export declare class Request<
|
|
1024
|
+
CfHostMetadata = unknown,
|
|
1025
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1026
|
+
> extends Body {
|
|
1027
|
+
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1028
|
+
clone(): Request<CfHostMetadata, Cf>;
|
|
1004
1029
|
/** Returns request's HTTP method, which is "GET" by default. */
|
|
1005
1030
|
readonly method: string;
|
|
1006
1031
|
/** Returns the URL of request as a string. */
|
|
@@ -1012,15 +1037,13 @@ export declare class Request<CfHostMetadata = unknown> extends Body {
|
|
|
1012
1037
|
readonly fetcher: Fetcher | null;
|
|
1013
1038
|
/** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. */
|
|
1014
1039
|
readonly signal: AbortSignal;
|
|
1015
|
-
readonly cf?:
|
|
1040
|
+
readonly cf?: Cf;
|
|
1016
1041
|
/** 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
1042
|
readonly integrity: string;
|
|
1018
1043
|
/** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
|
|
1019
1044
|
readonly keepalive: boolean;
|
|
1020
1045
|
}
|
|
1021
|
-
export interface RequestInit<
|
|
1022
|
-
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
1023
|
-
> {
|
|
1046
|
+
export interface RequestInit<Cf = CfProperties> {
|
|
1024
1047
|
/** A string to set request's method. */
|
|
1025
1048
|
method?: string;
|
|
1026
1049
|
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
@@ -1030,17 +1053,14 @@ export interface RequestInit<
|
|
|
1030
1053
|
/** A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */
|
|
1031
1054
|
redirect?: string;
|
|
1032
1055
|
fetcher?: Fetcher | null;
|
|
1033
|
-
cf?:
|
|
1056
|
+
cf?: Cf;
|
|
1034
1057
|
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1035
1058
|
integrity?: string;
|
|
1036
1059
|
/** An AbortSignal to set request's signal. */
|
|
1037
1060
|
signal?: AbortSignal | null;
|
|
1038
1061
|
}
|
|
1039
1062
|
export declare abstract class Fetcher {
|
|
1040
|
-
fetch(
|
|
1041
|
-
input: RequestInfo,
|
|
1042
|
-
init?: RequestInit<RequestInitCfProperties>
|
|
1043
|
-
): Promise<Response>;
|
|
1063
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1044
1064
|
}
|
|
1045
1065
|
export interface FetcherPutOptions {
|
|
1046
1066
|
expiration?: number;
|
|
@@ -1153,6 +1173,33 @@ export interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1153
1173
|
value: Value | null;
|
|
1154
1174
|
metadata: Metadata | null;
|
|
1155
1175
|
}
|
|
1176
|
+
export interface Queue<Body> {
|
|
1177
|
+
send(message: Body): Promise<void>;
|
|
1178
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1179
|
+
}
|
|
1180
|
+
export interface QueueSendOptions {}
|
|
1181
|
+
export interface MessageSendRequest<Body = unknown> {
|
|
1182
|
+
body: Body;
|
|
1183
|
+
}
|
|
1184
|
+
export interface Message<Body = unknown> {
|
|
1185
|
+
readonly id: string;
|
|
1186
|
+
readonly timestamp: Date;
|
|
1187
|
+
readonly body: Body;
|
|
1188
|
+
retry(): void;
|
|
1189
|
+
ack(): void;
|
|
1190
|
+
}
|
|
1191
|
+
export interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1192
|
+
readonly messages: readonly Message<Body>[];
|
|
1193
|
+
readonly queue: string;
|
|
1194
|
+
retryAll(): void;
|
|
1195
|
+
ackAll(): void;
|
|
1196
|
+
}
|
|
1197
|
+
export interface MessageBatch<Body = unknown> {
|
|
1198
|
+
readonly messages: readonly Message<Body>[];
|
|
1199
|
+
readonly queue: string;
|
|
1200
|
+
retryAll(): void;
|
|
1201
|
+
ackAll(): void;
|
|
1202
|
+
}
|
|
1156
1203
|
export interface R2Error extends Error {
|
|
1157
1204
|
readonly name: string;
|
|
1158
1205
|
readonly code: number;
|
|
@@ -1303,12 +1350,18 @@ export interface R2HTTPMetadata {
|
|
|
1303
1350
|
cacheControl?: string;
|
|
1304
1351
|
cacheExpiry?: Date;
|
|
1305
1352
|
}
|
|
1306
|
-
export
|
|
1353
|
+
export type R2Objects = {
|
|
1307
1354
|
objects: R2Object[];
|
|
1308
|
-
truncated: boolean;
|
|
1309
|
-
cursor?: string;
|
|
1310
1355
|
delimitedPrefixes: string[];
|
|
1311
|
-
}
|
|
1356
|
+
} & (
|
|
1357
|
+
| {
|
|
1358
|
+
truncated: true;
|
|
1359
|
+
cursor: string;
|
|
1360
|
+
}
|
|
1361
|
+
| {
|
|
1362
|
+
truncated: false;
|
|
1363
|
+
}
|
|
1364
|
+
);
|
|
1312
1365
|
export declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1313
1366
|
readonly scheduledTime: number;
|
|
1314
1367
|
readonly cron: string;
|
|
@@ -1519,13 +1572,19 @@ export declare class TransformStream<I = any, O = any> {
|
|
|
1519
1572
|
readonly writable: WritableStream<I>;
|
|
1520
1573
|
}
|
|
1521
1574
|
export declare class FixedLengthStream extends IdentityTransformStream {
|
|
1522
|
-
constructor(
|
|
1575
|
+
constructor(
|
|
1576
|
+
expectedLength: number | bigint,
|
|
1577
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy
|
|
1578
|
+
);
|
|
1523
1579
|
}
|
|
1524
1580
|
export declare class IdentityTransformStream extends TransformStream<
|
|
1525
1581
|
ArrayBuffer | ArrayBufferView,
|
|
1526
1582
|
Uint8Array
|
|
1527
1583
|
> {
|
|
1528
|
-
constructor();
|
|
1584
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
1585
|
+
}
|
|
1586
|
+
export interface IdentityTransformStreamQueuingStrategy {
|
|
1587
|
+
highWaterMark?: number | bigint;
|
|
1529
1588
|
}
|
|
1530
1589
|
export interface ReadableStreamValuesOptions {
|
|
1531
1590
|
preventCancel?: boolean;
|
|
@@ -1875,7 +1934,7 @@ export interface BasicImageTransformationsGravityCoordinates {
|
|
|
1875
1934
|
* Note: Currently, these properties cannot be tested in the
|
|
1876
1935
|
* playground.
|
|
1877
1936
|
*/
|
|
1878
|
-
export interface RequestInitCfProperties {
|
|
1937
|
+
export interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1879
1938
|
cacheEverything?: boolean;
|
|
1880
1939
|
/**
|
|
1881
1940
|
* A request's cache key is what determines if two requests are
|
|
@@ -2045,6 +2104,49 @@ export interface RequestInitCfPropertiesImage
|
|
|
2045
2104
|
* the origin.
|
|
2046
2105
|
*/
|
|
2047
2106
|
"origin-auth"?: "share-publicly";
|
|
2107
|
+
/**
|
|
2108
|
+
* Adds a border around the image. The border is added after resizing. Border
|
|
2109
|
+
* width takes dpr into account, and can be specified either using a single
|
|
2110
|
+
* width property, or individually for each side.
|
|
2111
|
+
*/
|
|
2112
|
+
border?:
|
|
2113
|
+
| {
|
|
2114
|
+
color: string;
|
|
2115
|
+
width: number;
|
|
2116
|
+
}
|
|
2117
|
+
| {
|
|
2118
|
+
color: string;
|
|
2119
|
+
top: number;
|
|
2120
|
+
right: number;
|
|
2121
|
+
bottom: number;
|
|
2122
|
+
left: number;
|
|
2123
|
+
};
|
|
2124
|
+
/**
|
|
2125
|
+
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
2126
|
+
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
2127
|
+
* 0 is ignored.
|
|
2128
|
+
*/
|
|
2129
|
+
brightness?: number;
|
|
2130
|
+
/**
|
|
2131
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
2132
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
2133
|
+
* ignored.
|
|
2134
|
+
*/
|
|
2135
|
+
contrast?: number;
|
|
2136
|
+
/**
|
|
2137
|
+
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
2138
|
+
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
2139
|
+
*/
|
|
2140
|
+
gamma?: number;
|
|
2141
|
+
/**
|
|
2142
|
+
* Slightly reduces latency on a cache miss by selecting a
|
|
2143
|
+
* quickest-to-compress file format, at a cost of increased file size and
|
|
2144
|
+
* lower image quality. It will usually override the format option and choose
|
|
2145
|
+
* JPEG over WebP or AVIF. We do not recommend using this option, except in
|
|
2146
|
+
* unusual circumstances like resizing uncacheable dynamically-generated
|
|
2147
|
+
* images.
|
|
2148
|
+
*/
|
|
2149
|
+
compression?: "fast";
|
|
2048
2150
|
}
|
|
2049
2151
|
export interface RequestInitCfPropertiesImageMinify {
|
|
2050
2152
|
javascript?: boolean;
|
|
@@ -2060,7 +2162,8 @@ export type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2060
2162
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2061
2163
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2062
2164
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2063
|
-
export interface IncomingRequestCfPropertiesBase
|
|
2165
|
+
export interface IncomingRequestCfPropertiesBase
|
|
2166
|
+
extends Record<string, unknown> {
|
|
2064
2167
|
/**
|
|
2065
2168
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2066
2169
|
*
|
|
@@ -2141,8 +2244,7 @@ export interface IncomingRequestCfPropertiesBase {
|
|
|
2141
2244
|
export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2142
2245
|
/**
|
|
2143
2246
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2144
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2145
|
-
* and `99` (almost certainly a bot).
|
|
2247
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2146
2248
|
*
|
|
2147
2249
|
* @example 54
|
|
2148
2250
|
*/
|
|
@@ -2253,86 +2355,82 @@ export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2253
2355
|
/**
|
|
2254
2356
|
* Geographic data about the request's origin.
|
|
2255
2357
|
*/
|
|
2256
|
-
export
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
* @example "635"
|
|
2333
|
-
*/
|
|
2334
|
-
metroCode?: string;
|
|
2335
|
-
};
|
|
2358
|
+
export interface IncomingRequestCfPropertiesGeographicInformation {
|
|
2359
|
+
/**
|
|
2360
|
+
* The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
|
|
2361
|
+
*
|
|
2362
|
+
* If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR.
|
|
2363
|
+
*
|
|
2364
|
+
* If Cloudflare is unable to determine where the request originated this property is omitted.
|
|
2365
|
+
*
|
|
2366
|
+
* The country code `"T1"` is used for requests originating on TOR.
|
|
2367
|
+
*
|
|
2368
|
+
* @example "GB"
|
|
2369
|
+
*/
|
|
2370
|
+
country?: Iso3166Alpha2Code | "T1";
|
|
2371
|
+
/**
|
|
2372
|
+
* If present, this property indicates that the request originated in the EU
|
|
2373
|
+
*
|
|
2374
|
+
* @example "1"
|
|
2375
|
+
*/
|
|
2376
|
+
isEUCountry?: "1";
|
|
2377
|
+
/**
|
|
2378
|
+
* A two-letter code indicating the continent the request originated from.
|
|
2379
|
+
*
|
|
2380
|
+
* @example "AN"
|
|
2381
|
+
*/
|
|
2382
|
+
continent?: ContinentCode;
|
|
2383
|
+
/**
|
|
2384
|
+
* The city the request originated from
|
|
2385
|
+
*
|
|
2386
|
+
* @example "Austin"
|
|
2387
|
+
*/
|
|
2388
|
+
city?: string;
|
|
2389
|
+
/**
|
|
2390
|
+
* Postal code of the incoming request
|
|
2391
|
+
*
|
|
2392
|
+
* @example "78701"
|
|
2393
|
+
*/
|
|
2394
|
+
postalCode?: string;
|
|
2395
|
+
/**
|
|
2396
|
+
* Latitude of the incoming request
|
|
2397
|
+
*
|
|
2398
|
+
* @example "30.27130"
|
|
2399
|
+
*/
|
|
2400
|
+
latitude?: string;
|
|
2401
|
+
/**
|
|
2402
|
+
* Longitude of the incoming request
|
|
2403
|
+
*
|
|
2404
|
+
* @example "-97.74260"
|
|
2405
|
+
*/
|
|
2406
|
+
longitude?: string;
|
|
2407
|
+
/**
|
|
2408
|
+
* Timezone of the incoming request
|
|
2409
|
+
*
|
|
2410
|
+
* @example "America/Chicago"
|
|
2411
|
+
*/
|
|
2412
|
+
timezone?: string;
|
|
2413
|
+
/**
|
|
2414
|
+
* If known, the ISO 3166-2 name for the first level region associated with
|
|
2415
|
+
* the IP address of the incoming request
|
|
2416
|
+
*
|
|
2417
|
+
* @example "Texas"
|
|
2418
|
+
*/
|
|
2419
|
+
region?: string;
|
|
2420
|
+
/**
|
|
2421
|
+
* If known, the ISO 3166-2 code for the first-level region associated with
|
|
2422
|
+
* the IP address of the incoming request
|
|
2423
|
+
*
|
|
2424
|
+
* @example "TX"
|
|
2425
|
+
*/
|
|
2426
|
+
regionCode?: string;
|
|
2427
|
+
/**
|
|
2428
|
+
* Metro code (DMA) of the incoming request
|
|
2429
|
+
*
|
|
2430
|
+
* @example "635"
|
|
2431
|
+
*/
|
|
2432
|
+
metroCode?: string;
|
|
2433
|
+
}
|
|
2336
2434
|
/** Data about the incoming request's TLS certificate */
|
|
2337
2435
|
export interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2338
2436
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2725,6 +2823,9 @@ export type Iso3166Alpha2Code =
|
|
|
2725
2823
|
| "ZW";
|
|
2726
2824
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2727
2825
|
export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2826
|
+
export type CfProperties<HostMetadata = unknown> =
|
|
2827
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2828
|
+
| RequestInitCfProperties;
|
|
2728
2829
|
export interface D1Result<T = unknown> {
|
|
2729
2830
|
results?: T[];
|
|
2730
2831
|
success: boolean;
|
|
@@ -2745,7 +2846,7 @@ export declare abstract class D1PreparedStatement {
|
|
|
2745
2846
|
raw<T = unknown>(): Promise<T[]>;
|
|
2746
2847
|
}
|
|
2747
2848
|
/**
|
|
2748
|
-
*
|
|
2849
|
+
* An email message that can be sent from a Worker.
|
|
2749
2850
|
*/
|
|
2750
2851
|
export interface EmailMessage {
|
|
2751
2852
|
/**
|
|
@@ -2756,14 +2857,19 @@ export interface EmailMessage {
|
|
|
2756
2857
|
* Envelope To attribute of the email message.
|
|
2757
2858
|
*/
|
|
2758
2859
|
readonly to: string;
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2860
|
+
}
|
|
2861
|
+
/**
|
|
2862
|
+
* An email message that is sent to a consumer Worker and can be rejected/forwarded.
|
|
2863
|
+
*/
|
|
2864
|
+
export interface ForwardableEmailMessage extends EmailMessage {
|
|
2763
2865
|
/**
|
|
2764
2866
|
* Stream of the email message content.
|
|
2765
2867
|
*/
|
|
2766
2868
|
readonly raw: ReadableStream;
|
|
2869
|
+
/**
|
|
2870
|
+
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2871
|
+
*/
|
|
2872
|
+
readonly headers: Headers;
|
|
2767
2873
|
/**
|
|
2768
2874
|
* Size of the email message content.
|
|
2769
2875
|
*/
|
|
@@ -2782,11 +2888,17 @@ export interface EmailMessage {
|
|
|
2782
2888
|
*/
|
|
2783
2889
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2784
2890
|
}
|
|
2891
|
+
/**
|
|
2892
|
+
* A binding that allows a Worker to send email messages.
|
|
2893
|
+
*/
|
|
2894
|
+
export interface SendEmail {
|
|
2895
|
+
send(message: EmailMessage): Promise<void>;
|
|
2896
|
+
}
|
|
2785
2897
|
export declare abstract class EmailEvent extends ExtendableEvent {
|
|
2786
|
-
readonly message:
|
|
2898
|
+
readonly message: ForwardableEmailMessage;
|
|
2787
2899
|
}
|
|
2788
2900
|
export type EmailExportedHandler<Env = unknown> = (
|
|
2789
|
-
message:
|
|
2901
|
+
message: ForwardableEmailMessage,
|
|
2790
2902
|
env: Env,
|
|
2791
2903
|
ctx: ExecutionContext
|
|
2792
2904
|
) => void | Promise<void>;
|
|
@@ -2867,75 +2979,12 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2867
2979
|
// Key Identifier of the JWK
|
|
2868
2980
|
readonly kid: string;
|
|
2869
2981
|
}
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
*/
|
|
2873
|
-
export interface Message<Body = unknown> {
|
|
2874
|
-
/**
|
|
2875
|
-
* A unique, system-generated ID for the message.
|
|
2876
|
-
*/
|
|
2877
|
-
readonly id: string;
|
|
2878
|
-
/**
|
|
2879
|
-
* A timestamp when the message was sent.
|
|
2880
|
-
*/
|
|
2881
|
-
readonly timestamp: Date;
|
|
2982
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
2983
|
+
export interface DispatchNamespace {
|
|
2882
2984
|
/**
|
|
2883
|
-
*
|
|
2985
|
+
* @param name Name of the Worker script.
|
|
2986
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
2987
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2884
2988
|
*/
|
|
2885
|
-
|
|
2886
|
-
/**
|
|
2887
|
-
* Marks message to be retried.
|
|
2888
|
-
*/
|
|
2889
|
-
retry(): void;
|
|
2890
|
-
/**
|
|
2891
|
-
* Marks message acknowledged.
|
|
2892
|
-
*/
|
|
2893
|
-
ack(): void;
|
|
2894
|
-
}
|
|
2895
|
-
/**
|
|
2896
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2897
|
-
*/
|
|
2898
|
-
export interface MessageBatch<Body = unknown> {
|
|
2899
|
-
/**
|
|
2900
|
-
* The name of the Queue that belongs to this batch.
|
|
2901
|
-
*/
|
|
2902
|
-
readonly queue: string;
|
|
2903
|
-
/**
|
|
2904
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2905
|
-
*/
|
|
2906
|
-
readonly messages: readonly Message<Body>[];
|
|
2907
|
-
/**
|
|
2908
|
-
* Marks every message to be retried in the next batch.
|
|
2909
|
-
*/
|
|
2910
|
-
retryAll(): void;
|
|
2911
|
-
/**
|
|
2912
|
-
* Marks every message acknowledged in the batch.
|
|
2913
|
-
*/
|
|
2914
|
-
ackAll(): void;
|
|
2915
|
-
}
|
|
2916
|
-
/**
|
|
2917
|
-
* A wrapper class used to structure message batches.
|
|
2918
|
-
*/
|
|
2919
|
-
export type MessageSendRequest<Body = unknown> = {
|
|
2920
|
-
/**
|
|
2921
|
-
* The body of the message.
|
|
2922
|
-
*/
|
|
2923
|
-
body: Body;
|
|
2924
|
-
};
|
|
2925
|
-
/**
|
|
2926
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
2927
|
-
*/
|
|
2928
|
-
export interface Queue<Body = any> {
|
|
2929
|
-
/**
|
|
2930
|
-
* Sends a message to the Queue.
|
|
2931
|
-
* @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB.
|
|
2932
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2933
|
-
*/
|
|
2934
|
-
send(message: Body): Promise<void>;
|
|
2935
|
-
/**
|
|
2936
|
-
* Sends a batch of messages to the Queue.
|
|
2937
|
-
* @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB.
|
|
2938
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2939
|
-
*/
|
|
2940
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2989
|
+
get(name: string): Fetcher;
|
|
2941
2990
|
}
|
package/package.json
CHANGED