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