@cloudflare/workers-types 4.20230518.0 → 4.20230710.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 +58 -8
- package/2021-11-03/index.ts +55 -8
- package/2022-01-31/index.d.ts +58 -8
- package/2022-01-31/index.ts +55 -8
- package/2022-03-21/index.d.ts +58 -8
- package/2022-03-21/index.ts +55 -8
- package/2022-08-04/index.d.ts +58 -8
- package/2022-08-04/index.ts +55 -8
- package/2022-10-31/index.d.ts +60 -10
- package/2022-10-31/index.ts +57 -10
- package/2022-11-30/index.d.ts +60 -10
- package/2022-11-30/index.ts +57 -10
- package/experimental/index.d.ts +63 -10
- package/experimental/index.ts +60 -10
- package/index.d.ts +58 -8
- package/index.ts +55 -8
- package/oldest/index.d.ts +58 -8
- package/oldest/index.ts +55 -8
- package/package.json +1 -1
package/2021-11-03/index.d.ts
CHANGED
|
@@ -213,6 +213,7 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
213
213
|
Response: typeof Response;
|
|
214
214
|
WebSocket: typeof WebSocket;
|
|
215
215
|
WebSocketPair: typeof WebSocketPair;
|
|
216
|
+
WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;
|
|
216
217
|
AbortController: typeof AbortController;
|
|
217
218
|
AbortSignal: typeof AbortSignal;
|
|
218
219
|
TextDecoder: typeof TextDecoder;
|
|
@@ -325,7 +326,7 @@ declare type ExportedHandlerTestHandler<Env = unknown> = (
|
|
|
325
326
|
) => void | Promise<void>;
|
|
326
327
|
declare interface ExportedHandler<
|
|
327
328
|
Env = unknown,
|
|
328
|
-
|
|
329
|
+
QueueHandlerMessage = unknown,
|
|
329
330
|
CfHostMetadata = unknown
|
|
330
331
|
> {
|
|
331
332
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
@@ -333,7 +334,8 @@ declare interface ExportedHandler<
|
|
|
333
334
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
334
335
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
335
336
|
test?: ExportedHandlerTestHandler<Env>;
|
|
336
|
-
|
|
337
|
+
email?: EmailExportedHandler<Env>;
|
|
338
|
+
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
|
|
337
339
|
}
|
|
338
340
|
declare interface StructuredSerializeOptions {
|
|
339
341
|
transfer?: any[];
|
|
@@ -350,6 +352,17 @@ declare interface Performance {
|
|
|
350
352
|
declare interface DurableObject {
|
|
351
353
|
fetch(request: Request): Response | Promise<Response>;
|
|
352
354
|
alarm?(): void | Promise<void>;
|
|
355
|
+
webSocketMessage(
|
|
356
|
+
ws: WebSocket,
|
|
357
|
+
message: string | ArrayBuffer
|
|
358
|
+
): void | Promise<void>;
|
|
359
|
+
webSocketClose(
|
|
360
|
+
ws: WebSocket,
|
|
361
|
+
code: number,
|
|
362
|
+
reason: string,
|
|
363
|
+
wasClean: boolean
|
|
364
|
+
): void | Promise<void>;
|
|
365
|
+
webSocketError(ws: WebSocket, error: unknown): void | Promise<void>;
|
|
353
366
|
}
|
|
354
367
|
declare interface DurableObjectStub extends Fetcher {
|
|
355
368
|
readonly id: DurableObjectId;
|
|
@@ -396,6 +409,9 @@ declare interface DurableObjectState {
|
|
|
396
409
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
397
410
|
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
398
411
|
getWebSockets(tag?: string): WebSocket[];
|
|
412
|
+
setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
|
|
413
|
+
getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
|
|
414
|
+
getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
|
|
399
415
|
}
|
|
400
416
|
declare interface DurableObjectTransaction {
|
|
401
417
|
get<T = unknown>(
|
|
@@ -490,6 +506,11 @@ declare interface DurableObjectSetAlarmOptions {
|
|
|
490
506
|
allowConcurrency?: boolean;
|
|
491
507
|
allowUnconfirmed?: boolean;
|
|
492
508
|
}
|
|
509
|
+
declare class WebSocketRequestResponsePair {
|
|
510
|
+
constructor(request: string, response: string);
|
|
511
|
+
get request(): string;
|
|
512
|
+
get response(): string;
|
|
513
|
+
}
|
|
493
514
|
declare interface AnalyticsEngineDataset {
|
|
494
515
|
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
495
516
|
}
|
|
@@ -1670,6 +1691,7 @@ declare interface TraceItem {
|
|
|
1670
1691
|
readonly eventTimestamp: number | null;
|
|
1671
1692
|
readonly logs: TraceLog[];
|
|
1672
1693
|
readonly exceptions: TraceException[];
|
|
1694
|
+
readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
|
|
1673
1695
|
readonly scriptName: string | null;
|
|
1674
1696
|
readonly dispatchNamespace?: string;
|
|
1675
1697
|
readonly scriptTags?: string[];
|
|
@@ -1716,6 +1738,11 @@ declare interface TraceException {
|
|
|
1716
1738
|
readonly message: string;
|
|
1717
1739
|
readonly name: string;
|
|
1718
1740
|
}
|
|
1741
|
+
declare interface TraceDiagnosticChannelEvent {
|
|
1742
|
+
readonly timestamp: number;
|
|
1743
|
+
readonly channel: string;
|
|
1744
|
+
readonly message: any;
|
|
1745
|
+
}
|
|
1719
1746
|
declare interface TraceMetrics {
|
|
1720
1747
|
readonly cpuTime: number;
|
|
1721
1748
|
readonly wallTime: number;
|
|
@@ -2863,25 +2890,36 @@ declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
|
2863
2890
|
declare type CfProperties<HostMetadata = unknown> =
|
|
2864
2891
|
| IncomingRequestCfProperties<HostMetadata>
|
|
2865
2892
|
| RequestInitCfProperties;
|
|
2893
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
2894
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2895
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2866
2896
|
declare interface D1Result<T = unknown> {
|
|
2867
|
-
results
|
|
2868
|
-
success:
|
|
2869
|
-
error?: string;
|
|
2897
|
+
results: T[];
|
|
2898
|
+
success: true;
|
|
2870
2899
|
meta: any;
|
|
2900
|
+
error?: never;
|
|
2901
|
+
}
|
|
2902
|
+
declare interface D1ExecResult {
|
|
2903
|
+
count: number;
|
|
2904
|
+
duration: number;
|
|
2871
2905
|
}
|
|
2872
2906
|
declare abstract class D1Database {
|
|
2873
2907
|
prepare(query: string): D1PreparedStatement;
|
|
2874
2908
|
dump(): Promise<ArrayBuffer>;
|
|
2875
2909
|
batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
|
|
2876
|
-
exec<T = unknown>(query: string): Promise<
|
|
2910
|
+
exec<T = unknown>(query: string): Promise<D1ExecResult>;
|
|
2877
2911
|
}
|
|
2878
2912
|
declare abstract class D1PreparedStatement {
|
|
2879
2913
|
bind(...values: any[]): D1PreparedStatement;
|
|
2880
|
-
first<T = unknown>(colName
|
|
2914
|
+
first<T = unknown>(colName: string): Promise<T | null>;
|
|
2915
|
+
first<T = unknown>(): Promise<Record<string, T> | null>;
|
|
2881
2916
|
run<T = unknown>(): Promise<D1Result<T>>;
|
|
2882
|
-
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2917
|
+
all<T = unknown>(): Promise<D1Result<T[]>>;
|
|
2883
2918
|
raw<T = unknown>(): Promise<T[]>;
|
|
2884
2919
|
}
|
|
2920
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
2921
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2922
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2885
2923
|
/**
|
|
2886
2924
|
* An email message that can be sent from a Worker.
|
|
2887
2925
|
*/
|
|
@@ -2946,6 +2984,9 @@ declare module "cloudflare:email" {
|
|
|
2946
2984
|
};
|
|
2947
2985
|
export { _EmailMessage as EmailMessage };
|
|
2948
2986
|
}
|
|
2987
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
2988
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2989
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2949
2990
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2950
2991
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2951
2992
|
request: Request;
|
|
@@ -2992,6 +3033,9 @@ declare type PagesPluginFunction<
|
|
|
2992
3033
|
declare module "assets:*" {
|
|
2993
3034
|
export const onRequest: PagesFunction;
|
|
2994
3035
|
}
|
|
3036
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
3037
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3038
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2995
3039
|
// https://developers.cloudflare.com/pub-sub/
|
|
2996
3040
|
// PubSubMessage represents an incoming PubSub message.
|
|
2997
3041
|
// The message includes metadata about the broker, the client, and the payload
|
|
@@ -3026,6 +3070,9 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
3026
3070
|
// Key Identifier of the JWK
|
|
3027
3071
|
readonly kid: string;
|
|
3028
3072
|
}
|
|
3073
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
3074
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3075
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
3029
3076
|
declare module "cloudflare:sockets" {
|
|
3030
3077
|
function _connect(
|
|
3031
3078
|
address: string | SocketAddress,
|
|
@@ -3033,6 +3080,9 @@ declare module "cloudflare:sockets" {
|
|
|
3033
3080
|
): Socket;
|
|
3034
3081
|
export { _connect as connect };
|
|
3035
3082
|
}
|
|
3083
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
3084
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3085
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
3036
3086
|
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3037
3087
|
declare interface DynamicDispatchLimits {
|
|
3038
3088
|
/**
|
package/2021-11-03/index.ts
CHANGED
|
@@ -213,6 +213,7 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
213
213
|
Response: typeof Response;
|
|
214
214
|
WebSocket: typeof WebSocket;
|
|
215
215
|
WebSocketPair: typeof WebSocketPair;
|
|
216
|
+
WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;
|
|
216
217
|
AbortController: typeof AbortController;
|
|
217
218
|
AbortSignal: typeof AbortSignal;
|
|
218
219
|
TextDecoder: typeof TextDecoder;
|
|
@@ -327,7 +328,7 @@ export type ExportedHandlerTestHandler<Env = unknown> = (
|
|
|
327
328
|
) => void | Promise<void>;
|
|
328
329
|
export interface ExportedHandler<
|
|
329
330
|
Env = unknown,
|
|
330
|
-
|
|
331
|
+
QueueHandlerMessage = unknown,
|
|
331
332
|
CfHostMetadata = unknown
|
|
332
333
|
> {
|
|
333
334
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
@@ -335,7 +336,8 @@ export interface ExportedHandler<
|
|
|
335
336
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
336
337
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
337
338
|
test?: ExportedHandlerTestHandler<Env>;
|
|
338
|
-
|
|
339
|
+
email?: EmailExportedHandler<Env>;
|
|
340
|
+
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
|
|
339
341
|
}
|
|
340
342
|
export interface StructuredSerializeOptions {
|
|
341
343
|
transfer?: any[];
|
|
@@ -352,6 +354,17 @@ export interface Performance {
|
|
|
352
354
|
export interface DurableObject {
|
|
353
355
|
fetch(request: Request): Response | Promise<Response>;
|
|
354
356
|
alarm?(): void | Promise<void>;
|
|
357
|
+
webSocketMessage(
|
|
358
|
+
ws: WebSocket,
|
|
359
|
+
message: string | ArrayBuffer
|
|
360
|
+
): void | Promise<void>;
|
|
361
|
+
webSocketClose(
|
|
362
|
+
ws: WebSocket,
|
|
363
|
+
code: number,
|
|
364
|
+
reason: string,
|
|
365
|
+
wasClean: boolean
|
|
366
|
+
): void | Promise<void>;
|
|
367
|
+
webSocketError(ws: WebSocket, error: unknown): void | Promise<void>;
|
|
355
368
|
}
|
|
356
369
|
export interface DurableObjectStub extends Fetcher {
|
|
357
370
|
readonly id: DurableObjectId;
|
|
@@ -398,6 +411,9 @@ export interface DurableObjectState {
|
|
|
398
411
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
399
412
|
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
400
413
|
getWebSockets(tag?: string): WebSocket[];
|
|
414
|
+
setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
|
|
415
|
+
getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
|
|
416
|
+
getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
|
|
401
417
|
}
|
|
402
418
|
export interface DurableObjectTransaction {
|
|
403
419
|
get<T = unknown>(
|
|
@@ -492,6 +508,11 @@ export interface DurableObjectSetAlarmOptions {
|
|
|
492
508
|
allowConcurrency?: boolean;
|
|
493
509
|
allowUnconfirmed?: boolean;
|
|
494
510
|
}
|
|
511
|
+
export declare class WebSocketRequestResponsePair {
|
|
512
|
+
constructor(request: string, response: string);
|
|
513
|
+
get request(): string;
|
|
514
|
+
get response(): string;
|
|
515
|
+
}
|
|
495
516
|
export interface AnalyticsEngineDataset {
|
|
496
517
|
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
497
518
|
}
|
|
@@ -1675,6 +1696,7 @@ export interface TraceItem {
|
|
|
1675
1696
|
readonly eventTimestamp: number | null;
|
|
1676
1697
|
readonly logs: TraceLog[];
|
|
1677
1698
|
readonly exceptions: TraceException[];
|
|
1699
|
+
readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
|
|
1678
1700
|
readonly scriptName: string | null;
|
|
1679
1701
|
readonly dispatchNamespace?: string;
|
|
1680
1702
|
readonly scriptTags?: string[];
|
|
@@ -1721,6 +1743,11 @@ export interface TraceException {
|
|
|
1721
1743
|
readonly message: string;
|
|
1722
1744
|
readonly name: string;
|
|
1723
1745
|
}
|
|
1746
|
+
export interface TraceDiagnosticChannelEvent {
|
|
1747
|
+
readonly timestamp: number;
|
|
1748
|
+
readonly channel: string;
|
|
1749
|
+
readonly message: any;
|
|
1750
|
+
}
|
|
1724
1751
|
export interface TraceMetrics {
|
|
1725
1752
|
readonly cpuTime: number;
|
|
1726
1753
|
readonly wallTime: number;
|
|
@@ -2868,25 +2895,36 @@ export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
|
2868
2895
|
export type CfProperties<HostMetadata = unknown> =
|
|
2869
2896
|
| IncomingRequestCfProperties<HostMetadata>
|
|
2870
2897
|
| RequestInitCfProperties;
|
|
2898
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
2899
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2900
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2871
2901
|
export interface D1Result<T = unknown> {
|
|
2872
|
-
results
|
|
2873
|
-
success:
|
|
2874
|
-
error?: string;
|
|
2902
|
+
results: T[];
|
|
2903
|
+
success: true;
|
|
2875
2904
|
meta: any;
|
|
2905
|
+
error?: never;
|
|
2906
|
+
}
|
|
2907
|
+
export interface D1ExecResult {
|
|
2908
|
+
count: number;
|
|
2909
|
+
duration: number;
|
|
2876
2910
|
}
|
|
2877
2911
|
export declare abstract class D1Database {
|
|
2878
2912
|
prepare(query: string): D1PreparedStatement;
|
|
2879
2913
|
dump(): Promise<ArrayBuffer>;
|
|
2880
2914
|
batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
|
|
2881
|
-
exec<T = unknown>(query: string): Promise<
|
|
2915
|
+
exec<T = unknown>(query: string): Promise<D1ExecResult>;
|
|
2882
2916
|
}
|
|
2883
2917
|
export declare abstract class D1PreparedStatement {
|
|
2884
2918
|
bind(...values: any[]): D1PreparedStatement;
|
|
2885
|
-
first<T = unknown>(colName
|
|
2919
|
+
first<T = unknown>(colName: string): Promise<T | null>;
|
|
2920
|
+
first<T = unknown>(): Promise<Record<string, T> | null>;
|
|
2886
2921
|
run<T = unknown>(): Promise<D1Result<T>>;
|
|
2887
|
-
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2922
|
+
all<T = unknown>(): Promise<D1Result<T[]>>;
|
|
2888
2923
|
raw<T = unknown>(): Promise<T[]>;
|
|
2889
2924
|
}
|
|
2925
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
2926
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2927
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2890
2928
|
/**
|
|
2891
2929
|
* An email message that can be sent from a Worker.
|
|
2892
2930
|
*/
|
|
@@ -2944,6 +2982,9 @@ export type EmailExportedHandler<Env = unknown> = (
|
|
|
2944
2982
|
env: Env,
|
|
2945
2983
|
ctx: ExecutionContext
|
|
2946
2984
|
) => void | Promise<void>;
|
|
2985
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
2986
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2987
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2947
2988
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2948
2989
|
export type EventContext<Env, P extends string, Data> = {
|
|
2949
2990
|
request: Request;
|
|
@@ -2987,6 +3028,9 @@ export type PagesPluginFunction<
|
|
|
2987
3028
|
> = (
|
|
2988
3029
|
context: EventPluginContext<Env, Params, Data, PluginArgs>
|
|
2989
3030
|
) => Response | Promise<Response>;
|
|
3031
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
3032
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3033
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2990
3034
|
// https://developers.cloudflare.com/pub-sub/
|
|
2991
3035
|
// PubSubMessage represents an incoming PubSub message.
|
|
2992
3036
|
// The message includes metadata about the broker, the client, and the payload
|
|
@@ -3021,6 +3065,9 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
3021
3065
|
// Key Identifier of the JWK
|
|
3022
3066
|
readonly kid: string;
|
|
3023
3067
|
}
|
|
3068
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
3069
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3070
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
3024
3071
|
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3025
3072
|
export interface DynamicDispatchLimits {
|
|
3026
3073
|
/**
|
package/2022-01-31/index.d.ts
CHANGED
|
@@ -213,6 +213,7 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
213
213
|
Response: typeof Response;
|
|
214
214
|
WebSocket: typeof WebSocket;
|
|
215
215
|
WebSocketPair: typeof WebSocketPair;
|
|
216
|
+
WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;
|
|
216
217
|
AbortController: typeof AbortController;
|
|
217
218
|
AbortSignal: typeof AbortSignal;
|
|
218
219
|
TextDecoder: typeof TextDecoder;
|
|
@@ -325,7 +326,7 @@ declare type ExportedHandlerTestHandler<Env = unknown> = (
|
|
|
325
326
|
) => void | Promise<void>;
|
|
326
327
|
declare interface ExportedHandler<
|
|
327
328
|
Env = unknown,
|
|
328
|
-
|
|
329
|
+
QueueHandlerMessage = unknown,
|
|
329
330
|
CfHostMetadata = unknown
|
|
330
331
|
> {
|
|
331
332
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
@@ -333,7 +334,8 @@ declare interface ExportedHandler<
|
|
|
333
334
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
334
335
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
335
336
|
test?: ExportedHandlerTestHandler<Env>;
|
|
336
|
-
|
|
337
|
+
email?: EmailExportedHandler<Env>;
|
|
338
|
+
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
|
|
337
339
|
}
|
|
338
340
|
declare interface StructuredSerializeOptions {
|
|
339
341
|
transfer?: any[];
|
|
@@ -350,6 +352,17 @@ declare interface Performance {
|
|
|
350
352
|
declare interface DurableObject {
|
|
351
353
|
fetch(request: Request): Response | Promise<Response>;
|
|
352
354
|
alarm?(): void | Promise<void>;
|
|
355
|
+
webSocketMessage(
|
|
356
|
+
ws: WebSocket,
|
|
357
|
+
message: string | ArrayBuffer
|
|
358
|
+
): void | Promise<void>;
|
|
359
|
+
webSocketClose(
|
|
360
|
+
ws: WebSocket,
|
|
361
|
+
code: number,
|
|
362
|
+
reason: string,
|
|
363
|
+
wasClean: boolean
|
|
364
|
+
): void | Promise<void>;
|
|
365
|
+
webSocketError(ws: WebSocket, error: unknown): void | Promise<void>;
|
|
353
366
|
}
|
|
354
367
|
declare interface DurableObjectStub extends Fetcher {
|
|
355
368
|
readonly id: DurableObjectId;
|
|
@@ -396,6 +409,9 @@ declare interface DurableObjectState {
|
|
|
396
409
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
397
410
|
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
398
411
|
getWebSockets(tag?: string): WebSocket[];
|
|
412
|
+
setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
|
|
413
|
+
getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
|
|
414
|
+
getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
|
|
399
415
|
}
|
|
400
416
|
declare interface DurableObjectTransaction {
|
|
401
417
|
get<T = unknown>(
|
|
@@ -490,6 +506,11 @@ declare interface DurableObjectSetAlarmOptions {
|
|
|
490
506
|
allowConcurrency?: boolean;
|
|
491
507
|
allowUnconfirmed?: boolean;
|
|
492
508
|
}
|
|
509
|
+
declare class WebSocketRequestResponsePair {
|
|
510
|
+
constructor(request: string, response: string);
|
|
511
|
+
get request(): string;
|
|
512
|
+
get response(): string;
|
|
513
|
+
}
|
|
493
514
|
declare interface AnalyticsEngineDataset {
|
|
494
515
|
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
495
516
|
}
|
|
@@ -1650,6 +1671,7 @@ declare interface TraceItem {
|
|
|
1650
1671
|
readonly eventTimestamp: number | null;
|
|
1651
1672
|
readonly logs: TraceLog[];
|
|
1652
1673
|
readonly exceptions: TraceException[];
|
|
1674
|
+
readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
|
|
1653
1675
|
readonly scriptName: string | null;
|
|
1654
1676
|
readonly dispatchNamespace?: string;
|
|
1655
1677
|
readonly scriptTags?: string[];
|
|
@@ -1696,6 +1718,11 @@ declare interface TraceException {
|
|
|
1696
1718
|
readonly message: string;
|
|
1697
1719
|
readonly name: string;
|
|
1698
1720
|
}
|
|
1721
|
+
declare interface TraceDiagnosticChannelEvent {
|
|
1722
|
+
readonly timestamp: number;
|
|
1723
|
+
readonly channel: string;
|
|
1724
|
+
readonly message: any;
|
|
1725
|
+
}
|
|
1699
1726
|
declare interface TraceMetrics {
|
|
1700
1727
|
readonly cpuTime: number;
|
|
1701
1728
|
readonly wallTime: number;
|
|
@@ -2849,25 +2876,36 @@ declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
|
2849
2876
|
declare type CfProperties<HostMetadata = unknown> =
|
|
2850
2877
|
| IncomingRequestCfProperties<HostMetadata>
|
|
2851
2878
|
| RequestInitCfProperties;
|
|
2879
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
2880
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2881
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2852
2882
|
declare interface D1Result<T = unknown> {
|
|
2853
|
-
results
|
|
2854
|
-
success:
|
|
2855
|
-
error?: string;
|
|
2883
|
+
results: T[];
|
|
2884
|
+
success: true;
|
|
2856
2885
|
meta: any;
|
|
2886
|
+
error?: never;
|
|
2887
|
+
}
|
|
2888
|
+
declare interface D1ExecResult {
|
|
2889
|
+
count: number;
|
|
2890
|
+
duration: number;
|
|
2857
2891
|
}
|
|
2858
2892
|
declare abstract class D1Database {
|
|
2859
2893
|
prepare(query: string): D1PreparedStatement;
|
|
2860
2894
|
dump(): Promise<ArrayBuffer>;
|
|
2861
2895
|
batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
|
|
2862
|
-
exec<T = unknown>(query: string): Promise<
|
|
2896
|
+
exec<T = unknown>(query: string): Promise<D1ExecResult>;
|
|
2863
2897
|
}
|
|
2864
2898
|
declare abstract class D1PreparedStatement {
|
|
2865
2899
|
bind(...values: any[]): D1PreparedStatement;
|
|
2866
|
-
first<T = unknown>(colName
|
|
2900
|
+
first<T = unknown>(colName: string): Promise<T | null>;
|
|
2901
|
+
first<T = unknown>(): Promise<Record<string, T> | null>;
|
|
2867
2902
|
run<T = unknown>(): Promise<D1Result<T>>;
|
|
2868
|
-
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2903
|
+
all<T = unknown>(): Promise<D1Result<T[]>>;
|
|
2869
2904
|
raw<T = unknown>(): Promise<T[]>;
|
|
2870
2905
|
}
|
|
2906
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
2907
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2908
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2871
2909
|
/**
|
|
2872
2910
|
* An email message that can be sent from a Worker.
|
|
2873
2911
|
*/
|
|
@@ -2932,6 +2970,9 @@ declare module "cloudflare:email" {
|
|
|
2932
2970
|
};
|
|
2933
2971
|
export { _EmailMessage as EmailMessage };
|
|
2934
2972
|
}
|
|
2973
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
2974
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2975
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2935
2976
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2936
2977
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2937
2978
|
request: Request;
|
|
@@ -2978,6 +3019,9 @@ declare type PagesPluginFunction<
|
|
|
2978
3019
|
declare module "assets:*" {
|
|
2979
3020
|
export const onRequest: PagesFunction;
|
|
2980
3021
|
}
|
|
3022
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
3023
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3024
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2981
3025
|
// https://developers.cloudflare.com/pub-sub/
|
|
2982
3026
|
// PubSubMessage represents an incoming PubSub message.
|
|
2983
3027
|
// The message includes metadata about the broker, the client, and the payload
|
|
@@ -3012,6 +3056,9 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
3012
3056
|
// Key Identifier of the JWK
|
|
3013
3057
|
readonly kid: string;
|
|
3014
3058
|
}
|
|
3059
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
3060
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3061
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
3015
3062
|
declare module "cloudflare:sockets" {
|
|
3016
3063
|
function _connect(
|
|
3017
3064
|
address: string | SocketAddress,
|
|
@@ -3019,6 +3066,9 @@ declare module "cloudflare:sockets" {
|
|
|
3019
3066
|
): Socket;
|
|
3020
3067
|
export { _connect as connect };
|
|
3021
3068
|
}
|
|
3069
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
3070
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3071
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
3022
3072
|
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3023
3073
|
declare interface DynamicDispatchLimits {
|
|
3024
3074
|
/**
|
package/2022-01-31/index.ts
CHANGED
|
@@ -213,6 +213,7 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
213
213
|
Response: typeof Response;
|
|
214
214
|
WebSocket: typeof WebSocket;
|
|
215
215
|
WebSocketPair: typeof WebSocketPair;
|
|
216
|
+
WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;
|
|
216
217
|
AbortController: typeof AbortController;
|
|
217
218
|
AbortSignal: typeof AbortSignal;
|
|
218
219
|
TextDecoder: typeof TextDecoder;
|
|
@@ -327,7 +328,7 @@ export type ExportedHandlerTestHandler<Env = unknown> = (
|
|
|
327
328
|
) => void | Promise<void>;
|
|
328
329
|
export interface ExportedHandler<
|
|
329
330
|
Env = unknown,
|
|
330
|
-
|
|
331
|
+
QueueHandlerMessage = unknown,
|
|
331
332
|
CfHostMetadata = unknown
|
|
332
333
|
> {
|
|
333
334
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
@@ -335,7 +336,8 @@ export interface ExportedHandler<
|
|
|
335
336
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
336
337
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
337
338
|
test?: ExportedHandlerTestHandler<Env>;
|
|
338
|
-
|
|
339
|
+
email?: EmailExportedHandler<Env>;
|
|
340
|
+
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
|
|
339
341
|
}
|
|
340
342
|
export interface StructuredSerializeOptions {
|
|
341
343
|
transfer?: any[];
|
|
@@ -352,6 +354,17 @@ export interface Performance {
|
|
|
352
354
|
export interface DurableObject {
|
|
353
355
|
fetch(request: Request): Response | Promise<Response>;
|
|
354
356
|
alarm?(): void | Promise<void>;
|
|
357
|
+
webSocketMessage(
|
|
358
|
+
ws: WebSocket,
|
|
359
|
+
message: string | ArrayBuffer
|
|
360
|
+
): void | Promise<void>;
|
|
361
|
+
webSocketClose(
|
|
362
|
+
ws: WebSocket,
|
|
363
|
+
code: number,
|
|
364
|
+
reason: string,
|
|
365
|
+
wasClean: boolean
|
|
366
|
+
): void | Promise<void>;
|
|
367
|
+
webSocketError(ws: WebSocket, error: unknown): void | Promise<void>;
|
|
355
368
|
}
|
|
356
369
|
export interface DurableObjectStub extends Fetcher {
|
|
357
370
|
readonly id: DurableObjectId;
|
|
@@ -398,6 +411,9 @@ export interface DurableObjectState {
|
|
|
398
411
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
399
412
|
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
400
413
|
getWebSockets(tag?: string): WebSocket[];
|
|
414
|
+
setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
|
|
415
|
+
getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
|
|
416
|
+
getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
|
|
401
417
|
}
|
|
402
418
|
export interface DurableObjectTransaction {
|
|
403
419
|
get<T = unknown>(
|
|
@@ -492,6 +508,11 @@ export interface DurableObjectSetAlarmOptions {
|
|
|
492
508
|
allowConcurrency?: boolean;
|
|
493
509
|
allowUnconfirmed?: boolean;
|
|
494
510
|
}
|
|
511
|
+
export declare class WebSocketRequestResponsePair {
|
|
512
|
+
constructor(request: string, response: string);
|
|
513
|
+
get request(): string;
|
|
514
|
+
get response(): string;
|
|
515
|
+
}
|
|
495
516
|
export interface AnalyticsEngineDataset {
|
|
496
517
|
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
497
518
|
}
|
|
@@ -1655,6 +1676,7 @@ export interface TraceItem {
|
|
|
1655
1676
|
readonly eventTimestamp: number | null;
|
|
1656
1677
|
readonly logs: TraceLog[];
|
|
1657
1678
|
readonly exceptions: TraceException[];
|
|
1679
|
+
readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
|
|
1658
1680
|
readonly scriptName: string | null;
|
|
1659
1681
|
readonly dispatchNamespace?: string;
|
|
1660
1682
|
readonly scriptTags?: string[];
|
|
@@ -1701,6 +1723,11 @@ export interface TraceException {
|
|
|
1701
1723
|
readonly message: string;
|
|
1702
1724
|
readonly name: string;
|
|
1703
1725
|
}
|
|
1726
|
+
export interface TraceDiagnosticChannelEvent {
|
|
1727
|
+
readonly timestamp: number;
|
|
1728
|
+
readonly channel: string;
|
|
1729
|
+
readonly message: any;
|
|
1730
|
+
}
|
|
1704
1731
|
export interface TraceMetrics {
|
|
1705
1732
|
readonly cpuTime: number;
|
|
1706
1733
|
readonly wallTime: number;
|
|
@@ -2854,25 +2881,36 @@ export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
|
2854
2881
|
export type CfProperties<HostMetadata = unknown> =
|
|
2855
2882
|
| IncomingRequestCfProperties<HostMetadata>
|
|
2856
2883
|
| RequestInitCfProperties;
|
|
2884
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
2885
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2886
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2857
2887
|
export interface D1Result<T = unknown> {
|
|
2858
|
-
results
|
|
2859
|
-
success:
|
|
2860
|
-
error?: string;
|
|
2888
|
+
results: T[];
|
|
2889
|
+
success: true;
|
|
2861
2890
|
meta: any;
|
|
2891
|
+
error?: never;
|
|
2892
|
+
}
|
|
2893
|
+
export interface D1ExecResult {
|
|
2894
|
+
count: number;
|
|
2895
|
+
duration: number;
|
|
2862
2896
|
}
|
|
2863
2897
|
export declare abstract class D1Database {
|
|
2864
2898
|
prepare(query: string): D1PreparedStatement;
|
|
2865
2899
|
dump(): Promise<ArrayBuffer>;
|
|
2866
2900
|
batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
|
|
2867
|
-
exec<T = unknown>(query: string): Promise<
|
|
2901
|
+
exec<T = unknown>(query: string): Promise<D1ExecResult>;
|
|
2868
2902
|
}
|
|
2869
2903
|
export declare abstract class D1PreparedStatement {
|
|
2870
2904
|
bind(...values: any[]): D1PreparedStatement;
|
|
2871
|
-
first<T = unknown>(colName
|
|
2905
|
+
first<T = unknown>(colName: string): Promise<T | null>;
|
|
2906
|
+
first<T = unknown>(): Promise<Record<string, T> | null>;
|
|
2872
2907
|
run<T = unknown>(): Promise<D1Result<T>>;
|
|
2873
|
-
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2908
|
+
all<T = unknown>(): Promise<D1Result<T[]>>;
|
|
2874
2909
|
raw<T = unknown>(): Promise<T[]>;
|
|
2875
2910
|
}
|
|
2911
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
2912
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2913
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2876
2914
|
/**
|
|
2877
2915
|
* An email message that can be sent from a Worker.
|
|
2878
2916
|
*/
|
|
@@ -2930,6 +2968,9 @@ export type EmailExportedHandler<Env = unknown> = (
|
|
|
2930
2968
|
env: Env,
|
|
2931
2969
|
ctx: ExecutionContext
|
|
2932
2970
|
) => void | Promise<void>;
|
|
2971
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
2972
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2973
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2933
2974
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2934
2975
|
export type EventContext<Env, P extends string, Data> = {
|
|
2935
2976
|
request: Request;
|
|
@@ -2973,6 +3014,9 @@ export type PagesPluginFunction<
|
|
|
2973
3014
|
> = (
|
|
2974
3015
|
context: EventPluginContext<Env, Params, Data, PluginArgs>
|
|
2975
3016
|
) => Response | Promise<Response>;
|
|
3017
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
3018
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3019
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2976
3020
|
// https://developers.cloudflare.com/pub-sub/
|
|
2977
3021
|
// PubSubMessage represents an incoming PubSub message.
|
|
2978
3022
|
// The message includes metadata about the broker, the client, and the payload
|
|
@@ -3007,6 +3051,9 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
3007
3051
|
// Key Identifier of the JWK
|
|
3008
3052
|
readonly kid: string;
|
|
3009
3053
|
}
|
|
3054
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
3055
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3056
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
3010
3057
|
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3011
3058
|
export interface DynamicDispatchLimits {
|
|
3012
3059
|
/**
|