@cloudflare/workers-types 4.20221111.1 → 4.20230214.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 +151 -18
- package/2021-11-03/index.ts +151 -21
- package/2022-01-31/index.d.ts +149 -18
- package/2022-01-31/index.ts +149 -21
- package/2022-03-21/index.d.ts +149 -18
- package/2022-03-21/index.ts +149 -21
- package/2022-08-04/index.d.ts +149 -18
- package/2022-08-04/index.ts +149 -21
- package/2022-10-31/index.d.ts +2916 -0
- package/2022-10-31/index.ts +2918 -0
- package/2022-11-30/index.d.ts +2919 -0
- package/2022-11-30/index.ts +2921 -0
- package/README.md +18 -8
- package/entrypoints.svg +53 -0
- package/experimental/index.d.ts +150 -18
- package/experimental/index.ts +150 -21
- package/index.d.ts +151 -18
- package/index.ts +151 -21
- package/oldest/index.d.ts +151 -18
- package/oldest/index.ts +151 -21
- package/package.json +1 -1
package/experimental/index.ts
CHANGED
|
@@ -233,7 +233,6 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
233
233
|
FixedLengthStream: typeof FixedLengthStream;
|
|
234
234
|
IdentityTransformStream: typeof IdentityTransformStream;
|
|
235
235
|
HTMLRewriter: typeof HTMLRewriter;
|
|
236
|
-
connect(address: string, options?: SocketOptions): Socket;
|
|
237
236
|
}
|
|
238
237
|
export declare function addEventListener<
|
|
239
238
|
Type extends keyof WorkerGlobalScopeEventMap
|
|
@@ -289,12 +288,8 @@ export declare const crypto: Crypto;
|
|
|
289
288
|
export declare const caches: CacheStorage;
|
|
290
289
|
export declare const scheduler: Scheduler;
|
|
291
290
|
export declare const navigator: Navigator;
|
|
292
|
-
export declare function connect(
|
|
293
|
-
address: string,
|
|
294
|
-
options?: SocketOptions
|
|
295
|
-
): Socket;
|
|
296
291
|
export interface ExecutionContext {
|
|
297
|
-
waitUntil(promise:
|
|
292
|
+
waitUntil(promise: Promise<any>): void;
|
|
298
293
|
passThroughOnException(): void;
|
|
299
294
|
}
|
|
300
295
|
export type ExportedHandlerFetchHandler<Env = unknown> = (
|
|
@@ -352,13 +347,20 @@ export interface DurableObjectNamespace {
|
|
|
352
347
|
): DurableObjectId;
|
|
353
348
|
idFromName(name: string): DurableObjectId;
|
|
354
349
|
idFromString(id: string): DurableObjectId;
|
|
355
|
-
get(
|
|
350
|
+
get(
|
|
351
|
+
id: DurableObjectId,
|
|
352
|
+
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
353
|
+
): DurableObjectStub;
|
|
354
|
+
jurisdiction(jurisdiction: string): DurableObjectNamespace;
|
|
356
355
|
}
|
|
357
356
|
export interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
358
357
|
jurisdiction?: string;
|
|
359
358
|
}
|
|
359
|
+
export interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
360
|
+
locationHint?: string;
|
|
361
|
+
}
|
|
360
362
|
export interface DurableObjectState {
|
|
361
|
-
waitUntil(promise:
|
|
363
|
+
waitUntil(promise: Promise<any>): void;
|
|
362
364
|
readonly id: DurableObjectId;
|
|
363
365
|
readonly storage: DurableObjectStorage;
|
|
364
366
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
@@ -548,7 +550,7 @@ export interface SchedulerWaitOptions {
|
|
|
548
550
|
signal?: AbortSignal;
|
|
549
551
|
}
|
|
550
552
|
export declare abstract class ExtendableEvent extends Event {
|
|
551
|
-
waitUntil(promise:
|
|
553
|
+
waitUntil(promise: Promise<any>): void;
|
|
552
554
|
}
|
|
553
555
|
export declare class Blob {
|
|
554
556
|
constructor(
|
|
@@ -933,6 +935,7 @@ export declare class Headers {
|
|
|
933
935
|
constructor(init?: HeadersInit);
|
|
934
936
|
get(name: string): string | null;
|
|
935
937
|
getAll(name: string): string[];
|
|
938
|
+
getSetCookie(): string[];
|
|
936
939
|
has(name: string): boolean;
|
|
937
940
|
set(name: string, value: string): void;
|
|
938
941
|
append(name: string, value: string): void;
|
|
@@ -996,6 +999,8 @@ export declare class Request<CfHostMetadata = unknown> extends Body {
|
|
|
996
999
|
get fetcher(): Fetcher | null;
|
|
997
1000
|
get signal(): AbortSignal;
|
|
998
1001
|
get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
|
|
1002
|
+
get integrity(): string;
|
|
1003
|
+
get keepalive(): boolean;
|
|
999
1004
|
}
|
|
1000
1005
|
export interface RequestInit<
|
|
1001
1006
|
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
@@ -1010,6 +1015,8 @@ export interface RequestInit<
|
|
|
1010
1015
|
redirect?: string;
|
|
1011
1016
|
fetcher?: Fetcher | null;
|
|
1012
1017
|
cf?: CfType;
|
|
1018
|
+
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1019
|
+
integrity?: string;
|
|
1013
1020
|
/** An AbortSignal to set request's signal. */
|
|
1014
1021
|
signal?: AbortSignal | null;
|
|
1015
1022
|
}
|
|
@@ -1018,7 +1025,6 @@ export declare abstract class Fetcher {
|
|
|
1018
1025
|
input: RequestInfo,
|
|
1019
1026
|
init?: RequestInit<RequestInitCfProperties>
|
|
1020
1027
|
): Promise<Response>;
|
|
1021
|
-
connect(address: string, options?: SocketOptions): Socket;
|
|
1022
1028
|
}
|
|
1023
1029
|
export interface FetcherPutOptions {
|
|
1024
1030
|
expiration?: number;
|
|
@@ -1062,11 +1068,11 @@ export interface KVNamespace<Key extends string = string> {
|
|
|
1062
1068
|
get(
|
|
1063
1069
|
key: Key,
|
|
1064
1070
|
options?: KVNamespaceGetOptions<"arrayBuffer">
|
|
1065
|
-
): Promise<
|
|
1071
|
+
): Promise<ArrayBuffer | null>;
|
|
1066
1072
|
get(
|
|
1067
1073
|
key: Key,
|
|
1068
1074
|
options?: KVNamespaceGetOptions<"stream">
|
|
1069
|
-
): Promise<
|
|
1075
|
+
): Promise<ReadableStream | null>;
|
|
1070
1076
|
list<Metadata = unknown>(
|
|
1071
1077
|
options?: KVNamespaceListOptions
|
|
1072
1078
|
): Promise<KVNamespaceListResult<Metadata, Key>>;
|
|
@@ -1166,6 +1172,19 @@ export declare abstract class R2Bucket {
|
|
|
1166
1172
|
| Blob,
|
|
1167
1173
|
options?: R2PutOptions
|
|
1168
1174
|
): Promise<R2Object>;
|
|
1175
|
+
put(
|
|
1176
|
+
key: string,
|
|
1177
|
+
value:
|
|
1178
|
+
| ReadableStream
|
|
1179
|
+
| ArrayBuffer
|
|
1180
|
+
| ArrayBufferView
|
|
1181
|
+
| string
|
|
1182
|
+
| null
|
|
1183
|
+
| Blob,
|
|
1184
|
+
options?: R2PutOptions & {
|
|
1185
|
+
onlyIf: R2Conditional | Headers;
|
|
1186
|
+
}
|
|
1187
|
+
): Promise<R2Object | null>;
|
|
1169
1188
|
createMultipartUpload(
|
|
1170
1189
|
key: string,
|
|
1171
1190
|
options?: R2MultipartOptions
|
|
@@ -1551,6 +1570,8 @@ export interface TraceItem {
|
|
|
1551
1570
|
| TraceItemFetchEventInfo
|
|
1552
1571
|
| TraceItemScheduledEventInfo
|
|
1553
1572
|
| TraceItemAlarmEventInfo
|
|
1573
|
+
| TraceItemQueueEventInfo
|
|
1574
|
+
| TraceItemEmailEventInfo
|
|
1554
1575
|
| TraceItemCustomEventInfo
|
|
1555
1576
|
)
|
|
1556
1577
|
| null;
|
|
@@ -1559,6 +1580,7 @@ export interface TraceItem {
|
|
|
1559
1580
|
readonly exceptions: TraceException[];
|
|
1560
1581
|
readonly scriptName: string | null;
|
|
1561
1582
|
readonly dispatchNamespace?: string;
|
|
1583
|
+
readonly scriptTags?: string[];
|
|
1562
1584
|
readonly outcome: string;
|
|
1563
1585
|
}
|
|
1564
1586
|
export interface TraceItemAlarmEventInfo {
|
|
@@ -1569,6 +1591,15 @@ export interface TraceItemScheduledEventInfo {
|
|
|
1569
1591
|
readonly scheduledTime: number;
|
|
1570
1592
|
readonly cron: string;
|
|
1571
1593
|
}
|
|
1594
|
+
export interface TraceItemQueueEventInfo {
|
|
1595
|
+
readonly queue: string;
|
|
1596
|
+
readonly batchSize: number;
|
|
1597
|
+
}
|
|
1598
|
+
export interface TraceItemEmailEventInfo {
|
|
1599
|
+
readonly mailFrom: string;
|
|
1600
|
+
readonly rcptTo: string;
|
|
1601
|
+
readonly rawSize: number;
|
|
1602
|
+
}
|
|
1572
1603
|
export interface TraceItemFetchEventInfo {
|
|
1573
1604
|
readonly response?: TraceItemFetchEventInfoResponse;
|
|
1574
1605
|
readonly request: TraceItemFetchEventInfoRequest;
|
|
@@ -1750,15 +1781,6 @@ export declare const WebSocketPair: {
|
|
|
1750
1781
|
1: WebSocket;
|
|
1751
1782
|
};
|
|
1752
1783
|
};
|
|
1753
|
-
export interface Socket {
|
|
1754
|
-
readonly readable: ReadableStream;
|
|
1755
|
-
readonly writable: WritableStream;
|
|
1756
|
-
readonly closed: Promise<void>;
|
|
1757
|
-
close(): Promise<void>;
|
|
1758
|
-
}
|
|
1759
|
-
export interface SocketOptions {
|
|
1760
|
-
tsl: boolean;
|
|
1761
|
-
}
|
|
1762
1784
|
export interface BasicImageTransformations {
|
|
1763
1785
|
/**
|
|
1764
1786
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2703,6 +2725,52 @@ export declare abstract class D1PreparedStatement {
|
|
|
2703
2725
|
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2704
2726
|
raw<T = unknown>(): Promise<T[]>;
|
|
2705
2727
|
}
|
|
2728
|
+
/**
|
|
2729
|
+
* A email message that is sent to a consumer Worker.
|
|
2730
|
+
*/
|
|
2731
|
+
export interface EmailMessage<Body = unknown> {
|
|
2732
|
+
/**
|
|
2733
|
+
* Envelope From attribute of the email message.
|
|
2734
|
+
*/
|
|
2735
|
+
readonly from: string;
|
|
2736
|
+
/**
|
|
2737
|
+
* Envelope To attribute of the email message.
|
|
2738
|
+
*/
|
|
2739
|
+
readonly to: string;
|
|
2740
|
+
/**
|
|
2741
|
+
* A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2742
|
+
*/
|
|
2743
|
+
readonly headers: Headers;
|
|
2744
|
+
/**
|
|
2745
|
+
* Stream of the email message content.
|
|
2746
|
+
*/
|
|
2747
|
+
readonly raw: ReadableStream;
|
|
2748
|
+
/**
|
|
2749
|
+
* Size of the email message content.
|
|
2750
|
+
*/
|
|
2751
|
+
readonly rawSize: number;
|
|
2752
|
+
/**
|
|
2753
|
+
* Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
|
|
2754
|
+
* @param reason The reject reason.
|
|
2755
|
+
* @returns void
|
|
2756
|
+
*/
|
|
2757
|
+
setReject(reason: string): void;
|
|
2758
|
+
/**
|
|
2759
|
+
* Forward this email message to a verified destination address of the account.
|
|
2760
|
+
* @param rcptTo Verified destination address.
|
|
2761
|
+
* @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2762
|
+
* @returns A promise that resolves when the email message is forwarded.
|
|
2763
|
+
*/
|
|
2764
|
+
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2765
|
+
}
|
|
2766
|
+
export declare abstract class EmailEvent extends ExtendableEvent {
|
|
2767
|
+
readonly message: EmailMessage;
|
|
2768
|
+
}
|
|
2769
|
+
export type EmailExportedHandler<Env = unknown> = (
|
|
2770
|
+
message: EmailMessage,
|
|
2771
|
+
env: Env,
|
|
2772
|
+
ctx: ExecutionContext
|
|
2773
|
+
) => void | Promise<void>;
|
|
2706
2774
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2707
2775
|
export type EventContext<Env, P extends string, Data> = {
|
|
2708
2776
|
request: Request;
|
|
@@ -2746,6 +2814,40 @@ export type PagesPluginFunction<
|
|
|
2746
2814
|
> = (
|
|
2747
2815
|
context: EventPluginContext<Env, Params, Data, PluginArgs>
|
|
2748
2816
|
) => Response | Promise<Response>;
|
|
2817
|
+
// https://developers.cloudflare.com/pub-sub/
|
|
2818
|
+
// PubSubMessage represents an incoming PubSub message.
|
|
2819
|
+
// The message includes metadata about the broker, the client, and the payload
|
|
2820
|
+
// itself.
|
|
2821
|
+
export interface PubSubMessage {
|
|
2822
|
+
// Message ID
|
|
2823
|
+
readonly mid: number;
|
|
2824
|
+
// MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
|
|
2825
|
+
readonly broker: string;
|
|
2826
|
+
// The MQTT topic the message was sent on.
|
|
2827
|
+
readonly topic: string;
|
|
2828
|
+
// The client ID of the client that published this message.
|
|
2829
|
+
readonly clientId: string;
|
|
2830
|
+
// The unique identifier (JWT ID) used by the client to authenticate, if token
|
|
2831
|
+
// auth was used.
|
|
2832
|
+
readonly jti?: string;
|
|
2833
|
+
// A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
|
|
2834
|
+
// received the message from the client.
|
|
2835
|
+
readonly receivedAt: number;
|
|
2836
|
+
// An (optional) string with the MIME type of the payload, if set by the
|
|
2837
|
+
// client.
|
|
2838
|
+
readonly contentType: string;
|
|
2839
|
+
// Set to 1 when the payload is a UTF-8 string
|
|
2840
|
+
// https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
|
|
2841
|
+
readonly payloadFormatIndicator: number;
|
|
2842
|
+
// Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
|
|
2843
|
+
// You can use payloadFormatIndicator to inspect this before decoding.
|
|
2844
|
+
payload: string | Uint8Array;
|
|
2845
|
+
}
|
|
2846
|
+
// JsonWebKey extended by kid parameter
|
|
2847
|
+
export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
2848
|
+
// Key Identifier of the JWK
|
|
2849
|
+
readonly kid: string;
|
|
2850
|
+
}
|
|
2749
2851
|
/**
|
|
2750
2852
|
* A message that is sent to a consumer Worker.
|
|
2751
2853
|
*/
|
|
@@ -2762,6 +2864,14 @@ export interface Message<Body = unknown> {
|
|
|
2762
2864
|
* The body of the message.
|
|
2763
2865
|
*/
|
|
2764
2866
|
readonly body: Body;
|
|
2867
|
+
/**
|
|
2868
|
+
* Marks message to be retried.
|
|
2869
|
+
*/
|
|
2870
|
+
retry(): void;
|
|
2871
|
+
/**
|
|
2872
|
+
* Marks message acknowledged.
|
|
2873
|
+
*/
|
|
2874
|
+
ack(): void;
|
|
2765
2875
|
}
|
|
2766
2876
|
/**
|
|
2767
2877
|
* A batch of messages that are sent to a consumer Worker.
|
|
@@ -2779,7 +2889,20 @@ export interface MessageBatch<Body = unknown> {
|
|
|
2779
2889
|
* Marks every message to be retried in the next batch.
|
|
2780
2890
|
*/
|
|
2781
2891
|
retryAll(): void;
|
|
2892
|
+
/**
|
|
2893
|
+
* Marks every message acknowledged in the batch.
|
|
2894
|
+
*/
|
|
2895
|
+
ackAll(): void;
|
|
2782
2896
|
}
|
|
2897
|
+
/**
|
|
2898
|
+
* A wrapper class used to structure message batches.
|
|
2899
|
+
*/
|
|
2900
|
+
export type MessageSendRequest<Body = unknown> = {
|
|
2901
|
+
/**
|
|
2902
|
+
* The body of the message.
|
|
2903
|
+
*/
|
|
2904
|
+
body: Body;
|
|
2905
|
+
};
|
|
2783
2906
|
/**
|
|
2784
2907
|
* A binding that allows a producer to send messages to a Queue.
|
|
2785
2908
|
*/
|
|
@@ -2790,4 +2913,10 @@ export interface Queue<Body = any> {
|
|
|
2790
2913
|
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2791
2914
|
*/
|
|
2792
2915
|
send(message: Body): Promise<void>;
|
|
2916
|
+
/**
|
|
2917
|
+
* Sends a batch of messages to the Queue.
|
|
2918
|
+
* @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.
|
|
2919
|
+
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2920
|
+
*/
|
|
2921
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2793
2922
|
}
|
package/index.d.ts
CHANGED
|
@@ -227,7 +227,6 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
227
227
|
FixedLengthStream: typeof FixedLengthStream;
|
|
228
228
|
IdentityTransformStream: typeof IdentityTransformStream;
|
|
229
229
|
HTMLRewriter: typeof HTMLRewriter;
|
|
230
|
-
connect(address: string, options?: SocketOptions): Socket;
|
|
231
230
|
}
|
|
232
231
|
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
|
|
233
232
|
type: Type,
|
|
@@ -280,9 +279,8 @@ declare const self: ServiceWorkerGlobalScope;
|
|
|
280
279
|
declare const crypto: Crypto;
|
|
281
280
|
declare const caches: CacheStorage;
|
|
282
281
|
declare const scheduler: Scheduler;
|
|
283
|
-
declare function connect(address: string, options?: SocketOptions): Socket;
|
|
284
282
|
declare interface ExecutionContext {
|
|
285
|
-
waitUntil(promise:
|
|
283
|
+
waitUntil(promise: Promise<any>): void;
|
|
286
284
|
passThroughOnException(): void;
|
|
287
285
|
}
|
|
288
286
|
declare type ExportedHandlerFetchHandler<Env = unknown> = (
|
|
@@ -337,13 +335,20 @@ declare interface DurableObjectNamespace {
|
|
|
337
335
|
): DurableObjectId;
|
|
338
336
|
idFromName(name: string): DurableObjectId;
|
|
339
337
|
idFromString(id: string): DurableObjectId;
|
|
340
|
-
get(
|
|
338
|
+
get(
|
|
339
|
+
id: DurableObjectId,
|
|
340
|
+
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
341
|
+
): DurableObjectStub;
|
|
342
|
+
jurisdiction(jurisdiction: string): DurableObjectNamespace;
|
|
341
343
|
}
|
|
342
344
|
declare interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
343
345
|
jurisdiction?: string;
|
|
344
346
|
}
|
|
347
|
+
declare interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
348
|
+
locationHint?: string;
|
|
349
|
+
}
|
|
345
350
|
declare interface DurableObjectState {
|
|
346
|
-
waitUntil(promise:
|
|
351
|
+
waitUntil(promise: Promise<any>): void;
|
|
347
352
|
readonly id: DurableObjectId;
|
|
348
353
|
readonly storage: DurableObjectStorage;
|
|
349
354
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
@@ -545,7 +550,7 @@ declare interface SchedulerWaitOptions {
|
|
|
545
550
|
signal?: AbortSignal;
|
|
546
551
|
}
|
|
547
552
|
declare abstract class ExtendableEvent extends Event {
|
|
548
|
-
waitUntil(promise:
|
|
553
|
+
waitUntil(promise: Promise<any>): void;
|
|
549
554
|
}
|
|
550
555
|
declare class Blob {
|
|
551
556
|
constructor(
|
|
@@ -999,6 +1004,10 @@ declare class Request<CfHostMetadata = unknown> extends Body {
|
|
|
999
1004
|
/** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. */
|
|
1000
1005
|
readonly signal: AbortSignal;
|
|
1001
1006
|
readonly cf?: IncomingRequestCfProperties<CfHostMetadata>;
|
|
1007
|
+
/** Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI] */
|
|
1008
|
+
readonly integrity: string;
|
|
1009
|
+
/** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
|
|
1010
|
+
readonly keepalive: boolean;
|
|
1002
1011
|
}
|
|
1003
1012
|
declare interface RequestInit<
|
|
1004
1013
|
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
@@ -1013,6 +1022,8 @@ declare interface RequestInit<
|
|
|
1013
1022
|
redirect?: string;
|
|
1014
1023
|
fetcher?: Fetcher | null;
|
|
1015
1024
|
cf?: CfType;
|
|
1025
|
+
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1026
|
+
integrity?: string;
|
|
1016
1027
|
/** An AbortSignal to set request's signal. */
|
|
1017
1028
|
signal?: AbortSignal | null;
|
|
1018
1029
|
}
|
|
@@ -1021,7 +1032,6 @@ declare abstract class Fetcher {
|
|
|
1021
1032
|
input: RequestInfo,
|
|
1022
1033
|
init?: RequestInit<RequestInitCfProperties>
|
|
1023
1034
|
): Promise<Response>;
|
|
1024
|
-
connect(address: string, options?: SocketOptions): Socket;
|
|
1025
1035
|
}
|
|
1026
1036
|
declare interface FetcherPutOptions {
|
|
1027
1037
|
expiration?: number;
|
|
@@ -1065,11 +1075,11 @@ declare interface KVNamespace<Key extends string = string> {
|
|
|
1065
1075
|
get(
|
|
1066
1076
|
key: Key,
|
|
1067
1077
|
options?: KVNamespaceGetOptions<"arrayBuffer">
|
|
1068
|
-
): Promise<
|
|
1078
|
+
): Promise<ArrayBuffer | null>;
|
|
1069
1079
|
get(
|
|
1070
1080
|
key: Key,
|
|
1071
1081
|
options?: KVNamespaceGetOptions<"stream">
|
|
1072
|
-
): Promise<
|
|
1082
|
+
): Promise<ReadableStream | null>;
|
|
1073
1083
|
list<Metadata = unknown>(
|
|
1074
1084
|
options?: KVNamespaceListOptions
|
|
1075
1085
|
): Promise<KVNamespaceListResult<Metadata, Key>>;
|
|
@@ -1168,6 +1178,19 @@ declare abstract class R2Bucket {
|
|
|
1168
1178
|
| Blob,
|
|
1169
1179
|
options?: R2PutOptions
|
|
1170
1180
|
): Promise<R2Object>;
|
|
1181
|
+
put(
|
|
1182
|
+
key: string,
|
|
1183
|
+
value:
|
|
1184
|
+
| ReadableStream
|
|
1185
|
+
| ArrayBuffer
|
|
1186
|
+
| ArrayBufferView
|
|
1187
|
+
| string
|
|
1188
|
+
| null
|
|
1189
|
+
| Blob,
|
|
1190
|
+
options?: R2PutOptions & {
|
|
1191
|
+
onlyIf: R2Conditional | Headers;
|
|
1192
|
+
}
|
|
1193
|
+
): Promise<R2Object | null>;
|
|
1171
1194
|
createMultipartUpload(
|
|
1172
1195
|
key: string,
|
|
1173
1196
|
options?: R2MultipartOptions
|
|
@@ -1551,6 +1574,8 @@ declare interface TraceItem {
|
|
|
1551
1574
|
| TraceItemFetchEventInfo
|
|
1552
1575
|
| TraceItemScheduledEventInfo
|
|
1553
1576
|
| TraceItemAlarmEventInfo
|
|
1577
|
+
| TraceItemQueueEventInfo
|
|
1578
|
+
| TraceItemEmailEventInfo
|
|
1554
1579
|
| TraceItemCustomEventInfo
|
|
1555
1580
|
)
|
|
1556
1581
|
| null;
|
|
@@ -1559,6 +1584,7 @@ declare interface TraceItem {
|
|
|
1559
1584
|
readonly exceptions: TraceException[];
|
|
1560
1585
|
readonly scriptName: string | null;
|
|
1561
1586
|
readonly dispatchNamespace?: string;
|
|
1587
|
+
readonly scriptTags?: string[];
|
|
1562
1588
|
readonly outcome: string;
|
|
1563
1589
|
}
|
|
1564
1590
|
declare interface TraceItemAlarmEventInfo {
|
|
@@ -1569,6 +1595,15 @@ declare interface TraceItemScheduledEventInfo {
|
|
|
1569
1595
|
readonly scheduledTime: number;
|
|
1570
1596
|
readonly cron: string;
|
|
1571
1597
|
}
|
|
1598
|
+
declare interface TraceItemQueueEventInfo {
|
|
1599
|
+
readonly queue: string;
|
|
1600
|
+
readonly batchSize: number;
|
|
1601
|
+
}
|
|
1602
|
+
declare interface TraceItemEmailEventInfo {
|
|
1603
|
+
readonly mailFrom: string;
|
|
1604
|
+
readonly rcptTo: string;
|
|
1605
|
+
readonly rawSize: number;
|
|
1606
|
+
}
|
|
1572
1607
|
declare interface TraceItemFetchEventInfo {
|
|
1573
1608
|
readonly response?: TraceItemFetchEventInfoResponse;
|
|
1574
1609
|
readonly request: TraceItemFetchEventInfoRequest;
|
|
@@ -1748,15 +1783,6 @@ declare const WebSocketPair: {
|
|
|
1748
1783
|
1: WebSocket;
|
|
1749
1784
|
};
|
|
1750
1785
|
};
|
|
1751
|
-
declare interface Socket {
|
|
1752
|
-
readonly readable: ReadableStream;
|
|
1753
|
-
readonly writable: WritableStream;
|
|
1754
|
-
readonly closed: Promise<void>;
|
|
1755
|
-
close(): Promise<void>;
|
|
1756
|
-
}
|
|
1757
|
-
declare interface SocketOptions {
|
|
1758
|
-
tsl: boolean;
|
|
1759
|
-
}
|
|
1760
1786
|
declare interface BasicImageTransformations {
|
|
1761
1787
|
/**
|
|
1762
1788
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2701,6 +2727,52 @@ declare abstract class D1PreparedStatement {
|
|
|
2701
2727
|
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2702
2728
|
raw<T = unknown>(): Promise<T[]>;
|
|
2703
2729
|
}
|
|
2730
|
+
/**
|
|
2731
|
+
* A email message that is sent to a consumer Worker.
|
|
2732
|
+
*/
|
|
2733
|
+
declare interface EmailMessage<Body = unknown> {
|
|
2734
|
+
/**
|
|
2735
|
+
* Envelope From attribute of the email message.
|
|
2736
|
+
*/
|
|
2737
|
+
readonly from: string;
|
|
2738
|
+
/**
|
|
2739
|
+
* Envelope To attribute of the email message.
|
|
2740
|
+
*/
|
|
2741
|
+
readonly to: string;
|
|
2742
|
+
/**
|
|
2743
|
+
* A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2744
|
+
*/
|
|
2745
|
+
readonly headers: Headers;
|
|
2746
|
+
/**
|
|
2747
|
+
* Stream of the email message content.
|
|
2748
|
+
*/
|
|
2749
|
+
readonly raw: ReadableStream;
|
|
2750
|
+
/**
|
|
2751
|
+
* Size of the email message content.
|
|
2752
|
+
*/
|
|
2753
|
+
readonly rawSize: number;
|
|
2754
|
+
/**
|
|
2755
|
+
* Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
|
|
2756
|
+
* @param reason The reject reason.
|
|
2757
|
+
* @returns void
|
|
2758
|
+
*/
|
|
2759
|
+
setReject(reason: string): void;
|
|
2760
|
+
/**
|
|
2761
|
+
* Forward this email message to a verified destination address of the account.
|
|
2762
|
+
* @param rcptTo Verified destination address.
|
|
2763
|
+
* @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2764
|
+
* @returns A promise that resolves when the email message is forwarded.
|
|
2765
|
+
*/
|
|
2766
|
+
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2767
|
+
}
|
|
2768
|
+
declare abstract class EmailEvent extends ExtendableEvent {
|
|
2769
|
+
readonly message: EmailMessage;
|
|
2770
|
+
}
|
|
2771
|
+
declare type EmailExportedHandler<Env = unknown> = (
|
|
2772
|
+
message: EmailMessage,
|
|
2773
|
+
env: Env,
|
|
2774
|
+
ctx: ExecutionContext
|
|
2775
|
+
) => void | Promise<void>;
|
|
2704
2776
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2705
2777
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2706
2778
|
request: Request;
|
|
@@ -2747,6 +2819,40 @@ declare type PagesPluginFunction<
|
|
|
2747
2819
|
declare module "assets:*" {
|
|
2748
2820
|
export const onRequest: PagesFunction;
|
|
2749
2821
|
}
|
|
2822
|
+
// https://developers.cloudflare.com/pub-sub/
|
|
2823
|
+
// PubSubMessage represents an incoming PubSub message.
|
|
2824
|
+
// The message includes metadata about the broker, the client, and the payload
|
|
2825
|
+
// itself.
|
|
2826
|
+
declare interface PubSubMessage {
|
|
2827
|
+
// Message ID
|
|
2828
|
+
readonly mid: number;
|
|
2829
|
+
// MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
|
|
2830
|
+
readonly broker: string;
|
|
2831
|
+
// The MQTT topic the message was sent on.
|
|
2832
|
+
readonly topic: string;
|
|
2833
|
+
// The client ID of the client that published this message.
|
|
2834
|
+
readonly clientId: string;
|
|
2835
|
+
// The unique identifier (JWT ID) used by the client to authenticate, if token
|
|
2836
|
+
// auth was used.
|
|
2837
|
+
readonly jti?: string;
|
|
2838
|
+
// A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
|
|
2839
|
+
// received the message from the client.
|
|
2840
|
+
readonly receivedAt: number;
|
|
2841
|
+
// An (optional) string with the MIME type of the payload, if set by the
|
|
2842
|
+
// client.
|
|
2843
|
+
readonly contentType: string;
|
|
2844
|
+
// Set to 1 when the payload is a UTF-8 string
|
|
2845
|
+
// https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
|
|
2846
|
+
readonly payloadFormatIndicator: number;
|
|
2847
|
+
// Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
|
|
2848
|
+
// You can use payloadFormatIndicator to inspect this before decoding.
|
|
2849
|
+
payload: string | Uint8Array;
|
|
2850
|
+
}
|
|
2851
|
+
// JsonWebKey extended by kid parameter
|
|
2852
|
+
declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
2853
|
+
// Key Identifier of the JWK
|
|
2854
|
+
readonly kid: string;
|
|
2855
|
+
}
|
|
2750
2856
|
/**
|
|
2751
2857
|
* A message that is sent to a consumer Worker.
|
|
2752
2858
|
*/
|
|
@@ -2763,6 +2869,14 @@ declare interface Message<Body = unknown> {
|
|
|
2763
2869
|
* The body of the message.
|
|
2764
2870
|
*/
|
|
2765
2871
|
readonly body: Body;
|
|
2872
|
+
/**
|
|
2873
|
+
* Marks message to be retried.
|
|
2874
|
+
*/
|
|
2875
|
+
retry(): void;
|
|
2876
|
+
/**
|
|
2877
|
+
* Marks message acknowledged.
|
|
2878
|
+
*/
|
|
2879
|
+
ack(): void;
|
|
2766
2880
|
}
|
|
2767
2881
|
/**
|
|
2768
2882
|
* A batch of messages that are sent to a consumer Worker.
|
|
@@ -2780,7 +2894,20 @@ declare interface MessageBatch<Body = unknown> {
|
|
|
2780
2894
|
* Marks every message to be retried in the next batch.
|
|
2781
2895
|
*/
|
|
2782
2896
|
retryAll(): void;
|
|
2897
|
+
/**
|
|
2898
|
+
* Marks every message acknowledged in the batch.
|
|
2899
|
+
*/
|
|
2900
|
+
ackAll(): void;
|
|
2783
2901
|
}
|
|
2902
|
+
/**
|
|
2903
|
+
* A wrapper class used to structure message batches.
|
|
2904
|
+
*/
|
|
2905
|
+
declare type MessageSendRequest<Body = unknown> = {
|
|
2906
|
+
/**
|
|
2907
|
+
* The body of the message.
|
|
2908
|
+
*/
|
|
2909
|
+
body: Body;
|
|
2910
|
+
};
|
|
2784
2911
|
/**
|
|
2785
2912
|
* A binding that allows a producer to send messages to a Queue.
|
|
2786
2913
|
*/
|
|
@@ -2791,4 +2918,10 @@ declare interface Queue<Body = any> {
|
|
|
2791
2918
|
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2792
2919
|
*/
|
|
2793
2920
|
send(message: Body): Promise<void>;
|
|
2921
|
+
/**
|
|
2922
|
+
* Sends a batch of messages to the Queue.
|
|
2923
|
+
* @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.
|
|
2924
|
+
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2925
|
+
*/
|
|
2926
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2794
2927
|
}
|