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