@cloudflare/workers-types 4.20230307.0 → 4.20230321.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 +151 -100
- package/2021-11-03/index.ts +151 -100
- package/2022-01-31/index.d.ts +151 -100
- package/2022-01-31/index.ts +151 -100
- package/2022-03-21/index.d.ts +151 -100
- package/2022-03-21/index.ts +151 -100
- package/2022-08-04/index.d.ts +151 -100
- package/2022-08-04/index.ts +151 -100
- package/2022-10-31/index.d.ts +152 -100
- package/2022-10-31/index.ts +152 -100
- package/2022-11-30/index.d.ts +152 -100
- package/2022-11-30/index.ts +152 -100
- package/experimental/index.d.ts +152 -100
- package/experimental/index.ts +152 -100
- package/index.d.ts +151 -100
- package/index.ts +151 -100
- package/oldest/index.d.ts +151 -100
- package/oldest/index.ts +151 -100
- package/package.json +1 -1
package/2021-11-03/index.d.ts
CHANGED
|
@@ -284,8 +284,11 @@ declare interface ExecutionContext {
|
|
|
284
284
|
waitUntil(promise: Promise<any>): void;
|
|
285
285
|
passThroughOnException(): void;
|
|
286
286
|
}
|
|
287
|
-
declare type ExportedHandlerFetchHandler<
|
|
288
|
-
|
|
287
|
+
declare type ExportedHandlerFetchHandler<
|
|
288
|
+
Env = unknown,
|
|
289
|
+
CfHostMetadata = unknown
|
|
290
|
+
> = (
|
|
291
|
+
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
289
292
|
env: Env,
|
|
290
293
|
ctx: ExecutionContext
|
|
291
294
|
) => Response | Promise<Response>;
|
|
@@ -309,8 +312,12 @@ declare type ExportedHandlerTestHandler<Env = unknown> = (
|
|
|
309
312
|
env: Env,
|
|
310
313
|
ctx: ExecutionContext
|
|
311
314
|
) => void | Promise<void>;
|
|
312
|
-
declare interface ExportedHandler<
|
|
313
|
-
|
|
315
|
+
declare interface ExportedHandler<
|
|
316
|
+
Env = unknown,
|
|
317
|
+
QueueMessage = unknown,
|
|
318
|
+
CfHostMetadata = unknown
|
|
319
|
+
> {
|
|
320
|
+
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
314
321
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
315
322
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
316
323
|
test?: ExportedHandlerTestHandler<Env>;
|
|
@@ -995,10 +1002,16 @@ declare interface ResponseInit {
|
|
|
995
1002
|
webSocket?: WebSocket | null;
|
|
996
1003
|
encodeBody?: "automatic" | "manual";
|
|
997
1004
|
}
|
|
998
|
-
declare type RequestInfo
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1005
|
+
declare type RequestInfo<
|
|
1006
|
+
CfHostMetadata = unknown,
|
|
1007
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1008
|
+
> = Request<CfHostMetadata, Cf> | string | URL;
|
|
1009
|
+
declare class Request<
|
|
1010
|
+
CfHostMetadata = unknown,
|
|
1011
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1012
|
+
> extends Body {
|
|
1013
|
+
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1014
|
+
clone(): Request<CfHostMetadata, Cf>;
|
|
1002
1015
|
/** Returns request's HTTP method, which is "GET" by default. */
|
|
1003
1016
|
readonly method: string;
|
|
1004
1017
|
/** Returns the URL of request as a string. */
|
|
@@ -1010,15 +1023,13 @@ declare class Request<CfHostMetadata = unknown> extends Body {
|
|
|
1010
1023
|
readonly fetcher: Fetcher | null;
|
|
1011
1024
|
/** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. */
|
|
1012
1025
|
readonly signal: AbortSignal;
|
|
1013
|
-
readonly cf?:
|
|
1026
|
+
readonly cf?: Cf;
|
|
1014
1027
|
/** Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI] */
|
|
1015
1028
|
readonly integrity: string;
|
|
1016
1029
|
/** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
|
|
1017
1030
|
readonly keepalive: boolean;
|
|
1018
1031
|
}
|
|
1019
|
-
declare interface RequestInit<
|
|
1020
|
-
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
1021
|
-
> {
|
|
1032
|
+
declare interface RequestInit<Cf = CfProperties> {
|
|
1022
1033
|
/** A string to set request's method. */
|
|
1023
1034
|
method?: string;
|
|
1024
1035
|
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
@@ -1028,17 +1039,14 @@ declare interface RequestInit<
|
|
|
1028
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. */
|
|
1029
1040
|
redirect?: string;
|
|
1030
1041
|
fetcher?: Fetcher | null;
|
|
1031
|
-
cf?:
|
|
1042
|
+
cf?: Cf;
|
|
1032
1043
|
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1033
1044
|
integrity?: string;
|
|
1034
1045
|
/** An AbortSignal to set request's signal. */
|
|
1035
1046
|
signal?: AbortSignal | null;
|
|
1036
1047
|
}
|
|
1037
1048
|
declare abstract class Fetcher {
|
|
1038
|
-
fetch(
|
|
1039
|
-
input: RequestInfo,
|
|
1040
|
-
init?: RequestInit<RequestInitCfProperties>
|
|
1041
|
-
): Promise<Response>;
|
|
1049
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1042
1050
|
}
|
|
1043
1051
|
declare interface FetcherPutOptions {
|
|
1044
1052
|
expiration?: number;
|
|
@@ -1870,7 +1878,7 @@ declare interface BasicImageTransformationsGravityCoordinates {
|
|
|
1870
1878
|
* Note: Currently, these properties cannot be tested in the
|
|
1871
1879
|
* playground.
|
|
1872
1880
|
*/
|
|
1873
|
-
declare interface RequestInitCfProperties {
|
|
1881
|
+
declare interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1874
1882
|
cacheEverything?: boolean;
|
|
1875
1883
|
/**
|
|
1876
1884
|
* A request's cache key is what determines if two requests are
|
|
@@ -2040,6 +2048,49 @@ declare interface RequestInitCfPropertiesImage
|
|
|
2040
2048
|
* the origin.
|
|
2041
2049
|
*/
|
|
2042
2050
|
"origin-auth"?: "share-publicly";
|
|
2051
|
+
/**
|
|
2052
|
+
* Adds a border around the image. The border is added after resizing. Border
|
|
2053
|
+
* width takes dpr into account, and can be specified either using a single
|
|
2054
|
+
* width property, or individually for each side.
|
|
2055
|
+
*/
|
|
2056
|
+
border?:
|
|
2057
|
+
| {
|
|
2058
|
+
color: string;
|
|
2059
|
+
width: number;
|
|
2060
|
+
}
|
|
2061
|
+
| {
|
|
2062
|
+
color: string;
|
|
2063
|
+
top: number;
|
|
2064
|
+
right: number;
|
|
2065
|
+
bottom: number;
|
|
2066
|
+
left: number;
|
|
2067
|
+
};
|
|
2068
|
+
/**
|
|
2069
|
+
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
2070
|
+
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
2071
|
+
* 0 is ignored.
|
|
2072
|
+
*/
|
|
2073
|
+
brightness?: number;
|
|
2074
|
+
/**
|
|
2075
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
2076
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
2077
|
+
* ignored.
|
|
2078
|
+
*/
|
|
2079
|
+
contrast?: number;
|
|
2080
|
+
/**
|
|
2081
|
+
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
2082
|
+
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
2083
|
+
*/
|
|
2084
|
+
gamma?: number;
|
|
2085
|
+
/**
|
|
2086
|
+
* Slightly reduces latency on a cache miss by selecting a
|
|
2087
|
+
* quickest-to-compress file format, at a cost of increased file size and
|
|
2088
|
+
* lower image quality. It will usually override the format option and choose
|
|
2089
|
+
* JPEG over WebP or AVIF. We do not recommend using this option, except in
|
|
2090
|
+
* unusual circumstances like resizing uncacheable dynamically-generated
|
|
2091
|
+
* images.
|
|
2092
|
+
*/
|
|
2093
|
+
compression?: "fast";
|
|
2043
2094
|
}
|
|
2044
2095
|
declare interface RequestInitCfPropertiesImageMinify {
|
|
2045
2096
|
javascript?: boolean;
|
|
@@ -2055,7 +2106,8 @@ declare type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2055
2106
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2056
2107
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2057
2108
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2058
|
-
declare interface IncomingRequestCfPropertiesBase
|
|
2109
|
+
declare interface IncomingRequestCfPropertiesBase
|
|
2110
|
+
extends Record<string, unknown> {
|
|
2059
2111
|
/**
|
|
2060
2112
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2061
2113
|
*
|
|
@@ -2248,86 +2300,82 @@ declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2248
2300
|
/**
|
|
2249
2301
|
* Geographic data about the request's origin.
|
|
2250
2302
|
*/
|
|
2251
|
-
declare
|
|
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
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
* @example "635"
|
|
2328
|
-
*/
|
|
2329
|
-
metroCode?: string;
|
|
2330
|
-
};
|
|
2303
|
+
declare interface IncomingRequestCfPropertiesGeographicInformation {
|
|
2304
|
+
/**
|
|
2305
|
+
* The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
|
|
2306
|
+
*
|
|
2307
|
+
* 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.
|
|
2308
|
+
*
|
|
2309
|
+
* If Cloudflare is unable to determine where the request originated this property is omitted.
|
|
2310
|
+
*
|
|
2311
|
+
* The country code `"T1"` is used for requests originating on TOR.
|
|
2312
|
+
*
|
|
2313
|
+
* @example "GB"
|
|
2314
|
+
*/
|
|
2315
|
+
country?: Iso3166Alpha2Code | "T1";
|
|
2316
|
+
/**
|
|
2317
|
+
* If present, this property indicates that the request originated in the EU
|
|
2318
|
+
*
|
|
2319
|
+
* @example "1"
|
|
2320
|
+
*/
|
|
2321
|
+
isEUCountry?: "1";
|
|
2322
|
+
/**
|
|
2323
|
+
* A two-letter code indicating the continent the request originated from.
|
|
2324
|
+
*
|
|
2325
|
+
* @example "AN"
|
|
2326
|
+
*/
|
|
2327
|
+
continent?: ContinentCode;
|
|
2328
|
+
/**
|
|
2329
|
+
* The city the request originated from
|
|
2330
|
+
*
|
|
2331
|
+
* @example "Austin"
|
|
2332
|
+
*/
|
|
2333
|
+
city?: string;
|
|
2334
|
+
/**
|
|
2335
|
+
* Postal code of the incoming request
|
|
2336
|
+
*
|
|
2337
|
+
* @example "78701"
|
|
2338
|
+
*/
|
|
2339
|
+
postalCode?: string;
|
|
2340
|
+
/**
|
|
2341
|
+
* Latitude of the incoming request
|
|
2342
|
+
*
|
|
2343
|
+
* @example "30.27130"
|
|
2344
|
+
*/
|
|
2345
|
+
latitude?: string;
|
|
2346
|
+
/**
|
|
2347
|
+
* Longitude of the incoming request
|
|
2348
|
+
*
|
|
2349
|
+
* @example "-97.74260"
|
|
2350
|
+
*/
|
|
2351
|
+
longitude?: string;
|
|
2352
|
+
/**
|
|
2353
|
+
* Timezone of the incoming request
|
|
2354
|
+
*
|
|
2355
|
+
* @example "America/Chicago"
|
|
2356
|
+
*/
|
|
2357
|
+
timezone?: string;
|
|
2358
|
+
/**
|
|
2359
|
+
* If known, the ISO 3166-2 name for the first level region associated with
|
|
2360
|
+
* the IP address of the incoming request
|
|
2361
|
+
*
|
|
2362
|
+
* @example "Texas"
|
|
2363
|
+
*/
|
|
2364
|
+
region?: string;
|
|
2365
|
+
/**
|
|
2366
|
+
* If known, the ISO 3166-2 code for the first-level region associated with
|
|
2367
|
+
* the IP address of the incoming request
|
|
2368
|
+
*
|
|
2369
|
+
* @example "TX"
|
|
2370
|
+
*/
|
|
2371
|
+
regionCode?: string;
|
|
2372
|
+
/**
|
|
2373
|
+
* Metro code (DMA) of the incoming request
|
|
2374
|
+
*
|
|
2375
|
+
* @example "635"
|
|
2376
|
+
*/
|
|
2377
|
+
metroCode?: string;
|
|
2378
|
+
}
|
|
2331
2379
|
/** Data about the incoming request's TLS certificate */
|
|
2332
2380
|
declare interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2333
2381
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2720,6 +2768,9 @@ declare type Iso3166Alpha2Code =
|
|
|
2720
2768
|
| "ZW";
|
|
2721
2769
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2722
2770
|
declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2771
|
+
declare type CfProperties<HostMetadata = unknown> =
|
|
2772
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2773
|
+
| RequestInitCfProperties;
|
|
2723
2774
|
declare interface D1Result<T = unknown> {
|
|
2724
2775
|
results?: T[];
|
|
2725
2776
|
success: boolean;
|
|
@@ -2742,7 +2793,7 @@ declare abstract class D1PreparedStatement {
|
|
|
2742
2793
|
/**
|
|
2743
2794
|
* A email message that is sent to a consumer Worker.
|
|
2744
2795
|
*/
|
|
2745
|
-
declare interface EmailMessage
|
|
2796
|
+
declare interface EmailMessage {
|
|
2746
2797
|
/**
|
|
2747
2798
|
* Envelope From attribute of the email message.
|
|
2748
2799
|
*/
|