@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/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/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/oldest/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/oldest/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/package.json
CHANGED