@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/2022-10-31/index.d.ts
CHANGED
|
@@ -287,8 +287,11 @@ declare interface ExecutionContext {
|
|
|
287
287
|
waitUntil(promise: Promise<any>): void;
|
|
288
288
|
passThroughOnException(): void;
|
|
289
289
|
}
|
|
290
|
-
declare type ExportedHandlerFetchHandler<
|
|
291
|
-
|
|
290
|
+
declare type ExportedHandlerFetchHandler<
|
|
291
|
+
Env = unknown,
|
|
292
|
+
CfHostMetadata = unknown
|
|
293
|
+
> = (
|
|
294
|
+
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
292
295
|
env: Env,
|
|
293
296
|
ctx: ExecutionContext
|
|
294
297
|
) => Response | Promise<Response>;
|
|
@@ -312,8 +315,12 @@ declare type ExportedHandlerTestHandler<Env = unknown> = (
|
|
|
312
315
|
env: Env,
|
|
313
316
|
ctx: ExecutionContext
|
|
314
317
|
) => void | Promise<void>;
|
|
315
|
-
declare interface ExportedHandler<
|
|
316
|
-
|
|
318
|
+
declare interface ExportedHandler<
|
|
319
|
+
Env = unknown,
|
|
320
|
+
QueueMessage = unknown,
|
|
321
|
+
CfHostMetadata = unknown
|
|
322
|
+
> {
|
|
323
|
+
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
317
324
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
318
325
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
319
326
|
test?: ExportedHandlerTestHandler<Env>;
|
|
@@ -988,23 +995,27 @@ declare interface ResponseInit {
|
|
|
988
995
|
webSocket?: WebSocket | null;
|
|
989
996
|
encodeBody?: "automatic" | "manual";
|
|
990
997
|
}
|
|
991
|
-
declare type RequestInfo
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
998
|
+
declare type RequestInfo<
|
|
999
|
+
CfHostMetadata = unknown,
|
|
1000
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1001
|
+
> = Request<CfHostMetadata, Cf> | string | URL;
|
|
1002
|
+
declare class Request<
|
|
1003
|
+
CfHostMetadata = unknown,
|
|
1004
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1005
|
+
> extends Body {
|
|
1006
|
+
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1007
|
+
clone(): Request<CfHostMetadata, Cf>;
|
|
995
1008
|
get method(): string;
|
|
996
1009
|
get url(): string;
|
|
997
1010
|
get headers(): Headers;
|
|
998
1011
|
get redirect(): string;
|
|
999
1012
|
get fetcher(): Fetcher | null;
|
|
1000
1013
|
get signal(): AbortSignal;
|
|
1001
|
-
get cf():
|
|
1014
|
+
get cf(): Cf | undefined;
|
|
1002
1015
|
get integrity(): string;
|
|
1003
1016
|
get keepalive(): boolean;
|
|
1004
1017
|
}
|
|
1005
|
-
declare interface RequestInit<
|
|
1006
|
-
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
1007
|
-
> {
|
|
1018
|
+
declare interface RequestInit<Cf = CfProperties> {
|
|
1008
1019
|
/** A string to set request's method. */
|
|
1009
1020
|
method?: string;
|
|
1010
1021
|
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
@@ -1014,17 +1025,14 @@ declare interface RequestInit<
|
|
|
1014
1025
|
/** 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
1026
|
redirect?: string;
|
|
1016
1027
|
fetcher?: Fetcher | null;
|
|
1017
|
-
cf?:
|
|
1028
|
+
cf?: Cf;
|
|
1018
1029
|
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1019
1030
|
integrity?: string;
|
|
1020
1031
|
/** An AbortSignal to set request's signal. */
|
|
1021
1032
|
signal?: AbortSignal | null;
|
|
1022
1033
|
}
|
|
1023
1034
|
declare abstract class Fetcher {
|
|
1024
|
-
fetch(
|
|
1025
|
-
input: RequestInfo,
|
|
1026
|
-
init?: RequestInit<RequestInitCfProperties>
|
|
1027
|
-
): Promise<Response>;
|
|
1035
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1028
1036
|
}
|
|
1029
1037
|
declare interface FetcherPutOptions {
|
|
1030
1038
|
expiration?: number;
|
|
@@ -1655,6 +1663,7 @@ declare class URL {
|
|
|
1655
1663
|
get searchParams(): URLSearchParams;
|
|
1656
1664
|
toJSON(): string;
|
|
1657
1665
|
toString(): string;
|
|
1666
|
+
static canParse(url: string, base?: string): boolean;
|
|
1658
1667
|
}
|
|
1659
1668
|
declare class URLSearchParams {
|
|
1660
1669
|
constructor(
|
|
@@ -1859,7 +1868,7 @@ declare interface BasicImageTransformationsGravityCoordinates {
|
|
|
1859
1868
|
* Note: Currently, these properties cannot be tested in the
|
|
1860
1869
|
* playground.
|
|
1861
1870
|
*/
|
|
1862
|
-
declare interface RequestInitCfProperties {
|
|
1871
|
+
declare interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1863
1872
|
cacheEverything?: boolean;
|
|
1864
1873
|
/**
|
|
1865
1874
|
* A request's cache key is what determines if two requests are
|
|
@@ -2029,6 +2038,49 @@ declare interface RequestInitCfPropertiesImage
|
|
|
2029
2038
|
* the origin.
|
|
2030
2039
|
*/
|
|
2031
2040
|
"origin-auth"?: "share-publicly";
|
|
2041
|
+
/**
|
|
2042
|
+
* Adds a border around the image. The border is added after resizing. Border
|
|
2043
|
+
* width takes dpr into account, and can be specified either using a single
|
|
2044
|
+
* width property, or individually for each side.
|
|
2045
|
+
*/
|
|
2046
|
+
border?:
|
|
2047
|
+
| {
|
|
2048
|
+
color: string;
|
|
2049
|
+
width: number;
|
|
2050
|
+
}
|
|
2051
|
+
| {
|
|
2052
|
+
color: string;
|
|
2053
|
+
top: number;
|
|
2054
|
+
right: number;
|
|
2055
|
+
bottom: number;
|
|
2056
|
+
left: number;
|
|
2057
|
+
};
|
|
2058
|
+
/**
|
|
2059
|
+
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
2060
|
+
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
2061
|
+
* 0 is ignored.
|
|
2062
|
+
*/
|
|
2063
|
+
brightness?: number;
|
|
2064
|
+
/**
|
|
2065
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
2066
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
2067
|
+
* ignored.
|
|
2068
|
+
*/
|
|
2069
|
+
contrast?: number;
|
|
2070
|
+
/**
|
|
2071
|
+
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
2072
|
+
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
2073
|
+
*/
|
|
2074
|
+
gamma?: number;
|
|
2075
|
+
/**
|
|
2076
|
+
* Slightly reduces latency on a cache miss by selecting a
|
|
2077
|
+
* quickest-to-compress file format, at a cost of increased file size and
|
|
2078
|
+
* lower image quality. It will usually override the format option and choose
|
|
2079
|
+
* JPEG over WebP or AVIF. We do not recommend using this option, except in
|
|
2080
|
+
* unusual circumstances like resizing uncacheable dynamically-generated
|
|
2081
|
+
* images.
|
|
2082
|
+
*/
|
|
2083
|
+
compression?: "fast";
|
|
2032
2084
|
}
|
|
2033
2085
|
declare interface RequestInitCfPropertiesImageMinify {
|
|
2034
2086
|
javascript?: boolean;
|
|
@@ -2044,7 +2096,8 @@ declare type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2044
2096
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2045
2097
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2046
2098
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2047
|
-
declare interface IncomingRequestCfPropertiesBase
|
|
2099
|
+
declare interface IncomingRequestCfPropertiesBase
|
|
2100
|
+
extends Record<string, unknown> {
|
|
2048
2101
|
/**
|
|
2049
2102
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2050
2103
|
*
|
|
@@ -2237,86 +2290,82 @@ declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2237
2290
|
/**
|
|
2238
2291
|
* Geographic data about the request's origin.
|
|
2239
2292
|
*/
|
|
2240
|
-
declare
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
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
|
-
* @example "635"
|
|
2317
|
-
*/
|
|
2318
|
-
metroCode?: string;
|
|
2319
|
-
};
|
|
2293
|
+
declare interface IncomingRequestCfPropertiesGeographicInformation {
|
|
2294
|
+
/**
|
|
2295
|
+
* The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
|
|
2296
|
+
*
|
|
2297
|
+
* 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.
|
|
2298
|
+
*
|
|
2299
|
+
* If Cloudflare is unable to determine where the request originated this property is omitted.
|
|
2300
|
+
*
|
|
2301
|
+
* The country code `"T1"` is used for requests originating on TOR.
|
|
2302
|
+
*
|
|
2303
|
+
* @example "GB"
|
|
2304
|
+
*/
|
|
2305
|
+
country?: Iso3166Alpha2Code | "T1";
|
|
2306
|
+
/**
|
|
2307
|
+
* If present, this property indicates that the request originated in the EU
|
|
2308
|
+
*
|
|
2309
|
+
* @example "1"
|
|
2310
|
+
*/
|
|
2311
|
+
isEUCountry?: "1";
|
|
2312
|
+
/**
|
|
2313
|
+
* A two-letter code indicating the continent the request originated from.
|
|
2314
|
+
*
|
|
2315
|
+
* @example "AN"
|
|
2316
|
+
*/
|
|
2317
|
+
continent?: ContinentCode;
|
|
2318
|
+
/**
|
|
2319
|
+
* The city the request originated from
|
|
2320
|
+
*
|
|
2321
|
+
* @example "Austin"
|
|
2322
|
+
*/
|
|
2323
|
+
city?: string;
|
|
2324
|
+
/**
|
|
2325
|
+
* Postal code of the incoming request
|
|
2326
|
+
*
|
|
2327
|
+
* @example "78701"
|
|
2328
|
+
*/
|
|
2329
|
+
postalCode?: string;
|
|
2330
|
+
/**
|
|
2331
|
+
* Latitude of the incoming request
|
|
2332
|
+
*
|
|
2333
|
+
* @example "30.27130"
|
|
2334
|
+
*/
|
|
2335
|
+
latitude?: string;
|
|
2336
|
+
/**
|
|
2337
|
+
* Longitude of the incoming request
|
|
2338
|
+
*
|
|
2339
|
+
* @example "-97.74260"
|
|
2340
|
+
*/
|
|
2341
|
+
longitude?: string;
|
|
2342
|
+
/**
|
|
2343
|
+
* Timezone of the incoming request
|
|
2344
|
+
*
|
|
2345
|
+
* @example "America/Chicago"
|
|
2346
|
+
*/
|
|
2347
|
+
timezone?: string;
|
|
2348
|
+
/**
|
|
2349
|
+
* If known, the ISO 3166-2 name for the first level region associated with
|
|
2350
|
+
* the IP address of the incoming request
|
|
2351
|
+
*
|
|
2352
|
+
* @example "Texas"
|
|
2353
|
+
*/
|
|
2354
|
+
region?: string;
|
|
2355
|
+
/**
|
|
2356
|
+
* If known, the ISO 3166-2 code for the first-level region associated with
|
|
2357
|
+
* the IP address of the incoming request
|
|
2358
|
+
*
|
|
2359
|
+
* @example "TX"
|
|
2360
|
+
*/
|
|
2361
|
+
regionCode?: string;
|
|
2362
|
+
/**
|
|
2363
|
+
* Metro code (DMA) of the incoming request
|
|
2364
|
+
*
|
|
2365
|
+
* @example "635"
|
|
2366
|
+
*/
|
|
2367
|
+
metroCode?: string;
|
|
2368
|
+
}
|
|
2320
2369
|
/** Data about the incoming request's TLS certificate */
|
|
2321
2370
|
declare interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2322
2371
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2709,6 +2758,9 @@ declare type Iso3166Alpha2Code =
|
|
|
2709
2758
|
| "ZW";
|
|
2710
2759
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2711
2760
|
declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2761
|
+
declare type CfProperties<HostMetadata = unknown> =
|
|
2762
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2763
|
+
| RequestInitCfProperties;
|
|
2712
2764
|
declare interface D1Result<T = unknown> {
|
|
2713
2765
|
results?: T[];
|
|
2714
2766
|
success: boolean;
|
|
@@ -2731,7 +2783,7 @@ declare abstract class D1PreparedStatement {
|
|
|
2731
2783
|
/**
|
|
2732
2784
|
* A email message that is sent to a consumer Worker.
|
|
2733
2785
|
*/
|
|
2734
|
-
declare interface EmailMessage
|
|
2786
|
+
declare interface EmailMessage {
|
|
2735
2787
|
/**
|
|
2736
2788
|
* Envelope From attribute of the email message.
|
|
2737
2789
|
*/
|