@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-01-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
|
};
|
|
@@ -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;
|
|
@@ -977,23 +1003,27 @@ export interface ResponseInit {
|
|
|
977
1003
|
webSocket?: WebSocket | null;
|
|
978
1004
|
encodeBody?: "automatic" | "manual";
|
|
979
1005
|
}
|
|
980
|
-
export type RequestInfo
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
1006
|
+
export type RequestInfo<
|
|
1007
|
+
CfHostMetadata = unknown,
|
|
1008
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1009
|
+
> = Request<CfHostMetadata, Cf> | string | URL;
|
|
1010
|
+
export declare class Request<
|
|
1011
|
+
CfHostMetadata = unknown,
|
|
1012
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1013
|
+
> extends Body {
|
|
1014
|
+
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1015
|
+
clone(): Request<CfHostMetadata, Cf>;
|
|
984
1016
|
get method(): string;
|
|
985
1017
|
get url(): string;
|
|
986
1018
|
get headers(): Headers;
|
|
987
1019
|
get redirect(): string;
|
|
988
1020
|
get fetcher(): Fetcher | null;
|
|
989
1021
|
get signal(): AbortSignal;
|
|
990
|
-
get cf():
|
|
1022
|
+
get cf(): Cf | undefined;
|
|
991
1023
|
get integrity(): string;
|
|
992
1024
|
get keepalive(): boolean;
|
|
993
1025
|
}
|
|
994
|
-
export interface RequestInit<
|
|
995
|
-
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
996
|
-
> {
|
|
1026
|
+
export interface RequestInit<Cf = CfProperties> {
|
|
997
1027
|
/** A string to set request's method. */
|
|
998
1028
|
method?: string;
|
|
999
1029
|
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
@@ -1003,17 +1033,14 @@ export interface RequestInit<
|
|
|
1003
1033
|
/** 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. */
|
|
1004
1034
|
redirect?: string;
|
|
1005
1035
|
fetcher?: Fetcher | null;
|
|
1006
|
-
cf?:
|
|
1036
|
+
cf?: Cf;
|
|
1007
1037
|
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1008
1038
|
integrity?: string;
|
|
1009
1039
|
/** An AbortSignal to set request's signal. */
|
|
1010
1040
|
signal?: AbortSignal | null;
|
|
1011
1041
|
}
|
|
1012
1042
|
export declare abstract class Fetcher {
|
|
1013
|
-
fetch(
|
|
1014
|
-
input: RequestInfo,
|
|
1015
|
-
init?: RequestInit<RequestInitCfProperties>
|
|
1016
|
-
): Promise<Response>;
|
|
1043
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1017
1044
|
}
|
|
1018
1045
|
export interface FetcherPutOptions {
|
|
1019
1046
|
expiration?: number;
|
|
@@ -1126,6 +1153,33 @@ export interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1126
1153
|
value: Value | null;
|
|
1127
1154
|
metadata: Metadata | null;
|
|
1128
1155
|
}
|
|
1156
|
+
export interface Queue<Body> {
|
|
1157
|
+
send(message: Body): Promise<void>;
|
|
1158
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1159
|
+
}
|
|
1160
|
+
export interface QueueSendOptions {}
|
|
1161
|
+
export interface MessageSendRequest<Body = unknown> {
|
|
1162
|
+
body: Body;
|
|
1163
|
+
}
|
|
1164
|
+
export interface Message<Body = unknown> {
|
|
1165
|
+
readonly id: string;
|
|
1166
|
+
readonly timestamp: Date;
|
|
1167
|
+
readonly body: Body;
|
|
1168
|
+
retry(): void;
|
|
1169
|
+
ack(): void;
|
|
1170
|
+
}
|
|
1171
|
+
export interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1172
|
+
readonly messages: readonly Message<Body>[];
|
|
1173
|
+
readonly queue: string;
|
|
1174
|
+
retryAll(): void;
|
|
1175
|
+
ackAll(): void;
|
|
1176
|
+
}
|
|
1177
|
+
export interface MessageBatch<Body = unknown> {
|
|
1178
|
+
readonly messages: readonly Message<Body>[];
|
|
1179
|
+
readonly queue: string;
|
|
1180
|
+
retryAll(): void;
|
|
1181
|
+
ackAll(): void;
|
|
1182
|
+
}
|
|
1129
1183
|
export interface R2Error extends Error {
|
|
1130
1184
|
readonly name: string;
|
|
1131
1185
|
readonly code: number;
|
|
@@ -1276,12 +1330,18 @@ export interface R2HTTPMetadata {
|
|
|
1276
1330
|
cacheControl?: string;
|
|
1277
1331
|
cacheExpiry?: Date;
|
|
1278
1332
|
}
|
|
1279
|
-
export
|
|
1333
|
+
export type R2Objects = {
|
|
1280
1334
|
objects: R2Object[];
|
|
1281
|
-
truncated: boolean;
|
|
1282
|
-
cursor?: string;
|
|
1283
1335
|
delimitedPrefixes: string[];
|
|
1284
|
-
}
|
|
1336
|
+
} & (
|
|
1337
|
+
| {
|
|
1338
|
+
truncated: true;
|
|
1339
|
+
cursor: string;
|
|
1340
|
+
}
|
|
1341
|
+
| {
|
|
1342
|
+
truncated: false;
|
|
1343
|
+
}
|
|
1344
|
+
);
|
|
1285
1345
|
export declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1286
1346
|
readonly scheduledTime: number;
|
|
1287
1347
|
readonly cron: string;
|
|
@@ -1492,13 +1552,19 @@ export declare class TransformStream<I = any, O = any> {
|
|
|
1492
1552
|
get writable(): WritableStream<I>;
|
|
1493
1553
|
}
|
|
1494
1554
|
export declare class FixedLengthStream extends IdentityTransformStream {
|
|
1495
|
-
constructor(
|
|
1555
|
+
constructor(
|
|
1556
|
+
expectedLength: number | bigint,
|
|
1557
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy
|
|
1558
|
+
);
|
|
1496
1559
|
}
|
|
1497
1560
|
export declare class IdentityTransformStream extends TransformStream<
|
|
1498
1561
|
ArrayBuffer | ArrayBufferView,
|
|
1499
1562
|
Uint8Array
|
|
1500
1563
|
> {
|
|
1501
|
-
constructor();
|
|
1564
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
1565
|
+
}
|
|
1566
|
+
export interface IdentityTransformStreamQueuingStrategy {
|
|
1567
|
+
highWaterMark?: number | bigint;
|
|
1502
1568
|
}
|
|
1503
1569
|
export interface ReadableStreamValuesOptions {
|
|
1504
1570
|
preventCancel?: boolean;
|
|
@@ -1507,13 +1573,13 @@ export declare class CompressionStream extends TransformStream<
|
|
|
1507
1573
|
ArrayBuffer | ArrayBufferView,
|
|
1508
1574
|
Uint8Array
|
|
1509
1575
|
> {
|
|
1510
|
-
constructor(format: "gzip" | "deflate");
|
|
1576
|
+
constructor(format: "gzip" | "deflate" | "deflate-raw");
|
|
1511
1577
|
}
|
|
1512
1578
|
export declare class DecompressionStream 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 TextEncoderStream extends TransformStream<
|
|
1519
1585
|
string,
|
|
@@ -1655,6 +1721,7 @@ export declare class URLSearchParams {
|
|
|
1655
1721
|
| Record<string, string>
|
|
1656
1722
|
| [key: string, value: string][]
|
|
1657
1723
|
);
|
|
1724
|
+
get size(): number;
|
|
1658
1725
|
append(name: string, value: string): void;
|
|
1659
1726
|
delete(name: string): void;
|
|
1660
1727
|
get(name: string): string | null;
|
|
@@ -1853,7 +1920,7 @@ export interface BasicImageTransformationsGravityCoordinates {
|
|
|
1853
1920
|
* Note: Currently, these properties cannot be tested in the
|
|
1854
1921
|
* playground.
|
|
1855
1922
|
*/
|
|
1856
|
-
export interface RequestInitCfProperties {
|
|
1923
|
+
export interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1857
1924
|
cacheEverything?: boolean;
|
|
1858
1925
|
/**
|
|
1859
1926
|
* A request's cache key is what determines if two requests are
|
|
@@ -2023,6 +2090,49 @@ export interface RequestInitCfPropertiesImage
|
|
|
2023
2090
|
* the origin.
|
|
2024
2091
|
*/
|
|
2025
2092
|
"origin-auth"?: "share-publicly";
|
|
2093
|
+
/**
|
|
2094
|
+
* Adds a border around the image. The border is added after resizing. Border
|
|
2095
|
+
* width takes dpr into account, and can be specified either using a single
|
|
2096
|
+
* width property, or individually for each side.
|
|
2097
|
+
*/
|
|
2098
|
+
border?:
|
|
2099
|
+
| {
|
|
2100
|
+
color: string;
|
|
2101
|
+
width: number;
|
|
2102
|
+
}
|
|
2103
|
+
| {
|
|
2104
|
+
color: string;
|
|
2105
|
+
top: number;
|
|
2106
|
+
right: number;
|
|
2107
|
+
bottom: number;
|
|
2108
|
+
left: number;
|
|
2109
|
+
};
|
|
2110
|
+
/**
|
|
2111
|
+
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
2112
|
+
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
2113
|
+
* 0 is ignored.
|
|
2114
|
+
*/
|
|
2115
|
+
brightness?: number;
|
|
2116
|
+
/**
|
|
2117
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
2118
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
2119
|
+
* ignored.
|
|
2120
|
+
*/
|
|
2121
|
+
contrast?: number;
|
|
2122
|
+
/**
|
|
2123
|
+
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
2124
|
+
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
2125
|
+
*/
|
|
2126
|
+
gamma?: number;
|
|
2127
|
+
/**
|
|
2128
|
+
* Slightly reduces latency on a cache miss by selecting a
|
|
2129
|
+
* quickest-to-compress file format, at a cost of increased file size and
|
|
2130
|
+
* lower image quality. It will usually override the format option and choose
|
|
2131
|
+
* JPEG over WebP or AVIF. We do not recommend using this option, except in
|
|
2132
|
+
* unusual circumstances like resizing uncacheable dynamically-generated
|
|
2133
|
+
* images.
|
|
2134
|
+
*/
|
|
2135
|
+
compression?: "fast";
|
|
2026
2136
|
}
|
|
2027
2137
|
export interface RequestInitCfPropertiesImageMinify {
|
|
2028
2138
|
javascript?: boolean;
|
|
@@ -2038,7 +2148,8 @@ export type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2038
2148
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2039
2149
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2040
2150
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2041
|
-
export interface IncomingRequestCfPropertiesBase
|
|
2151
|
+
export interface IncomingRequestCfPropertiesBase
|
|
2152
|
+
extends Record<string, unknown> {
|
|
2042
2153
|
/**
|
|
2043
2154
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2044
2155
|
*
|
|
@@ -2119,8 +2230,7 @@ export interface IncomingRequestCfPropertiesBase {
|
|
|
2119
2230
|
export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2120
2231
|
/**
|
|
2121
2232
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2122
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2123
|
-
* and `99` (almost certainly a bot).
|
|
2233
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2124
2234
|
*
|
|
2125
2235
|
* @example 54
|
|
2126
2236
|
*/
|
|
@@ -2139,6 +2249,10 @@ export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
|
2139
2249
|
* 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.
|
|
2140
2250
|
*/
|
|
2141
2251
|
staticResource: boolean;
|
|
2252
|
+
/**
|
|
2253
|
+
* 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).
|
|
2254
|
+
*/
|
|
2255
|
+
detectionIds: number[];
|
|
2142
2256
|
}
|
|
2143
2257
|
export interface IncomingRequestCfPropertiesBotManagement {
|
|
2144
2258
|
/**
|
|
@@ -2227,86 +2341,82 @@ export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2227
2341
|
/**
|
|
2228
2342
|
* Geographic data about the request's origin.
|
|
2229
2343
|
*/
|
|
2230
|
-
export
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
* @example "635"
|
|
2307
|
-
*/
|
|
2308
|
-
metroCode?: string;
|
|
2309
|
-
};
|
|
2344
|
+
export interface IncomingRequestCfPropertiesGeographicInformation {
|
|
2345
|
+
/**
|
|
2346
|
+
* The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
|
|
2347
|
+
*
|
|
2348
|
+
* 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.
|
|
2349
|
+
*
|
|
2350
|
+
* If Cloudflare is unable to determine where the request originated this property is omitted.
|
|
2351
|
+
*
|
|
2352
|
+
* The country code `"T1"` is used for requests originating on TOR.
|
|
2353
|
+
*
|
|
2354
|
+
* @example "GB"
|
|
2355
|
+
*/
|
|
2356
|
+
country?: Iso3166Alpha2Code | "T1";
|
|
2357
|
+
/**
|
|
2358
|
+
* If present, this property indicates that the request originated in the EU
|
|
2359
|
+
*
|
|
2360
|
+
* @example "1"
|
|
2361
|
+
*/
|
|
2362
|
+
isEUCountry?: "1";
|
|
2363
|
+
/**
|
|
2364
|
+
* A two-letter code indicating the continent the request originated from.
|
|
2365
|
+
*
|
|
2366
|
+
* @example "AN"
|
|
2367
|
+
*/
|
|
2368
|
+
continent?: ContinentCode;
|
|
2369
|
+
/**
|
|
2370
|
+
* The city the request originated from
|
|
2371
|
+
*
|
|
2372
|
+
* @example "Austin"
|
|
2373
|
+
*/
|
|
2374
|
+
city?: string;
|
|
2375
|
+
/**
|
|
2376
|
+
* Postal code of the incoming request
|
|
2377
|
+
*
|
|
2378
|
+
* @example "78701"
|
|
2379
|
+
*/
|
|
2380
|
+
postalCode?: string;
|
|
2381
|
+
/**
|
|
2382
|
+
* Latitude of the incoming request
|
|
2383
|
+
*
|
|
2384
|
+
* @example "30.27130"
|
|
2385
|
+
*/
|
|
2386
|
+
latitude?: string;
|
|
2387
|
+
/**
|
|
2388
|
+
* Longitude of the incoming request
|
|
2389
|
+
*
|
|
2390
|
+
* @example "-97.74260"
|
|
2391
|
+
*/
|
|
2392
|
+
longitude?: string;
|
|
2393
|
+
/**
|
|
2394
|
+
* Timezone of the incoming request
|
|
2395
|
+
*
|
|
2396
|
+
* @example "America/Chicago"
|
|
2397
|
+
*/
|
|
2398
|
+
timezone?: string;
|
|
2399
|
+
/**
|
|
2400
|
+
* If known, the ISO 3166-2 name for the first level region associated with
|
|
2401
|
+
* the IP address of the incoming request
|
|
2402
|
+
*
|
|
2403
|
+
* @example "Texas"
|
|
2404
|
+
*/
|
|
2405
|
+
region?: string;
|
|
2406
|
+
/**
|
|
2407
|
+
* If known, the ISO 3166-2 code for the first-level region associated with
|
|
2408
|
+
* the IP address of the incoming request
|
|
2409
|
+
*
|
|
2410
|
+
* @example "TX"
|
|
2411
|
+
*/
|
|
2412
|
+
regionCode?: string;
|
|
2413
|
+
/**
|
|
2414
|
+
* Metro code (DMA) of the incoming request
|
|
2415
|
+
*
|
|
2416
|
+
* @example "635"
|
|
2417
|
+
*/
|
|
2418
|
+
metroCode?: string;
|
|
2419
|
+
}
|
|
2310
2420
|
/** Data about the incoming request's TLS certificate */
|
|
2311
2421
|
export interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2312
2422
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2699,6 +2809,9 @@ export type Iso3166Alpha2Code =
|
|
|
2699
2809
|
| "ZW";
|
|
2700
2810
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2701
2811
|
export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2812
|
+
export type CfProperties<HostMetadata = unknown> =
|
|
2813
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2814
|
+
| RequestInitCfProperties;
|
|
2702
2815
|
export interface D1Result<T = unknown> {
|
|
2703
2816
|
results?: T[];
|
|
2704
2817
|
success: boolean;
|
|
@@ -2719,9 +2832,9 @@ export declare abstract class D1PreparedStatement {
|
|
|
2719
2832
|
raw<T = unknown>(): Promise<T[]>;
|
|
2720
2833
|
}
|
|
2721
2834
|
/**
|
|
2722
|
-
*
|
|
2835
|
+
* An email message that can be sent from a Worker.
|
|
2723
2836
|
*/
|
|
2724
|
-
export interface EmailMessage
|
|
2837
|
+
export interface EmailMessage {
|
|
2725
2838
|
/**
|
|
2726
2839
|
* Envelope From attribute of the email message.
|
|
2727
2840
|
*/
|
|
@@ -2730,14 +2843,19 @@ export interface EmailMessage<Body = unknown> {
|
|
|
2730
2843
|
* Envelope To attribute of the email message.
|
|
2731
2844
|
*/
|
|
2732
2845
|
readonly to: string;
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2846
|
+
}
|
|
2847
|
+
/**
|
|
2848
|
+
* An email message that is sent to a consumer Worker and can be rejected/forwarded.
|
|
2849
|
+
*/
|
|
2850
|
+
export interface ForwardableEmailMessage extends EmailMessage {
|
|
2737
2851
|
/**
|
|
2738
2852
|
* Stream of the email message content.
|
|
2739
2853
|
*/
|
|
2740
2854
|
readonly raw: ReadableStream;
|
|
2855
|
+
/**
|
|
2856
|
+
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2857
|
+
*/
|
|
2858
|
+
readonly headers: Headers;
|
|
2741
2859
|
/**
|
|
2742
2860
|
* Size of the email message content.
|
|
2743
2861
|
*/
|
|
@@ -2756,11 +2874,17 @@ export interface EmailMessage<Body = unknown> {
|
|
|
2756
2874
|
*/
|
|
2757
2875
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2758
2876
|
}
|
|
2877
|
+
/**
|
|
2878
|
+
* A binding that allows a Worker to send email messages.
|
|
2879
|
+
*/
|
|
2880
|
+
export interface SendEmail {
|
|
2881
|
+
send(message: EmailMessage): Promise<void>;
|
|
2882
|
+
}
|
|
2759
2883
|
export declare abstract class EmailEvent extends ExtendableEvent {
|
|
2760
|
-
readonly message:
|
|
2884
|
+
readonly message: ForwardableEmailMessage;
|
|
2761
2885
|
}
|
|
2762
2886
|
export type EmailExportedHandler<Env = unknown> = (
|
|
2763
|
-
message:
|
|
2887
|
+
message: ForwardableEmailMessage,
|
|
2764
2888
|
env: Env,
|
|
2765
2889
|
ctx: ExecutionContext
|
|
2766
2890
|
) => void | Promise<void>;
|
|
@@ -2841,75 +2965,12 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2841
2965
|
// Key Identifier of the JWK
|
|
2842
2966
|
readonly kid: string;
|
|
2843
2967
|
}
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
*/
|
|
2847
|
-
export interface Message<Body = unknown> {
|
|
2848
|
-
/**
|
|
2849
|
-
* A unique, system-generated ID for the message.
|
|
2850
|
-
*/
|
|
2851
|
-
readonly id: string;
|
|
2852
|
-
/**
|
|
2853
|
-
* A timestamp when the message was sent.
|
|
2854
|
-
*/
|
|
2855
|
-
readonly timestamp: Date;
|
|
2856
|
-
/**
|
|
2857
|
-
* The body of the message.
|
|
2858
|
-
*/
|
|
2859
|
-
readonly body: Body;
|
|
2860
|
-
/**
|
|
2861
|
-
* Marks message to be retried.
|
|
2862
|
-
*/
|
|
2863
|
-
retry(): void;
|
|
2864
|
-
/**
|
|
2865
|
-
* Marks message acknowledged.
|
|
2866
|
-
*/
|
|
2867
|
-
ack(): void;
|
|
2868
|
-
}
|
|
2869
|
-
/**
|
|
2870
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2871
|
-
*/
|
|
2872
|
-
export interface MessageBatch<Body = unknown> {
|
|
2873
|
-
/**
|
|
2874
|
-
* The name of the Queue that belongs to this batch.
|
|
2875
|
-
*/
|
|
2876
|
-
readonly queue: string;
|
|
2877
|
-
/**
|
|
2878
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2879
|
-
*/
|
|
2880
|
-
readonly messages: readonly Message<Body>[];
|
|
2881
|
-
/**
|
|
2882
|
-
* Marks every message to be retried in the next batch.
|
|
2883
|
-
*/
|
|
2884
|
-
retryAll(): void;
|
|
2885
|
-
/**
|
|
2886
|
-
* Marks every message acknowledged in the batch.
|
|
2887
|
-
*/
|
|
2888
|
-
ackAll(): void;
|
|
2889
|
-
}
|
|
2890
|
-
/**
|
|
2891
|
-
* A wrapper class used to structure message batches.
|
|
2892
|
-
*/
|
|
2893
|
-
export type MessageSendRequest<Body = unknown> = {
|
|
2968
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
2969
|
+
export interface DispatchNamespace {
|
|
2894
2970
|
/**
|
|
2895
|
-
*
|
|
2971
|
+
* @param name Name of the Worker script.
|
|
2972
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
2973
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2896
2974
|
*/
|
|
2897
|
-
|
|
2898
|
-
};
|
|
2899
|
-
/**
|
|
2900
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
2901
|
-
*/
|
|
2902
|
-
export interface Queue<Body = any> {
|
|
2903
|
-
/**
|
|
2904
|
-
* Sends a message to the Queue.
|
|
2905
|
-
* @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.
|
|
2906
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2907
|
-
*/
|
|
2908
|
-
send(message: Body): Promise<void>;
|
|
2909
|
-
/**
|
|
2910
|
-
* Sends a batch of messages to the Queue.
|
|
2911
|
-
* @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.
|
|
2912
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2913
|
-
*/
|
|
2914
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2975
|
+
get(name: string): Fetcher;
|
|
2915
2976
|
}
|