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