@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/2022-11-30/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
|
};
|
|
@@ -291,8 +292,11 @@ declare interface ExecutionContext {
|
|
|
291
292
|
waitUntil(promise: Promise<any>): void;
|
|
292
293
|
passThroughOnException(): void;
|
|
293
294
|
}
|
|
294
|
-
declare type ExportedHandlerFetchHandler<
|
|
295
|
-
|
|
295
|
+
declare type ExportedHandlerFetchHandler<
|
|
296
|
+
Env = unknown,
|
|
297
|
+
CfHostMetadata = unknown
|
|
298
|
+
> = (
|
|
299
|
+
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
296
300
|
env: Env,
|
|
297
301
|
ctx: ExecutionContext
|
|
298
302
|
) => Response | Promise<Response>;
|
|
@@ -316,12 +320,16 @@ declare type ExportedHandlerTestHandler<Env = unknown> = (
|
|
|
316
320
|
env: Env,
|
|
317
321
|
ctx: ExecutionContext
|
|
318
322
|
) => void | Promise<void>;
|
|
319
|
-
declare interface ExportedHandler<
|
|
320
|
-
|
|
323
|
+
declare interface ExportedHandler<
|
|
324
|
+
Env = unknown,
|
|
325
|
+
QueueMessage = unknown,
|
|
326
|
+
CfHostMetadata = unknown
|
|
327
|
+
> {
|
|
328
|
+
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
321
329
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
322
330
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
323
331
|
test?: ExportedHandlerTestHandler<Env>;
|
|
324
|
-
queue?: ExportedHandlerQueueHandler<Env,
|
|
332
|
+
queue?: ExportedHandlerQueueHandler<Env, Message>;
|
|
325
333
|
}
|
|
326
334
|
declare interface StructuredSerializeOptions {
|
|
327
335
|
transfer?: any[];
|
|
@@ -356,13 +364,24 @@ declare interface DurableObjectNamespace {
|
|
|
356
364
|
id: DurableObjectId,
|
|
357
365
|
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
358
366
|
): DurableObjectStub;
|
|
359
|
-
jurisdiction(jurisdiction:
|
|
367
|
+
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
|
|
360
368
|
}
|
|
369
|
+
declare type DurableObjectJurisdiction = "eu" | "fedramp";
|
|
361
370
|
declare interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
362
|
-
jurisdiction?:
|
|
363
|
-
}
|
|
371
|
+
jurisdiction?: DurableObjectJurisdiction;
|
|
372
|
+
}
|
|
373
|
+
declare type DurableObjectLocationHint =
|
|
374
|
+
| "wnam"
|
|
375
|
+
| "enam"
|
|
376
|
+
| "sam"
|
|
377
|
+
| "weur"
|
|
378
|
+
| "eeur"
|
|
379
|
+
| "apac"
|
|
380
|
+
| "oc"
|
|
381
|
+
| "afr"
|
|
382
|
+
| "me";
|
|
364
383
|
declare interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
365
|
-
locationHint?:
|
|
384
|
+
locationHint?: DurableObjectLocationHint;
|
|
366
385
|
}
|
|
367
386
|
declare interface DurableObjectState {
|
|
368
387
|
waitUntil(promise: Promise<any>): void;
|
|
@@ -992,23 +1011,27 @@ declare interface ResponseInit {
|
|
|
992
1011
|
webSocket?: WebSocket | null;
|
|
993
1012
|
encodeBody?: "automatic" | "manual";
|
|
994
1013
|
}
|
|
995
|
-
declare type RequestInfo
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
1014
|
+
declare type RequestInfo<
|
|
1015
|
+
CfHostMetadata = unknown,
|
|
1016
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1017
|
+
> = Request<CfHostMetadata, Cf> | string | URL;
|
|
1018
|
+
declare class Request<
|
|
1019
|
+
CfHostMetadata = unknown,
|
|
1020
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1021
|
+
> extends Body {
|
|
1022
|
+
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1023
|
+
clone(): Request<CfHostMetadata, Cf>;
|
|
999
1024
|
get method(): string;
|
|
1000
1025
|
get url(): string;
|
|
1001
1026
|
get headers(): Headers;
|
|
1002
1027
|
get redirect(): string;
|
|
1003
1028
|
get fetcher(): Fetcher | null;
|
|
1004
1029
|
get signal(): AbortSignal;
|
|
1005
|
-
get cf():
|
|
1030
|
+
get cf(): Cf | undefined;
|
|
1006
1031
|
get integrity(): string;
|
|
1007
1032
|
get keepalive(): boolean;
|
|
1008
1033
|
}
|
|
1009
|
-
declare interface RequestInit<
|
|
1010
|
-
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
1011
|
-
> {
|
|
1034
|
+
declare interface RequestInit<Cf = CfProperties> {
|
|
1012
1035
|
/** A string to set request's method. */
|
|
1013
1036
|
method?: string;
|
|
1014
1037
|
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
@@ -1018,17 +1041,14 @@ declare interface RequestInit<
|
|
|
1018
1041
|
/** 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. */
|
|
1019
1042
|
redirect?: string;
|
|
1020
1043
|
fetcher?: Fetcher | null;
|
|
1021
|
-
cf?:
|
|
1044
|
+
cf?: Cf;
|
|
1022
1045
|
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1023
1046
|
integrity?: string;
|
|
1024
1047
|
/** An AbortSignal to set request's signal. */
|
|
1025
1048
|
signal?: AbortSignal | null;
|
|
1026
1049
|
}
|
|
1027
1050
|
declare abstract class Fetcher {
|
|
1028
|
-
fetch(
|
|
1029
|
-
input: RequestInfo,
|
|
1030
|
-
init?: RequestInit<RequestInitCfProperties>
|
|
1031
|
-
): Promise<Response>;
|
|
1051
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1032
1052
|
}
|
|
1033
1053
|
declare interface FetcherPutOptions {
|
|
1034
1054
|
expiration?: number;
|
|
@@ -1141,6 +1161,33 @@ declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1141
1161
|
value: Value | null;
|
|
1142
1162
|
metadata: Metadata | null;
|
|
1143
1163
|
}
|
|
1164
|
+
declare interface Queue<Body> {
|
|
1165
|
+
send(message: Body): Promise<void>;
|
|
1166
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1167
|
+
}
|
|
1168
|
+
declare interface QueueSendOptions {}
|
|
1169
|
+
declare interface MessageSendRequest<Body = unknown> {
|
|
1170
|
+
body: Body;
|
|
1171
|
+
}
|
|
1172
|
+
declare interface Message<Body = unknown> {
|
|
1173
|
+
readonly id: string;
|
|
1174
|
+
readonly timestamp: Date;
|
|
1175
|
+
readonly body: Body;
|
|
1176
|
+
retry(): void;
|
|
1177
|
+
ack(): void;
|
|
1178
|
+
}
|
|
1179
|
+
declare interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1180
|
+
readonly messages: readonly Message<Body>[];
|
|
1181
|
+
readonly queue: string;
|
|
1182
|
+
retryAll(): void;
|
|
1183
|
+
ackAll(): void;
|
|
1184
|
+
}
|
|
1185
|
+
declare interface MessageBatch<Body = unknown> {
|
|
1186
|
+
readonly messages: readonly Message<Body>[];
|
|
1187
|
+
readonly queue: string;
|
|
1188
|
+
retryAll(): void;
|
|
1189
|
+
ackAll(): void;
|
|
1190
|
+
}
|
|
1144
1191
|
declare interface R2Error extends Error {
|
|
1145
1192
|
readonly name: string;
|
|
1146
1193
|
readonly code: number;
|
|
@@ -1292,12 +1339,18 @@ declare interface R2HTTPMetadata {
|
|
|
1292
1339
|
cacheControl?: string;
|
|
1293
1340
|
cacheExpiry?: Date;
|
|
1294
1341
|
}
|
|
1295
|
-
declare
|
|
1342
|
+
declare type R2Objects = {
|
|
1296
1343
|
objects: R2Object[];
|
|
1297
|
-
truncated: boolean;
|
|
1298
|
-
cursor?: string;
|
|
1299
1344
|
delimitedPrefixes: string[];
|
|
1300
|
-
}
|
|
1345
|
+
} & (
|
|
1346
|
+
| {
|
|
1347
|
+
truncated: true;
|
|
1348
|
+
cursor: string;
|
|
1349
|
+
}
|
|
1350
|
+
| {
|
|
1351
|
+
truncated: false;
|
|
1352
|
+
}
|
|
1353
|
+
);
|
|
1301
1354
|
declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1302
1355
|
readonly scheduledTime: number;
|
|
1303
1356
|
readonly cron: string;
|
|
@@ -1507,13 +1560,19 @@ declare class TransformStream<I = any, O = any> {
|
|
|
1507
1560
|
get writable(): WritableStream<I>;
|
|
1508
1561
|
}
|
|
1509
1562
|
declare class FixedLengthStream extends IdentityTransformStream {
|
|
1510
|
-
constructor(
|
|
1563
|
+
constructor(
|
|
1564
|
+
expectedLength: number | bigint,
|
|
1565
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy
|
|
1566
|
+
);
|
|
1511
1567
|
}
|
|
1512
1568
|
declare class IdentityTransformStream extends TransformStream<
|
|
1513
1569
|
ArrayBuffer | ArrayBufferView,
|
|
1514
1570
|
Uint8Array
|
|
1515
1571
|
> {
|
|
1516
|
-
constructor();
|
|
1572
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
1573
|
+
}
|
|
1574
|
+
declare interface IdentityTransformStreamQueuingStrategy {
|
|
1575
|
+
highWaterMark?: number | bigint;
|
|
1517
1576
|
}
|
|
1518
1577
|
declare interface ReadableStreamValuesOptions {
|
|
1519
1578
|
preventCancel?: boolean;
|
|
@@ -1658,6 +1717,7 @@ declare class URL {
|
|
|
1658
1717
|
get searchParams(): URLSearchParams;
|
|
1659
1718
|
toJSON(): string;
|
|
1660
1719
|
toString(): string;
|
|
1720
|
+
static canParse(url: string, base?: string): boolean;
|
|
1661
1721
|
}
|
|
1662
1722
|
declare class URLSearchParams {
|
|
1663
1723
|
constructor(
|
|
@@ -1862,7 +1922,7 @@ declare interface BasicImageTransformationsGravityCoordinates {
|
|
|
1862
1922
|
* Note: Currently, these properties cannot be tested in the
|
|
1863
1923
|
* playground.
|
|
1864
1924
|
*/
|
|
1865
|
-
declare interface RequestInitCfProperties {
|
|
1925
|
+
declare interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1866
1926
|
cacheEverything?: boolean;
|
|
1867
1927
|
/**
|
|
1868
1928
|
* A request's cache key is what determines if two requests are
|
|
@@ -2032,6 +2092,49 @@ declare interface RequestInitCfPropertiesImage
|
|
|
2032
2092
|
* the origin.
|
|
2033
2093
|
*/
|
|
2034
2094
|
"origin-auth"?: "share-publicly";
|
|
2095
|
+
/**
|
|
2096
|
+
* Adds a border around the image. The border is added after resizing. Border
|
|
2097
|
+
* width takes dpr into account, and can be specified either using a single
|
|
2098
|
+
* width property, or individually for each side.
|
|
2099
|
+
*/
|
|
2100
|
+
border?:
|
|
2101
|
+
| {
|
|
2102
|
+
color: string;
|
|
2103
|
+
width: number;
|
|
2104
|
+
}
|
|
2105
|
+
| {
|
|
2106
|
+
color: string;
|
|
2107
|
+
top: number;
|
|
2108
|
+
right: number;
|
|
2109
|
+
bottom: number;
|
|
2110
|
+
left: number;
|
|
2111
|
+
};
|
|
2112
|
+
/**
|
|
2113
|
+
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
2114
|
+
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
2115
|
+
* 0 is ignored.
|
|
2116
|
+
*/
|
|
2117
|
+
brightness?: number;
|
|
2118
|
+
/**
|
|
2119
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
2120
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
2121
|
+
* ignored.
|
|
2122
|
+
*/
|
|
2123
|
+
contrast?: number;
|
|
2124
|
+
/**
|
|
2125
|
+
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
2126
|
+
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
2127
|
+
*/
|
|
2128
|
+
gamma?: number;
|
|
2129
|
+
/**
|
|
2130
|
+
* Slightly reduces latency on a cache miss by selecting a
|
|
2131
|
+
* quickest-to-compress file format, at a cost of increased file size and
|
|
2132
|
+
* lower image quality. It will usually override the format option and choose
|
|
2133
|
+
* JPEG over WebP or AVIF. We do not recommend using this option, except in
|
|
2134
|
+
* unusual circumstances like resizing uncacheable dynamically-generated
|
|
2135
|
+
* images.
|
|
2136
|
+
*/
|
|
2137
|
+
compression?: "fast";
|
|
2035
2138
|
}
|
|
2036
2139
|
declare interface RequestInitCfPropertiesImageMinify {
|
|
2037
2140
|
javascript?: boolean;
|
|
@@ -2047,7 +2150,8 @@ declare type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2047
2150
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2048
2151
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2049
2152
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2050
|
-
declare interface IncomingRequestCfPropertiesBase
|
|
2153
|
+
declare interface IncomingRequestCfPropertiesBase
|
|
2154
|
+
extends Record<string, unknown> {
|
|
2051
2155
|
/**
|
|
2052
2156
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2053
2157
|
*
|
|
@@ -2128,8 +2232,7 @@ declare interface IncomingRequestCfPropertiesBase {
|
|
|
2128
2232
|
declare interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2129
2233
|
/**
|
|
2130
2234
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2131
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2132
|
-
* and `99` (almost certainly a bot).
|
|
2235
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2133
2236
|
*
|
|
2134
2237
|
* @example 54
|
|
2135
2238
|
*/
|
|
@@ -2240,86 +2343,82 @@ declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2240
2343
|
/**
|
|
2241
2344
|
* Geographic data about the request's origin.
|
|
2242
2345
|
*/
|
|
2243
|
-
declare
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
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
|
-
* @example "635"
|
|
2320
|
-
*/
|
|
2321
|
-
metroCode?: string;
|
|
2322
|
-
};
|
|
2346
|
+
declare interface IncomingRequestCfPropertiesGeographicInformation {
|
|
2347
|
+
/**
|
|
2348
|
+
* The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
|
|
2349
|
+
*
|
|
2350
|
+
* 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.
|
|
2351
|
+
*
|
|
2352
|
+
* If Cloudflare is unable to determine where the request originated this property is omitted.
|
|
2353
|
+
*
|
|
2354
|
+
* The country code `"T1"` is used for requests originating on TOR.
|
|
2355
|
+
*
|
|
2356
|
+
* @example "GB"
|
|
2357
|
+
*/
|
|
2358
|
+
country?: Iso3166Alpha2Code | "T1";
|
|
2359
|
+
/**
|
|
2360
|
+
* If present, this property indicates that the request originated in the EU
|
|
2361
|
+
*
|
|
2362
|
+
* @example "1"
|
|
2363
|
+
*/
|
|
2364
|
+
isEUCountry?: "1";
|
|
2365
|
+
/**
|
|
2366
|
+
* A two-letter code indicating the continent the request originated from.
|
|
2367
|
+
*
|
|
2368
|
+
* @example "AN"
|
|
2369
|
+
*/
|
|
2370
|
+
continent?: ContinentCode;
|
|
2371
|
+
/**
|
|
2372
|
+
* The city the request originated from
|
|
2373
|
+
*
|
|
2374
|
+
* @example "Austin"
|
|
2375
|
+
*/
|
|
2376
|
+
city?: string;
|
|
2377
|
+
/**
|
|
2378
|
+
* Postal code of the incoming request
|
|
2379
|
+
*
|
|
2380
|
+
* @example "78701"
|
|
2381
|
+
*/
|
|
2382
|
+
postalCode?: string;
|
|
2383
|
+
/**
|
|
2384
|
+
* Latitude of the incoming request
|
|
2385
|
+
*
|
|
2386
|
+
* @example "30.27130"
|
|
2387
|
+
*/
|
|
2388
|
+
latitude?: string;
|
|
2389
|
+
/**
|
|
2390
|
+
* Longitude of the incoming request
|
|
2391
|
+
*
|
|
2392
|
+
* @example "-97.74260"
|
|
2393
|
+
*/
|
|
2394
|
+
longitude?: string;
|
|
2395
|
+
/**
|
|
2396
|
+
* Timezone of the incoming request
|
|
2397
|
+
*
|
|
2398
|
+
* @example "America/Chicago"
|
|
2399
|
+
*/
|
|
2400
|
+
timezone?: string;
|
|
2401
|
+
/**
|
|
2402
|
+
* If known, the ISO 3166-2 name for the first level region associated with
|
|
2403
|
+
* the IP address of the incoming request
|
|
2404
|
+
*
|
|
2405
|
+
* @example "Texas"
|
|
2406
|
+
*/
|
|
2407
|
+
region?: string;
|
|
2408
|
+
/**
|
|
2409
|
+
* If known, the ISO 3166-2 code for the first-level region associated with
|
|
2410
|
+
* the IP address of the incoming request
|
|
2411
|
+
*
|
|
2412
|
+
* @example "TX"
|
|
2413
|
+
*/
|
|
2414
|
+
regionCode?: string;
|
|
2415
|
+
/**
|
|
2416
|
+
* Metro code (DMA) of the incoming request
|
|
2417
|
+
*
|
|
2418
|
+
* @example "635"
|
|
2419
|
+
*/
|
|
2420
|
+
metroCode?: string;
|
|
2421
|
+
}
|
|
2323
2422
|
/** Data about the incoming request's TLS certificate */
|
|
2324
2423
|
declare interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2325
2424
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2712,6 +2811,9 @@ declare type Iso3166Alpha2Code =
|
|
|
2712
2811
|
| "ZW";
|
|
2713
2812
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2714
2813
|
declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2814
|
+
declare type CfProperties<HostMetadata = unknown> =
|
|
2815
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2816
|
+
| RequestInitCfProperties;
|
|
2715
2817
|
declare interface D1Result<T = unknown> {
|
|
2716
2818
|
results?: T[];
|
|
2717
2819
|
success: boolean;
|
|
@@ -2732,7 +2834,7 @@ declare abstract class D1PreparedStatement {
|
|
|
2732
2834
|
raw<T = unknown>(): Promise<T[]>;
|
|
2733
2835
|
}
|
|
2734
2836
|
/**
|
|
2735
|
-
*
|
|
2837
|
+
* An email message that can be sent from a Worker.
|
|
2736
2838
|
*/
|
|
2737
2839
|
declare interface EmailMessage {
|
|
2738
2840
|
/**
|
|
@@ -2743,14 +2845,19 @@ declare interface EmailMessage {
|
|
|
2743
2845
|
* Envelope To attribute of the email message.
|
|
2744
2846
|
*/
|
|
2745
2847
|
readonly to: string;
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2848
|
+
}
|
|
2849
|
+
/**
|
|
2850
|
+
* An email message that is sent to a consumer Worker and can be rejected/forwarded.
|
|
2851
|
+
*/
|
|
2852
|
+
declare interface ForwardableEmailMessage extends EmailMessage {
|
|
2750
2853
|
/**
|
|
2751
2854
|
* Stream of the email message content.
|
|
2752
2855
|
*/
|
|
2753
2856
|
readonly raw: ReadableStream;
|
|
2857
|
+
/**
|
|
2858
|
+
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2859
|
+
*/
|
|
2860
|
+
readonly headers: Headers;
|
|
2754
2861
|
/**
|
|
2755
2862
|
* Size of the email message content.
|
|
2756
2863
|
*/
|
|
@@ -2769,14 +2876,27 @@ declare interface EmailMessage {
|
|
|
2769
2876
|
*/
|
|
2770
2877
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2771
2878
|
}
|
|
2879
|
+
/**
|
|
2880
|
+
* A binding that allows a Worker to send email messages.
|
|
2881
|
+
*/
|
|
2882
|
+
declare interface SendEmail {
|
|
2883
|
+
send(message: EmailMessage): Promise<void>;
|
|
2884
|
+
}
|
|
2772
2885
|
declare abstract class EmailEvent extends ExtendableEvent {
|
|
2773
|
-
readonly message:
|
|
2886
|
+
readonly message: ForwardableEmailMessage;
|
|
2774
2887
|
}
|
|
2775
2888
|
declare type EmailExportedHandler<Env = unknown> = (
|
|
2776
|
-
message:
|
|
2889
|
+
message: ForwardableEmailMessage,
|
|
2777
2890
|
env: Env,
|
|
2778
2891
|
ctx: ExecutionContext
|
|
2779
2892
|
) => void | Promise<void>;
|
|
2893
|
+
declare module "cloudflare:email" {
|
|
2894
|
+
let _EmailMessage: {
|
|
2895
|
+
prototype: EmailMessage;
|
|
2896
|
+
new (from: string, to: string, raw: ReadableStream | string): EmailMessage;
|
|
2897
|
+
};
|
|
2898
|
+
export { _EmailMessage as EmailMessage };
|
|
2899
|
+
}
|
|
2780
2900
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2781
2901
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2782
2902
|
request: Request;
|
|
@@ -2857,75 +2977,12 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2857
2977
|
// Key Identifier of the JWK
|
|
2858
2978
|
readonly kid: string;
|
|
2859
2979
|
}
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
*/
|
|
2863
|
-
declare interface Message<Body = unknown> {
|
|
2864
|
-
/**
|
|
2865
|
-
* A unique, system-generated ID for the message.
|
|
2866
|
-
*/
|
|
2867
|
-
readonly id: string;
|
|
2868
|
-
/**
|
|
2869
|
-
* A timestamp when the message was sent.
|
|
2870
|
-
*/
|
|
2871
|
-
readonly timestamp: Date;
|
|
2872
|
-
/**
|
|
2873
|
-
* The body of the message.
|
|
2874
|
-
*/
|
|
2875
|
-
readonly body: Body;
|
|
2876
|
-
/**
|
|
2877
|
-
* Marks message to be retried.
|
|
2878
|
-
*/
|
|
2879
|
-
retry(): void;
|
|
2880
|
-
/**
|
|
2881
|
-
* Marks message acknowledged.
|
|
2882
|
-
*/
|
|
2883
|
-
ack(): void;
|
|
2884
|
-
}
|
|
2885
|
-
/**
|
|
2886
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2887
|
-
*/
|
|
2888
|
-
declare interface MessageBatch<Body = unknown> {
|
|
2889
|
-
/**
|
|
2890
|
-
* The name of the Queue that belongs to this batch.
|
|
2891
|
-
*/
|
|
2892
|
-
readonly queue: string;
|
|
2893
|
-
/**
|
|
2894
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2895
|
-
*/
|
|
2896
|
-
readonly messages: readonly Message<Body>[];
|
|
2980
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
2981
|
+
declare interface DispatchNamespace {
|
|
2897
2982
|
/**
|
|
2898
|
-
*
|
|
2983
|
+
* @param name Name of the Worker script.
|
|
2984
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
2985
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2899
2986
|
*/
|
|
2900
|
-
|
|
2901
|
-
/**
|
|
2902
|
-
* Marks every message acknowledged in the batch.
|
|
2903
|
-
*/
|
|
2904
|
-
ackAll(): void;
|
|
2905
|
-
}
|
|
2906
|
-
/**
|
|
2907
|
-
* A wrapper class used to structure message batches.
|
|
2908
|
-
*/
|
|
2909
|
-
declare type MessageSendRequest<Body = unknown> = {
|
|
2910
|
-
/**
|
|
2911
|
-
* The body of the message.
|
|
2912
|
-
*/
|
|
2913
|
-
body: Body;
|
|
2914
|
-
};
|
|
2915
|
-
/**
|
|
2916
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
2917
|
-
*/
|
|
2918
|
-
declare interface Queue<Body = any> {
|
|
2919
|
-
/**
|
|
2920
|
-
* Sends a message to the Queue.
|
|
2921
|
-
* @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.
|
|
2922
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2923
|
-
*/
|
|
2924
|
-
send(message: Body): Promise<void>;
|
|
2925
|
-
/**
|
|
2926
|
-
* Sends a batch of messages to the Queue.
|
|
2927
|
-
* @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.
|
|
2928
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2929
|
-
*/
|
|
2930
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2987
|
+
get(name: string): Fetcher;
|
|
2931
2988
|
}
|