@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/experimental/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,37 @@ declare interface DurableObjectNamespace {
|
|
|
356
380
|
id: DurableObjectId,
|
|
357
381
|
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
358
382
|
): DurableObjectStub;
|
|
359
|
-
|
|
383
|
+
getExisting(
|
|
384
|
+
id: DurableObjectId,
|
|
385
|
+
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
386
|
+
): DurableObjectStub;
|
|
387
|
+
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
|
|
360
388
|
}
|
|
389
|
+
declare type DurableObjectJurisdiction = "eu" | "fedramp";
|
|
361
390
|
declare interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
362
|
-
jurisdiction?:
|
|
363
|
-
}
|
|
391
|
+
jurisdiction?: DurableObjectJurisdiction;
|
|
392
|
+
}
|
|
393
|
+
declare type DurableObjectLocationHint =
|
|
394
|
+
| "wnam"
|
|
395
|
+
| "enam"
|
|
396
|
+
| "sam"
|
|
397
|
+
| "weur"
|
|
398
|
+
| "eeur"
|
|
399
|
+
| "apac"
|
|
400
|
+
| "oc"
|
|
401
|
+
| "afr"
|
|
402
|
+
| "me";
|
|
364
403
|
declare interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
365
|
-
locationHint?:
|
|
404
|
+
locationHint?: DurableObjectLocationHint;
|
|
366
405
|
}
|
|
367
406
|
declare interface DurableObjectState {
|
|
368
407
|
waitUntil(promise: Promise<any>): void;
|
|
369
408
|
readonly id: DurableObjectId;
|
|
370
409
|
readonly storage: DurableObjectStorage;
|
|
371
410
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
411
|
+
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
412
|
+
getWebSockets(tag?: string): WebSocket[];
|
|
413
|
+
abort(reason?: string): void;
|
|
372
414
|
}
|
|
373
415
|
declare interface DurableObjectTransaction {
|
|
374
416
|
get<T = unknown>(
|
|
@@ -435,6 +477,8 @@ declare interface DurableObjectStorage {
|
|
|
435
477
|
): Promise<void>;
|
|
436
478
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
437
479
|
sync(): Promise<void>;
|
|
480
|
+
sql: SqlStorage;
|
|
481
|
+
transactionSync<T>(closure: () => T): T;
|
|
438
482
|
}
|
|
439
483
|
declare interface DurableObjectListOptions {
|
|
440
484
|
start?: string;
|
|
@@ -544,6 +588,7 @@ declare class AbortController {
|
|
|
544
588
|
declare abstract class AbortSignal extends EventTarget {
|
|
545
589
|
static abort(reason?: any): AbortSignal;
|
|
546
590
|
static timeout(delay: number): AbortSignal;
|
|
591
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
547
592
|
get aborted(): boolean;
|
|
548
593
|
get reason(): any;
|
|
549
594
|
throwIfAborted(): void;
|
|
@@ -993,23 +1038,27 @@ declare interface ResponseInit {
|
|
|
993
1038
|
webSocket?: WebSocket | null;
|
|
994
1039
|
encodeBody?: "automatic" | "manual";
|
|
995
1040
|
}
|
|
996
|
-
declare type RequestInfo
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1041
|
+
declare type RequestInfo<
|
|
1042
|
+
CfHostMetadata = unknown,
|
|
1043
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1044
|
+
> = Request<CfHostMetadata, Cf> | string | URL;
|
|
1045
|
+
declare class Request<
|
|
1046
|
+
CfHostMetadata = unknown,
|
|
1047
|
+
Cf = CfProperties<CfHostMetadata>
|
|
1048
|
+
> extends Body {
|
|
1049
|
+
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1050
|
+
clone(): Request<CfHostMetadata, Cf>;
|
|
1000
1051
|
get method(): string;
|
|
1001
1052
|
get url(): string;
|
|
1002
1053
|
get headers(): Headers;
|
|
1003
1054
|
get redirect(): string;
|
|
1004
1055
|
get fetcher(): Fetcher | null;
|
|
1005
1056
|
get signal(): AbortSignal;
|
|
1006
|
-
get cf():
|
|
1057
|
+
get cf(): Cf | undefined;
|
|
1007
1058
|
get integrity(): string;
|
|
1008
1059
|
get keepalive(): boolean;
|
|
1009
1060
|
}
|
|
1010
|
-
declare interface RequestInit<
|
|
1011
|
-
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
1012
|
-
> {
|
|
1061
|
+
declare interface RequestInit<Cf = CfProperties> {
|
|
1013
1062
|
/** A string to set request's method. */
|
|
1014
1063
|
method?: string;
|
|
1015
1064
|
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
|
|
@@ -1019,22 +1068,29 @@ declare interface RequestInit<
|
|
|
1019
1068
|
/** 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. */
|
|
1020
1069
|
redirect?: string;
|
|
1021
1070
|
fetcher?: Fetcher | null;
|
|
1022
|
-
cf?:
|
|
1071
|
+
cf?: Cf;
|
|
1023
1072
|
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1024
1073
|
integrity?: string;
|
|
1025
1074
|
/** An AbortSignal to set request's signal. */
|
|
1026
1075
|
signal?: AbortSignal | null;
|
|
1027
1076
|
}
|
|
1028
1077
|
declare abstract class Fetcher {
|
|
1029
|
-
fetch(
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1078
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1079
|
+
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1080
|
+
queue(
|
|
1081
|
+
queueName: string,
|
|
1082
|
+
messages: ServiceBindingQueueMessage[]
|
|
1083
|
+
): Promise<QueueResponse>;
|
|
1033
1084
|
}
|
|
1034
1085
|
declare interface FetcherPutOptions {
|
|
1035
1086
|
expiration?: number;
|
|
1036
1087
|
expirationTtl?: number;
|
|
1037
1088
|
}
|
|
1089
|
+
declare interface ServiceBindingQueueMessage<Body = unknown> {
|
|
1090
|
+
id: string;
|
|
1091
|
+
timestamp: Date;
|
|
1092
|
+
body: Body;
|
|
1093
|
+
}
|
|
1038
1094
|
declare interface KVNamespaceListKey<Metadata, Key extends string = string> {
|
|
1039
1095
|
name: Key;
|
|
1040
1096
|
expiration?: number;
|
|
@@ -1142,6 +1198,40 @@ declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
|
1142
1198
|
value: Value | null;
|
|
1143
1199
|
metadata: Metadata | null;
|
|
1144
1200
|
}
|
|
1201
|
+
declare interface Queue<Body> {
|
|
1202
|
+
send(message: Body): Promise<void>;
|
|
1203
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
1204
|
+
}
|
|
1205
|
+
declare interface QueueSendOptions {}
|
|
1206
|
+
declare interface MessageSendRequest<Body = unknown> {
|
|
1207
|
+
body: Body;
|
|
1208
|
+
}
|
|
1209
|
+
declare interface QueueResponse {
|
|
1210
|
+
outcome: number;
|
|
1211
|
+
retryAll: boolean;
|
|
1212
|
+
ackAll: boolean;
|
|
1213
|
+
explicitRetries: string[];
|
|
1214
|
+
explicitAcks: string[];
|
|
1215
|
+
}
|
|
1216
|
+
declare interface Message<Body = unknown> {
|
|
1217
|
+
readonly id: string;
|
|
1218
|
+
readonly timestamp: Date;
|
|
1219
|
+
readonly body: Body;
|
|
1220
|
+
retry(): void;
|
|
1221
|
+
ack(): void;
|
|
1222
|
+
}
|
|
1223
|
+
declare interface QueueEvent<Body = unknown> extends ExtendableEvent {
|
|
1224
|
+
readonly messages: readonly Message<Body>[];
|
|
1225
|
+
readonly queue: string;
|
|
1226
|
+
retryAll(): void;
|
|
1227
|
+
ackAll(): void;
|
|
1228
|
+
}
|
|
1229
|
+
declare interface MessageBatch<Body = unknown> {
|
|
1230
|
+
readonly messages: readonly Message<Body>[];
|
|
1231
|
+
readonly queue: string;
|
|
1232
|
+
retryAll(): void;
|
|
1233
|
+
ackAll(): void;
|
|
1234
|
+
}
|
|
1145
1235
|
declare interface R2Error extends Error {
|
|
1146
1236
|
readonly name: string;
|
|
1147
1237
|
readonly code: number;
|
|
@@ -1293,12 +1383,18 @@ declare interface R2HTTPMetadata {
|
|
|
1293
1383
|
cacheControl?: string;
|
|
1294
1384
|
cacheExpiry?: Date;
|
|
1295
1385
|
}
|
|
1296
|
-
declare
|
|
1386
|
+
declare type R2Objects = {
|
|
1297
1387
|
objects: R2Object[];
|
|
1298
|
-
truncated: boolean;
|
|
1299
|
-
cursor?: string;
|
|
1300
1388
|
delimitedPrefixes: string[];
|
|
1301
|
-
}
|
|
1389
|
+
} & (
|
|
1390
|
+
| {
|
|
1391
|
+
truncated: true;
|
|
1392
|
+
cursor: string;
|
|
1393
|
+
}
|
|
1394
|
+
| {
|
|
1395
|
+
truncated: false;
|
|
1396
|
+
}
|
|
1397
|
+
);
|
|
1302
1398
|
declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1303
1399
|
readonly scheduledTime: number;
|
|
1304
1400
|
readonly cron: string;
|
|
@@ -1508,13 +1604,19 @@ declare class TransformStream<I = any, O = any> {
|
|
|
1508
1604
|
get writable(): WritableStream<I>;
|
|
1509
1605
|
}
|
|
1510
1606
|
declare class FixedLengthStream extends IdentityTransformStream {
|
|
1511
|
-
constructor(
|
|
1607
|
+
constructor(
|
|
1608
|
+
expectedLength: number | bigint,
|
|
1609
|
+
queuingStrategy?: IdentityTransformStreamQueuingStrategy
|
|
1610
|
+
);
|
|
1512
1611
|
}
|
|
1513
1612
|
declare class IdentityTransformStream extends TransformStream<
|
|
1514
1613
|
ArrayBuffer | ArrayBufferView,
|
|
1515
1614
|
Uint8Array
|
|
1516
1615
|
> {
|
|
1517
|
-
constructor();
|
|
1616
|
+
constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
|
|
1617
|
+
}
|
|
1618
|
+
declare interface IdentityTransformStreamQueuingStrategy {
|
|
1619
|
+
highWaterMark?: number | bigint;
|
|
1518
1620
|
}
|
|
1519
1621
|
declare interface ReadableStreamValuesOptions {
|
|
1520
1622
|
preventCancel?: boolean;
|
|
@@ -1563,7 +1665,8 @@ declare interface QueuingStrategyInit {
|
|
|
1563
1665
|
*/
|
|
1564
1666
|
highWaterMark: number;
|
|
1565
1667
|
}
|
|
1566
|
-
declare abstract class
|
|
1668
|
+
declare abstract class TailEvent extends ExtendableEvent {
|
|
1669
|
+
readonly events: TraceItem[];
|
|
1567
1670
|
readonly traces: TraceItem[];
|
|
1568
1671
|
}
|
|
1569
1672
|
declare interface TraceItem {
|
|
@@ -1659,6 +1762,7 @@ declare class URL {
|
|
|
1659
1762
|
get searchParams(): URLSearchParams;
|
|
1660
1763
|
toJSON(): string;
|
|
1661
1764
|
toString(): string;
|
|
1765
|
+
static canParse(url: string, base?: string): boolean;
|
|
1662
1766
|
}
|
|
1663
1767
|
declare class URLSearchParams {
|
|
1664
1768
|
constructor(
|
|
@@ -1666,10 +1770,10 @@ declare class URLSearchParams {
|
|
|
1666
1770
|
);
|
|
1667
1771
|
get size(): number;
|
|
1668
1772
|
append(name: string, value: string): void;
|
|
1669
|
-
delete(name: string): void;
|
|
1773
|
+
delete(name: string, value?: any): void;
|
|
1670
1774
|
get(name: string): string | null;
|
|
1671
1775
|
getAll(name: string): string[];
|
|
1672
|
-
has(name: string): boolean;
|
|
1776
|
+
has(name: string, value?: any): boolean;
|
|
1673
1777
|
set(name: string, value: string): void;
|
|
1674
1778
|
sort(): void;
|
|
1675
1779
|
entries(): IterableIterator<[key: string, value: string]>;
|
|
@@ -1769,6 +1873,8 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
1769
1873
|
accept(): void;
|
|
1770
1874
|
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
1771
1875
|
close(code?: number, reason?: string): void;
|
|
1876
|
+
serializeAttachment(attachment: any): void;
|
|
1877
|
+
deserializeAttachment(): any | null;
|
|
1772
1878
|
static readonly READY_STATE_CONNECTING: number;
|
|
1773
1879
|
static readonly READY_STATE_OPEN: number;
|
|
1774
1880
|
static readonly READY_STATE_CLOSING: number;
|
|
@@ -1784,6 +1890,40 @@ declare const WebSocketPair: {
|
|
|
1784
1890
|
1: WebSocket;
|
|
1785
1891
|
};
|
|
1786
1892
|
};
|
|
1893
|
+
declare interface SqlStorage {
|
|
1894
|
+
exec(query: string, ...bindings: any[]): SqlStorageCursor;
|
|
1895
|
+
prepare(query: string): SqlStorageStatement;
|
|
1896
|
+
get databaseSize(): number;
|
|
1897
|
+
get voluntarySizeLimit(): number;
|
|
1898
|
+
set voluntarySizeLimit(value: number);
|
|
1899
|
+
Cursor: typeof SqlStorageCursor;
|
|
1900
|
+
Statement: typeof SqlStorageStatement;
|
|
1901
|
+
}
|
|
1902
|
+
declare abstract class SqlStorageStatement {}
|
|
1903
|
+
declare abstract class SqlStorageCursor {
|
|
1904
|
+
raw(): IterableIterator<((ArrayBuffer | string | number) | null)[]>;
|
|
1905
|
+
[Symbol.iterator](): IterableIterator<
|
|
1906
|
+
Record<string, (ArrayBuffer | string | number) | null>
|
|
1907
|
+
>;
|
|
1908
|
+
}
|
|
1909
|
+
declare interface Socket {
|
|
1910
|
+
get readable(): ReadableStream;
|
|
1911
|
+
get writable(): WritableStream;
|
|
1912
|
+
get closed(): Promise<void>;
|
|
1913
|
+
close(): Promise<void>;
|
|
1914
|
+
startTls(options?: TlsOptions): Socket;
|
|
1915
|
+
}
|
|
1916
|
+
declare interface SocketOptions {
|
|
1917
|
+
secureTransport?: string;
|
|
1918
|
+
allowHalfOpen: boolean;
|
|
1919
|
+
}
|
|
1920
|
+
declare interface SocketAddress {
|
|
1921
|
+
hostname: string;
|
|
1922
|
+
port: number;
|
|
1923
|
+
}
|
|
1924
|
+
declare interface TlsOptions {
|
|
1925
|
+
expectedServerHostname?: string;
|
|
1926
|
+
}
|
|
1787
1927
|
declare interface BasicImageTransformations {
|
|
1788
1928
|
/**
|
|
1789
1929
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -1863,7 +2003,7 @@ declare interface BasicImageTransformationsGravityCoordinates {
|
|
|
1863
2003
|
* Note: Currently, these properties cannot be tested in the
|
|
1864
2004
|
* playground.
|
|
1865
2005
|
*/
|
|
1866
|
-
declare interface RequestInitCfProperties {
|
|
2006
|
+
declare interface RequestInitCfProperties extends Record<string, unknown> {
|
|
1867
2007
|
cacheEverything?: boolean;
|
|
1868
2008
|
/**
|
|
1869
2009
|
* A request's cache key is what determines if two requests are
|
|
@@ -2033,6 +2173,49 @@ declare interface RequestInitCfPropertiesImage
|
|
|
2033
2173
|
* the origin.
|
|
2034
2174
|
*/
|
|
2035
2175
|
"origin-auth"?: "share-publicly";
|
|
2176
|
+
/**
|
|
2177
|
+
* Adds a border around the image. The border is added after resizing. Border
|
|
2178
|
+
* width takes dpr into account, and can be specified either using a single
|
|
2179
|
+
* width property, or individually for each side.
|
|
2180
|
+
*/
|
|
2181
|
+
border?:
|
|
2182
|
+
| {
|
|
2183
|
+
color: string;
|
|
2184
|
+
width: number;
|
|
2185
|
+
}
|
|
2186
|
+
| {
|
|
2187
|
+
color: string;
|
|
2188
|
+
top: number;
|
|
2189
|
+
right: number;
|
|
2190
|
+
bottom: number;
|
|
2191
|
+
left: number;
|
|
2192
|
+
};
|
|
2193
|
+
/**
|
|
2194
|
+
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
2195
|
+
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
2196
|
+
* 0 is ignored.
|
|
2197
|
+
*/
|
|
2198
|
+
brightness?: number;
|
|
2199
|
+
/**
|
|
2200
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
2201
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
2202
|
+
* ignored.
|
|
2203
|
+
*/
|
|
2204
|
+
contrast?: number;
|
|
2205
|
+
/**
|
|
2206
|
+
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
2207
|
+
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
2208
|
+
*/
|
|
2209
|
+
gamma?: number;
|
|
2210
|
+
/**
|
|
2211
|
+
* Slightly reduces latency on a cache miss by selecting a
|
|
2212
|
+
* quickest-to-compress file format, at a cost of increased file size and
|
|
2213
|
+
* lower image quality. It will usually override the format option and choose
|
|
2214
|
+
* JPEG over WebP or AVIF. We do not recommend using this option, except in
|
|
2215
|
+
* unusual circumstances like resizing uncacheable dynamically-generated
|
|
2216
|
+
* images.
|
|
2217
|
+
*/
|
|
2218
|
+
compression?: "fast";
|
|
2036
2219
|
}
|
|
2037
2220
|
declare interface RequestInitCfPropertiesImageMinify {
|
|
2038
2221
|
javascript?: boolean;
|
|
@@ -2048,7 +2231,8 @@ declare type IncomingRequestCfProperties<HostMetadata = unknown> =
|
|
|
2048
2231
|
IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
|
|
2049
2232
|
IncomingRequestCfPropertiesGeographicInformation &
|
|
2050
2233
|
IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
|
|
2051
|
-
declare interface IncomingRequestCfPropertiesBase
|
|
2234
|
+
declare interface IncomingRequestCfPropertiesBase
|
|
2235
|
+
extends Record<string, unknown> {
|
|
2052
2236
|
/**
|
|
2053
2237
|
* [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
|
|
2054
2238
|
*
|
|
@@ -2129,8 +2313,7 @@ declare interface IncomingRequestCfPropertiesBase {
|
|
|
2129
2313
|
declare interface IncomingRequestCfPropertiesBotManagementBase {
|
|
2130
2314
|
/**
|
|
2131
2315
|
* Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
|
|
2132
|
-
* represented as an integer percentage between `1` (almost certainly human)
|
|
2133
|
-
* and `99` (almost certainly a bot).
|
|
2316
|
+
* represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
|
|
2134
2317
|
*
|
|
2135
2318
|
* @example 54
|
|
2136
2319
|
*/
|
|
@@ -2241,86 +2424,82 @@ declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
|
|
|
2241
2424
|
/**
|
|
2242
2425
|
* Geographic data about the request's origin.
|
|
2243
2426
|
*/
|
|
2244
|
-
declare
|
|
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
|
-
|
|
2320
|
-
* @example "635"
|
|
2321
|
-
*/
|
|
2322
|
-
metroCode?: string;
|
|
2323
|
-
};
|
|
2427
|
+
declare interface IncomingRequestCfPropertiesGeographicInformation {
|
|
2428
|
+
/**
|
|
2429
|
+
* The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
|
|
2430
|
+
*
|
|
2431
|
+
* 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.
|
|
2432
|
+
*
|
|
2433
|
+
* If Cloudflare is unable to determine where the request originated this property is omitted.
|
|
2434
|
+
*
|
|
2435
|
+
* The country code `"T1"` is used for requests originating on TOR.
|
|
2436
|
+
*
|
|
2437
|
+
* @example "GB"
|
|
2438
|
+
*/
|
|
2439
|
+
country?: Iso3166Alpha2Code | "T1";
|
|
2440
|
+
/**
|
|
2441
|
+
* If present, this property indicates that the request originated in the EU
|
|
2442
|
+
*
|
|
2443
|
+
* @example "1"
|
|
2444
|
+
*/
|
|
2445
|
+
isEUCountry?: "1";
|
|
2446
|
+
/**
|
|
2447
|
+
* A two-letter code indicating the continent the request originated from.
|
|
2448
|
+
*
|
|
2449
|
+
* @example "AN"
|
|
2450
|
+
*/
|
|
2451
|
+
continent?: ContinentCode;
|
|
2452
|
+
/**
|
|
2453
|
+
* The city the request originated from
|
|
2454
|
+
*
|
|
2455
|
+
* @example "Austin"
|
|
2456
|
+
*/
|
|
2457
|
+
city?: string;
|
|
2458
|
+
/**
|
|
2459
|
+
* Postal code of the incoming request
|
|
2460
|
+
*
|
|
2461
|
+
* @example "78701"
|
|
2462
|
+
*/
|
|
2463
|
+
postalCode?: string;
|
|
2464
|
+
/**
|
|
2465
|
+
* Latitude of the incoming request
|
|
2466
|
+
*
|
|
2467
|
+
* @example "30.27130"
|
|
2468
|
+
*/
|
|
2469
|
+
latitude?: string;
|
|
2470
|
+
/**
|
|
2471
|
+
* Longitude of the incoming request
|
|
2472
|
+
*
|
|
2473
|
+
* @example "-97.74260"
|
|
2474
|
+
*/
|
|
2475
|
+
longitude?: string;
|
|
2476
|
+
/**
|
|
2477
|
+
* Timezone of the incoming request
|
|
2478
|
+
*
|
|
2479
|
+
* @example "America/Chicago"
|
|
2480
|
+
*/
|
|
2481
|
+
timezone?: string;
|
|
2482
|
+
/**
|
|
2483
|
+
* If known, the ISO 3166-2 name for the first level region associated with
|
|
2484
|
+
* the IP address of the incoming request
|
|
2485
|
+
*
|
|
2486
|
+
* @example "Texas"
|
|
2487
|
+
*/
|
|
2488
|
+
region?: string;
|
|
2489
|
+
/**
|
|
2490
|
+
* If known, the ISO 3166-2 code for the first-level region associated with
|
|
2491
|
+
* the IP address of the incoming request
|
|
2492
|
+
*
|
|
2493
|
+
* @example "TX"
|
|
2494
|
+
*/
|
|
2495
|
+
regionCode?: string;
|
|
2496
|
+
/**
|
|
2497
|
+
* Metro code (DMA) of the incoming request
|
|
2498
|
+
*
|
|
2499
|
+
* @example "635"
|
|
2500
|
+
*/
|
|
2501
|
+
metroCode?: string;
|
|
2502
|
+
}
|
|
2324
2503
|
/** Data about the incoming request's TLS certificate */
|
|
2325
2504
|
declare interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
2326
2505
|
/** Always `"1"`, indicating that the certificate was presented */
|
|
@@ -2713,6 +2892,9 @@ declare type Iso3166Alpha2Code =
|
|
|
2713
2892
|
| "ZW";
|
|
2714
2893
|
/** The 2-letter continent codes Cloudflare uses */
|
|
2715
2894
|
declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
2895
|
+
declare type CfProperties<HostMetadata = unknown> =
|
|
2896
|
+
| IncomingRequestCfProperties<HostMetadata>
|
|
2897
|
+
| RequestInitCfProperties;
|
|
2716
2898
|
declare interface D1Result<T = unknown> {
|
|
2717
2899
|
results?: T[];
|
|
2718
2900
|
success: boolean;
|
|
@@ -2733,7 +2915,7 @@ declare abstract class D1PreparedStatement {
|
|
|
2733
2915
|
raw<T = unknown>(): Promise<T[]>;
|
|
2734
2916
|
}
|
|
2735
2917
|
/**
|
|
2736
|
-
*
|
|
2918
|
+
* An email message that can be sent from a Worker.
|
|
2737
2919
|
*/
|
|
2738
2920
|
declare interface EmailMessage {
|
|
2739
2921
|
/**
|
|
@@ -2744,14 +2926,19 @@ declare interface EmailMessage {
|
|
|
2744
2926
|
* Envelope To attribute of the email message.
|
|
2745
2927
|
*/
|
|
2746
2928
|
readonly to: string;
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2929
|
+
}
|
|
2930
|
+
/**
|
|
2931
|
+
* An email message that is sent to a consumer Worker and can be rejected/forwarded.
|
|
2932
|
+
*/
|
|
2933
|
+
declare interface ForwardableEmailMessage extends EmailMessage {
|
|
2751
2934
|
/**
|
|
2752
2935
|
* Stream of the email message content.
|
|
2753
2936
|
*/
|
|
2754
2937
|
readonly raw: ReadableStream;
|
|
2938
|
+
/**
|
|
2939
|
+
* An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2940
|
+
*/
|
|
2941
|
+
readonly headers: Headers;
|
|
2755
2942
|
/**
|
|
2756
2943
|
* Size of the email message content.
|
|
2757
2944
|
*/
|
|
@@ -2770,14 +2957,27 @@ declare interface EmailMessage {
|
|
|
2770
2957
|
*/
|
|
2771
2958
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2772
2959
|
}
|
|
2960
|
+
/**
|
|
2961
|
+
* A binding that allows a Worker to send email messages.
|
|
2962
|
+
*/
|
|
2963
|
+
declare interface SendEmail {
|
|
2964
|
+
send(message: EmailMessage): Promise<void>;
|
|
2965
|
+
}
|
|
2773
2966
|
declare abstract class EmailEvent extends ExtendableEvent {
|
|
2774
|
-
readonly message:
|
|
2967
|
+
readonly message: ForwardableEmailMessage;
|
|
2775
2968
|
}
|
|
2776
2969
|
declare type EmailExportedHandler<Env = unknown> = (
|
|
2777
|
-
message:
|
|
2970
|
+
message: ForwardableEmailMessage,
|
|
2778
2971
|
env: Env,
|
|
2779
2972
|
ctx: ExecutionContext
|
|
2780
2973
|
) => void | Promise<void>;
|
|
2974
|
+
declare module "cloudflare:email" {
|
|
2975
|
+
let _EmailMessage: {
|
|
2976
|
+
prototype: EmailMessage;
|
|
2977
|
+
new (from: string, to: string, raw: ReadableStream | string): EmailMessage;
|
|
2978
|
+
};
|
|
2979
|
+
export { _EmailMessage as EmailMessage };
|
|
2980
|
+
}
|
|
2781
2981
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2782
2982
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2783
2983
|
request: Request;
|
|
@@ -2858,75 +3058,12 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
2858
3058
|
// Key Identifier of the JWK
|
|
2859
3059
|
readonly kid: string;
|
|
2860
3060
|
}
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
*/
|
|
2864
|
-
declare interface Message<Body = unknown> {
|
|
3061
|
+
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3062
|
+
declare interface DispatchNamespace {
|
|
2865
3063
|
/**
|
|
2866
|
-
*
|
|
3064
|
+
* @param name Name of the Worker script.
|
|
3065
|
+
* @returns A Fetcher object that allows you to send requests to the Worker script.
|
|
3066
|
+
* @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
|
|
2867
3067
|
*/
|
|
2868
|
-
|
|
2869
|
-
/**
|
|
2870
|
-
* A timestamp when the message was sent.
|
|
2871
|
-
*/
|
|
2872
|
-
readonly timestamp: Date;
|
|
2873
|
-
/**
|
|
2874
|
-
* The body of the message.
|
|
2875
|
-
*/
|
|
2876
|
-
readonly body: Body;
|
|
2877
|
-
/**
|
|
2878
|
-
* Marks message to be retried.
|
|
2879
|
-
*/
|
|
2880
|
-
retry(): void;
|
|
2881
|
-
/**
|
|
2882
|
-
* Marks message acknowledged.
|
|
2883
|
-
*/
|
|
2884
|
-
ack(): void;
|
|
2885
|
-
}
|
|
2886
|
-
/**
|
|
2887
|
-
* A batch of messages that are sent to a consumer Worker.
|
|
2888
|
-
*/
|
|
2889
|
-
declare interface MessageBatch<Body = unknown> {
|
|
2890
|
-
/**
|
|
2891
|
-
* The name of the Queue that belongs to this batch.
|
|
2892
|
-
*/
|
|
2893
|
-
readonly queue: string;
|
|
2894
|
-
/**
|
|
2895
|
-
* An array of messages in the batch. Ordering of messages is not guaranteed.
|
|
2896
|
-
*/
|
|
2897
|
-
readonly messages: readonly Message<Body>[];
|
|
2898
|
-
/**
|
|
2899
|
-
* Marks every message to be retried in the next batch.
|
|
2900
|
-
*/
|
|
2901
|
-
retryAll(): void;
|
|
2902
|
-
/**
|
|
2903
|
-
* Marks every message acknowledged in the batch.
|
|
2904
|
-
*/
|
|
2905
|
-
ackAll(): void;
|
|
2906
|
-
}
|
|
2907
|
-
/**
|
|
2908
|
-
* A wrapper class used to structure message batches.
|
|
2909
|
-
*/
|
|
2910
|
-
declare type MessageSendRequest<Body = unknown> = {
|
|
2911
|
-
/**
|
|
2912
|
-
* The body of the message.
|
|
2913
|
-
*/
|
|
2914
|
-
body: Body;
|
|
2915
|
-
};
|
|
2916
|
-
/**
|
|
2917
|
-
* A binding that allows a producer to send messages to a Queue.
|
|
2918
|
-
*/
|
|
2919
|
-
declare interface Queue<Body = any> {
|
|
2920
|
-
/**
|
|
2921
|
-
* Sends a message to the Queue.
|
|
2922
|
-
* @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.
|
|
2923
|
-
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2924
|
-
*/
|
|
2925
|
-
send(message: Body): Promise<void>;
|
|
2926
|
-
/**
|
|
2927
|
-
* Sends a batch of messages to the Queue.
|
|
2928
|
-
* @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.
|
|
2929
|
-
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2930
|
-
*/
|
|
2931
|
-
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
3068
|
+
get(name: string): Fetcher;
|
|
2932
3069
|
}
|