@cloudflare/workers-types 4.20230307.0 → 4.20230404.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 +209 -117
- package/2021-11-03/index.ts +202 -117
- package/2022-01-31/index.d.ts +209 -117
- package/2022-01-31/index.ts +202 -117
- package/2022-03-21/index.d.ts +209 -117
- package/2022-03-21/index.ts +202 -117
- package/2022-08-04/index.d.ts +209 -117
- package/2022-08-04/index.ts +202 -117
- package/2022-10-31/index.d.ts +210 -117
- package/2022-10-31/index.ts +203 -117
- package/2022-11-30/index.d.ts +210 -117
- package/2022-11-30/index.ts +203 -117
- package/README.md +1 -1
- package/experimental/index.d.ts +210 -117
- package/experimental/index.ts +203 -117
- package/index.d.ts +209 -117
- package/index.ts +202 -117
- package/oldest/index.d.ts +209 -117
- package/oldest/index.ts +202 -117
- package/package.json +1 -1
package/2022-08-04/index.ts
CHANGED
|
@@ -289,8 +289,11 @@ export interface ExecutionContext {
|
|
|
289
289
|
waitUntil(promise: Promise<any>): void;
|
|
290
290
|
passThroughOnException(): void;
|
|
291
291
|
}
|
|
292
|
-
export type ExportedHandlerFetchHandler<
|
|
293
|
-
|
|
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<
|
|
318
|
-
|
|
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>;
|
|
@@ -354,13 +361,24 @@ export interface DurableObjectNamespace {
|
|
|
354
361
|
id: DurableObjectId,
|
|
355
362
|
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
356
363
|
): DurableObjectStub;
|
|
357
|
-
jurisdiction(jurisdiction:
|
|
364
|
+
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
|
|
358
365
|
}
|
|
366
|
+
export type DurableObjectJurisdiction = "eu" | "fedramp";
|
|
359
367
|
export interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
360
|
-
jurisdiction?:
|
|
361
|
-
}
|
|
368
|
+
jurisdiction?: DurableObjectJurisdiction;
|
|
369
|
+
}
|
|
370
|
+
export type DurableObjectLocationHint =
|
|
371
|
+
| "wnam"
|
|
372
|
+
| "enam"
|
|
373
|
+
| "sam"
|
|
374
|
+
| "weur"
|
|
375
|
+
| "eeur"
|
|
376
|
+
| "apac"
|
|
377
|
+
| "oc"
|
|
378
|
+
| "afr"
|
|
379
|
+
| "me";
|
|
362
380
|
export interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
363
|
-
locationHint?:
|
|
381
|
+
locationHint?: DurableObjectLocationHint;
|
|
364
382
|
}
|
|
365
383
|
export interface DurableObjectState {
|
|
366
384
|
waitUntil(promise: Promise<any>): void;
|
|
@@ -990,23 +1008,27 @@ export interface ResponseInit {
|
|
|
990
1008
|
webSocket?: WebSocket | null;
|
|
991
1009
|
encodeBody?: "automatic" | "manual";
|
|
992
1010
|
}
|
|
993
|
-
export type RequestInfo
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
1011
|
+
export type RequestInfo<
|
|
1012
|
+
CfHostMetadata = unknown,
|
|
1013
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1014
|
+
> = Request<CfHostMetadata, Cf> | string | URL;
|
|
1015
|
+
export declare class Request<
|
|
1016
|
+
CfHostMetadata = unknown,
|
|
1017
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1018
|
+
> extends Body {
|
|
1019
|
+
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1020
|
+
clone(): Request<CfHostMetadata, Cf>;
|
|
997
1021
|
get method(): string;
|
|
998
1022
|
get url(): string;
|
|
999
1023
|
get headers(): Headers;
|
|
1000
1024
|
get redirect(): string;
|
|
1001
1025
|
get fetcher(): Fetcher | null;
|
|
1002
1026
|
get signal(): AbortSignal;
|
|
1003
|
-
get cf():
|
|
1027
|
+
get cf(): Cf | undefined;
|
|
1004
1028
|
get integrity(): string;
|
|
1005
1029
|
get keepalive(): boolean;
|
|
1006
1030
|
}
|
|
1007
|
-
export interface RequestInit<
|
|
1008
|
-
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
1009
|
-
> {
|
|
1031
|
+
export interface RequestInit<Cf = CfProperties> {
|
|
1010
1032
|
/** A string to set request's method. */
|
|
1011
1033
|
method?: string;
|
|
1012
1034
|
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
@@ -1016,17 +1038,14 @@ export interface RequestInit<
|
|
|
1016
1038
|
/** 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
1039
|
redirect?: string;
|
|
1018
1040
|
fetcher?: Fetcher | null;
|
|
1019
|
-
cf?:
|
|
1041
|
+
cf?: Cf;
|
|
1020
1042
|
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1021
1043
|
integrity?: string;
|
|
1022
1044
|
/** An AbortSignal to set request's signal. */
|
|
1023
1045
|
signal?: AbortSignal | null;
|
|
1024
1046
|
}
|
|
1025
1047
|
export declare abstract class Fetcher {
|
|
1026
|
-
fetch(
|
|
1027
|
-
input: RequestInfo,
|
|
1028
|
-
init?: RequestInit<RequestInitCfProperties>
|
|
1029
|
-
): Promise<Response>;
|
|
1048
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1030
1049
|
}
|
|
1031
1050
|
export interface FetcherPutOptions {
|
|
1032
1051
|
expiration?: number;
|
|
@@ -1290,12 +1309,18 @@ export interface R2HTTPMetadata {
|
|
|
1290
1309
|
cacheControl?: string;
|
|
1291
1310
|
cacheExpiry?: Date;
|
|
1292
1311
|
}
|
|
1293
|
-
export
|
|
1312
|
+
export type R2Objects = {
|
|
1294
1313
|
objects: R2Object[];
|
|
1295
|
-
truncated: boolean;
|
|
1296
|
-
cursor?: string;
|
|
1297
1314
|
delimitedPrefixes: string[];
|
|
1298
|
-
}
|
|
1315
|
+
} & (
|
|
1316
|
+
| {
|
|
1317
|
+
truncated: true;
|
|
1318
|
+
cursor: string;
|
|
1319
|
+
}
|
|
1320
|
+
| {
|
|
1321
|
+
truncated: false;
|
|
1322
|
+
}
|
|
1323
|
+
);
|
|
1299
1324
|
export declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1300
1325
|
readonly scheduledTime: number;
|
|
1301
1326
|
readonly cron: string;
|
|
@@ -1506,13 +1531,19 @@ export declare class TransformStream<I = any, O = any> {
|
|
|
1506
1531
|
get writable(): WritableStream<I>;
|
|
1507
1532
|
}
|
|
1508
1533
|
export declare class FixedLengthStream extends IdentityTransformStream {
|
|
1509
|
-
constructor(
|
|
1534
|
+
constructor(
|
|
1535
|
+
expectedLength: number | bigint,
|
|
1536
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy
|
|
1537
|
+
);
|
|
1510
1538
|
}
|
|
1511
1539
|
export declare class IdentityTransformStream extends TransformStream<
|
|
1512
1540
|
ArrayBuffer | ArrayBufferView,
|
|
1513
1541
|
Uint8Array
|
|
1514
1542
|
> {
|
|
1515
|
-
constructor();
|
|
1543
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
1544
|
+
}
|
|
1545
|
+
export interface IdentityTransformStreamQueuingStrategy {
|
|
1546
|
+
highWaterMark?: number | bigint;
|
|
1516
1547
|
}
|
|
1517
1548
|
export interface ReadableStreamValuesOptions {
|
|
1518
1549
|
preventCancel?: boolean;
|
|
@@ -1868,7 +1899,7 @@ export interface BasicImageTransformationsGravityCoordinates {
|
|
|
1868
1899
|
* Note: Currently, these properties cannot be tested in the
|
|
1869
1900
|
* playground.
|
|
1870
1901
|
*/
|
|
1871
|
-
export interface RequestInitCfProperties {
|
|
1902
|
+
export interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1872
1903
|
cacheEverything?: boolean;
|
|
1873
1904
|
/**
|
|
1874
1905
|
* A request's cache key is what determines if two requests are
|
|
@@ -2038,6 +2069,49 @@ export interface RequestInitCfPropertiesImage
|
|
|
2038
2069
|
* the origin.
|
|
2039
2070
|
*/
|
|
2040
2071
|
"origin-auth"?: "share-publicly";
|
|
2072
|
+
/**
|
|
2073
|
+
* Adds a border around the image. The border is added after resizing. Border
|
|
2074
|
+
* width takes dpr into account, and can be specified either using a single
|
|
2075
|
+
* width property, or individually for each side.
|
|
2076
|
+
*/
|
|
2077
|
+
border?:
|
|
2078
|
+
| {
|
|
2079
|
+
color: string;
|
|
2080
|
+
width: number;
|
|
2081
|
+
}
|
|
2082
|
+
| {
|
|
2083
|
+
color: string;
|
|
2084
|
+
top: number;
|
|
2085
|
+
right: number;
|
|
2086
|
+
bottom: number;
|
|
2087
|
+
left: number;
|
|
2088
|
+
};
|
|
2089
|
+
/**
|
|
2090
|
+
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
2091
|
+
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
2092
|
+
* 0 is ignored.
|
|
2093
|
+
*/
|
|
2094
|
+
brightness?: number;
|
|
2095
|
+
/**
|
|
2096
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
2097
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
2098
|
+
* ignored.
|
|
2099
|
+
*/
|
|
2100
|
+
contrast?: number;
|
|
2101
|
+
/**
|
|
2102
|
+
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
2103
|
+
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
2104
|
+
*/
|
|
2105
|
+
gamma?: number;
|
|
2106
|
+
/**
|
|
2107
|
+
* Slightly reduces latency on a cache miss by selecting a
|
|
2108
|
+
* quickest-to-compress file format, at a cost of increased file size and
|
|
2109
|
+
* lower image quality. It will usually override the format option and choose
|
|
2110
|
+
* JPEG over WebP or AVIF. We do not recommend using this option, except in
|
|
2111
|
+
* unusual circumstances like resizing uncacheable dynamically-generated
|
|
2112
|
+
* images.
|
|
2113
|
+
*/
|
|
2114
|
+
compression?: "fast";
|
|
2041
2115
|
}
|
|
2042
2116
|
export interface RequestInitCfPropertiesImageMinify {
|
|
2043
2117
|
javascript?: boolean;
|
|
@@ -2053,7 +2127,8 @@ export type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2053
2127
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2054
2128
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2055
2129
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2056
|
-
export interface IncomingRequestCfPropertiesBase
|
|
2130
|
+
export interface IncomingRequestCfPropertiesBase
|
|
2131
|
+
extends Record<string, unknown> {
|
|
2057
2132
|
/**
|
|
2058
2133
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2059
2134
|
*
|
|
@@ -2246,86 +2321,82 @@ export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2246
2321
|
/**
|
|
2247
2322
|
* Geographic data about the request's origin.
|
|
2248
2323
|
*/
|
|
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
|
-
};
|
|
2324
|
+
export interface IncomingRequestCfPropertiesGeographicInformation {
|
|
2325
|
+
/**
|
|
2326
|
+
* The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
|
|
2327
|
+
*
|
|
2328
|
+
* 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.
|
|
2329
|
+
*
|
|
2330
|
+
* If Cloudflare is unable to determine where the request originated this property is omitted.
|
|
2331
|
+
*
|
|
2332
|
+
* The country code `"T1"` is used for requests originating on TOR.
|
|
2333
|
+
*
|
|
2334
|
+
* @example "GB"
|
|
2335
|
+
*/
|
|
2336
|
+
country?: Iso3166Alpha2Code | "T1";
|
|
2337
|
+
/**
|
|
2338
|
+
* If present, this property indicates that the request originated in the EU
|
|
2339
|
+
*
|
|
2340
|
+
* @example "1"
|
|
2341
|
+
*/
|
|
2342
|
+
isEUCountry?: "1";
|
|
2343
|
+
/**
|
|
2344
|
+
* A two-letter code indicating the continent the request originated from.
|
|
2345
|
+
*
|
|
2346
|
+
* @example "AN"
|
|
2347
|
+
*/
|
|
2348
|
+
continent?: ContinentCode;
|
|
2349
|
+
/**
|
|
2350
|
+
* The city the request originated from
|
|
2351
|
+
*
|
|
2352
|
+
* @example "Austin"
|
|
2353
|
+
*/
|
|
2354
|
+
city?: string;
|
|
2355
|
+
/**
|
|
2356
|
+
* Postal code of the incoming request
|
|
2357
|
+
*
|
|
2358
|
+
* @example "78701"
|
|
2359
|
+
*/
|
|
2360
|
+
postalCode?: string;
|
|
2361
|
+
/**
|
|
2362
|
+
* Latitude of the incoming request
|
|
2363
|
+
*
|
|
2364
|
+
* @example "30.27130"
|
|
2365
|
+
*/
|
|
2366
|
+
latitude?: string;
|
|
2367
|
+
/**
|
|
2368
|
+
* Longitude of the incoming request
|
|
2369
|
+
*
|
|
2370
|
+
* @example "-97.74260"
|
|
2371
|
+
*/
|
|
2372
|
+
longitude?: string;
|
|
2373
|
+
/**
|
|
2374
|
+
* Timezone of the incoming request
|
|
2375
|
+
*
|
|
2376
|
+
* @example "America/Chicago"
|
|
2377
|
+
*/
|
|
2378
|
+
timezone?: string;
|
|
2379
|
+
/**
|
|
2380
|
+
* If known, the ISO 3166-2 name for the first level region associated with
|
|
2381
|
+
* the IP address of the incoming request
|
|
2382
|
+
*
|
|
2383
|
+
* @example "Texas"
|
|
2384
|
+
*/
|
|
2385
|
+
region?: string;
|
|
2386
|
+
/**
|
|
2387
|
+
* If known, the ISO 3166-2 code for the first-level region associated with
|
|
2388
|
+
* the IP address of the incoming request
|
|
2389
|
+
*
|
|
2390
|
+
* @example "TX"
|
|
2391
|
+
*/
|
|
2392
|
+
regionCode?: string;
|
|
2393
|
+
/**
|
|
2394
|
+
* Metro code (DMA) of the incoming request
|
|
2395
|
+
*
|
|
2396
|
+
* @example "635"
|
|
2397
|
+
*/
|
|
2398
|
+
metroCode?: string;
|
|
2399
|
+
}
|
|
2329
2400
|
/** Data about the incoming request's TLS certificate */
|
|
2330
2401
|
export interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2331
2402
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2718,6 +2789,9 @@ export type Iso3166Alpha2Code =
|
|
|
2718
2789
|
| "ZW";
|
|
2719
2790
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2720
2791
|
export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2792
|
+
export type CfProperties<HostMetadata = unknown> =
|
|
2793
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2794
|
+
| RequestInitCfProperties;
|
|
2721
2795
|
export interface D1Result<T = unknown> {
|
|
2722
2796
|
results?: T[];
|
|
2723
2797
|
success: boolean;
|
|
@@ -2738,9 +2812,9 @@ export declare abstract class D1PreparedStatement {
|
|
|
2738
2812
|
raw<T = unknown>(): Promise<T[]>;
|
|
2739
2813
|
}
|
|
2740
2814
|
/**
|
|
2741
|
-
*
|
|
2815
|
+
* An email message that can be sent from a Worker.
|
|
2742
2816
|
*/
|
|
2743
|
-
export interface EmailMessage
|
|
2817
|
+
export interface EmailMessage {
|
|
2744
2818
|
/**
|
|
2745
2819
|
* Envelope From attribute of the email message.
|
|
2746
2820
|
*/
|
|
@@ -2749,14 +2823,19 @@ export interface EmailMessage<Body = unknown> {
|
|
|
2749
2823
|
* Envelope To attribute of the email message.
|
|
2750
2824
|
*/
|
|
2751
2825
|
readonly to: string;
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2826
|
+
}
|
|
2827
|
+
/**
|
|
2828
|
+
* An email message that is sent to a consumer Worker and can be rejected/forwarded.
|
|
2829
|
+
*/
|
|
2830
|
+
export interface ForwardableEmailMessage extends EmailMessage {
|
|
2756
2831
|
/**
|
|
2757
2832
|
* Stream of the email message content.
|
|
2758
2833
|
*/
|
|
2759
2834
|
readonly raw: ReadableStream;
|
|
2835
|
+
/**
|
|
2836
|
+
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2837
|
+
*/
|
|
2838
|
+
readonly headers: Headers;
|
|
2760
2839
|
/**
|
|
2761
2840
|
* Size of the email message content.
|
|
2762
2841
|
*/
|
|
@@ -2775,11 +2854,17 @@ export interface EmailMessage<Body = unknown> {
|
|
|
2775
2854
|
*/
|
|
2776
2855
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2777
2856
|
}
|
|
2857
|
+
/**
|
|
2858
|
+
* A binding that allows a Worker to send email messages.
|
|
2859
|
+
*/
|
|
2860
|
+
export interface SendEmail {
|
|
2861
|
+
send(message: EmailMessage): Promise<void>;
|
|
2862
|
+
}
|
|
2778
2863
|
export declare abstract class EmailEvent extends ExtendableEvent {
|
|
2779
|
-
readonly message:
|
|
2864
|
+
readonly message: ForwardableEmailMessage;
|
|
2780
2865
|
}
|
|
2781
2866
|
export type EmailExportedHandler<Env = unknown> = (
|
|
2782
|
-
message:
|
|
2867
|
+
message: ForwardableEmailMessage,
|
|
2783
2868
|
env: Env,
|
|
2784
2869
|
ctx: ExecutionContext
|
|
2785
2870
|
) => void | Promise<void>;
|