@cloudflare/workers-types 0.20230307.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 +244 -188
- package/2021-11-03/index.ts +237 -188
- package/2022-01-31/index.d.ts +244 -188
- package/2022-01-31/index.ts +237 -188
- package/2022-03-21/index.d.ts +244 -188
- package/2022-03-21/index.ts +237 -188
- package/2022-08-04/index.d.ts +244 -188
- package/2022-08-04/index.ts +237 -188
- package/2022-10-31/index.d.ts +245 -188
- package/2022-10-31/index.ts +238 -188
- package/2022-11-30/index.d.ts +245 -188
- package/2022-11-30/index.ts +238 -188
- package/README.md +1 -1
- package/experimental/index.d.ts +298 -188
- package/experimental/index.ts +291 -188
- package/index.d.ts +244 -188
- package/index.ts +237 -188
- package/oldest/index.d.ts +244 -188
- package/oldest/index.ts +237 -188
- package/package.json +1 -1
package/2022-08-04/index.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ declare class DOMException extends Error {
|
|
|
49
49
|
declare type WorkerGlobalScopeEventMap = {
|
|
50
50
|
fetch: FetchEvent;
|
|
51
51
|
scheduled: ScheduledEvent;
|
|
52
|
+
queue: QueueEvent;
|
|
52
53
|
unhandledrejection: PromiseRejectionEvent;
|
|
53
54
|
rejectionhandled: PromiseRejectionEvent;
|
|
54
55
|
};
|
|
@@ -287,8 +288,11 @@ declare interface ExecutionContext {
|
|
|
287
288
|
waitUntil(promise: Promise<any>): void;
|
|
288
289
|
passThroughOnException(): void;
|
|
289
290
|
}
|
|
290
|
-
declare type ExportedHandlerFetchHandler<
|
|
291
|
-
|
|
291
|
+
declare type ExportedHandlerFetchHandler<
|
|
292
|
+
Env = unknown,
|
|
293
|
+
CfHostMetadata = unknown
|
|
294
|
+
> = (
|
|
295
|
+
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
292
296
|
env: Env,
|
|
293
297
|
ctx: ExecutionContext
|
|
294
298
|
) => Response | Promise<Response>;
|
|
@@ -312,12 +316,16 @@ declare type ExportedHandlerTestHandler<Env = unknown> = (
|
|
|
312
316
|
env: Env,
|
|
313
317
|
ctx: ExecutionContext
|
|
314
318
|
) => void | Promise<void>;
|
|
315
|
-
declare interface ExportedHandler<
|
|
316
|
-
|
|
319
|
+
declare interface ExportedHandler<
|
|
320
|
+
Env = unknown,
|
|
321
|
+
QueueMessage = unknown,
|
|
322
|
+
CfHostMetadata = unknown
|
|
323
|
+
> {
|
|
324
|
+
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
317
325
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
318
326
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
319
327
|
test?: ExportedHandlerTestHandler<Env>;
|
|
320
|
-
queue?: ExportedHandlerQueueHandler<Env,
|
|
328
|
+
queue?: ExportedHandlerQueueHandler<Env, Message>;
|
|
321
329
|
}
|
|
322
330
|
declare interface StructuredSerializeOptions {
|
|
323
331
|
transfer?: any[];
|
|
@@ -352,13 +360,24 @@ declare interface DurableObjectNamespace {
|
|
|
352
360
|
id: DurableObjectId,
|
|
353
361
|
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
354
362
|
): DurableObjectStub;
|
|
355
|
-
jurisdiction(jurisdiction:
|
|
363
|
+
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
|
|
356
364
|
}
|
|
365
|
+
declare type DurableObjectJurisdiction = "eu" | "fedramp";
|
|
357
366
|
declare interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
358
|
-
jurisdiction?:
|
|
359
|
-
}
|
|
367
|
+
jurisdiction?: DurableObjectJurisdiction;
|
|
368
|
+
}
|
|
369
|
+
declare type DurableObjectLocationHint =
|
|
370
|
+
| "wnam"
|
|
371
|
+
| "enam"
|
|
372
|
+
| "sam"
|
|
373
|
+
| "weur"
|
|
374
|
+
| "eeur"
|
|
375
|
+
| "apac"
|
|
376
|
+
| "oc"
|
|
377
|
+
| "afr"
|
|
378
|
+
| "me";
|
|
360
379
|
declare interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
361
|
-
locationHint?:
|
|
380
|
+
locationHint?: DurableObjectLocationHint;
|
|
362
381
|
}
|
|
363
382
|
declare interface DurableObjectState {
|
|
364
383
|
waitUntil(promise: Promise<any>): void;
|
|
@@ -988,23 +1007,27 @@ declare interface ResponseInit {
|
|
|
988
1007
|
webSocket?: WebSocket | null;
|
|
989
1008
|
encodeBody?: "automatic" | "manual";
|
|
990
1009
|
}
|
|
991
|
-
declare type RequestInfo
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
1010
|
+
declare type RequestInfo<
|
|
1011
|
+
CfHostMetadata = unknown,
|
|
1012
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1013
|
+
> = Request<CfHostMetadata, Cf> | string | URL;
|
|
1014
|
+
declare class Request<
|
|
1015
|
+
CfHostMetadata = unknown,
|
|
1016
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1017
|
+
> extends Body {
|
|
1018
|
+
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1019
|
+
clone(): Request<CfHostMetadata, Cf>;
|
|
995
1020
|
get method(): string;
|
|
996
1021
|
get url(): string;
|
|
997
1022
|
get headers(): Headers;
|
|
998
1023
|
get redirect(): string;
|
|
999
1024
|
get fetcher(): Fetcher | null;
|
|
1000
1025
|
get signal(): AbortSignal;
|
|
1001
|
-
get cf():
|
|
1026
|
+
get cf(): Cf | undefined;
|
|
1002
1027
|
get integrity(): string;
|
|
1003
1028
|
get keepalive(): boolean;
|
|
1004
1029
|
}
|
|
1005
|
-
declare interface RequestInit<
|
|
1006
|
-
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
1007
|
-
> {
|
|
1030
|
+
declare interface RequestInit<Cf = CfProperties> {
|
|
1008
1031
|
/** A string to set request's method. */
|
|
1009
1032
|
method?: string;
|
|
1010
1033
|
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
@@ -1014,17 +1037,14 @@ declare interface RequestInit<
|
|
|
1014
1037
|
/** 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. */
|
|
1015
1038
|
redirect?: string;
|
|
1016
1039
|
fetcher?: Fetcher | null;
|
|
1017
|
-
cf?:
|
|
1040
|
+
cf?: Cf;
|
|
1018
1041
|
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1019
1042
|
integrity?: string;
|
|
1020
1043
|
/** An AbortSignal to set request's signal. */
|
|
1021
1044
|
signal?: AbortSignal | null;
|
|
1022
1045
|
}
|
|
1023
1046
|
declare abstract class Fetcher {
|
|
1024
|
-
fetch(
|
|
1025
|
-
input: RequestInfo,
|
|
1026
|
-
init?: RequestInit<RequestInitCfProperties>
|
|
1027
|
-
): Promise<Response>;
|
|
1047
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1028
1048
|
}
|
|
1029
1049
|
declare interface FetcherPutOptions {
|
|
1030
1050
|
expiration?: number;
|
|
@@ -1137,6 +1157,33 @@ declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1137
1157
|
value: Value | null;
|
|
1138
1158
|
metadata: Metadata | null;
|
|
1139
1159
|
}
|
|
1160
|
+
declare interface Queue<Body> {
|
|
1161
|
+
send(message: Body): Promise<void>;
|
|
1162
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1163
|
+
}
|
|
1164
|
+
declare interface QueueSendOptions {}
|
|
1165
|
+
declare interface MessageSendRequest<Body = unknown> {
|
|
1166
|
+
body: Body;
|
|
1167
|
+
}
|
|
1168
|
+
declare interface Message<Body = unknown> {
|
|
1169
|
+
readonly id: string;
|
|
1170
|
+
readonly timestamp: Date;
|
|
1171
|
+
readonly body: Body;
|
|
1172
|
+
retry(): void;
|
|
1173
|
+
ack(): void;
|
|
1174
|
+
}
|
|
1175
|
+
declare interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1176
|
+
readonly messages: readonly Message<Body>[];
|
|
1177
|
+
readonly queue: string;
|
|
1178
|
+
retryAll(): void;
|
|
1179
|
+
ackAll(): void;
|
|
1180
|
+
}
|
|
1181
|
+
declare interface MessageBatch<Body = unknown> {
|
|
1182
|
+
readonly messages: readonly Message<Body>[];
|
|
1183
|
+
readonly queue: string;
|
|
1184
|
+
retryAll(): void;
|
|
1185
|
+
ackAll(): void;
|
|
1186
|
+
}
|
|
1140
1187
|
declare interface R2Error extends Error {
|
|
1141
1188
|
readonly name: string;
|
|
1142
1189
|
readonly code: number;
|
|
@@ -1288,12 +1335,18 @@ declare interface R2HTTPMetadata {
|
|
|
1288
1335
|
cacheControl?: string;
|
|
1289
1336
|
cacheExpiry?: Date;
|
|
1290
1337
|
}
|
|
1291
|
-
declare
|
|
1338
|
+
declare type R2Objects = {
|
|
1292
1339
|
objects: R2Object[];
|
|
1293
|
-
truncated: boolean;
|
|
1294
|
-
cursor?: string;
|
|
1295
1340
|
delimitedPrefixes: string[];
|
|
1296
|
-
}
|
|
1341
|
+
} & (
|
|
1342
|
+
| {
|
|
1343
|
+
truncated: true;
|
|
1344
|
+
cursor: string;
|
|
1345
|
+
}
|
|
1346
|
+
| {
|
|
1347
|
+
truncated: false;
|
|
1348
|
+
}
|
|
1349
|
+
);
|
|
1297
1350
|
declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1298
1351
|
readonly scheduledTime: number;
|
|
1299
1352
|
readonly cron: string;
|
|
@@ -1504,13 +1557,19 @@ declare class TransformStream<I = any, O = any> {
|
|
|
1504
1557
|
get writable(): WritableStream<I>;
|
|
1505
1558
|
}
|
|
1506
1559
|
declare class FixedLengthStream extends IdentityTransformStream {
|
|
1507
|
-
constructor(
|
|
1560
|
+
constructor(
|
|
1561
|
+
expectedLength: number | bigint,
|
|
1562
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy
|
|
1563
|
+
);
|
|
1508
1564
|
}
|
|
1509
1565
|
declare class IdentityTransformStream extends TransformStream<
|
|
1510
1566
|
ArrayBuffer | ArrayBufferView,
|
|
1511
1567
|
Uint8Array
|
|
1512
1568
|
> {
|
|
1513
|
-
constructor();
|
|
1569
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
1570
|
+
}
|
|
1571
|
+
declare interface IdentityTransformStreamQueuingStrategy {
|
|
1572
|
+
highWaterMark?: number | bigint;
|
|
1514
1573
|
}
|
|
1515
1574
|
declare interface ReadableStreamValuesOptions {
|
|
1516
1575
|
preventCancel?: boolean;
|
|
@@ -1863,7 +1922,7 @@ declare interface BasicImageTransformationsGravityCoordinates {
|
|
|
1863
1922
|
* Note: Currently, these properties cannot be tested in the
|
|
1864
1923
|
* playground.
|
|
1865
1924
|
*/
|
|
1866
|
-
declare interface RequestInitCfProperties {
|
|
1925
|
+
declare interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1867
1926
|
cacheEverything?: boolean;
|
|
1868
1927
|
/**
|
|
1869
1928
|
* A request's cache key is what determines if two requests are
|
|
@@ -2033,6 +2092,49 @@ declare interface RequestInitCfPropertiesImage
|
|
|
2033
2092
|
* the origin.
|
|
2034
2093
|
*/
|
|
2035
2094
|
"origin-auth"?: "share-publicly";
|
|
2095
|
+
/**
|
|
2096
|
+
* Adds a border around the image. The border is added after resizing. Border
|
|
2097
|
+
* width takes dpr into account, and can be specified either using a single
|
|
2098
|
+
* width property, or individually for each side.
|
|
2099
|
+
*/
|
|
2100
|
+
border?:
|
|
2101
|
+
| {
|
|
2102
|
+
color: string;
|
|
2103
|
+
width: number;
|
|
2104
|
+
}
|
|
2105
|
+
| {
|
|
2106
|
+
color: string;
|
|
2107
|
+
top: number;
|
|
2108
|
+
right: number;
|
|
2109
|
+
bottom: number;
|
|
2110
|
+
left: number;
|
|
2111
|
+
};
|
|
2112
|
+
/**
|
|
2113
|
+
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
2114
|
+
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
2115
|
+
* 0 is ignored.
|
|
2116
|
+
*/
|
|
2117
|
+
brightness?: number;
|
|
2118
|
+
/**
|
|
2119
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
2120
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
2121
|
+
* ignored.
|
|
2122
|
+
*/
|
|
2123
|
+
contrast?: number;
|
|
2124
|
+
/**
|
|
2125
|
+
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
2126
|
+
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
2127
|
+
*/
|
|
2128
|
+
gamma?: number;
|
|
2129
|
+
/**
|
|
2130
|
+
* Slightly reduces latency on a cache miss by selecting a
|
|
2131
|
+
* quickest-to-compress file format, at a cost of increased file size and
|
|
2132
|
+
* lower image quality. It will usually override the format option and choose
|
|
2133
|
+
* JPEG over WebP or AVIF. We do not recommend using this option, except in
|
|
2134
|
+
* unusual circumstances like resizing uncacheable dynamically-generated
|
|
2135
|
+
* images.
|
|
2136
|
+
*/
|
|
2137
|
+
compression?: "fast";
|
|
2036
2138
|
}
|
|
2037
2139
|
declare interface RequestInitCfPropertiesImageMinify {
|
|
2038
2140
|
javascript?: boolean;
|
|
@@ -2048,7 +2150,8 @@ declare type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2048
2150
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2049
2151
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2050
2152
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2051
|
-
declare interface IncomingRequestCfPropertiesBase
|
|
2153
|
+
declare interface IncomingRequestCfPropertiesBase
|
|
2154
|
+
extends Record<string, unknown> {
|
|
2052
2155
|
/**
|
|
2053
2156
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2054
2157
|
*
|
|
@@ -2129,8 +2232,7 @@ declare interface IncomingRequestCfPropertiesBase {
|
|
|
2129
2232
|
declare interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2130
2233
|
/**
|
|
2131
2234
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2132
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2133
|
-
* and `99` (almost certainly a bot).
|
|
2235
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2134
2236
|
*
|
|
2135
2237
|
* @example 54
|
|
2136
2238
|
*/
|
|
@@ -2241,86 +2343,82 @@ declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2241
2343
|
/**
|
|
2242
2344
|
* Geographic data about the request's origin.
|
|
2243
2345
|
*/
|
|
2244
|
-
declare
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
* @example "635"
|
|
2321
|
-
*/
|
|
2322
|
-
metroCode?: string;
|
|
2323
|
-
};
|
|
2346
|
+
declare interface IncomingRequestCfPropertiesGeographicInformation {
|
|
2347
|
+
/**
|
|
2348
|
+
* The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
|
|
2349
|
+
*
|
|
2350
|
+
* 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.
|
|
2351
|
+
*
|
|
2352
|
+
* If Cloudflare is unable to determine where the request originated this property is omitted.
|
|
2353
|
+
*
|
|
2354
|
+
* The country code `"T1"` is used for requests originating on TOR.
|
|
2355
|
+
*
|
|
2356
|
+
* @example "GB"
|
|
2357
|
+
*/
|
|
2358
|
+
country?: Iso3166Alpha2Code | "T1";
|
|
2359
|
+
/**
|
|
2360
|
+
* If present, this property indicates that the request originated in the EU
|
|
2361
|
+
*
|
|
2362
|
+
* @example "1"
|
|
2363
|
+
*/
|
|
2364
|
+
isEUCountry?: "1";
|
|
2365
|
+
/**
|
|
2366
|
+
* A two-letter code indicating the continent the request originated from.
|
|
2367
|
+
*
|
|
2368
|
+
* @example "AN"
|
|
2369
|
+
*/
|
|
2370
|
+
continent?: ContinentCode;
|
|
2371
|
+
/**
|
|
2372
|
+
* The city the request originated from
|
|
2373
|
+
*
|
|
2374
|
+
* @example "Austin"
|
|
2375
|
+
*/
|
|
2376
|
+
city?: string;
|
|
2377
|
+
/**
|
|
2378
|
+
* Postal code of the incoming request
|
|
2379
|
+
*
|
|
2380
|
+
* @example "78701"
|
|
2381
|
+
*/
|
|
2382
|
+
postalCode?: string;
|
|
2383
|
+
/**
|
|
2384
|
+
* Latitude of the incoming request
|
|
2385
|
+
*
|
|
2386
|
+
* @example "30.27130"
|
|
2387
|
+
*/
|
|
2388
|
+
latitude?: string;
|
|
2389
|
+
/**
|
|
2390
|
+
* Longitude of the incoming request
|
|
2391
|
+
*
|
|
2392
|
+
* @example "-97.74260"
|
|
2393
|
+
*/
|
|
2394
|
+
longitude?: string;
|
|
2395
|
+
/**
|
|
2396
|
+
* Timezone of the incoming request
|
|
2397
|
+
*
|
|
2398
|
+
* @example "America/Chicago"
|
|
2399
|
+
*/
|
|
2400
|
+
timezone?: string;
|
|
2401
|
+
/**
|
|
2402
|
+
* If known, the ISO 3166-2 name for the first level region associated with
|
|
2403
|
+
* the IP address of the incoming request
|
|
2404
|
+
*
|
|
2405
|
+
* @example "Texas"
|
|
2406
|
+
*/
|
|
2407
|
+
region?: string;
|
|
2408
|
+
/**
|
|
2409
|
+
* If known, the ISO 3166-2 code for the first-level region associated with
|
|
2410
|
+
* the IP address of the incoming request
|
|
2411
|
+
*
|
|
2412
|
+
* @example "TX"
|
|
2413
|
+
*/
|
|
2414
|
+
regionCode?: string;
|
|
2415
|
+
/**
|
|
2416
|
+
* Metro code (DMA) of the incoming request
|
|
2417
|
+
*
|
|
2418
|
+
* @example "635"
|
|
2419
|
+
*/
|
|
2420
|
+
metroCode?: string;
|
|
2421
|
+
}
|
|
2324
2422
|
/** Data about the incoming request's TLS certificate */
|
|
2325
2423
|
declare interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2326
2424
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2713,6 +2811,9 @@ declare type Iso3166Alpha2Code =
|
|
|
2713
2811
|
| "ZW";
|
|
2714
2812
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2715
2813
|
declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2814
|
+
declare type CfProperties<HostMetadata = unknown> =
|
|
2815
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2816
|
+
| RequestInitCfProperties;
|
|
2716
2817
|
declare interface D1Result<T = unknown> {
|
|
2717
2818
|
results?: T[];
|
|
2718
2819
|
success: boolean;
|
|
@@ -2733,7 +2834,7 @@ declare abstract class D1PreparedStatement {
|
|
|
2733
2834
|
raw<T = unknown>(): Promise<T[]>;
|
|
2734
2835
|
}
|
|
2735
2836
|
/**
|
|
2736
|
-
*
|
|
2837
|
+
* An email message that can be sent from a Worker.
|
|
2737
2838
|
*/
|
|
2738
2839
|
declare interface EmailMessage {
|
|
2739
2840
|
/**
|
|
@@ -2744,14 +2845,19 @@ declare interface EmailMessage {
|
|
|
2744
2845
|
* Envelope To attribute of the email message.
|
|
2745
2846
|
*/
|
|
2746
2847
|
readonly to: string;
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2848
|
+
}
|
|
2849
|
+
/**
|
|
2850
|
+
* An email message that is sent to a consumer Worker and can be rejected/forwarded.
|
|
2851
|
+
*/
|
|
2852
|
+
declare interface ForwardableEmailMessage extends EmailMessage {
|
|
2751
2853
|
/**
|
|
2752
2854
|
* Stream of the email message content.
|
|
2753
2855
|
*/
|
|
2754
2856
|
readonly raw: ReadableStream;
|
|
2857
|
+
/**
|
|
2858
|
+
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2859
|
+
*/
|
|
2860
|
+
readonly headers: Headers;
|
|
2755
2861
|
/**
|
|
2756
2862
|
* Size of the email message content.
|
|
2757
2863
|
*/
|
|
@@ -2770,14 +2876,27 @@ declare interface EmailMessage {
|
|
|
2770
2876
|
*/
|
|
2771
2877
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2772
2878
|
}
|
|
2879
|
+
/**
|
|
2880
|
+
* A binding that allows a Worker to send email messages.
|
|
2881
|
+
*/
|
|
2882
|
+
declare interface SendEmail {
|
|
2883
|
+
send(message: EmailMessage): Promise<void>;
|
|
2884
|
+
}
|
|
2773
2885
|
declare abstract class EmailEvent extends ExtendableEvent {
|
|
2774
|
-
readonly message:
|
|
2886
|
+
readonly message: ForwardableEmailMessage;
|
|
2775
2887
|
}
|
|
2776
2888
|
declare type EmailExportedHandler<Env = unknown> = (
|
|
2777
|
-
message:
|
|
2889
|
+
message: ForwardableEmailMessage,
|
|
2778
2890
|
env: Env,
|
|
2779
2891
|
ctx: ExecutionContext
|
|
2780
2892
|
) => void | Promise<void>;
|
|
2893
|
+
declare module "cloudflare:email" {
|
|
2894
|
+
let _EmailMessage: {
|
|
2895
|
+
prototype: EmailMessage;
|
|
2896
|
+
new (from: string, to: string, raw: ReadableStream | string): EmailMessage;
|
|
2897
|
+
};
|
|
2898
|
+
export { _EmailMessage as EmailMessage };
|
|
2899
|
+
}
|
|
2781
2900
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2782
2901
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2783
2902
|
request: Request;
|
|
@@ -2858,75 +2977,12 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2858
2977
|
// Key Identifier of the JWK
|
|
2859
2978
|
readonly kid: string;
|
|
2860
2979
|
}
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
*/
|
|
2864
|
-
declare interface Message<Body = unknown> {
|
|
2865
|
-
/**
|
|
2866
|
-
* A unique, system-generated ID for the message.
|
|
2867
|
-
*/
|
|
2868
|
-
readonly id: string;
|
|
2869
|
-
/**
|
|
2870
|
-
* A timestamp when the message was sent.
|
|
2871
|
-
*/
|
|
2872
|
-
readonly timestamp: Date;
|
|
2873
|
-
/**
|
|
2874
|
-
* The body of the message.
|
|
2875
|
-
*/
|
|
2876
|
-
readonly body: Body;
|
|
2877
|
-
/**
|
|
2878
|
-
* Marks message to be retried.
|
|
2879
|
-
*/
|
|
2880
|
-
retry(): void;
|
|
2881
|
-
/**
|
|
2882
|
-
* Marks message acknowledged.
|
|
2883
|
-
*/
|
|
2884
|
-
ack(): void;
|
|
2885
|
-
}
|
|
2886
|
-
/**
|
|
2887
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2888
|
-
*/
|
|
2889
|
-
declare interface MessageBatch<Body = unknown> {
|
|
2890
|
-
/**
|
|
2891
|
-
* The name of the Queue that belongs to this batch.
|
|
2892
|
-
*/
|
|
2893
|
-
readonly queue: string;
|
|
2894
|
-
/**
|
|
2895
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2896
|
-
*/
|
|
2897
|
-
readonly messages: readonly Message<Body>[];
|
|
2980
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
2981
|
+
declare interface DispatchNamespace {
|
|
2898
2982
|
/**
|
|
2899
|
-
*
|
|
2983
|
+
* @param name Name of the Worker script.
|
|
2984
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
2985
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2900
2986
|
*/
|
|
2901
|
-
|
|
2902
|
-
/**
|
|
2903
|
-
* Marks every message acknowledged in the batch.
|
|
2904
|
-
*/
|
|
2905
|
-
ackAll(): void;
|
|
2906
|
-
}
|
|
2907
|
-
/**
|
|
2908
|
-
* A wrapper class used to structure message batches.
|
|
2909
|
-
*/
|
|
2910
|
-
declare type MessageSendRequest<Body = unknown> = {
|
|
2911
|
-
/**
|
|
2912
|
-
* The body of the message.
|
|
2913
|
-
*/
|
|
2914
|
-
body: Body;
|
|
2915
|
-
};
|
|
2916
|
-
/**
|
|
2917
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
2918
|
-
*/
|
|
2919
|
-
declare interface Queue<Body = any> {
|
|
2920
|
-
/**
|
|
2921
|
-
* Sends a message to the Queue.
|
|
2922
|
-
* @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.
|
|
2923
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2924
|
-
*/
|
|
2925
|
-
send(message: Body): Promise<void>;
|
|
2926
|
-
/**
|
|
2927
|
-
* Sends a batch of messages to the Queue.
|
|
2928
|
-
* @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.
|
|
2929
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2930
|
-
*/
|
|
2931
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2987
|
+
get(name: string): Fetcher;
|
|
2932
2988
|
}
|