@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.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;
|
|
@@ -287,17 +291,27 @@ export declare const self: ServiceWorkerGlobalScope;
|
|
|
287
291
|
export declare const crypto: Crypto;
|
|
288
292
|
export declare const caches: CacheStorage;
|
|
289
293
|
export declare const scheduler: Scheduler;
|
|
294
|
+
export declare const performance: Performance;
|
|
295
|
+
export declare const origin: string;
|
|
290
296
|
export declare const navigator: Navigator;
|
|
291
297
|
export interface TestController {}
|
|
292
298
|
export interface ExecutionContext {
|
|
293
299
|
waitUntil(promise: Promise<any>): void;
|
|
294
300
|
passThroughOnException(): void;
|
|
295
301
|
}
|
|
296
|
-
export type ExportedHandlerFetchHandler<
|
|
297
|
-
|
|
302
|
+
export type ExportedHandlerFetchHandler<
|
|
303
|
+
Env = unknown,
|
|
304
|
+
CfHostMetadata = unknown
|
|
305
|
+
> = (
|
|
306
|
+
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
298
307
|
env: Env,
|
|
299
308
|
ctx: ExecutionContext
|
|
300
309
|
) => Response | Promise<Response>;
|
|
310
|
+
export type ExportedHandlerTailHandler<Env = unknown> = (
|
|
311
|
+
events: TraceItem[],
|
|
312
|
+
env: Env,
|
|
313
|
+
ctx: ExecutionContext
|
|
314
|
+
) => void | Promise<void>;
|
|
301
315
|
export type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
302
316
|
traces: TraceItem[],
|
|
303
317
|
env: Env,
|
|
@@ -318,12 +332,17 @@ export type ExportedHandlerTestHandler<Env = unknown> = (
|
|
|
318
332
|
env: Env,
|
|
319
333
|
ctx: ExecutionContext
|
|
320
334
|
) => void | Promise<void>;
|
|
321
|
-
export interface ExportedHandler<
|
|
322
|
-
|
|
335
|
+
export interface ExportedHandler<
|
|
336
|
+
Env = unknown,
|
|
337
|
+
QueueMessage = unknown,
|
|
338
|
+
CfHostMetadata = unknown
|
|
339
|
+
> {
|
|
340
|
+
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
341
|
+
tail?: ExportedHandlerTailHandler<Env>;
|
|
323
342
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
324
343
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
325
344
|
test?: ExportedHandlerTestHandler<Env>;
|
|
326
|
-
queue?: ExportedHandlerQueueHandler<Env,
|
|
345
|
+
queue?: ExportedHandlerQueueHandler<Env, Message>;
|
|
327
346
|
}
|
|
328
347
|
export interface StructuredSerializeOptions {
|
|
329
348
|
transfer?: any[];
|
|
@@ -335,6 +354,11 @@ export declare abstract class PromiseRejectionEvent extends Event {
|
|
|
335
354
|
export declare abstract class Navigator {
|
|
336
355
|
readonly userAgent: string;
|
|
337
356
|
}
|
|
357
|
+
/** 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. */
|
|
358
|
+
export interface Performance {
|
|
359
|
+
readonly timeOrigin: number;
|
|
360
|
+
now(): number;
|
|
361
|
+
}
|
|
338
362
|
export interface DurableObject {
|
|
339
363
|
fetch(request: Request): Response | Promise<Response>;
|
|
340
364
|
alarm?(): void | Promise<void>;
|
|
@@ -358,19 +382,32 @@ export interface DurableObjectNamespace {
|
|
|
358
382
|
id: DurableObjectId,
|
|
359
383
|
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
360
384
|
): DurableObjectStub;
|
|
361
|
-
jurisdiction(jurisdiction:
|
|
385
|
+
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
|
|
362
386
|
}
|
|
387
|
+
export type DurableObjectJurisdiction = "eu" | "fedramp";
|
|
363
388
|
export interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
364
|
-
jurisdiction?:
|
|
365
|
-
}
|
|
389
|
+
jurisdiction?: DurableObjectJurisdiction;
|
|
390
|
+
}
|
|
391
|
+
export type DurableObjectLocationHint =
|
|
392
|
+
| "wnam"
|
|
393
|
+
| "enam"
|
|
394
|
+
| "sam"
|
|
395
|
+
| "weur"
|
|
396
|
+
| "eeur"
|
|
397
|
+
| "apac"
|
|
398
|
+
| "oc"
|
|
399
|
+
| "afr"
|
|
400
|
+
| "me";
|
|
366
401
|
export interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
367
|
-
locationHint?:
|
|
402
|
+
locationHint?: DurableObjectLocationHint;
|
|
368
403
|
}
|
|
369
404
|
export interface DurableObjectState {
|
|
370
405
|
waitUntil(promise: Promise<any>): void;
|
|
371
406
|
readonly id: DurableObjectId;
|
|
372
407
|
readonly storage: DurableObjectStorage;
|
|
373
408
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
409
|
+
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
410
|
+
getWebSockets(tag?: string): WebSocket[];
|
|
374
411
|
}
|
|
375
412
|
export interface DurableObjectTransaction {
|
|
376
413
|
get<T = unknown>(
|
|
@@ -437,6 +474,7 @@ export interface DurableObjectStorage {
|
|
|
437
474
|
): Promise<void>;
|
|
438
475
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
439
476
|
sync(): Promise<void>;
|
|
477
|
+
transactionSync<T>(closure: () => T): T;
|
|
440
478
|
}
|
|
441
479
|
export interface DurableObjectListOptions {
|
|
442
480
|
start?: string;
|
|
@@ -546,6 +584,7 @@ export declare class AbortController {
|
|
|
546
584
|
export declare abstract class AbortSignal extends EventTarget {
|
|
547
585
|
static abort(reason?: any): AbortSignal;
|
|
548
586
|
static timeout(delay: number): AbortSignal;
|
|
587
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
549
588
|
get aborted(): boolean;
|
|
550
589
|
get reason(): any;
|
|
551
590
|
throwIfAborted(): void;
|
|
@@ -994,23 +1033,27 @@ export interface ResponseInit {
|
|
|
994
1033
|
webSocket?: WebSocket | null;
|
|
995
1034
|
encodeBody?: "automatic" | "manual";
|
|
996
1035
|
}
|
|
997
|
-
export type RequestInfo
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1036
|
+
export type RequestInfo<
|
|
1037
|
+
CfHostMetadata = unknown,
|
|
1038
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1039
|
+
> = Request<CfHostMetadata, Cf> | string | URL;
|
|
1040
|
+
export declare class Request<
|
|
1041
|
+
CfHostMetadata = unknown,
|
|
1042
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1043
|
+
> extends Body {
|
|
1044
|
+
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1045
|
+
clone(): Request<CfHostMetadata, Cf>;
|
|
1001
1046
|
get method(): string;
|
|
1002
1047
|
get url(): string;
|
|
1003
1048
|
get headers(): Headers;
|
|
1004
1049
|
get redirect(): string;
|
|
1005
1050
|
get fetcher(): Fetcher | null;
|
|
1006
1051
|
get signal(): AbortSignal;
|
|
1007
|
-
get cf():
|
|
1052
|
+
get cf(): Cf | undefined;
|
|
1008
1053
|
get integrity(): string;
|
|
1009
1054
|
get keepalive(): boolean;
|
|
1010
1055
|
}
|
|
1011
|
-
export interface RequestInit<
|
|
1012
|
-
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
1013
|
-
> {
|
|
1056
|
+
export interface RequestInit<Cf = CfProperties> {
|
|
1014
1057
|
/** A string to set request's method. */
|
|
1015
1058
|
method?: string;
|
|
1016
1059
|
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
@@ -1020,17 +1063,15 @@ export interface RequestInit<
|
|
|
1020
1063
|
/** 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. */
|
|
1021
1064
|
redirect?: string;
|
|
1022
1065
|
fetcher?: Fetcher | null;
|
|
1023
|
-
cf?:
|
|
1066
|
+
cf?: Cf;
|
|
1024
1067
|
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1025
1068
|
integrity?: string;
|
|
1026
1069
|
/** An AbortSignal to set request's signal. */
|
|
1027
1070
|
signal?: AbortSignal | null;
|
|
1028
1071
|
}
|
|
1029
1072
|
export declare abstract class Fetcher {
|
|
1030
|
-
fetch(
|
|
1031
|
-
|
|
1032
|
-
init?: RequestInit<RequestInitCfProperties>
|
|
1033
|
-
): Promise<Response>;
|
|
1073
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1074
|
+
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1034
1075
|
}
|
|
1035
1076
|
export interface FetcherPutOptions {
|
|
1036
1077
|
expiration?: number;
|
|
@@ -1143,6 +1184,33 @@ export interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1143
1184
|
value: Value | null;
|
|
1144
1185
|
metadata: Metadata | null;
|
|
1145
1186
|
}
|
|
1187
|
+
export interface Queue<Body> {
|
|
1188
|
+
send(message: Body): Promise<void>;
|
|
1189
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1190
|
+
}
|
|
1191
|
+
export interface QueueSendOptions {}
|
|
1192
|
+
export interface MessageSendRequest<Body = unknown> {
|
|
1193
|
+
body: Body;
|
|
1194
|
+
}
|
|
1195
|
+
export interface Message<Body = unknown> {
|
|
1196
|
+
readonly id: string;
|
|
1197
|
+
readonly timestamp: Date;
|
|
1198
|
+
readonly body: Body;
|
|
1199
|
+
retry(): void;
|
|
1200
|
+
ack(): void;
|
|
1201
|
+
}
|
|
1202
|
+
export interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1203
|
+
readonly messages: readonly Message<Body>[];
|
|
1204
|
+
readonly queue: string;
|
|
1205
|
+
retryAll(): void;
|
|
1206
|
+
ackAll(): void;
|
|
1207
|
+
}
|
|
1208
|
+
export interface MessageBatch<Body = unknown> {
|
|
1209
|
+
readonly messages: readonly Message<Body>[];
|
|
1210
|
+
readonly queue: string;
|
|
1211
|
+
retryAll(): void;
|
|
1212
|
+
ackAll(): void;
|
|
1213
|
+
}
|
|
1146
1214
|
export interface R2Error extends Error {
|
|
1147
1215
|
readonly name: string;
|
|
1148
1216
|
readonly code: number;
|
|
@@ -1294,12 +1362,18 @@ export interface R2HTTPMetadata {
|
|
|
1294
1362
|
cacheControl?: string;
|
|
1295
1363
|
cacheExpiry?: Date;
|
|
1296
1364
|
}
|
|
1297
|
-
export
|
|
1365
|
+
export type R2Objects = {
|
|
1298
1366
|
objects: R2Object[];
|
|
1299
|
-
truncated: boolean;
|
|
1300
|
-
cursor?: string;
|
|
1301
1367
|
delimitedPrefixes: string[];
|
|
1302
|
-
}
|
|
1368
|
+
} & (
|
|
1369
|
+
| {
|
|
1370
|
+
truncated: true;
|
|
1371
|
+
cursor: string;
|
|
1372
|
+
}
|
|
1373
|
+
| {
|
|
1374
|
+
truncated: false;
|
|
1375
|
+
}
|
|
1376
|
+
);
|
|
1303
1377
|
export declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1304
1378
|
readonly scheduledTime: number;
|
|
1305
1379
|
readonly cron: string;
|
|
@@ -1509,13 +1583,19 @@ export declare class TransformStream<I = any, O = any> {
|
|
|
1509
1583
|
get writable(): WritableStream<I>;
|
|
1510
1584
|
}
|
|
1511
1585
|
export declare class FixedLengthStream extends IdentityTransformStream {
|
|
1512
|
-
constructor(
|
|
1586
|
+
constructor(
|
|
1587
|
+
expectedLength: number | bigint,
|
|
1588
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy
|
|
1589
|
+
);
|
|
1513
1590
|
}
|
|
1514
1591
|
export declare class IdentityTransformStream extends TransformStream<
|
|
1515
1592
|
ArrayBuffer | ArrayBufferView,
|
|
1516
1593
|
Uint8Array
|
|
1517
1594
|
> {
|
|
1518
|
-
constructor();
|
|
1595
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
1596
|
+
}
|
|
1597
|
+
export interface IdentityTransformStreamQueuingStrategy {
|
|
1598
|
+
highWaterMark?: number | bigint;
|
|
1519
1599
|
}
|
|
1520
1600
|
export interface ReadableStreamValuesOptions {
|
|
1521
1601
|
preventCancel?: boolean;
|
|
@@ -1567,7 +1647,8 @@ export interface QueuingStrategyInit {
|
|
|
1567
1647
|
*/
|
|
1568
1648
|
highWaterMark: number;
|
|
1569
1649
|
}
|
|
1570
|
-
export declare abstract class
|
|
1650
|
+
export declare abstract class TailEvent extends ExtendableEvent {
|
|
1651
|
+
readonly events: TraceItem[];
|
|
1571
1652
|
readonly traces: TraceItem[];
|
|
1572
1653
|
}
|
|
1573
1654
|
export interface TraceItem {
|
|
@@ -1663,6 +1744,7 @@ export declare class URL {
|
|
|
1663
1744
|
get searchParams(): URLSearchParams;
|
|
1664
1745
|
toJSON(): string;
|
|
1665
1746
|
toString(): string;
|
|
1747
|
+
static canParse(url: string, base?: string): boolean;
|
|
1666
1748
|
}
|
|
1667
1749
|
export declare class URLSearchParams {
|
|
1668
1750
|
constructor(
|
|
@@ -1670,10 +1752,10 @@ export declare class URLSearchParams {
|
|
|
1670
1752
|
);
|
|
1671
1753
|
get size(): number;
|
|
1672
1754
|
append(name: string, value: string): void;
|
|
1673
|
-
delete(name: string): void;
|
|
1755
|
+
delete(name: string, value?: any): void;
|
|
1674
1756
|
get(name: string): string | null;
|
|
1675
1757
|
getAll(name: string): string[];
|
|
1676
|
-
has(name: string): boolean;
|
|
1758
|
+
has(name: string, value?: any): boolean;
|
|
1677
1759
|
set(name: string, value: string): void;
|
|
1678
1760
|
sort(): void;
|
|
1679
1761
|
entries(): IterableIterator<[key: string, value: string]>;
|
|
@@ -1773,6 +1855,8 @@ export declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1773
1855
|
accept(): void;
|
|
1774
1856
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1775
1857
|
close(code?: number, reason?: string): void;
|
|
1858
|
+
serializeAttachment(attachment: any): void;
|
|
1859
|
+
deserializeAttachment(): any | null;
|
|
1776
1860
|
static readonly READY_STATE_CONNECTING: number;
|
|
1777
1861
|
static readonly READY_STATE_OPEN: number;
|
|
1778
1862
|
static readonly READY_STATE_CLOSING: number;
|
|
@@ -1788,6 +1872,24 @@ export declare const WebSocketPair: {
|
|
|
1788
1872
|
1: WebSocket;
|
|
1789
1873
|
};
|
|
1790
1874
|
};
|
|
1875
|
+
export interface Socket {
|
|
1876
|
+
get readable(): ReadableStream;
|
|
1877
|
+
get writable(): WritableStream;
|
|
1878
|
+
get closed(): Promise<void>;
|
|
1879
|
+
close(): Promise<void>;
|
|
1880
|
+
startTls(options?: TlsOptions): Socket;
|
|
1881
|
+
}
|
|
1882
|
+
export interface SocketOptions {
|
|
1883
|
+
secureTransport?: string;
|
|
1884
|
+
allowHalfOpen: boolean;
|
|
1885
|
+
}
|
|
1886
|
+
export interface SocketAddress {
|
|
1887
|
+
hostname: string;
|
|
1888
|
+
port: number;
|
|
1889
|
+
}
|
|
1890
|
+
export interface TlsOptions {
|
|
1891
|
+
expectedServerHostname?: string;
|
|
1892
|
+
}
|
|
1791
1893
|
export interface BasicImageTransformations {
|
|
1792
1894
|
/**
|
|
1793
1895
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -1867,7 +1969,7 @@ export interface BasicImageTransformationsGravityCoordinates {
|
|
|
1867
1969
|
* Note: Currently, these properties cannot be tested in the
|
|
1868
1970
|
* playground.
|
|
1869
1971
|
*/
|
|
1870
|
-
export interface RequestInitCfProperties {
|
|
1972
|
+
export interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1871
1973
|
cacheEverything?: boolean;
|
|
1872
1974
|
/**
|
|
1873
1975
|
* A request's cache key is what determines if two requests are
|
|
@@ -2037,6 +2139,49 @@ export interface RequestInitCfPropertiesImage
|
|
|
2037
2139
|
* the origin.
|
|
2038
2140
|
*/
|
|
2039
2141
|
"origin-auth"?: "share-publicly";
|
|
2142
|
+
/**
|
|
2143
|
+
* Adds a border around the image. The border is added after resizing. Border
|
|
2144
|
+
* width takes dpr into account, and can be specified either using a single
|
|
2145
|
+
* width property, or individually for each side.
|
|
2146
|
+
*/
|
|
2147
|
+
border?:
|
|
2148
|
+
| {
|
|
2149
|
+
color: string;
|
|
2150
|
+
width: number;
|
|
2151
|
+
}
|
|
2152
|
+
| {
|
|
2153
|
+
color: string;
|
|
2154
|
+
top: number;
|
|
2155
|
+
right: number;
|
|
2156
|
+
bottom: number;
|
|
2157
|
+
left: number;
|
|
2158
|
+
};
|
|
2159
|
+
/**
|
|
2160
|
+
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
2161
|
+
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
2162
|
+
* 0 is ignored.
|
|
2163
|
+
*/
|
|
2164
|
+
brightness?: number;
|
|
2165
|
+
/**
|
|
2166
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
2167
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
2168
|
+
* ignored.
|
|
2169
|
+
*/
|
|
2170
|
+
contrast?: number;
|
|
2171
|
+
/**
|
|
2172
|
+
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
2173
|
+
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
2174
|
+
*/
|
|
2175
|
+
gamma?: number;
|
|
2176
|
+
/**
|
|
2177
|
+
* Slightly reduces latency on a cache miss by selecting a
|
|
2178
|
+
* quickest-to-compress file format, at a cost of increased file size and
|
|
2179
|
+
* lower image quality. It will usually override the format option and choose
|
|
2180
|
+
* JPEG over WebP or AVIF. We do not recommend using this option, except in
|
|
2181
|
+
* unusual circumstances like resizing uncacheable dynamically-generated
|
|
2182
|
+
* images.
|
|
2183
|
+
*/
|
|
2184
|
+
compression?: "fast";
|
|
2040
2185
|
}
|
|
2041
2186
|
export interface RequestInitCfPropertiesImageMinify {
|
|
2042
2187
|
javascript?: boolean;
|
|
@@ -2052,7 +2197,8 @@ export type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2052
2197
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2053
2198
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2054
2199
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2055
|
-
export interface IncomingRequestCfPropertiesBase
|
|
2200
|
+
export interface IncomingRequestCfPropertiesBase
|
|
2201
|
+
extends Record<string, unknown> {
|
|
2056
2202
|
/**
|
|
2057
2203
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2058
2204
|
*
|
|
@@ -2133,8 +2279,7 @@ export interface IncomingRequestCfPropertiesBase {
|
|
|
2133
2279
|
export interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2134
2280
|
/**
|
|
2135
2281
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2136
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2137
|
-
* and `99` (almost certainly a bot).
|
|
2282
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2138
2283
|
*
|
|
2139
2284
|
* @example 54
|
|
2140
2285
|
*/
|
|
@@ -2245,86 +2390,82 @@ export interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2245
2390
|
/**
|
|
2246
2391
|
* Geographic data about the request's origin.
|
|
2247
2392
|
*/
|
|
2248
|
-
export
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
* @example "635"
|
|
2325
|
-
*/
|
|
2326
|
-
metroCode?: string;
|
|
2327
|
-
};
|
|
2393
|
+
export interface IncomingRequestCfPropertiesGeographicInformation {
|
|
2394
|
+
/**
|
|
2395
|
+
* The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
|
|
2396
|
+
*
|
|
2397
|
+
* 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.
|
|
2398
|
+
*
|
|
2399
|
+
* If Cloudflare is unable to determine where the request originated this property is omitted.
|
|
2400
|
+
*
|
|
2401
|
+
* The country code `"T1"` is used for requests originating on TOR.
|
|
2402
|
+
*
|
|
2403
|
+
* @example "GB"
|
|
2404
|
+
*/
|
|
2405
|
+
country?: Iso3166Alpha2Code | "T1";
|
|
2406
|
+
/**
|
|
2407
|
+
* If present, this property indicates that the request originated in the EU
|
|
2408
|
+
*
|
|
2409
|
+
* @example "1"
|
|
2410
|
+
*/
|
|
2411
|
+
isEUCountry?: "1";
|
|
2412
|
+
/**
|
|
2413
|
+
* A two-letter code indicating the continent the request originated from.
|
|
2414
|
+
*
|
|
2415
|
+
* @example "AN"
|
|
2416
|
+
*/
|
|
2417
|
+
continent?: ContinentCode;
|
|
2418
|
+
/**
|
|
2419
|
+
* The city the request originated from
|
|
2420
|
+
*
|
|
2421
|
+
* @example "Austin"
|
|
2422
|
+
*/
|
|
2423
|
+
city?: string;
|
|
2424
|
+
/**
|
|
2425
|
+
* Postal code of the incoming request
|
|
2426
|
+
*
|
|
2427
|
+
* @example "78701"
|
|
2428
|
+
*/
|
|
2429
|
+
postalCode?: string;
|
|
2430
|
+
/**
|
|
2431
|
+
* Latitude of the incoming request
|
|
2432
|
+
*
|
|
2433
|
+
* @example "30.27130"
|
|
2434
|
+
*/
|
|
2435
|
+
latitude?: string;
|
|
2436
|
+
/**
|
|
2437
|
+
* Longitude of the incoming request
|
|
2438
|
+
*
|
|
2439
|
+
* @example "-97.74260"
|
|
2440
|
+
*/
|
|
2441
|
+
longitude?: string;
|
|
2442
|
+
/**
|
|
2443
|
+
* Timezone of the incoming request
|
|
2444
|
+
*
|
|
2445
|
+
* @example "America/Chicago"
|
|
2446
|
+
*/
|
|
2447
|
+
timezone?: string;
|
|
2448
|
+
/**
|
|
2449
|
+
* If known, the ISO 3166-2 name for the first level region associated with
|
|
2450
|
+
* the IP address of the incoming request
|
|
2451
|
+
*
|
|
2452
|
+
* @example "Texas"
|
|
2453
|
+
*/
|
|
2454
|
+
region?: string;
|
|
2455
|
+
/**
|
|
2456
|
+
* If known, the ISO 3166-2 code for the first-level region associated with
|
|
2457
|
+
* the IP address of the incoming request
|
|
2458
|
+
*
|
|
2459
|
+
* @example "TX"
|
|
2460
|
+
*/
|
|
2461
|
+
regionCode?: string;
|
|
2462
|
+
/**
|
|
2463
|
+
* Metro code (DMA) of the incoming request
|
|
2464
|
+
*
|
|
2465
|
+
* @example "635"
|
|
2466
|
+
*/
|
|
2467
|
+
metroCode?: string;
|
|
2468
|
+
}
|
|
2328
2469
|
/** Data about the incoming request's TLS certificate */
|
|
2329
2470
|
export interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2330
2471
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2717,6 +2858,9 @@ export type Iso3166Alpha2Code =
|
|
|
2717
2858
|
| "ZW";
|
|
2718
2859
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2719
2860
|
export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2861
|
+
export type CfProperties<HostMetadata = unknown> =
|
|
2862
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2863
|
+
| RequestInitCfProperties;
|
|
2720
2864
|
export interface D1Result<T = unknown> {
|
|
2721
2865
|
results?: T[];
|
|
2722
2866
|
success: boolean;
|
|
@@ -2737,7 +2881,7 @@ export declare abstract class D1PreparedStatement {
|
|
|
2737
2881
|
raw<T = unknown>(): Promise<T[]>;
|
|
2738
2882
|
}
|
|
2739
2883
|
/**
|
|
2740
|
-
*
|
|
2884
|
+
* An email message that can be sent from a Worker.
|
|
2741
2885
|
*/
|
|
2742
2886
|
export interface EmailMessage {
|
|
2743
2887
|
/**
|
|
@@ -2748,14 +2892,19 @@ export interface EmailMessage {
|
|
|
2748
2892
|
* Envelope To attribute of the email message.
|
|
2749
2893
|
*/
|
|
2750
2894
|
readonly to: string;
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2895
|
+
}
|
|
2896
|
+
/**
|
|
2897
|
+
* An email message that is sent to a consumer Worker and can be rejected/forwarded.
|
|
2898
|
+
*/
|
|
2899
|
+
export interface ForwardableEmailMessage extends EmailMessage {
|
|
2755
2900
|
/**
|
|
2756
2901
|
* Stream of the email message content.
|
|
2757
2902
|
*/
|
|
2758
2903
|
readonly raw: ReadableStream;
|
|
2904
|
+
/**
|
|
2905
|
+
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2906
|
+
*/
|
|
2907
|
+
readonly headers: Headers;
|
|
2759
2908
|
/**
|
|
2760
2909
|
* Size of the email message content.
|
|
2761
2910
|
*/
|
|
@@ -2774,11 +2923,17 @@ export interface EmailMessage {
|
|
|
2774
2923
|
*/
|
|
2775
2924
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2776
2925
|
}
|
|
2926
|
+
/**
|
|
2927
|
+
* A binding that allows a Worker to send email messages.
|
|
2928
|
+
*/
|
|
2929
|
+
export interface SendEmail {
|
|
2930
|
+
send(message: EmailMessage): Promise<void>;
|
|
2931
|
+
}
|
|
2777
2932
|
export declare abstract class EmailEvent extends ExtendableEvent {
|
|
2778
|
-
readonly message:
|
|
2933
|
+
readonly message: ForwardableEmailMessage;
|
|
2779
2934
|
}
|
|
2780
2935
|
export type EmailExportedHandler<Env = unknown> = (
|
|
2781
|
-
message:
|
|
2936
|
+
message: ForwardableEmailMessage,
|
|
2782
2937
|
env: Env,
|
|
2783
2938
|
ctx: ExecutionContext
|
|
2784
2939
|
) => void | Promise<void>;
|
|
@@ -2859,75 +3014,12 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2859
3014
|
// Key Identifier of the JWK
|
|
2860
3015
|
readonly kid: string;
|
|
2861
3016
|
}
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
*/
|
|
2865
|
-
export interface Message<Body = unknown> {
|
|
2866
|
-
/**
|
|
2867
|
-
* A unique, system-generated ID for the message.
|
|
2868
|
-
*/
|
|
2869
|
-
readonly id: string;
|
|
3017
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3018
|
+
export interface DispatchNamespace {
|
|
2870
3019
|
/**
|
|
2871
|
-
*
|
|
3020
|
+
* @param name Name of the Worker script.
|
|
3021
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
3022
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2872
3023
|
*/
|
|
2873
|
-
|
|
2874
|
-
/**
|
|
2875
|
-
* The body of the message.
|
|
2876
|
-
*/
|
|
2877
|
-
readonly body: Body;
|
|
2878
|
-
/**
|
|
2879
|
-
* Marks message to be retried.
|
|
2880
|
-
*/
|
|
2881
|
-
retry(): void;
|
|
2882
|
-
/**
|
|
2883
|
-
* Marks message acknowledged.
|
|
2884
|
-
*/
|
|
2885
|
-
ack(): void;
|
|
2886
|
-
}
|
|
2887
|
-
/**
|
|
2888
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2889
|
-
*/
|
|
2890
|
-
export interface MessageBatch<Body = unknown> {
|
|
2891
|
-
/**
|
|
2892
|
-
* The name of the Queue that belongs to this batch.
|
|
2893
|
-
*/
|
|
2894
|
-
readonly queue: string;
|
|
2895
|
-
/**
|
|
2896
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2897
|
-
*/
|
|
2898
|
-
readonly messages: readonly Message<Body>[];
|
|
2899
|
-
/**
|
|
2900
|
-
* Marks every message to be retried in the next batch.
|
|
2901
|
-
*/
|
|
2902
|
-
retryAll(): void;
|
|
2903
|
-
/**
|
|
2904
|
-
* Marks every message acknowledged in the batch.
|
|
2905
|
-
*/
|
|
2906
|
-
ackAll(): void;
|
|
2907
|
-
}
|
|
2908
|
-
/**
|
|
2909
|
-
* A wrapper class used to structure message batches.
|
|
2910
|
-
*/
|
|
2911
|
-
export type MessageSendRequest<Body = unknown> = {
|
|
2912
|
-
/**
|
|
2913
|
-
* The body of the message.
|
|
2914
|
-
*/
|
|
2915
|
-
body: Body;
|
|
2916
|
-
};
|
|
2917
|
-
/**
|
|
2918
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
2919
|
-
*/
|
|
2920
|
-
export interface Queue<Body = any> {
|
|
2921
|
-
/**
|
|
2922
|
-
* Sends a message to the Queue.
|
|
2923
|
-
* @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.
|
|
2924
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2925
|
-
*/
|
|
2926
|
-
send(message: Body): Promise<void>;
|
|
2927
|
-
/**
|
|
2928
|
-
* Sends a batch of messages to the Queue.
|
|
2929
|
-
* @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.
|
|
2930
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2931
|
-
*/
|
|
2932
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
3024
|
+
get(name: string): Fetcher;
|
|
2933
3025
|
}
|