@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-10-31/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 {
|
|
@@ -1655,6 +1736,7 @@ declare class URL {
|
|
|
1655
1736
|
get searchParams(): URLSearchParams;
|
|
1656
1737
|
toJSON(): string;
|
|
1657
1738
|
toString(): string;
|
|
1739
|
+
static canParse(url: string, base?: string): boolean;
|
|
1658
1740
|
}
|
|
1659
1741
|
declare class URLSearchParams {
|
|
1660
1742
|
constructor(
|
|
@@ -1662,10 +1744,10 @@ declare class URLSearchParams {
|
|
|
1662
1744
|
);
|
|
1663
1745
|
get size(): number;
|
|
1664
1746
|
append(name: string, value: string): void;
|
|
1665
|
-
delete(name: string): void;
|
|
1747
|
+
delete(name: string, value?: any): void;
|
|
1666
1748
|
get(name: string): string | null;
|
|
1667
1749
|
getAll(name: string): string[];
|
|
1668
|
-
has(name: string): boolean;
|
|
1750
|
+
has(name: string, value?: any): boolean;
|
|
1669
1751
|
set(name: string, value: string): void;
|
|
1670
1752
|
sort(): void;
|
|
1671
1753
|
entries(): IterableIterator<[key: string, value: string]>;
|
|
@@ -1765,6 +1847,8 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1765
1847
|
accept(): void;
|
|
1766
1848
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1767
1849
|
close(code?: number, reason?: string): void;
|
|
1850
|
+
serializeAttachment(attachment: any): void;
|
|
1851
|
+
deserializeAttachment(): any | null;
|
|
1768
1852
|
static readonly READY_STATE_CONNECTING: number;
|
|
1769
1853
|
static readonly READY_STATE_OPEN: number;
|
|
1770
1854
|
static readonly READY_STATE_CLOSING: number;
|
|
@@ -1780,6 +1864,24 @@ declare const WebSocketPair: {
|
|
|
1780
1864
|
1: WebSocket;
|
|
1781
1865
|
};
|
|
1782
1866
|
};
|
|
1867
|
+
declare interface Socket {
|
|
1868
|
+
get readable(): ReadableStream;
|
|
1869
|
+
get writable(): WritableStream;
|
|
1870
|
+
get closed(): Promise<void>;
|
|
1871
|
+
close(): Promise<void>;
|
|
1872
|
+
startTls(options?: TlsOptions): Socket;
|
|
1873
|
+
}
|
|
1874
|
+
declare interface SocketOptions {
|
|
1875
|
+
secureTransport?: string;
|
|
1876
|
+
allowHalfOpen: boolean;
|
|
1877
|
+
}
|
|
1878
|
+
declare interface SocketAddress {
|
|
1879
|
+
hostname: string;
|
|
1880
|
+
port: number;
|
|
1881
|
+
}
|
|
1882
|
+
declare interface TlsOptions {
|
|
1883
|
+
expectedServerHostname?: string;
|
|
1884
|
+
}
|
|
1783
1885
|
declare interface BasicImageTransformations {
|
|
1784
1886
|
/**
|
|
1785
1887
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -1859,7 +1961,7 @@ declare interface BasicImageTransformationsGravityCoordinates {
|
|
|
1859
1961
|
* Note: Currently, these properties cannot be tested in the
|
|
1860
1962
|
* playground.
|
|
1861
1963
|
*/
|
|
1862
|
-
declare interface RequestInitCfProperties {
|
|
1964
|
+
declare interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1863
1965
|
cacheEverything?: boolean;
|
|
1864
1966
|
/**
|
|
1865
1967
|
* A request's cache key is what determines if two requests are
|
|
@@ -2029,6 +2131,49 @@ declare interface RequestInitCfPropertiesImage
|
|
|
2029
2131
|
* the origin.
|
|
2030
2132
|
*/
|
|
2031
2133
|
"origin-auth"?: "share-publicly";
|
|
2134
|
+
/**
|
|
2135
|
+
* Adds a border around the image. The border is added after resizing. Border
|
|
2136
|
+
* width takes dpr into account, and can be specified either using a single
|
|
2137
|
+
* width property, or individually for each side.
|
|
2138
|
+
*/
|
|
2139
|
+
border?:
|
|
2140
|
+
| {
|
|
2141
|
+
color: string;
|
|
2142
|
+
width: number;
|
|
2143
|
+
}
|
|
2144
|
+
| {
|
|
2145
|
+
color: string;
|
|
2146
|
+
top: number;
|
|
2147
|
+
right: number;
|
|
2148
|
+
bottom: number;
|
|
2149
|
+
left: number;
|
|
2150
|
+
};
|
|
2151
|
+
/**
|
|
2152
|
+
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
2153
|
+
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
2154
|
+
* 0 is ignored.
|
|
2155
|
+
*/
|
|
2156
|
+
brightness?: number;
|
|
2157
|
+
/**
|
|
2158
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
2159
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
2160
|
+
* ignored.
|
|
2161
|
+
*/
|
|
2162
|
+
contrast?: number;
|
|
2163
|
+
/**
|
|
2164
|
+
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
2165
|
+
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
2166
|
+
*/
|
|
2167
|
+
gamma?: number;
|
|
2168
|
+
/**
|
|
2169
|
+
* Slightly reduces latency on a cache miss by selecting a
|
|
2170
|
+
* quickest-to-compress file format, at a cost of increased file size and
|
|
2171
|
+
* lower image quality. It will usually override the format option and choose
|
|
2172
|
+
* JPEG over WebP or AVIF. We do not recommend using this option, except in
|
|
2173
|
+
* unusual circumstances like resizing uncacheable dynamically-generated
|
|
2174
|
+
* images.
|
|
2175
|
+
*/
|
|
2176
|
+
compression?: "fast";
|
|
2032
2177
|
}
|
|
2033
2178
|
declare interface RequestInitCfPropertiesImageMinify {
|
|
2034
2179
|
javascript?: boolean;
|
|
@@ -2044,7 +2189,8 @@ declare type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2044
2189
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2045
2190
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2046
2191
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2047
|
-
declare interface IncomingRequestCfPropertiesBase
|
|
2192
|
+
declare interface IncomingRequestCfPropertiesBase
|
|
2193
|
+
extends Record<string, unknown> {
|
|
2048
2194
|
/**
|
|
2049
2195
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2050
2196
|
*
|
|
@@ -2125,8 +2271,7 @@ declare interface IncomingRequestCfPropertiesBase {
|
|
|
2125
2271
|
declare interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2126
2272
|
/**
|
|
2127
2273
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2128
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2129
|
-
* and `99` (almost certainly a bot).
|
|
2274
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2130
2275
|
*
|
|
2131
2276
|
* @example 54
|
|
2132
2277
|
*/
|
|
@@ -2237,86 +2382,82 @@ declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2237
2382
|
/**
|
|
2238
2383
|
* Geographic data about the request's origin.
|
|
2239
2384
|
*/
|
|
2240
|
-
declare
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
* @example "635"
|
|
2317
|
-
*/
|
|
2318
|
-
metroCode?: string;
|
|
2319
|
-
};
|
|
2385
|
+
declare interface IncomingRequestCfPropertiesGeographicInformation {
|
|
2386
|
+
/**
|
|
2387
|
+
* The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
|
|
2388
|
+
*
|
|
2389
|
+
* 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.
|
|
2390
|
+
*
|
|
2391
|
+
* If Cloudflare is unable to determine where the request originated this property is omitted.
|
|
2392
|
+
*
|
|
2393
|
+
* The country code `"T1"` is used for requests originating on TOR.
|
|
2394
|
+
*
|
|
2395
|
+
* @example "GB"
|
|
2396
|
+
*/
|
|
2397
|
+
country?: Iso3166Alpha2Code | "T1";
|
|
2398
|
+
/**
|
|
2399
|
+
* If present, this property indicates that the request originated in the EU
|
|
2400
|
+
*
|
|
2401
|
+
* @example "1"
|
|
2402
|
+
*/
|
|
2403
|
+
isEUCountry?: "1";
|
|
2404
|
+
/**
|
|
2405
|
+
* A two-letter code indicating the continent the request originated from.
|
|
2406
|
+
*
|
|
2407
|
+
* @example "AN"
|
|
2408
|
+
*/
|
|
2409
|
+
continent?: ContinentCode;
|
|
2410
|
+
/**
|
|
2411
|
+
* The city the request originated from
|
|
2412
|
+
*
|
|
2413
|
+
* @example "Austin"
|
|
2414
|
+
*/
|
|
2415
|
+
city?: string;
|
|
2416
|
+
/**
|
|
2417
|
+
* Postal code of the incoming request
|
|
2418
|
+
*
|
|
2419
|
+
* @example "78701"
|
|
2420
|
+
*/
|
|
2421
|
+
postalCode?: string;
|
|
2422
|
+
/**
|
|
2423
|
+
* Latitude of the incoming request
|
|
2424
|
+
*
|
|
2425
|
+
* @example "30.27130"
|
|
2426
|
+
*/
|
|
2427
|
+
latitude?: string;
|
|
2428
|
+
/**
|
|
2429
|
+
* Longitude of the incoming request
|
|
2430
|
+
*
|
|
2431
|
+
* @example "-97.74260"
|
|
2432
|
+
*/
|
|
2433
|
+
longitude?: string;
|
|
2434
|
+
/**
|
|
2435
|
+
* Timezone of the incoming request
|
|
2436
|
+
*
|
|
2437
|
+
* @example "America/Chicago"
|
|
2438
|
+
*/
|
|
2439
|
+
timezone?: string;
|
|
2440
|
+
/**
|
|
2441
|
+
* If known, the ISO 3166-2 name for the first level region associated with
|
|
2442
|
+
* the IP address of the incoming request
|
|
2443
|
+
*
|
|
2444
|
+
* @example "Texas"
|
|
2445
|
+
*/
|
|
2446
|
+
region?: string;
|
|
2447
|
+
/**
|
|
2448
|
+
* If known, the ISO 3166-2 code for the first-level region associated with
|
|
2449
|
+
* the IP address of the incoming request
|
|
2450
|
+
*
|
|
2451
|
+
* @example "TX"
|
|
2452
|
+
*/
|
|
2453
|
+
regionCode?: string;
|
|
2454
|
+
/**
|
|
2455
|
+
* Metro code (DMA) of the incoming request
|
|
2456
|
+
*
|
|
2457
|
+
* @example "635"
|
|
2458
|
+
*/
|
|
2459
|
+
metroCode?: string;
|
|
2460
|
+
}
|
|
2320
2461
|
/** Data about the incoming request's TLS certificate */
|
|
2321
2462
|
declare interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2322
2463
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2709,6 +2850,9 @@ declare type Iso3166Alpha2Code =
|
|
|
2709
2850
|
| "ZW";
|
|
2710
2851
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2711
2852
|
declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2853
|
+
declare type CfProperties<HostMetadata = unknown> =
|
|
2854
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2855
|
+
| RequestInitCfProperties;
|
|
2712
2856
|
declare interface D1Result<T = unknown> {
|
|
2713
2857
|
results?: T[];
|
|
2714
2858
|
success: boolean;
|
|
@@ -2729,7 +2873,7 @@ declare abstract class D1PreparedStatement {
|
|
|
2729
2873
|
raw<T = unknown>(): Promise<T[]>;
|
|
2730
2874
|
}
|
|
2731
2875
|
/**
|
|
2732
|
-
*
|
|
2876
|
+
* An email message that can be sent from a Worker.
|
|
2733
2877
|
*/
|
|
2734
2878
|
declare interface EmailMessage {
|
|
2735
2879
|
/**
|
|
@@ -2740,14 +2884,19 @@ declare interface EmailMessage {
|
|
|
2740
2884
|
* Envelope To attribute of the email message.
|
|
2741
2885
|
*/
|
|
2742
2886
|
readonly to: string;
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2887
|
+
}
|
|
2888
|
+
/**
|
|
2889
|
+
* An email message that is sent to a consumer Worker and can be rejected/forwarded.
|
|
2890
|
+
*/
|
|
2891
|
+
declare interface ForwardableEmailMessage extends EmailMessage {
|
|
2747
2892
|
/**
|
|
2748
2893
|
* Stream of the email message content.
|
|
2749
2894
|
*/
|
|
2750
2895
|
readonly raw: ReadableStream;
|
|
2896
|
+
/**
|
|
2897
|
+
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2898
|
+
*/
|
|
2899
|
+
readonly headers: Headers;
|
|
2751
2900
|
/**
|
|
2752
2901
|
* Size of the email message content.
|
|
2753
2902
|
*/
|
|
@@ -2766,14 +2915,27 @@ declare interface EmailMessage {
|
|
|
2766
2915
|
*/
|
|
2767
2916
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2768
2917
|
}
|
|
2918
|
+
/**
|
|
2919
|
+
* A binding that allows a Worker to send email messages.
|
|
2920
|
+
*/
|
|
2921
|
+
declare interface SendEmail {
|
|
2922
|
+
send(message: EmailMessage): Promise<void>;
|
|
2923
|
+
}
|
|
2769
2924
|
declare abstract class EmailEvent extends ExtendableEvent {
|
|
2770
|
-
readonly message:
|
|
2925
|
+
readonly message: ForwardableEmailMessage;
|
|
2771
2926
|
}
|
|
2772
2927
|
declare type EmailExportedHandler<Env = unknown> = (
|
|
2773
|
-
message:
|
|
2928
|
+
message: ForwardableEmailMessage,
|
|
2774
2929
|
env: Env,
|
|
2775
2930
|
ctx: ExecutionContext
|
|
2776
2931
|
) => void | Promise<void>;
|
|
2932
|
+
declare module "cloudflare:email" {
|
|
2933
|
+
let _EmailMessage: {
|
|
2934
|
+
prototype: EmailMessage;
|
|
2935
|
+
new (from: string, to: string, raw: ReadableStream | string): EmailMessage;
|
|
2936
|
+
};
|
|
2937
|
+
export { _EmailMessage as EmailMessage };
|
|
2938
|
+
}
|
|
2777
2939
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2778
2940
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2779
2941
|
request: Request;
|
|
@@ -2854,75 +3016,12 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2854
3016
|
// Key Identifier of the JWK
|
|
2855
3017
|
readonly kid: string;
|
|
2856
3018
|
}
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
*/
|
|
2860
|
-
declare interface Message<Body = unknown> {
|
|
2861
|
-
/**
|
|
2862
|
-
* A unique, system-generated ID for the message.
|
|
2863
|
-
*/
|
|
2864
|
-
readonly id: string;
|
|
2865
|
-
/**
|
|
2866
|
-
* A timestamp when the message was sent.
|
|
2867
|
-
*/
|
|
2868
|
-
readonly timestamp: Date;
|
|
2869
|
-
/**
|
|
2870
|
-
* The body of the message.
|
|
2871
|
-
*/
|
|
2872
|
-
readonly body: Body;
|
|
2873
|
-
/**
|
|
2874
|
-
* Marks message to be retried.
|
|
2875
|
-
*/
|
|
2876
|
-
retry(): void;
|
|
2877
|
-
/**
|
|
2878
|
-
* Marks message acknowledged.
|
|
2879
|
-
*/
|
|
2880
|
-
ack(): void;
|
|
2881
|
-
}
|
|
2882
|
-
/**
|
|
2883
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2884
|
-
*/
|
|
2885
|
-
declare interface MessageBatch<Body = unknown> {
|
|
2886
|
-
/**
|
|
2887
|
-
* The name of the Queue that belongs to this batch.
|
|
2888
|
-
*/
|
|
2889
|
-
readonly queue: string;
|
|
2890
|
-
/**
|
|
2891
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2892
|
-
*/
|
|
2893
|
-
readonly messages: readonly Message<Body>[];
|
|
2894
|
-
/**
|
|
2895
|
-
* Marks every message to be retried in the next batch.
|
|
2896
|
-
*/
|
|
2897
|
-
retryAll(): void;
|
|
2898
|
-
/**
|
|
2899
|
-
* Marks every message acknowledged in the batch.
|
|
2900
|
-
*/
|
|
2901
|
-
ackAll(): void;
|
|
2902
|
-
}
|
|
2903
|
-
/**
|
|
2904
|
-
* A wrapper class used to structure message batches.
|
|
2905
|
-
*/
|
|
2906
|
-
declare type MessageSendRequest<Body = unknown> = {
|
|
3019
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3020
|
+
declare interface DispatchNamespace {
|
|
2907
3021
|
/**
|
|
2908
|
-
*
|
|
3022
|
+
* @param name Name of the Worker script.
|
|
3023
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
3024
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2909
3025
|
*/
|
|
2910
|
-
|
|
2911
|
-
};
|
|
2912
|
-
/**
|
|
2913
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
2914
|
-
*/
|
|
2915
|
-
declare interface Queue<Body = any> {
|
|
2916
|
-
/**
|
|
2917
|
-
* Sends a message to the Queue.
|
|
2918
|
-
* @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.
|
|
2919
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2920
|
-
*/
|
|
2921
|
-
send(message: Body): Promise<void>;
|
|
2922
|
-
/**
|
|
2923
|
-
* Sends a batch of messages to the Queue.
|
|
2924
|
-
* @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.
|
|
2925
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2926
|
-
*/
|
|
2927
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
3026
|
+
get(name: string): Fetcher;
|
|
2928
3027
|
}
|