@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/2021-11-03/index.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ declare class DOMException extends Error {
|
|
|
49
49
|
declare type WorkerGlobalScopeEventMap = {
|
|
50
50
|
fetch: FetchEvent;
|
|
51
51
|
scheduled: ScheduledEvent;
|
|
52
|
+
queue: QueueEvent;
|
|
52
53
|
unhandledrejection: PromiseRejectionEvent;
|
|
53
54
|
rejectionhandled: PromiseRejectionEvent;
|
|
54
55
|
};
|
|
@@ -284,8 +285,11 @@ declare interface ExecutionContext {
|
|
|
284
285
|
waitUntil(promise: Promise<any>): void;
|
|
285
286
|
passThroughOnException(): void;
|
|
286
287
|
}
|
|
287
|
-
declare type ExportedHandlerFetchHandler<
|
|
288
|
-
|
|
288
|
+
declare type ExportedHandlerFetchHandler<
|
|
289
|
+
Env = unknown,
|
|
290
|
+
CfHostMetadata = unknown
|
|
291
|
+
> = (
|
|
292
|
+
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
289
293
|
env: Env,
|
|
290
294
|
ctx: ExecutionContext
|
|
291
295
|
) => Response | Promise<Response>;
|
|
@@ -309,12 +313,16 @@ declare type ExportedHandlerTestHandler<Env = unknown> = (
|
|
|
309
313
|
env: Env,
|
|
310
314
|
ctx: ExecutionContext
|
|
311
315
|
) => void | Promise<void>;
|
|
312
|
-
declare interface ExportedHandler<
|
|
313
|
-
|
|
316
|
+
declare interface ExportedHandler<
|
|
317
|
+
Env = unknown,
|
|
318
|
+
QueueMessage = unknown,
|
|
319
|
+
CfHostMetadata = unknown
|
|
320
|
+
> {
|
|
321
|
+
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
314
322
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
315
323
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
316
324
|
test?: ExportedHandlerTestHandler<Env>;
|
|
317
|
-
queue?: ExportedHandlerQueueHandler<Env,
|
|
325
|
+
queue?: ExportedHandlerQueueHandler<Env, Message>;
|
|
318
326
|
}
|
|
319
327
|
declare interface StructuredSerializeOptions {
|
|
320
328
|
transfer?: any[];
|
|
@@ -346,13 +354,24 @@ declare interface DurableObjectNamespace {
|
|
|
346
354
|
id: DurableObjectId,
|
|
347
355
|
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
348
356
|
): DurableObjectStub;
|
|
349
|
-
jurisdiction(jurisdiction:
|
|
357
|
+
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
|
|
350
358
|
}
|
|
359
|
+
declare type DurableObjectJurisdiction = "eu" | "fedramp";
|
|
351
360
|
declare interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
352
|
-
jurisdiction?:
|
|
353
|
-
}
|
|
361
|
+
jurisdiction?: DurableObjectJurisdiction;
|
|
362
|
+
}
|
|
363
|
+
declare type DurableObjectLocationHint =
|
|
364
|
+
| "wnam"
|
|
365
|
+
| "enam"
|
|
366
|
+
| "sam"
|
|
367
|
+
| "weur"
|
|
368
|
+
| "eeur"
|
|
369
|
+
| "apac"
|
|
370
|
+
| "oc"
|
|
371
|
+
| "afr"
|
|
372
|
+
| "me";
|
|
354
373
|
declare interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
355
|
-
locationHint?:
|
|
374
|
+
locationHint?: DurableObjectLocationHint;
|
|
356
375
|
}
|
|
357
376
|
declare interface DurableObjectState {
|
|
358
377
|
waitUntil(promise: Promise<any>): void;
|
|
@@ -995,10 +1014,16 @@ declare interface ResponseInit {
|
|
|
995
1014
|
webSocket?: WebSocket | null;
|
|
996
1015
|
encodeBody?: "automatic" | "manual";
|
|
997
1016
|
}
|
|
998
|
-
declare type RequestInfo
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1017
|
+
declare type RequestInfo<
|
|
1018
|
+
CfHostMetadata = unknown,
|
|
1019
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1020
|
+
> = Request<CfHostMetadata, Cf> | string | URL;
|
|
1021
|
+
declare class Request<
|
|
1022
|
+
CfHostMetadata = unknown,
|
|
1023
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1024
|
+
> extends Body {
|
|
1025
|
+
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1026
|
+
clone(): Request<CfHostMetadata, Cf>;
|
|
1002
1027
|
/** Returns request's HTTP method, which is "GET" by default. */
|
|
1003
1028
|
readonly method: string;
|
|
1004
1029
|
/** Returns the URL of request as a string. */
|
|
@@ -1010,15 +1035,13 @@ declare class Request<CfHostMetadata = unknown> extends Body {
|
|
|
1010
1035
|
readonly fetcher: Fetcher | null;
|
|
1011
1036
|
/** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. */
|
|
1012
1037
|
readonly signal: AbortSignal;
|
|
1013
|
-
readonly cf?:
|
|
1038
|
+
readonly cf?: Cf;
|
|
1014
1039
|
/** 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
1040
|
readonly integrity: string;
|
|
1016
1041
|
/** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
|
|
1017
1042
|
readonly keepalive: boolean;
|
|
1018
1043
|
}
|
|
1019
|
-
declare interface RequestInit<
|
|
1020
|
-
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
1021
|
-
> {
|
|
1044
|
+
declare interface RequestInit<Cf = CfProperties> {
|
|
1022
1045
|
/** A string to set request's method. */
|
|
1023
1046
|
method?: string;
|
|
1024
1047
|
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
@@ -1028,17 +1051,14 @@ declare interface RequestInit<
|
|
|
1028
1051
|
/** 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. */
|
|
1029
1052
|
redirect?: string;
|
|
1030
1053
|
fetcher?: Fetcher | null;
|
|
1031
|
-
cf?:
|
|
1054
|
+
cf?: Cf;
|
|
1032
1055
|
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1033
1056
|
integrity?: string;
|
|
1034
1057
|
/** An AbortSignal to set request's signal. */
|
|
1035
1058
|
signal?: AbortSignal | null;
|
|
1036
1059
|
}
|
|
1037
1060
|
declare abstract class Fetcher {
|
|
1038
|
-
fetch(
|
|
1039
|
-
input: RequestInfo,
|
|
1040
|
-
init?: RequestInit<RequestInitCfProperties>
|
|
1041
|
-
): Promise<Response>;
|
|
1061
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1042
1062
|
}
|
|
1043
1063
|
declare interface FetcherPutOptions {
|
|
1044
1064
|
expiration?: number;
|
|
@@ -1151,6 +1171,33 @@ declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1151
1171
|
value: Value | null;
|
|
1152
1172
|
metadata: Metadata | null;
|
|
1153
1173
|
}
|
|
1174
|
+
declare interface Queue<Body> {
|
|
1175
|
+
send(message: Body): Promise<void>;
|
|
1176
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1177
|
+
}
|
|
1178
|
+
declare interface QueueSendOptions {}
|
|
1179
|
+
declare interface MessageSendRequest<Body = unknown> {
|
|
1180
|
+
body: Body;
|
|
1181
|
+
}
|
|
1182
|
+
declare interface Message<Body = unknown> {
|
|
1183
|
+
readonly id: string;
|
|
1184
|
+
readonly timestamp: Date;
|
|
1185
|
+
readonly body: Body;
|
|
1186
|
+
retry(): void;
|
|
1187
|
+
ack(): void;
|
|
1188
|
+
}
|
|
1189
|
+
declare interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1190
|
+
readonly messages: readonly Message<Body>[];
|
|
1191
|
+
readonly queue: string;
|
|
1192
|
+
retryAll(): void;
|
|
1193
|
+
ackAll(): void;
|
|
1194
|
+
}
|
|
1195
|
+
declare interface MessageBatch<Body = unknown> {
|
|
1196
|
+
readonly messages: readonly Message<Body>[];
|
|
1197
|
+
readonly queue: string;
|
|
1198
|
+
retryAll(): void;
|
|
1199
|
+
ackAll(): void;
|
|
1200
|
+
}
|
|
1154
1201
|
declare interface R2Error extends Error {
|
|
1155
1202
|
readonly name: string;
|
|
1156
1203
|
readonly code: number;
|
|
@@ -1301,12 +1348,18 @@ declare interface R2HTTPMetadata {
|
|
|
1301
1348
|
cacheControl?: string;
|
|
1302
1349
|
cacheExpiry?: Date;
|
|
1303
1350
|
}
|
|
1304
|
-
declare
|
|
1351
|
+
declare type R2Objects = {
|
|
1305
1352
|
objects: R2Object[];
|
|
1306
|
-
truncated: boolean;
|
|
1307
|
-
cursor?: string;
|
|
1308
1353
|
delimitedPrefixes: string[];
|
|
1309
|
-
}
|
|
1354
|
+
} & (
|
|
1355
|
+
| {
|
|
1356
|
+
truncated: true;
|
|
1357
|
+
cursor: string;
|
|
1358
|
+
}
|
|
1359
|
+
| {
|
|
1360
|
+
truncated: false;
|
|
1361
|
+
}
|
|
1362
|
+
);
|
|
1310
1363
|
declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1311
1364
|
readonly scheduledTime: number;
|
|
1312
1365
|
readonly cron: string;
|
|
@@ -1517,13 +1570,19 @@ declare class TransformStream<I = any, O = any> {
|
|
|
1517
1570
|
readonly writable: WritableStream<I>;
|
|
1518
1571
|
}
|
|
1519
1572
|
declare class FixedLengthStream extends IdentityTransformStream {
|
|
1520
|
-
constructor(
|
|
1573
|
+
constructor(
|
|
1574
|
+
expectedLength: number | bigint,
|
|
1575
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy
|
|
1576
|
+
);
|
|
1521
1577
|
}
|
|
1522
1578
|
declare class IdentityTransformStream extends TransformStream<
|
|
1523
1579
|
ArrayBuffer | ArrayBufferView,
|
|
1524
1580
|
Uint8Array
|
|
1525
1581
|
> {
|
|
1526
|
-
constructor();
|
|
1582
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
1583
|
+
}
|
|
1584
|
+
declare interface IdentityTransformStreamQueuingStrategy {
|
|
1585
|
+
highWaterMark?: number | bigint;
|
|
1527
1586
|
}
|
|
1528
1587
|
declare interface ReadableStreamValuesOptions {
|
|
1529
1588
|
preventCancel?: boolean;
|
|
@@ -1870,7 +1929,7 @@ declare interface BasicImageTransformationsGravityCoordinates {
|
|
|
1870
1929
|
* Note: Currently, these properties cannot be tested in the
|
|
1871
1930
|
* playground.
|
|
1872
1931
|
*/
|
|
1873
|
-
declare interface RequestInitCfProperties {
|
|
1932
|
+
declare interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1874
1933
|
cacheEverything?: boolean;
|
|
1875
1934
|
/**
|
|
1876
1935
|
* A request's cache key is what determines if two requests are
|
|
@@ -2040,6 +2099,49 @@ declare interface RequestInitCfPropertiesImage
|
|
|
2040
2099
|
* the origin.
|
|
2041
2100
|
*/
|
|
2042
2101
|
"origin-auth"?: "share-publicly";
|
|
2102
|
+
/**
|
|
2103
|
+
* Adds a border around the image. The border is added after resizing. Border
|
|
2104
|
+
* width takes dpr into account, and can be specified either using a single
|
|
2105
|
+
* width property, or individually for each side.
|
|
2106
|
+
*/
|
|
2107
|
+
border?:
|
|
2108
|
+
| {
|
|
2109
|
+
color: string;
|
|
2110
|
+
width: number;
|
|
2111
|
+
}
|
|
2112
|
+
| {
|
|
2113
|
+
color: string;
|
|
2114
|
+
top: number;
|
|
2115
|
+
right: number;
|
|
2116
|
+
bottom: number;
|
|
2117
|
+
left: number;
|
|
2118
|
+
};
|
|
2119
|
+
/**
|
|
2120
|
+
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
2121
|
+
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
2122
|
+
* 0 is ignored.
|
|
2123
|
+
*/
|
|
2124
|
+
brightness?: number;
|
|
2125
|
+
/**
|
|
2126
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
2127
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
2128
|
+
* ignored.
|
|
2129
|
+
*/
|
|
2130
|
+
contrast?: number;
|
|
2131
|
+
/**
|
|
2132
|
+
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
2133
|
+
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
2134
|
+
*/
|
|
2135
|
+
gamma?: number;
|
|
2136
|
+
/**
|
|
2137
|
+
* Slightly reduces latency on a cache miss by selecting a
|
|
2138
|
+
* quickest-to-compress file format, at a cost of increased file size and
|
|
2139
|
+
* lower image quality. It will usually override the format option and choose
|
|
2140
|
+
* JPEG over WebP or AVIF. We do not recommend using this option, except in
|
|
2141
|
+
* unusual circumstances like resizing uncacheable dynamically-generated
|
|
2142
|
+
* images.
|
|
2143
|
+
*/
|
|
2144
|
+
compression?: "fast";
|
|
2043
2145
|
}
|
|
2044
2146
|
declare interface RequestInitCfPropertiesImageMinify {
|
|
2045
2147
|
javascript?: boolean;
|
|
@@ -2055,7 +2157,8 @@ declare type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2055
2157
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2056
2158
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2057
2159
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2058
|
-
declare interface IncomingRequestCfPropertiesBase
|
|
2160
|
+
declare interface IncomingRequestCfPropertiesBase
|
|
2161
|
+
extends Record<string, unknown> {
|
|
2059
2162
|
/**
|
|
2060
2163
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2061
2164
|
*
|
|
@@ -2136,8 +2239,7 @@ declare interface IncomingRequestCfPropertiesBase {
|
|
|
2136
2239
|
declare interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2137
2240
|
/**
|
|
2138
2241
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2139
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2140
|
-
* and `99` (almost certainly a bot).
|
|
2242
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2141
2243
|
*
|
|
2142
2244
|
* @example 54
|
|
2143
2245
|
*/
|
|
@@ -2248,86 +2350,82 @@ declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2248
2350
|
/**
|
|
2249
2351
|
* Geographic data about the request's origin.
|
|
2250
2352
|
*/
|
|
2251
|
-
declare
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
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
|
-
* @example "635"
|
|
2328
|
-
*/
|
|
2329
|
-
metroCode?: string;
|
|
2330
|
-
};
|
|
2353
|
+
declare interface IncomingRequestCfPropertiesGeographicInformation {
|
|
2354
|
+
/**
|
|
2355
|
+
* The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
|
|
2356
|
+
*
|
|
2357
|
+
* 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.
|
|
2358
|
+
*
|
|
2359
|
+
* If Cloudflare is unable to determine where the request originated this property is omitted.
|
|
2360
|
+
*
|
|
2361
|
+
* The country code `"T1"` is used for requests originating on TOR.
|
|
2362
|
+
*
|
|
2363
|
+
* @example "GB"
|
|
2364
|
+
*/
|
|
2365
|
+
country?: Iso3166Alpha2Code | "T1";
|
|
2366
|
+
/**
|
|
2367
|
+
* If present, this property indicates that the request originated in the EU
|
|
2368
|
+
*
|
|
2369
|
+
* @example "1"
|
|
2370
|
+
*/
|
|
2371
|
+
isEUCountry?: "1";
|
|
2372
|
+
/**
|
|
2373
|
+
* A two-letter code indicating the continent the request originated from.
|
|
2374
|
+
*
|
|
2375
|
+
* @example "AN"
|
|
2376
|
+
*/
|
|
2377
|
+
continent?: ContinentCode;
|
|
2378
|
+
/**
|
|
2379
|
+
* The city the request originated from
|
|
2380
|
+
*
|
|
2381
|
+
* @example "Austin"
|
|
2382
|
+
*/
|
|
2383
|
+
city?: string;
|
|
2384
|
+
/**
|
|
2385
|
+
* Postal code of the incoming request
|
|
2386
|
+
*
|
|
2387
|
+
* @example "78701"
|
|
2388
|
+
*/
|
|
2389
|
+
postalCode?: string;
|
|
2390
|
+
/**
|
|
2391
|
+
* Latitude of the incoming request
|
|
2392
|
+
*
|
|
2393
|
+
* @example "30.27130"
|
|
2394
|
+
*/
|
|
2395
|
+
latitude?: string;
|
|
2396
|
+
/**
|
|
2397
|
+
* Longitude of the incoming request
|
|
2398
|
+
*
|
|
2399
|
+
* @example "-97.74260"
|
|
2400
|
+
*/
|
|
2401
|
+
longitude?: string;
|
|
2402
|
+
/**
|
|
2403
|
+
* Timezone of the incoming request
|
|
2404
|
+
*
|
|
2405
|
+
* @example "America/Chicago"
|
|
2406
|
+
*/
|
|
2407
|
+
timezone?: string;
|
|
2408
|
+
/**
|
|
2409
|
+
* If known, the ISO 3166-2 name for the first level region associated with
|
|
2410
|
+
* the IP address of the incoming request
|
|
2411
|
+
*
|
|
2412
|
+
* @example "Texas"
|
|
2413
|
+
*/
|
|
2414
|
+
region?: string;
|
|
2415
|
+
/**
|
|
2416
|
+
* If known, the ISO 3166-2 code for the first-level region associated with
|
|
2417
|
+
* the IP address of the incoming request
|
|
2418
|
+
*
|
|
2419
|
+
* @example "TX"
|
|
2420
|
+
*/
|
|
2421
|
+
regionCode?: string;
|
|
2422
|
+
/**
|
|
2423
|
+
* Metro code (DMA) of the incoming request
|
|
2424
|
+
*
|
|
2425
|
+
* @example "635"
|
|
2426
|
+
*/
|
|
2427
|
+
metroCode?: string;
|
|
2428
|
+
}
|
|
2331
2429
|
/** Data about the incoming request's TLS certificate */
|
|
2332
2430
|
declare interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2333
2431
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2720,6 +2818,9 @@ declare type Iso3166Alpha2Code =
|
|
|
2720
2818
|
| "ZW";
|
|
2721
2819
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2722
2820
|
declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2821
|
+
declare type CfProperties<HostMetadata = unknown> =
|
|
2822
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2823
|
+
| RequestInitCfProperties;
|
|
2723
2824
|
declare interface D1Result<T = unknown> {
|
|
2724
2825
|
results?: T[];
|
|
2725
2826
|
success: boolean;
|
|
@@ -2740,7 +2841,7 @@ declare abstract class D1PreparedStatement {
|
|
|
2740
2841
|
raw<T = unknown>(): Promise<T[]>;
|
|
2741
2842
|
}
|
|
2742
2843
|
/**
|
|
2743
|
-
*
|
|
2844
|
+
* An email message that can be sent from a Worker.
|
|
2744
2845
|
*/
|
|
2745
2846
|
declare interface EmailMessage {
|
|
2746
2847
|
/**
|
|
@@ -2751,14 +2852,19 @@ declare interface EmailMessage {
|
|
|
2751
2852
|
* Envelope To attribute of the email message.
|
|
2752
2853
|
*/
|
|
2753
2854
|
readonly to: string;
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2855
|
+
}
|
|
2856
|
+
/**
|
|
2857
|
+
* An email message that is sent to a consumer Worker and can be rejected/forwarded.
|
|
2858
|
+
*/
|
|
2859
|
+
declare interface ForwardableEmailMessage extends EmailMessage {
|
|
2758
2860
|
/**
|
|
2759
2861
|
* Stream of the email message content.
|
|
2760
2862
|
*/
|
|
2761
2863
|
readonly raw: ReadableStream;
|
|
2864
|
+
/**
|
|
2865
|
+
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2866
|
+
*/
|
|
2867
|
+
readonly headers: Headers;
|
|
2762
2868
|
/**
|
|
2763
2869
|
* Size of the email message content.
|
|
2764
2870
|
*/
|
|
@@ -2777,14 +2883,27 @@ declare interface EmailMessage {
|
|
|
2777
2883
|
*/
|
|
2778
2884
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2779
2885
|
}
|
|
2886
|
+
/**
|
|
2887
|
+
* A binding that allows a Worker to send email messages.
|
|
2888
|
+
*/
|
|
2889
|
+
declare interface SendEmail {
|
|
2890
|
+
send(message: EmailMessage): Promise<void>;
|
|
2891
|
+
}
|
|
2780
2892
|
declare abstract class EmailEvent extends ExtendableEvent {
|
|
2781
|
-
readonly message:
|
|
2893
|
+
readonly message: ForwardableEmailMessage;
|
|
2782
2894
|
}
|
|
2783
2895
|
declare type EmailExportedHandler<Env = unknown> = (
|
|
2784
|
-
message:
|
|
2896
|
+
message: ForwardableEmailMessage,
|
|
2785
2897
|
env: Env,
|
|
2786
2898
|
ctx: ExecutionContext
|
|
2787
2899
|
) => void | Promise<void>;
|
|
2900
|
+
declare module "cloudflare:email" {
|
|
2901
|
+
let _EmailMessage: {
|
|
2902
|
+
prototype: EmailMessage;
|
|
2903
|
+
new (from: string, to: string, raw: ReadableStream | string): EmailMessage;
|
|
2904
|
+
};
|
|
2905
|
+
export { _EmailMessage as EmailMessage };
|
|
2906
|
+
}
|
|
2788
2907
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2789
2908
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2790
2909
|
request: Request;
|
|
@@ -2865,75 +2984,12 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2865
2984
|
// Key Identifier of the JWK
|
|
2866
2985
|
readonly kid: string;
|
|
2867
2986
|
}
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
*/
|
|
2871
|
-
declare interface Message<Body = unknown> {
|
|
2872
|
-
/**
|
|
2873
|
-
* A unique, system-generated ID for the message.
|
|
2874
|
-
*/
|
|
2875
|
-
readonly id: string;
|
|
2876
|
-
/**
|
|
2877
|
-
* A timestamp when the message was sent.
|
|
2878
|
-
*/
|
|
2879
|
-
readonly timestamp: Date;
|
|
2880
|
-
/**
|
|
2881
|
-
* The body of the message.
|
|
2882
|
-
*/
|
|
2883
|
-
readonly body: Body;
|
|
2884
|
-
/**
|
|
2885
|
-
* Marks message to be retried.
|
|
2886
|
-
*/
|
|
2887
|
-
retry(): void;
|
|
2888
|
-
/**
|
|
2889
|
-
* Marks message acknowledged.
|
|
2890
|
-
*/
|
|
2891
|
-
ack(): void;
|
|
2892
|
-
}
|
|
2893
|
-
/**
|
|
2894
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2895
|
-
*/
|
|
2896
|
-
declare interface MessageBatch<Body = unknown> {
|
|
2897
|
-
/**
|
|
2898
|
-
* The name of the Queue that belongs to this batch.
|
|
2899
|
-
*/
|
|
2900
|
-
readonly queue: string;
|
|
2901
|
-
/**
|
|
2902
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2903
|
-
*/
|
|
2904
|
-
readonly messages: readonly Message<Body>[];
|
|
2987
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
2988
|
+
declare interface DispatchNamespace {
|
|
2905
2989
|
/**
|
|
2906
|
-
*
|
|
2990
|
+
* @param name Name of the Worker script.
|
|
2991
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
2992
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2907
2993
|
*/
|
|
2908
|
-
|
|
2909
|
-
/**
|
|
2910
|
-
* Marks every message acknowledged in the batch.
|
|
2911
|
-
*/
|
|
2912
|
-
ackAll(): void;
|
|
2913
|
-
}
|
|
2914
|
-
/**
|
|
2915
|
-
* A wrapper class used to structure message batches.
|
|
2916
|
-
*/
|
|
2917
|
-
declare type MessageSendRequest<Body = unknown> = {
|
|
2918
|
-
/**
|
|
2919
|
-
* The body of the message.
|
|
2920
|
-
*/
|
|
2921
|
-
body: Body;
|
|
2922
|
-
};
|
|
2923
|
-
/**
|
|
2924
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
2925
|
-
*/
|
|
2926
|
-
declare interface Queue<Body = any> {
|
|
2927
|
-
/**
|
|
2928
|
-
* Sends a message to the Queue.
|
|
2929
|
-
* @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.
|
|
2930
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2931
|
-
*/
|
|
2932
|
-
send(message: Body): Promise<void>;
|
|
2933
|
-
/**
|
|
2934
|
-
* Sends a batch of messages to the Queue.
|
|
2935
|
-
* @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.
|
|
2936
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2937
|
-
*/
|
|
2938
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2994
|
+
get(name: string): Fetcher;
|
|
2939
2995
|
}
|