@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/2022-08-04/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;
|
|
@@ -281,17 +285,27 @@ declare const self: ServiceWorkerGlobalScope;
|
|
|
281
285
|
declare const crypto: Crypto;
|
|
282
286
|
declare const caches: CacheStorage;
|
|
283
287
|
declare const scheduler: Scheduler;
|
|
288
|
+
declare const performance: Performance;
|
|
289
|
+
declare const origin: string;
|
|
284
290
|
declare const navigator: Navigator;
|
|
285
291
|
declare interface TestController {}
|
|
286
292
|
declare interface ExecutionContext {
|
|
287
293
|
waitUntil(promise: Promise<any>): void;
|
|
288
294
|
passThroughOnException(): void;
|
|
289
295
|
}
|
|
290
|
-
declare type ExportedHandlerFetchHandler<
|
|
291
|
-
|
|
296
|
+
declare type ExportedHandlerFetchHandler<
|
|
297
|
+
Env = unknown,
|
|
298
|
+
CfHostMetadata = unknown
|
|
299
|
+
> = (
|
|
300
|
+
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
292
301
|
env: Env,
|
|
293
302
|
ctx: ExecutionContext
|
|
294
303
|
) => Response | Promise<Response>;
|
|
304
|
+
declare type ExportedHandlerTailHandler<Env = unknown> = (
|
|
305
|
+
events: TraceItem[],
|
|
306
|
+
env: Env,
|
|
307
|
+
ctx: ExecutionContext
|
|
308
|
+
) => void | Promise<void>;
|
|
295
309
|
declare type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
296
310
|
traces: TraceItem[],
|
|
297
311
|
env: Env,
|
|
@@ -312,12 +326,17 @@ declare type ExportedHandlerTestHandler<Env = unknown> = (
|
|
|
312
326
|
env: Env,
|
|
313
327
|
ctx: ExecutionContext
|
|
314
328
|
) => void | Promise<void>;
|
|
315
|
-
declare interface ExportedHandler<
|
|
316
|
-
|
|
329
|
+
declare interface ExportedHandler<
|
|
330
|
+
Env = unknown,
|
|
331
|
+
QueueMessage = unknown,
|
|
332
|
+
CfHostMetadata = unknown
|
|
333
|
+
> {
|
|
334
|
+
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
335
|
+
tail?: ExportedHandlerTailHandler<Env>;
|
|
317
336
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
318
337
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
319
338
|
test?: ExportedHandlerTestHandler<Env>;
|
|
320
|
-
queue?: ExportedHandlerQueueHandler<Env,
|
|
339
|
+
queue?: ExportedHandlerQueueHandler<Env, Message>;
|
|
321
340
|
}
|
|
322
341
|
declare interface StructuredSerializeOptions {
|
|
323
342
|
transfer?: any[];
|
|
@@ -329,6 +348,11 @@ declare abstract class PromiseRejectionEvent extends Event {
|
|
|
329
348
|
declare abstract class Navigator {
|
|
330
349
|
readonly userAgent: string;
|
|
331
350
|
}
|
|
351
|
+
/** 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. */
|
|
352
|
+
declare interface Performance {
|
|
353
|
+
readonly timeOrigin: number;
|
|
354
|
+
now(): number;
|
|
355
|
+
}
|
|
332
356
|
declare interface DurableObject {
|
|
333
357
|
fetch(request: Request): Response | Promise<Response>;
|
|
334
358
|
alarm?(): void | Promise<void>;
|
|
@@ -352,19 +376,32 @@ declare interface DurableObjectNamespace {
|
|
|
352
376
|
id: DurableObjectId,
|
|
353
377
|
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
354
378
|
): DurableObjectStub;
|
|
355
|
-
jurisdiction(jurisdiction:
|
|
379
|
+
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
|
|
356
380
|
}
|
|
381
|
+
declare type DurableObjectJurisdiction = "eu" | "fedramp";
|
|
357
382
|
declare interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
358
|
-
jurisdiction?:
|
|
359
|
-
}
|
|
383
|
+
jurisdiction?: DurableObjectJurisdiction;
|
|
384
|
+
}
|
|
385
|
+
declare type DurableObjectLocationHint =
|
|
386
|
+
| "wnam"
|
|
387
|
+
| "enam"
|
|
388
|
+
| "sam"
|
|
389
|
+
| "weur"
|
|
390
|
+
| "eeur"
|
|
391
|
+
| "apac"
|
|
392
|
+
| "oc"
|
|
393
|
+
| "afr"
|
|
394
|
+
| "me";
|
|
360
395
|
declare interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
361
|
-
locationHint?:
|
|
396
|
+
locationHint?: DurableObjectLocationHint;
|
|
362
397
|
}
|
|
363
398
|
declare interface DurableObjectState {
|
|
364
399
|
waitUntil(promise: Promise<any>): void;
|
|
365
400
|
readonly id: DurableObjectId;
|
|
366
401
|
readonly storage: DurableObjectStorage;
|
|
367
402
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
403
|
+
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
404
|
+
getWebSockets(tag?: string): WebSocket[];
|
|
368
405
|
}
|
|
369
406
|
declare interface DurableObjectTransaction {
|
|
370
407
|
get<T = unknown>(
|
|
@@ -431,6 +468,7 @@ declare interface DurableObjectStorage {
|
|
|
431
468
|
): Promise<void>;
|
|
432
469
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
433
470
|
sync(): Promise<void>;
|
|
471
|
+
transactionSync<T>(closure: () => T): T;
|
|
434
472
|
}
|
|
435
473
|
declare interface DurableObjectListOptions {
|
|
436
474
|
start?: string;
|
|
@@ -540,6 +578,7 @@ declare class AbortController {
|
|
|
540
578
|
declare abstract class AbortSignal extends EventTarget {
|
|
541
579
|
static abort(reason?: any): AbortSignal;
|
|
542
580
|
static timeout(delay: number): AbortSignal;
|
|
581
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
543
582
|
get aborted(): boolean;
|
|
544
583
|
get reason(): any;
|
|
545
584
|
throwIfAborted(): void;
|
|
@@ -988,23 +1027,27 @@ declare interface ResponseInit {
|
|
|
988
1027
|
webSocket?: WebSocket | null;
|
|
989
1028
|
encodeBody?: "automatic" | "manual";
|
|
990
1029
|
}
|
|
991
|
-
declare type RequestInfo
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
1030
|
+
declare type RequestInfo<
|
|
1031
|
+
CfHostMetadata = unknown,
|
|
1032
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1033
|
+
> = Request<CfHostMetadata, Cf> | string | URL;
|
|
1034
|
+
declare class Request<
|
|
1035
|
+
CfHostMetadata = unknown,
|
|
1036
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1037
|
+
> extends Body {
|
|
1038
|
+
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1039
|
+
clone(): Request<CfHostMetadata, Cf>;
|
|
995
1040
|
get method(): string;
|
|
996
1041
|
get url(): string;
|
|
997
1042
|
get headers(): Headers;
|
|
998
1043
|
get redirect(): string;
|
|
999
1044
|
get fetcher(): Fetcher | null;
|
|
1000
1045
|
get signal(): AbortSignal;
|
|
1001
|
-
get cf():
|
|
1046
|
+
get cf(): Cf | undefined;
|
|
1002
1047
|
get integrity(): string;
|
|
1003
1048
|
get keepalive(): boolean;
|
|
1004
1049
|
}
|
|
1005
|
-
declare interface RequestInit<
|
|
1006
|
-
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
1007
|
-
> {
|
|
1050
|
+
declare interface RequestInit<Cf = CfProperties> {
|
|
1008
1051
|
/** A string to set request's method. */
|
|
1009
1052
|
method?: string;
|
|
1010
1053
|
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
@@ -1014,17 +1057,15 @@ declare interface RequestInit<
|
|
|
1014
1057
|
/** 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
1058
|
redirect?: string;
|
|
1016
1059
|
fetcher?: Fetcher | null;
|
|
1017
|
-
cf?:
|
|
1060
|
+
cf?: Cf;
|
|
1018
1061
|
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1019
1062
|
integrity?: string;
|
|
1020
1063
|
/** An AbortSignal to set request's signal. */
|
|
1021
1064
|
signal?: AbortSignal | null;
|
|
1022
1065
|
}
|
|
1023
1066
|
declare abstract class Fetcher {
|
|
1024
|
-
fetch(
|
|
1025
|
-
|
|
1026
|
-
init?: RequestInit<RequestInitCfProperties>
|
|
1027
|
-
): Promise<Response>;
|
|
1067
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1068
|
+
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1028
1069
|
}
|
|
1029
1070
|
declare interface FetcherPutOptions {
|
|
1030
1071
|
expiration?: number;
|
|
@@ -1137,6 +1178,33 @@ declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1137
1178
|
value: Value | null;
|
|
1138
1179
|
metadata: Metadata | null;
|
|
1139
1180
|
}
|
|
1181
|
+
declare interface Queue<Body> {
|
|
1182
|
+
send(message: Body): Promise<void>;
|
|
1183
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1184
|
+
}
|
|
1185
|
+
declare interface QueueSendOptions {}
|
|
1186
|
+
declare interface MessageSendRequest<Body = unknown> {
|
|
1187
|
+
body: Body;
|
|
1188
|
+
}
|
|
1189
|
+
declare interface Message<Body = unknown> {
|
|
1190
|
+
readonly id: string;
|
|
1191
|
+
readonly timestamp: Date;
|
|
1192
|
+
readonly body: Body;
|
|
1193
|
+
retry(): void;
|
|
1194
|
+
ack(): void;
|
|
1195
|
+
}
|
|
1196
|
+
declare interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1197
|
+
readonly messages: readonly Message<Body>[];
|
|
1198
|
+
readonly queue: string;
|
|
1199
|
+
retryAll(): void;
|
|
1200
|
+
ackAll(): void;
|
|
1201
|
+
}
|
|
1202
|
+
declare interface MessageBatch<Body = unknown> {
|
|
1203
|
+
readonly messages: readonly Message<Body>[];
|
|
1204
|
+
readonly queue: string;
|
|
1205
|
+
retryAll(): void;
|
|
1206
|
+
ackAll(): void;
|
|
1207
|
+
}
|
|
1140
1208
|
declare interface R2Error extends Error {
|
|
1141
1209
|
readonly name: string;
|
|
1142
1210
|
readonly code: number;
|
|
@@ -1288,12 +1356,18 @@ declare interface R2HTTPMetadata {
|
|
|
1288
1356
|
cacheControl?: string;
|
|
1289
1357
|
cacheExpiry?: Date;
|
|
1290
1358
|
}
|
|
1291
|
-
declare
|
|
1359
|
+
declare type R2Objects = {
|
|
1292
1360
|
objects: R2Object[];
|
|
1293
|
-
truncated: boolean;
|
|
1294
|
-
cursor?: string;
|
|
1295
1361
|
delimitedPrefixes: string[];
|
|
1296
|
-
}
|
|
1362
|
+
} & (
|
|
1363
|
+
| {
|
|
1364
|
+
truncated: true;
|
|
1365
|
+
cursor: string;
|
|
1366
|
+
}
|
|
1367
|
+
| {
|
|
1368
|
+
truncated: false;
|
|
1369
|
+
}
|
|
1370
|
+
);
|
|
1297
1371
|
declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1298
1372
|
readonly scheduledTime: number;
|
|
1299
1373
|
readonly cron: string;
|
|
@@ -1504,13 +1578,19 @@ declare class TransformStream<I = any, O = any> {
|
|
|
1504
1578
|
get writable(): WritableStream<I>;
|
|
1505
1579
|
}
|
|
1506
1580
|
declare class FixedLengthStream extends IdentityTransformStream {
|
|
1507
|
-
constructor(
|
|
1581
|
+
constructor(
|
|
1582
|
+
expectedLength: number | bigint,
|
|
1583
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy
|
|
1584
|
+
);
|
|
1508
1585
|
}
|
|
1509
1586
|
declare class IdentityTransformStream extends TransformStream<
|
|
1510
1587
|
ArrayBuffer | ArrayBufferView,
|
|
1511
1588
|
Uint8Array
|
|
1512
1589
|
> {
|
|
1513
|
-
constructor();
|
|
1590
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
1591
|
+
}
|
|
1592
|
+
declare interface IdentityTransformStreamQueuingStrategy {
|
|
1593
|
+
highWaterMark?: number | bigint;
|
|
1514
1594
|
}
|
|
1515
1595
|
declare interface ReadableStreamValuesOptions {
|
|
1516
1596
|
preventCancel?: boolean;
|
|
@@ -1559,7 +1639,8 @@ declare interface QueuingStrategyInit {
|
|
|
1559
1639
|
*/
|
|
1560
1640
|
highWaterMark: number;
|
|
1561
1641
|
}
|
|
1562
|
-
declare abstract class
|
|
1642
|
+
declare abstract class TailEvent extends ExtendableEvent {
|
|
1643
|
+
readonly events: TraceItem[];
|
|
1563
1644
|
readonly traces: TraceItem[];
|
|
1564
1645
|
}
|
|
1565
1646
|
declare interface TraceItem {
|
|
@@ -1769,6 +1850,8 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1769
1850
|
accept(): void;
|
|
1770
1851
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1771
1852
|
close(code?: number, reason?: string): void;
|
|
1853
|
+
serializeAttachment(attachment: any): void;
|
|
1854
|
+
deserializeAttachment(): any | null;
|
|
1772
1855
|
static readonly READY_STATE_CONNECTING: number;
|
|
1773
1856
|
static readonly READY_STATE_OPEN: number;
|
|
1774
1857
|
static readonly READY_STATE_CLOSING: number;
|
|
@@ -1784,6 +1867,24 @@ declare const WebSocketPair: {
|
|
|
1784
1867
|
1: WebSocket;
|
|
1785
1868
|
};
|
|
1786
1869
|
};
|
|
1870
|
+
declare interface Socket {
|
|
1871
|
+
get readable(): ReadableStream;
|
|
1872
|
+
get writable(): WritableStream;
|
|
1873
|
+
get closed(): Promise<void>;
|
|
1874
|
+
close(): Promise<void>;
|
|
1875
|
+
startTls(options?: TlsOptions): Socket;
|
|
1876
|
+
}
|
|
1877
|
+
declare interface SocketOptions {
|
|
1878
|
+
secureTransport?: string;
|
|
1879
|
+
allowHalfOpen: boolean;
|
|
1880
|
+
}
|
|
1881
|
+
declare interface SocketAddress {
|
|
1882
|
+
hostname: string;
|
|
1883
|
+
port: number;
|
|
1884
|
+
}
|
|
1885
|
+
declare interface TlsOptions {
|
|
1886
|
+
expectedServerHostname?: string;
|
|
1887
|
+
}
|
|
1787
1888
|
declare interface BasicImageTransformations {
|
|
1788
1889
|
/**
|
|
1789
1890
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -1863,7 +1964,7 @@ declare interface BasicImageTransformationsGravityCoordinates {
|
|
|
1863
1964
|
* Note: Currently, these properties cannot be tested in the
|
|
1864
1965
|
* playground.
|
|
1865
1966
|
*/
|
|
1866
|
-
declare interface RequestInitCfProperties {
|
|
1967
|
+
declare interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1867
1968
|
cacheEverything?: boolean;
|
|
1868
1969
|
/**
|
|
1869
1970
|
* A request's cache key is what determines if two requests are
|
|
@@ -2033,6 +2134,49 @@ declare interface RequestInitCfPropertiesImage
|
|
|
2033
2134
|
* the origin.
|
|
2034
2135
|
*/
|
|
2035
2136
|
"origin-auth"?: "share-publicly";
|
|
2137
|
+
/**
|
|
2138
|
+
* Adds a border around the image. The border is added after resizing. Border
|
|
2139
|
+
* width takes dpr into account, and can be specified either using a single
|
|
2140
|
+
* width property, or individually for each side.
|
|
2141
|
+
*/
|
|
2142
|
+
border?:
|
|
2143
|
+
| {
|
|
2144
|
+
color: string;
|
|
2145
|
+
width: number;
|
|
2146
|
+
}
|
|
2147
|
+
| {
|
|
2148
|
+
color: string;
|
|
2149
|
+
top: number;
|
|
2150
|
+
right: number;
|
|
2151
|
+
bottom: number;
|
|
2152
|
+
left: number;
|
|
2153
|
+
};
|
|
2154
|
+
/**
|
|
2155
|
+
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
2156
|
+
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
2157
|
+
* 0 is ignored.
|
|
2158
|
+
*/
|
|
2159
|
+
brightness?: number;
|
|
2160
|
+
/**
|
|
2161
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
2162
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
2163
|
+
* ignored.
|
|
2164
|
+
*/
|
|
2165
|
+
contrast?: number;
|
|
2166
|
+
/**
|
|
2167
|
+
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
2168
|
+
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
2169
|
+
*/
|
|
2170
|
+
gamma?: number;
|
|
2171
|
+
/**
|
|
2172
|
+
* Slightly reduces latency on a cache miss by selecting a
|
|
2173
|
+
* quickest-to-compress file format, at a cost of increased file size and
|
|
2174
|
+
* lower image quality. It will usually override the format option and choose
|
|
2175
|
+
* JPEG over WebP or AVIF. We do not recommend using this option, except in
|
|
2176
|
+
* unusual circumstances like resizing uncacheable dynamically-generated
|
|
2177
|
+
* images.
|
|
2178
|
+
*/
|
|
2179
|
+
compression?: "fast";
|
|
2036
2180
|
}
|
|
2037
2181
|
declare interface RequestInitCfPropertiesImageMinify {
|
|
2038
2182
|
javascript?: boolean;
|
|
@@ -2048,7 +2192,8 @@ declare type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2048
2192
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2049
2193
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2050
2194
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2051
|
-
declare interface IncomingRequestCfPropertiesBase
|
|
2195
|
+
declare interface IncomingRequestCfPropertiesBase
|
|
2196
|
+
extends Record<string, unknown> {
|
|
2052
2197
|
/**
|
|
2053
2198
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2054
2199
|
*
|
|
@@ -2129,8 +2274,7 @@ declare interface IncomingRequestCfPropertiesBase {
|
|
|
2129
2274
|
declare interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2130
2275
|
/**
|
|
2131
2276
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2132
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2133
|
-
* and `99` (almost certainly a bot).
|
|
2277
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2134
2278
|
*
|
|
2135
2279
|
* @example 54
|
|
2136
2280
|
*/
|
|
@@ -2241,86 +2385,82 @@ declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2241
2385
|
/**
|
|
2242
2386
|
* Geographic data about the request's origin.
|
|
2243
2387
|
*/
|
|
2244
|
-
declare
|
|
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
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
* @example "635"
|
|
2321
|
-
*/
|
|
2322
|
-
metroCode?: string;
|
|
2323
|
-
};
|
|
2388
|
+
declare interface IncomingRequestCfPropertiesGeographicInformation {
|
|
2389
|
+
/**
|
|
2390
|
+
* The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
|
|
2391
|
+
*
|
|
2392
|
+
* 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.
|
|
2393
|
+
*
|
|
2394
|
+
* If Cloudflare is unable to determine where the request originated this property is omitted.
|
|
2395
|
+
*
|
|
2396
|
+
* The country code `"T1"` is used for requests originating on TOR.
|
|
2397
|
+
*
|
|
2398
|
+
* @example "GB"
|
|
2399
|
+
*/
|
|
2400
|
+
country?: Iso3166Alpha2Code | "T1";
|
|
2401
|
+
/**
|
|
2402
|
+
* If present, this property indicates that the request originated in the EU
|
|
2403
|
+
*
|
|
2404
|
+
* @example "1"
|
|
2405
|
+
*/
|
|
2406
|
+
isEUCountry?: "1";
|
|
2407
|
+
/**
|
|
2408
|
+
* A two-letter code indicating the continent the request originated from.
|
|
2409
|
+
*
|
|
2410
|
+
* @example "AN"
|
|
2411
|
+
*/
|
|
2412
|
+
continent?: ContinentCode;
|
|
2413
|
+
/**
|
|
2414
|
+
* The city the request originated from
|
|
2415
|
+
*
|
|
2416
|
+
* @example "Austin"
|
|
2417
|
+
*/
|
|
2418
|
+
city?: string;
|
|
2419
|
+
/**
|
|
2420
|
+
* Postal code of the incoming request
|
|
2421
|
+
*
|
|
2422
|
+
* @example "78701"
|
|
2423
|
+
*/
|
|
2424
|
+
postalCode?: string;
|
|
2425
|
+
/**
|
|
2426
|
+
* Latitude of the incoming request
|
|
2427
|
+
*
|
|
2428
|
+
* @example "30.27130"
|
|
2429
|
+
*/
|
|
2430
|
+
latitude?: string;
|
|
2431
|
+
/**
|
|
2432
|
+
* Longitude of the incoming request
|
|
2433
|
+
*
|
|
2434
|
+
* @example "-97.74260"
|
|
2435
|
+
*/
|
|
2436
|
+
longitude?: string;
|
|
2437
|
+
/**
|
|
2438
|
+
* Timezone of the incoming request
|
|
2439
|
+
*
|
|
2440
|
+
* @example "America/Chicago"
|
|
2441
|
+
*/
|
|
2442
|
+
timezone?: string;
|
|
2443
|
+
/**
|
|
2444
|
+
* If known, the ISO 3166-2 name for the first level region associated with
|
|
2445
|
+
* the IP address of the incoming request
|
|
2446
|
+
*
|
|
2447
|
+
* @example "Texas"
|
|
2448
|
+
*/
|
|
2449
|
+
region?: string;
|
|
2450
|
+
/**
|
|
2451
|
+
* If known, the ISO 3166-2 code for the first-level region associated with
|
|
2452
|
+
* the IP address of the incoming request
|
|
2453
|
+
*
|
|
2454
|
+
* @example "TX"
|
|
2455
|
+
*/
|
|
2456
|
+
regionCode?: string;
|
|
2457
|
+
/**
|
|
2458
|
+
* Metro code (DMA) of the incoming request
|
|
2459
|
+
*
|
|
2460
|
+
* @example "635"
|
|
2461
|
+
*/
|
|
2462
|
+
metroCode?: string;
|
|
2463
|
+
}
|
|
2324
2464
|
/** Data about the incoming request's TLS certificate */
|
|
2325
2465
|
declare interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2326
2466
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2713,6 +2853,9 @@ declare type Iso3166Alpha2Code =
|
|
|
2713
2853
|
| "ZW";
|
|
2714
2854
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2715
2855
|
declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2856
|
+
declare type CfProperties<HostMetadata = unknown> =
|
|
2857
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2858
|
+
| RequestInitCfProperties;
|
|
2716
2859
|
declare interface D1Result<T = unknown> {
|
|
2717
2860
|
results?: T[];
|
|
2718
2861
|
success: boolean;
|
|
@@ -2733,7 +2876,7 @@ declare abstract class D1PreparedStatement {
|
|
|
2733
2876
|
raw<T = unknown>(): Promise<T[]>;
|
|
2734
2877
|
}
|
|
2735
2878
|
/**
|
|
2736
|
-
*
|
|
2879
|
+
* An email message that can be sent from a Worker.
|
|
2737
2880
|
*/
|
|
2738
2881
|
declare interface EmailMessage {
|
|
2739
2882
|
/**
|
|
@@ -2744,14 +2887,19 @@ declare interface EmailMessage {
|
|
|
2744
2887
|
* Envelope To attribute of the email message.
|
|
2745
2888
|
*/
|
|
2746
2889
|
readonly to: string;
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2890
|
+
}
|
|
2891
|
+
/**
|
|
2892
|
+
* An email message that is sent to a consumer Worker and can be rejected/forwarded.
|
|
2893
|
+
*/
|
|
2894
|
+
declare interface ForwardableEmailMessage extends EmailMessage {
|
|
2751
2895
|
/**
|
|
2752
2896
|
* Stream of the email message content.
|
|
2753
2897
|
*/
|
|
2754
2898
|
readonly raw: ReadableStream;
|
|
2899
|
+
/**
|
|
2900
|
+
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2901
|
+
*/
|
|
2902
|
+
readonly headers: Headers;
|
|
2755
2903
|
/**
|
|
2756
2904
|
* Size of the email message content.
|
|
2757
2905
|
*/
|
|
@@ -2770,14 +2918,27 @@ declare interface EmailMessage {
|
|
|
2770
2918
|
*/
|
|
2771
2919
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2772
2920
|
}
|
|
2921
|
+
/**
|
|
2922
|
+
* A binding that allows a Worker to send email messages.
|
|
2923
|
+
*/
|
|
2924
|
+
declare interface SendEmail {
|
|
2925
|
+
send(message: EmailMessage): Promise<void>;
|
|
2926
|
+
}
|
|
2773
2927
|
declare abstract class EmailEvent extends ExtendableEvent {
|
|
2774
|
-
readonly message:
|
|
2928
|
+
readonly message: ForwardableEmailMessage;
|
|
2775
2929
|
}
|
|
2776
2930
|
declare type EmailExportedHandler<Env = unknown> = (
|
|
2777
|
-
message:
|
|
2931
|
+
message: ForwardableEmailMessage,
|
|
2778
2932
|
env: Env,
|
|
2779
2933
|
ctx: ExecutionContext
|
|
2780
2934
|
) => void | Promise<void>;
|
|
2935
|
+
declare module "cloudflare:email" {
|
|
2936
|
+
let _EmailMessage: {
|
|
2937
|
+
prototype: EmailMessage;
|
|
2938
|
+
new (from: string, to: string, raw: ReadableStream | string): EmailMessage;
|
|
2939
|
+
};
|
|
2940
|
+
export { _EmailMessage as EmailMessage };
|
|
2941
|
+
}
|
|
2781
2942
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2782
2943
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2783
2944
|
request: Request;
|
|
@@ -2858,75 +3019,12 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2858
3019
|
// Key Identifier of the JWK
|
|
2859
3020
|
readonly kid: string;
|
|
2860
3021
|
}
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
*/
|
|
2864
|
-
declare interface Message<Body = unknown> {
|
|
2865
|
-
/**
|
|
2866
|
-
* A unique, system-generated ID for the message.
|
|
2867
|
-
*/
|
|
2868
|
-
readonly id: string;
|
|
3022
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3023
|
+
declare interface DispatchNamespace {
|
|
2869
3024
|
/**
|
|
2870
|
-
*
|
|
3025
|
+
* @param name Name of the Worker script.
|
|
3026
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
3027
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2871
3028
|
*/
|
|
2872
|
-
|
|
2873
|
-
/**
|
|
2874
|
-
* The body of the message.
|
|
2875
|
-
*/
|
|
2876
|
-
readonly body: Body;
|
|
2877
|
-
/**
|
|
2878
|
-
* Marks message to be retried.
|
|
2879
|
-
*/
|
|
2880
|
-
retry(): void;
|
|
2881
|
-
/**
|
|
2882
|
-
* Marks message acknowledged.
|
|
2883
|
-
*/
|
|
2884
|
-
ack(): void;
|
|
2885
|
-
}
|
|
2886
|
-
/**
|
|
2887
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2888
|
-
*/
|
|
2889
|
-
declare interface MessageBatch<Body = unknown> {
|
|
2890
|
-
/**
|
|
2891
|
-
* The name of the Queue that belongs to this batch.
|
|
2892
|
-
*/
|
|
2893
|
-
readonly queue: string;
|
|
2894
|
-
/**
|
|
2895
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2896
|
-
*/
|
|
2897
|
-
readonly messages: readonly Message<Body>[];
|
|
2898
|
-
/**
|
|
2899
|
-
* Marks every message to be retried in the next batch.
|
|
2900
|
-
*/
|
|
2901
|
-
retryAll(): void;
|
|
2902
|
-
/**
|
|
2903
|
-
* Marks every message acknowledged in the batch.
|
|
2904
|
-
*/
|
|
2905
|
-
ackAll(): void;
|
|
2906
|
-
}
|
|
2907
|
-
/**
|
|
2908
|
-
* A wrapper class used to structure message batches.
|
|
2909
|
-
*/
|
|
2910
|
-
declare type MessageSendRequest<Body = unknown> = {
|
|
2911
|
-
/**
|
|
2912
|
-
* The body of the message.
|
|
2913
|
-
*/
|
|
2914
|
-
body: Body;
|
|
2915
|
-
};
|
|
2916
|
-
/**
|
|
2917
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
2918
|
-
*/
|
|
2919
|
-
declare interface Queue<Body = any> {
|
|
2920
|
-
/**
|
|
2921
|
-
* Sends a message to the Queue.
|
|
2922
|
-
* @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.
|
|
2923
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2924
|
-
*/
|
|
2925
|
-
send(message: Body): Promise<void>;
|
|
2926
|
-
/**
|
|
2927
|
-
* Sends a batch of messages to the Queue.
|
|
2928
|
-
* @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.
|
|
2929
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2930
|
-
*/
|
|
2931
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
3029
|
+
get(name: string): Fetcher;
|
|
2932
3030
|
}
|