@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-03-21/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;
|
|
@@ -1287,12 +1355,18 @@ declare interface R2HTTPMetadata {
|
|
|
1287
1355
|
cacheControl?: string;
|
|
1288
1356
|
cacheExpiry?: Date;
|
|
1289
1357
|
}
|
|
1290
|
-
declare
|
|
1358
|
+
declare type R2Objects = {
|
|
1291
1359
|
objects: R2Object[];
|
|
1292
|
-
truncated: boolean;
|
|
1293
|
-
cursor?: string;
|
|
1294
1360
|
delimitedPrefixes: string[];
|
|
1295
|
-
}
|
|
1361
|
+
} & (
|
|
1362
|
+
| {
|
|
1363
|
+
truncated: true;
|
|
1364
|
+
cursor: string;
|
|
1365
|
+
}
|
|
1366
|
+
| {
|
|
1367
|
+
truncated: false;
|
|
1368
|
+
}
|
|
1369
|
+
);
|
|
1296
1370
|
declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1297
1371
|
readonly scheduledTime: number;
|
|
1298
1372
|
readonly cron: string;
|
|
@@ -1503,13 +1577,19 @@ declare class TransformStream<I = any, O = any> {
|
|
|
1503
1577
|
get writable(): WritableStream<I>;
|
|
1504
1578
|
}
|
|
1505
1579
|
declare class FixedLengthStream extends IdentityTransformStream {
|
|
1506
|
-
constructor(
|
|
1580
|
+
constructor(
|
|
1581
|
+
expectedLength: number | bigint,
|
|
1582
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy
|
|
1583
|
+
);
|
|
1507
1584
|
}
|
|
1508
1585
|
declare class IdentityTransformStream extends TransformStream<
|
|
1509
1586
|
ArrayBuffer | ArrayBufferView,
|
|
1510
1587
|
Uint8Array
|
|
1511
1588
|
> {
|
|
1512
|
-
constructor();
|
|
1589
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
1590
|
+
}
|
|
1591
|
+
declare interface IdentityTransformStreamQueuingStrategy {
|
|
1592
|
+
highWaterMark?: number | bigint;
|
|
1513
1593
|
}
|
|
1514
1594
|
declare interface ReadableStreamValuesOptions {
|
|
1515
1595
|
preventCancel?: boolean;
|
|
@@ -1558,7 +1638,8 @@ declare interface QueuingStrategyInit {
|
|
|
1558
1638
|
*/
|
|
1559
1639
|
highWaterMark: number;
|
|
1560
1640
|
}
|
|
1561
|
-
declare abstract class
|
|
1641
|
+
declare abstract class TailEvent extends ExtendableEvent {
|
|
1642
|
+
readonly events: TraceItem[];
|
|
1562
1643
|
readonly traces: TraceItem[];
|
|
1563
1644
|
}
|
|
1564
1645
|
declare interface TraceItem {
|
|
@@ -1768,6 +1849,8 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1768
1849
|
accept(): void;
|
|
1769
1850
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1770
1851
|
close(code?: number, reason?: string): void;
|
|
1852
|
+
serializeAttachment(attachment: any): void;
|
|
1853
|
+
deserializeAttachment(): any | null;
|
|
1771
1854
|
static readonly READY_STATE_CONNECTING: number;
|
|
1772
1855
|
static readonly READY_STATE_OPEN: number;
|
|
1773
1856
|
static readonly READY_STATE_CLOSING: number;
|
|
@@ -1783,6 +1866,24 @@ declare const WebSocketPair: {
|
|
|
1783
1866
|
1: WebSocket;
|
|
1784
1867
|
};
|
|
1785
1868
|
};
|
|
1869
|
+
declare interface Socket {
|
|
1870
|
+
get readable(): ReadableStream;
|
|
1871
|
+
get writable(): WritableStream;
|
|
1872
|
+
get closed(): Promise<void>;
|
|
1873
|
+
close(): Promise<void>;
|
|
1874
|
+
startTls(options?: TlsOptions): Socket;
|
|
1875
|
+
}
|
|
1876
|
+
declare interface SocketOptions {
|
|
1877
|
+
secureTransport?: string;
|
|
1878
|
+
allowHalfOpen: boolean;
|
|
1879
|
+
}
|
|
1880
|
+
declare interface SocketAddress {
|
|
1881
|
+
hostname: string;
|
|
1882
|
+
port: number;
|
|
1883
|
+
}
|
|
1884
|
+
declare interface TlsOptions {
|
|
1885
|
+
expectedServerHostname?: string;
|
|
1886
|
+
}
|
|
1786
1887
|
declare interface BasicImageTransformations {
|
|
1787
1888
|
/**
|
|
1788
1889
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -1862,7 +1963,7 @@ declare interface BasicImageTransformationsGravityCoordinates {
|
|
|
1862
1963
|
* Note: Currently, these properties cannot be tested in the
|
|
1863
1964
|
* playground.
|
|
1864
1965
|
*/
|
|
1865
|
-
declare interface RequestInitCfProperties {
|
|
1966
|
+
declare interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1866
1967
|
cacheEverything?: boolean;
|
|
1867
1968
|
/**
|
|
1868
1969
|
* A request's cache key is what determines if two requests are
|
|
@@ -2032,6 +2133,49 @@ declare interface RequestInitCfPropertiesImage
|
|
|
2032
2133
|
* the origin.
|
|
2033
2134
|
*/
|
|
2034
2135
|
"origin-auth"?: "share-publicly";
|
|
2136
|
+
/**
|
|
2137
|
+
* Adds a border around the image. The border is added after resizing. Border
|
|
2138
|
+
* width takes dpr into account, and can be specified either using a single
|
|
2139
|
+
* width property, or individually for each side.
|
|
2140
|
+
*/
|
|
2141
|
+
border?:
|
|
2142
|
+
| {
|
|
2143
|
+
color: string;
|
|
2144
|
+
width: number;
|
|
2145
|
+
}
|
|
2146
|
+
| {
|
|
2147
|
+
color: string;
|
|
2148
|
+
top: number;
|
|
2149
|
+
right: number;
|
|
2150
|
+
bottom: number;
|
|
2151
|
+
left: number;
|
|
2152
|
+
};
|
|
2153
|
+
/**
|
|
2154
|
+
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
2155
|
+
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
2156
|
+
* 0 is ignored.
|
|
2157
|
+
*/
|
|
2158
|
+
brightness?: number;
|
|
2159
|
+
/**
|
|
2160
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
2161
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
2162
|
+
* ignored.
|
|
2163
|
+
*/
|
|
2164
|
+
contrast?: number;
|
|
2165
|
+
/**
|
|
2166
|
+
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
2167
|
+
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
2168
|
+
*/
|
|
2169
|
+
gamma?: number;
|
|
2170
|
+
/**
|
|
2171
|
+
* Slightly reduces latency on a cache miss by selecting a
|
|
2172
|
+
* quickest-to-compress file format, at a cost of increased file size and
|
|
2173
|
+
* lower image quality. It will usually override the format option and choose
|
|
2174
|
+
* JPEG over WebP or AVIF. We do not recommend using this option, except in
|
|
2175
|
+
* unusual circumstances like resizing uncacheable dynamically-generated
|
|
2176
|
+
* images.
|
|
2177
|
+
*/
|
|
2178
|
+
compression?: "fast";
|
|
2035
2179
|
}
|
|
2036
2180
|
declare interface RequestInitCfPropertiesImageMinify {
|
|
2037
2181
|
javascript?: boolean;
|
|
@@ -2047,7 +2191,8 @@ declare type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2047
2191
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2048
2192
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2049
2193
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2050
|
-
declare interface IncomingRequestCfPropertiesBase
|
|
2194
|
+
declare interface IncomingRequestCfPropertiesBase
|
|
2195
|
+
extends Record<string, unknown> {
|
|
2051
2196
|
/**
|
|
2052
2197
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2053
2198
|
*
|
|
@@ -2128,8 +2273,7 @@ declare interface IncomingRequestCfPropertiesBase {
|
|
|
2128
2273
|
declare interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2129
2274
|
/**
|
|
2130
2275
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2131
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2132
|
-
* and `99` (almost certainly a bot).
|
|
2276
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2133
2277
|
*
|
|
2134
2278
|
* @example 54
|
|
2135
2279
|
*/
|
|
@@ -2240,86 +2384,82 @@ declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2240
2384
|
/**
|
|
2241
2385
|
* Geographic data about the request's origin.
|
|
2242
2386
|
*/
|
|
2243
|
-
declare
|
|
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
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
* @example "635"
|
|
2320
|
-
*/
|
|
2321
|
-
metroCode?: string;
|
|
2322
|
-
};
|
|
2387
|
+
declare interface IncomingRequestCfPropertiesGeographicInformation {
|
|
2388
|
+
/**
|
|
2389
|
+
* The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
|
|
2390
|
+
*
|
|
2391
|
+
* 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.
|
|
2392
|
+
*
|
|
2393
|
+
* If Cloudflare is unable to determine where the request originated this property is omitted.
|
|
2394
|
+
*
|
|
2395
|
+
* The country code `"T1"` is used for requests originating on TOR.
|
|
2396
|
+
*
|
|
2397
|
+
* @example "GB"
|
|
2398
|
+
*/
|
|
2399
|
+
country?: Iso3166Alpha2Code | "T1";
|
|
2400
|
+
/**
|
|
2401
|
+
* If present, this property indicates that the request originated in the EU
|
|
2402
|
+
*
|
|
2403
|
+
* @example "1"
|
|
2404
|
+
*/
|
|
2405
|
+
isEUCountry?: "1";
|
|
2406
|
+
/**
|
|
2407
|
+
* A two-letter code indicating the continent the request originated from.
|
|
2408
|
+
*
|
|
2409
|
+
* @example "AN"
|
|
2410
|
+
*/
|
|
2411
|
+
continent?: ContinentCode;
|
|
2412
|
+
/**
|
|
2413
|
+
* The city the request originated from
|
|
2414
|
+
*
|
|
2415
|
+
* @example "Austin"
|
|
2416
|
+
*/
|
|
2417
|
+
city?: string;
|
|
2418
|
+
/**
|
|
2419
|
+
* Postal code of the incoming request
|
|
2420
|
+
*
|
|
2421
|
+
* @example "78701"
|
|
2422
|
+
*/
|
|
2423
|
+
postalCode?: string;
|
|
2424
|
+
/**
|
|
2425
|
+
* Latitude of the incoming request
|
|
2426
|
+
*
|
|
2427
|
+
* @example "30.27130"
|
|
2428
|
+
*/
|
|
2429
|
+
latitude?: string;
|
|
2430
|
+
/**
|
|
2431
|
+
* Longitude of the incoming request
|
|
2432
|
+
*
|
|
2433
|
+
* @example "-97.74260"
|
|
2434
|
+
*/
|
|
2435
|
+
longitude?: string;
|
|
2436
|
+
/**
|
|
2437
|
+
* Timezone of the incoming request
|
|
2438
|
+
*
|
|
2439
|
+
* @example "America/Chicago"
|
|
2440
|
+
*/
|
|
2441
|
+
timezone?: string;
|
|
2442
|
+
/**
|
|
2443
|
+
* If known, the ISO 3166-2 name for the first level region associated with
|
|
2444
|
+
* the IP address of the incoming request
|
|
2445
|
+
*
|
|
2446
|
+
* @example "Texas"
|
|
2447
|
+
*/
|
|
2448
|
+
region?: string;
|
|
2449
|
+
/**
|
|
2450
|
+
* If known, the ISO 3166-2 code for the first-level region associated with
|
|
2451
|
+
* the IP address of the incoming request
|
|
2452
|
+
*
|
|
2453
|
+
* @example "TX"
|
|
2454
|
+
*/
|
|
2455
|
+
regionCode?: string;
|
|
2456
|
+
/**
|
|
2457
|
+
* Metro code (DMA) of the incoming request
|
|
2458
|
+
*
|
|
2459
|
+
* @example "635"
|
|
2460
|
+
*/
|
|
2461
|
+
metroCode?: string;
|
|
2462
|
+
}
|
|
2323
2463
|
/** Data about the incoming request's TLS certificate */
|
|
2324
2464
|
declare interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2325
2465
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2712,6 +2852,9 @@ declare type Iso3166Alpha2Code =
|
|
|
2712
2852
|
| "ZW";
|
|
2713
2853
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2714
2854
|
declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2855
|
+
declare type CfProperties<HostMetadata = unknown> =
|
|
2856
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2857
|
+
| RequestInitCfProperties;
|
|
2715
2858
|
declare interface D1Result<T = unknown> {
|
|
2716
2859
|
results?: T[];
|
|
2717
2860
|
success: boolean;
|
|
@@ -2732,7 +2875,7 @@ declare abstract class D1PreparedStatement {
|
|
|
2732
2875
|
raw<T = unknown>(): Promise<T[]>;
|
|
2733
2876
|
}
|
|
2734
2877
|
/**
|
|
2735
|
-
*
|
|
2878
|
+
* An email message that can be sent from a Worker.
|
|
2736
2879
|
*/
|
|
2737
2880
|
declare interface EmailMessage {
|
|
2738
2881
|
/**
|
|
@@ -2743,14 +2886,19 @@ declare interface EmailMessage {
|
|
|
2743
2886
|
* Envelope To attribute of the email message.
|
|
2744
2887
|
*/
|
|
2745
2888
|
readonly to: string;
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2889
|
+
}
|
|
2890
|
+
/**
|
|
2891
|
+
* An email message that is sent to a consumer Worker and can be rejected/forwarded.
|
|
2892
|
+
*/
|
|
2893
|
+
declare interface ForwardableEmailMessage extends EmailMessage {
|
|
2750
2894
|
/**
|
|
2751
2895
|
* Stream of the email message content.
|
|
2752
2896
|
*/
|
|
2753
2897
|
readonly raw: ReadableStream;
|
|
2898
|
+
/**
|
|
2899
|
+
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2900
|
+
*/
|
|
2901
|
+
readonly headers: Headers;
|
|
2754
2902
|
/**
|
|
2755
2903
|
* Size of the email message content.
|
|
2756
2904
|
*/
|
|
@@ -2769,14 +2917,27 @@ declare interface EmailMessage {
|
|
|
2769
2917
|
*/
|
|
2770
2918
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2771
2919
|
}
|
|
2920
|
+
/**
|
|
2921
|
+
* A binding that allows a Worker to send email messages.
|
|
2922
|
+
*/
|
|
2923
|
+
declare interface SendEmail {
|
|
2924
|
+
send(message: EmailMessage): Promise<void>;
|
|
2925
|
+
}
|
|
2772
2926
|
declare abstract class EmailEvent extends ExtendableEvent {
|
|
2773
|
-
readonly message:
|
|
2927
|
+
readonly message: ForwardableEmailMessage;
|
|
2774
2928
|
}
|
|
2775
2929
|
declare type EmailExportedHandler<Env = unknown> = (
|
|
2776
|
-
message:
|
|
2930
|
+
message: ForwardableEmailMessage,
|
|
2777
2931
|
env: Env,
|
|
2778
2932
|
ctx: ExecutionContext
|
|
2779
2933
|
) => void | Promise<void>;
|
|
2934
|
+
declare module "cloudflare:email" {
|
|
2935
|
+
let _EmailMessage: {
|
|
2936
|
+
prototype: EmailMessage;
|
|
2937
|
+
new (from: string, to: string, raw: ReadableStream | string): EmailMessage;
|
|
2938
|
+
};
|
|
2939
|
+
export { _EmailMessage as EmailMessage };
|
|
2940
|
+
}
|
|
2780
2941
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2781
2942
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2782
2943
|
request: Request;
|
|
@@ -2857,75 +3018,12 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2857
3018
|
// Key Identifier of the JWK
|
|
2858
3019
|
readonly kid: string;
|
|
2859
3020
|
}
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
*/
|
|
2863
|
-
declare interface Message<Body = unknown> {
|
|
2864
|
-
/**
|
|
2865
|
-
* A unique, system-generated ID for the message.
|
|
2866
|
-
*/
|
|
2867
|
-
readonly id: string;
|
|
3021
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3022
|
+
declare interface DispatchNamespace {
|
|
2868
3023
|
/**
|
|
2869
|
-
*
|
|
3024
|
+
* @param name Name of the Worker script.
|
|
3025
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
3026
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2870
3027
|
*/
|
|
2871
|
-
|
|
2872
|
-
/**
|
|
2873
|
-
* The body of the message.
|
|
2874
|
-
*/
|
|
2875
|
-
readonly body: Body;
|
|
2876
|
-
/**
|
|
2877
|
-
* Marks message to be retried.
|
|
2878
|
-
*/
|
|
2879
|
-
retry(): void;
|
|
2880
|
-
/**
|
|
2881
|
-
* Marks message acknowledged.
|
|
2882
|
-
*/
|
|
2883
|
-
ack(): void;
|
|
2884
|
-
}
|
|
2885
|
-
/**
|
|
2886
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2887
|
-
*/
|
|
2888
|
-
declare interface MessageBatch<Body = unknown> {
|
|
2889
|
-
/**
|
|
2890
|
-
* The name of the Queue that belongs to this batch.
|
|
2891
|
-
*/
|
|
2892
|
-
readonly queue: string;
|
|
2893
|
-
/**
|
|
2894
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2895
|
-
*/
|
|
2896
|
-
readonly messages: readonly Message<Body>[];
|
|
2897
|
-
/**
|
|
2898
|
-
* Marks every message to be retried in the next batch.
|
|
2899
|
-
*/
|
|
2900
|
-
retryAll(): void;
|
|
2901
|
-
/**
|
|
2902
|
-
* Marks every message acknowledged in the batch.
|
|
2903
|
-
*/
|
|
2904
|
-
ackAll(): void;
|
|
2905
|
-
}
|
|
2906
|
-
/**
|
|
2907
|
-
* A wrapper class used to structure message batches.
|
|
2908
|
-
*/
|
|
2909
|
-
declare type MessageSendRequest<Body = unknown> = {
|
|
2910
|
-
/**
|
|
2911
|
-
* The body of the message.
|
|
2912
|
-
*/
|
|
2913
|
-
body: Body;
|
|
2914
|
-
};
|
|
2915
|
-
/**
|
|
2916
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
2917
|
-
*/
|
|
2918
|
-
declare interface Queue<Body = any> {
|
|
2919
|
-
/**
|
|
2920
|
-
* Sends a message to the Queue.
|
|
2921
|
-
* @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.
|
|
2922
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2923
|
-
*/
|
|
2924
|
-
send(message: Body): Promise<void>;
|
|
2925
|
-
/**
|
|
2926
|
-
* Sends a batch of messages to the Queue.
|
|
2927
|
-
* @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.
|
|
2928
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2929
|
-
*/
|
|
2930
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
3028
|
+
get(name: string): Fetcher;
|
|
2931
3029
|
}
|