@cloudflare/workers-types 4.20230518.0 → 4.20230628.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 +29 -8
- package/2021-11-03/index.ts +29 -8
- package/2022-01-31/index.d.ts +29 -8
- package/2022-01-31/index.ts +29 -8
- package/2022-03-21/index.d.ts +29 -8
- package/2022-03-21/index.ts +29 -8
- package/2022-08-04/index.d.ts +29 -8
- package/2022-08-04/index.ts +29 -8
- package/2022-10-31/index.d.ts +31 -10
- package/2022-10-31/index.ts +31 -10
- package/2022-11-30/index.d.ts +31 -10
- package/2022-11-30/index.ts +31 -10
- package/experimental/index.d.ts +34 -10
- package/experimental/index.ts +34 -10
- package/index.d.ts +29 -8
- package/index.ts +29 -8
- package/oldest/index.d.ts +29 -8
- package/oldest/index.ts +29 -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[];
|
|
@@ -396,6 +398,9 @@ declare interface DurableObjectState {
|
|
|
396
398
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
397
399
|
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
398
400
|
getWebSockets(tag?: string): WebSocket[];
|
|
401
|
+
setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
|
|
402
|
+
getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
|
|
403
|
+
getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
|
|
399
404
|
}
|
|
400
405
|
declare interface DurableObjectTransaction {
|
|
401
406
|
get<T = unknown>(
|
|
@@ -490,6 +495,11 @@ declare interface DurableObjectSetAlarmOptions {
|
|
|
490
495
|
allowConcurrency?: boolean;
|
|
491
496
|
allowUnconfirmed?: boolean;
|
|
492
497
|
}
|
|
498
|
+
declare class WebSocketRequestResponsePair {
|
|
499
|
+
constructor(request: string, response: string);
|
|
500
|
+
get request(): string;
|
|
501
|
+
get response(): string;
|
|
502
|
+
}
|
|
493
503
|
declare interface AnalyticsEngineDataset {
|
|
494
504
|
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
495
505
|
}
|
|
@@ -1670,6 +1680,7 @@ declare interface TraceItem {
|
|
|
1670
1680
|
readonly eventTimestamp: number | null;
|
|
1671
1681
|
readonly logs: TraceLog[];
|
|
1672
1682
|
readonly exceptions: TraceException[];
|
|
1683
|
+
readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
|
|
1673
1684
|
readonly scriptName: string | null;
|
|
1674
1685
|
readonly dispatchNamespace?: string;
|
|
1675
1686
|
readonly scriptTags?: string[];
|
|
@@ -1716,6 +1727,11 @@ declare interface TraceException {
|
|
|
1716
1727
|
readonly message: string;
|
|
1717
1728
|
readonly name: string;
|
|
1718
1729
|
}
|
|
1730
|
+
declare interface TraceDiagnosticChannelEvent {
|
|
1731
|
+
readonly timestamp: number;
|
|
1732
|
+
readonly channel: string;
|
|
1733
|
+
readonly message: any;
|
|
1734
|
+
}
|
|
1719
1735
|
declare interface TraceMetrics {
|
|
1720
1736
|
readonly cpuTime: number;
|
|
1721
1737
|
readonly wallTime: number;
|
|
@@ -2864,22 +2880,27 @@ declare type CfProperties<HostMetadata = unknown> =
|
|
|
2864
2880
|
| IncomingRequestCfProperties<HostMetadata>
|
|
2865
2881
|
| RequestInitCfProperties;
|
|
2866
2882
|
declare interface D1Result<T = unknown> {
|
|
2867
|
-
results
|
|
2868
|
-
success:
|
|
2869
|
-
error?: string;
|
|
2883
|
+
results: T[];
|
|
2884
|
+
success: true;
|
|
2870
2885
|
meta: any;
|
|
2886
|
+
error?: never;
|
|
2887
|
+
}
|
|
2888
|
+
declare interface D1ExecResult {
|
|
2889
|
+
count: number;
|
|
2890
|
+
duration: number;
|
|
2871
2891
|
}
|
|
2872
2892
|
declare abstract class D1Database {
|
|
2873
2893
|
prepare(query: string): D1PreparedStatement;
|
|
2874
2894
|
dump(): Promise<ArrayBuffer>;
|
|
2875
2895
|
batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
|
|
2876
|
-
exec<T = unknown>(query: string): Promise<
|
|
2896
|
+
exec<T = unknown>(query: string): Promise<D1ExecResult>;
|
|
2877
2897
|
}
|
|
2878
2898
|
declare abstract class D1PreparedStatement {
|
|
2879
2899
|
bind(...values: any[]): D1PreparedStatement;
|
|
2880
|
-
first<T = unknown>(colName
|
|
2900
|
+
first<T = unknown>(colName: string): Promise<T | null>;
|
|
2901
|
+
first<T = unknown>(): Promise<Record<string, T> | null>;
|
|
2881
2902
|
run<T = unknown>(): Promise<D1Result<T>>;
|
|
2882
|
-
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2903
|
+
all<T = unknown>(): Promise<D1Result<T[]>>;
|
|
2883
2904
|
raw<T = unknown>(): Promise<T[]>;
|
|
2884
2905
|
}
|
|
2885
2906
|
/**
|
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[];
|
|
@@ -398,6 +400,9 @@ export interface DurableObjectState {
|
|
|
398
400
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
399
401
|
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
400
402
|
getWebSockets(tag?: string): WebSocket[];
|
|
403
|
+
setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
|
|
404
|
+
getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
|
|
405
|
+
getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
|
|
401
406
|
}
|
|
402
407
|
export interface DurableObjectTransaction {
|
|
403
408
|
get<T = unknown>(
|
|
@@ -492,6 +497,11 @@ export interface DurableObjectSetAlarmOptions {
|
|
|
492
497
|
allowConcurrency?: boolean;
|
|
493
498
|
allowUnconfirmed?: boolean;
|
|
494
499
|
}
|
|
500
|
+
export declare class WebSocketRequestResponsePair {
|
|
501
|
+
constructor(request: string, response: string);
|
|
502
|
+
get request(): string;
|
|
503
|
+
get response(): string;
|
|
504
|
+
}
|
|
495
505
|
export interface AnalyticsEngineDataset {
|
|
496
506
|
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
497
507
|
}
|
|
@@ -1675,6 +1685,7 @@ export interface TraceItem {
|
|
|
1675
1685
|
readonly eventTimestamp: number | null;
|
|
1676
1686
|
readonly logs: TraceLog[];
|
|
1677
1687
|
readonly exceptions: TraceException[];
|
|
1688
|
+
readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
|
|
1678
1689
|
readonly scriptName: string | null;
|
|
1679
1690
|
readonly dispatchNamespace?: string;
|
|
1680
1691
|
readonly scriptTags?: string[];
|
|
@@ -1721,6 +1732,11 @@ export interface TraceException {
|
|
|
1721
1732
|
readonly message: string;
|
|
1722
1733
|
readonly name: string;
|
|
1723
1734
|
}
|
|
1735
|
+
export interface TraceDiagnosticChannelEvent {
|
|
1736
|
+
readonly timestamp: number;
|
|
1737
|
+
readonly channel: string;
|
|
1738
|
+
readonly message: any;
|
|
1739
|
+
}
|
|
1724
1740
|
export interface TraceMetrics {
|
|
1725
1741
|
readonly cpuTime: number;
|
|
1726
1742
|
readonly wallTime: number;
|
|
@@ -2869,22 +2885,27 @@ export type CfProperties<HostMetadata = unknown> =
|
|
|
2869
2885
|
| IncomingRequestCfProperties<HostMetadata>
|
|
2870
2886
|
| RequestInitCfProperties;
|
|
2871
2887
|
export interface D1Result<T = unknown> {
|
|
2872
|
-
results
|
|
2873
|
-
success:
|
|
2874
|
-
error?: string;
|
|
2888
|
+
results: T[];
|
|
2889
|
+
success: true;
|
|
2875
2890
|
meta: any;
|
|
2891
|
+
error?: never;
|
|
2892
|
+
}
|
|
2893
|
+
export interface D1ExecResult {
|
|
2894
|
+
count: number;
|
|
2895
|
+
duration: number;
|
|
2876
2896
|
}
|
|
2877
2897
|
export declare abstract class D1Database {
|
|
2878
2898
|
prepare(query: string): D1PreparedStatement;
|
|
2879
2899
|
dump(): Promise<ArrayBuffer>;
|
|
2880
2900
|
batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
|
|
2881
|
-
exec<T = unknown>(query: string): Promise<
|
|
2901
|
+
exec<T = unknown>(query: string): Promise<D1ExecResult>;
|
|
2882
2902
|
}
|
|
2883
2903
|
export declare abstract class D1PreparedStatement {
|
|
2884
2904
|
bind(...values: any[]): D1PreparedStatement;
|
|
2885
|
-
first<T = unknown>(colName
|
|
2905
|
+
first<T = unknown>(colName: string): Promise<T | null>;
|
|
2906
|
+
first<T = unknown>(): Promise<Record<string, T> | null>;
|
|
2886
2907
|
run<T = unknown>(): Promise<D1Result<T>>;
|
|
2887
|
-
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2908
|
+
all<T = unknown>(): Promise<D1Result<T[]>>;
|
|
2888
2909
|
raw<T = unknown>(): Promise<T[]>;
|
|
2889
2910
|
}
|
|
2890
2911
|
/**
|
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[];
|
|
@@ -396,6 +398,9 @@ declare interface DurableObjectState {
|
|
|
396
398
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
397
399
|
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
398
400
|
getWebSockets(tag?: string): WebSocket[];
|
|
401
|
+
setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
|
|
402
|
+
getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
|
|
403
|
+
getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
|
|
399
404
|
}
|
|
400
405
|
declare interface DurableObjectTransaction {
|
|
401
406
|
get<T = unknown>(
|
|
@@ -490,6 +495,11 @@ declare interface DurableObjectSetAlarmOptions {
|
|
|
490
495
|
allowConcurrency?: boolean;
|
|
491
496
|
allowUnconfirmed?: boolean;
|
|
492
497
|
}
|
|
498
|
+
declare class WebSocketRequestResponsePair {
|
|
499
|
+
constructor(request: string, response: string);
|
|
500
|
+
get request(): string;
|
|
501
|
+
get response(): string;
|
|
502
|
+
}
|
|
493
503
|
declare interface AnalyticsEngineDataset {
|
|
494
504
|
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
495
505
|
}
|
|
@@ -1650,6 +1660,7 @@ declare interface TraceItem {
|
|
|
1650
1660
|
readonly eventTimestamp: number | null;
|
|
1651
1661
|
readonly logs: TraceLog[];
|
|
1652
1662
|
readonly exceptions: TraceException[];
|
|
1663
|
+
readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
|
|
1653
1664
|
readonly scriptName: string | null;
|
|
1654
1665
|
readonly dispatchNamespace?: string;
|
|
1655
1666
|
readonly scriptTags?: string[];
|
|
@@ -1696,6 +1707,11 @@ declare interface TraceException {
|
|
|
1696
1707
|
readonly message: string;
|
|
1697
1708
|
readonly name: string;
|
|
1698
1709
|
}
|
|
1710
|
+
declare interface TraceDiagnosticChannelEvent {
|
|
1711
|
+
readonly timestamp: number;
|
|
1712
|
+
readonly channel: string;
|
|
1713
|
+
readonly message: any;
|
|
1714
|
+
}
|
|
1699
1715
|
declare interface TraceMetrics {
|
|
1700
1716
|
readonly cpuTime: number;
|
|
1701
1717
|
readonly wallTime: number;
|
|
@@ -2850,22 +2866,27 @@ declare type CfProperties<HostMetadata = unknown> =
|
|
|
2850
2866
|
| IncomingRequestCfProperties<HostMetadata>
|
|
2851
2867
|
| RequestInitCfProperties;
|
|
2852
2868
|
declare interface D1Result<T = unknown> {
|
|
2853
|
-
results
|
|
2854
|
-
success:
|
|
2855
|
-
error?: string;
|
|
2869
|
+
results: T[];
|
|
2870
|
+
success: true;
|
|
2856
2871
|
meta: any;
|
|
2872
|
+
error?: never;
|
|
2873
|
+
}
|
|
2874
|
+
declare interface D1ExecResult {
|
|
2875
|
+
count: number;
|
|
2876
|
+
duration: number;
|
|
2857
2877
|
}
|
|
2858
2878
|
declare abstract class D1Database {
|
|
2859
2879
|
prepare(query: string): D1PreparedStatement;
|
|
2860
2880
|
dump(): Promise<ArrayBuffer>;
|
|
2861
2881
|
batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
|
|
2862
|
-
exec<T = unknown>(query: string): Promise<
|
|
2882
|
+
exec<T = unknown>(query: string): Promise<D1ExecResult>;
|
|
2863
2883
|
}
|
|
2864
2884
|
declare abstract class D1PreparedStatement {
|
|
2865
2885
|
bind(...values: any[]): D1PreparedStatement;
|
|
2866
|
-
first<T = unknown>(colName
|
|
2886
|
+
first<T = unknown>(colName: string): Promise<T | null>;
|
|
2887
|
+
first<T = unknown>(): Promise<Record<string, T> | null>;
|
|
2867
2888
|
run<T = unknown>(): Promise<D1Result<T>>;
|
|
2868
|
-
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2889
|
+
all<T = unknown>(): Promise<D1Result<T[]>>;
|
|
2869
2890
|
raw<T = unknown>(): Promise<T[]>;
|
|
2870
2891
|
}
|
|
2871
2892
|
/**
|
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[];
|
|
@@ -398,6 +400,9 @@ export interface DurableObjectState {
|
|
|
398
400
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
399
401
|
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
400
402
|
getWebSockets(tag?: string): WebSocket[];
|
|
403
|
+
setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
|
|
404
|
+
getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
|
|
405
|
+
getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
|
|
401
406
|
}
|
|
402
407
|
export interface DurableObjectTransaction {
|
|
403
408
|
get<T = unknown>(
|
|
@@ -492,6 +497,11 @@ export interface DurableObjectSetAlarmOptions {
|
|
|
492
497
|
allowConcurrency?: boolean;
|
|
493
498
|
allowUnconfirmed?: boolean;
|
|
494
499
|
}
|
|
500
|
+
export declare class WebSocketRequestResponsePair {
|
|
501
|
+
constructor(request: string, response: string);
|
|
502
|
+
get request(): string;
|
|
503
|
+
get response(): string;
|
|
504
|
+
}
|
|
495
505
|
export interface AnalyticsEngineDataset {
|
|
496
506
|
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
497
507
|
}
|
|
@@ -1655,6 +1665,7 @@ export interface TraceItem {
|
|
|
1655
1665
|
readonly eventTimestamp: number | null;
|
|
1656
1666
|
readonly logs: TraceLog[];
|
|
1657
1667
|
readonly exceptions: TraceException[];
|
|
1668
|
+
readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
|
|
1658
1669
|
readonly scriptName: string | null;
|
|
1659
1670
|
readonly dispatchNamespace?: string;
|
|
1660
1671
|
readonly scriptTags?: string[];
|
|
@@ -1701,6 +1712,11 @@ export interface TraceException {
|
|
|
1701
1712
|
readonly message: string;
|
|
1702
1713
|
readonly name: string;
|
|
1703
1714
|
}
|
|
1715
|
+
export interface TraceDiagnosticChannelEvent {
|
|
1716
|
+
readonly timestamp: number;
|
|
1717
|
+
readonly channel: string;
|
|
1718
|
+
readonly message: any;
|
|
1719
|
+
}
|
|
1704
1720
|
export interface TraceMetrics {
|
|
1705
1721
|
readonly cpuTime: number;
|
|
1706
1722
|
readonly wallTime: number;
|
|
@@ -2855,22 +2871,27 @@ export type CfProperties<HostMetadata = unknown> =
|
|
|
2855
2871
|
| IncomingRequestCfProperties<HostMetadata>
|
|
2856
2872
|
| RequestInitCfProperties;
|
|
2857
2873
|
export interface D1Result<T = unknown> {
|
|
2858
|
-
results
|
|
2859
|
-
success:
|
|
2860
|
-
error?: string;
|
|
2874
|
+
results: T[];
|
|
2875
|
+
success: true;
|
|
2861
2876
|
meta: any;
|
|
2877
|
+
error?: never;
|
|
2878
|
+
}
|
|
2879
|
+
export interface D1ExecResult {
|
|
2880
|
+
count: number;
|
|
2881
|
+
duration: number;
|
|
2862
2882
|
}
|
|
2863
2883
|
export declare abstract class D1Database {
|
|
2864
2884
|
prepare(query: string): D1PreparedStatement;
|
|
2865
2885
|
dump(): Promise<ArrayBuffer>;
|
|
2866
2886
|
batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
|
|
2867
|
-
exec<T = unknown>(query: string): Promise<
|
|
2887
|
+
exec<T = unknown>(query: string): Promise<D1ExecResult>;
|
|
2868
2888
|
}
|
|
2869
2889
|
export declare abstract class D1PreparedStatement {
|
|
2870
2890
|
bind(...values: any[]): D1PreparedStatement;
|
|
2871
|
-
first<T = unknown>(colName
|
|
2891
|
+
first<T = unknown>(colName: string): Promise<T | null>;
|
|
2892
|
+
first<T = unknown>(): Promise<Record<string, T> | null>;
|
|
2872
2893
|
run<T = unknown>(): Promise<D1Result<T>>;
|
|
2873
|
-
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2894
|
+
all<T = unknown>(): Promise<D1Result<T[]>>;
|
|
2874
2895
|
raw<T = unknown>(): Promise<T[]>;
|
|
2875
2896
|
}
|
|
2876
2897
|
/**
|
package/2022-03-21/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[];
|
|
@@ -402,6 +404,9 @@ declare interface DurableObjectState {
|
|
|
402
404
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
403
405
|
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
404
406
|
getWebSockets(tag?: string): WebSocket[];
|
|
407
|
+
setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
|
|
408
|
+
getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
|
|
409
|
+
getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
|
|
405
410
|
}
|
|
406
411
|
declare interface DurableObjectTransaction {
|
|
407
412
|
get<T = unknown>(
|
|
@@ -496,6 +501,11 @@ declare interface DurableObjectSetAlarmOptions {
|
|
|
496
501
|
allowConcurrency?: boolean;
|
|
497
502
|
allowUnconfirmed?: boolean;
|
|
498
503
|
}
|
|
504
|
+
declare class WebSocketRequestResponsePair {
|
|
505
|
+
constructor(request: string, response: string);
|
|
506
|
+
get request(): string;
|
|
507
|
+
get response(): string;
|
|
508
|
+
}
|
|
499
509
|
declare interface AnalyticsEngineDataset {
|
|
500
510
|
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
501
511
|
}
|
|
@@ -1656,6 +1666,7 @@ declare interface TraceItem {
|
|
|
1656
1666
|
readonly eventTimestamp: number | null;
|
|
1657
1667
|
readonly logs: TraceLog[];
|
|
1658
1668
|
readonly exceptions: TraceException[];
|
|
1669
|
+
readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
|
|
1659
1670
|
readonly scriptName: string | null;
|
|
1660
1671
|
readonly dispatchNamespace?: string;
|
|
1661
1672
|
readonly scriptTags?: string[];
|
|
@@ -1702,6 +1713,11 @@ declare interface TraceException {
|
|
|
1702
1713
|
readonly message: string;
|
|
1703
1714
|
readonly name: string;
|
|
1704
1715
|
}
|
|
1716
|
+
declare interface TraceDiagnosticChannelEvent {
|
|
1717
|
+
readonly timestamp: number;
|
|
1718
|
+
readonly channel: string;
|
|
1719
|
+
readonly message: any;
|
|
1720
|
+
}
|
|
1705
1721
|
declare interface TraceMetrics {
|
|
1706
1722
|
readonly cpuTime: number;
|
|
1707
1723
|
readonly wallTime: number;
|
|
@@ -2856,22 +2872,27 @@ declare type CfProperties<HostMetadata = unknown> =
|
|
|
2856
2872
|
| IncomingRequestCfProperties<HostMetadata>
|
|
2857
2873
|
| RequestInitCfProperties;
|
|
2858
2874
|
declare interface D1Result<T = unknown> {
|
|
2859
|
-
results
|
|
2860
|
-
success:
|
|
2861
|
-
error?: string;
|
|
2875
|
+
results: T[];
|
|
2876
|
+
success: true;
|
|
2862
2877
|
meta: any;
|
|
2878
|
+
error?: never;
|
|
2879
|
+
}
|
|
2880
|
+
declare interface D1ExecResult {
|
|
2881
|
+
count: number;
|
|
2882
|
+
duration: number;
|
|
2863
2883
|
}
|
|
2864
2884
|
declare abstract class D1Database {
|
|
2865
2885
|
prepare(query: string): D1PreparedStatement;
|
|
2866
2886
|
dump(): Promise<ArrayBuffer>;
|
|
2867
2887
|
batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
|
|
2868
|
-
exec<T = unknown>(query: string): Promise<
|
|
2888
|
+
exec<T = unknown>(query: string): Promise<D1ExecResult>;
|
|
2869
2889
|
}
|
|
2870
2890
|
declare abstract class D1PreparedStatement {
|
|
2871
2891
|
bind(...values: any[]): D1PreparedStatement;
|
|
2872
|
-
first<T = unknown>(colName
|
|
2892
|
+
first<T = unknown>(colName: string): Promise<T | null>;
|
|
2893
|
+
first<T = unknown>(): Promise<Record<string, T> | null>;
|
|
2873
2894
|
run<T = unknown>(): Promise<D1Result<T>>;
|
|
2874
|
-
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2895
|
+
all<T = unknown>(): Promise<D1Result<T[]>>;
|
|
2875
2896
|
raw<T = unknown>(): Promise<T[]>;
|
|
2876
2897
|
}
|
|
2877
2898
|
/**
|
package/2022-03-21/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[];
|
|
@@ -404,6 +406,9 @@ export interface DurableObjectState {
|
|
|
404
406
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
405
407
|
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
406
408
|
getWebSockets(tag?: string): WebSocket[];
|
|
409
|
+
setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;
|
|
410
|
+
getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;
|
|
411
|
+
getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;
|
|
407
412
|
}
|
|
408
413
|
export interface DurableObjectTransaction {
|
|
409
414
|
get<T = unknown>(
|
|
@@ -498,6 +503,11 @@ export interface DurableObjectSetAlarmOptions {
|
|
|
498
503
|
allowConcurrency?: boolean;
|
|
499
504
|
allowUnconfirmed?: boolean;
|
|
500
505
|
}
|
|
506
|
+
export declare class WebSocketRequestResponsePair {
|
|
507
|
+
constructor(request: string, response: string);
|
|
508
|
+
get request(): string;
|
|
509
|
+
get response(): string;
|
|
510
|
+
}
|
|
501
511
|
export interface AnalyticsEngineDataset {
|
|
502
512
|
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
503
513
|
}
|
|
@@ -1661,6 +1671,7 @@ export interface TraceItem {
|
|
|
1661
1671
|
readonly eventTimestamp: number | null;
|
|
1662
1672
|
readonly logs: TraceLog[];
|
|
1663
1673
|
readonly exceptions: TraceException[];
|
|
1674
|
+
readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
|
|
1664
1675
|
readonly scriptName: string | null;
|
|
1665
1676
|
readonly dispatchNamespace?: string;
|
|
1666
1677
|
readonly scriptTags?: string[];
|
|
@@ -1707,6 +1718,11 @@ export interface TraceException {
|
|
|
1707
1718
|
readonly message: string;
|
|
1708
1719
|
readonly name: string;
|
|
1709
1720
|
}
|
|
1721
|
+
export interface TraceDiagnosticChannelEvent {
|
|
1722
|
+
readonly timestamp: number;
|
|
1723
|
+
readonly channel: string;
|
|
1724
|
+
readonly message: any;
|
|
1725
|
+
}
|
|
1710
1726
|
export interface TraceMetrics {
|
|
1711
1727
|
readonly cpuTime: number;
|
|
1712
1728
|
readonly wallTime: number;
|
|
@@ -2861,22 +2877,27 @@ export type CfProperties<HostMetadata = unknown> =
|
|
|
2861
2877
|
| IncomingRequestCfProperties<HostMetadata>
|
|
2862
2878
|
| RequestInitCfProperties;
|
|
2863
2879
|
export interface D1Result<T = unknown> {
|
|
2864
|
-
results
|
|
2865
|
-
success:
|
|
2866
|
-
error?: string;
|
|
2880
|
+
results: T[];
|
|
2881
|
+
success: true;
|
|
2867
2882
|
meta: any;
|
|
2883
|
+
error?: never;
|
|
2884
|
+
}
|
|
2885
|
+
export interface D1ExecResult {
|
|
2886
|
+
count: number;
|
|
2887
|
+
duration: number;
|
|
2868
2888
|
}
|
|
2869
2889
|
export declare abstract class D1Database {
|
|
2870
2890
|
prepare(query: string): D1PreparedStatement;
|
|
2871
2891
|
dump(): Promise<ArrayBuffer>;
|
|
2872
2892
|
batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
|
|
2873
|
-
exec<T = unknown>(query: string): Promise<
|
|
2893
|
+
exec<T = unknown>(query: string): Promise<D1ExecResult>;
|
|
2874
2894
|
}
|
|
2875
2895
|
export declare abstract class D1PreparedStatement {
|
|
2876
2896
|
bind(...values: any[]): D1PreparedStatement;
|
|
2877
|
-
first<T = unknown>(colName
|
|
2897
|
+
first<T = unknown>(colName: string): Promise<T | null>;
|
|
2898
|
+
first<T = unknown>(): Promise<Record<string, T> | null>;
|
|
2878
2899
|
run<T = unknown>(): Promise<D1Result<T>>;
|
|
2879
|
-
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2900
|
+
all<T = unknown>(): Promise<D1Result<T[]>>;
|
|
2880
2901
|
raw<T = unknown>(): Promise<T[]>;
|
|
2881
2902
|
}
|
|
2882
2903
|
/**
|