@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-11-30/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>;
|
|
@@ -994,23 +1001,27 @@ export interface ResponseInit {
|
|
|
994
1001
|
webSocket?: WebSocket | null;
|
|
995
1002
|
encodeBody?: "automatic" | "manual";
|
|
996
1003
|
}
|
|
997
|
-
export type RequestInfo
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1004
|
+
export type RequestInfo<
|
|
1005
|
+
CfHostMetadata = unknown,
|
|
1006
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1007
|
+
> = Request<CfHostMetadata, Cf> | string | URL;
|
|
1008
|
+
export declare class Request<
|
|
1009
|
+
CfHostMetadata = unknown,
|
|
1010
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1011
|
+
> extends Body {
|
|
1012
|
+
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1013
|
+
clone(): Request<CfHostMetadata, Cf>;
|
|
1001
1014
|
get method(): string;
|
|
1002
1015
|
get url(): string;
|
|
1003
1016
|
get headers(): Headers;
|
|
1004
1017
|
get redirect(): string;
|
|
1005
1018
|
get fetcher(): Fetcher | null;
|
|
1006
1019
|
get signal(): AbortSignal;
|
|
1007
|
-
get cf():
|
|
1020
|
+
get cf(): Cf | undefined;
|
|
1008
1021
|
get integrity(): string;
|
|
1009
1022
|
get keepalive(): boolean;
|
|
1010
1023
|
}
|
|
1011
|
-
export interface RequestInit<
|
|
1012
|
-
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
1013
|
-
> {
|
|
1024
|
+
export interface RequestInit<Cf = CfProperties> {
|
|
1014
1025
|
/** A string to set request's method. */
|
|
1015
1026
|
method?: string;
|
|
1016
1027
|
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
@@ -1020,17 +1031,14 @@ export interface RequestInit<
|
|
|
1020
1031
|
/** 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. */
|
|
1021
1032
|
redirect?: string;
|
|
1022
1033
|
fetcher?: Fetcher | null;
|
|
1023
|
-
cf?:
|
|
1034
|
+
cf?: Cf;
|
|
1024
1035
|
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1025
1036
|
integrity?: string;
|
|
1026
1037
|
/** An AbortSignal to set request's signal. */
|
|
1027
1038
|
signal?: AbortSignal | null;
|
|
1028
1039
|
}
|
|
1029
1040
|
export declare abstract class Fetcher {
|
|
1030
|
-
fetch(
|
|
1031
|
-
input: RequestInfo,
|
|
1032
|
-
init?: RequestInit<RequestInitCfProperties>
|
|
1033
|
-
): Promise<Response>;
|
|
1041
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1034
1042
|
}
|
|
1035
1043
|
export interface FetcherPutOptions {
|
|
1036
1044
|
expiration?: number;
|
|
@@ -1663,6 +1671,7 @@ export declare class URL {
|
|
|
1663
1671
|
get searchParams(): URLSearchParams;
|
|
1664
1672
|
toJSON(): string;
|
|
1665
1673
|
toString(): string;
|
|
1674
|
+
static canParse(url: string, base?: string): boolean;
|
|
1666
1675
|
}
|
|
1667
1676
|
export declare class URLSearchParams {
|
|
1668
1677
|
constructor(
|
|
@@ -1867,7 +1876,7 @@ export interface BasicImageTransformationsGravityCoordinates {
|
|
|
1867
1876
|
* Note: Currently, these properties cannot be tested in the
|
|
1868
1877
|
* playground.
|
|
1869
1878
|
*/
|
|
1870
|
-
export interface RequestInitCfProperties {
|
|
1879
|
+
export interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1871
1880
|
cacheEverything?: boolean;
|
|
1872
1881
|
/**
|
|
1873
1882
|
* A request's cache key is what determines if two requests are
|
|
@@ -2037,6 +2046,49 @@ export interface RequestInitCfPropertiesImage
|
|
|
2037
2046
|
* the origin.
|
|
2038
2047
|
*/
|
|
2039
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";
|
|
2040
2092
|
}
|
|
2041
2093
|
export interface RequestInitCfPropertiesImageMinify {
|
|
2042
2094
|
javascript?: boolean;
|
|
@@ -2052,7 +2104,8 @@ export type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2052
2104
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2053
2105
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2054
2106
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2055
|
-
export interface IncomingRequestCfPropertiesBase
|
|
2107
|
+
export interface IncomingRequestCfPropertiesBase
|
|
2108
|
+
extends Record<string, unknown> {
|
|
2056
2109
|
/**
|
|
2057
2110
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2058
2111
|
*
|
|
@@ -2245,86 +2298,82 @@ export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2245
2298
|
/**
|
|
2246
2299
|
* Geographic data about the request's origin.
|
|
2247
2300
|
*/
|
|
2248
|
-
export
|
|
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
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
* @example "635"
|
|
2325
|
-
*/
|
|
2326
|
-
metroCode?: string;
|
|
2327
|
-
};
|
|
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
|
+
}
|
|
2328
2377
|
/** Data about the incoming request's TLS certificate */
|
|
2329
2378
|
export interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2330
2379
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2717,6 +2766,9 @@ export type Iso3166Alpha2Code =
|
|
|
2717
2766
|
| "ZW";
|
|
2718
2767
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2719
2768
|
export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2769
|
+
export type CfProperties<HostMetadata = unknown> =
|
|
2770
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2771
|
+
| RequestInitCfProperties;
|
|
2720
2772
|
export interface D1Result<T = unknown> {
|
|
2721
2773
|
results?: T[];
|
|
2722
2774
|
success: boolean;
|
|
@@ -2739,7 +2791,7 @@ export declare abstract class D1PreparedStatement {
|
|
|
2739
2791
|
/**
|
|
2740
2792
|
* A email message that is sent to a consumer Worker.
|
|
2741
2793
|
*/
|
|
2742
|
-
export interface EmailMessage
|
|
2794
|
+
export interface EmailMessage {
|
|
2743
2795
|
/**
|
|
2744
2796
|
* Envelope From attribute of the email message.
|
|
2745
2797
|
*/
|