@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.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,
|
|
@@ -1653,11 +1719,13 @@ export declare class URL {
|
|
|
1653
1719
|
get searchParams(): URLSearchParams;
|
|
1654
1720
|
toJSON(): string;
|
|
1655
1721
|
toString(): string;
|
|
1722
|
+
static canParse(url: string, base?: string): boolean;
|
|
1656
1723
|
}
|
|
1657
1724
|
export declare class URLSearchParams {
|
|
1658
1725
|
constructor(
|
|
1659
1726
|
init?: Iterable<Iterable<string>> | Record<string, string> | string
|
|
1660
1727
|
);
|
|
1728
|
+
get size(): number;
|
|
1661
1729
|
append(name: string, value: string): void;
|
|
1662
1730
|
delete(name: string): void;
|
|
1663
1731
|
get(name: string): string | null;
|
|
@@ -1856,7 +1924,7 @@ export interface BasicImageTransformationsGravityCoordinates {
|
|
|
1856
1924
|
* Note: Currently, these properties cannot be tested in the
|
|
1857
1925
|
* playground.
|
|
1858
1926
|
*/
|
|
1859
|
-
export interface RequestInitCfProperties {
|
|
1927
|
+
export interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1860
1928
|
cacheEverything?: boolean;
|
|
1861
1929
|
/**
|
|
1862
1930
|
* A request's cache key is what determines if two requests are
|
|
@@ -2026,6 +2094,49 @@ export interface RequestInitCfPropertiesImage
|
|
|
2026
2094
|
* the origin.
|
|
2027
2095
|
*/
|
|
2028
2096
|
"origin-auth"?: "share-publicly";
|
|
2097
|
+
/**
|
|
2098
|
+
* Adds a border around the image. The border is added after resizing. Border
|
|
2099
|
+
* width takes dpr into account, and can be specified either using a single
|
|
2100
|
+
* width property, or individually for each side.
|
|
2101
|
+
*/
|
|
2102
|
+
border?:
|
|
2103
|
+
| {
|
|
2104
|
+
color: string;
|
|
2105
|
+
width: number;
|
|
2106
|
+
}
|
|
2107
|
+
| {
|
|
2108
|
+
color: string;
|
|
2109
|
+
top: number;
|
|
2110
|
+
right: number;
|
|
2111
|
+
bottom: number;
|
|
2112
|
+
left: number;
|
|
2113
|
+
};
|
|
2114
|
+
/**
|
|
2115
|
+
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
2116
|
+
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
2117
|
+
* 0 is ignored.
|
|
2118
|
+
*/
|
|
2119
|
+
brightness?: number;
|
|
2120
|
+
/**
|
|
2121
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
2122
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
2123
|
+
* ignored.
|
|
2124
|
+
*/
|
|
2125
|
+
contrast?: number;
|
|
2126
|
+
/**
|
|
2127
|
+
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
2128
|
+
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
2129
|
+
*/
|
|
2130
|
+
gamma?: number;
|
|
2131
|
+
/**
|
|
2132
|
+
* Slightly reduces latency on a cache miss by selecting a
|
|
2133
|
+
* quickest-to-compress file format, at a cost of increased file size and
|
|
2134
|
+
* lower image quality. It will usually override the format option and choose
|
|
2135
|
+
* JPEG over WebP or AVIF. We do not recommend using this option, except in
|
|
2136
|
+
* unusual circumstances like resizing uncacheable dynamically-generated
|
|
2137
|
+
* images.
|
|
2138
|
+
*/
|
|
2139
|
+
compression?: "fast";
|
|
2029
2140
|
}
|
|
2030
2141
|
export interface RequestInitCfPropertiesImageMinify {
|
|
2031
2142
|
javascript?: boolean;
|
|
@@ -2041,7 +2152,8 @@ export type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2041
2152
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2042
2153
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2043
2154
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2044
|
-
export interface IncomingRequestCfPropertiesBase
|
|
2155
|
+
export interface IncomingRequestCfPropertiesBase
|
|
2156
|
+
extends Record<string, unknown> {
|
|
2045
2157
|
/**
|
|
2046
2158
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2047
2159
|
*
|
|
@@ -2122,8 +2234,7 @@ export interface IncomingRequestCfPropertiesBase {
|
|
|
2122
2234
|
export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2123
2235
|
/**
|
|
2124
2236
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2125
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2126
|
-
* and `99` (almost certainly a bot).
|
|
2237
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2127
2238
|
*
|
|
2128
2239
|
* @example 54
|
|
2129
2240
|
*/
|
|
@@ -2142,6 +2253,10 @@ export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
|
2142
2253
|
* 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.
|
|
2143
2254
|
*/
|
|
2144
2255
|
staticResource: boolean;
|
|
2256
|
+
/**
|
|
2257
|
+
* 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).
|
|
2258
|
+
*/
|
|
2259
|
+
detectionIds: number[];
|
|
2145
2260
|
}
|
|
2146
2261
|
export interface IncomingRequestCfPropertiesBotManagement {
|
|
2147
2262
|
/**
|
|
@@ -2230,86 +2345,82 @@ export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2230
2345
|
/**
|
|
2231
2346
|
* Geographic data about the request's origin.
|
|
2232
2347
|
*/
|
|
2233
|
-
export
|
|
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
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
* @example "635"
|
|
2310
|
-
*/
|
|
2311
|
-
metroCode?: string;
|
|
2312
|
-
};
|
|
2348
|
+
export interface IncomingRequestCfPropertiesGeographicInformation {
|
|
2349
|
+
/**
|
|
2350
|
+
* The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
|
|
2351
|
+
*
|
|
2352
|
+
* 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.
|
|
2353
|
+
*
|
|
2354
|
+
* If Cloudflare is unable to determine where the request originated this property is omitted.
|
|
2355
|
+
*
|
|
2356
|
+
* The country code `"T1"` is used for requests originating on TOR.
|
|
2357
|
+
*
|
|
2358
|
+
* @example "GB"
|
|
2359
|
+
*/
|
|
2360
|
+
country?: Iso3166Alpha2Code | "T1";
|
|
2361
|
+
/**
|
|
2362
|
+
* If present, this property indicates that the request originated in the EU
|
|
2363
|
+
*
|
|
2364
|
+
* @example "1"
|
|
2365
|
+
*/
|
|
2366
|
+
isEUCountry?: "1";
|
|
2367
|
+
/**
|
|
2368
|
+
* A two-letter code indicating the continent the request originated from.
|
|
2369
|
+
*
|
|
2370
|
+
* @example "AN"
|
|
2371
|
+
*/
|
|
2372
|
+
continent?: ContinentCode;
|
|
2373
|
+
/**
|
|
2374
|
+
* The city the request originated from
|
|
2375
|
+
*
|
|
2376
|
+
* @example "Austin"
|
|
2377
|
+
*/
|
|
2378
|
+
city?: string;
|
|
2379
|
+
/**
|
|
2380
|
+
* Postal code of the incoming request
|
|
2381
|
+
*
|
|
2382
|
+
* @example "78701"
|
|
2383
|
+
*/
|
|
2384
|
+
postalCode?: string;
|
|
2385
|
+
/**
|
|
2386
|
+
* Latitude of the incoming request
|
|
2387
|
+
*
|
|
2388
|
+
* @example "30.27130"
|
|
2389
|
+
*/
|
|
2390
|
+
latitude?: string;
|
|
2391
|
+
/**
|
|
2392
|
+
* Longitude of the incoming request
|
|
2393
|
+
*
|
|
2394
|
+
* @example "-97.74260"
|
|
2395
|
+
*/
|
|
2396
|
+
longitude?: string;
|
|
2397
|
+
/**
|
|
2398
|
+
* Timezone of the incoming request
|
|
2399
|
+
*
|
|
2400
|
+
* @example "America/Chicago"
|
|
2401
|
+
*/
|
|
2402
|
+
timezone?: string;
|
|
2403
|
+
/**
|
|
2404
|
+
* If known, the ISO 3166-2 name for the first level region associated with
|
|
2405
|
+
* the IP address of the incoming request
|
|
2406
|
+
*
|
|
2407
|
+
* @example "Texas"
|
|
2408
|
+
*/
|
|
2409
|
+
region?: string;
|
|
2410
|
+
/**
|
|
2411
|
+
* If known, the ISO 3166-2 code for the first-level region associated with
|
|
2412
|
+
* the IP address of the incoming request
|
|
2413
|
+
*
|
|
2414
|
+
* @example "TX"
|
|
2415
|
+
*/
|
|
2416
|
+
regionCode?: string;
|
|
2417
|
+
/**
|
|
2418
|
+
* Metro code (DMA) of the incoming request
|
|
2419
|
+
*
|
|
2420
|
+
* @example "635"
|
|
2421
|
+
*/
|
|
2422
|
+
metroCode?: string;
|
|
2423
|
+
}
|
|
2313
2424
|
/** Data about the incoming request's TLS certificate */
|
|
2314
2425
|
export interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2315
2426
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2702,6 +2813,9 @@ export type Iso3166Alpha2Code =
|
|
|
2702
2813
|
| "ZW";
|
|
2703
2814
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2704
2815
|
export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2816
|
+
export type CfProperties<HostMetadata = unknown> =
|
|
2817
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2818
|
+
| RequestInitCfProperties;
|
|
2705
2819
|
export interface D1Result<T = unknown> {
|
|
2706
2820
|
results?: T[];
|
|
2707
2821
|
success: boolean;
|
|
@@ -2722,9 +2836,9 @@ export declare abstract class D1PreparedStatement {
|
|
|
2722
2836
|
raw<T = unknown>(): Promise<T[]>;
|
|
2723
2837
|
}
|
|
2724
2838
|
/**
|
|
2725
|
-
*
|
|
2839
|
+
* An email message that can be sent from a Worker.
|
|
2726
2840
|
*/
|
|
2727
|
-
export interface EmailMessage
|
|
2841
|
+
export interface EmailMessage {
|
|
2728
2842
|
/**
|
|
2729
2843
|
* Envelope From attribute of the email message.
|
|
2730
2844
|
*/
|
|
@@ -2733,14 +2847,19 @@ export interface EmailMessage<Body = unknown> {
|
|
|
2733
2847
|
* Envelope To attribute of the email message.
|
|
2734
2848
|
*/
|
|
2735
2849
|
readonly to: string;
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2850
|
+
}
|
|
2851
|
+
/**
|
|
2852
|
+
* An email message that is sent to a consumer Worker and can be rejected/forwarded.
|
|
2853
|
+
*/
|
|
2854
|
+
export interface ForwardableEmailMessage extends EmailMessage {
|
|
2740
2855
|
/**
|
|
2741
2856
|
* Stream of the email message content.
|
|
2742
2857
|
*/
|
|
2743
2858
|
readonly raw: ReadableStream;
|
|
2859
|
+
/**
|
|
2860
|
+
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2861
|
+
*/
|
|
2862
|
+
readonly headers: Headers;
|
|
2744
2863
|
/**
|
|
2745
2864
|
* Size of the email message content.
|
|
2746
2865
|
*/
|
|
@@ -2759,11 +2878,17 @@ export interface EmailMessage<Body = unknown> {
|
|
|
2759
2878
|
*/
|
|
2760
2879
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2761
2880
|
}
|
|
2881
|
+
/**
|
|
2882
|
+
* A binding that allows a Worker to send email messages.
|
|
2883
|
+
*/
|
|
2884
|
+
export interface SendEmail {
|
|
2885
|
+
send(message: EmailMessage): Promise<void>;
|
|
2886
|
+
}
|
|
2762
2887
|
export declare abstract class EmailEvent extends ExtendableEvent {
|
|
2763
|
-
readonly message:
|
|
2888
|
+
readonly message: ForwardableEmailMessage;
|
|
2764
2889
|
}
|
|
2765
2890
|
export type EmailExportedHandler<Env = unknown> = (
|
|
2766
|
-
message:
|
|
2891
|
+
message: ForwardableEmailMessage,
|
|
2767
2892
|
env: Env,
|
|
2768
2893
|
ctx: ExecutionContext
|
|
2769
2894
|
) => void | Promise<void>;
|
|
@@ -2844,75 +2969,12 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2844
2969
|
// Key Identifier of the JWK
|
|
2845
2970
|
readonly kid: string;
|
|
2846
2971
|
}
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
*/
|
|
2850
|
-
export interface Message<Body = unknown> {
|
|
2851
|
-
/**
|
|
2852
|
-
* A unique, system-generated ID for the message.
|
|
2853
|
-
*/
|
|
2854
|
-
readonly id: string;
|
|
2855
|
-
/**
|
|
2856
|
-
* A timestamp when the message was sent.
|
|
2857
|
-
*/
|
|
2858
|
-
readonly timestamp: Date;
|
|
2859
|
-
/**
|
|
2860
|
-
* The body of the message.
|
|
2861
|
-
*/
|
|
2862
|
-
readonly body: Body;
|
|
2863
|
-
/**
|
|
2864
|
-
* Marks message to be retried.
|
|
2865
|
-
*/
|
|
2866
|
-
retry(): void;
|
|
2867
|
-
/**
|
|
2868
|
-
* Marks message acknowledged.
|
|
2869
|
-
*/
|
|
2870
|
-
ack(): void;
|
|
2871
|
-
}
|
|
2872
|
-
/**
|
|
2873
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2874
|
-
*/
|
|
2875
|
-
export interface MessageBatch<Body = unknown> {
|
|
2876
|
-
/**
|
|
2877
|
-
* The name of the Queue that belongs to this batch.
|
|
2878
|
-
*/
|
|
2879
|
-
readonly queue: string;
|
|
2880
|
-
/**
|
|
2881
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2882
|
-
*/
|
|
2883
|
-
readonly messages: readonly Message<Body>[];
|
|
2884
|
-
/**
|
|
2885
|
-
* Marks every message to be retried in the next batch.
|
|
2886
|
-
*/
|
|
2887
|
-
retryAll(): void;
|
|
2888
|
-
/**
|
|
2889
|
-
* Marks every message acknowledged in the batch.
|
|
2890
|
-
*/
|
|
2891
|
-
ackAll(): void;
|
|
2892
|
-
}
|
|
2893
|
-
/**
|
|
2894
|
-
* A wrapper class used to structure message batches.
|
|
2895
|
-
*/
|
|
2896
|
-
export type MessageSendRequest<Body = unknown> = {
|
|
2972
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
2973
|
+
export interface DispatchNamespace {
|
|
2897
2974
|
/**
|
|
2898
|
-
*
|
|
2975
|
+
* @param name Name of the Worker script.
|
|
2976
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
2977
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2899
2978
|
*/
|
|
2900
|
-
|
|
2901
|
-
};
|
|
2902
|
-
/**
|
|
2903
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
2904
|
-
*/
|
|
2905
|
-
export interface Queue<Body = any> {
|
|
2906
|
-
/**
|
|
2907
|
-
* Sends a message to the Queue.
|
|
2908
|
-
* @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.
|
|
2909
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2910
|
-
*/
|
|
2911
|
-
send(message: Body): Promise<void>;
|
|
2912
|
-
/**
|
|
2913
|
-
* Sends a batch of messages to the Queue.
|
|
2914
|
-
* @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.
|
|
2915
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2916
|
-
*/
|
|
2917
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2979
|
+
get(name: string): Fetcher;
|
|
2918
2980
|
}
|