@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/2021-11-03/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
|
};
|
|
@@ -281,12 +282,16 @@ export declare const self: ServiceWorkerGlobalScope;
|
|
|
281
282
|
export declare const crypto: Crypto;
|
|
282
283
|
export declare const caches: CacheStorage;
|
|
283
284
|
export declare const scheduler: Scheduler;
|
|
285
|
+
export interface TestController {}
|
|
284
286
|
export interface ExecutionContext {
|
|
285
287
|
waitUntil(promise: Promise<any>): void;
|
|
286
288
|
passThroughOnException(): void;
|
|
287
289
|
}
|
|
288
|
-
export type ExportedHandlerFetchHandler<
|
|
289
|
-
|
|
290
|
+
export type ExportedHandlerFetchHandler<
|
|
291
|
+
Env = unknown,
|
|
292
|
+
CfHostMetadata = unknown
|
|
293
|
+
> = (
|
|
294
|
+
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
290
295
|
env: Env,
|
|
291
296
|
ctx: ExecutionContext
|
|
292
297
|
) => Response | Promise<Response>;
|
|
@@ -305,11 +310,21 @@ export type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
|
|
|
305
310
|
env: Env,
|
|
306
311
|
ctx: ExecutionContext
|
|
307
312
|
) => void | Promise<void>;
|
|
308
|
-
export
|
|
309
|
-
|
|
313
|
+
export type ExportedHandlerTestHandler<Env = unknown> = (
|
|
314
|
+
controller: TestController,
|
|
315
|
+
env: Env,
|
|
316
|
+
ctx: ExecutionContext
|
|
317
|
+
) => void | Promise<void>;
|
|
318
|
+
export interface ExportedHandler<
|
|
319
|
+
Env = unknown,
|
|
320
|
+
QueueMessage = unknown,
|
|
321
|
+
CfHostMetadata = unknown
|
|
322
|
+
> {
|
|
323
|
+
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
310
324
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
311
325
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
312
|
-
|
|
326
|
+
test?: ExportedHandlerTestHandler<Env>;
|
|
327
|
+
queue?: ExportedHandlerQueueHandler<Env, Message>;
|
|
313
328
|
}
|
|
314
329
|
export interface StructuredSerializeOptions {
|
|
315
330
|
transfer?: any[];
|
|
@@ -341,13 +356,24 @@ export interface DurableObjectNamespace {
|
|
|
341
356
|
id: DurableObjectId,
|
|
342
357
|
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
343
358
|
): DurableObjectStub;
|
|
344
|
-
jurisdiction(jurisdiction:
|
|
359
|
+
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
|
|
345
360
|
}
|
|
361
|
+
export type DurableObjectJurisdiction = "eu" | "fedramp";
|
|
346
362
|
export interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
347
|
-
jurisdiction?:
|
|
348
|
-
}
|
|
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";
|
|
349
375
|
export interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
350
|
-
locationHint?:
|
|
376
|
+
locationHint?: DurableObjectLocationHint;
|
|
351
377
|
}
|
|
352
378
|
export interface DurableObjectState {
|
|
353
379
|
waitUntil(promise: Promise<any>): void;
|
|
@@ -990,10 +1016,16 @@ export interface ResponseInit {
|
|
|
990
1016
|
webSocket?: WebSocket | null;
|
|
991
1017
|
encodeBody?: "automatic" | "manual";
|
|
992
1018
|
}
|
|
993
|
-
export type RequestInfo
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
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>;
|
|
997
1029
|
/** Returns request's HTTP method, which is "GET" by default. */
|
|
998
1030
|
readonly method: string;
|
|
999
1031
|
/** Returns the URL of request as a string. */
|
|
@@ -1005,15 +1037,13 @@ export declare class Request<CfHostMetadata = unknown> extends Body {
|
|
|
1005
1037
|
readonly fetcher: Fetcher | null;
|
|
1006
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. */
|
|
1007
1039
|
readonly signal: AbortSignal;
|
|
1008
|
-
readonly cf?:
|
|
1040
|
+
readonly cf?: Cf;
|
|
1009
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] */
|
|
1010
1042
|
readonly integrity: string;
|
|
1011
1043
|
/** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
|
|
1012
1044
|
readonly keepalive: boolean;
|
|
1013
1045
|
}
|
|
1014
|
-
export interface RequestInit<
|
|
1015
|
-
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
1016
|
-
> {
|
|
1046
|
+
export interface RequestInit<Cf = CfProperties> {
|
|
1017
1047
|
/** A string to set request's method. */
|
|
1018
1048
|
method?: string;
|
|
1019
1049
|
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
@@ -1023,17 +1053,14 @@ export interface RequestInit<
|
|
|
1023
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. */
|
|
1024
1054
|
redirect?: string;
|
|
1025
1055
|
fetcher?: Fetcher | null;
|
|
1026
|
-
cf?:
|
|
1056
|
+
cf?: Cf;
|
|
1027
1057
|
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1028
1058
|
integrity?: string;
|
|
1029
1059
|
/** An AbortSignal to set request's signal. */
|
|
1030
1060
|
signal?: AbortSignal | null;
|
|
1031
1061
|
}
|
|
1032
1062
|
export declare abstract class Fetcher {
|
|
1033
|
-
fetch(
|
|
1034
|
-
input: RequestInfo,
|
|
1035
|
-
init?: RequestInit<RequestInitCfProperties>
|
|
1036
|
-
): Promise<Response>;
|
|
1063
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1037
1064
|
}
|
|
1038
1065
|
export interface FetcherPutOptions {
|
|
1039
1066
|
expiration?: number;
|
|
@@ -1146,6 +1173,33 @@ export interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1146
1173
|
value: Value | null;
|
|
1147
1174
|
metadata: Metadata | null;
|
|
1148
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
|
+
}
|
|
1149
1203
|
export interface R2Error extends Error {
|
|
1150
1204
|
readonly name: string;
|
|
1151
1205
|
readonly code: number;
|
|
@@ -1296,12 +1350,18 @@ export interface R2HTTPMetadata {
|
|
|
1296
1350
|
cacheControl?: string;
|
|
1297
1351
|
cacheExpiry?: Date;
|
|
1298
1352
|
}
|
|
1299
|
-
export
|
|
1353
|
+
export type R2Objects = {
|
|
1300
1354
|
objects: R2Object[];
|
|
1301
|
-
truncated: boolean;
|
|
1302
|
-
cursor?: string;
|
|
1303
1355
|
delimitedPrefixes: string[];
|
|
1304
|
-
}
|
|
1356
|
+
} & (
|
|
1357
|
+
| {
|
|
1358
|
+
truncated: true;
|
|
1359
|
+
cursor: string;
|
|
1360
|
+
}
|
|
1361
|
+
| {
|
|
1362
|
+
truncated: false;
|
|
1363
|
+
}
|
|
1364
|
+
);
|
|
1305
1365
|
export declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1306
1366
|
readonly scheduledTime: number;
|
|
1307
1367
|
readonly cron: string;
|
|
@@ -1512,13 +1572,19 @@ export declare class TransformStream<I = any, O = any> {
|
|
|
1512
1572
|
readonly writable: WritableStream<I>;
|
|
1513
1573
|
}
|
|
1514
1574
|
export declare class FixedLengthStream extends IdentityTransformStream {
|
|
1515
|
-
constructor(
|
|
1575
|
+
constructor(
|
|
1576
|
+
expectedLength: number | bigint,
|
|
1577
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy
|
|
1578
|
+
);
|
|
1516
1579
|
}
|
|
1517
1580
|
export declare class IdentityTransformStream extends TransformStream<
|
|
1518
1581
|
ArrayBuffer | ArrayBufferView,
|
|
1519
1582
|
Uint8Array
|
|
1520
1583
|
> {
|
|
1521
|
-
constructor();
|
|
1584
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
1585
|
+
}
|
|
1586
|
+
export interface IdentityTransformStreamQueuingStrategy {
|
|
1587
|
+
highWaterMark?: number | bigint;
|
|
1522
1588
|
}
|
|
1523
1589
|
export interface ReadableStreamValuesOptions {
|
|
1524
1590
|
preventCancel?: boolean;
|
|
@@ -1527,13 +1593,13 @@ export declare class CompressionStream extends TransformStream<
|
|
|
1527
1593
|
ArrayBuffer | ArrayBufferView,
|
|
1528
1594
|
Uint8Array
|
|
1529
1595
|
> {
|
|
1530
|
-
constructor(format: "gzip" | "deflate");
|
|
1596
|
+
constructor(format: "gzip" | "deflate" | "deflate-raw");
|
|
1531
1597
|
}
|
|
1532
1598
|
export declare class DecompressionStream extends TransformStream<
|
|
1533
1599
|
ArrayBuffer | ArrayBufferView,
|
|
1534
1600
|
Uint8Array
|
|
1535
1601
|
> {
|
|
1536
|
-
constructor(format: "gzip" | "deflate");
|
|
1602
|
+
constructor(format: "gzip" | "deflate" | "deflate-raw");
|
|
1537
1603
|
}
|
|
1538
1604
|
export declare class TextEncoderStream extends TransformStream<
|
|
1539
1605
|
string,
|
|
@@ -1665,6 +1731,7 @@ export declare class URLSearchParams {
|
|
|
1665
1731
|
| Record<string, string>
|
|
1666
1732
|
| [key: string, value: string][]
|
|
1667
1733
|
);
|
|
1734
|
+
get size(): number;
|
|
1668
1735
|
append(name: string, value: string): void;
|
|
1669
1736
|
delete(name: string): void;
|
|
1670
1737
|
get(name: string): string | null;
|
|
@@ -1867,7 +1934,7 @@ export interface BasicImageTransformationsGravityCoordinates {
|
|
|
1867
1934
|
* Note: Currently, these properties cannot be tested in the
|
|
1868
1935
|
* playground.
|
|
1869
1936
|
*/
|
|
1870
|
-
export interface RequestInitCfProperties {
|
|
1937
|
+
export interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1871
1938
|
cacheEverything?: boolean;
|
|
1872
1939
|
/**
|
|
1873
1940
|
* A request's cache key is what determines if two requests are
|
|
@@ -2037,6 +2104,49 @@ export interface RequestInitCfPropertiesImage
|
|
|
2037
2104
|
* the origin.
|
|
2038
2105
|
*/
|
|
2039
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";
|
|
2040
2150
|
}
|
|
2041
2151
|
export interface RequestInitCfPropertiesImageMinify {
|
|
2042
2152
|
javascript?: boolean;
|
|
@@ -2052,7 +2162,8 @@ export type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2052
2162
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2053
2163
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2054
2164
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2055
|
-
export interface IncomingRequestCfPropertiesBase
|
|
2165
|
+
export interface IncomingRequestCfPropertiesBase
|
|
2166
|
+
extends Record<string, unknown> {
|
|
2056
2167
|
/**
|
|
2057
2168
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2058
2169
|
*
|
|
@@ -2133,8 +2244,7 @@ export interface IncomingRequestCfPropertiesBase {
|
|
|
2133
2244
|
export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2134
2245
|
/**
|
|
2135
2246
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2136
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2137
|
-
* and `99` (almost certainly a bot).
|
|
2247
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2138
2248
|
*
|
|
2139
2249
|
* @example 54
|
|
2140
2250
|
*/
|
|
@@ -2153,6 +2263,10 @@ export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
|
2153
2263
|
* 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.
|
|
2154
2264
|
*/
|
|
2155
2265
|
staticResource: boolean;
|
|
2266
|
+
/**
|
|
2267
|
+
* 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).
|
|
2268
|
+
*/
|
|
2269
|
+
detectionIds: number[];
|
|
2156
2270
|
}
|
|
2157
2271
|
export interface IncomingRequestCfPropertiesBotManagement {
|
|
2158
2272
|
/**
|
|
@@ -2241,86 +2355,82 @@ export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2241
2355
|
/**
|
|
2242
2356
|
* Geographic data about the request's origin.
|
|
2243
2357
|
*/
|
|
2244
|
-
export
|
|
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
|
-
|
|
2320
|
-
* @example "635"
|
|
2321
|
-
*/
|
|
2322
|
-
metroCode?: string;
|
|
2323
|
-
};
|
|
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
|
+
}
|
|
2324
2434
|
/** Data about the incoming request's TLS certificate */
|
|
2325
2435
|
export interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2326
2436
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2713,6 +2823,9 @@ export type Iso3166Alpha2Code =
|
|
|
2713
2823
|
| "ZW";
|
|
2714
2824
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2715
2825
|
export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2826
|
+
export type CfProperties<HostMetadata = unknown> =
|
|
2827
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2828
|
+
| RequestInitCfProperties;
|
|
2716
2829
|
export interface D1Result<T = unknown> {
|
|
2717
2830
|
results?: T[];
|
|
2718
2831
|
success: boolean;
|
|
@@ -2733,9 +2846,9 @@ export declare abstract class D1PreparedStatement {
|
|
|
2733
2846
|
raw<T = unknown>(): Promise<T[]>;
|
|
2734
2847
|
}
|
|
2735
2848
|
/**
|
|
2736
|
-
*
|
|
2849
|
+
* An email message that can be sent from a Worker.
|
|
2737
2850
|
*/
|
|
2738
|
-
export interface EmailMessage
|
|
2851
|
+
export interface EmailMessage {
|
|
2739
2852
|
/**
|
|
2740
2853
|
* Envelope From attribute of the email message.
|
|
2741
2854
|
*/
|
|
@@ -2744,14 +2857,19 @@ export interface EmailMessage<Body = unknown> {
|
|
|
2744
2857
|
* Envelope To attribute of the email message.
|
|
2745
2858
|
*/
|
|
2746
2859
|
readonly to: string;
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
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 {
|
|
2751
2865
|
/**
|
|
2752
2866
|
* Stream of the email message content.
|
|
2753
2867
|
*/
|
|
2754
2868
|
readonly raw: ReadableStream;
|
|
2869
|
+
/**
|
|
2870
|
+
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2871
|
+
*/
|
|
2872
|
+
readonly headers: Headers;
|
|
2755
2873
|
/**
|
|
2756
2874
|
* Size of the email message content.
|
|
2757
2875
|
*/
|
|
@@ -2770,11 +2888,17 @@ export interface EmailMessage<Body = unknown> {
|
|
|
2770
2888
|
*/
|
|
2771
2889
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2772
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
|
+
}
|
|
2773
2897
|
export declare abstract class EmailEvent extends ExtendableEvent {
|
|
2774
|
-
readonly message:
|
|
2898
|
+
readonly message: ForwardableEmailMessage;
|
|
2775
2899
|
}
|
|
2776
2900
|
export type EmailExportedHandler<Env = unknown> = (
|
|
2777
|
-
message:
|
|
2901
|
+
message: ForwardableEmailMessage,
|
|
2778
2902
|
env: Env,
|
|
2779
2903
|
ctx: ExecutionContext
|
|
2780
2904
|
) => void | Promise<void>;
|
|
@@ -2855,75 +2979,12 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2855
2979
|
// Key Identifier of the JWK
|
|
2856
2980
|
readonly kid: string;
|
|
2857
2981
|
}
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
*/
|
|
2861
|
-
export interface Message<Body = unknown> {
|
|
2862
|
-
/**
|
|
2863
|
-
* A unique, system-generated ID for the message.
|
|
2864
|
-
*/
|
|
2865
|
-
readonly id: string;
|
|
2866
|
-
/**
|
|
2867
|
-
* A timestamp when the message was sent.
|
|
2868
|
-
*/
|
|
2869
|
-
readonly timestamp: Date;
|
|
2870
|
-
/**
|
|
2871
|
-
* The body of the message.
|
|
2872
|
-
*/
|
|
2873
|
-
readonly body: Body;
|
|
2874
|
-
/**
|
|
2875
|
-
* Marks message to be retried.
|
|
2876
|
-
*/
|
|
2877
|
-
retry(): void;
|
|
2878
|
-
/**
|
|
2879
|
-
* Marks message acknowledged.
|
|
2880
|
-
*/
|
|
2881
|
-
ack(): void;
|
|
2882
|
-
}
|
|
2883
|
-
/**
|
|
2884
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2885
|
-
*/
|
|
2886
|
-
export interface MessageBatch<Body = unknown> {
|
|
2887
|
-
/**
|
|
2888
|
-
* The name of the Queue that belongs to this batch.
|
|
2889
|
-
*/
|
|
2890
|
-
readonly queue: string;
|
|
2891
|
-
/**
|
|
2892
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2893
|
-
*/
|
|
2894
|
-
readonly messages: readonly Message<Body>[];
|
|
2895
|
-
/**
|
|
2896
|
-
* Marks every message to be retried in the next batch.
|
|
2897
|
-
*/
|
|
2898
|
-
retryAll(): void;
|
|
2899
|
-
/**
|
|
2900
|
-
* Marks every message acknowledged in the batch.
|
|
2901
|
-
*/
|
|
2902
|
-
ackAll(): void;
|
|
2903
|
-
}
|
|
2904
|
-
/**
|
|
2905
|
-
* A wrapper class used to structure message batches.
|
|
2906
|
-
*/
|
|
2907
|
-
export type MessageSendRequest<Body = unknown> = {
|
|
2982
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
2983
|
+
export interface DispatchNamespace {
|
|
2908
2984
|
/**
|
|
2909
|
-
*
|
|
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.
|
|
2910
2988
|
*/
|
|
2911
|
-
|
|
2912
|
-
};
|
|
2913
|
-
/**
|
|
2914
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
2915
|
-
*/
|
|
2916
|
-
export interface Queue<Body = any> {
|
|
2917
|
-
/**
|
|
2918
|
-
* Sends a message to the Queue.
|
|
2919
|
-
* @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.
|
|
2920
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2921
|
-
*/
|
|
2922
|
-
send(message: Body): Promise<void>;
|
|
2923
|
-
/**
|
|
2924
|
-
* Sends a batch of messages to the Queue.
|
|
2925
|
-
* @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.
|
|
2926
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2927
|
-
*/
|
|
2928
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2989
|
+
get(name: string): Fetcher;
|
|
2929
2990
|
}
|