@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/2022-10-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;
|
|
@@ -328,7 +329,7 @@ declare type ExportedHandlerTestHandler<Env = unknown> = (
|
|
|
328
329
|
) => void | Promise<void>;
|
|
329
330
|
declare interface ExportedHandler<
|
|
330
331
|
Env = unknown,
|
|
331
|
-
|
|
332
|
+
QueueHandlerMessage = unknown,
|
|
332
333
|
CfHostMetadata = unknown
|
|
333
334
|
> {
|
|
334
335
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
@@ -336,7 +337,8 @@ declare interface ExportedHandler<
|
|
|
336
337
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
337
338
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
338
339
|
test?: ExportedHandlerTestHandler<Env>;
|
|
339
|
-
|
|
340
|
+
email?: EmailExportedHandler<Env>;
|
|
341
|
+
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
|
|
340
342
|
}
|
|
341
343
|
declare interface StructuredSerializeOptions {
|
|
342
344
|
transfer?: any[];
|
|
@@ -356,6 +358,17 @@ declare interface Performance {
|
|
|
356
358
|
declare interface DurableObject {
|
|
357
359
|
fetch(request: Request): Response | Promise<Response>;
|
|
358
360
|
alarm?(): void | Promise<void>;
|
|
361
|
+
webSocketMessage(
|
|
362
|
+
ws: WebSocket,
|
|
363
|
+
message: string | ArrayBuffer
|
|
364
|
+
): void | Promise<void>;
|
|
365
|
+
webSocketClose(
|
|
366
|
+
ws: WebSocket,
|
|
367
|
+
code: number,
|
|
368
|
+
reason: string,
|
|
369
|
+
wasClean: boolean
|
|
370
|
+
): void | Promise<void>;
|
|
371
|
+
webSocketError(ws: WebSocket, error: unknown): void | Promise<void>;
|
|
359
372
|
}
|
|
360
373
|
declare interface DurableObjectStub extends Fetcher {
|
|
361
374
|
readonly id: DurableObjectId;
|
|
@@ -402,6 +415,9 @@ declare interface DurableObjectState {
|
|
|
402
415
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
403
416
|
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
404
417
|
getWebSockets(tag?: string): WebSocket[];
|
|
418
|
+
setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
|
|
419
|
+
getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
|
|
420
|
+
getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
|
|
405
421
|
}
|
|
406
422
|
declare interface DurableObjectTransaction {
|
|
407
423
|
get<T = unknown>(
|
|
@@ -496,6 +512,11 @@ declare interface DurableObjectSetAlarmOptions {
|
|
|
496
512
|
allowConcurrency?: boolean;
|
|
497
513
|
allowUnconfirmed?: boolean;
|
|
498
514
|
}
|
|
515
|
+
declare class WebSocketRequestResponsePair {
|
|
516
|
+
constructor(request: string, response: string);
|
|
517
|
+
get request(): string;
|
|
518
|
+
get response(): string;
|
|
519
|
+
}
|
|
499
520
|
declare interface AnalyticsEngineDataset {
|
|
500
521
|
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
501
522
|
}
|
|
@@ -1657,6 +1678,7 @@ declare interface TraceItem {
|
|
|
1657
1678
|
readonly eventTimestamp: number | null;
|
|
1658
1679
|
readonly logs: TraceLog[];
|
|
1659
1680
|
readonly exceptions: TraceException[];
|
|
1681
|
+
readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
|
|
1660
1682
|
readonly scriptName: string | null;
|
|
1661
1683
|
readonly dispatchNamespace?: string;
|
|
1662
1684
|
readonly scriptTags?: string[];
|
|
@@ -1703,6 +1725,11 @@ declare interface TraceException {
|
|
|
1703
1725
|
readonly message: string;
|
|
1704
1726
|
readonly name: string;
|
|
1705
1727
|
}
|
|
1728
|
+
declare interface TraceDiagnosticChannelEvent {
|
|
1729
|
+
readonly timestamp: number;
|
|
1730
|
+
readonly channel: string;
|
|
1731
|
+
readonly message: any;
|
|
1732
|
+
}
|
|
1706
1733
|
declare interface TraceMetrics {
|
|
1707
1734
|
readonly cpuTime: number;
|
|
1708
1735
|
readonly wallTime: number;
|
|
@@ -1744,10 +1771,10 @@ declare class URLSearchParams {
|
|
|
1744
1771
|
);
|
|
1745
1772
|
get size(): number;
|
|
1746
1773
|
append(name: string, value: string): void;
|
|
1747
|
-
delete(name: string, value?:
|
|
1774
|
+
delete(name: string, value?: string): void;
|
|
1748
1775
|
get(name: string): string | null;
|
|
1749
1776
|
getAll(name: string): string[];
|
|
1750
|
-
has(name: string, value?:
|
|
1777
|
+
has(name: string, value?: string): boolean;
|
|
1751
1778
|
set(name: string, value: string): void;
|
|
1752
1779
|
sort(): void;
|
|
1753
1780
|
entries(): IterableIterator<[key: string, value: string]>;
|
|
@@ -2853,25 +2880,36 @@ declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
|
2853
2880
|
declare type CfProperties<HostMetadata = unknown> =
|
|
2854
2881
|
| IncomingRequestCfProperties<HostMetadata>
|
|
2855
2882
|
| RequestInitCfProperties;
|
|
2883
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
2884
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2885
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2856
2886
|
declare interface D1Result<T = unknown> {
|
|
2857
|
-
results
|
|
2858
|
-
success:
|
|
2859
|
-
error?: string;
|
|
2887
|
+
results: T[];
|
|
2888
|
+
success: true;
|
|
2860
2889
|
meta: any;
|
|
2890
|
+
error?: never;
|
|
2891
|
+
}
|
|
2892
|
+
declare interface D1ExecResult {
|
|
2893
|
+
count: number;
|
|
2894
|
+
duration: number;
|
|
2861
2895
|
}
|
|
2862
2896
|
declare abstract class D1Database {
|
|
2863
2897
|
prepare(query: string): D1PreparedStatement;
|
|
2864
2898
|
dump(): Promise<ArrayBuffer>;
|
|
2865
2899
|
batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
|
|
2866
|
-
exec<T = unknown>(query: string): Promise<
|
|
2900
|
+
exec<T = unknown>(query: string): Promise<D1ExecResult>;
|
|
2867
2901
|
}
|
|
2868
2902
|
declare abstract class D1PreparedStatement {
|
|
2869
2903
|
bind(...values: any[]): D1PreparedStatement;
|
|
2870
|
-
first<T = unknown>(colName
|
|
2904
|
+
first<T = unknown>(colName: string): Promise<T | null>;
|
|
2905
|
+
first<T = unknown>(): Promise<Record<string, T> | null>;
|
|
2871
2906
|
run<T = unknown>(): Promise<D1Result<T>>;
|
|
2872
|
-
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2907
|
+
all<T = unknown>(): Promise<D1Result<T[]>>;
|
|
2873
2908
|
raw<T = unknown>(): Promise<T[]>;
|
|
2874
2909
|
}
|
|
2910
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
2911
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2912
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2875
2913
|
/**
|
|
2876
2914
|
* An email message that can be sent from a Worker.
|
|
2877
2915
|
*/
|
|
@@ -2936,6 +2974,9 @@ declare module "cloudflare:email" {
|
|
|
2936
2974
|
};
|
|
2937
2975
|
export { _EmailMessage as EmailMessage };
|
|
2938
2976
|
}
|
|
2977
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
2978
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2979
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2939
2980
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2940
2981
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2941
2982
|
request: Request;
|
|
@@ -2982,6 +3023,9 @@ declare type PagesPluginFunction<
|
|
|
2982
3023
|
declare module "assets:*" {
|
|
2983
3024
|
export const onRequest: PagesFunction;
|
|
2984
3025
|
}
|
|
3026
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
3027
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3028
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2985
3029
|
// https://developers.cloudflare.com/pub-sub/
|
|
2986
3030
|
// PubSubMessage represents an incoming PubSub message.
|
|
2987
3031
|
// The message includes metadata about the broker, the client, and the payload
|
|
@@ -3016,6 +3060,9 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
3016
3060
|
// Key Identifier of the JWK
|
|
3017
3061
|
readonly kid: string;
|
|
3018
3062
|
}
|
|
3063
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
3064
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3065
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
3019
3066
|
declare module "cloudflare:sockets" {
|
|
3020
3067
|
function _connect(
|
|
3021
3068
|
address: string | SocketAddress,
|
|
@@ -3023,6 +3070,9 @@ declare module "cloudflare:sockets" {
|
|
|
3023
3070
|
): Socket;
|
|
3024
3071
|
export { _connect as connect };
|
|
3025
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
|
|
3026
3076
|
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3027
3077
|
declare interface DynamicDispatchLimits {
|
|
3028
3078
|
/**
|
package/2022-10-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;
|
|
@@ -330,7 +331,7 @@ export type ExportedHandlerTestHandler<Env = unknown> = (
|
|
|
330
331
|
) => void | Promise<void>;
|
|
331
332
|
export interface ExportedHandler<
|
|
332
333
|
Env = unknown,
|
|
333
|
-
|
|
334
|
+
QueueHandlerMessage = unknown,
|
|
334
335
|
CfHostMetadata = unknown
|
|
335
336
|
> {
|
|
336
337
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
@@ -338,7 +339,8 @@ export interface ExportedHandler<
|
|
|
338
339
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
339
340
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
340
341
|
test?: ExportedHandlerTestHandler<Env>;
|
|
341
|
-
|
|
342
|
+
email?: EmailExportedHandler<Env>;
|
|
343
|
+
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
|
|
342
344
|
}
|
|
343
345
|
export interface StructuredSerializeOptions {
|
|
344
346
|
transfer?: any[];
|
|
@@ -358,6 +360,17 @@ export interface Performance {
|
|
|
358
360
|
export interface DurableObject {
|
|
359
361
|
fetch(request: Request): Response | Promise<Response>;
|
|
360
362
|
alarm?(): void | Promise<void>;
|
|
363
|
+
webSocketMessage(
|
|
364
|
+
ws: WebSocket,
|
|
365
|
+
message: string | ArrayBuffer
|
|
366
|
+
): void | Promise<void>;
|
|
367
|
+
webSocketClose(
|
|
368
|
+
ws: WebSocket,
|
|
369
|
+
code: number,
|
|
370
|
+
reason: string,
|
|
371
|
+
wasClean: boolean
|
|
372
|
+
): void | Promise<void>;
|
|
373
|
+
webSocketError(ws: WebSocket, error: unknown): void | Promise<void>;
|
|
361
374
|
}
|
|
362
375
|
export interface DurableObjectStub extends Fetcher {
|
|
363
376
|
readonly id: DurableObjectId;
|
|
@@ -404,6 +417,9 @@ export interface DurableObjectState {
|
|
|
404
417
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
405
418
|
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
406
419
|
getWebSockets(tag?: string): WebSocket[];
|
|
420
|
+
setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
|
|
421
|
+
getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
|
|
422
|
+
getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
|
|
407
423
|
}
|
|
408
424
|
export interface DurableObjectTransaction {
|
|
409
425
|
get<T = unknown>(
|
|
@@ -498,6 +514,11 @@ export interface DurableObjectSetAlarmOptions {
|
|
|
498
514
|
allowConcurrency?: boolean;
|
|
499
515
|
allowUnconfirmed?: boolean;
|
|
500
516
|
}
|
|
517
|
+
export declare class WebSocketRequestResponsePair {
|
|
518
|
+
constructor(request: string, response: string);
|
|
519
|
+
get request(): string;
|
|
520
|
+
get response(): string;
|
|
521
|
+
}
|
|
501
522
|
export interface AnalyticsEngineDataset {
|
|
502
523
|
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
503
524
|
}
|
|
@@ -1662,6 +1683,7 @@ export interface TraceItem {
|
|
|
1662
1683
|
readonly eventTimestamp: number | null;
|
|
1663
1684
|
readonly logs: TraceLog[];
|
|
1664
1685
|
readonly exceptions: TraceException[];
|
|
1686
|
+
readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
|
|
1665
1687
|
readonly scriptName: string | null;
|
|
1666
1688
|
readonly dispatchNamespace?: string;
|
|
1667
1689
|
readonly scriptTags?: string[];
|
|
@@ -1708,6 +1730,11 @@ export interface TraceException {
|
|
|
1708
1730
|
readonly message: string;
|
|
1709
1731
|
readonly name: string;
|
|
1710
1732
|
}
|
|
1733
|
+
export interface TraceDiagnosticChannelEvent {
|
|
1734
|
+
readonly timestamp: number;
|
|
1735
|
+
readonly channel: string;
|
|
1736
|
+
readonly message: any;
|
|
1737
|
+
}
|
|
1711
1738
|
export interface TraceMetrics {
|
|
1712
1739
|
readonly cpuTime: number;
|
|
1713
1740
|
readonly wallTime: number;
|
|
@@ -1749,10 +1776,10 @@ export declare class URLSearchParams {
|
|
|
1749
1776
|
);
|
|
1750
1777
|
get size(): number;
|
|
1751
1778
|
append(name: string, value: string): void;
|
|
1752
|
-
delete(name: string, value?:
|
|
1779
|
+
delete(name: string, value?: string): void;
|
|
1753
1780
|
get(name: string): string | null;
|
|
1754
1781
|
getAll(name: string): string[];
|
|
1755
|
-
has(name: string, value?:
|
|
1782
|
+
has(name: string, value?: string): boolean;
|
|
1756
1783
|
set(name: string, value: string): void;
|
|
1757
1784
|
sort(): void;
|
|
1758
1785
|
entries(): IterableIterator<[key: string, value: string]>;
|
|
@@ -2858,25 +2885,36 @@ export type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
|
2858
2885
|
export type CfProperties<HostMetadata = unknown> =
|
|
2859
2886
|
| IncomingRequestCfProperties<HostMetadata>
|
|
2860
2887
|
| RequestInitCfProperties;
|
|
2888
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
2889
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2890
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2861
2891
|
export interface D1Result<T = unknown> {
|
|
2862
|
-
results
|
|
2863
|
-
success:
|
|
2864
|
-
error?: string;
|
|
2892
|
+
results: T[];
|
|
2893
|
+
success: true;
|
|
2865
2894
|
meta: any;
|
|
2895
|
+
error?: never;
|
|
2896
|
+
}
|
|
2897
|
+
export interface D1ExecResult {
|
|
2898
|
+
count: number;
|
|
2899
|
+
duration: number;
|
|
2866
2900
|
}
|
|
2867
2901
|
export declare abstract class D1Database {
|
|
2868
2902
|
prepare(query: string): D1PreparedStatement;
|
|
2869
2903
|
dump(): Promise<ArrayBuffer>;
|
|
2870
2904
|
batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
|
|
2871
|
-
exec<T = unknown>(query: string): Promise<
|
|
2905
|
+
exec<T = unknown>(query: string): Promise<D1ExecResult>;
|
|
2872
2906
|
}
|
|
2873
2907
|
export declare abstract class D1PreparedStatement {
|
|
2874
2908
|
bind(...values: any[]): D1PreparedStatement;
|
|
2875
|
-
first<T = unknown>(colName
|
|
2909
|
+
first<T = unknown>(colName: string): Promise<T | null>;
|
|
2910
|
+
first<T = unknown>(): Promise<Record<string, T> | null>;
|
|
2876
2911
|
run<T = unknown>(): Promise<D1Result<T>>;
|
|
2877
|
-
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2912
|
+
all<T = unknown>(): Promise<D1Result<T[]>>;
|
|
2878
2913
|
raw<T = unknown>(): Promise<T[]>;
|
|
2879
2914
|
}
|
|
2915
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
2916
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2917
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2880
2918
|
/**
|
|
2881
2919
|
* An email message that can be sent from a Worker.
|
|
2882
2920
|
*/
|
|
@@ -2934,6 +2972,9 @@ export type EmailExportedHandler<Env = unknown> = (
|
|
|
2934
2972
|
env: Env,
|
|
2935
2973
|
ctx: ExecutionContext
|
|
2936
2974
|
) => void | Promise<void>;
|
|
2975
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
2976
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2977
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2937
2978
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2938
2979
|
export type EventContext<Env, P extends string, Data> = {
|
|
2939
2980
|
request: Request;
|
|
@@ -2977,6 +3018,9 @@ export type PagesPluginFunction<
|
|
|
2977
3018
|
> = (
|
|
2978
3019
|
context: EventPluginContext<Env, Params, Data, PluginArgs>
|
|
2979
3020
|
) => Response | Promise<Response>;
|
|
3021
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
3022
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3023
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2980
3024
|
// https://developers.cloudflare.com/pub-sub/
|
|
2981
3025
|
// PubSubMessage represents an incoming PubSub message.
|
|
2982
3026
|
// The message includes metadata about the broker, the client, and the payload
|
|
@@ -3011,6 +3055,9 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
3011
3055
|
// Key Identifier of the JWK
|
|
3012
3056
|
readonly kid: string;
|
|
3013
3057
|
}
|
|
3058
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
3059
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3060
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
3014
3061
|
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3015
3062
|
export interface DynamicDispatchLimits {
|
|
3016
3063
|
/**
|
package/2022-11-30/index.d.ts
CHANGED
|
@@ -217,6 +217,7 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
217
217
|
Response: typeof Response;
|
|
218
218
|
WebSocket: typeof WebSocket;
|
|
219
219
|
WebSocketPair: typeof WebSocketPair;
|
|
220
|
+
WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;
|
|
220
221
|
AbortController: typeof AbortController;
|
|
221
222
|
AbortSignal: typeof AbortSignal;
|
|
222
223
|
TextDecoder: typeof TextDecoder;
|
|
@@ -332,7 +333,7 @@ declare type ExportedHandlerTestHandler<Env = unknown> = (
|
|
|
332
333
|
) => void | Promise<void>;
|
|
333
334
|
declare interface ExportedHandler<
|
|
334
335
|
Env = unknown,
|
|
335
|
-
|
|
336
|
+
QueueHandlerMessage = unknown,
|
|
336
337
|
CfHostMetadata = unknown
|
|
337
338
|
> {
|
|
338
339
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
@@ -340,7 +341,8 @@ declare interface ExportedHandler<
|
|
|
340
341
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
341
342
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
342
343
|
test?: ExportedHandlerTestHandler<Env>;
|
|
343
|
-
|
|
344
|
+
email?: EmailExportedHandler<Env>;
|
|
345
|
+
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
|
|
344
346
|
}
|
|
345
347
|
declare interface StructuredSerializeOptions {
|
|
346
348
|
transfer?: any[];
|
|
@@ -360,6 +362,17 @@ declare interface Performance {
|
|
|
360
362
|
declare interface DurableObject {
|
|
361
363
|
fetch(request: Request): Response | Promise<Response>;
|
|
362
364
|
alarm?(): void | Promise<void>;
|
|
365
|
+
webSocketMessage(
|
|
366
|
+
ws: WebSocket,
|
|
367
|
+
message: string | ArrayBuffer
|
|
368
|
+
): void | Promise<void>;
|
|
369
|
+
webSocketClose(
|
|
370
|
+
ws: WebSocket,
|
|
371
|
+
code: number,
|
|
372
|
+
reason: string,
|
|
373
|
+
wasClean: boolean
|
|
374
|
+
): void | Promise<void>;
|
|
375
|
+
webSocketError(ws: WebSocket, error: unknown): void | Promise<void>;
|
|
363
376
|
}
|
|
364
377
|
declare interface DurableObjectStub extends Fetcher {
|
|
365
378
|
readonly id: DurableObjectId;
|
|
@@ -406,6 +419,9 @@ declare interface DurableObjectState {
|
|
|
406
419
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
407
420
|
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
408
421
|
getWebSockets(tag?: string): WebSocket[];
|
|
422
|
+
setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
|
|
423
|
+
getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
|
|
424
|
+
getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
|
|
409
425
|
}
|
|
410
426
|
declare interface DurableObjectTransaction {
|
|
411
427
|
get<T = unknown>(
|
|
@@ -500,6 +516,11 @@ declare interface DurableObjectSetAlarmOptions {
|
|
|
500
516
|
allowConcurrency?: boolean;
|
|
501
517
|
allowUnconfirmed?: boolean;
|
|
502
518
|
}
|
|
519
|
+
declare class WebSocketRequestResponsePair {
|
|
520
|
+
constructor(request: string, response: string);
|
|
521
|
+
get request(): string;
|
|
522
|
+
get response(): string;
|
|
523
|
+
}
|
|
503
524
|
declare interface AnalyticsEngineDataset {
|
|
504
525
|
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
505
526
|
}
|
|
@@ -1660,6 +1681,7 @@ declare interface TraceItem {
|
|
|
1660
1681
|
readonly eventTimestamp: number | null;
|
|
1661
1682
|
readonly logs: TraceLog[];
|
|
1662
1683
|
readonly exceptions: TraceException[];
|
|
1684
|
+
readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
|
|
1663
1685
|
readonly scriptName: string | null;
|
|
1664
1686
|
readonly dispatchNamespace?: string;
|
|
1665
1687
|
readonly scriptTags?: string[];
|
|
@@ -1706,6 +1728,11 @@ declare interface TraceException {
|
|
|
1706
1728
|
readonly message: string;
|
|
1707
1729
|
readonly name: string;
|
|
1708
1730
|
}
|
|
1731
|
+
declare interface TraceDiagnosticChannelEvent {
|
|
1732
|
+
readonly timestamp: number;
|
|
1733
|
+
readonly channel: string;
|
|
1734
|
+
readonly message: any;
|
|
1735
|
+
}
|
|
1709
1736
|
declare interface TraceMetrics {
|
|
1710
1737
|
readonly cpuTime: number;
|
|
1711
1738
|
readonly wallTime: number;
|
|
@@ -1747,10 +1774,10 @@ declare class URLSearchParams {
|
|
|
1747
1774
|
);
|
|
1748
1775
|
get size(): number;
|
|
1749
1776
|
append(name: string, value: string): void;
|
|
1750
|
-
delete(name: string, value?:
|
|
1777
|
+
delete(name: string, value?: string): void;
|
|
1751
1778
|
get(name: string): string | null;
|
|
1752
1779
|
getAll(name: string): string[];
|
|
1753
|
-
has(name: string, value?:
|
|
1780
|
+
has(name: string, value?: string): boolean;
|
|
1754
1781
|
set(name: string, value: string): void;
|
|
1755
1782
|
sort(): void;
|
|
1756
1783
|
entries(): IterableIterator<[key: string, value: string]>;
|
|
@@ -2856,25 +2883,36 @@ declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
|
|
|
2856
2883
|
declare type CfProperties<HostMetadata = unknown> =
|
|
2857
2884
|
| IncomingRequestCfProperties<HostMetadata>
|
|
2858
2885
|
| RequestInitCfProperties;
|
|
2886
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
2887
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2888
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2859
2889
|
declare interface D1Result<T = unknown> {
|
|
2860
|
-
results
|
|
2861
|
-
success:
|
|
2862
|
-
error?: string;
|
|
2890
|
+
results: T[];
|
|
2891
|
+
success: true;
|
|
2863
2892
|
meta: any;
|
|
2893
|
+
error?: never;
|
|
2894
|
+
}
|
|
2895
|
+
declare interface D1ExecResult {
|
|
2896
|
+
count: number;
|
|
2897
|
+
duration: number;
|
|
2864
2898
|
}
|
|
2865
2899
|
declare abstract class D1Database {
|
|
2866
2900
|
prepare(query: string): D1PreparedStatement;
|
|
2867
2901
|
dump(): Promise<ArrayBuffer>;
|
|
2868
2902
|
batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
|
|
2869
|
-
exec<T = unknown>(query: string): Promise<
|
|
2903
|
+
exec<T = unknown>(query: string): Promise<D1ExecResult>;
|
|
2870
2904
|
}
|
|
2871
2905
|
declare abstract class D1PreparedStatement {
|
|
2872
2906
|
bind(...values: any[]): D1PreparedStatement;
|
|
2873
|
-
first<T = unknown>(colName
|
|
2907
|
+
first<T = unknown>(colName: string): Promise<T | null>;
|
|
2908
|
+
first<T = unknown>(): Promise<Record<string, T> | null>;
|
|
2874
2909
|
run<T = unknown>(): Promise<D1Result<T>>;
|
|
2875
|
-
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2910
|
+
all<T = unknown>(): Promise<D1Result<T[]>>;
|
|
2876
2911
|
raw<T = unknown>(): Promise<T[]>;
|
|
2877
2912
|
}
|
|
2913
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
2914
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2915
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2878
2916
|
/**
|
|
2879
2917
|
* An email message that can be sent from a Worker.
|
|
2880
2918
|
*/
|
|
@@ -2939,6 +2977,9 @@ declare module "cloudflare:email" {
|
|
|
2939
2977
|
};
|
|
2940
2978
|
export { _EmailMessage as EmailMessage };
|
|
2941
2979
|
}
|
|
2980
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
2981
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
2982
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2942
2983
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2943
2984
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2944
2985
|
request: Request;
|
|
@@ -2985,6 +3026,9 @@ declare type PagesPluginFunction<
|
|
|
2985
3026
|
declare module "assets:*" {
|
|
2986
3027
|
export const onRequest: PagesFunction;
|
|
2987
3028
|
}
|
|
3029
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
3030
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3031
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
2988
3032
|
// https://developers.cloudflare.com/pub-sub/
|
|
2989
3033
|
// PubSubMessage represents an incoming PubSub message.
|
|
2990
3034
|
// The message includes metadata about the broker, the client, and the payload
|
|
@@ -3019,6 +3063,9 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
|
3019
3063
|
// Key Identifier of the JWK
|
|
3020
3064
|
readonly kid: string;
|
|
3021
3065
|
}
|
|
3066
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
3067
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3068
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
3022
3069
|
declare module "cloudflare:sockets" {
|
|
3023
3070
|
function _connect(
|
|
3024
3071
|
address: string | SocketAddress,
|
|
@@ -3026,6 +3073,9 @@ declare module "cloudflare:sockets" {
|
|
|
3026
3073
|
): Socket;
|
|
3027
3074
|
export { _connect as connect };
|
|
3028
3075
|
}
|
|
3076
|
+
// Copyright (c) 2023 Cloudflare, Inc.
|
|
3077
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3078
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
3029
3079
|
// https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
3030
3080
|
declare interface DynamicDispatchLimits {
|
|
3031
3081
|
/**
|