@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-11-30/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;
|
|
@@ -285,17 +289,27 @@ declare const self: ServiceWorkerGlobalScope;
|
|
|
285
289
|
declare const crypto: Crypto;
|
|
286
290
|
declare const caches: CacheStorage;
|
|
287
291
|
declare const scheduler: Scheduler;
|
|
292
|
+
declare const performance: Performance;
|
|
293
|
+
declare const origin: string;
|
|
288
294
|
declare const navigator: Navigator;
|
|
289
295
|
declare interface TestController {}
|
|
290
296
|
declare interface ExecutionContext {
|
|
291
297
|
waitUntil(promise: Promise<any>): void;
|
|
292
298
|
passThroughOnException(): void;
|
|
293
299
|
}
|
|
294
|
-
declare type ExportedHandlerFetchHandler<
|
|
295
|
-
|
|
300
|
+
declare type ExportedHandlerFetchHandler<
|
|
301
|
+
Env = unknown,
|
|
302
|
+
CfHostMetadata = unknown
|
|
303
|
+
> = (
|
|
304
|
+
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
296
305
|
env: Env,
|
|
297
306
|
ctx: ExecutionContext
|
|
298
307
|
) => Response | Promise<Response>;
|
|
308
|
+
declare type ExportedHandlerTailHandler<Env = unknown> = (
|
|
309
|
+
events: TraceItem[],
|
|
310
|
+
env: Env,
|
|
311
|
+
ctx: ExecutionContext
|
|
312
|
+
) => void | Promise<void>;
|
|
299
313
|
declare type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
300
314
|
traces: TraceItem[],
|
|
301
315
|
env: Env,
|
|
@@ -316,12 +330,17 @@ declare type ExportedHandlerTestHandler<Env = unknown> = (
|
|
|
316
330
|
env: Env,
|
|
317
331
|
ctx: ExecutionContext
|
|
318
332
|
) => void | Promise<void>;
|
|
319
|
-
declare interface ExportedHandler<
|
|
320
|
-
|
|
333
|
+
declare interface ExportedHandler<
|
|
334
|
+
Env = unknown,
|
|
335
|
+
QueueMessage = unknown,
|
|
336
|
+
CfHostMetadata = unknown
|
|
337
|
+
> {
|
|
338
|
+
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
339
|
+
tail?: ExportedHandlerTailHandler<Env>;
|
|
321
340
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
322
341
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
323
342
|
test?: ExportedHandlerTestHandler<Env>;
|
|
324
|
-
queue?: ExportedHandlerQueueHandler<Env,
|
|
343
|
+
queue?: ExportedHandlerQueueHandler<Env, Message>;
|
|
325
344
|
}
|
|
326
345
|
declare interface StructuredSerializeOptions {
|
|
327
346
|
transfer?: any[];
|
|
@@ -333,6 +352,11 @@ declare abstract class PromiseRejectionEvent extends Event {
|
|
|
333
352
|
declare abstract class Navigator {
|
|
334
353
|
readonly userAgent: string;
|
|
335
354
|
}
|
|
355
|
+
/** 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. */
|
|
356
|
+
declare interface Performance {
|
|
357
|
+
readonly timeOrigin: number;
|
|
358
|
+
now(): number;
|
|
359
|
+
}
|
|
336
360
|
declare interface DurableObject {
|
|
337
361
|
fetch(request: Request): Response | Promise<Response>;
|
|
338
362
|
alarm?(): void | Promise<void>;
|
|
@@ -356,19 +380,32 @@ declare interface DurableObjectNamespace {
|
|
|
356
380
|
id: DurableObjectId,
|
|
357
381
|
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
358
382
|
): DurableObjectStub;
|
|
359
|
-
jurisdiction(jurisdiction:
|
|
383
|
+
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
|
|
360
384
|
}
|
|
385
|
+
declare type DurableObjectJurisdiction = "eu" | "fedramp";
|
|
361
386
|
declare interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
362
|
-
jurisdiction?:
|
|
363
|
-
}
|
|
387
|
+
jurisdiction?: DurableObjectJurisdiction;
|
|
388
|
+
}
|
|
389
|
+
declare type DurableObjectLocationHint =
|
|
390
|
+
| "wnam"
|
|
391
|
+
| "enam"
|
|
392
|
+
| "sam"
|
|
393
|
+
| "weur"
|
|
394
|
+
| "eeur"
|
|
395
|
+
| "apac"
|
|
396
|
+
| "oc"
|
|
397
|
+
| "afr"
|
|
398
|
+
| "me";
|
|
364
399
|
declare interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
365
|
-
locationHint?:
|
|
400
|
+
locationHint?: DurableObjectLocationHint;
|
|
366
401
|
}
|
|
367
402
|
declare interface DurableObjectState {
|
|
368
403
|
waitUntil(promise: Promise<any>): void;
|
|
369
404
|
readonly id: DurableObjectId;
|
|
370
405
|
readonly storage: DurableObjectStorage;
|
|
371
406
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
407
|
+
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
408
|
+
getWebSockets(tag?: string): WebSocket[];
|
|
372
409
|
}
|
|
373
410
|
declare interface DurableObjectTransaction {
|
|
374
411
|
get<T = unknown>(
|
|
@@ -435,6 +472,7 @@ declare interface DurableObjectStorage {
|
|
|
435
472
|
): Promise<void>;
|
|
436
473
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
437
474
|
sync(): Promise<void>;
|
|
475
|
+
transactionSync<T>(closure: () => T): T;
|
|
438
476
|
}
|
|
439
477
|
declare interface DurableObjectListOptions {
|
|
440
478
|
start?: string;
|
|
@@ -544,6 +582,7 @@ declare class AbortController {
|
|
|
544
582
|
declare abstract class AbortSignal extends EventTarget {
|
|
545
583
|
static abort(reason?: any): AbortSignal;
|
|
546
584
|
static timeout(delay: number): AbortSignal;
|
|
585
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
547
586
|
get aborted(): boolean;
|
|
548
587
|
get reason(): any;
|
|
549
588
|
throwIfAborted(): void;
|
|
@@ -992,23 +1031,27 @@ declare interface ResponseInit {
|
|
|
992
1031
|
webSocket?: WebSocket | null;
|
|
993
1032
|
encodeBody?: "automatic" | "manual";
|
|
994
1033
|
}
|
|
995
|
-
declare type RequestInfo
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
1034
|
+
declare type RequestInfo<
|
|
1035
|
+
CfHostMetadata = unknown,
|
|
1036
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1037
|
+
> = Request<CfHostMetadata, Cf> | string | URL;
|
|
1038
|
+
declare class Request<
|
|
1039
|
+
CfHostMetadata = unknown,
|
|
1040
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1041
|
+
> extends Body {
|
|
1042
|
+
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1043
|
+
clone(): Request<CfHostMetadata, Cf>;
|
|
999
1044
|
get method(): string;
|
|
1000
1045
|
get url(): string;
|
|
1001
1046
|
get headers(): Headers;
|
|
1002
1047
|
get redirect(): string;
|
|
1003
1048
|
get fetcher(): Fetcher | null;
|
|
1004
1049
|
get signal(): AbortSignal;
|
|
1005
|
-
get cf():
|
|
1050
|
+
get cf(): Cf | undefined;
|
|
1006
1051
|
get integrity(): string;
|
|
1007
1052
|
get keepalive(): boolean;
|
|
1008
1053
|
}
|
|
1009
|
-
declare interface RequestInit<
|
|
1010
|
-
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
1011
|
-
> {
|
|
1054
|
+
declare interface RequestInit<Cf = CfProperties> {
|
|
1012
1055
|
/** A string to set request's method. */
|
|
1013
1056
|
method?: string;
|
|
1014
1057
|
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
@@ -1018,17 +1061,15 @@ declare interface RequestInit<
|
|
|
1018
1061
|
/** 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. */
|
|
1019
1062
|
redirect?: string;
|
|
1020
1063
|
fetcher?: Fetcher | null;
|
|
1021
|
-
cf?:
|
|
1064
|
+
cf?: Cf;
|
|
1022
1065
|
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1023
1066
|
integrity?: string;
|
|
1024
1067
|
/** An AbortSignal to set request's signal. */
|
|
1025
1068
|
signal?: AbortSignal | null;
|
|
1026
1069
|
}
|
|
1027
1070
|
declare abstract class Fetcher {
|
|
1028
|
-
fetch(
|
|
1029
|
-
|
|
1030
|
-
init?: RequestInit<RequestInitCfProperties>
|
|
1031
|
-
): Promise<Response>;
|
|
1071
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1072
|
+
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1032
1073
|
}
|
|
1033
1074
|
declare interface FetcherPutOptions {
|
|
1034
1075
|
expiration?: number;
|
|
@@ -1141,6 +1182,33 @@ declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1141
1182
|
value: Value | null;
|
|
1142
1183
|
metadata: Metadata | null;
|
|
1143
1184
|
}
|
|
1185
|
+
declare interface Queue<Body> {
|
|
1186
|
+
send(message: Body): Promise<void>;
|
|
1187
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1188
|
+
}
|
|
1189
|
+
declare interface QueueSendOptions {}
|
|
1190
|
+
declare interface MessageSendRequest<Body = unknown> {
|
|
1191
|
+
body: Body;
|
|
1192
|
+
}
|
|
1193
|
+
declare interface Message<Body = unknown> {
|
|
1194
|
+
readonly id: string;
|
|
1195
|
+
readonly timestamp: Date;
|
|
1196
|
+
readonly body: Body;
|
|
1197
|
+
retry(): void;
|
|
1198
|
+
ack(): void;
|
|
1199
|
+
}
|
|
1200
|
+
declare interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1201
|
+
readonly messages: readonly Message<Body>[];
|
|
1202
|
+
readonly queue: string;
|
|
1203
|
+
retryAll(): void;
|
|
1204
|
+
ackAll(): void;
|
|
1205
|
+
}
|
|
1206
|
+
declare interface MessageBatch<Body = unknown> {
|
|
1207
|
+
readonly messages: readonly Message<Body>[];
|
|
1208
|
+
readonly queue: string;
|
|
1209
|
+
retryAll(): void;
|
|
1210
|
+
ackAll(): void;
|
|
1211
|
+
}
|
|
1144
1212
|
declare interface R2Error extends Error {
|
|
1145
1213
|
readonly name: string;
|
|
1146
1214
|
readonly code: number;
|
|
@@ -1292,12 +1360,18 @@ declare interface R2HTTPMetadata {
|
|
|
1292
1360
|
cacheControl?: string;
|
|
1293
1361
|
cacheExpiry?: Date;
|
|
1294
1362
|
}
|
|
1295
|
-
declare
|
|
1363
|
+
declare type R2Objects = {
|
|
1296
1364
|
objects: R2Object[];
|
|
1297
|
-
truncated: boolean;
|
|
1298
|
-
cursor?: string;
|
|
1299
1365
|
delimitedPrefixes: string[];
|
|
1300
|
-
}
|
|
1366
|
+
} & (
|
|
1367
|
+
| {
|
|
1368
|
+
truncated: true;
|
|
1369
|
+
cursor: string;
|
|
1370
|
+
}
|
|
1371
|
+
| {
|
|
1372
|
+
truncated: false;
|
|
1373
|
+
}
|
|
1374
|
+
);
|
|
1301
1375
|
declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1302
1376
|
readonly scheduledTime: number;
|
|
1303
1377
|
readonly cron: string;
|
|
@@ -1507,13 +1581,19 @@ declare class TransformStream<I = any, O = any> {
|
|
|
1507
1581
|
get writable(): WritableStream<I>;
|
|
1508
1582
|
}
|
|
1509
1583
|
declare class FixedLengthStream extends IdentityTransformStream {
|
|
1510
|
-
constructor(
|
|
1584
|
+
constructor(
|
|
1585
|
+
expectedLength: number | bigint,
|
|
1586
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy
|
|
1587
|
+
);
|
|
1511
1588
|
}
|
|
1512
1589
|
declare class IdentityTransformStream extends TransformStream<
|
|
1513
1590
|
ArrayBuffer | ArrayBufferView,
|
|
1514
1591
|
Uint8Array
|
|
1515
1592
|
> {
|
|
1516
|
-
constructor();
|
|
1593
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
1594
|
+
}
|
|
1595
|
+
declare interface IdentityTransformStreamQueuingStrategy {
|
|
1596
|
+
highWaterMark?: number | bigint;
|
|
1517
1597
|
}
|
|
1518
1598
|
declare interface ReadableStreamValuesOptions {
|
|
1519
1599
|
preventCancel?: boolean;
|
|
@@ -1562,7 +1642,8 @@ declare interface QueuingStrategyInit {
|
|
|
1562
1642
|
*/
|
|
1563
1643
|
highWaterMark: number;
|
|
1564
1644
|
}
|
|
1565
|
-
declare abstract class
|
|
1645
|
+
declare abstract class TailEvent extends ExtendableEvent {
|
|
1646
|
+
readonly events: TraceItem[];
|
|
1566
1647
|
readonly traces: TraceItem[];
|
|
1567
1648
|
}
|
|
1568
1649
|
declare interface TraceItem {
|
|
@@ -1658,6 +1739,7 @@ declare class URL {
|
|
|
1658
1739
|
get searchParams(): URLSearchParams;
|
|
1659
1740
|
toJSON(): string;
|
|
1660
1741
|
toString(): string;
|
|
1742
|
+
static canParse(url: string, base?: string): boolean;
|
|
1661
1743
|
}
|
|
1662
1744
|
declare class URLSearchParams {
|
|
1663
1745
|
constructor(
|
|
@@ -1665,10 +1747,10 @@ declare class URLSearchParams {
|
|
|
1665
1747
|
);
|
|
1666
1748
|
get size(): number;
|
|
1667
1749
|
append(name: string, value: string): void;
|
|
1668
|
-
delete(name: string): void;
|
|
1750
|
+
delete(name: string, value?: any): void;
|
|
1669
1751
|
get(name: string): string | null;
|
|
1670
1752
|
getAll(name: string): string[];
|
|
1671
|
-
has(name: string): boolean;
|
|
1753
|
+
has(name: string, value?: any): boolean;
|
|
1672
1754
|
set(name: string, value: string): void;
|
|
1673
1755
|
sort(): void;
|
|
1674
1756
|
entries(): IterableIterator<[key: string, value: string]>;
|
|
@@ -1768,6 +1850,8 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1768
1850
|
accept(): void;
|
|
1769
1851
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1770
1852
|
close(code?: number, reason?: string): void;
|
|
1853
|
+
serializeAttachment(attachment: any): void;
|
|
1854
|
+
deserializeAttachment(): any | null;
|
|
1771
1855
|
static readonly READY_STATE_CONNECTING: number;
|
|
1772
1856
|
static readonly READY_STATE_OPEN: number;
|
|
1773
1857
|
static readonly READY_STATE_CLOSING: number;
|
|
@@ -1783,6 +1867,24 @@ declare const WebSocketPair: {
|
|
|
1783
1867
|
1: WebSocket;
|
|
1784
1868
|
};
|
|
1785
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
|
+
}
|
|
1786
1888
|
declare interface BasicImageTransformations {
|
|
1787
1889
|
/**
|
|
1788
1890
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -1862,7 +1964,7 @@ declare interface BasicImageTransformationsGravityCoordinates {
|
|
|
1862
1964
|
* Note: Currently, these properties cannot be tested in the
|
|
1863
1965
|
* playground.
|
|
1864
1966
|
*/
|
|
1865
|
-
declare interface RequestInitCfProperties {
|
|
1967
|
+
declare interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1866
1968
|
cacheEverything?: boolean;
|
|
1867
1969
|
/**
|
|
1868
1970
|
* A request's cache key is what determines if two requests are
|
|
@@ -2032,6 +2134,49 @@ declare interface RequestInitCfPropertiesImage
|
|
|
2032
2134
|
* the origin.
|
|
2033
2135
|
*/
|
|
2034
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";
|
|
2035
2180
|
}
|
|
2036
2181
|
declare interface RequestInitCfPropertiesImageMinify {
|
|
2037
2182
|
javascript?: boolean;
|
|
@@ -2047,7 +2192,8 @@ declare type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2047
2192
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2048
2193
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2049
2194
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2050
|
-
declare interface IncomingRequestCfPropertiesBase
|
|
2195
|
+
declare interface IncomingRequestCfPropertiesBase
|
|
2196
|
+
extends Record<string, unknown> {
|
|
2051
2197
|
/**
|
|
2052
2198
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2053
2199
|
*
|
|
@@ -2128,8 +2274,7 @@ declare interface IncomingRequestCfPropertiesBase {
|
|
|
2128
2274
|
declare interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2129
2275
|
/**
|
|
2130
2276
|
* 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).
|
|
2277
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2133
2278
|
*
|
|
2134
2279
|
* @example 54
|
|
2135
2280
|
*/
|
|
@@ -2240,86 +2385,82 @@ declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2240
2385
|
/**
|
|
2241
2386
|
* Geographic data about the request's origin.
|
|
2242
2387
|
*/
|
|
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
|
-
};
|
|
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
|
+
}
|
|
2323
2464
|
/** Data about the incoming request's TLS certificate */
|
|
2324
2465
|
declare interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2325
2466
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2712,6 +2853,9 @@ declare type Iso3166Alpha2Code =
|
|
|
2712
2853
|
| "ZW";
|
|
2713
2854
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2714
2855
|
declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2856
|
+
declare type CfProperties<HostMetadata = unknown> =
|
|
2857
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2858
|
+
| RequestInitCfProperties;
|
|
2715
2859
|
declare interface D1Result<T = unknown> {
|
|
2716
2860
|
results?: T[];
|
|
2717
2861
|
success: boolean;
|
|
@@ -2732,7 +2876,7 @@ declare abstract class D1PreparedStatement {
|
|
|
2732
2876
|
raw<T = unknown>(): Promise<T[]>;
|
|
2733
2877
|
}
|
|
2734
2878
|
/**
|
|
2735
|
-
*
|
|
2879
|
+
* An email message that can be sent from a Worker.
|
|
2736
2880
|
*/
|
|
2737
2881
|
declare interface EmailMessage {
|
|
2738
2882
|
/**
|
|
@@ -2743,14 +2887,19 @@ declare interface EmailMessage {
|
|
|
2743
2887
|
* Envelope To attribute of the email message.
|
|
2744
2888
|
*/
|
|
2745
2889
|
readonly to: string;
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
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 {
|
|
2750
2895
|
/**
|
|
2751
2896
|
* Stream of the email message content.
|
|
2752
2897
|
*/
|
|
2753
2898
|
readonly raw: ReadableStream;
|
|
2899
|
+
/**
|
|
2900
|
+
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2901
|
+
*/
|
|
2902
|
+
readonly headers: Headers;
|
|
2754
2903
|
/**
|
|
2755
2904
|
* Size of the email message content.
|
|
2756
2905
|
*/
|
|
@@ -2769,14 +2918,27 @@ declare interface EmailMessage {
|
|
|
2769
2918
|
*/
|
|
2770
2919
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2771
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
|
+
}
|
|
2772
2927
|
declare abstract class EmailEvent extends ExtendableEvent {
|
|
2773
|
-
readonly message:
|
|
2928
|
+
readonly message: ForwardableEmailMessage;
|
|
2774
2929
|
}
|
|
2775
2930
|
declare type EmailExportedHandler<Env = unknown> = (
|
|
2776
|
-
message:
|
|
2931
|
+
message: ForwardableEmailMessage,
|
|
2777
2932
|
env: Env,
|
|
2778
2933
|
ctx: ExecutionContext
|
|
2779
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
|
+
}
|
|
2780
2942
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2781
2943
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2782
2944
|
request: Request;
|
|
@@ -2857,75 +3019,12 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2857
3019
|
// Key Identifier of the JWK
|
|
2858
3020
|
readonly kid: string;
|
|
2859
3021
|
}
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
*/
|
|
2863
|
-
declare interface Message<Body = unknown> {
|
|
2864
|
-
/**
|
|
2865
|
-
* A unique, system-generated ID for the message.
|
|
2866
|
-
*/
|
|
2867
|
-
readonly id: string;
|
|
2868
|
-
/**
|
|
2869
|
-
* A timestamp when the message was sent.
|
|
2870
|
-
*/
|
|
2871
|
-
readonly timestamp: Date;
|
|
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> = {
|
|
3022
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3023
|
+
declare interface DispatchNamespace {
|
|
2910
3024
|
/**
|
|
2911
|
-
*
|
|
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.
|
|
2912
3028
|
*/
|
|
2913
|
-
|
|
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>;
|
|
3029
|
+
get(name: string): Fetcher;
|
|
2931
3030
|
}
|