@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-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
|
};
|
|
@@ -289,8 +290,11 @@ export interface ExecutionContext {
|
|
|
289
290
|
waitUntil(promise: Promise<any>): void;
|
|
290
291
|
passThroughOnException(): void;
|
|
291
292
|
}
|
|
292
|
-
export type ExportedHandlerFetchHandler<
|
|
293
|
-
|
|
293
|
+
export type ExportedHandlerFetchHandler<
|
|
294
|
+
Env = unknown,
|
|
295
|
+
CfHostMetadata = unknown
|
|
296
|
+
> = (
|
|
297
|
+
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
294
298
|
env: Env,
|
|
295
299
|
ctx: ExecutionContext
|
|
296
300
|
) => Response | Promise<Response>;
|
|
@@ -314,12 +318,16 @@ export type ExportedHandlerTestHandler<Env = unknown> = (
|
|
|
314
318
|
env: Env,
|
|
315
319
|
ctx: ExecutionContext
|
|
316
320
|
) => void | Promise<void>;
|
|
317
|
-
export interface ExportedHandler<
|
|
318
|
-
|
|
321
|
+
export interface ExportedHandler<
|
|
322
|
+
Env = unknown,
|
|
323
|
+
QueueMessage = unknown,
|
|
324
|
+
CfHostMetadata = unknown
|
|
325
|
+
> {
|
|
326
|
+
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
319
327
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
320
328
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
321
329
|
test?: ExportedHandlerTestHandler<Env>;
|
|
322
|
-
queue?: ExportedHandlerQueueHandler<Env,
|
|
330
|
+
queue?: ExportedHandlerQueueHandler<Env, Message>;
|
|
323
331
|
}
|
|
324
332
|
export interface StructuredSerializeOptions {
|
|
325
333
|
transfer?: any[];
|
|
@@ -354,13 +362,24 @@ export interface DurableObjectNamespace {
|
|
|
354
362
|
id: DurableObjectId,
|
|
355
363
|
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
356
364
|
): DurableObjectStub;
|
|
357
|
-
jurisdiction(jurisdiction:
|
|
365
|
+
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
|
|
358
366
|
}
|
|
367
|
+
export type DurableObjectJurisdiction = "eu" | "fedramp";
|
|
359
368
|
export interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
360
|
-
jurisdiction?:
|
|
361
|
-
}
|
|
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";
|
|
362
381
|
export interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
363
|
-
locationHint?:
|
|
382
|
+
locationHint?: DurableObjectLocationHint;
|
|
364
383
|
}
|
|
365
384
|
export interface DurableObjectState {
|
|
366
385
|
waitUntil(promise: Promise<any>): void;
|
|
@@ -990,23 +1009,27 @@ export interface ResponseInit {
|
|
|
990
1009
|
webSocket?: WebSocket | null;
|
|
991
1010
|
encodeBody?: "automatic" | "manual";
|
|
992
1011
|
}
|
|
993
|
-
export type RequestInfo
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
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>;
|
|
997
1022
|
get method(): string;
|
|
998
1023
|
get url(): string;
|
|
999
1024
|
get headers(): Headers;
|
|
1000
1025
|
get redirect(): string;
|
|
1001
1026
|
get fetcher(): Fetcher | null;
|
|
1002
1027
|
get signal(): AbortSignal;
|
|
1003
|
-
get cf():
|
|
1028
|
+
get cf(): Cf | undefined;
|
|
1004
1029
|
get integrity(): string;
|
|
1005
1030
|
get keepalive(): boolean;
|
|
1006
1031
|
}
|
|
1007
|
-
export interface RequestInit<
|
|
1008
|
-
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
1009
|
-
> {
|
|
1032
|
+
export interface RequestInit<Cf = CfProperties> {
|
|
1010
1033
|
/** A string to set request's method. */
|
|
1011
1034
|
method?: string;
|
|
1012
1035
|
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
@@ -1016,17 +1039,14 @@ export interface RequestInit<
|
|
|
1016
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. */
|
|
1017
1040
|
redirect?: string;
|
|
1018
1041
|
fetcher?: Fetcher | null;
|
|
1019
|
-
cf?:
|
|
1042
|
+
cf?: Cf;
|
|
1020
1043
|
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1021
1044
|
integrity?: string;
|
|
1022
1045
|
/** An AbortSignal to set request's signal. */
|
|
1023
1046
|
signal?: AbortSignal | null;
|
|
1024
1047
|
}
|
|
1025
1048
|
export declare abstract class Fetcher {
|
|
1026
|
-
fetch(
|
|
1027
|
-
input: RequestInfo,
|
|
1028
|
-
init?: RequestInit<RequestInitCfProperties>
|
|
1029
|
-
): Promise<Response>;
|
|
1049
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1030
1050
|
}
|
|
1031
1051
|
export interface FetcherPutOptions {
|
|
1032
1052
|
expiration?: number;
|
|
@@ -1139,6 +1159,33 @@ export interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1139
1159
|
value: Value | null;
|
|
1140
1160
|
metadata: Metadata | null;
|
|
1141
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
|
+
}
|
|
1142
1189
|
export interface R2Error extends Error {
|
|
1143
1190
|
readonly name: string;
|
|
1144
1191
|
readonly code: number;
|
|
@@ -1290,12 +1337,18 @@ export interface R2HTTPMetadata {
|
|
|
1290
1337
|
cacheControl?: string;
|
|
1291
1338
|
cacheExpiry?: Date;
|
|
1292
1339
|
}
|
|
1293
|
-
export
|
|
1340
|
+
export type R2Objects = {
|
|
1294
1341
|
objects: R2Object[];
|
|
1295
|
-
truncated: boolean;
|
|
1296
|
-
cursor?: string;
|
|
1297
1342
|
delimitedPrefixes: string[];
|
|
1298
|
-
}
|
|
1343
|
+
} & (
|
|
1344
|
+
| {
|
|
1345
|
+
truncated: true;
|
|
1346
|
+
cursor: string;
|
|
1347
|
+
}
|
|
1348
|
+
| {
|
|
1349
|
+
truncated: false;
|
|
1350
|
+
}
|
|
1351
|
+
);
|
|
1299
1352
|
export declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1300
1353
|
readonly scheduledTime: number;
|
|
1301
1354
|
readonly cron: string;
|
|
@@ -1506,13 +1559,19 @@ export declare class TransformStream<I = any, O = any> {
|
|
|
1506
1559
|
get writable(): WritableStream<I>;
|
|
1507
1560
|
}
|
|
1508
1561
|
export declare class FixedLengthStream extends IdentityTransformStream {
|
|
1509
|
-
constructor(
|
|
1562
|
+
constructor(
|
|
1563
|
+
expectedLength: number | bigint,
|
|
1564
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy
|
|
1565
|
+
);
|
|
1510
1566
|
}
|
|
1511
1567
|
export declare class IdentityTransformStream extends TransformStream<
|
|
1512
1568
|
ArrayBuffer | ArrayBufferView,
|
|
1513
1569
|
Uint8Array
|
|
1514
1570
|
> {
|
|
1515
|
-
constructor();
|
|
1571
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
1572
|
+
}
|
|
1573
|
+
export interface IdentityTransformStreamQueuingStrategy {
|
|
1574
|
+
highWaterMark?: number | bigint;
|
|
1516
1575
|
}
|
|
1517
1576
|
export interface ReadableStreamValuesOptions {
|
|
1518
1577
|
preventCancel?: boolean;
|
|
@@ -1660,6 +1719,7 @@ export declare class URL {
|
|
|
1660
1719
|
get searchParams(): URLSearchParams;
|
|
1661
1720
|
toJSON(): string;
|
|
1662
1721
|
toString(): string;
|
|
1722
|
+
static canParse(url: string, base?: string): boolean;
|
|
1663
1723
|
}
|
|
1664
1724
|
export declare class URLSearchParams {
|
|
1665
1725
|
constructor(
|
|
@@ -1864,7 +1924,7 @@ export interface BasicImageTransformationsGravityCoordinates {
|
|
|
1864
1924
|
* Note: Currently, these properties cannot be tested in the
|
|
1865
1925
|
* playground.
|
|
1866
1926
|
*/
|
|
1867
|
-
export interface RequestInitCfProperties {
|
|
1927
|
+
export interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1868
1928
|
cacheEverything?: boolean;
|
|
1869
1929
|
/**
|
|
1870
1930
|
* A request's cache key is what determines if two requests are
|
|
@@ -2034,6 +2094,49 @@ export interface RequestInitCfPropertiesImage
|
|
|
2034
2094
|
* the origin.
|
|
2035
2095
|
*/
|
|
2036
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";
|
|
2037
2140
|
}
|
|
2038
2141
|
export interface RequestInitCfPropertiesImageMinify {
|
|
2039
2142
|
javascript?: boolean;
|
|
@@ -2049,7 +2152,8 @@ export type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2049
2152
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2050
2153
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2051
2154
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2052
|
-
export interface IncomingRequestCfPropertiesBase
|
|
2155
|
+
export interface IncomingRequestCfPropertiesBase
|
|
2156
|
+
extends Record<string, unknown> {
|
|
2053
2157
|
/**
|
|
2054
2158
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2055
2159
|
*
|
|
@@ -2130,8 +2234,7 @@ export interface IncomingRequestCfPropertiesBase {
|
|
|
2130
2234
|
export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2131
2235
|
/**
|
|
2132
2236
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2133
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2134
|
-
* and `99` (almost certainly a bot).
|
|
2237
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2135
2238
|
*
|
|
2136
2239
|
* @example 54
|
|
2137
2240
|
*/
|
|
@@ -2242,86 +2345,82 @@ export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2242
2345
|
/**
|
|
2243
2346
|
* Geographic data about the request's origin.
|
|
2244
2347
|
*/
|
|
2245
|
-
export
|
|
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
|
-
|
|
2321
|
-
* @example "635"
|
|
2322
|
-
*/
|
|
2323
|
-
metroCode?: string;
|
|
2324
|
-
};
|
|
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
|
+
}
|
|
2325
2424
|
/** Data about the incoming request's TLS certificate */
|
|
2326
2425
|
export interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2327
2426
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2714,6 +2813,9 @@ export type Iso3166Alpha2Code =
|
|
|
2714
2813
|
| "ZW";
|
|
2715
2814
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2716
2815
|
export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2816
|
+
export type CfProperties<HostMetadata = unknown> =
|
|
2817
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2818
|
+
| RequestInitCfProperties;
|
|
2717
2819
|
export interface D1Result<T = unknown> {
|
|
2718
2820
|
results?: T[];
|
|
2719
2821
|
success: boolean;
|
|
@@ -2734,7 +2836,7 @@ export declare abstract class D1PreparedStatement {
|
|
|
2734
2836
|
raw<T = unknown>(): Promise<T[]>;
|
|
2735
2837
|
}
|
|
2736
2838
|
/**
|
|
2737
|
-
*
|
|
2839
|
+
* An email message that can be sent from a Worker.
|
|
2738
2840
|
*/
|
|
2739
2841
|
export interface EmailMessage {
|
|
2740
2842
|
/**
|
|
@@ -2745,14 +2847,19 @@ export interface EmailMessage {
|
|
|
2745
2847
|
* Envelope To attribute of the email message.
|
|
2746
2848
|
*/
|
|
2747
2849
|
readonly to: string;
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
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 {
|
|
2752
2855
|
/**
|
|
2753
2856
|
* Stream of the email message content.
|
|
2754
2857
|
*/
|
|
2755
2858
|
readonly raw: ReadableStream;
|
|
2859
|
+
/**
|
|
2860
|
+
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2861
|
+
*/
|
|
2862
|
+
readonly headers: Headers;
|
|
2756
2863
|
/**
|
|
2757
2864
|
* Size of the email message content.
|
|
2758
2865
|
*/
|
|
@@ -2771,11 +2878,17 @@ export interface EmailMessage {
|
|
|
2771
2878
|
*/
|
|
2772
2879
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2773
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
|
+
}
|
|
2774
2887
|
export declare abstract class EmailEvent extends ExtendableEvent {
|
|
2775
|
-
readonly message:
|
|
2888
|
+
readonly message: ForwardableEmailMessage;
|
|
2776
2889
|
}
|
|
2777
2890
|
export type EmailExportedHandler<Env = unknown> = (
|
|
2778
|
-
message:
|
|
2891
|
+
message: ForwardableEmailMessage,
|
|
2779
2892
|
env: Env,
|
|
2780
2893
|
ctx: ExecutionContext
|
|
2781
2894
|
) => void | Promise<void>;
|
|
@@ -2856,75 +2969,12 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2856
2969
|
// Key Identifier of the JWK
|
|
2857
2970
|
readonly kid: string;
|
|
2858
2971
|
}
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
*/
|
|
2862
|
-
export interface Message<Body = unknown> {
|
|
2863
|
-
/**
|
|
2864
|
-
* A unique, system-generated ID for the message.
|
|
2865
|
-
*/
|
|
2866
|
-
readonly id: string;
|
|
2867
|
-
/**
|
|
2868
|
-
* A timestamp when the message was sent.
|
|
2869
|
-
*/
|
|
2870
|
-
readonly timestamp: Date;
|
|
2972
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
2973
|
+
export interface DispatchNamespace {
|
|
2871
2974
|
/**
|
|
2872
|
-
*
|
|
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.
|
|
2873
2978
|
*/
|
|
2874
|
-
|
|
2875
|
-
/**
|
|
2876
|
-
* Marks message to be retried.
|
|
2877
|
-
*/
|
|
2878
|
-
retry(): void;
|
|
2879
|
-
/**
|
|
2880
|
-
* Marks message acknowledged.
|
|
2881
|
-
*/
|
|
2882
|
-
ack(): void;
|
|
2883
|
-
}
|
|
2884
|
-
/**
|
|
2885
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2886
|
-
*/
|
|
2887
|
-
export interface MessageBatch<Body = unknown> {
|
|
2888
|
-
/**
|
|
2889
|
-
* The name of the Queue that belongs to this batch.
|
|
2890
|
-
*/
|
|
2891
|
-
readonly queue: string;
|
|
2892
|
-
/**
|
|
2893
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2894
|
-
*/
|
|
2895
|
-
readonly messages: readonly Message<Body>[];
|
|
2896
|
-
/**
|
|
2897
|
-
* Marks every message to be retried in the next batch.
|
|
2898
|
-
*/
|
|
2899
|
-
retryAll(): void;
|
|
2900
|
-
/**
|
|
2901
|
-
* Marks every message acknowledged in the batch.
|
|
2902
|
-
*/
|
|
2903
|
-
ackAll(): void;
|
|
2904
|
-
}
|
|
2905
|
-
/**
|
|
2906
|
-
* A wrapper class used to structure message batches.
|
|
2907
|
-
*/
|
|
2908
|
-
export type MessageSendRequest<Body = unknown> = {
|
|
2909
|
-
/**
|
|
2910
|
-
* The body of the message.
|
|
2911
|
-
*/
|
|
2912
|
-
body: Body;
|
|
2913
|
-
};
|
|
2914
|
-
/**
|
|
2915
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
2916
|
-
*/
|
|
2917
|
-
export interface Queue<Body = any> {
|
|
2918
|
-
/**
|
|
2919
|
-
* Sends a message to the Queue.
|
|
2920
|
-
* @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.
|
|
2921
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2922
|
-
*/
|
|
2923
|
-
send(message: Body): Promise<void>;
|
|
2924
|
-
/**
|
|
2925
|
-
* Sends a batch of messages to the Queue.
|
|
2926
|
-
* @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.
|
|
2927
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2928
|
-
*/
|
|
2929
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2979
|
+
get(name: string): Fetcher;
|
|
2930
2980
|
}
|