@cloudflare/workers-types 0.20230307.0 → 0.20230512.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 +288 -190
- package/2021-11-03/index.ts +281 -190
- package/2022-01-31/index.d.ts +288 -190
- package/2022-01-31/index.ts +281 -190
- package/2022-03-21/index.d.ts +288 -190
- package/2022-03-21/index.ts +281 -190
- package/2022-08-04/index.d.ts +288 -190
- package/2022-08-04/index.ts +281 -190
- package/2022-10-31/index.d.ts +291 -192
- package/2022-10-31/index.ts +284 -192
- package/2022-11-30/index.d.ts +291 -192
- package/2022-11-30/index.ts +284 -192
- package/README.md +1 -1
- package/experimental/index.d.ts +329 -192
- package/experimental/index.ts +322 -192
- package/index.d.ts +288 -190
- package/index.ts +281 -190
- package/oldest/index.d.ts +288 -190
- package/oldest/index.ts +281 -190
- package/package.json +1 -1
package/2021-11-03/index.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ declare class DOMException extends Error {
|
|
|
49
49
|
declare type WorkerGlobalScopeEventMap = {
|
|
50
50
|
fetch: FetchEvent;
|
|
51
51
|
scheduled: ScheduledEvent;
|
|
52
|
+
queue: QueueEvent;
|
|
52
53
|
unhandledrejection: PromiseRejectionEvent;
|
|
53
54
|
rejectionhandled: PromiseRejectionEvent;
|
|
54
55
|
};
|
|
@@ -183,11 +184,14 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
183
184
|
crypto: Crypto;
|
|
184
185
|
caches: CacheStorage;
|
|
185
186
|
scheduler: Scheduler;
|
|
187
|
+
performance: Performance;
|
|
188
|
+
readonly origin: string;
|
|
186
189
|
Event: typeof Event;
|
|
187
190
|
ExtendableEvent: typeof ExtendableEvent;
|
|
188
191
|
PromiseRejectionEvent: typeof PromiseRejectionEvent;
|
|
189
192
|
FetchEvent: typeof FetchEvent;
|
|
190
|
-
|
|
193
|
+
TailEvent: typeof TailEvent;
|
|
194
|
+
TraceEvent: typeof TailEvent;
|
|
191
195
|
ScheduledEvent: typeof ScheduledEvent;
|
|
192
196
|
MessageEvent: typeof MessageEvent;
|
|
193
197
|
CloseEvent: typeof CloseEvent;
|
|
@@ -279,16 +283,26 @@ declare const self: ServiceWorkerGlobalScope;
|
|
|
279
283
|
declare const crypto: Crypto;
|
|
280
284
|
declare const caches: CacheStorage;
|
|
281
285
|
declare const scheduler: Scheduler;
|
|
286
|
+
declare const performance: Performance;
|
|
287
|
+
declare const origin: string;
|
|
282
288
|
declare interface TestController {}
|
|
283
289
|
declare interface ExecutionContext {
|
|
284
290
|
waitUntil(promise: Promise<any>): void;
|
|
285
291
|
passThroughOnException(): void;
|
|
286
292
|
}
|
|
287
|
-
declare type ExportedHandlerFetchHandler<
|
|
288
|
-
|
|
293
|
+
declare type ExportedHandlerFetchHandler<
|
|
294
|
+
Env = unknown,
|
|
295
|
+
CfHostMetadata = unknown
|
|
296
|
+
> = (
|
|
297
|
+
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
289
298
|
env: Env,
|
|
290
299
|
ctx: ExecutionContext
|
|
291
300
|
) => Response | Promise<Response>;
|
|
301
|
+
declare type ExportedHandlerTailHandler<Env = unknown> = (
|
|
302
|
+
events: TraceItem[],
|
|
303
|
+
env: Env,
|
|
304
|
+
ctx: ExecutionContext
|
|
305
|
+
) => void | Promise<void>;
|
|
292
306
|
declare type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
293
307
|
traces: TraceItem[],
|
|
294
308
|
env: Env,
|
|
@@ -309,12 +323,17 @@ declare type ExportedHandlerTestHandler<Env = unknown> = (
|
|
|
309
323
|
env: Env,
|
|
310
324
|
ctx: ExecutionContext
|
|
311
325
|
) => void | Promise<void>;
|
|
312
|
-
declare interface ExportedHandler<
|
|
313
|
-
|
|
326
|
+
declare interface ExportedHandler<
|
|
327
|
+
Env = unknown,
|
|
328
|
+
QueueMessage = unknown,
|
|
329
|
+
CfHostMetadata = unknown
|
|
330
|
+
> {
|
|
331
|
+
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
332
|
+
tail?: ExportedHandlerTailHandler<Env>;
|
|
314
333
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
315
334
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
316
335
|
test?: ExportedHandlerTestHandler<Env>;
|
|
317
|
-
queue?: ExportedHandlerQueueHandler<Env,
|
|
336
|
+
queue?: ExportedHandlerQueueHandler<Env, Message>;
|
|
318
337
|
}
|
|
319
338
|
declare interface StructuredSerializeOptions {
|
|
320
339
|
transfer?: any[];
|
|
@@ -323,6 +342,11 @@ declare abstract class PromiseRejectionEvent extends Event {
|
|
|
323
342
|
readonly promise: Promise<any>;
|
|
324
343
|
readonly reason: any;
|
|
325
344
|
}
|
|
345
|
+
/** Provides access to performance-related information for the current page. It's part of the High Resolution Time API, but is enhanced by the Performance Timeline API, the Navigation Timing API, the User Timing API, and the Resource Timing API. */
|
|
346
|
+
declare interface Performance {
|
|
347
|
+
readonly timeOrigin: number;
|
|
348
|
+
now(): number;
|
|
349
|
+
}
|
|
326
350
|
declare interface DurableObject {
|
|
327
351
|
fetch(request: Request): Response | Promise<Response>;
|
|
328
352
|
alarm?(): void | Promise<void>;
|
|
@@ -346,19 +370,32 @@ declare interface DurableObjectNamespace {
|
|
|
346
370
|
id: DurableObjectId,
|
|
347
371
|
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
348
372
|
): DurableObjectStub;
|
|
349
|
-
jurisdiction(jurisdiction:
|
|
373
|
+
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
|
|
350
374
|
}
|
|
375
|
+
declare type DurableObjectJurisdiction = "eu" | "fedramp";
|
|
351
376
|
declare interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
352
|
-
jurisdiction?:
|
|
353
|
-
}
|
|
377
|
+
jurisdiction?: DurableObjectJurisdiction;
|
|
378
|
+
}
|
|
379
|
+
declare type DurableObjectLocationHint =
|
|
380
|
+
| "wnam"
|
|
381
|
+
| "enam"
|
|
382
|
+
| "sam"
|
|
383
|
+
| "weur"
|
|
384
|
+
| "eeur"
|
|
385
|
+
| "apac"
|
|
386
|
+
| "oc"
|
|
387
|
+
| "afr"
|
|
388
|
+
| "me";
|
|
354
389
|
declare interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
355
|
-
locationHint?:
|
|
390
|
+
locationHint?: DurableObjectLocationHint;
|
|
356
391
|
}
|
|
357
392
|
declare interface DurableObjectState {
|
|
358
393
|
waitUntil(promise: Promise<any>): void;
|
|
359
394
|
readonly id: DurableObjectId;
|
|
360
395
|
readonly storage: DurableObjectStorage;
|
|
361
396
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
397
|
+
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
398
|
+
getWebSockets(tag?: string): WebSocket[];
|
|
362
399
|
}
|
|
363
400
|
declare interface DurableObjectTransaction {
|
|
364
401
|
get<T = unknown>(
|
|
@@ -425,6 +462,7 @@ declare interface DurableObjectStorage {
|
|
|
425
462
|
): Promise<void>;
|
|
426
463
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
427
464
|
sync(): Promise<void>;
|
|
465
|
+
transactionSync<T>(closure: () => T): T;
|
|
428
466
|
}
|
|
429
467
|
declare interface DurableObjectListOptions {
|
|
430
468
|
start?: string;
|
|
@@ -545,6 +583,7 @@ declare class AbortController {
|
|
|
545
583
|
declare abstract class AbortSignal extends EventTarget {
|
|
546
584
|
static abort(reason?: any): AbortSignal;
|
|
547
585
|
static timeout(delay: number): AbortSignal;
|
|
586
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
548
587
|
/** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */
|
|
549
588
|
readonly aborted: boolean;
|
|
550
589
|
readonly reason: any;
|
|
@@ -995,10 +1034,16 @@ declare interface ResponseInit {
|
|
|
995
1034
|
webSocket?: WebSocket | null;
|
|
996
1035
|
encodeBody?: "automatic" | "manual";
|
|
997
1036
|
}
|
|
998
|
-
declare type RequestInfo
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1037
|
+
declare type RequestInfo<
|
|
1038
|
+
CfHostMetadata = unknown,
|
|
1039
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1040
|
+
> = Request<CfHostMetadata, Cf> | string | URL;
|
|
1041
|
+
declare class Request<
|
|
1042
|
+
CfHostMetadata = unknown,
|
|
1043
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1044
|
+
> extends Body {
|
|
1045
|
+
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1046
|
+
clone(): Request<CfHostMetadata, Cf>;
|
|
1002
1047
|
/** Returns request's HTTP method, which is "GET" by default. */
|
|
1003
1048
|
readonly method: string;
|
|
1004
1049
|
/** Returns the URL of request as a string. */
|
|
@@ -1010,15 +1055,13 @@ declare class Request<CfHostMetadata = unknown> extends Body {
|
|
|
1010
1055
|
readonly fetcher: Fetcher | null;
|
|
1011
1056
|
/** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. */
|
|
1012
1057
|
readonly signal: AbortSignal;
|
|
1013
|
-
readonly cf?:
|
|
1058
|
+
readonly cf?: Cf;
|
|
1014
1059
|
/** Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI] */
|
|
1015
1060
|
readonly integrity: string;
|
|
1016
1061
|
/** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
|
|
1017
1062
|
readonly keepalive: boolean;
|
|
1018
1063
|
}
|
|
1019
|
-
declare interface RequestInit<
|
|
1020
|
-
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
1021
|
-
> {
|
|
1064
|
+
declare interface RequestInit<Cf = CfProperties> {
|
|
1022
1065
|
/** A string to set request's method. */
|
|
1023
1066
|
method?: string;
|
|
1024
1067
|
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
@@ -1028,17 +1071,15 @@ declare interface RequestInit<
|
|
|
1028
1071
|
/** 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. */
|
|
1029
1072
|
redirect?: string;
|
|
1030
1073
|
fetcher?: Fetcher | null;
|
|
1031
|
-
cf?:
|
|
1074
|
+
cf?: Cf;
|
|
1032
1075
|
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1033
1076
|
integrity?: string;
|
|
1034
1077
|
/** An AbortSignal to set request's signal. */
|
|
1035
1078
|
signal?: AbortSignal | null;
|
|
1036
1079
|
}
|
|
1037
1080
|
declare abstract class Fetcher {
|
|
1038
|
-
fetch(
|
|
1039
|
-
|
|
1040
|
-
init?: RequestInit<RequestInitCfProperties>
|
|
1041
|
-
): Promise<Response>;
|
|
1081
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1082
|
+
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1042
1083
|
}
|
|
1043
1084
|
declare interface FetcherPutOptions {
|
|
1044
1085
|
expiration?: number;
|
|
@@ -1151,6 +1192,33 @@ declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1151
1192
|
value: Value | null;
|
|
1152
1193
|
metadata: Metadata | null;
|
|
1153
1194
|
}
|
|
1195
|
+
declare interface Queue<Body> {
|
|
1196
|
+
send(message: Body): Promise<void>;
|
|
1197
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1198
|
+
}
|
|
1199
|
+
declare interface QueueSendOptions {}
|
|
1200
|
+
declare interface MessageSendRequest<Body = unknown> {
|
|
1201
|
+
body: Body;
|
|
1202
|
+
}
|
|
1203
|
+
declare interface Message<Body = unknown> {
|
|
1204
|
+
readonly id: string;
|
|
1205
|
+
readonly timestamp: Date;
|
|
1206
|
+
readonly body: Body;
|
|
1207
|
+
retry(): void;
|
|
1208
|
+
ack(): void;
|
|
1209
|
+
}
|
|
1210
|
+
declare interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1211
|
+
readonly messages: readonly Message<Body>[];
|
|
1212
|
+
readonly queue: string;
|
|
1213
|
+
retryAll(): void;
|
|
1214
|
+
ackAll(): void;
|
|
1215
|
+
}
|
|
1216
|
+
declare interface MessageBatch<Body = unknown> {
|
|
1217
|
+
readonly messages: readonly Message<Body>[];
|
|
1218
|
+
readonly queue: string;
|
|
1219
|
+
retryAll(): void;
|
|
1220
|
+
ackAll(): void;
|
|
1221
|
+
}
|
|
1154
1222
|
declare interface R2Error extends Error {
|
|
1155
1223
|
readonly name: string;
|
|
1156
1224
|
readonly code: number;
|
|
@@ -1301,12 +1369,18 @@ declare interface R2HTTPMetadata {
|
|
|
1301
1369
|
cacheControl?: string;
|
|
1302
1370
|
cacheExpiry?: Date;
|
|
1303
1371
|
}
|
|
1304
|
-
declare
|
|
1372
|
+
declare type R2Objects = {
|
|
1305
1373
|
objects: R2Object[];
|
|
1306
|
-
truncated: boolean;
|
|
1307
|
-
cursor?: string;
|
|
1308
1374
|
delimitedPrefixes: string[];
|
|
1309
|
-
}
|
|
1375
|
+
} & (
|
|
1376
|
+
| {
|
|
1377
|
+
truncated: true;
|
|
1378
|
+
cursor: string;
|
|
1379
|
+
}
|
|
1380
|
+
| {
|
|
1381
|
+
truncated: false;
|
|
1382
|
+
}
|
|
1383
|
+
);
|
|
1310
1384
|
declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1311
1385
|
readonly scheduledTime: number;
|
|
1312
1386
|
readonly cron: string;
|
|
@@ -1517,13 +1591,19 @@ declare class TransformStream<I = any, O = any> {
|
|
|
1517
1591
|
readonly writable: WritableStream<I>;
|
|
1518
1592
|
}
|
|
1519
1593
|
declare class FixedLengthStream extends IdentityTransformStream {
|
|
1520
|
-
constructor(
|
|
1594
|
+
constructor(
|
|
1595
|
+
expectedLength: number | bigint,
|
|
1596
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy
|
|
1597
|
+
);
|
|
1521
1598
|
}
|
|
1522
1599
|
declare class IdentityTransformStream extends TransformStream<
|
|
1523
1600
|
ArrayBuffer | ArrayBufferView,
|
|
1524
1601
|
Uint8Array
|
|
1525
1602
|
> {
|
|
1526
|
-
constructor();
|
|
1603
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
1604
|
+
}
|
|
1605
|
+
declare interface IdentityTransformStreamQueuingStrategy {
|
|
1606
|
+
highWaterMark?: number | bigint;
|
|
1527
1607
|
}
|
|
1528
1608
|
declare interface ReadableStreamValuesOptions {
|
|
1529
1609
|
preventCancel?: boolean;
|
|
@@ -1572,7 +1652,8 @@ declare interface QueuingStrategyInit {
|
|
|
1572
1652
|
*/
|
|
1573
1653
|
highWaterMark: number;
|
|
1574
1654
|
}
|
|
1575
|
-
declare abstract class
|
|
1655
|
+
declare abstract class TailEvent extends ExtendableEvent {
|
|
1656
|
+
readonly events: TraceItem[];
|
|
1576
1657
|
readonly traces: TraceItem[];
|
|
1577
1658
|
}
|
|
1578
1659
|
declare interface TraceItem {
|
|
@@ -1772,6 +1853,8 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1772
1853
|
accept(): void;
|
|
1773
1854
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1774
1855
|
close(code?: number, reason?: string): void;
|
|
1856
|
+
serializeAttachment(attachment: any): void;
|
|
1857
|
+
deserializeAttachment(): any | null;
|
|
1775
1858
|
static readonly READY_STATE_CONNECTING: number;
|
|
1776
1859
|
static readonly READY_STATE_OPEN: number;
|
|
1777
1860
|
static readonly READY_STATE_CLOSING: number;
|
|
@@ -1791,6 +1874,24 @@ declare const WebSocketPair: {
|
|
|
1791
1874
|
1: WebSocket;
|
|
1792
1875
|
};
|
|
1793
1876
|
};
|
|
1877
|
+
declare interface Socket {
|
|
1878
|
+
get readable(): ReadableStream;
|
|
1879
|
+
get writable(): WritableStream;
|
|
1880
|
+
get closed(): Promise<void>;
|
|
1881
|
+
close(): Promise<void>;
|
|
1882
|
+
startTls(options?: TlsOptions): Socket;
|
|
1883
|
+
}
|
|
1884
|
+
declare interface SocketOptions {
|
|
1885
|
+
secureTransport?: string;
|
|
1886
|
+
allowHalfOpen: boolean;
|
|
1887
|
+
}
|
|
1888
|
+
declare interface SocketAddress {
|
|
1889
|
+
hostname: string;
|
|
1890
|
+
port: number;
|
|
1891
|
+
}
|
|
1892
|
+
declare interface TlsOptions {
|
|
1893
|
+
expectedServerHostname?: string;
|
|
1894
|
+
}
|
|
1794
1895
|
declare interface BasicImageTransformations {
|
|
1795
1896
|
/**
|
|
1796
1897
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -1870,7 +1971,7 @@ declare interface BasicImageTransformationsGravityCoordinates {
|
|
|
1870
1971
|
* Note: Currently, these properties cannot be tested in the
|
|
1871
1972
|
* playground.
|
|
1872
1973
|
*/
|
|
1873
|
-
declare interface RequestInitCfProperties {
|
|
1974
|
+
declare interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1874
1975
|
cacheEverything?: boolean;
|
|
1875
1976
|
/**
|
|
1876
1977
|
* A request's cache key is what determines if two requests are
|
|
@@ -2040,6 +2141,49 @@ declare interface RequestInitCfPropertiesImage
|
|
|
2040
2141
|
* the origin.
|
|
2041
2142
|
*/
|
|
2042
2143
|
"origin-auth"?: "share-publicly";
|
|
2144
|
+
/**
|
|
2145
|
+
* Adds a border around the image. The border is added after resizing. Border
|
|
2146
|
+
* width takes dpr into account, and can be specified either using a single
|
|
2147
|
+
* width property, or individually for each side.
|
|
2148
|
+
*/
|
|
2149
|
+
border?:
|
|
2150
|
+
| {
|
|
2151
|
+
color: string;
|
|
2152
|
+
width: number;
|
|
2153
|
+
}
|
|
2154
|
+
| {
|
|
2155
|
+
color: string;
|
|
2156
|
+
top: number;
|
|
2157
|
+
right: number;
|
|
2158
|
+
bottom: number;
|
|
2159
|
+
left: number;
|
|
2160
|
+
};
|
|
2161
|
+
/**
|
|
2162
|
+
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
2163
|
+
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
2164
|
+
* 0 is ignored.
|
|
2165
|
+
*/
|
|
2166
|
+
brightness?: number;
|
|
2167
|
+
/**
|
|
2168
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
2169
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
2170
|
+
* ignored.
|
|
2171
|
+
*/
|
|
2172
|
+
contrast?: number;
|
|
2173
|
+
/**
|
|
2174
|
+
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
2175
|
+
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
2176
|
+
*/
|
|
2177
|
+
gamma?: number;
|
|
2178
|
+
/**
|
|
2179
|
+
* Slightly reduces latency on a cache miss by selecting a
|
|
2180
|
+
* quickest-to-compress file format, at a cost of increased file size and
|
|
2181
|
+
* lower image quality. It will usually override the format option and choose
|
|
2182
|
+
* JPEG over WebP or AVIF. We do not recommend using this option, except in
|
|
2183
|
+
* unusual circumstances like resizing uncacheable dynamically-generated
|
|
2184
|
+
* images.
|
|
2185
|
+
*/
|
|
2186
|
+
compression?: "fast";
|
|
2043
2187
|
}
|
|
2044
2188
|
declare interface RequestInitCfPropertiesImageMinify {
|
|
2045
2189
|
javascript?: boolean;
|
|
@@ -2055,7 +2199,8 @@ declare type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2055
2199
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2056
2200
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2057
2201
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2058
|
-
declare interface IncomingRequestCfPropertiesBase
|
|
2202
|
+
declare interface IncomingRequestCfPropertiesBase
|
|
2203
|
+
extends Record<string, unknown> {
|
|
2059
2204
|
/**
|
|
2060
2205
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2061
2206
|
*
|
|
@@ -2136,8 +2281,7 @@ declare interface IncomingRequestCfPropertiesBase {
|
|
|
2136
2281
|
declare interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2137
2282
|
/**
|
|
2138
2283
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2139
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2140
|
-
* and `99` (almost certainly a bot).
|
|
2284
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2141
2285
|
*
|
|
2142
2286
|
* @example 54
|
|
2143
2287
|
*/
|
|
@@ -2248,86 +2392,82 @@ declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2248
2392
|
/**
|
|
2249
2393
|
* Geographic data about the request's origin.
|
|
2250
2394
|
*/
|
|
2251
|
-
declare
|
|
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
|
-
|
|
2326
|
-
|
|
2327
|
-
* @example "635"
|
|
2328
|
-
*/
|
|
2329
|
-
metroCode?: string;
|
|
2330
|
-
};
|
|
2395
|
+
declare interface IncomingRequestCfPropertiesGeographicInformation {
|
|
2396
|
+
/**
|
|
2397
|
+
* The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
|
|
2398
|
+
*
|
|
2399
|
+
* 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.
|
|
2400
|
+
*
|
|
2401
|
+
* If Cloudflare is unable to determine where the request originated this property is omitted.
|
|
2402
|
+
*
|
|
2403
|
+
* The country code `"T1"` is used for requests originating on TOR.
|
|
2404
|
+
*
|
|
2405
|
+
* @example "GB"
|
|
2406
|
+
*/
|
|
2407
|
+
country?: Iso3166Alpha2Code | "T1";
|
|
2408
|
+
/**
|
|
2409
|
+
* If present, this property indicates that the request originated in the EU
|
|
2410
|
+
*
|
|
2411
|
+
* @example "1"
|
|
2412
|
+
*/
|
|
2413
|
+
isEUCountry?: "1";
|
|
2414
|
+
/**
|
|
2415
|
+
* A two-letter code indicating the continent the request originated from.
|
|
2416
|
+
*
|
|
2417
|
+
* @example "AN"
|
|
2418
|
+
*/
|
|
2419
|
+
continent?: ContinentCode;
|
|
2420
|
+
/**
|
|
2421
|
+
* The city the request originated from
|
|
2422
|
+
*
|
|
2423
|
+
* @example "Austin"
|
|
2424
|
+
*/
|
|
2425
|
+
city?: string;
|
|
2426
|
+
/**
|
|
2427
|
+
* Postal code of the incoming request
|
|
2428
|
+
*
|
|
2429
|
+
* @example "78701"
|
|
2430
|
+
*/
|
|
2431
|
+
postalCode?: string;
|
|
2432
|
+
/**
|
|
2433
|
+
* Latitude of the incoming request
|
|
2434
|
+
*
|
|
2435
|
+
* @example "30.27130"
|
|
2436
|
+
*/
|
|
2437
|
+
latitude?: string;
|
|
2438
|
+
/**
|
|
2439
|
+
* Longitude of the incoming request
|
|
2440
|
+
*
|
|
2441
|
+
* @example "-97.74260"
|
|
2442
|
+
*/
|
|
2443
|
+
longitude?: string;
|
|
2444
|
+
/**
|
|
2445
|
+
* Timezone of the incoming request
|
|
2446
|
+
*
|
|
2447
|
+
* @example "America/Chicago"
|
|
2448
|
+
*/
|
|
2449
|
+
timezone?: string;
|
|
2450
|
+
/**
|
|
2451
|
+
* If known, the ISO 3166-2 name for the first level region associated with
|
|
2452
|
+
* the IP address of the incoming request
|
|
2453
|
+
*
|
|
2454
|
+
* @example "Texas"
|
|
2455
|
+
*/
|
|
2456
|
+
region?: string;
|
|
2457
|
+
/**
|
|
2458
|
+
* If known, the ISO 3166-2 code for the first-level region associated with
|
|
2459
|
+
* the IP address of the incoming request
|
|
2460
|
+
*
|
|
2461
|
+
* @example "TX"
|
|
2462
|
+
*/
|
|
2463
|
+
regionCode?: string;
|
|
2464
|
+
/**
|
|
2465
|
+
* Metro code (DMA) of the incoming request
|
|
2466
|
+
*
|
|
2467
|
+
* @example "635"
|
|
2468
|
+
*/
|
|
2469
|
+
metroCode?: string;
|
|
2470
|
+
}
|
|
2331
2471
|
/** Data about the incoming request's TLS certificate */
|
|
2332
2472
|
declare interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2333
2473
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2720,6 +2860,9 @@ declare type Iso3166Alpha2Code =
|
|
|
2720
2860
|
| "ZW";
|
|
2721
2861
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2722
2862
|
declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2863
|
+
declare type CfProperties<HostMetadata = unknown> =
|
|
2864
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2865
|
+
| RequestInitCfProperties;
|
|
2723
2866
|
declare interface D1Result<T = unknown> {
|
|
2724
2867
|
results?: T[];
|
|
2725
2868
|
success: boolean;
|
|
@@ -2740,7 +2883,7 @@ declare abstract class D1PreparedStatement {
|
|
|
2740
2883
|
raw<T = unknown>(): Promise<T[]>;
|
|
2741
2884
|
}
|
|
2742
2885
|
/**
|
|
2743
|
-
*
|
|
2886
|
+
* An email message that can be sent from a Worker.
|
|
2744
2887
|
*/
|
|
2745
2888
|
declare interface EmailMessage {
|
|
2746
2889
|
/**
|
|
@@ -2751,14 +2894,19 @@ declare interface EmailMessage {
|
|
|
2751
2894
|
* Envelope To attribute of the email message.
|
|
2752
2895
|
*/
|
|
2753
2896
|
readonly to: string;
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2897
|
+
}
|
|
2898
|
+
/**
|
|
2899
|
+
* An email message that is sent to a consumer Worker and can be rejected/forwarded.
|
|
2900
|
+
*/
|
|
2901
|
+
declare interface ForwardableEmailMessage extends EmailMessage {
|
|
2758
2902
|
/**
|
|
2759
2903
|
* Stream of the email message content.
|
|
2760
2904
|
*/
|
|
2761
2905
|
readonly raw: ReadableStream;
|
|
2906
|
+
/**
|
|
2907
|
+
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2908
|
+
*/
|
|
2909
|
+
readonly headers: Headers;
|
|
2762
2910
|
/**
|
|
2763
2911
|
* Size of the email message content.
|
|
2764
2912
|
*/
|
|
@@ -2777,14 +2925,27 @@ declare interface EmailMessage {
|
|
|
2777
2925
|
*/
|
|
2778
2926
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2779
2927
|
}
|
|
2928
|
+
/**
|
|
2929
|
+
* A binding that allows a Worker to send email messages.
|
|
2930
|
+
*/
|
|
2931
|
+
declare interface SendEmail {
|
|
2932
|
+
send(message: EmailMessage): Promise<void>;
|
|
2933
|
+
}
|
|
2780
2934
|
declare abstract class EmailEvent extends ExtendableEvent {
|
|
2781
|
-
readonly message:
|
|
2935
|
+
readonly message: ForwardableEmailMessage;
|
|
2782
2936
|
}
|
|
2783
2937
|
declare type EmailExportedHandler<Env = unknown> = (
|
|
2784
|
-
message:
|
|
2938
|
+
message: ForwardableEmailMessage,
|
|
2785
2939
|
env: Env,
|
|
2786
2940
|
ctx: ExecutionContext
|
|
2787
2941
|
) => void | Promise<void>;
|
|
2942
|
+
declare module "cloudflare:email" {
|
|
2943
|
+
let _EmailMessage: {
|
|
2944
|
+
prototype: EmailMessage;
|
|
2945
|
+
new (from: string, to: string, raw: ReadableStream | string): EmailMessage;
|
|
2946
|
+
};
|
|
2947
|
+
export { _EmailMessage as EmailMessage };
|
|
2948
|
+
}
|
|
2788
2949
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2789
2950
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2790
2951
|
request: Request;
|
|
@@ -2865,75 +3026,12 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2865
3026
|
// Key Identifier of the JWK
|
|
2866
3027
|
readonly kid: string;
|
|
2867
3028
|
}
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
*/
|
|
2871
|
-
declare interface Message<Body = unknown> {
|
|
2872
|
-
/**
|
|
2873
|
-
* A unique, system-generated ID for the message.
|
|
2874
|
-
*/
|
|
2875
|
-
readonly id: string;
|
|
2876
|
-
/**
|
|
2877
|
-
* A timestamp when the message was sent.
|
|
2878
|
-
*/
|
|
2879
|
-
readonly timestamp: Date;
|
|
2880
|
-
/**
|
|
2881
|
-
* The body of the message.
|
|
2882
|
-
*/
|
|
2883
|
-
readonly body: Body;
|
|
2884
|
-
/**
|
|
2885
|
-
* Marks message to be retried.
|
|
2886
|
-
*/
|
|
2887
|
-
retry(): void;
|
|
2888
|
-
/**
|
|
2889
|
-
* Marks message acknowledged.
|
|
2890
|
-
*/
|
|
2891
|
-
ack(): void;
|
|
2892
|
-
}
|
|
2893
|
-
/**
|
|
2894
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2895
|
-
*/
|
|
2896
|
-
declare interface MessageBatch<Body = unknown> {
|
|
2897
|
-
/**
|
|
2898
|
-
* The name of the Queue that belongs to this batch.
|
|
2899
|
-
*/
|
|
2900
|
-
readonly queue: string;
|
|
2901
|
-
/**
|
|
2902
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2903
|
-
*/
|
|
2904
|
-
readonly messages: readonly Message<Body>[];
|
|
2905
|
-
/**
|
|
2906
|
-
* Marks every message to be retried in the next batch.
|
|
2907
|
-
*/
|
|
2908
|
-
retryAll(): void;
|
|
2909
|
-
/**
|
|
2910
|
-
* Marks every message acknowledged in the batch.
|
|
2911
|
-
*/
|
|
2912
|
-
ackAll(): void;
|
|
2913
|
-
}
|
|
2914
|
-
/**
|
|
2915
|
-
* A wrapper class used to structure message batches.
|
|
2916
|
-
*/
|
|
2917
|
-
declare type MessageSendRequest<Body = unknown> = {
|
|
3029
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3030
|
+
declare interface DispatchNamespace {
|
|
2918
3031
|
/**
|
|
2919
|
-
*
|
|
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.
|
|
2920
3035
|
*/
|
|
2921
|
-
|
|
2922
|
-
};
|
|
2923
|
-
/**
|
|
2924
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
2925
|
-
*/
|
|
2926
|
-
declare interface Queue<Body = any> {
|
|
2927
|
-
/**
|
|
2928
|
-
* Sends a message to the Queue.
|
|
2929
|
-
* @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.
|
|
2930
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2931
|
-
*/
|
|
2932
|
-
send(message: Body): Promise<void>;
|
|
2933
|
-
/**
|
|
2934
|
-
* Sends a batch of messages to the Queue.
|
|
2935
|
-
* @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.
|
|
2936
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2937
|
-
*/
|
|
2938
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
3036
|
+
get(name: string): Fetcher;
|
|
2939
3037
|
}
|