@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.
@@ -289,8 +289,11 @@ export interface ExecutionContext {
289
289
  waitUntil(promise: Promise<any>): void;
290
290
  passThroughOnException(): void;
291
291
  }
292
- export type ExportedHandlerFetchHandler<Env = unknown> = (
293
- request: Request,
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<Env = unknown, QueueMessage = unknown> {
318
- fetch?: ExportedHandlerFetchHandler<Env>;
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 = Request | string | URL;
994
- export declare class Request<CfHostMetadata = unknown> extends Body {
995
- constructor(input: RequestInfo, init?: RequestInit);
996
- clone(): Request<CfHostMetadata>;
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(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
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?: CfType;
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;
@@ -1867,7 +1875,7 @@ export interface BasicImageTransformationsGravityCoordinates {
1867
1875
  * Note: Currently, these properties cannot be tested in the
1868
1876
  * playground.
1869
1877
  */
1870
- export interface RequestInitCfProperties {
1878
+ export interface RequestInitCfProperties extends Record<string, unknown> {
1871
1879
  cacheEverything?: boolean;
1872
1880
  /**
1873
1881
  * A request's cache key is what determines if two requests are
@@ -2037,6 +2045,49 @@ export interface RequestInitCfPropertiesImage
2037
2045
  * the origin.
2038
2046
  */
2039
2047
  "origin-auth"?: "share-publicly";
2048
+ /**
2049
+ * Adds a border around the image. The border is added after resizing. Border
2050
+ * width takes dpr into account, and can be specified either using a single
2051
+ * width property, or individually for each side.
2052
+ */
2053
+ border?:
2054
+ | {
2055
+ color: string;
2056
+ width: number;
2057
+ }
2058
+ | {
2059
+ color: string;
2060
+ top: number;
2061
+ right: number;
2062
+ bottom: number;
2063
+ left: number;
2064
+ };
2065
+ /**
2066
+ * Increase brightness by a factor. A value of 1.0 equals no change, a value
2067
+ * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
2068
+ * 0 is ignored.
2069
+ */
2070
+ brightness?: number;
2071
+ /**
2072
+ * Increase contrast by a factor. A value of 1.0 equals no change, a value of
2073
+ * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
2074
+ * ignored.
2075
+ */
2076
+ contrast?: number;
2077
+ /**
2078
+ * Increase exposure by a factor. A value of 1.0 equals no change, a value of
2079
+ * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
2080
+ */
2081
+ gamma?: number;
2082
+ /**
2083
+ * Slightly reduces latency on a cache miss by selecting a
2084
+ * quickest-to-compress file format, at a cost of increased file size and
2085
+ * lower image quality. It will usually override the format option and choose
2086
+ * JPEG over WebP or AVIF. We do not recommend using this option, except in
2087
+ * unusual circumstances like resizing uncacheable dynamically-generated
2088
+ * images.
2089
+ */
2090
+ compression?: "fast";
2040
2091
  }
2041
2092
  export interface RequestInitCfPropertiesImageMinify {
2042
2093
  javascript?: boolean;
@@ -2052,7 +2103,8 @@ export type IncomingRequestCfProperties<HostMetadata = unknown> =
2052
2103
  IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
2053
2104
  IncomingRequestCfPropertiesGeographicInformation &
2054
2105
  IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
2055
- export interface IncomingRequestCfPropertiesBase {
2106
+ export interface IncomingRequestCfPropertiesBase
2107
+ extends Record<string, unknown> {
2056
2108
  /**
2057
2109
  * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
2058
2110
  *
@@ -2245,86 +2297,82 @@ export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
2245
2297
  /**
2246
2298
  * Geographic data about the request's origin.
2247
2299
  */
2248
- export type IncomingRequestCfPropertiesGeographicInformation =
2249
- | {}
2250
- | {
2251
- /** The country code `"T1"` is used for requests originating on TOR */
2252
- country: "T1";
2253
- }
2254
- | {
2255
- /**
2256
- * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
2257
- *
2258
- * 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.
2259
- *
2260
- * If Cloudflare is unable to determine where the request originated this property is omitted.
2261
- *
2262
- * @example "GB"
2263
- */
2264
- country: Iso3166Alpha2Code;
2265
- /**
2266
- * If present, this property indicates that the request originated in the EU
2267
- *
2268
- * @example "1"
2269
- */
2270
- isEUCountry?: "1";
2271
- /**
2272
- * A two-letter code indicating the continent the request originated from.
2273
- *
2274
- * @example "AN"
2275
- */
2276
- continent: ContinentCode;
2277
- /**
2278
- * The city the request originated from
2279
- *
2280
- * @example "Austin"
2281
- */
2282
- city?: string;
2283
- /**
2284
- * Postal code of the incoming request
2285
- *
2286
- * @example "78701"
2287
- */
2288
- postalCode?: string;
2289
- /**
2290
- * Latitude of the incoming request
2291
- *
2292
- * @example "30.27130"
2293
- */
2294
- latitude?: string;
2295
- /**
2296
- * Longitude of the incoming request
2297
- *
2298
- * @example "-97.74260"
2299
- */
2300
- longitude?: string;
2301
- /**
2302
- * Timezone of the incoming request
2303
- *
2304
- * @example "America/Chicago"
2305
- */
2306
- timezone?: string;
2307
- /**
2308
- * If known, the ISO 3166-2 name for the first level region associated with
2309
- * the IP address of the incoming request
2310
- *
2311
- * @example "Texas"
2312
- */
2313
- region?: string;
2314
- /**
2315
- * If known, the ISO 3166-2 code for the first-level region associated with
2316
- * the IP address of the incoming request
2317
- *
2318
- * @example "TX"
2319
- */
2320
- regionCode?: string;
2321
- /**
2322
- * Metro code (DMA) of the incoming request
2323
- *
2324
- * @example "635"
2325
- */
2326
- metroCode?: string;
2327
- };
2300
+ export interface IncomingRequestCfPropertiesGeographicInformation {
2301
+ /**
2302
+ * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
2303
+ *
2304
+ * 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.
2305
+ *
2306
+ * If Cloudflare is unable to determine where the request originated this property is omitted.
2307
+ *
2308
+ * The country code `"T1"` is used for requests originating on TOR.
2309
+ *
2310
+ * @example "GB"
2311
+ */
2312
+ country?: Iso3166Alpha2Code | "T1";
2313
+ /**
2314
+ * If present, this property indicates that the request originated in the EU
2315
+ *
2316
+ * @example "1"
2317
+ */
2318
+ isEUCountry?: "1";
2319
+ /**
2320
+ * A two-letter code indicating the continent the request originated from.
2321
+ *
2322
+ * @example "AN"
2323
+ */
2324
+ continent?: ContinentCode;
2325
+ /**
2326
+ * The city the request originated from
2327
+ *
2328
+ * @example "Austin"
2329
+ */
2330
+ city?: string;
2331
+ /**
2332
+ * Postal code of the incoming request
2333
+ *
2334
+ * @example "78701"
2335
+ */
2336
+ postalCode?: string;
2337
+ /**
2338
+ * Latitude of the incoming request
2339
+ *
2340
+ * @example "30.27130"
2341
+ */
2342
+ latitude?: string;
2343
+ /**
2344
+ * Longitude of the incoming request
2345
+ *
2346
+ * @example "-97.74260"
2347
+ */
2348
+ longitude?: string;
2349
+ /**
2350
+ * Timezone of the incoming request
2351
+ *
2352
+ * @example "America/Chicago"
2353
+ */
2354
+ timezone?: string;
2355
+ /**
2356
+ * If known, the ISO 3166-2 name for the first level region associated with
2357
+ * the IP address of the incoming request
2358
+ *
2359
+ * @example "Texas"
2360
+ */
2361
+ region?: string;
2362
+ /**
2363
+ * If known, the ISO 3166-2 code for the first-level region associated with
2364
+ * the IP address of the incoming request
2365
+ *
2366
+ * @example "TX"
2367
+ */
2368
+ regionCode?: string;
2369
+ /**
2370
+ * Metro code (DMA) of the incoming request
2371
+ *
2372
+ * @example "635"
2373
+ */
2374
+ metroCode?: string;
2375
+ }
2328
2376
  /** Data about the incoming request's TLS certificate */
2329
2377
  export interface IncomingRequestCfPropertiesTLSClientAuth {
2330
2378
  /** Always `"1"`, indicating that the certificate was presented */
@@ -2717,6 +2765,9 @@ export type Iso3166Alpha2Code =
2717
2765
  | "ZW";
2718
2766
  /** The 2-letter continent codes Cloudflare uses */
2719
2767
  export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
2768
+ export type CfProperties<HostMetadata = unknown> =
2769
+ | IncomingRequestCfProperties<HostMetadata>
2770
+ | RequestInitCfProperties;
2720
2771
  export interface D1Result<T = unknown> {
2721
2772
  results?: T[];
2722
2773
  success: boolean;
@@ -2739,7 +2790,7 @@ export declare abstract class D1PreparedStatement {
2739
2790
  /**
2740
2791
  * A email message that is sent to a consumer Worker.
2741
2792
  */
2742
- export interface EmailMessage<Body = unknown> {
2793
+ export interface EmailMessage {
2743
2794
  /**
2744
2795
  * Envelope From attribute of the email message.
2745
2796
  */
@@ -287,8 +287,11 @@ declare interface ExecutionContext {
287
287
  waitUntil(promise: Promise<any>): void;
288
288
  passThroughOnException(): void;
289
289
  }
290
- declare type ExportedHandlerFetchHandler<Env = unknown> = (
291
- request: Request,
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<Env = unknown, QueueMessage = unknown> {
316
- fetch?: ExportedHandlerFetchHandler<Env>;
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 = Request | string | URL;
992
- declare class Request<CfHostMetadata = unknown> extends Body {
993
- constructor(input: RequestInfo, init?: RequestInit);
994
- clone(): Request<CfHostMetadata>;
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(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
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?: CfType;
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;
@@ -1863,7 +1871,7 @@ declare interface BasicImageTransformationsGravityCoordinates {
1863
1871
  * Note: Currently, these properties cannot be tested in the
1864
1872
  * playground.
1865
1873
  */
1866
- declare interface RequestInitCfProperties {
1874
+ declare interface RequestInitCfProperties extends Record<string, unknown> {
1867
1875
  cacheEverything?: boolean;
1868
1876
  /**
1869
1877
  * A request's cache key is what determines if two requests are
@@ -2033,6 +2041,49 @@ declare interface RequestInitCfPropertiesImage
2033
2041
  * the origin.
2034
2042
  */
2035
2043
  "origin-auth"?: "share-publicly";
2044
+ /**
2045
+ * Adds a border around the image. The border is added after resizing. Border
2046
+ * width takes dpr into account, and can be specified either using a single
2047
+ * width property, or individually for each side.
2048
+ */
2049
+ border?:
2050
+ | {
2051
+ color: string;
2052
+ width: number;
2053
+ }
2054
+ | {
2055
+ color: string;
2056
+ top: number;
2057
+ right: number;
2058
+ bottom: number;
2059
+ left: number;
2060
+ };
2061
+ /**
2062
+ * Increase brightness by a factor. A value of 1.0 equals no change, a value
2063
+ * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
2064
+ * 0 is ignored.
2065
+ */
2066
+ brightness?: number;
2067
+ /**
2068
+ * Increase contrast by a factor. A value of 1.0 equals no change, a value of
2069
+ * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
2070
+ * ignored.
2071
+ */
2072
+ contrast?: number;
2073
+ /**
2074
+ * Increase exposure by a factor. A value of 1.0 equals no change, a value of
2075
+ * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
2076
+ */
2077
+ gamma?: number;
2078
+ /**
2079
+ * Slightly reduces latency on a cache miss by selecting a
2080
+ * quickest-to-compress file format, at a cost of increased file size and
2081
+ * lower image quality. It will usually override the format option and choose
2082
+ * JPEG over WebP or AVIF. We do not recommend using this option, except in
2083
+ * unusual circumstances like resizing uncacheable dynamically-generated
2084
+ * images.
2085
+ */
2086
+ compression?: "fast";
2036
2087
  }
2037
2088
  declare interface RequestInitCfPropertiesImageMinify {
2038
2089
  javascript?: boolean;
@@ -2048,7 +2099,8 @@ declare type IncomingRequestCfProperties<HostMetadata = unknown> =
2048
2099
  IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
2049
2100
  IncomingRequestCfPropertiesGeographicInformation &
2050
2101
  IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
2051
- declare interface IncomingRequestCfPropertiesBase {
2102
+ declare interface IncomingRequestCfPropertiesBase
2103
+ extends Record<string, unknown> {
2052
2104
  /**
2053
2105
  * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
2054
2106
  *
@@ -2241,86 +2293,82 @@ declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
2241
2293
  /**
2242
2294
  * Geographic data about the request's origin.
2243
2295
  */
2244
- declare type IncomingRequestCfPropertiesGeographicInformation =
2245
- | {}
2246
- | {
2247
- /** The country code `"T1"` is used for requests originating on TOR */
2248
- country: "T1";
2249
- }
2250
- | {
2251
- /**
2252
- * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
2253
- *
2254
- * 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.
2255
- *
2256
- * If Cloudflare is unable to determine where the request originated this property is omitted.
2257
- *
2258
- * @example "GB"
2259
- */
2260
- country: Iso3166Alpha2Code;
2261
- /**
2262
- * If present, this property indicates that the request originated in the EU
2263
- *
2264
- * @example "1"
2265
- */
2266
- isEUCountry?: "1";
2267
- /**
2268
- * A two-letter code indicating the continent the request originated from.
2269
- *
2270
- * @example "AN"
2271
- */
2272
- continent: ContinentCode;
2273
- /**
2274
- * The city the request originated from
2275
- *
2276
- * @example "Austin"
2277
- */
2278
- city?: string;
2279
- /**
2280
- * Postal code of the incoming request
2281
- *
2282
- * @example "78701"
2283
- */
2284
- postalCode?: string;
2285
- /**
2286
- * Latitude of the incoming request
2287
- *
2288
- * @example "30.27130"
2289
- */
2290
- latitude?: string;
2291
- /**
2292
- * Longitude of the incoming request
2293
- *
2294
- * @example "-97.74260"
2295
- */
2296
- longitude?: string;
2297
- /**
2298
- * Timezone of the incoming request
2299
- *
2300
- * @example "America/Chicago"
2301
- */
2302
- timezone?: string;
2303
- /**
2304
- * If known, the ISO 3166-2 name for the first level region associated with
2305
- * the IP address of the incoming request
2306
- *
2307
- * @example "Texas"
2308
- */
2309
- region?: string;
2310
- /**
2311
- * If known, the ISO 3166-2 code for the first-level region associated with
2312
- * the IP address of the incoming request
2313
- *
2314
- * @example "TX"
2315
- */
2316
- regionCode?: string;
2317
- /**
2318
- * Metro code (DMA) of the incoming request
2319
- *
2320
- * @example "635"
2321
- */
2322
- metroCode?: string;
2323
- };
2296
+ declare interface IncomingRequestCfPropertiesGeographicInformation {
2297
+ /**
2298
+ * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
2299
+ *
2300
+ * 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.
2301
+ *
2302
+ * If Cloudflare is unable to determine where the request originated this property is omitted.
2303
+ *
2304
+ * The country code `"T1"` is used for requests originating on TOR.
2305
+ *
2306
+ * @example "GB"
2307
+ */
2308
+ country?: Iso3166Alpha2Code | "T1";
2309
+ /**
2310
+ * If present, this property indicates that the request originated in the EU
2311
+ *
2312
+ * @example "1"
2313
+ */
2314
+ isEUCountry?: "1";
2315
+ /**
2316
+ * A two-letter code indicating the continent the request originated from.
2317
+ *
2318
+ * @example "AN"
2319
+ */
2320
+ continent?: ContinentCode;
2321
+ /**
2322
+ * The city the request originated from
2323
+ *
2324
+ * @example "Austin"
2325
+ */
2326
+ city?: string;
2327
+ /**
2328
+ * Postal code of the incoming request
2329
+ *
2330
+ * @example "78701"
2331
+ */
2332
+ postalCode?: string;
2333
+ /**
2334
+ * Latitude of the incoming request
2335
+ *
2336
+ * @example "30.27130"
2337
+ */
2338
+ latitude?: string;
2339
+ /**
2340
+ * Longitude of the incoming request
2341
+ *
2342
+ * @example "-97.74260"
2343
+ */
2344
+ longitude?: string;
2345
+ /**
2346
+ * Timezone of the incoming request
2347
+ *
2348
+ * @example "America/Chicago"
2349
+ */
2350
+ timezone?: string;
2351
+ /**
2352
+ * If known, the ISO 3166-2 name for the first level region associated with
2353
+ * the IP address of the incoming request
2354
+ *
2355
+ * @example "Texas"
2356
+ */
2357
+ region?: string;
2358
+ /**
2359
+ * If known, the ISO 3166-2 code for the first-level region associated with
2360
+ * the IP address of the incoming request
2361
+ *
2362
+ * @example "TX"
2363
+ */
2364
+ regionCode?: string;
2365
+ /**
2366
+ * Metro code (DMA) of the incoming request
2367
+ *
2368
+ * @example "635"
2369
+ */
2370
+ metroCode?: string;
2371
+ }
2324
2372
  /** Data about the incoming request's TLS certificate */
2325
2373
  declare interface IncomingRequestCfPropertiesTLSClientAuth {
2326
2374
  /** Always `"1"`, indicating that the certificate was presented */
@@ -2713,6 +2761,9 @@ declare type Iso3166Alpha2Code =
2713
2761
  | "ZW";
2714
2762
  /** The 2-letter continent codes Cloudflare uses */
2715
2763
  declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
2764
+ declare type CfProperties<HostMetadata = unknown> =
2765
+ | IncomingRequestCfProperties<HostMetadata>
2766
+ | RequestInitCfProperties;
2716
2767
  declare interface D1Result<T = unknown> {
2717
2768
  results?: T[];
2718
2769
  success: boolean;
@@ -2735,7 +2786,7 @@ declare abstract class D1PreparedStatement {
2735
2786
  /**
2736
2787
  * A email message that is sent to a consumer Worker.
2737
2788
  */
2738
- declare interface EmailMessage<Body = unknown> {
2789
+ declare interface EmailMessage {
2739
2790
  /**
2740
2791
  * Envelope From attribute of the email message.
2741
2792
  */