@cloudflare/workers-types 0.20230215.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 +259 -191
- package/2021-11-03/index.ts +252 -191
- package/2022-01-31/index.d.ts +259 -191
- package/2022-01-31/index.ts +252 -191
- package/2022-03-21/index.d.ts +259 -191
- package/2022-03-21/index.ts +252 -191
- package/2022-08-04/index.d.ts +259 -191
- package/2022-08-04/index.ts +252 -191
- package/2022-10-31/index.d.ts +260 -191
- package/2022-10-31/index.ts +253 -191
- package/2022-11-30/index.d.ts +260 -191
- package/2022-11-30/index.ts +253 -191
- package/README.md +1 -1
- package/experimental/index.d.ts +313 -191
- package/experimental/index.ts +306 -191
- package/index.d.ts +259 -191
- package/index.ts +252 -191
- package/oldest/index.d.ts +259 -191
- package/oldest/index.ts +252 -191
- package/package.json +1 -1
package/2022-10-31/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
|
};
|
|
@@ -282,12 +283,16 @@ declare const crypto: Crypto;
|
|
|
282
283
|
declare const caches: CacheStorage;
|
|
283
284
|
declare const scheduler: Scheduler;
|
|
284
285
|
declare const navigator: Navigator;
|
|
286
|
+
declare interface TestController {}
|
|
285
287
|
declare interface ExecutionContext {
|
|
286
288
|
waitUntil(promise: Promise<any>): void;
|
|
287
289
|
passThroughOnException(): void;
|
|
288
290
|
}
|
|
289
|
-
declare type ExportedHandlerFetchHandler<
|
|
290
|
-
|
|
291
|
+
declare type ExportedHandlerFetchHandler<
|
|
292
|
+
Env = unknown,
|
|
293
|
+
CfHostMetadata = unknown
|
|
294
|
+
> = (
|
|
295
|
+
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
291
296
|
env: Env,
|
|
292
297
|
ctx: ExecutionContext
|
|
293
298
|
) => Response | Promise<Response>;
|
|
@@ -306,11 +311,21 @@ declare type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
|
|
|
306
311
|
env: Env,
|
|
307
312
|
ctx: ExecutionContext
|
|
308
313
|
) => void | Promise<void>;
|
|
309
|
-
declare
|
|
310
|
-
|
|
314
|
+
declare type ExportedHandlerTestHandler<Env = unknown> = (
|
|
315
|
+
controller: TestController,
|
|
316
|
+
env: Env,
|
|
317
|
+
ctx: ExecutionContext
|
|
318
|
+
) => void | Promise<void>;
|
|
319
|
+
declare interface ExportedHandler<
|
|
320
|
+
Env = unknown,
|
|
321
|
+
QueueMessage = unknown,
|
|
322
|
+
CfHostMetadata = unknown
|
|
323
|
+
> {
|
|
324
|
+
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
311
325
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
312
326
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
313
|
-
|
|
327
|
+
test?: ExportedHandlerTestHandler<Env>;
|
|
328
|
+
queue?: ExportedHandlerQueueHandler<Env, Message>;
|
|
314
329
|
}
|
|
315
330
|
declare interface StructuredSerializeOptions {
|
|
316
331
|
transfer?: any[];
|
|
@@ -345,13 +360,24 @@ declare interface DurableObjectNamespace {
|
|
|
345
360
|
id: DurableObjectId,
|
|
346
361
|
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
347
362
|
): DurableObjectStub;
|
|
348
|
-
jurisdiction(jurisdiction:
|
|
363
|
+
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
|
|
349
364
|
}
|
|
365
|
+
declare type DurableObjectJurisdiction = "eu" | "fedramp";
|
|
350
366
|
declare interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
351
|
-
jurisdiction?:
|
|
352
|
-
}
|
|
367
|
+
jurisdiction?: DurableObjectJurisdiction;
|
|
368
|
+
}
|
|
369
|
+
declare type DurableObjectLocationHint =
|
|
370
|
+
| "wnam"
|
|
371
|
+
| "enam"
|
|
372
|
+
| "sam"
|
|
373
|
+
| "weur"
|
|
374
|
+
| "eeur"
|
|
375
|
+
| "apac"
|
|
376
|
+
| "oc"
|
|
377
|
+
| "afr"
|
|
378
|
+
| "me";
|
|
353
379
|
declare interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
354
|
-
locationHint?:
|
|
380
|
+
locationHint?: DurableObjectLocationHint;
|
|
355
381
|
}
|
|
356
382
|
declare interface DurableObjectState {
|
|
357
383
|
waitUntil(promise: Promise<any>): void;
|
|
@@ -981,23 +1007,27 @@ declare interface ResponseInit {
|
|
|
981
1007
|
webSocket?: WebSocket | null;
|
|
982
1008
|
encodeBody?: "automatic" | "manual";
|
|
983
1009
|
}
|
|
984
|
-
declare type RequestInfo
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
1010
|
+
declare type RequestInfo<
|
|
1011
|
+
CfHostMetadata = unknown,
|
|
1012
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1013
|
+
> = Request<CfHostMetadata, Cf> | string | URL;
|
|
1014
|
+
declare class Request<
|
|
1015
|
+
CfHostMetadata = unknown,
|
|
1016
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1017
|
+
> extends Body {
|
|
1018
|
+
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1019
|
+
clone(): Request<CfHostMetadata, Cf>;
|
|
988
1020
|
get method(): string;
|
|
989
1021
|
get url(): string;
|
|
990
1022
|
get headers(): Headers;
|
|
991
1023
|
get redirect(): string;
|
|
992
1024
|
get fetcher(): Fetcher | null;
|
|
993
1025
|
get signal(): AbortSignal;
|
|
994
|
-
get cf():
|
|
1026
|
+
get cf(): Cf | undefined;
|
|
995
1027
|
get integrity(): string;
|
|
996
1028
|
get keepalive(): boolean;
|
|
997
1029
|
}
|
|
998
|
-
declare interface RequestInit<
|
|
999
|
-
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
1000
|
-
> {
|
|
1030
|
+
declare interface RequestInit<Cf = CfProperties> {
|
|
1001
1031
|
/** A string to set request's method. */
|
|
1002
1032
|
method?: string;
|
|
1003
1033
|
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
@@ -1007,17 +1037,14 @@ declare interface RequestInit<
|
|
|
1007
1037
|
/** 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. */
|
|
1008
1038
|
redirect?: string;
|
|
1009
1039
|
fetcher?: Fetcher | null;
|
|
1010
|
-
cf?:
|
|
1040
|
+
cf?: Cf;
|
|
1011
1041
|
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1012
1042
|
integrity?: string;
|
|
1013
1043
|
/** An AbortSignal to set request's signal. */
|
|
1014
1044
|
signal?: AbortSignal | null;
|
|
1015
1045
|
}
|
|
1016
1046
|
declare abstract class Fetcher {
|
|
1017
|
-
fetch(
|
|
1018
|
-
input: RequestInfo,
|
|
1019
|
-
init?: RequestInit<RequestInitCfProperties>
|
|
1020
|
-
): Promise<Response>;
|
|
1047
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1021
1048
|
}
|
|
1022
1049
|
declare interface FetcherPutOptions {
|
|
1023
1050
|
expiration?: number;
|
|
@@ -1130,6 +1157,33 @@ declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1130
1157
|
value: Value | null;
|
|
1131
1158
|
metadata: Metadata | null;
|
|
1132
1159
|
}
|
|
1160
|
+
declare interface Queue<Body> {
|
|
1161
|
+
send(message: Body): Promise<void>;
|
|
1162
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1163
|
+
}
|
|
1164
|
+
declare interface QueueSendOptions {}
|
|
1165
|
+
declare interface MessageSendRequest<Body = unknown> {
|
|
1166
|
+
body: Body;
|
|
1167
|
+
}
|
|
1168
|
+
declare interface Message<Body = unknown> {
|
|
1169
|
+
readonly id: string;
|
|
1170
|
+
readonly timestamp: Date;
|
|
1171
|
+
readonly body: Body;
|
|
1172
|
+
retry(): void;
|
|
1173
|
+
ack(): void;
|
|
1174
|
+
}
|
|
1175
|
+
declare interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1176
|
+
readonly messages: readonly Message<Body>[];
|
|
1177
|
+
readonly queue: string;
|
|
1178
|
+
retryAll(): void;
|
|
1179
|
+
ackAll(): void;
|
|
1180
|
+
}
|
|
1181
|
+
declare interface MessageBatch<Body = unknown> {
|
|
1182
|
+
readonly messages: readonly Message<Body>[];
|
|
1183
|
+
readonly queue: string;
|
|
1184
|
+
retryAll(): void;
|
|
1185
|
+
ackAll(): void;
|
|
1186
|
+
}
|
|
1133
1187
|
declare interface R2Error extends Error {
|
|
1134
1188
|
readonly name: string;
|
|
1135
1189
|
readonly code: number;
|
|
@@ -1281,12 +1335,18 @@ declare interface R2HTTPMetadata {
|
|
|
1281
1335
|
cacheControl?: string;
|
|
1282
1336
|
cacheExpiry?: Date;
|
|
1283
1337
|
}
|
|
1284
|
-
declare
|
|
1338
|
+
declare type R2Objects = {
|
|
1285
1339
|
objects: R2Object[];
|
|
1286
|
-
truncated: boolean;
|
|
1287
|
-
cursor?: string;
|
|
1288
1340
|
delimitedPrefixes: string[];
|
|
1289
|
-
}
|
|
1341
|
+
} & (
|
|
1342
|
+
| {
|
|
1343
|
+
truncated: true;
|
|
1344
|
+
cursor: string;
|
|
1345
|
+
}
|
|
1346
|
+
| {
|
|
1347
|
+
truncated: false;
|
|
1348
|
+
}
|
|
1349
|
+
);
|
|
1290
1350
|
declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1291
1351
|
readonly scheduledTime: number;
|
|
1292
1352
|
readonly cron: string;
|
|
@@ -1497,13 +1557,19 @@ declare class TransformStream<I = any, O = any> {
|
|
|
1497
1557
|
get writable(): WritableStream<I>;
|
|
1498
1558
|
}
|
|
1499
1559
|
declare class FixedLengthStream extends IdentityTransformStream {
|
|
1500
|
-
constructor(
|
|
1560
|
+
constructor(
|
|
1561
|
+
expectedLength: number | bigint,
|
|
1562
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy
|
|
1563
|
+
);
|
|
1501
1564
|
}
|
|
1502
1565
|
declare class IdentityTransformStream extends TransformStream<
|
|
1503
1566
|
ArrayBuffer | ArrayBufferView,
|
|
1504
1567
|
Uint8Array
|
|
1505
1568
|
> {
|
|
1506
|
-
constructor();
|
|
1569
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
1570
|
+
}
|
|
1571
|
+
declare interface IdentityTransformStreamQueuingStrategy {
|
|
1572
|
+
highWaterMark?: number | bigint;
|
|
1507
1573
|
}
|
|
1508
1574
|
declare interface ReadableStreamValuesOptions {
|
|
1509
1575
|
preventCancel?: boolean;
|
|
@@ -1512,13 +1578,13 @@ declare class CompressionStream extends TransformStream<
|
|
|
1512
1578
|
ArrayBuffer | ArrayBufferView,
|
|
1513
1579
|
Uint8Array
|
|
1514
1580
|
> {
|
|
1515
|
-
constructor(format: "gzip" | "deflate");
|
|
1581
|
+
constructor(format: "gzip" | "deflate" | "deflate-raw");
|
|
1516
1582
|
}
|
|
1517
1583
|
declare class DecompressionStream extends TransformStream<
|
|
1518
1584
|
ArrayBuffer | ArrayBufferView,
|
|
1519
1585
|
Uint8Array
|
|
1520
1586
|
> {
|
|
1521
|
-
constructor(format: "gzip" | "deflate");
|
|
1587
|
+
constructor(format: "gzip" | "deflate" | "deflate-raw");
|
|
1522
1588
|
}
|
|
1523
1589
|
declare class TextEncoderStream extends TransformStream<string, Uint8Array> {
|
|
1524
1590
|
constructor();
|
|
@@ -1648,11 +1714,13 @@ declare class URL {
|
|
|
1648
1714
|
get searchParams(): URLSearchParams;
|
|
1649
1715
|
toJSON(): string;
|
|
1650
1716
|
toString(): string;
|
|
1717
|
+
static canParse(url: string, base?: string): boolean;
|
|
1651
1718
|
}
|
|
1652
1719
|
declare class URLSearchParams {
|
|
1653
1720
|
constructor(
|
|
1654
1721
|
init?: Iterable<Iterable<string>> | Record<string, string> | string
|
|
1655
1722
|
);
|
|
1723
|
+
get size(): number;
|
|
1656
1724
|
append(name: string, value: string): void;
|
|
1657
1725
|
delete(name: string): void;
|
|
1658
1726
|
get(name: string): string | null;
|
|
@@ -1851,7 +1919,7 @@ declare interface BasicImageTransformationsGravityCoordinates {
|
|
|
1851
1919
|
* Note: Currently, these properties cannot be tested in the
|
|
1852
1920
|
* playground.
|
|
1853
1921
|
*/
|
|
1854
|
-
declare interface RequestInitCfProperties {
|
|
1922
|
+
declare interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1855
1923
|
cacheEverything?: boolean;
|
|
1856
1924
|
/**
|
|
1857
1925
|
* A request's cache key is what determines if two requests are
|
|
@@ -2021,6 +2089,49 @@ declare interface RequestInitCfPropertiesImage
|
|
|
2021
2089
|
* the origin.
|
|
2022
2090
|
*/
|
|
2023
2091
|
"origin-auth"?: "share-publicly";
|
|
2092
|
+
/**
|
|
2093
|
+
* Adds a border around the image. The border is added after resizing. Border
|
|
2094
|
+
* width takes dpr into account, and can be specified either using a single
|
|
2095
|
+
* width property, or individually for each side.
|
|
2096
|
+
*/
|
|
2097
|
+
border?:
|
|
2098
|
+
| {
|
|
2099
|
+
color: string;
|
|
2100
|
+
width: number;
|
|
2101
|
+
}
|
|
2102
|
+
| {
|
|
2103
|
+
color: string;
|
|
2104
|
+
top: number;
|
|
2105
|
+
right: number;
|
|
2106
|
+
bottom: number;
|
|
2107
|
+
left: number;
|
|
2108
|
+
};
|
|
2109
|
+
/**
|
|
2110
|
+
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
2111
|
+
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
2112
|
+
* 0 is ignored.
|
|
2113
|
+
*/
|
|
2114
|
+
brightness?: number;
|
|
2115
|
+
/**
|
|
2116
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
2117
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
2118
|
+
* ignored.
|
|
2119
|
+
*/
|
|
2120
|
+
contrast?: number;
|
|
2121
|
+
/**
|
|
2122
|
+
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
2123
|
+
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
2124
|
+
*/
|
|
2125
|
+
gamma?: number;
|
|
2126
|
+
/**
|
|
2127
|
+
* Slightly reduces latency on a cache miss by selecting a
|
|
2128
|
+
* quickest-to-compress file format, at a cost of increased file size and
|
|
2129
|
+
* lower image quality. It will usually override the format option and choose
|
|
2130
|
+
* JPEG over WebP or AVIF. We do not recommend using this option, except in
|
|
2131
|
+
* unusual circumstances like resizing uncacheable dynamically-generated
|
|
2132
|
+
* images.
|
|
2133
|
+
*/
|
|
2134
|
+
compression?: "fast";
|
|
2024
2135
|
}
|
|
2025
2136
|
declare interface RequestInitCfPropertiesImageMinify {
|
|
2026
2137
|
javascript?: boolean;
|
|
@@ -2036,7 +2147,8 @@ declare type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2036
2147
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2037
2148
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2038
2149
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2039
|
-
declare interface IncomingRequestCfPropertiesBase
|
|
2150
|
+
declare interface IncomingRequestCfPropertiesBase
|
|
2151
|
+
extends Record<string, unknown> {
|
|
2040
2152
|
/**
|
|
2041
2153
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2042
2154
|
*
|
|
@@ -2117,8 +2229,7 @@ declare interface IncomingRequestCfPropertiesBase {
|
|
|
2117
2229
|
declare interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2118
2230
|
/**
|
|
2119
2231
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2120
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2121
|
-
* and `99` (almost certainly a bot).
|
|
2232
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2122
2233
|
*
|
|
2123
2234
|
* @example 54
|
|
2124
2235
|
*/
|
|
@@ -2137,6 +2248,10 @@ declare interface IncomingRequestCfPropertiesBotManagementBase {
|
|
|
2137
2248
|
* A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources.
|
|
2138
2249
|
*/
|
|
2139
2250
|
staticResource: boolean;
|
|
2251
|
+
/**
|
|
2252
|
+
* List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request).
|
|
2253
|
+
*/
|
|
2254
|
+
detectionIds: number[];
|
|
2140
2255
|
}
|
|
2141
2256
|
declare interface IncomingRequestCfPropertiesBotManagement {
|
|
2142
2257
|
/**
|
|
@@ -2225,86 +2340,82 @@ declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2225
2340
|
/**
|
|
2226
2341
|
* Geographic data about the request's origin.
|
|
2227
2342
|
*/
|
|
2228
|
-
declare
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
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
|
-
* @example "635"
|
|
2305
|
-
*/
|
|
2306
|
-
metroCode?: string;
|
|
2307
|
-
};
|
|
2343
|
+
declare interface IncomingRequestCfPropertiesGeographicInformation {
|
|
2344
|
+
/**
|
|
2345
|
+
* The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
|
|
2346
|
+
*
|
|
2347
|
+
* 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.
|
|
2348
|
+
*
|
|
2349
|
+
* If Cloudflare is unable to determine where the request originated this property is omitted.
|
|
2350
|
+
*
|
|
2351
|
+
* The country code `"T1"` is used for requests originating on TOR.
|
|
2352
|
+
*
|
|
2353
|
+
* @example "GB"
|
|
2354
|
+
*/
|
|
2355
|
+
country?: Iso3166Alpha2Code | "T1";
|
|
2356
|
+
/**
|
|
2357
|
+
* If present, this property indicates that the request originated in the EU
|
|
2358
|
+
*
|
|
2359
|
+
* @example "1"
|
|
2360
|
+
*/
|
|
2361
|
+
isEUCountry?: "1";
|
|
2362
|
+
/**
|
|
2363
|
+
* A two-letter code indicating the continent the request originated from.
|
|
2364
|
+
*
|
|
2365
|
+
* @example "AN"
|
|
2366
|
+
*/
|
|
2367
|
+
continent?: ContinentCode;
|
|
2368
|
+
/**
|
|
2369
|
+
* The city the request originated from
|
|
2370
|
+
*
|
|
2371
|
+
* @example "Austin"
|
|
2372
|
+
*/
|
|
2373
|
+
city?: string;
|
|
2374
|
+
/**
|
|
2375
|
+
* Postal code of the incoming request
|
|
2376
|
+
*
|
|
2377
|
+
* @example "78701"
|
|
2378
|
+
*/
|
|
2379
|
+
postalCode?: string;
|
|
2380
|
+
/**
|
|
2381
|
+
* Latitude of the incoming request
|
|
2382
|
+
*
|
|
2383
|
+
* @example "30.27130"
|
|
2384
|
+
*/
|
|
2385
|
+
latitude?: string;
|
|
2386
|
+
/**
|
|
2387
|
+
* Longitude of the incoming request
|
|
2388
|
+
*
|
|
2389
|
+
* @example "-97.74260"
|
|
2390
|
+
*/
|
|
2391
|
+
longitude?: string;
|
|
2392
|
+
/**
|
|
2393
|
+
* Timezone of the incoming request
|
|
2394
|
+
*
|
|
2395
|
+
* @example "America/Chicago"
|
|
2396
|
+
*/
|
|
2397
|
+
timezone?: string;
|
|
2398
|
+
/**
|
|
2399
|
+
* If known, the ISO 3166-2 name for the first level region associated with
|
|
2400
|
+
* the IP address of the incoming request
|
|
2401
|
+
*
|
|
2402
|
+
* @example "Texas"
|
|
2403
|
+
*/
|
|
2404
|
+
region?: string;
|
|
2405
|
+
/**
|
|
2406
|
+
* If known, the ISO 3166-2 code for the first-level region associated with
|
|
2407
|
+
* the IP address of the incoming request
|
|
2408
|
+
*
|
|
2409
|
+
* @example "TX"
|
|
2410
|
+
*/
|
|
2411
|
+
regionCode?: string;
|
|
2412
|
+
/**
|
|
2413
|
+
* Metro code (DMA) of the incoming request
|
|
2414
|
+
*
|
|
2415
|
+
* @example "635"
|
|
2416
|
+
*/
|
|
2417
|
+
metroCode?: string;
|
|
2418
|
+
}
|
|
2308
2419
|
/** Data about the incoming request's TLS certificate */
|
|
2309
2420
|
declare interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2310
2421
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2697,6 +2808,9 @@ declare type Iso3166Alpha2Code =
|
|
|
2697
2808
|
| "ZW";
|
|
2698
2809
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2699
2810
|
declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2811
|
+
declare type CfProperties<HostMetadata = unknown> =
|
|
2812
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2813
|
+
| RequestInitCfProperties;
|
|
2700
2814
|
declare interface D1Result<T = unknown> {
|
|
2701
2815
|
results?: T[];
|
|
2702
2816
|
success: boolean;
|
|
@@ -2717,9 +2831,9 @@ declare abstract class D1PreparedStatement {
|
|
|
2717
2831
|
raw<T = unknown>(): Promise<T[]>;
|
|
2718
2832
|
}
|
|
2719
2833
|
/**
|
|
2720
|
-
*
|
|
2834
|
+
* An email message that can be sent from a Worker.
|
|
2721
2835
|
*/
|
|
2722
|
-
declare interface EmailMessage
|
|
2836
|
+
declare interface EmailMessage {
|
|
2723
2837
|
/**
|
|
2724
2838
|
* Envelope From attribute of the email message.
|
|
2725
2839
|
*/
|
|
@@ -2728,14 +2842,19 @@ declare interface EmailMessage<Body = unknown> {
|
|
|
2728
2842
|
* Envelope To attribute of the email message.
|
|
2729
2843
|
*/
|
|
2730
2844
|
readonly to: string;
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2845
|
+
}
|
|
2846
|
+
/**
|
|
2847
|
+
* An email message that is sent to a consumer Worker and can be rejected/forwarded.
|
|
2848
|
+
*/
|
|
2849
|
+
declare interface ForwardableEmailMessage extends EmailMessage {
|
|
2735
2850
|
/**
|
|
2736
2851
|
* Stream of the email message content.
|
|
2737
2852
|
*/
|
|
2738
2853
|
readonly raw: ReadableStream;
|
|
2854
|
+
/**
|
|
2855
|
+
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2856
|
+
*/
|
|
2857
|
+
readonly headers: Headers;
|
|
2739
2858
|
/**
|
|
2740
2859
|
* Size of the email message content.
|
|
2741
2860
|
*/
|
|
@@ -2754,14 +2873,27 @@ declare interface EmailMessage<Body = unknown> {
|
|
|
2754
2873
|
*/
|
|
2755
2874
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2756
2875
|
}
|
|
2876
|
+
/**
|
|
2877
|
+
* A binding that allows a Worker to send email messages.
|
|
2878
|
+
*/
|
|
2879
|
+
declare interface SendEmail {
|
|
2880
|
+
send(message: EmailMessage): Promise<void>;
|
|
2881
|
+
}
|
|
2757
2882
|
declare abstract class EmailEvent extends ExtendableEvent {
|
|
2758
|
-
readonly message:
|
|
2883
|
+
readonly message: ForwardableEmailMessage;
|
|
2759
2884
|
}
|
|
2760
2885
|
declare type EmailExportedHandler<Env = unknown> = (
|
|
2761
|
-
message:
|
|
2886
|
+
message: ForwardableEmailMessage,
|
|
2762
2887
|
env: Env,
|
|
2763
2888
|
ctx: ExecutionContext
|
|
2764
2889
|
) => void | Promise<void>;
|
|
2890
|
+
declare module "cloudflare:email" {
|
|
2891
|
+
let _EmailMessage: {
|
|
2892
|
+
prototype: EmailMessage;
|
|
2893
|
+
new (from: string, to: string, raw: ReadableStream | string): EmailMessage;
|
|
2894
|
+
};
|
|
2895
|
+
export { _EmailMessage as EmailMessage };
|
|
2896
|
+
}
|
|
2765
2897
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2766
2898
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2767
2899
|
request: Request;
|
|
@@ -2842,75 +2974,12 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2842
2974
|
// Key Identifier of the JWK
|
|
2843
2975
|
readonly kid: string;
|
|
2844
2976
|
}
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
*/
|
|
2848
|
-
declare interface Message<Body = unknown> {
|
|
2977
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
2978
|
+
declare interface DispatchNamespace {
|
|
2849
2979
|
/**
|
|
2850
|
-
*
|
|
2980
|
+
* @param name Name of the Worker script.
|
|
2981
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
2982
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2851
2983
|
*/
|
|
2852
|
-
|
|
2853
|
-
/**
|
|
2854
|
-
* A timestamp when the message was sent.
|
|
2855
|
-
*/
|
|
2856
|
-
readonly timestamp: Date;
|
|
2857
|
-
/**
|
|
2858
|
-
* The body of the message.
|
|
2859
|
-
*/
|
|
2860
|
-
readonly body: Body;
|
|
2861
|
-
/**
|
|
2862
|
-
* Marks message to be retried.
|
|
2863
|
-
*/
|
|
2864
|
-
retry(): void;
|
|
2865
|
-
/**
|
|
2866
|
-
* Marks message acknowledged.
|
|
2867
|
-
*/
|
|
2868
|
-
ack(): void;
|
|
2869
|
-
}
|
|
2870
|
-
/**
|
|
2871
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2872
|
-
*/
|
|
2873
|
-
declare interface MessageBatch<Body = unknown> {
|
|
2874
|
-
/**
|
|
2875
|
-
* The name of the Queue that belongs to this batch.
|
|
2876
|
-
*/
|
|
2877
|
-
readonly queue: string;
|
|
2878
|
-
/**
|
|
2879
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2880
|
-
*/
|
|
2881
|
-
readonly messages: readonly Message<Body>[];
|
|
2882
|
-
/**
|
|
2883
|
-
* Marks every message to be retried in the next batch.
|
|
2884
|
-
*/
|
|
2885
|
-
retryAll(): void;
|
|
2886
|
-
/**
|
|
2887
|
-
* Marks every message acknowledged in the batch.
|
|
2888
|
-
*/
|
|
2889
|
-
ackAll(): void;
|
|
2890
|
-
}
|
|
2891
|
-
/**
|
|
2892
|
-
* A wrapper class used to structure message batches.
|
|
2893
|
-
*/
|
|
2894
|
-
declare type MessageSendRequest<Body = unknown> = {
|
|
2895
|
-
/**
|
|
2896
|
-
* The body of the message.
|
|
2897
|
-
*/
|
|
2898
|
-
body: Body;
|
|
2899
|
-
};
|
|
2900
|
-
/**
|
|
2901
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
2902
|
-
*/
|
|
2903
|
-
declare interface Queue<Body = any> {
|
|
2904
|
-
/**
|
|
2905
|
-
* Sends a message to the Queue.
|
|
2906
|
-
* @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.
|
|
2907
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2908
|
-
*/
|
|
2909
|
-
send(message: Body): Promise<void>;
|
|
2910
|
-
/**
|
|
2911
|
-
* Sends a batch of messages to the Queue.
|
|
2912
|
-
* @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.
|
|
2913
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2914
|
-
*/
|
|
2915
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2984
|
+
get(name: string): Fetcher;
|
|
2916
2985
|
}
|