@cloudflare/workers-types 0.20230215.0 → 0.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 +259 -191
- package/2021-11-03/index.ts +252 -191
- package/2022-01-31/index.d.ts +259 -191
- package/2022-01-31/index.ts +252 -191
- package/2022-03-21/index.d.ts +259 -191
- package/2022-03-21/index.ts +252 -191
- package/2022-08-04/index.d.ts +259 -191
- package/2022-08-04/index.ts +252 -191
- package/2022-10-31/index.d.ts +260 -191
- package/2022-10-31/index.ts +253 -191
- package/2022-11-30/index.d.ts +260 -191
- package/2022-11-30/index.ts +253 -191
- package/README.md +1 -1
- package/experimental/index.d.ts +313 -191
- package/experimental/index.ts +306 -191
- package/index.d.ts +259 -191
- package/index.ts +252 -191
- package/oldest/index.d.ts +259 -191
- package/oldest/index.ts +252 -191
- package/package.json +1 -1
package/experimental/index.ts
CHANGED
|
@@ -49,6 +49,7 @@ export declare class DOMException extends Error {
|
|
|
49
49
|
export type WorkerGlobalScopeEventMap = {
|
|
50
50
|
fetch: FetchEvent;
|
|
51
51
|
scheduled: ScheduledEvent;
|
|
52
|
+
queue: QueueEvent;
|
|
52
53
|
unhandledrejection: PromiseRejectionEvent;
|
|
53
54
|
rejectionhandled: PromiseRejectionEvent;
|
|
54
55
|
};
|
|
@@ -288,12 +289,16 @@ export declare const crypto: Crypto;
|
|
|
288
289
|
export declare const caches: CacheStorage;
|
|
289
290
|
export declare const scheduler: Scheduler;
|
|
290
291
|
export declare const navigator: Navigator;
|
|
292
|
+
export interface TestController {}
|
|
291
293
|
export interface ExecutionContext {
|
|
292
294
|
waitUntil(promise: Promise<any>): void;
|
|
293
295
|
passThroughOnException(): void;
|
|
294
296
|
}
|
|
295
|
-
export type ExportedHandlerFetchHandler<
|
|
296
|
-
|
|
297
|
+
export type ExportedHandlerFetchHandler<
|
|
298
|
+
Env = unknown,
|
|
299
|
+
CfHostMetadata = unknown
|
|
300
|
+
> = (
|
|
301
|
+
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
297
302
|
env: Env,
|
|
298
303
|
ctx: ExecutionContext
|
|
299
304
|
) => Response | Promise<Response>;
|
|
@@ -312,11 +317,21 @@ export type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
|
|
|
312
317
|
env: Env,
|
|
313
318
|
ctx: ExecutionContext
|
|
314
319
|
) => void | Promise<void>;
|
|
315
|
-
export
|
|
316
|
-
|
|
320
|
+
export type ExportedHandlerTestHandler<Env = unknown> = (
|
|
321
|
+
controller: TestController,
|
|
322
|
+
env: Env,
|
|
323
|
+
ctx: ExecutionContext
|
|
324
|
+
) => void | Promise<void>;
|
|
325
|
+
export interface ExportedHandler<
|
|
326
|
+
Env = unknown,
|
|
327
|
+
QueueMessage = unknown,
|
|
328
|
+
CfHostMetadata = unknown
|
|
329
|
+
> {
|
|
330
|
+
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
317
331
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
318
332
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
319
|
-
|
|
333
|
+
test?: ExportedHandlerTestHandler<Env>;
|
|
334
|
+
queue?: ExportedHandlerQueueHandler<Env, Message>;
|
|
320
335
|
}
|
|
321
336
|
export interface StructuredSerializeOptions {
|
|
322
337
|
transfer?: any[];
|
|
@@ -351,13 +366,28 @@ export interface DurableObjectNamespace {
|
|
|
351
366
|
id: DurableObjectId,
|
|
352
367
|
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
353
368
|
): DurableObjectStub;
|
|
354
|
-
|
|
369
|
+
getExisting(
|
|
370
|
+
id: DurableObjectId,
|
|
371
|
+
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
372
|
+
): DurableObjectStub;
|
|
373
|
+
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
|
|
355
374
|
}
|
|
375
|
+
export type DurableObjectJurisdiction = "eu" | "fedramp";
|
|
356
376
|
export interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
357
|
-
jurisdiction?:
|
|
358
|
-
}
|
|
377
|
+
jurisdiction?: DurableObjectJurisdiction;
|
|
378
|
+
}
|
|
379
|
+
export type DurableObjectLocationHint =
|
|
380
|
+
| "wnam"
|
|
381
|
+
| "enam"
|
|
382
|
+
| "sam"
|
|
383
|
+
| "weur"
|
|
384
|
+
| "eeur"
|
|
385
|
+
| "apac"
|
|
386
|
+
| "oc"
|
|
387
|
+
| "afr"
|
|
388
|
+
| "me";
|
|
359
389
|
export interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
360
|
-
locationHint?:
|
|
390
|
+
locationHint?: DurableObjectLocationHint;
|
|
361
391
|
}
|
|
362
392
|
export interface DurableObjectState {
|
|
363
393
|
waitUntil(promise: Promise<any>): void;
|
|
@@ -430,6 +460,7 @@ export interface DurableObjectStorage {
|
|
|
430
460
|
): Promise<void>;
|
|
431
461
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
432
462
|
sync(): Promise<void>;
|
|
463
|
+
sql: SqlStorage;
|
|
433
464
|
}
|
|
434
465
|
export interface DurableObjectListOptions {
|
|
435
466
|
start?: string;
|
|
@@ -988,23 +1019,27 @@ export interface ResponseInit {
|
|
|
988
1019
|
webSocket?: WebSocket | null;
|
|
989
1020
|
encodeBody?: "automatic" | "manual";
|
|
990
1021
|
}
|
|
991
|
-
export type RequestInfo
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
1022
|
+
export type RequestInfo<
|
|
1023
|
+
CfHostMetadata = unknown,
|
|
1024
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1025
|
+
> = Request<CfHostMetadata, Cf> | string | URL;
|
|
1026
|
+
export declare class Request<
|
|
1027
|
+
CfHostMetadata = unknown,
|
|
1028
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1029
|
+
> extends Body {
|
|
1030
|
+
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1031
|
+
clone(): Request<CfHostMetadata, Cf>;
|
|
995
1032
|
get method(): string;
|
|
996
1033
|
get url(): string;
|
|
997
1034
|
get headers(): Headers;
|
|
998
1035
|
get redirect(): string;
|
|
999
1036
|
get fetcher(): Fetcher | null;
|
|
1000
1037
|
get signal(): AbortSignal;
|
|
1001
|
-
get cf():
|
|
1038
|
+
get cf(): Cf | undefined;
|
|
1002
1039
|
get integrity(): string;
|
|
1003
1040
|
get keepalive(): boolean;
|
|
1004
1041
|
}
|
|
1005
|
-
export interface RequestInit<
|
|
1006
|
-
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
1007
|
-
> {
|
|
1042
|
+
export interface RequestInit<Cf = CfProperties> {
|
|
1008
1043
|
/** A string to set request's method. */
|
|
1009
1044
|
method?: string;
|
|
1010
1045
|
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
@@ -1014,22 +1049,29 @@ export interface RequestInit<
|
|
|
1014
1049
|
/** 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
1050
|
redirect?: string;
|
|
1016
1051
|
fetcher?: Fetcher | null;
|
|
1017
|
-
cf?:
|
|
1052
|
+
cf?: Cf;
|
|
1018
1053
|
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1019
1054
|
integrity?: string;
|
|
1020
1055
|
/** An AbortSignal to set request's signal. */
|
|
1021
1056
|
signal?: AbortSignal | null;
|
|
1022
1057
|
}
|
|
1023
1058
|
export declare abstract class Fetcher {
|
|
1024
|
-
fetch(
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1059
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1060
|
+
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1061
|
+
queue(
|
|
1062
|
+
queueName: string,
|
|
1063
|
+
messages: ServiceBindingQueueMessage[]
|
|
1064
|
+
): Promise<QueueResponse>;
|
|
1028
1065
|
}
|
|
1029
1066
|
export interface FetcherPutOptions {
|
|
1030
1067
|
expiration?: number;
|
|
1031
1068
|
expirationTtl?: number;
|
|
1032
1069
|
}
|
|
1070
|
+
export interface ServiceBindingQueueMessage<Body = unknown> {
|
|
1071
|
+
id: string;
|
|
1072
|
+
timestamp: Date;
|
|
1073
|
+
body: Body;
|
|
1074
|
+
}
|
|
1033
1075
|
export interface KVNamespaceListKey<Metadata, Key extends string = string> {
|
|
1034
1076
|
name: Key;
|
|
1035
1077
|
expiration?: number;
|
|
@@ -1137,6 +1179,40 @@ export interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1137
1179
|
value: Value | null;
|
|
1138
1180
|
metadata: Metadata | null;
|
|
1139
1181
|
}
|
|
1182
|
+
export interface Queue<Body> {
|
|
1183
|
+
send(message: Body): Promise<void>;
|
|
1184
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1185
|
+
}
|
|
1186
|
+
export interface QueueSendOptions {}
|
|
1187
|
+
export interface MessageSendRequest<Body = unknown> {
|
|
1188
|
+
body: Body;
|
|
1189
|
+
}
|
|
1190
|
+
export interface QueueResponse {
|
|
1191
|
+
outcome: number;
|
|
1192
|
+
retryAll: boolean;
|
|
1193
|
+
ackAll: boolean;
|
|
1194
|
+
explicitRetries: string[];
|
|
1195
|
+
explicitAcks: string[];
|
|
1196
|
+
}
|
|
1197
|
+
export interface Message<Body = unknown> {
|
|
1198
|
+
readonly id: string;
|
|
1199
|
+
readonly timestamp: Date;
|
|
1200
|
+
readonly body: Body;
|
|
1201
|
+
retry(): void;
|
|
1202
|
+
ack(): void;
|
|
1203
|
+
}
|
|
1204
|
+
export interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1205
|
+
readonly messages: readonly Message<Body>[];
|
|
1206
|
+
readonly queue: string;
|
|
1207
|
+
retryAll(): void;
|
|
1208
|
+
ackAll(): void;
|
|
1209
|
+
}
|
|
1210
|
+
export interface MessageBatch<Body = unknown> {
|
|
1211
|
+
readonly messages: readonly Message<Body>[];
|
|
1212
|
+
readonly queue: string;
|
|
1213
|
+
retryAll(): void;
|
|
1214
|
+
ackAll(): void;
|
|
1215
|
+
}
|
|
1140
1216
|
export interface R2Error extends Error {
|
|
1141
1217
|
readonly name: string;
|
|
1142
1218
|
readonly code: number;
|
|
@@ -1288,12 +1364,18 @@ export interface R2HTTPMetadata {
|
|
|
1288
1364
|
cacheControl?: string;
|
|
1289
1365
|
cacheExpiry?: Date;
|
|
1290
1366
|
}
|
|
1291
|
-
export
|
|
1367
|
+
export type R2Objects = {
|
|
1292
1368
|
objects: R2Object[];
|
|
1293
|
-
truncated: boolean;
|
|
1294
|
-
cursor?: string;
|
|
1295
1369
|
delimitedPrefixes: string[];
|
|
1296
|
-
}
|
|
1370
|
+
} & (
|
|
1371
|
+
| {
|
|
1372
|
+
truncated: true;
|
|
1373
|
+
cursor: string;
|
|
1374
|
+
}
|
|
1375
|
+
| {
|
|
1376
|
+
truncated: false;
|
|
1377
|
+
}
|
|
1378
|
+
);
|
|
1297
1379
|
export declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1298
1380
|
readonly scheduledTime: number;
|
|
1299
1381
|
readonly cron: string;
|
|
@@ -1503,13 +1585,19 @@ export declare class TransformStream<I = any, O = any> {
|
|
|
1503
1585
|
get writable(): WritableStream<I>;
|
|
1504
1586
|
}
|
|
1505
1587
|
export declare class FixedLengthStream extends IdentityTransformStream {
|
|
1506
|
-
constructor(
|
|
1588
|
+
constructor(
|
|
1589
|
+
expectedLength: number | bigint,
|
|
1590
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy
|
|
1591
|
+
);
|
|
1507
1592
|
}
|
|
1508
1593
|
export declare class IdentityTransformStream extends TransformStream<
|
|
1509
1594
|
ArrayBuffer | ArrayBufferView,
|
|
1510
1595
|
Uint8Array
|
|
1511
1596
|
> {
|
|
1512
|
-
constructor();
|
|
1597
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
1598
|
+
}
|
|
1599
|
+
export interface IdentityTransformStreamQueuingStrategy {
|
|
1600
|
+
highWaterMark?: number | bigint;
|
|
1513
1601
|
}
|
|
1514
1602
|
export interface ReadableStreamValuesOptions {
|
|
1515
1603
|
preventCancel?: boolean;
|
|
@@ -1518,13 +1606,13 @@ export declare class CompressionStream extends TransformStream<
|
|
|
1518
1606
|
ArrayBuffer | ArrayBufferView,
|
|
1519
1607
|
Uint8Array
|
|
1520
1608
|
> {
|
|
1521
|
-
constructor(format: "gzip" | "deflate");
|
|
1609
|
+
constructor(format: "gzip" | "deflate" | "deflate-raw");
|
|
1522
1610
|
}
|
|
1523
1611
|
export declare class DecompressionStream extends TransformStream<
|
|
1524
1612
|
ArrayBuffer | ArrayBufferView,
|
|
1525
1613
|
Uint8Array
|
|
1526
1614
|
> {
|
|
1527
|
-
constructor(format: "gzip" | "deflate");
|
|
1615
|
+
constructor(format: "gzip" | "deflate" | "deflate-raw");
|
|
1528
1616
|
}
|
|
1529
1617
|
export declare class TextEncoderStream extends TransformStream<
|
|
1530
1618
|
string,
|
|
@@ -1657,11 +1745,13 @@ export declare class URL {
|
|
|
1657
1745
|
get searchParams(): URLSearchParams;
|
|
1658
1746
|
toJSON(): string;
|
|
1659
1747
|
toString(): string;
|
|
1748
|
+
static canParse(url: string, base?: string): boolean;
|
|
1660
1749
|
}
|
|
1661
1750
|
export declare class URLSearchParams {
|
|
1662
1751
|
constructor(
|
|
1663
1752
|
init?: Iterable<Iterable<string>> | Record<string, string> | string
|
|
1664
1753
|
);
|
|
1754
|
+
get size(): number;
|
|
1665
1755
|
append(name: string, value: string): void;
|
|
1666
1756
|
delete(name: string): void;
|
|
1667
1757
|
get(name: string): string | null;
|
|
@@ -1781,6 +1871,37 @@ export declare const WebSocketPair: {
|
|
|
1781
1871
|
1: WebSocket;
|
|
1782
1872
|
};
|
|
1783
1873
|
};
|
|
1874
|
+
export interface SqlStorage {
|
|
1875
|
+
exec(query: string, ...bindings: any[]): SqlStorageCursor;
|
|
1876
|
+
prepare(query: string): SqlStorageStatement;
|
|
1877
|
+
Cursor: typeof SqlStorageCursor;
|
|
1878
|
+
Statement: typeof SqlStorageStatement;
|
|
1879
|
+
}
|
|
1880
|
+
export declare abstract class SqlStorageStatement {}
|
|
1881
|
+
export declare abstract class SqlStorageCursor {
|
|
1882
|
+
raw(): IterableIterator<((ArrayBuffer | string | number) | null)[]>;
|
|
1883
|
+
[Symbol.iterator](): IterableIterator<
|
|
1884
|
+
Record<string, (ArrayBuffer | string | number) | null>
|
|
1885
|
+
>;
|
|
1886
|
+
}
|
|
1887
|
+
export interface Socket {
|
|
1888
|
+
get readable(): ReadableStream;
|
|
1889
|
+
get writable(): WritableStream;
|
|
1890
|
+
get closed(): Promise<void>;
|
|
1891
|
+
close(): Promise<void>;
|
|
1892
|
+
startTls(options?: TlsOptions): Socket;
|
|
1893
|
+
}
|
|
1894
|
+
export interface SocketOptions {
|
|
1895
|
+
secureTransport?: string;
|
|
1896
|
+
allowHalfOpen: boolean;
|
|
1897
|
+
}
|
|
1898
|
+
export interface SocketAddress {
|
|
1899
|
+
hostname: string;
|
|
1900
|
+
port: number;
|
|
1901
|
+
}
|
|
1902
|
+
export interface TlsOptions {
|
|
1903
|
+
expectedServerHostname?: string;
|
|
1904
|
+
}
|
|
1784
1905
|
export interface BasicImageTransformations {
|
|
1785
1906
|
/**
|
|
1786
1907
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -1860,7 +1981,7 @@ export interface BasicImageTransformationsGravityCoordinates {
|
|
|
1860
1981
|
* Note: Currently, these properties cannot be tested in the
|
|
1861
1982
|
* playground.
|
|
1862
1983
|
*/
|
|
1863
|
-
export interface RequestInitCfProperties {
|
|
1984
|
+
export interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1864
1985
|
cacheEverything?: boolean;
|
|
1865
1986
|
/**
|
|
1866
1987
|
* A request's cache key is what determines if two requests are
|
|
@@ -2030,6 +2151,49 @@ export interface RequestInitCfPropertiesImage
|
|
|
2030
2151
|
* the origin.
|
|
2031
2152
|
*/
|
|
2032
2153
|
"origin-auth"?: "share-publicly";
|
|
2154
|
+
/**
|
|
2155
|
+
* Adds a border around the image. The border is added after resizing. Border
|
|
2156
|
+
* width takes dpr into account, and can be specified either using a single
|
|
2157
|
+
* width property, or individually for each side.
|
|
2158
|
+
*/
|
|
2159
|
+
border?:
|
|
2160
|
+
| {
|
|
2161
|
+
color: string;
|
|
2162
|
+
width: number;
|
|
2163
|
+
}
|
|
2164
|
+
| {
|
|
2165
|
+
color: string;
|
|
2166
|
+
top: number;
|
|
2167
|
+
right: number;
|
|
2168
|
+
bottom: number;
|
|
2169
|
+
left: number;
|
|
2170
|
+
};
|
|
2171
|
+
/**
|
|
2172
|
+
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
2173
|
+
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
2174
|
+
* 0 is ignored.
|
|
2175
|
+
*/
|
|
2176
|
+
brightness?: number;
|
|
2177
|
+
/**
|
|
2178
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
2179
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
2180
|
+
* ignored.
|
|
2181
|
+
*/
|
|
2182
|
+
contrast?: number;
|
|
2183
|
+
/**
|
|
2184
|
+
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
2185
|
+
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
2186
|
+
*/
|
|
2187
|
+
gamma?: number;
|
|
2188
|
+
/**
|
|
2189
|
+
* Slightly reduces latency on a cache miss by selecting a
|
|
2190
|
+
* quickest-to-compress file format, at a cost of increased file size and
|
|
2191
|
+
* lower image quality. It will usually override the format option and choose
|
|
2192
|
+
* JPEG over WebP or AVIF. We do not recommend using this option, except in
|
|
2193
|
+
* unusual circumstances like resizing uncacheable dynamically-generated
|
|
2194
|
+
* images.
|
|
2195
|
+
*/
|
|
2196
|
+
compression?: "fast";
|
|
2033
2197
|
}
|
|
2034
2198
|
export interface RequestInitCfPropertiesImageMinify {
|
|
2035
2199
|
javascript?: boolean;
|
|
@@ -2045,7 +2209,8 @@ export type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2045
2209
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2046
2210
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2047
2211
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2048
|
-
export interface IncomingRequestCfPropertiesBase
|
|
2212
|
+
export interface IncomingRequestCfPropertiesBase
|
|
2213
|
+
extends Record<string, unknown> {
|
|
2049
2214
|
/**
|
|
2050
2215
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2051
2216
|
*
|
|
@@ -2126,8 +2291,7 @@ export interface IncomingRequestCfPropertiesBase {
|
|
|
2126
2291
|
export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2127
2292
|
/**
|
|
2128
2293
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2129
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2130
|
-
* and `99` (almost certainly a bot).
|
|
2294
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2131
2295
|
*
|
|
2132
2296
|
* @example 54
|
|
2133
2297
|
*/
|
|
@@ -2146,6 +2310,10 @@ export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
|
2146
2310
|
* A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources.
|
|
2147
2311
|
*/
|
|
2148
2312
|
staticResource: boolean;
|
|
2313
|
+
/**
|
|
2314
|
+
* List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request).
|
|
2315
|
+
*/
|
|
2316
|
+
detectionIds: number[];
|
|
2149
2317
|
}
|
|
2150
2318
|
export interface IncomingRequestCfPropertiesBotManagement {
|
|
2151
2319
|
/**
|
|
@@ -2234,86 +2402,82 @@ export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2234
2402
|
/**
|
|
2235
2403
|
* Geographic data about the request's origin.
|
|
2236
2404
|
*/
|
|
2237
|
-
export
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
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
|
-
* @example "635"
|
|
2314
|
-
*/
|
|
2315
|
-
metroCode?: string;
|
|
2316
|
-
};
|
|
2405
|
+
export interface IncomingRequestCfPropertiesGeographicInformation {
|
|
2406
|
+
/**
|
|
2407
|
+
* The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
|
|
2408
|
+
*
|
|
2409
|
+
* 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.
|
|
2410
|
+
*
|
|
2411
|
+
* If Cloudflare is unable to determine where the request originated this property is omitted.
|
|
2412
|
+
*
|
|
2413
|
+
* The country code `"T1"` is used for requests originating on TOR.
|
|
2414
|
+
*
|
|
2415
|
+
* @example "GB"
|
|
2416
|
+
*/
|
|
2417
|
+
country?: Iso3166Alpha2Code | "T1";
|
|
2418
|
+
/**
|
|
2419
|
+
* If present, this property indicates that the request originated in the EU
|
|
2420
|
+
*
|
|
2421
|
+
* @example "1"
|
|
2422
|
+
*/
|
|
2423
|
+
isEUCountry?: "1";
|
|
2424
|
+
/**
|
|
2425
|
+
* A two-letter code indicating the continent the request originated from.
|
|
2426
|
+
*
|
|
2427
|
+
* @example "AN"
|
|
2428
|
+
*/
|
|
2429
|
+
continent?: ContinentCode;
|
|
2430
|
+
/**
|
|
2431
|
+
* The city the request originated from
|
|
2432
|
+
*
|
|
2433
|
+
* @example "Austin"
|
|
2434
|
+
*/
|
|
2435
|
+
city?: string;
|
|
2436
|
+
/**
|
|
2437
|
+
* Postal code of the incoming request
|
|
2438
|
+
*
|
|
2439
|
+
* @example "78701"
|
|
2440
|
+
*/
|
|
2441
|
+
postalCode?: string;
|
|
2442
|
+
/**
|
|
2443
|
+
* Latitude of the incoming request
|
|
2444
|
+
*
|
|
2445
|
+
* @example "30.27130"
|
|
2446
|
+
*/
|
|
2447
|
+
latitude?: string;
|
|
2448
|
+
/**
|
|
2449
|
+
* Longitude of the incoming request
|
|
2450
|
+
*
|
|
2451
|
+
* @example "-97.74260"
|
|
2452
|
+
*/
|
|
2453
|
+
longitude?: string;
|
|
2454
|
+
/**
|
|
2455
|
+
* Timezone of the incoming request
|
|
2456
|
+
*
|
|
2457
|
+
* @example "America/Chicago"
|
|
2458
|
+
*/
|
|
2459
|
+
timezone?: string;
|
|
2460
|
+
/**
|
|
2461
|
+
* If known, the ISO 3166-2 name for the first level region associated with
|
|
2462
|
+
* the IP address of the incoming request
|
|
2463
|
+
*
|
|
2464
|
+
* @example "Texas"
|
|
2465
|
+
*/
|
|
2466
|
+
region?: string;
|
|
2467
|
+
/**
|
|
2468
|
+
* If known, the ISO 3166-2 code for the first-level region associated with
|
|
2469
|
+
* the IP address of the incoming request
|
|
2470
|
+
*
|
|
2471
|
+
* @example "TX"
|
|
2472
|
+
*/
|
|
2473
|
+
regionCode?: string;
|
|
2474
|
+
/**
|
|
2475
|
+
* Metro code (DMA) of the incoming request
|
|
2476
|
+
*
|
|
2477
|
+
* @example "635"
|
|
2478
|
+
*/
|
|
2479
|
+
metroCode?: string;
|
|
2480
|
+
}
|
|
2317
2481
|
/** Data about the incoming request's TLS certificate */
|
|
2318
2482
|
export interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2319
2483
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2706,6 +2870,9 @@ export type Iso3166Alpha2Code =
|
|
|
2706
2870
|
| "ZW";
|
|
2707
2871
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2708
2872
|
export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2873
|
+
export type CfProperties<HostMetadata = unknown> =
|
|
2874
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2875
|
+
| RequestInitCfProperties;
|
|
2709
2876
|
export interface D1Result<T = unknown> {
|
|
2710
2877
|
results?: T[];
|
|
2711
2878
|
success: boolean;
|
|
@@ -2726,9 +2893,9 @@ export declare abstract class D1PreparedStatement {
|
|
|
2726
2893
|
raw<T = unknown>(): Promise<T[]>;
|
|
2727
2894
|
}
|
|
2728
2895
|
/**
|
|
2729
|
-
*
|
|
2896
|
+
* An email message that can be sent from a Worker.
|
|
2730
2897
|
*/
|
|
2731
|
-
export interface EmailMessage
|
|
2898
|
+
export interface EmailMessage {
|
|
2732
2899
|
/**
|
|
2733
2900
|
* Envelope From attribute of the email message.
|
|
2734
2901
|
*/
|
|
@@ -2737,14 +2904,19 @@ export interface EmailMessage<Body = unknown> {
|
|
|
2737
2904
|
* Envelope To attribute of the email message.
|
|
2738
2905
|
*/
|
|
2739
2906
|
readonly to: string;
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2907
|
+
}
|
|
2908
|
+
/**
|
|
2909
|
+
* An email message that is sent to a consumer Worker and can be rejected/forwarded.
|
|
2910
|
+
*/
|
|
2911
|
+
export interface ForwardableEmailMessage extends EmailMessage {
|
|
2744
2912
|
/**
|
|
2745
2913
|
* Stream of the email message content.
|
|
2746
2914
|
*/
|
|
2747
2915
|
readonly raw: ReadableStream;
|
|
2916
|
+
/**
|
|
2917
|
+
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2918
|
+
*/
|
|
2919
|
+
readonly headers: Headers;
|
|
2748
2920
|
/**
|
|
2749
2921
|
* Size of the email message content.
|
|
2750
2922
|
*/
|
|
@@ -2763,11 +2935,17 @@ export interface EmailMessage<Body = unknown> {
|
|
|
2763
2935
|
*/
|
|
2764
2936
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2765
2937
|
}
|
|
2938
|
+
/**
|
|
2939
|
+
* A binding that allows a Worker to send email messages.
|
|
2940
|
+
*/
|
|
2941
|
+
export interface SendEmail {
|
|
2942
|
+
send(message: EmailMessage): Promise<void>;
|
|
2943
|
+
}
|
|
2766
2944
|
export declare abstract class EmailEvent extends ExtendableEvent {
|
|
2767
|
-
readonly message:
|
|
2945
|
+
readonly message: ForwardableEmailMessage;
|
|
2768
2946
|
}
|
|
2769
2947
|
export type EmailExportedHandler<Env = unknown> = (
|
|
2770
|
-
message:
|
|
2948
|
+
message: ForwardableEmailMessage,
|
|
2771
2949
|
env: Env,
|
|
2772
2950
|
ctx: ExecutionContext
|
|
2773
2951
|
) => void | Promise<void>;
|
|
@@ -2848,75 +3026,12 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2848
3026
|
// Key Identifier of the JWK
|
|
2849
3027
|
readonly kid: string;
|
|
2850
3028
|
}
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
*/
|
|
2854
|
-
export interface Message<Body = unknown> {
|
|
2855
|
-
/**
|
|
2856
|
-
* A unique, system-generated ID for the message.
|
|
2857
|
-
*/
|
|
2858
|
-
readonly id: string;
|
|
2859
|
-
/**
|
|
2860
|
-
* A timestamp when the message was sent.
|
|
2861
|
-
*/
|
|
2862
|
-
readonly timestamp: Date;
|
|
2863
|
-
/**
|
|
2864
|
-
* The body of the message.
|
|
2865
|
-
*/
|
|
2866
|
-
readonly body: Body;
|
|
2867
|
-
/**
|
|
2868
|
-
* Marks message to be retried.
|
|
2869
|
-
*/
|
|
2870
|
-
retry(): void;
|
|
2871
|
-
/**
|
|
2872
|
-
* Marks message acknowledged.
|
|
2873
|
-
*/
|
|
2874
|
-
ack(): void;
|
|
2875
|
-
}
|
|
2876
|
-
/**
|
|
2877
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2878
|
-
*/
|
|
2879
|
-
export interface MessageBatch<Body = unknown> {
|
|
3029
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3030
|
+
export interface DispatchNamespace {
|
|
2880
3031
|
/**
|
|
2881
|
-
*
|
|
3032
|
+
* @param name Name of the Worker script.
|
|
3033
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
3034
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2882
3035
|
*/
|
|
2883
|
-
|
|
2884
|
-
/**
|
|
2885
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2886
|
-
*/
|
|
2887
|
-
readonly messages: readonly Message<Body>[];
|
|
2888
|
-
/**
|
|
2889
|
-
* Marks every message to be retried in the next batch.
|
|
2890
|
-
*/
|
|
2891
|
-
retryAll(): void;
|
|
2892
|
-
/**
|
|
2893
|
-
* Marks every message acknowledged in the batch.
|
|
2894
|
-
*/
|
|
2895
|
-
ackAll(): void;
|
|
2896
|
-
}
|
|
2897
|
-
/**
|
|
2898
|
-
* A wrapper class used to structure message batches.
|
|
2899
|
-
*/
|
|
2900
|
-
export type MessageSendRequest<Body = unknown> = {
|
|
2901
|
-
/**
|
|
2902
|
-
* The body of the message.
|
|
2903
|
-
*/
|
|
2904
|
-
body: Body;
|
|
2905
|
-
};
|
|
2906
|
-
/**
|
|
2907
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
2908
|
-
*/
|
|
2909
|
-
export interface Queue<Body = any> {
|
|
2910
|
-
/**
|
|
2911
|
-
* Sends a message to the Queue.
|
|
2912
|
-
* @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB.
|
|
2913
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2914
|
-
*/
|
|
2915
|
-
send(message: Body): Promise<void>;
|
|
2916
|
-
/**
|
|
2917
|
-
* Sends a batch of messages to the Queue.
|
|
2918
|
-
* @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB.
|
|
2919
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2920
|
-
*/
|
|
2921
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
3036
|
+
get(name: string): Fetcher;
|
|
2922
3037
|
}
|