@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-03-21/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
|
};
|
|
@@ -284,12 +285,16 @@ export declare const crypto: Crypto;
|
|
|
284
285
|
export declare const caches: CacheStorage;
|
|
285
286
|
export declare const scheduler: Scheduler;
|
|
286
287
|
export declare const navigator: Navigator;
|
|
288
|
+
export interface TestController {}
|
|
287
289
|
export interface ExecutionContext {
|
|
288
290
|
waitUntil(promise: Promise<any>): void;
|
|
289
291
|
passThroughOnException(): void;
|
|
290
292
|
}
|
|
291
|
-
export type ExportedHandlerFetchHandler<
|
|
292
|
-
|
|
293
|
+
export type ExportedHandlerFetchHandler<
|
|
294
|
+
Env = unknown,
|
|
295
|
+
CfHostMetadata = unknown
|
|
296
|
+
> = (
|
|
297
|
+
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
293
298
|
env: Env,
|
|
294
299
|
ctx: ExecutionContext
|
|
295
300
|
) => Response | Promise<Response>;
|
|
@@ -308,11 +313,21 @@ export type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
|
|
|
308
313
|
env: Env,
|
|
309
314
|
ctx: ExecutionContext
|
|
310
315
|
) => void | Promise<void>;
|
|
311
|
-
export
|
|
312
|
-
|
|
316
|
+
export type ExportedHandlerTestHandler<Env = unknown> = (
|
|
317
|
+
controller: TestController,
|
|
318
|
+
env: Env,
|
|
319
|
+
ctx: ExecutionContext
|
|
320
|
+
) => void | Promise<void>;
|
|
321
|
+
export interface ExportedHandler<
|
|
322
|
+
Env = unknown,
|
|
323
|
+
QueueMessage = unknown,
|
|
324
|
+
CfHostMetadata = unknown
|
|
325
|
+
> {
|
|
326
|
+
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
313
327
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
314
328
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
315
|
-
|
|
329
|
+
test?: ExportedHandlerTestHandler<Env>;
|
|
330
|
+
queue?: ExportedHandlerQueueHandler<Env, Message>;
|
|
316
331
|
}
|
|
317
332
|
export interface StructuredSerializeOptions {
|
|
318
333
|
transfer?: any[];
|
|
@@ -347,13 +362,24 @@ export interface DurableObjectNamespace {
|
|
|
347
362
|
id: DurableObjectId,
|
|
348
363
|
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
349
364
|
): DurableObjectStub;
|
|
350
|
-
jurisdiction(jurisdiction:
|
|
365
|
+
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
|
|
351
366
|
}
|
|
367
|
+
export type DurableObjectJurisdiction = "eu" | "fedramp";
|
|
352
368
|
export interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
353
|
-
jurisdiction?:
|
|
354
|
-
}
|
|
369
|
+
jurisdiction?: DurableObjectJurisdiction;
|
|
370
|
+
}
|
|
371
|
+
export type DurableObjectLocationHint =
|
|
372
|
+
| "wnam"
|
|
373
|
+
| "enam"
|
|
374
|
+
| "sam"
|
|
375
|
+
| "weur"
|
|
376
|
+
| "eeur"
|
|
377
|
+
| "apac"
|
|
378
|
+
| "oc"
|
|
379
|
+
| "afr"
|
|
380
|
+
| "me";
|
|
355
381
|
export interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
356
|
-
locationHint?:
|
|
382
|
+
locationHint?: DurableObjectLocationHint;
|
|
357
383
|
}
|
|
358
384
|
export interface DurableObjectState {
|
|
359
385
|
waitUntil(promise: Promise<any>): void;
|
|
@@ -983,23 +1009,27 @@ export interface ResponseInit {
|
|
|
983
1009
|
webSocket?: WebSocket | null;
|
|
984
1010
|
encodeBody?: "automatic" | "manual";
|
|
985
1011
|
}
|
|
986
|
-
export type RequestInfo
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1012
|
+
export type RequestInfo<
|
|
1013
|
+
CfHostMetadata = unknown,
|
|
1014
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1015
|
+
> = Request<CfHostMetadata, Cf> | string | URL;
|
|
1016
|
+
export declare class Request<
|
|
1017
|
+
CfHostMetadata = unknown,
|
|
1018
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1019
|
+
> extends Body {
|
|
1020
|
+
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1021
|
+
clone(): Request<CfHostMetadata, Cf>;
|
|
990
1022
|
get method(): string;
|
|
991
1023
|
get url(): string;
|
|
992
1024
|
get headers(): Headers;
|
|
993
1025
|
get redirect(): string;
|
|
994
1026
|
get fetcher(): Fetcher | null;
|
|
995
1027
|
get signal(): AbortSignal;
|
|
996
|
-
get cf():
|
|
1028
|
+
get cf(): Cf | undefined;
|
|
997
1029
|
get integrity(): string;
|
|
998
1030
|
get keepalive(): boolean;
|
|
999
1031
|
}
|
|
1000
|
-
export interface RequestInit<
|
|
1001
|
-
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
1002
|
-
> {
|
|
1032
|
+
export interface RequestInit<Cf = CfProperties> {
|
|
1003
1033
|
/** A string to set request's method. */
|
|
1004
1034
|
method?: string;
|
|
1005
1035
|
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
@@ -1009,17 +1039,14 @@ export interface RequestInit<
|
|
|
1009
1039
|
/** 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. */
|
|
1010
1040
|
redirect?: string;
|
|
1011
1041
|
fetcher?: Fetcher | null;
|
|
1012
|
-
cf?:
|
|
1042
|
+
cf?: Cf;
|
|
1013
1043
|
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1014
1044
|
integrity?: string;
|
|
1015
1045
|
/** An AbortSignal to set request's signal. */
|
|
1016
1046
|
signal?: AbortSignal | null;
|
|
1017
1047
|
}
|
|
1018
1048
|
export declare abstract class Fetcher {
|
|
1019
|
-
fetch(
|
|
1020
|
-
input: RequestInfo,
|
|
1021
|
-
init?: RequestInit<RequestInitCfProperties>
|
|
1022
|
-
): Promise<Response>;
|
|
1049
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1023
1050
|
}
|
|
1024
1051
|
export interface FetcherPutOptions {
|
|
1025
1052
|
expiration?: number;
|
|
@@ -1132,6 +1159,33 @@ export interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1132
1159
|
value: Value | null;
|
|
1133
1160
|
metadata: Metadata | null;
|
|
1134
1161
|
}
|
|
1162
|
+
export interface Queue<Body> {
|
|
1163
|
+
send(message: Body): Promise<void>;
|
|
1164
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1165
|
+
}
|
|
1166
|
+
export interface QueueSendOptions {}
|
|
1167
|
+
export interface MessageSendRequest<Body = unknown> {
|
|
1168
|
+
body: Body;
|
|
1169
|
+
}
|
|
1170
|
+
export interface Message<Body = unknown> {
|
|
1171
|
+
readonly id: string;
|
|
1172
|
+
readonly timestamp: Date;
|
|
1173
|
+
readonly body: Body;
|
|
1174
|
+
retry(): void;
|
|
1175
|
+
ack(): void;
|
|
1176
|
+
}
|
|
1177
|
+
export interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1178
|
+
readonly messages: readonly Message<Body>[];
|
|
1179
|
+
readonly queue: string;
|
|
1180
|
+
retryAll(): void;
|
|
1181
|
+
ackAll(): void;
|
|
1182
|
+
}
|
|
1183
|
+
export interface MessageBatch<Body = unknown> {
|
|
1184
|
+
readonly messages: readonly Message<Body>[];
|
|
1185
|
+
readonly queue: string;
|
|
1186
|
+
retryAll(): void;
|
|
1187
|
+
ackAll(): void;
|
|
1188
|
+
}
|
|
1135
1189
|
export interface R2Error extends Error {
|
|
1136
1190
|
readonly name: string;
|
|
1137
1191
|
readonly code: number;
|
|
@@ -1282,12 +1336,18 @@ export interface R2HTTPMetadata {
|
|
|
1282
1336
|
cacheControl?: string;
|
|
1283
1337
|
cacheExpiry?: Date;
|
|
1284
1338
|
}
|
|
1285
|
-
export
|
|
1339
|
+
export type R2Objects = {
|
|
1286
1340
|
objects: R2Object[];
|
|
1287
|
-
truncated: boolean;
|
|
1288
|
-
cursor?: string;
|
|
1289
1341
|
delimitedPrefixes: string[];
|
|
1290
|
-
}
|
|
1342
|
+
} & (
|
|
1343
|
+
| {
|
|
1344
|
+
truncated: true;
|
|
1345
|
+
cursor: string;
|
|
1346
|
+
}
|
|
1347
|
+
| {
|
|
1348
|
+
truncated: false;
|
|
1349
|
+
}
|
|
1350
|
+
);
|
|
1291
1351
|
export declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1292
1352
|
readonly scheduledTime: number;
|
|
1293
1353
|
readonly cron: string;
|
|
@@ -1498,13 +1558,19 @@ export declare class TransformStream<I = any, O = any> {
|
|
|
1498
1558
|
get writable(): WritableStream<I>;
|
|
1499
1559
|
}
|
|
1500
1560
|
export declare class FixedLengthStream extends IdentityTransformStream {
|
|
1501
|
-
constructor(
|
|
1561
|
+
constructor(
|
|
1562
|
+
expectedLength: number | bigint,
|
|
1563
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy
|
|
1564
|
+
);
|
|
1502
1565
|
}
|
|
1503
1566
|
export declare class IdentityTransformStream extends TransformStream<
|
|
1504
1567
|
ArrayBuffer | ArrayBufferView,
|
|
1505
1568
|
Uint8Array
|
|
1506
1569
|
> {
|
|
1507
|
-
constructor();
|
|
1570
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
1571
|
+
}
|
|
1572
|
+
export interface IdentityTransformStreamQueuingStrategy {
|
|
1573
|
+
highWaterMark?: number | bigint;
|
|
1508
1574
|
}
|
|
1509
1575
|
export interface ReadableStreamValuesOptions {
|
|
1510
1576
|
preventCancel?: boolean;
|
|
@@ -1513,13 +1579,13 @@ export declare class CompressionStream extends TransformStream<
|
|
|
1513
1579
|
ArrayBuffer | ArrayBufferView,
|
|
1514
1580
|
Uint8Array
|
|
1515
1581
|
> {
|
|
1516
|
-
constructor(format: "gzip" | "deflate");
|
|
1582
|
+
constructor(format: "gzip" | "deflate" | "deflate-raw");
|
|
1517
1583
|
}
|
|
1518
1584
|
export declare class DecompressionStream extends TransformStream<
|
|
1519
1585
|
ArrayBuffer | ArrayBufferView,
|
|
1520
1586
|
Uint8Array
|
|
1521
1587
|
> {
|
|
1522
|
-
constructor(format: "gzip" | "deflate");
|
|
1588
|
+
constructor(format: "gzip" | "deflate" | "deflate-raw");
|
|
1523
1589
|
}
|
|
1524
1590
|
export declare class TextEncoderStream extends TransformStream<
|
|
1525
1591
|
string,
|
|
@@ -1661,6 +1727,7 @@ export declare class URLSearchParams {
|
|
|
1661
1727
|
| Record<string, string>
|
|
1662
1728
|
| [key: string, value: string][]
|
|
1663
1729
|
);
|
|
1730
|
+
get size(): number;
|
|
1664
1731
|
append(name: string, value: string): void;
|
|
1665
1732
|
delete(name: string): void;
|
|
1666
1733
|
get(name: string): string | null;
|
|
@@ -1859,7 +1926,7 @@ export interface BasicImageTransformationsGravityCoordinates {
|
|
|
1859
1926
|
* Note: Currently, these properties cannot be tested in the
|
|
1860
1927
|
* playground.
|
|
1861
1928
|
*/
|
|
1862
|
-
export interface RequestInitCfProperties {
|
|
1929
|
+
export interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1863
1930
|
cacheEverything?: boolean;
|
|
1864
1931
|
/**
|
|
1865
1932
|
* A request's cache key is what determines if two requests are
|
|
@@ -2029,6 +2096,49 @@ export interface RequestInitCfPropertiesImage
|
|
|
2029
2096
|
* the origin.
|
|
2030
2097
|
*/
|
|
2031
2098
|
"origin-auth"?: "share-publicly";
|
|
2099
|
+
/**
|
|
2100
|
+
* Adds a border around the image. The border is added after resizing. Border
|
|
2101
|
+
* width takes dpr into account, and can be specified either using a single
|
|
2102
|
+
* width property, or individually for each side.
|
|
2103
|
+
*/
|
|
2104
|
+
border?:
|
|
2105
|
+
| {
|
|
2106
|
+
color: string;
|
|
2107
|
+
width: number;
|
|
2108
|
+
}
|
|
2109
|
+
| {
|
|
2110
|
+
color: string;
|
|
2111
|
+
top: number;
|
|
2112
|
+
right: number;
|
|
2113
|
+
bottom: number;
|
|
2114
|
+
left: number;
|
|
2115
|
+
};
|
|
2116
|
+
/**
|
|
2117
|
+
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
2118
|
+
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
2119
|
+
* 0 is ignored.
|
|
2120
|
+
*/
|
|
2121
|
+
brightness?: number;
|
|
2122
|
+
/**
|
|
2123
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
2124
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
2125
|
+
* ignored.
|
|
2126
|
+
*/
|
|
2127
|
+
contrast?: number;
|
|
2128
|
+
/**
|
|
2129
|
+
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
2130
|
+
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
2131
|
+
*/
|
|
2132
|
+
gamma?: number;
|
|
2133
|
+
/**
|
|
2134
|
+
* Slightly reduces latency on a cache miss by selecting a
|
|
2135
|
+
* quickest-to-compress file format, at a cost of increased file size and
|
|
2136
|
+
* lower image quality. It will usually override the format option and choose
|
|
2137
|
+
* JPEG over WebP or AVIF. We do not recommend using this option, except in
|
|
2138
|
+
* unusual circumstances like resizing uncacheable dynamically-generated
|
|
2139
|
+
* images.
|
|
2140
|
+
*/
|
|
2141
|
+
compression?: "fast";
|
|
2032
2142
|
}
|
|
2033
2143
|
export interface RequestInitCfPropertiesImageMinify {
|
|
2034
2144
|
javascript?: boolean;
|
|
@@ -2044,7 +2154,8 @@ export type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2044
2154
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2045
2155
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2046
2156
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2047
|
-
export interface IncomingRequestCfPropertiesBase
|
|
2157
|
+
export interface IncomingRequestCfPropertiesBase
|
|
2158
|
+
extends Record<string, unknown> {
|
|
2048
2159
|
/**
|
|
2049
2160
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2050
2161
|
*
|
|
@@ -2125,8 +2236,7 @@ export interface IncomingRequestCfPropertiesBase {
|
|
|
2125
2236
|
export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2126
2237
|
/**
|
|
2127
2238
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2128
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2129
|
-
* and `99` (almost certainly a bot).
|
|
2239
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2130
2240
|
*
|
|
2131
2241
|
* @example 54
|
|
2132
2242
|
*/
|
|
@@ -2145,6 +2255,10 @@ export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
|
2145
2255
|
* 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.
|
|
2146
2256
|
*/
|
|
2147
2257
|
staticResource: boolean;
|
|
2258
|
+
/**
|
|
2259
|
+
* 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).
|
|
2260
|
+
*/
|
|
2261
|
+
detectionIds: number[];
|
|
2148
2262
|
}
|
|
2149
2263
|
export interface IncomingRequestCfPropertiesBotManagement {
|
|
2150
2264
|
/**
|
|
@@ -2233,86 +2347,82 @@ export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2233
2347
|
/**
|
|
2234
2348
|
* Geographic data about the request's origin.
|
|
2235
2349
|
*/
|
|
2236
|
-
export
|
|
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
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
* @example "635"
|
|
2313
|
-
*/
|
|
2314
|
-
metroCode?: string;
|
|
2315
|
-
};
|
|
2350
|
+
export interface IncomingRequestCfPropertiesGeographicInformation {
|
|
2351
|
+
/**
|
|
2352
|
+
* The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
|
|
2353
|
+
*
|
|
2354
|
+
* 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.
|
|
2355
|
+
*
|
|
2356
|
+
* If Cloudflare is unable to determine where the request originated this property is omitted.
|
|
2357
|
+
*
|
|
2358
|
+
* The country code `"T1"` is used for requests originating on TOR.
|
|
2359
|
+
*
|
|
2360
|
+
* @example "GB"
|
|
2361
|
+
*/
|
|
2362
|
+
country?: Iso3166Alpha2Code | "T1";
|
|
2363
|
+
/**
|
|
2364
|
+
* If present, this property indicates that the request originated in the EU
|
|
2365
|
+
*
|
|
2366
|
+
* @example "1"
|
|
2367
|
+
*/
|
|
2368
|
+
isEUCountry?: "1";
|
|
2369
|
+
/**
|
|
2370
|
+
* A two-letter code indicating the continent the request originated from.
|
|
2371
|
+
*
|
|
2372
|
+
* @example "AN"
|
|
2373
|
+
*/
|
|
2374
|
+
continent?: ContinentCode;
|
|
2375
|
+
/**
|
|
2376
|
+
* The city the request originated from
|
|
2377
|
+
*
|
|
2378
|
+
* @example "Austin"
|
|
2379
|
+
*/
|
|
2380
|
+
city?: string;
|
|
2381
|
+
/**
|
|
2382
|
+
* Postal code of the incoming request
|
|
2383
|
+
*
|
|
2384
|
+
* @example "78701"
|
|
2385
|
+
*/
|
|
2386
|
+
postalCode?: string;
|
|
2387
|
+
/**
|
|
2388
|
+
* Latitude of the incoming request
|
|
2389
|
+
*
|
|
2390
|
+
* @example "30.27130"
|
|
2391
|
+
*/
|
|
2392
|
+
latitude?: string;
|
|
2393
|
+
/**
|
|
2394
|
+
* Longitude of the incoming request
|
|
2395
|
+
*
|
|
2396
|
+
* @example "-97.74260"
|
|
2397
|
+
*/
|
|
2398
|
+
longitude?: string;
|
|
2399
|
+
/**
|
|
2400
|
+
* Timezone of the incoming request
|
|
2401
|
+
*
|
|
2402
|
+
* @example "America/Chicago"
|
|
2403
|
+
*/
|
|
2404
|
+
timezone?: string;
|
|
2405
|
+
/**
|
|
2406
|
+
* If known, the ISO 3166-2 name for the first level region associated with
|
|
2407
|
+
* the IP address of the incoming request
|
|
2408
|
+
*
|
|
2409
|
+
* @example "Texas"
|
|
2410
|
+
*/
|
|
2411
|
+
region?: string;
|
|
2412
|
+
/**
|
|
2413
|
+
* If known, the ISO 3166-2 code for the first-level region associated with
|
|
2414
|
+
* the IP address of the incoming request
|
|
2415
|
+
*
|
|
2416
|
+
* @example "TX"
|
|
2417
|
+
*/
|
|
2418
|
+
regionCode?: string;
|
|
2419
|
+
/**
|
|
2420
|
+
* Metro code (DMA) of the incoming request
|
|
2421
|
+
*
|
|
2422
|
+
* @example "635"
|
|
2423
|
+
*/
|
|
2424
|
+
metroCode?: string;
|
|
2425
|
+
}
|
|
2316
2426
|
/** Data about the incoming request's TLS certificate */
|
|
2317
2427
|
export interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2318
2428
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2705,6 +2815,9 @@ export type Iso3166Alpha2Code =
|
|
|
2705
2815
|
| "ZW";
|
|
2706
2816
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2707
2817
|
export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2818
|
+
export type CfProperties<HostMetadata = unknown> =
|
|
2819
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2820
|
+
| RequestInitCfProperties;
|
|
2708
2821
|
export interface D1Result<T = unknown> {
|
|
2709
2822
|
results?: T[];
|
|
2710
2823
|
success: boolean;
|
|
@@ -2725,9 +2838,9 @@ export declare abstract class D1PreparedStatement {
|
|
|
2725
2838
|
raw<T = unknown>(): Promise<T[]>;
|
|
2726
2839
|
}
|
|
2727
2840
|
/**
|
|
2728
|
-
*
|
|
2841
|
+
* An email message that can be sent from a Worker.
|
|
2729
2842
|
*/
|
|
2730
|
-
export interface EmailMessage
|
|
2843
|
+
export interface EmailMessage {
|
|
2731
2844
|
/**
|
|
2732
2845
|
* Envelope From attribute of the email message.
|
|
2733
2846
|
*/
|
|
@@ -2736,14 +2849,19 @@ export interface EmailMessage<Body = unknown> {
|
|
|
2736
2849
|
* Envelope To attribute of the email message.
|
|
2737
2850
|
*/
|
|
2738
2851
|
readonly to: string;
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2852
|
+
}
|
|
2853
|
+
/**
|
|
2854
|
+
* An email message that is sent to a consumer Worker and can be rejected/forwarded.
|
|
2855
|
+
*/
|
|
2856
|
+
export interface ForwardableEmailMessage extends EmailMessage {
|
|
2743
2857
|
/**
|
|
2744
2858
|
* Stream of the email message content.
|
|
2745
2859
|
*/
|
|
2746
2860
|
readonly raw: ReadableStream;
|
|
2861
|
+
/**
|
|
2862
|
+
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2863
|
+
*/
|
|
2864
|
+
readonly headers: Headers;
|
|
2747
2865
|
/**
|
|
2748
2866
|
* Size of the email message content.
|
|
2749
2867
|
*/
|
|
@@ -2762,11 +2880,17 @@ export interface EmailMessage<Body = unknown> {
|
|
|
2762
2880
|
*/
|
|
2763
2881
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2764
2882
|
}
|
|
2883
|
+
/**
|
|
2884
|
+
* A binding that allows a Worker to send email messages.
|
|
2885
|
+
*/
|
|
2886
|
+
export interface SendEmail {
|
|
2887
|
+
send(message: EmailMessage): Promise<void>;
|
|
2888
|
+
}
|
|
2765
2889
|
export declare abstract class EmailEvent extends ExtendableEvent {
|
|
2766
|
-
readonly message:
|
|
2890
|
+
readonly message: ForwardableEmailMessage;
|
|
2767
2891
|
}
|
|
2768
2892
|
export type EmailExportedHandler<Env = unknown> = (
|
|
2769
|
-
message:
|
|
2893
|
+
message: ForwardableEmailMessage,
|
|
2770
2894
|
env: Env,
|
|
2771
2895
|
ctx: ExecutionContext
|
|
2772
2896
|
) => void | Promise<void>;
|
|
@@ -2847,75 +2971,12 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2847
2971
|
// Key Identifier of the JWK
|
|
2848
2972
|
readonly kid: string;
|
|
2849
2973
|
}
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
*/
|
|
2853
|
-
export interface Message<Body = unknown> {
|
|
2854
|
-
/**
|
|
2855
|
-
* A unique, system-generated ID for the message.
|
|
2856
|
-
*/
|
|
2857
|
-
readonly id: string;
|
|
2858
|
-
/**
|
|
2859
|
-
* A timestamp when the message was sent.
|
|
2860
|
-
*/
|
|
2861
|
-
readonly timestamp: Date;
|
|
2862
|
-
/**
|
|
2863
|
-
* The body of the message.
|
|
2864
|
-
*/
|
|
2865
|
-
readonly body: Body;
|
|
2866
|
-
/**
|
|
2867
|
-
* Marks message to be retried.
|
|
2868
|
-
*/
|
|
2869
|
-
retry(): void;
|
|
2870
|
-
/**
|
|
2871
|
-
* Marks message acknowledged.
|
|
2872
|
-
*/
|
|
2873
|
-
ack(): void;
|
|
2874
|
-
}
|
|
2875
|
-
/**
|
|
2876
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2877
|
-
*/
|
|
2878
|
-
export interface MessageBatch<Body = unknown> {
|
|
2879
|
-
/**
|
|
2880
|
-
* The name of the Queue that belongs to this batch.
|
|
2881
|
-
*/
|
|
2882
|
-
readonly queue: string;
|
|
2883
|
-
/**
|
|
2884
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2885
|
-
*/
|
|
2886
|
-
readonly messages: readonly Message<Body>[];
|
|
2887
|
-
/**
|
|
2888
|
-
* Marks every message to be retried in the next batch.
|
|
2889
|
-
*/
|
|
2890
|
-
retryAll(): void;
|
|
2891
|
-
/**
|
|
2892
|
-
* Marks every message acknowledged in the batch.
|
|
2893
|
-
*/
|
|
2894
|
-
ackAll(): void;
|
|
2895
|
-
}
|
|
2896
|
-
/**
|
|
2897
|
-
* A wrapper class used to structure message batches.
|
|
2898
|
-
*/
|
|
2899
|
-
export type MessageSendRequest<Body = unknown> = {
|
|
2974
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
2975
|
+
export interface DispatchNamespace {
|
|
2900
2976
|
/**
|
|
2901
|
-
*
|
|
2977
|
+
* @param name Name of the Worker script.
|
|
2978
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
2979
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2902
2980
|
*/
|
|
2903
|
-
|
|
2904
|
-
};
|
|
2905
|
-
/**
|
|
2906
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
2907
|
-
*/
|
|
2908
|
-
export interface Queue<Body = any> {
|
|
2909
|
-
/**
|
|
2910
|
-
* Sends a message to the Queue.
|
|
2911
|
-
* @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.
|
|
2912
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2913
|
-
*/
|
|
2914
|
-
send(message: Body): Promise<void>;
|
|
2915
|
-
/**
|
|
2916
|
-
* Sends a batch of messages to the Queue.
|
|
2917
|
-
* @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.
|
|
2918
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2919
|
-
*/
|
|
2920
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2981
|
+
get(name: string): Fetcher;
|
|
2921
2982
|
}
|