@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/2022-03-21/index.d.ts
CHANGED
|
@@ -229,7 +229,6 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
229
229
|
FixedLengthStream: typeof FixedLengthStream;
|
|
230
230
|
IdentityTransformStream: typeof IdentityTransformStream;
|
|
231
231
|
HTMLRewriter: typeof HTMLRewriter;
|
|
232
|
-
connect(address: string, options?: SocketOptions): Socket;
|
|
233
232
|
}
|
|
234
233
|
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
|
|
235
234
|
type: Type,
|
|
@@ -283,9 +282,8 @@ declare const crypto: Crypto;
|
|
|
283
282
|
declare const caches: CacheStorage;
|
|
284
283
|
declare const scheduler: Scheduler;
|
|
285
284
|
declare const navigator: Navigator;
|
|
286
|
-
declare function connect(address: string, options?: SocketOptions): Socket;
|
|
287
285
|
declare interface ExecutionContext {
|
|
288
|
-
waitUntil(promise:
|
|
286
|
+
waitUntil(promise: Promise<any>): void;
|
|
289
287
|
passThroughOnException(): void;
|
|
290
288
|
}
|
|
291
289
|
declare type ExportedHandlerFetchHandler<Env = unknown> = (
|
|
@@ -343,13 +341,20 @@ declare interface DurableObjectNamespace {
|
|
|
343
341
|
): DurableObjectId;
|
|
344
342
|
idFromName(name: string): DurableObjectId;
|
|
345
343
|
idFromString(id: string): DurableObjectId;
|
|
346
|
-
get(
|
|
344
|
+
get(
|
|
345
|
+
id: DurableObjectId,
|
|
346
|
+
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
347
|
+
): DurableObjectStub;
|
|
348
|
+
jurisdiction(jurisdiction: string): DurableObjectNamespace;
|
|
347
349
|
}
|
|
348
350
|
declare interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
349
351
|
jurisdiction?: string;
|
|
350
352
|
}
|
|
353
|
+
declare interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
354
|
+
locationHint?: string;
|
|
355
|
+
}
|
|
351
356
|
declare interface DurableObjectState {
|
|
352
|
-
waitUntil(promise:
|
|
357
|
+
waitUntil(promise: Promise<any>): void;
|
|
353
358
|
readonly id: DurableObjectId;
|
|
354
359
|
readonly storage: DurableObjectStorage;
|
|
355
360
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
@@ -539,7 +544,7 @@ declare interface SchedulerWaitOptions {
|
|
|
539
544
|
signal?: AbortSignal;
|
|
540
545
|
}
|
|
541
546
|
declare abstract class ExtendableEvent extends Event {
|
|
542
|
-
waitUntil(promise:
|
|
547
|
+
waitUntil(promise: Promise<any>): void;
|
|
543
548
|
}
|
|
544
549
|
declare class Blob {
|
|
545
550
|
constructor(
|
|
@@ -987,6 +992,8 @@ declare class Request<CfHostMetadata = unknown> extends Body {
|
|
|
987
992
|
get fetcher(): Fetcher | null;
|
|
988
993
|
get signal(): AbortSignal;
|
|
989
994
|
get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
|
|
995
|
+
get integrity(): string;
|
|
996
|
+
get keepalive(): boolean;
|
|
990
997
|
}
|
|
991
998
|
declare interface RequestInit<
|
|
992
999
|
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
@@ -1001,6 +1008,8 @@ declare interface RequestInit<
|
|
|
1001
1008
|
redirect?: string;
|
|
1002
1009
|
fetcher?: Fetcher | null;
|
|
1003
1010
|
cf?: CfType;
|
|
1011
|
+
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1012
|
+
integrity?: string;
|
|
1004
1013
|
/** An AbortSignal to set request's signal. */
|
|
1005
1014
|
signal?: AbortSignal | null;
|
|
1006
1015
|
}
|
|
@@ -1009,7 +1018,6 @@ declare abstract class Fetcher {
|
|
|
1009
1018
|
input: RequestInfo,
|
|
1010
1019
|
init?: RequestInit<RequestInitCfProperties>
|
|
1011
1020
|
): Promise<Response>;
|
|
1012
|
-
connect(address: string, options?: SocketOptions): Socket;
|
|
1013
1021
|
}
|
|
1014
1022
|
declare interface FetcherPutOptions {
|
|
1015
1023
|
expiration?: number;
|
|
@@ -1053,11 +1061,11 @@ declare interface KVNamespace<Key extends string = string> {
|
|
|
1053
1061
|
get(
|
|
1054
1062
|
key: Key,
|
|
1055
1063
|
options?: KVNamespaceGetOptions<"arrayBuffer">
|
|
1056
|
-
): Promise<
|
|
1064
|
+
): Promise<ArrayBuffer | null>;
|
|
1057
1065
|
get(
|
|
1058
1066
|
key: Key,
|
|
1059
1067
|
options?: KVNamespaceGetOptions<"stream">
|
|
1060
|
-
): Promise<
|
|
1068
|
+
): Promise<ReadableStream | null>;
|
|
1061
1069
|
list<Metadata = unknown>(
|
|
1062
1070
|
options?: KVNamespaceListOptions
|
|
1063
1071
|
): Promise<KVNamespaceListResult<Metadata, Key>>;
|
|
@@ -1156,6 +1164,19 @@ declare abstract class R2Bucket {
|
|
|
1156
1164
|
| Blob,
|
|
1157
1165
|
options?: R2PutOptions
|
|
1158
1166
|
): Promise<R2Object>;
|
|
1167
|
+
put(
|
|
1168
|
+
key: string,
|
|
1169
|
+
value:
|
|
1170
|
+
| ReadableStream
|
|
1171
|
+
| ArrayBuffer
|
|
1172
|
+
| ArrayBufferView
|
|
1173
|
+
| string
|
|
1174
|
+
| null
|
|
1175
|
+
| Blob,
|
|
1176
|
+
options?: R2PutOptions & {
|
|
1177
|
+
onlyIf: R2Conditional | Headers;
|
|
1178
|
+
}
|
|
1179
|
+
): Promise<R2Object | null>;
|
|
1159
1180
|
createMultipartUpload(
|
|
1160
1181
|
key: string,
|
|
1161
1182
|
options?: R2MultipartOptions
|
|
@@ -1539,6 +1560,8 @@ declare interface TraceItem {
|
|
|
1539
1560
|
| TraceItemFetchEventInfo
|
|
1540
1561
|
| TraceItemScheduledEventInfo
|
|
1541
1562
|
| TraceItemAlarmEventInfo
|
|
1563
|
+
| TraceItemQueueEventInfo
|
|
1564
|
+
| TraceItemEmailEventInfo
|
|
1542
1565
|
| TraceItemCustomEventInfo
|
|
1543
1566
|
)
|
|
1544
1567
|
| null;
|
|
@@ -1547,6 +1570,7 @@ declare interface TraceItem {
|
|
|
1547
1570
|
readonly exceptions: TraceException[];
|
|
1548
1571
|
readonly scriptName: string | null;
|
|
1549
1572
|
readonly dispatchNamespace?: string;
|
|
1573
|
+
readonly scriptTags?: string[];
|
|
1550
1574
|
readonly outcome: string;
|
|
1551
1575
|
}
|
|
1552
1576
|
declare interface TraceItemAlarmEventInfo {
|
|
@@ -1557,6 +1581,15 @@ declare interface TraceItemScheduledEventInfo {
|
|
|
1557
1581
|
readonly scheduledTime: number;
|
|
1558
1582
|
readonly cron: string;
|
|
1559
1583
|
}
|
|
1584
|
+
declare interface TraceItemQueueEventInfo {
|
|
1585
|
+
readonly queue: string;
|
|
1586
|
+
readonly batchSize: number;
|
|
1587
|
+
}
|
|
1588
|
+
declare interface TraceItemEmailEventInfo {
|
|
1589
|
+
readonly mailFrom: string;
|
|
1590
|
+
readonly rcptTo: string;
|
|
1591
|
+
readonly rawSize: number;
|
|
1592
|
+
}
|
|
1560
1593
|
declare interface TraceItemFetchEventInfo {
|
|
1561
1594
|
readonly response?: TraceItemFetchEventInfoResponse;
|
|
1562
1595
|
readonly request: TraceItemFetchEventInfoRequest;
|
|
@@ -1742,15 +1775,6 @@ declare const WebSocketPair: {
|
|
|
1742
1775
|
1: WebSocket;
|
|
1743
1776
|
};
|
|
1744
1777
|
};
|
|
1745
|
-
declare interface Socket {
|
|
1746
|
-
readonly readable: ReadableStream;
|
|
1747
|
-
readonly writable: WritableStream;
|
|
1748
|
-
readonly closed: Promise<void>;
|
|
1749
|
-
close(): Promise<void>;
|
|
1750
|
-
}
|
|
1751
|
-
declare interface SocketOptions {
|
|
1752
|
-
tsl: boolean;
|
|
1753
|
-
}
|
|
1754
1778
|
declare interface BasicImageTransformations {
|
|
1755
1779
|
/**
|
|
1756
1780
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2695,6 +2719,52 @@ declare abstract class D1PreparedStatement {
|
|
|
2695
2719
|
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2696
2720
|
raw<T = unknown>(): Promise<T[]>;
|
|
2697
2721
|
}
|
|
2722
|
+
/**
|
|
2723
|
+
* A email message that is sent to a consumer Worker.
|
|
2724
|
+
*/
|
|
2725
|
+
declare interface EmailMessage<Body = unknown> {
|
|
2726
|
+
/**
|
|
2727
|
+
* Envelope From attribute of the email message.
|
|
2728
|
+
*/
|
|
2729
|
+
readonly from: string;
|
|
2730
|
+
/**
|
|
2731
|
+
* Envelope To attribute of the email message.
|
|
2732
|
+
*/
|
|
2733
|
+
readonly to: string;
|
|
2734
|
+
/**
|
|
2735
|
+
* A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2736
|
+
*/
|
|
2737
|
+
readonly headers: Headers;
|
|
2738
|
+
/**
|
|
2739
|
+
* Stream of the email message content.
|
|
2740
|
+
*/
|
|
2741
|
+
readonly raw: ReadableStream;
|
|
2742
|
+
/**
|
|
2743
|
+
* Size of the email message content.
|
|
2744
|
+
*/
|
|
2745
|
+
readonly rawSize: number;
|
|
2746
|
+
/**
|
|
2747
|
+
* Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
|
|
2748
|
+
* @param reason The reject reason.
|
|
2749
|
+
* @returns void
|
|
2750
|
+
*/
|
|
2751
|
+
setReject(reason: string): void;
|
|
2752
|
+
/**
|
|
2753
|
+
* Forward this email message to a verified destination address of the account.
|
|
2754
|
+
* @param rcptTo Verified destination address.
|
|
2755
|
+
* @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2756
|
+
* @returns A promise that resolves when the email message is forwarded.
|
|
2757
|
+
*/
|
|
2758
|
+
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2759
|
+
}
|
|
2760
|
+
declare abstract class EmailEvent extends ExtendableEvent {
|
|
2761
|
+
readonly message: EmailMessage;
|
|
2762
|
+
}
|
|
2763
|
+
declare type EmailExportedHandler<Env = unknown> = (
|
|
2764
|
+
message: EmailMessage,
|
|
2765
|
+
env: Env,
|
|
2766
|
+
ctx: ExecutionContext
|
|
2767
|
+
) => void | Promise<void>;
|
|
2698
2768
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2699
2769
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2700
2770
|
request: Request;
|
|
@@ -2741,6 +2811,40 @@ declare type PagesPluginFunction<
|
|
|
2741
2811
|
declare module "assets:*" {
|
|
2742
2812
|
export const onRequest: PagesFunction;
|
|
2743
2813
|
}
|
|
2814
|
+
// https://developers.cloudflare.com/pub-sub/
|
|
2815
|
+
// PubSubMessage represents an incoming PubSub message.
|
|
2816
|
+
// The message includes metadata about the broker, the client, and the payload
|
|
2817
|
+
// itself.
|
|
2818
|
+
declare interface PubSubMessage {
|
|
2819
|
+
// Message ID
|
|
2820
|
+
readonly mid: number;
|
|
2821
|
+
// MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
|
|
2822
|
+
readonly broker: string;
|
|
2823
|
+
// The MQTT topic the message was sent on.
|
|
2824
|
+
readonly topic: string;
|
|
2825
|
+
// The client ID of the client that published this message.
|
|
2826
|
+
readonly clientId: string;
|
|
2827
|
+
// The unique identifier (JWT ID) used by the client to authenticate, if token
|
|
2828
|
+
// auth was used.
|
|
2829
|
+
readonly jti?: string;
|
|
2830
|
+
// A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
|
|
2831
|
+
// received the message from the client.
|
|
2832
|
+
readonly receivedAt: number;
|
|
2833
|
+
// An (optional) string with the MIME type of the payload, if set by the
|
|
2834
|
+
// client.
|
|
2835
|
+
readonly contentType: string;
|
|
2836
|
+
// Set to 1 when the payload is a UTF-8 string
|
|
2837
|
+
// https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
|
|
2838
|
+
readonly payloadFormatIndicator: number;
|
|
2839
|
+
// Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
|
|
2840
|
+
// You can use payloadFormatIndicator to inspect this before decoding.
|
|
2841
|
+
payload: string | Uint8Array;
|
|
2842
|
+
}
|
|
2843
|
+
// JsonWebKey extended by kid parameter
|
|
2844
|
+
declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
2845
|
+
// Key Identifier of the JWK
|
|
2846
|
+
readonly kid: string;
|
|
2847
|
+
}
|
|
2744
2848
|
/**
|
|
2745
2849
|
* A message that is sent to a consumer Worker.
|
|
2746
2850
|
*/
|
|
@@ -2757,6 +2861,14 @@ declare interface Message<Body = unknown> {
|
|
|
2757
2861
|
* The body of the message.
|
|
2758
2862
|
*/
|
|
2759
2863
|
readonly body: Body;
|
|
2864
|
+
/**
|
|
2865
|
+
* Marks message to be retried.
|
|
2866
|
+
*/
|
|
2867
|
+
retry(): void;
|
|
2868
|
+
/**
|
|
2869
|
+
* Marks message acknowledged.
|
|
2870
|
+
*/
|
|
2871
|
+
ack(): void;
|
|
2760
2872
|
}
|
|
2761
2873
|
/**
|
|
2762
2874
|
* A batch of messages that are sent to a consumer Worker.
|
|
@@ -2774,7 +2886,20 @@ declare interface MessageBatch<Body = unknown> {
|
|
|
2774
2886
|
* Marks every message to be retried in the next batch.
|
|
2775
2887
|
*/
|
|
2776
2888
|
retryAll(): void;
|
|
2889
|
+
/**
|
|
2890
|
+
* Marks every message acknowledged in the batch.
|
|
2891
|
+
*/
|
|
2892
|
+
ackAll(): void;
|
|
2777
2893
|
}
|
|
2894
|
+
/**
|
|
2895
|
+
* A wrapper class used to structure message batches.
|
|
2896
|
+
*/
|
|
2897
|
+
declare type MessageSendRequest<Body = unknown> = {
|
|
2898
|
+
/**
|
|
2899
|
+
* The body of the message.
|
|
2900
|
+
*/
|
|
2901
|
+
body: Body;
|
|
2902
|
+
};
|
|
2778
2903
|
/**
|
|
2779
2904
|
* A binding that allows a producer to send messages to a Queue.
|
|
2780
2905
|
*/
|
|
@@ -2785,4 +2910,10 @@ declare interface Queue<Body = any> {
|
|
|
2785
2910
|
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2786
2911
|
*/
|
|
2787
2912
|
send(message: Body): Promise<void>;
|
|
2913
|
+
/**
|
|
2914
|
+
* Sends a batch of messages to the Queue.
|
|
2915
|
+
* @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.
|
|
2916
|
+
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2917
|
+
*/
|
|
2918
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2788
2919
|
}
|
package/2022-03-21/index.ts
CHANGED
|
@@ -229,7 +229,6 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
229
229
|
FixedLengthStream: typeof FixedLengthStream;
|
|
230
230
|
IdentityTransformStream: typeof IdentityTransformStream;
|
|
231
231
|
HTMLRewriter: typeof HTMLRewriter;
|
|
232
|
-
connect(address: string, options?: SocketOptions): Socket;
|
|
233
232
|
}
|
|
234
233
|
export declare function addEventListener<
|
|
235
234
|
Type extends keyof WorkerGlobalScopeEventMap
|
|
@@ -285,12 +284,8 @@ export declare const crypto: Crypto;
|
|
|
285
284
|
export declare const caches: CacheStorage;
|
|
286
285
|
export declare const scheduler: Scheduler;
|
|
287
286
|
export declare const navigator: Navigator;
|
|
288
|
-
export declare function connect(
|
|
289
|
-
address: string,
|
|
290
|
-
options?: SocketOptions
|
|
291
|
-
): Socket;
|
|
292
287
|
export interface ExecutionContext {
|
|
293
|
-
waitUntil(promise:
|
|
288
|
+
waitUntil(promise: Promise<any>): void;
|
|
294
289
|
passThroughOnException(): void;
|
|
295
290
|
}
|
|
296
291
|
export type ExportedHandlerFetchHandler<Env = unknown> = (
|
|
@@ -348,13 +343,20 @@ export interface DurableObjectNamespace {
|
|
|
348
343
|
): DurableObjectId;
|
|
349
344
|
idFromName(name: string): DurableObjectId;
|
|
350
345
|
idFromString(id: string): DurableObjectId;
|
|
351
|
-
get(
|
|
346
|
+
get(
|
|
347
|
+
id: DurableObjectId,
|
|
348
|
+
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
349
|
+
): DurableObjectStub;
|
|
350
|
+
jurisdiction(jurisdiction: string): DurableObjectNamespace;
|
|
352
351
|
}
|
|
353
352
|
export interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
354
353
|
jurisdiction?: string;
|
|
355
354
|
}
|
|
355
|
+
export interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
356
|
+
locationHint?: string;
|
|
357
|
+
}
|
|
356
358
|
export interface DurableObjectState {
|
|
357
|
-
waitUntil(promise:
|
|
359
|
+
waitUntil(promise: Promise<any>): void;
|
|
358
360
|
readonly id: DurableObjectId;
|
|
359
361
|
readonly storage: DurableObjectStorage;
|
|
360
362
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
@@ -544,7 +546,7 @@ export interface SchedulerWaitOptions {
|
|
|
544
546
|
signal?: AbortSignal;
|
|
545
547
|
}
|
|
546
548
|
export declare abstract class ExtendableEvent extends Event {
|
|
547
|
-
waitUntil(promise:
|
|
549
|
+
waitUntil(promise: Promise<any>): void;
|
|
548
550
|
}
|
|
549
551
|
export declare class Blob {
|
|
550
552
|
constructor(
|
|
@@ -992,6 +994,8 @@ export declare class Request<CfHostMetadata = unknown> extends Body {
|
|
|
992
994
|
get fetcher(): Fetcher | null;
|
|
993
995
|
get signal(): AbortSignal;
|
|
994
996
|
get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
|
|
997
|
+
get integrity(): string;
|
|
998
|
+
get keepalive(): boolean;
|
|
995
999
|
}
|
|
996
1000
|
export interface RequestInit<
|
|
997
1001
|
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
@@ -1006,6 +1010,8 @@ export interface RequestInit<
|
|
|
1006
1010
|
redirect?: string;
|
|
1007
1011
|
fetcher?: Fetcher | null;
|
|
1008
1012
|
cf?: CfType;
|
|
1013
|
+
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1014
|
+
integrity?: string;
|
|
1009
1015
|
/** An AbortSignal to set request's signal. */
|
|
1010
1016
|
signal?: AbortSignal | null;
|
|
1011
1017
|
}
|
|
@@ -1014,7 +1020,6 @@ export declare abstract class Fetcher {
|
|
|
1014
1020
|
input: RequestInfo,
|
|
1015
1021
|
init?: RequestInit<RequestInitCfProperties>
|
|
1016
1022
|
): Promise<Response>;
|
|
1017
|
-
connect(address: string, options?: SocketOptions): Socket;
|
|
1018
1023
|
}
|
|
1019
1024
|
export interface FetcherPutOptions {
|
|
1020
1025
|
expiration?: number;
|
|
@@ -1058,11 +1063,11 @@ export interface KVNamespace<Key extends string = string> {
|
|
|
1058
1063
|
get(
|
|
1059
1064
|
key: Key,
|
|
1060
1065
|
options?: KVNamespaceGetOptions<"arrayBuffer">
|
|
1061
|
-
): Promise<
|
|
1066
|
+
): Promise<ArrayBuffer | null>;
|
|
1062
1067
|
get(
|
|
1063
1068
|
key: Key,
|
|
1064
1069
|
options?: KVNamespaceGetOptions<"stream">
|
|
1065
|
-
): Promise<
|
|
1070
|
+
): Promise<ReadableStream | null>;
|
|
1066
1071
|
list<Metadata = unknown>(
|
|
1067
1072
|
options?: KVNamespaceListOptions
|
|
1068
1073
|
): Promise<KVNamespaceListResult<Metadata, Key>>;
|
|
@@ -1161,6 +1166,19 @@ export declare abstract class R2Bucket {
|
|
|
1161
1166
|
| Blob,
|
|
1162
1167
|
options?: R2PutOptions
|
|
1163
1168
|
): Promise<R2Object>;
|
|
1169
|
+
put(
|
|
1170
|
+
key: string,
|
|
1171
|
+
value:
|
|
1172
|
+
| ReadableStream
|
|
1173
|
+
| ArrayBuffer
|
|
1174
|
+
| ArrayBufferView
|
|
1175
|
+
| string
|
|
1176
|
+
| null
|
|
1177
|
+
| Blob,
|
|
1178
|
+
options?: R2PutOptions & {
|
|
1179
|
+
onlyIf: R2Conditional | Headers;
|
|
1180
|
+
}
|
|
1181
|
+
): Promise<R2Object | null>;
|
|
1164
1182
|
createMultipartUpload(
|
|
1165
1183
|
key: string,
|
|
1166
1184
|
options?: R2MultipartOptions
|
|
@@ -1547,6 +1565,8 @@ export interface TraceItem {
|
|
|
1547
1565
|
| TraceItemFetchEventInfo
|
|
1548
1566
|
| TraceItemScheduledEventInfo
|
|
1549
1567
|
| TraceItemAlarmEventInfo
|
|
1568
|
+
| TraceItemQueueEventInfo
|
|
1569
|
+
| TraceItemEmailEventInfo
|
|
1550
1570
|
| TraceItemCustomEventInfo
|
|
1551
1571
|
)
|
|
1552
1572
|
| null;
|
|
@@ -1555,6 +1575,7 @@ export interface TraceItem {
|
|
|
1555
1575
|
readonly exceptions: TraceException[];
|
|
1556
1576
|
readonly scriptName: string | null;
|
|
1557
1577
|
readonly dispatchNamespace?: string;
|
|
1578
|
+
readonly scriptTags?: string[];
|
|
1558
1579
|
readonly outcome: string;
|
|
1559
1580
|
}
|
|
1560
1581
|
export interface TraceItemAlarmEventInfo {
|
|
@@ -1565,6 +1586,15 @@ export interface TraceItemScheduledEventInfo {
|
|
|
1565
1586
|
readonly scheduledTime: number;
|
|
1566
1587
|
readonly cron: string;
|
|
1567
1588
|
}
|
|
1589
|
+
export interface TraceItemQueueEventInfo {
|
|
1590
|
+
readonly queue: string;
|
|
1591
|
+
readonly batchSize: number;
|
|
1592
|
+
}
|
|
1593
|
+
export interface TraceItemEmailEventInfo {
|
|
1594
|
+
readonly mailFrom: string;
|
|
1595
|
+
readonly rcptTo: string;
|
|
1596
|
+
readonly rawSize: number;
|
|
1597
|
+
}
|
|
1568
1598
|
export interface TraceItemFetchEventInfo {
|
|
1569
1599
|
readonly response?: TraceItemFetchEventInfoResponse;
|
|
1570
1600
|
readonly request: TraceItemFetchEventInfoRequest;
|
|
@@ -1750,15 +1780,6 @@ export declare const WebSocketPair: {
|
|
|
1750
1780
|
1: WebSocket;
|
|
1751
1781
|
};
|
|
1752
1782
|
};
|
|
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
1783
|
export interface BasicImageTransformations {
|
|
1763
1784
|
/**
|
|
1764
1785
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2703,6 +2724,52 @@ export declare abstract class D1PreparedStatement {
|
|
|
2703
2724
|
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2704
2725
|
raw<T = unknown>(): Promise<T[]>;
|
|
2705
2726
|
}
|
|
2727
|
+
/**
|
|
2728
|
+
* A email message that is sent to a consumer Worker.
|
|
2729
|
+
*/
|
|
2730
|
+
export interface EmailMessage<Body = unknown> {
|
|
2731
|
+
/**
|
|
2732
|
+
* Envelope From attribute of the email message.
|
|
2733
|
+
*/
|
|
2734
|
+
readonly from: string;
|
|
2735
|
+
/**
|
|
2736
|
+
* Envelope To attribute of the email message.
|
|
2737
|
+
*/
|
|
2738
|
+
readonly to: string;
|
|
2739
|
+
/**
|
|
2740
|
+
* A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2741
|
+
*/
|
|
2742
|
+
readonly headers: Headers;
|
|
2743
|
+
/**
|
|
2744
|
+
* Stream of the email message content.
|
|
2745
|
+
*/
|
|
2746
|
+
readonly raw: ReadableStream;
|
|
2747
|
+
/**
|
|
2748
|
+
* Size of the email message content.
|
|
2749
|
+
*/
|
|
2750
|
+
readonly rawSize: number;
|
|
2751
|
+
/**
|
|
2752
|
+
* Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
|
|
2753
|
+
* @param reason The reject reason.
|
|
2754
|
+
* @returns void
|
|
2755
|
+
*/
|
|
2756
|
+
setReject(reason: string): void;
|
|
2757
|
+
/**
|
|
2758
|
+
* Forward this email message to a verified destination address of the account.
|
|
2759
|
+
* @param rcptTo Verified destination address.
|
|
2760
|
+
* @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2761
|
+
* @returns A promise that resolves when the email message is forwarded.
|
|
2762
|
+
*/
|
|
2763
|
+
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2764
|
+
}
|
|
2765
|
+
export declare abstract class EmailEvent extends ExtendableEvent {
|
|
2766
|
+
readonly message: EmailMessage;
|
|
2767
|
+
}
|
|
2768
|
+
export type EmailExportedHandler<Env = unknown> = (
|
|
2769
|
+
message: EmailMessage,
|
|
2770
|
+
env: Env,
|
|
2771
|
+
ctx: ExecutionContext
|
|
2772
|
+
) => void | Promise<void>;
|
|
2706
2773
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2707
2774
|
export type EventContext<Env, P extends string, Data> = {
|
|
2708
2775
|
request: Request;
|
|
@@ -2746,6 +2813,40 @@ export type PagesPluginFunction<
|
|
|
2746
2813
|
> = (
|
|
2747
2814
|
context: EventPluginContext<Env, Params, Data, PluginArgs>
|
|
2748
2815
|
) => Response | Promise<Response>;
|
|
2816
|
+
// https://developers.cloudflare.com/pub-sub/
|
|
2817
|
+
// PubSubMessage represents an incoming PubSub message.
|
|
2818
|
+
// The message includes metadata about the broker, the client, and the payload
|
|
2819
|
+
// itself.
|
|
2820
|
+
export interface PubSubMessage {
|
|
2821
|
+
// Message ID
|
|
2822
|
+
readonly mid: number;
|
|
2823
|
+
// MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
|
|
2824
|
+
readonly broker: string;
|
|
2825
|
+
// The MQTT topic the message was sent on.
|
|
2826
|
+
readonly topic: string;
|
|
2827
|
+
// The client ID of the client that published this message.
|
|
2828
|
+
readonly clientId: string;
|
|
2829
|
+
// The unique identifier (JWT ID) used by the client to authenticate, if token
|
|
2830
|
+
// auth was used.
|
|
2831
|
+
readonly jti?: string;
|
|
2832
|
+
// A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
|
|
2833
|
+
// received the message from the client.
|
|
2834
|
+
readonly receivedAt: number;
|
|
2835
|
+
// An (optional) string with the MIME type of the payload, if set by the
|
|
2836
|
+
// client.
|
|
2837
|
+
readonly contentType: string;
|
|
2838
|
+
// Set to 1 when the payload is a UTF-8 string
|
|
2839
|
+
// https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
|
|
2840
|
+
readonly payloadFormatIndicator: number;
|
|
2841
|
+
// Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
|
|
2842
|
+
// You can use payloadFormatIndicator to inspect this before decoding.
|
|
2843
|
+
payload: string | Uint8Array;
|
|
2844
|
+
}
|
|
2845
|
+
// JsonWebKey extended by kid parameter
|
|
2846
|
+
export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
2847
|
+
// Key Identifier of the JWK
|
|
2848
|
+
readonly kid: string;
|
|
2849
|
+
}
|
|
2749
2850
|
/**
|
|
2750
2851
|
* A message that is sent to a consumer Worker.
|
|
2751
2852
|
*/
|
|
@@ -2762,6 +2863,14 @@ export interface Message<Body = unknown> {
|
|
|
2762
2863
|
* The body of the message.
|
|
2763
2864
|
*/
|
|
2764
2865
|
readonly body: Body;
|
|
2866
|
+
/**
|
|
2867
|
+
* Marks message to be retried.
|
|
2868
|
+
*/
|
|
2869
|
+
retry(): void;
|
|
2870
|
+
/**
|
|
2871
|
+
* Marks message acknowledged.
|
|
2872
|
+
*/
|
|
2873
|
+
ack(): void;
|
|
2765
2874
|
}
|
|
2766
2875
|
/**
|
|
2767
2876
|
* A batch of messages that are sent to a consumer Worker.
|
|
@@ -2779,7 +2888,20 @@ export interface MessageBatch<Body = unknown> {
|
|
|
2779
2888
|
* Marks every message to be retried in the next batch.
|
|
2780
2889
|
*/
|
|
2781
2890
|
retryAll(): void;
|
|
2891
|
+
/**
|
|
2892
|
+
* Marks every message acknowledged in the batch.
|
|
2893
|
+
*/
|
|
2894
|
+
ackAll(): void;
|
|
2782
2895
|
}
|
|
2896
|
+
/**
|
|
2897
|
+
* A wrapper class used to structure message batches.
|
|
2898
|
+
*/
|
|
2899
|
+
export type MessageSendRequest<Body = unknown> = {
|
|
2900
|
+
/**
|
|
2901
|
+
* The body of the message.
|
|
2902
|
+
*/
|
|
2903
|
+
body: Body;
|
|
2904
|
+
};
|
|
2783
2905
|
/**
|
|
2784
2906
|
* A binding that allows a producer to send messages to a Queue.
|
|
2785
2907
|
*/
|
|
@@ -2790,4 +2912,10 @@ export interface Queue<Body = any> {
|
|
|
2790
2912
|
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2791
2913
|
*/
|
|
2792
2914
|
send(message: Body): Promise<void>;
|
|
2915
|
+
/**
|
|
2916
|
+
* Sends a batch of messages to the Queue.
|
|
2917
|
+
* @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.
|
|
2918
|
+
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2919
|
+
*/
|
|
2920
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2793
2921
|
}
|