@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-08-04/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;
|
|
@@ -1283,12 +1337,18 @@ export interface R2HTTPMetadata {
|
|
|
1283
1337
|
cacheControl?: string;
|
|
1284
1338
|
cacheExpiry?: Date;
|
|
1285
1339
|
}
|
|
1286
|
-
export
|
|
1340
|
+
export type R2Objects = {
|
|
1287
1341
|
objects: R2Object[];
|
|
1288
|
-
truncated: boolean;
|
|
1289
|
-
cursor?: string;
|
|
1290
1342
|
delimitedPrefixes: string[];
|
|
1291
|
-
}
|
|
1343
|
+
} & (
|
|
1344
|
+
| {
|
|
1345
|
+
truncated: true;
|
|
1346
|
+
cursor: string;
|
|
1347
|
+
}
|
|
1348
|
+
| {
|
|
1349
|
+
truncated: false;
|
|
1350
|
+
}
|
|
1351
|
+
);
|
|
1292
1352
|
export declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1293
1353
|
readonly scheduledTime: number;
|
|
1294
1354
|
readonly cron: string;
|
|
@@ -1499,13 +1559,19 @@ export declare class TransformStream<I = any, O = any> {
|
|
|
1499
1559
|
get writable(): WritableStream<I>;
|
|
1500
1560
|
}
|
|
1501
1561
|
export declare class FixedLengthStream extends IdentityTransformStream {
|
|
1502
|
-
constructor(
|
|
1562
|
+
constructor(
|
|
1563
|
+
expectedLength: number | bigint,
|
|
1564
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy
|
|
1565
|
+
);
|
|
1503
1566
|
}
|
|
1504
1567
|
export declare class IdentityTransformStream extends TransformStream<
|
|
1505
1568
|
ArrayBuffer | ArrayBufferView,
|
|
1506
1569
|
Uint8Array
|
|
1507
1570
|
> {
|
|
1508
|
-
constructor();
|
|
1571
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
1572
|
+
}
|
|
1573
|
+
export interface IdentityTransformStreamQueuingStrategy {
|
|
1574
|
+
highWaterMark?: number | bigint;
|
|
1509
1575
|
}
|
|
1510
1576
|
export interface ReadableStreamValuesOptions {
|
|
1511
1577
|
preventCancel?: boolean;
|
|
@@ -1514,13 +1580,13 @@ export declare class CompressionStream extends TransformStream<
|
|
|
1514
1580
|
ArrayBuffer | ArrayBufferView,
|
|
1515
1581
|
Uint8Array
|
|
1516
1582
|
> {
|
|
1517
|
-
constructor(format: "gzip" | "deflate");
|
|
1583
|
+
constructor(format: "gzip" | "deflate" | "deflate-raw");
|
|
1518
1584
|
}
|
|
1519
1585
|
export declare class DecompressionStream extends TransformStream<
|
|
1520
1586
|
ArrayBuffer | ArrayBufferView,
|
|
1521
1587
|
Uint8Array
|
|
1522
1588
|
> {
|
|
1523
|
-
constructor(format: "gzip" | "deflate");
|
|
1589
|
+
constructor(format: "gzip" | "deflate" | "deflate-raw");
|
|
1524
1590
|
}
|
|
1525
1591
|
export declare class TextEncoderStream extends TransformStream<
|
|
1526
1592
|
string,
|
|
@@ -1662,6 +1728,7 @@ export declare class URLSearchParams {
|
|
|
1662
1728
|
| Record<string, string>
|
|
1663
1729
|
| [key: string, value: string][]
|
|
1664
1730
|
);
|
|
1731
|
+
get size(): number;
|
|
1665
1732
|
append(name: string, value: string): void;
|
|
1666
1733
|
delete(name: string): void;
|
|
1667
1734
|
get(name: string): string | null;
|
|
@@ -1860,7 +1927,7 @@ export interface BasicImageTransformationsGravityCoordinates {
|
|
|
1860
1927
|
* Note: Currently, these properties cannot be tested in the
|
|
1861
1928
|
* playground.
|
|
1862
1929
|
*/
|
|
1863
|
-
export interface RequestInitCfProperties {
|
|
1930
|
+
export interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1864
1931
|
cacheEverything?: boolean;
|
|
1865
1932
|
/**
|
|
1866
1933
|
* A request's cache key is what determines if two requests are
|
|
@@ -2030,6 +2097,49 @@ export interface RequestInitCfPropertiesImage
|
|
|
2030
2097
|
* the origin.
|
|
2031
2098
|
*/
|
|
2032
2099
|
"origin-auth"?: "share-publicly";
|
|
2100
|
+
/**
|
|
2101
|
+
* Adds a border around the image. The border is added after resizing. Border
|
|
2102
|
+
* width takes dpr into account, and can be specified either using a single
|
|
2103
|
+
* width property, or individually for each side.
|
|
2104
|
+
*/
|
|
2105
|
+
border?:
|
|
2106
|
+
| {
|
|
2107
|
+
color: string;
|
|
2108
|
+
width: number;
|
|
2109
|
+
}
|
|
2110
|
+
| {
|
|
2111
|
+
color: string;
|
|
2112
|
+
top: number;
|
|
2113
|
+
right: number;
|
|
2114
|
+
bottom: number;
|
|
2115
|
+
left: number;
|
|
2116
|
+
};
|
|
2117
|
+
/**
|
|
2118
|
+
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
2119
|
+
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
2120
|
+
* 0 is ignored.
|
|
2121
|
+
*/
|
|
2122
|
+
brightness?: number;
|
|
2123
|
+
/**
|
|
2124
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
2125
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
2126
|
+
* ignored.
|
|
2127
|
+
*/
|
|
2128
|
+
contrast?: number;
|
|
2129
|
+
/**
|
|
2130
|
+
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
2131
|
+
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
2132
|
+
*/
|
|
2133
|
+
gamma?: number;
|
|
2134
|
+
/**
|
|
2135
|
+
* Slightly reduces latency on a cache miss by selecting a
|
|
2136
|
+
* quickest-to-compress file format, at a cost of increased file size and
|
|
2137
|
+
* lower image quality. It will usually override the format option and choose
|
|
2138
|
+
* JPEG over WebP or AVIF. We do not recommend using this option, except in
|
|
2139
|
+
* unusual circumstances like resizing uncacheable dynamically-generated
|
|
2140
|
+
* images.
|
|
2141
|
+
*/
|
|
2142
|
+
compression?: "fast";
|
|
2033
2143
|
}
|
|
2034
2144
|
export interface RequestInitCfPropertiesImageMinify {
|
|
2035
2145
|
javascript?: boolean;
|
|
@@ -2045,7 +2155,8 @@ export type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2045
2155
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2046
2156
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2047
2157
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2048
|
-
export interface IncomingRequestCfPropertiesBase
|
|
2158
|
+
export interface IncomingRequestCfPropertiesBase
|
|
2159
|
+
extends Record<string, unknown> {
|
|
2049
2160
|
/**
|
|
2050
2161
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2051
2162
|
*
|
|
@@ -2126,8 +2237,7 @@ export interface IncomingRequestCfPropertiesBase {
|
|
|
2126
2237
|
export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2127
2238
|
/**
|
|
2128
2239
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2129
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2130
|
-
* and `99` (almost certainly a bot).
|
|
2240
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2131
2241
|
*
|
|
2132
2242
|
* @example 54
|
|
2133
2243
|
*/
|
|
@@ -2146,6 +2256,10 @@ export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
|
2146
2256
|
* 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.
|
|
2147
2257
|
*/
|
|
2148
2258
|
staticResource: boolean;
|
|
2259
|
+
/**
|
|
2260
|
+
* 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).
|
|
2261
|
+
*/
|
|
2262
|
+
detectionIds: number[];
|
|
2149
2263
|
}
|
|
2150
2264
|
export interface IncomingRequestCfPropertiesBotManagement {
|
|
2151
2265
|
/**
|
|
@@ -2234,86 +2348,82 @@ export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2234
2348
|
/**
|
|
2235
2349
|
* Geographic data about the request's origin.
|
|
2236
2350
|
*/
|
|
2237
|
-
export
|
|
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
|
-
|
|
2313
|
-
* @example "635"
|
|
2314
|
-
*/
|
|
2315
|
-
metroCode?: string;
|
|
2316
|
-
};
|
|
2351
|
+
export interface IncomingRequestCfPropertiesGeographicInformation {
|
|
2352
|
+
/**
|
|
2353
|
+
* The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
|
|
2354
|
+
*
|
|
2355
|
+
* 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.
|
|
2356
|
+
*
|
|
2357
|
+
* If Cloudflare is unable to determine where the request originated this property is omitted.
|
|
2358
|
+
*
|
|
2359
|
+
* The country code `"T1"` is used for requests originating on TOR.
|
|
2360
|
+
*
|
|
2361
|
+
* @example "GB"
|
|
2362
|
+
*/
|
|
2363
|
+
country?: Iso3166Alpha2Code | "T1";
|
|
2364
|
+
/**
|
|
2365
|
+
* If present, this property indicates that the request originated in the EU
|
|
2366
|
+
*
|
|
2367
|
+
* @example "1"
|
|
2368
|
+
*/
|
|
2369
|
+
isEUCountry?: "1";
|
|
2370
|
+
/**
|
|
2371
|
+
* A two-letter code indicating the continent the request originated from.
|
|
2372
|
+
*
|
|
2373
|
+
* @example "AN"
|
|
2374
|
+
*/
|
|
2375
|
+
continent?: ContinentCode;
|
|
2376
|
+
/**
|
|
2377
|
+
* The city the request originated from
|
|
2378
|
+
*
|
|
2379
|
+
* @example "Austin"
|
|
2380
|
+
*/
|
|
2381
|
+
city?: string;
|
|
2382
|
+
/**
|
|
2383
|
+
* Postal code of the incoming request
|
|
2384
|
+
*
|
|
2385
|
+
* @example "78701"
|
|
2386
|
+
*/
|
|
2387
|
+
postalCode?: string;
|
|
2388
|
+
/**
|
|
2389
|
+
* Latitude of the incoming request
|
|
2390
|
+
*
|
|
2391
|
+
* @example "30.27130"
|
|
2392
|
+
*/
|
|
2393
|
+
latitude?: string;
|
|
2394
|
+
/**
|
|
2395
|
+
* Longitude of the incoming request
|
|
2396
|
+
*
|
|
2397
|
+
* @example "-97.74260"
|
|
2398
|
+
*/
|
|
2399
|
+
longitude?: string;
|
|
2400
|
+
/**
|
|
2401
|
+
* Timezone of the incoming request
|
|
2402
|
+
*
|
|
2403
|
+
* @example "America/Chicago"
|
|
2404
|
+
*/
|
|
2405
|
+
timezone?: string;
|
|
2406
|
+
/**
|
|
2407
|
+
* If known, the ISO 3166-2 name for the first level region associated with
|
|
2408
|
+
* the IP address of the incoming request
|
|
2409
|
+
*
|
|
2410
|
+
* @example "Texas"
|
|
2411
|
+
*/
|
|
2412
|
+
region?: string;
|
|
2413
|
+
/**
|
|
2414
|
+
* If known, the ISO 3166-2 code for the first-level region associated with
|
|
2415
|
+
* the IP address of the incoming request
|
|
2416
|
+
*
|
|
2417
|
+
* @example "TX"
|
|
2418
|
+
*/
|
|
2419
|
+
regionCode?: string;
|
|
2420
|
+
/**
|
|
2421
|
+
* Metro code (DMA) of the incoming request
|
|
2422
|
+
*
|
|
2423
|
+
* @example "635"
|
|
2424
|
+
*/
|
|
2425
|
+
metroCode?: string;
|
|
2426
|
+
}
|
|
2317
2427
|
/** Data about the incoming request's TLS certificate */
|
|
2318
2428
|
export interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2319
2429
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2706,6 +2816,9 @@ export type Iso3166Alpha2Code =
|
|
|
2706
2816
|
| "ZW";
|
|
2707
2817
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2708
2818
|
export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2819
|
+
export type CfProperties<HostMetadata = unknown> =
|
|
2820
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2821
|
+
| RequestInitCfProperties;
|
|
2709
2822
|
export interface D1Result<T = unknown> {
|
|
2710
2823
|
results?: T[];
|
|
2711
2824
|
success: boolean;
|
|
@@ -2726,9 +2839,9 @@ export declare abstract class D1PreparedStatement {
|
|
|
2726
2839
|
raw<T = unknown>(): Promise<T[]>;
|
|
2727
2840
|
}
|
|
2728
2841
|
/**
|
|
2729
|
-
*
|
|
2842
|
+
* An email message that can be sent from a Worker.
|
|
2730
2843
|
*/
|
|
2731
|
-
export interface EmailMessage
|
|
2844
|
+
export interface EmailMessage {
|
|
2732
2845
|
/**
|
|
2733
2846
|
* Envelope From attribute of the email message.
|
|
2734
2847
|
*/
|
|
@@ -2737,14 +2850,19 @@ export interface EmailMessage<Body = unknown> {
|
|
|
2737
2850
|
* Envelope To attribute of the email message.
|
|
2738
2851
|
*/
|
|
2739
2852
|
readonly to: string;
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2853
|
+
}
|
|
2854
|
+
/**
|
|
2855
|
+
* An email message that is sent to a consumer Worker and can be rejected/forwarded.
|
|
2856
|
+
*/
|
|
2857
|
+
export interface ForwardableEmailMessage extends EmailMessage {
|
|
2744
2858
|
/**
|
|
2745
2859
|
* Stream of the email message content.
|
|
2746
2860
|
*/
|
|
2747
2861
|
readonly raw: ReadableStream;
|
|
2862
|
+
/**
|
|
2863
|
+
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2864
|
+
*/
|
|
2865
|
+
readonly headers: Headers;
|
|
2748
2866
|
/**
|
|
2749
2867
|
* Size of the email message content.
|
|
2750
2868
|
*/
|
|
@@ -2763,11 +2881,17 @@ export interface EmailMessage<Body = unknown> {
|
|
|
2763
2881
|
*/
|
|
2764
2882
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2765
2883
|
}
|
|
2884
|
+
/**
|
|
2885
|
+
* A binding that allows a Worker to send email messages.
|
|
2886
|
+
*/
|
|
2887
|
+
export interface SendEmail {
|
|
2888
|
+
send(message: EmailMessage): Promise<void>;
|
|
2889
|
+
}
|
|
2766
2890
|
export declare abstract class EmailEvent extends ExtendableEvent {
|
|
2767
|
-
readonly message:
|
|
2891
|
+
readonly message: ForwardableEmailMessage;
|
|
2768
2892
|
}
|
|
2769
2893
|
export type EmailExportedHandler<Env = unknown> = (
|
|
2770
|
-
message:
|
|
2894
|
+
message: ForwardableEmailMessage,
|
|
2771
2895
|
env: Env,
|
|
2772
2896
|
ctx: ExecutionContext
|
|
2773
2897
|
) => void | Promise<void>;
|
|
@@ -2848,75 +2972,12 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2848
2972
|
// Key Identifier of the JWK
|
|
2849
2973
|
readonly kid: string;
|
|
2850
2974
|
}
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
*/
|
|
2854
|
-
export interface Message<Body = unknown> {
|
|
2855
|
-
/**
|
|
2856
|
-
* A unique, system-generated ID for the message.
|
|
2857
|
-
*/
|
|
2858
|
-
readonly id: string;
|
|
2859
|
-
/**
|
|
2860
|
-
* A timestamp when the message was sent.
|
|
2861
|
-
*/
|
|
2862
|
-
readonly timestamp: Date;
|
|
2863
|
-
/**
|
|
2864
|
-
* The body of the message.
|
|
2865
|
-
*/
|
|
2866
|
-
readonly body: Body;
|
|
2867
|
-
/**
|
|
2868
|
-
* Marks message to be retried.
|
|
2869
|
-
*/
|
|
2870
|
-
retry(): void;
|
|
2871
|
-
/**
|
|
2872
|
-
* Marks message acknowledged.
|
|
2873
|
-
*/
|
|
2874
|
-
ack(): void;
|
|
2875
|
-
}
|
|
2876
|
-
/**
|
|
2877
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2878
|
-
*/
|
|
2879
|
-
export interface MessageBatch<Body = unknown> {
|
|
2880
|
-
/**
|
|
2881
|
-
* The name of the Queue that belongs to this batch.
|
|
2882
|
-
*/
|
|
2883
|
-
readonly queue: string;
|
|
2884
|
-
/**
|
|
2885
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2886
|
-
*/
|
|
2887
|
-
readonly messages: readonly Message<Body>[];
|
|
2888
|
-
/**
|
|
2889
|
-
* Marks every message to be retried in the next batch.
|
|
2890
|
-
*/
|
|
2891
|
-
retryAll(): void;
|
|
2892
|
-
/**
|
|
2893
|
-
* Marks every message acknowledged in the batch.
|
|
2894
|
-
*/
|
|
2895
|
-
ackAll(): void;
|
|
2896
|
-
}
|
|
2897
|
-
/**
|
|
2898
|
-
* A wrapper class used to structure message batches.
|
|
2899
|
-
*/
|
|
2900
|
-
export type MessageSendRequest<Body = unknown> = {
|
|
2975
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
2976
|
+
export interface DispatchNamespace {
|
|
2901
2977
|
/**
|
|
2902
|
-
*
|
|
2978
|
+
* @param name Name of the Worker script.
|
|
2979
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
2980
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2903
2981
|
*/
|
|
2904
|
-
|
|
2905
|
-
};
|
|
2906
|
-
/**
|
|
2907
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
2908
|
-
*/
|
|
2909
|
-
export interface Queue<Body = any> {
|
|
2910
|
-
/**
|
|
2911
|
-
* Sends a message to the Queue.
|
|
2912
|
-
* @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.
|
|
2913
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2914
|
-
*/
|
|
2915
|
-
send(message: Body): Promise<void>;
|
|
2916
|
-
/**
|
|
2917
|
-
* Sends a batch of messages to the Queue.
|
|
2918
|
-
* @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.
|
|
2919
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2920
|
-
*/
|
|
2921
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2982
|
+
get(name: string): Fetcher;
|
|
2922
2983
|
}
|