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