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