@cloudflare/workers-types 4.20260307.1 → 4.20260312.1
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 +46 -25
- package/2021-11-03/index.ts +42 -24
- package/2022-01-31/index.d.ts +46 -25
- package/2022-01-31/index.ts +42 -24
- package/2022-03-21/index.d.ts +46 -25
- package/2022-03-21/index.ts +42 -24
- package/2022-08-04/index.d.ts +46 -25
- package/2022-08-04/index.ts +42 -24
- package/2022-10-31/index.d.ts +46 -25
- package/2022-10-31/index.ts +42 -24
- package/2022-11-30/index.d.ts +46 -25
- package/2022-11-30/index.ts +42 -24
- package/2023-03-01/index.d.ts +46 -25
- package/2023-03-01/index.ts +42 -24
- package/2023-07-01/index.d.ts +46 -25
- package/2023-07-01/index.ts +42 -24
- package/experimental/index.d.ts +52 -25
- package/experimental/index.ts +48 -24
- package/index.d.ts +46 -25
- package/index.ts +42 -24
- package/latest/index.d.ts +46 -25
- package/latest/index.ts +42 -24
- package/oldest/index.d.ts +46 -25
- package/oldest/index.ts +42 -24
- package/package.json +1 -1
package/2021-11-03/index.d.ts
CHANGED
|
@@ -469,54 +469,63 @@ interface ExecutionContext<Props = unknown> {
|
|
|
469
469
|
passThroughOnException(): void;
|
|
470
470
|
readonly props: Props;
|
|
471
471
|
}
|
|
472
|
-
type ExportedHandlerFetchHandler<
|
|
472
|
+
type ExportedHandlerFetchHandler<
|
|
473
|
+
Env = unknown,
|
|
474
|
+
CfHostMetadata = unknown,
|
|
475
|
+
Props = unknown,
|
|
476
|
+
> = (
|
|
473
477
|
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
474
478
|
env: Env,
|
|
475
|
-
ctx: ExecutionContext
|
|
479
|
+
ctx: ExecutionContext<Props>,
|
|
476
480
|
) => Response | Promise<Response>;
|
|
477
|
-
type ExportedHandlerTailHandler<Env = unknown> = (
|
|
481
|
+
type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (
|
|
478
482
|
events: TraceItem[],
|
|
479
483
|
env: Env,
|
|
480
|
-
ctx: ExecutionContext
|
|
484
|
+
ctx: ExecutionContext<Props>,
|
|
481
485
|
) => void | Promise<void>;
|
|
482
|
-
type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
486
|
+
type ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (
|
|
483
487
|
traces: TraceItem[],
|
|
484
488
|
env: Env,
|
|
485
|
-
ctx: ExecutionContext
|
|
489
|
+
ctx: ExecutionContext<Props>,
|
|
486
490
|
) => void | Promise<void>;
|
|
487
|
-
type ExportedHandlerTailStreamHandler<Env = unknown> = (
|
|
491
|
+
type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (
|
|
488
492
|
event: TailStream.TailEvent<TailStream.Onset>,
|
|
489
493
|
env: Env,
|
|
490
|
-
ctx: ExecutionContext
|
|
494
|
+
ctx: ExecutionContext<Props>,
|
|
491
495
|
) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
|
|
492
|
-
type ExportedHandlerScheduledHandler<Env = unknown> = (
|
|
496
|
+
type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (
|
|
493
497
|
controller: ScheduledController,
|
|
494
498
|
env: Env,
|
|
495
|
-
ctx: ExecutionContext
|
|
499
|
+
ctx: ExecutionContext<Props>,
|
|
496
500
|
) => void | Promise<void>;
|
|
497
|
-
type ExportedHandlerQueueHandler<
|
|
501
|
+
type ExportedHandlerQueueHandler<
|
|
502
|
+
Env = unknown,
|
|
503
|
+
Message = unknown,
|
|
504
|
+
Props = unknown,
|
|
505
|
+
> = (
|
|
498
506
|
batch: MessageBatch<Message>,
|
|
499
507
|
env: Env,
|
|
500
|
-
ctx: ExecutionContext
|
|
508
|
+
ctx: ExecutionContext<Props>,
|
|
501
509
|
) => void | Promise<void>;
|
|
502
|
-
type ExportedHandlerTestHandler<Env = unknown> = (
|
|
510
|
+
type ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (
|
|
503
511
|
controller: TestController,
|
|
504
512
|
env: Env,
|
|
505
|
-
ctx: ExecutionContext
|
|
513
|
+
ctx: ExecutionContext<Props>,
|
|
506
514
|
) => void | Promise<void>;
|
|
507
515
|
interface ExportedHandler<
|
|
508
516
|
Env = unknown,
|
|
509
517
|
QueueHandlerMessage = unknown,
|
|
510
518
|
CfHostMetadata = unknown,
|
|
519
|
+
Props = unknown,
|
|
511
520
|
> {
|
|
512
|
-
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
513
|
-
tail?: ExportedHandlerTailHandler<Env>;
|
|
514
|
-
trace?: ExportedHandlerTraceHandler<Env>;
|
|
515
|
-
tailStream?: ExportedHandlerTailStreamHandler<Env>;
|
|
516
|
-
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
517
|
-
test?: ExportedHandlerTestHandler<Env>;
|
|
518
|
-
email?: EmailExportedHandler<Env>;
|
|
519
|
-
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
|
|
521
|
+
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
|
|
522
|
+
tail?: ExportedHandlerTailHandler<Env, Props>;
|
|
523
|
+
trace?: ExportedHandlerTraceHandler<Env, Props>;
|
|
524
|
+
tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
|
|
525
|
+
scheduled?: ExportedHandlerScheduledHandler<Env, Props>;
|
|
526
|
+
test?: ExportedHandlerTestHandler<Env, Props>;
|
|
527
|
+
email?: EmailExportedHandler<Env, Props>;
|
|
528
|
+
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;
|
|
520
529
|
}
|
|
521
530
|
interface StructuredSerializeOptions {
|
|
522
531
|
transfer?: any[];
|
|
@@ -3454,7 +3463,7 @@ declare var WebSocket: {
|
|
|
3454
3463
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
|
|
3455
3464
|
*/
|
|
3456
3465
|
interface WebSocket extends EventTarget<WebSocketEventMap> {
|
|
3457
|
-
accept(): void;
|
|
3466
|
+
accept(options?: WebSocketAcceptOptions): void;
|
|
3458
3467
|
/**
|
|
3459
3468
|
* The **`WebSocket.send()`** method enqueues the specified data to be transmitted to the server over the WebSocket connection, increasing the value of `bufferedAmount` by the number of bytes needed to contain the data.
|
|
3460
3469
|
*
|
|
@@ -3500,6 +3509,16 @@ interface WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
3500
3509
|
*/
|
|
3501
3510
|
binaryType: "blob" | "arraybuffer";
|
|
3502
3511
|
}
|
|
3512
|
+
interface WebSocketAcceptOptions {
|
|
3513
|
+
/**
|
|
3514
|
+
* When set to `true`, receiving a server-initiated WebSocket Close frame will not
|
|
3515
|
+
* automatically send a reciprocal Close frame, leaving the connection in a half-open
|
|
3516
|
+
* state. This is useful for proxying scenarios where you need to coordinate closing
|
|
3517
|
+
* both sides independently. Defaults to `false` when the
|
|
3518
|
+
* `no_web_socket_half_open_by_default` compatibility flag is enabled.
|
|
3519
|
+
*/
|
|
3520
|
+
allowHalfOpen?: boolean;
|
|
3521
|
+
}
|
|
3503
3522
|
declare const WebSocketPair: {
|
|
3504
3523
|
new (): {
|
|
3505
3524
|
0: WebSocket;
|
|
@@ -3623,6 +3642,8 @@ interface Container {
|
|
|
3623
3642
|
signal(signo: number): void;
|
|
3624
3643
|
getTcpPort(port: number): Fetcher;
|
|
3625
3644
|
setInactivityTimeout(durationMs: number | bigint): Promise<void>;
|
|
3645
|
+
interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
|
|
3646
|
+
interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
|
|
3626
3647
|
}
|
|
3627
3648
|
interface ContainerStartupOptions {
|
|
3628
3649
|
entrypoint?: string[];
|
|
@@ -10991,10 +11012,10 @@ interface SendEmail {
|
|
|
10991
11012
|
declare abstract class EmailEvent extends ExtendableEvent {
|
|
10992
11013
|
readonly message: ForwardableEmailMessage;
|
|
10993
11014
|
}
|
|
10994
|
-
declare type EmailExportedHandler<Env = unknown> = (
|
|
11015
|
+
declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
|
|
10995
11016
|
message: ForwardableEmailMessage,
|
|
10996
11017
|
env: Env,
|
|
10997
|
-
ctx: ExecutionContext
|
|
11018
|
+
ctx: ExecutionContext<Props>,
|
|
10998
11019
|
) => void | Promise<void>;
|
|
10999
11020
|
declare module "cloudflare:email" {
|
|
11000
11021
|
let _EmailMessage: {
|
package/2021-11-03/index.ts
CHANGED
|
@@ -474,54 +474,60 @@ export interface ExecutionContext<Props = unknown> {
|
|
|
474
474
|
export type ExportedHandlerFetchHandler<
|
|
475
475
|
Env = unknown,
|
|
476
476
|
CfHostMetadata = unknown,
|
|
477
|
+
Props = unknown,
|
|
477
478
|
> = (
|
|
478
479
|
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
479
480
|
env: Env,
|
|
480
|
-
ctx: ExecutionContext
|
|
481
|
+
ctx: ExecutionContext<Props>,
|
|
481
482
|
) => Response | Promise<Response>;
|
|
482
|
-
export type ExportedHandlerTailHandler<Env = unknown> = (
|
|
483
|
+
export type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (
|
|
483
484
|
events: TraceItem[],
|
|
484
485
|
env: Env,
|
|
485
|
-
ctx: ExecutionContext
|
|
486
|
+
ctx: ExecutionContext<Props>,
|
|
486
487
|
) => void | Promise<void>;
|
|
487
|
-
export type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
488
|
+
export type ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (
|
|
488
489
|
traces: TraceItem[],
|
|
489
490
|
env: Env,
|
|
490
|
-
ctx: ExecutionContext
|
|
491
|
+
ctx: ExecutionContext<Props>,
|
|
491
492
|
) => void | Promise<void>;
|
|
492
|
-
export type ExportedHandlerTailStreamHandler<Env = unknown> = (
|
|
493
|
+
export type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (
|
|
493
494
|
event: TailStream.TailEvent<TailStream.Onset>,
|
|
494
495
|
env: Env,
|
|
495
|
-
ctx: ExecutionContext
|
|
496
|
+
ctx: ExecutionContext<Props>,
|
|
496
497
|
) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
|
|
497
|
-
export type ExportedHandlerScheduledHandler<Env = unknown> = (
|
|
498
|
+
export type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (
|
|
498
499
|
controller: ScheduledController,
|
|
499
500
|
env: Env,
|
|
500
|
-
ctx: ExecutionContext
|
|
501
|
+
ctx: ExecutionContext<Props>,
|
|
501
502
|
) => void | Promise<void>;
|
|
502
|
-
export type ExportedHandlerQueueHandler<
|
|
503
|
+
export type ExportedHandlerQueueHandler<
|
|
504
|
+
Env = unknown,
|
|
505
|
+
Message = unknown,
|
|
506
|
+
Props = unknown,
|
|
507
|
+
> = (
|
|
503
508
|
batch: MessageBatch<Message>,
|
|
504
509
|
env: Env,
|
|
505
|
-
ctx: ExecutionContext
|
|
510
|
+
ctx: ExecutionContext<Props>,
|
|
506
511
|
) => void | Promise<void>;
|
|
507
|
-
export type ExportedHandlerTestHandler<Env = unknown> = (
|
|
512
|
+
export type ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (
|
|
508
513
|
controller: TestController,
|
|
509
514
|
env: Env,
|
|
510
|
-
ctx: ExecutionContext
|
|
515
|
+
ctx: ExecutionContext<Props>,
|
|
511
516
|
) => void | Promise<void>;
|
|
512
517
|
export interface ExportedHandler<
|
|
513
518
|
Env = unknown,
|
|
514
519
|
QueueHandlerMessage = unknown,
|
|
515
520
|
CfHostMetadata = unknown,
|
|
521
|
+
Props = unknown,
|
|
516
522
|
> {
|
|
517
|
-
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
518
|
-
tail?: ExportedHandlerTailHandler<Env>;
|
|
519
|
-
trace?: ExportedHandlerTraceHandler<Env>;
|
|
520
|
-
tailStream?: ExportedHandlerTailStreamHandler<Env>;
|
|
521
|
-
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
522
|
-
test?: ExportedHandlerTestHandler<Env>;
|
|
523
|
-
email?: EmailExportedHandler<Env>;
|
|
524
|
-
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
|
|
523
|
+
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
|
|
524
|
+
tail?: ExportedHandlerTailHandler<Env, Props>;
|
|
525
|
+
trace?: ExportedHandlerTraceHandler<Env, Props>;
|
|
526
|
+
tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
|
|
527
|
+
scheduled?: ExportedHandlerScheduledHandler<Env, Props>;
|
|
528
|
+
test?: ExportedHandlerTestHandler<Env, Props>;
|
|
529
|
+
email?: EmailExportedHandler<Env, Props>;
|
|
530
|
+
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;
|
|
525
531
|
}
|
|
526
532
|
export interface StructuredSerializeOptions {
|
|
527
533
|
transfer?: any[];
|
|
@@ -3463,7 +3469,7 @@ export declare var WebSocket: {
|
|
|
3463
3469
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
|
|
3464
3470
|
*/
|
|
3465
3471
|
export interface WebSocket extends EventTarget<WebSocketEventMap> {
|
|
3466
|
-
accept(): void;
|
|
3472
|
+
accept(options?: WebSocketAcceptOptions): void;
|
|
3467
3473
|
/**
|
|
3468
3474
|
* The **`WebSocket.send()`** method enqueues the specified data to be transmitted to the server over the WebSocket connection, increasing the value of `bufferedAmount` by the number of bytes needed to contain the data.
|
|
3469
3475
|
*
|
|
@@ -3509,6 +3515,16 @@ export interface WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
3509
3515
|
*/
|
|
3510
3516
|
binaryType: "blob" | "arraybuffer";
|
|
3511
3517
|
}
|
|
3518
|
+
export interface WebSocketAcceptOptions {
|
|
3519
|
+
/**
|
|
3520
|
+
* When set to `true`, receiving a server-initiated WebSocket Close frame will not
|
|
3521
|
+
* automatically send a reciprocal Close frame, leaving the connection in a half-open
|
|
3522
|
+
* state. This is useful for proxying scenarios where you need to coordinate closing
|
|
3523
|
+
* both sides independently. Defaults to `false` when the
|
|
3524
|
+
* `no_web_socket_half_open_by_default` compatibility flag is enabled.
|
|
3525
|
+
*/
|
|
3526
|
+
allowHalfOpen?: boolean;
|
|
3527
|
+
}
|
|
3512
3528
|
export declare const WebSocketPair: {
|
|
3513
3529
|
new (): {
|
|
3514
3530
|
0: WebSocket;
|
|
@@ -3632,6 +3648,8 @@ export interface Container {
|
|
|
3632
3648
|
signal(signo: number): void;
|
|
3633
3649
|
getTcpPort(port: number): Fetcher;
|
|
3634
3650
|
setInactivityTimeout(durationMs: number | bigint): Promise<void>;
|
|
3651
|
+
interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
|
|
3652
|
+
interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
|
|
3635
3653
|
}
|
|
3636
3654
|
export interface ContainerStartupOptions {
|
|
3637
3655
|
entrypoint?: string[];
|
|
@@ -11015,10 +11033,10 @@ export interface SendEmail {
|
|
|
11015
11033
|
export declare abstract class EmailEvent extends ExtendableEvent {
|
|
11016
11034
|
readonly message: ForwardableEmailMessage;
|
|
11017
11035
|
}
|
|
11018
|
-
export declare type EmailExportedHandler<Env = unknown> = (
|
|
11036
|
+
export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
|
|
11019
11037
|
message: ForwardableEmailMessage,
|
|
11020
11038
|
env: Env,
|
|
11021
|
-
ctx: ExecutionContext
|
|
11039
|
+
ctx: ExecutionContext<Props>,
|
|
11022
11040
|
) => void | Promise<void>;
|
|
11023
11041
|
/**
|
|
11024
11042
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
package/2022-01-31/index.d.ts
CHANGED
|
@@ -469,54 +469,63 @@ interface ExecutionContext<Props = unknown> {
|
|
|
469
469
|
passThroughOnException(): void;
|
|
470
470
|
readonly props: Props;
|
|
471
471
|
}
|
|
472
|
-
type ExportedHandlerFetchHandler<
|
|
472
|
+
type ExportedHandlerFetchHandler<
|
|
473
|
+
Env = unknown,
|
|
474
|
+
CfHostMetadata = unknown,
|
|
475
|
+
Props = unknown,
|
|
476
|
+
> = (
|
|
473
477
|
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
474
478
|
env: Env,
|
|
475
|
-
ctx: ExecutionContext
|
|
479
|
+
ctx: ExecutionContext<Props>,
|
|
476
480
|
) => Response | Promise<Response>;
|
|
477
|
-
type ExportedHandlerTailHandler<Env = unknown> = (
|
|
481
|
+
type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (
|
|
478
482
|
events: TraceItem[],
|
|
479
483
|
env: Env,
|
|
480
|
-
ctx: ExecutionContext
|
|
484
|
+
ctx: ExecutionContext<Props>,
|
|
481
485
|
) => void | Promise<void>;
|
|
482
|
-
type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
486
|
+
type ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (
|
|
483
487
|
traces: TraceItem[],
|
|
484
488
|
env: Env,
|
|
485
|
-
ctx: ExecutionContext
|
|
489
|
+
ctx: ExecutionContext<Props>,
|
|
486
490
|
) => void | Promise<void>;
|
|
487
|
-
type ExportedHandlerTailStreamHandler<Env = unknown> = (
|
|
491
|
+
type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (
|
|
488
492
|
event: TailStream.TailEvent<TailStream.Onset>,
|
|
489
493
|
env: Env,
|
|
490
|
-
ctx: ExecutionContext
|
|
494
|
+
ctx: ExecutionContext<Props>,
|
|
491
495
|
) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
|
|
492
|
-
type ExportedHandlerScheduledHandler<Env = unknown> = (
|
|
496
|
+
type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (
|
|
493
497
|
controller: ScheduledController,
|
|
494
498
|
env: Env,
|
|
495
|
-
ctx: ExecutionContext
|
|
499
|
+
ctx: ExecutionContext<Props>,
|
|
496
500
|
) => void | Promise<void>;
|
|
497
|
-
type ExportedHandlerQueueHandler<
|
|
501
|
+
type ExportedHandlerQueueHandler<
|
|
502
|
+
Env = unknown,
|
|
503
|
+
Message = unknown,
|
|
504
|
+
Props = unknown,
|
|
505
|
+
> = (
|
|
498
506
|
batch: MessageBatch<Message>,
|
|
499
507
|
env: Env,
|
|
500
|
-
ctx: ExecutionContext
|
|
508
|
+
ctx: ExecutionContext<Props>,
|
|
501
509
|
) => void | Promise<void>;
|
|
502
|
-
type ExportedHandlerTestHandler<Env = unknown> = (
|
|
510
|
+
type ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (
|
|
503
511
|
controller: TestController,
|
|
504
512
|
env: Env,
|
|
505
|
-
ctx: ExecutionContext
|
|
513
|
+
ctx: ExecutionContext<Props>,
|
|
506
514
|
) => void | Promise<void>;
|
|
507
515
|
interface ExportedHandler<
|
|
508
516
|
Env = unknown,
|
|
509
517
|
QueueHandlerMessage = unknown,
|
|
510
518
|
CfHostMetadata = unknown,
|
|
519
|
+
Props = unknown,
|
|
511
520
|
> {
|
|
512
|
-
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
513
|
-
tail?: ExportedHandlerTailHandler<Env>;
|
|
514
|
-
trace?: ExportedHandlerTraceHandler<Env>;
|
|
515
|
-
tailStream?: ExportedHandlerTailStreamHandler<Env>;
|
|
516
|
-
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
517
|
-
test?: ExportedHandlerTestHandler<Env>;
|
|
518
|
-
email?: EmailExportedHandler<Env>;
|
|
519
|
-
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
|
|
521
|
+
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
|
|
522
|
+
tail?: ExportedHandlerTailHandler<Env, Props>;
|
|
523
|
+
trace?: ExportedHandlerTraceHandler<Env, Props>;
|
|
524
|
+
tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
|
|
525
|
+
scheduled?: ExportedHandlerScheduledHandler<Env, Props>;
|
|
526
|
+
test?: ExportedHandlerTestHandler<Env, Props>;
|
|
527
|
+
email?: EmailExportedHandler<Env, Props>;
|
|
528
|
+
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;
|
|
520
529
|
}
|
|
521
530
|
interface StructuredSerializeOptions {
|
|
522
531
|
transfer?: any[];
|
|
@@ -3521,7 +3530,7 @@ declare var WebSocket: {
|
|
|
3521
3530
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
|
|
3522
3531
|
*/
|
|
3523
3532
|
interface WebSocket extends EventTarget<WebSocketEventMap> {
|
|
3524
|
-
accept(): void;
|
|
3533
|
+
accept(options?: WebSocketAcceptOptions): void;
|
|
3525
3534
|
/**
|
|
3526
3535
|
* The **`WebSocket.send()`** method enqueues the specified data to be transmitted to the server over the WebSocket connection, increasing the value of `bufferedAmount` by the number of bytes needed to contain the data.
|
|
3527
3536
|
*
|
|
@@ -3567,6 +3576,16 @@ interface WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
3567
3576
|
*/
|
|
3568
3577
|
binaryType: "blob" | "arraybuffer";
|
|
3569
3578
|
}
|
|
3579
|
+
interface WebSocketAcceptOptions {
|
|
3580
|
+
/**
|
|
3581
|
+
* When set to `true`, receiving a server-initiated WebSocket Close frame will not
|
|
3582
|
+
* automatically send a reciprocal Close frame, leaving the connection in a half-open
|
|
3583
|
+
* state. This is useful for proxying scenarios where you need to coordinate closing
|
|
3584
|
+
* both sides independently. Defaults to `false` when the
|
|
3585
|
+
* `no_web_socket_half_open_by_default` compatibility flag is enabled.
|
|
3586
|
+
*/
|
|
3587
|
+
allowHalfOpen?: boolean;
|
|
3588
|
+
}
|
|
3570
3589
|
declare const WebSocketPair: {
|
|
3571
3590
|
new (): {
|
|
3572
3591
|
0: WebSocket;
|
|
@@ -3690,6 +3709,8 @@ interface Container {
|
|
|
3690
3709
|
signal(signo: number): void;
|
|
3691
3710
|
getTcpPort(port: number): Fetcher;
|
|
3692
3711
|
setInactivityTimeout(durationMs: number | bigint): Promise<void>;
|
|
3712
|
+
interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
|
|
3713
|
+
interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
|
|
3693
3714
|
}
|
|
3694
3715
|
interface ContainerStartupOptions {
|
|
3695
3716
|
entrypoint?: string[];
|
|
@@ -11058,10 +11079,10 @@ interface SendEmail {
|
|
|
11058
11079
|
declare abstract class EmailEvent extends ExtendableEvent {
|
|
11059
11080
|
readonly message: ForwardableEmailMessage;
|
|
11060
11081
|
}
|
|
11061
|
-
declare type EmailExportedHandler<Env = unknown> = (
|
|
11082
|
+
declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
|
|
11062
11083
|
message: ForwardableEmailMessage,
|
|
11063
11084
|
env: Env,
|
|
11064
|
-
ctx: ExecutionContext
|
|
11085
|
+
ctx: ExecutionContext<Props>,
|
|
11065
11086
|
) => void | Promise<void>;
|
|
11066
11087
|
declare module "cloudflare:email" {
|
|
11067
11088
|
let _EmailMessage: {
|
package/2022-01-31/index.ts
CHANGED
|
@@ -474,54 +474,60 @@ export interface ExecutionContext<Props = unknown> {
|
|
|
474
474
|
export type ExportedHandlerFetchHandler<
|
|
475
475
|
Env = unknown,
|
|
476
476
|
CfHostMetadata = unknown,
|
|
477
|
+
Props = unknown,
|
|
477
478
|
> = (
|
|
478
479
|
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
479
480
|
env: Env,
|
|
480
|
-
ctx: ExecutionContext
|
|
481
|
+
ctx: ExecutionContext<Props>,
|
|
481
482
|
) => Response | Promise<Response>;
|
|
482
|
-
export type ExportedHandlerTailHandler<Env = unknown> = (
|
|
483
|
+
export type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (
|
|
483
484
|
events: TraceItem[],
|
|
484
485
|
env: Env,
|
|
485
|
-
ctx: ExecutionContext
|
|
486
|
+
ctx: ExecutionContext<Props>,
|
|
486
487
|
) => void | Promise<void>;
|
|
487
|
-
export type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
488
|
+
export type ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (
|
|
488
489
|
traces: TraceItem[],
|
|
489
490
|
env: Env,
|
|
490
|
-
ctx: ExecutionContext
|
|
491
|
+
ctx: ExecutionContext<Props>,
|
|
491
492
|
) => void | Promise<void>;
|
|
492
|
-
export type ExportedHandlerTailStreamHandler<Env = unknown> = (
|
|
493
|
+
export type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (
|
|
493
494
|
event: TailStream.TailEvent<TailStream.Onset>,
|
|
494
495
|
env: Env,
|
|
495
|
-
ctx: ExecutionContext
|
|
496
|
+
ctx: ExecutionContext<Props>,
|
|
496
497
|
) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
|
|
497
|
-
export type ExportedHandlerScheduledHandler<Env = unknown> = (
|
|
498
|
+
export type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (
|
|
498
499
|
controller: ScheduledController,
|
|
499
500
|
env: Env,
|
|
500
|
-
ctx: ExecutionContext
|
|
501
|
+
ctx: ExecutionContext<Props>,
|
|
501
502
|
) => void | Promise<void>;
|
|
502
|
-
export type ExportedHandlerQueueHandler<
|
|
503
|
+
export type ExportedHandlerQueueHandler<
|
|
504
|
+
Env = unknown,
|
|
505
|
+
Message = unknown,
|
|
506
|
+
Props = unknown,
|
|
507
|
+
> = (
|
|
503
508
|
batch: MessageBatch<Message>,
|
|
504
509
|
env: Env,
|
|
505
|
-
ctx: ExecutionContext
|
|
510
|
+
ctx: ExecutionContext<Props>,
|
|
506
511
|
) => void | Promise<void>;
|
|
507
|
-
export type ExportedHandlerTestHandler<Env = unknown> = (
|
|
512
|
+
export type ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (
|
|
508
513
|
controller: TestController,
|
|
509
514
|
env: Env,
|
|
510
|
-
ctx: ExecutionContext
|
|
515
|
+
ctx: ExecutionContext<Props>,
|
|
511
516
|
) => void | Promise<void>;
|
|
512
517
|
export interface ExportedHandler<
|
|
513
518
|
Env = unknown,
|
|
514
519
|
QueueHandlerMessage = unknown,
|
|
515
520
|
CfHostMetadata = unknown,
|
|
521
|
+
Props = unknown,
|
|
516
522
|
> {
|
|
517
|
-
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
518
|
-
tail?: ExportedHandlerTailHandler<Env>;
|
|
519
|
-
trace?: ExportedHandlerTraceHandler<Env>;
|
|
520
|
-
tailStream?: ExportedHandlerTailStreamHandler<Env>;
|
|
521
|
-
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
522
|
-
test?: ExportedHandlerTestHandler<Env>;
|
|
523
|
-
email?: EmailExportedHandler<Env>;
|
|
524
|
-
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
|
|
523
|
+
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
|
|
524
|
+
tail?: ExportedHandlerTailHandler<Env, Props>;
|
|
525
|
+
trace?: ExportedHandlerTraceHandler<Env, Props>;
|
|
526
|
+
tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
|
|
527
|
+
scheduled?: ExportedHandlerScheduledHandler<Env, Props>;
|
|
528
|
+
test?: ExportedHandlerTestHandler<Env, Props>;
|
|
529
|
+
email?: EmailExportedHandler<Env, Props>;
|
|
530
|
+
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;
|
|
525
531
|
}
|
|
526
532
|
export interface StructuredSerializeOptions {
|
|
527
533
|
transfer?: any[];
|
|
@@ -3530,7 +3536,7 @@ export declare var WebSocket: {
|
|
|
3530
3536
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
|
|
3531
3537
|
*/
|
|
3532
3538
|
export interface WebSocket extends EventTarget<WebSocketEventMap> {
|
|
3533
|
-
accept(): void;
|
|
3539
|
+
accept(options?: WebSocketAcceptOptions): void;
|
|
3534
3540
|
/**
|
|
3535
3541
|
* The **`WebSocket.send()`** method enqueues the specified data to be transmitted to the server over the WebSocket connection, increasing the value of `bufferedAmount` by the number of bytes needed to contain the data.
|
|
3536
3542
|
*
|
|
@@ -3576,6 +3582,16 @@ export interface WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
3576
3582
|
*/
|
|
3577
3583
|
binaryType: "blob" | "arraybuffer";
|
|
3578
3584
|
}
|
|
3585
|
+
export interface WebSocketAcceptOptions {
|
|
3586
|
+
/**
|
|
3587
|
+
* When set to `true`, receiving a server-initiated WebSocket Close frame will not
|
|
3588
|
+
* automatically send a reciprocal Close frame, leaving the connection in a half-open
|
|
3589
|
+
* state. This is useful for proxying scenarios where you need to coordinate closing
|
|
3590
|
+
* both sides independently. Defaults to `false` when the
|
|
3591
|
+
* `no_web_socket_half_open_by_default` compatibility flag is enabled.
|
|
3592
|
+
*/
|
|
3593
|
+
allowHalfOpen?: boolean;
|
|
3594
|
+
}
|
|
3579
3595
|
export declare const WebSocketPair: {
|
|
3580
3596
|
new (): {
|
|
3581
3597
|
0: WebSocket;
|
|
@@ -3699,6 +3715,8 @@ export interface Container {
|
|
|
3699
3715
|
signal(signo: number): void;
|
|
3700
3716
|
getTcpPort(port: number): Fetcher;
|
|
3701
3717
|
setInactivityTimeout(durationMs: number | bigint): Promise<void>;
|
|
3718
|
+
interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
|
|
3719
|
+
interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
|
|
3702
3720
|
}
|
|
3703
3721
|
export interface ContainerStartupOptions {
|
|
3704
3722
|
entrypoint?: string[];
|
|
@@ -11082,10 +11100,10 @@ export interface SendEmail {
|
|
|
11082
11100
|
export declare abstract class EmailEvent extends ExtendableEvent {
|
|
11083
11101
|
readonly message: ForwardableEmailMessage;
|
|
11084
11102
|
}
|
|
11085
|
-
export declare type EmailExportedHandler<Env = unknown> = (
|
|
11103
|
+
export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
|
|
11086
11104
|
message: ForwardableEmailMessage,
|
|
11087
11105
|
env: Env,
|
|
11088
|
-
ctx: ExecutionContext
|
|
11106
|
+
ctx: ExecutionContext<Props>,
|
|
11089
11107
|
) => void | Promise<void>;
|
|
11090
11108
|
/**
|
|
11091
11109
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
package/2022-03-21/index.d.ts
CHANGED
|
@@ -472,54 +472,63 @@ interface ExecutionContext<Props = unknown> {
|
|
|
472
472
|
passThroughOnException(): void;
|
|
473
473
|
readonly props: Props;
|
|
474
474
|
}
|
|
475
|
-
type ExportedHandlerFetchHandler<
|
|
475
|
+
type ExportedHandlerFetchHandler<
|
|
476
|
+
Env = unknown,
|
|
477
|
+
CfHostMetadata = unknown,
|
|
478
|
+
Props = unknown,
|
|
479
|
+
> = (
|
|
476
480
|
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
477
481
|
env: Env,
|
|
478
|
-
ctx: ExecutionContext
|
|
482
|
+
ctx: ExecutionContext<Props>,
|
|
479
483
|
) => Response | Promise<Response>;
|
|
480
|
-
type ExportedHandlerTailHandler<Env = unknown> = (
|
|
484
|
+
type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (
|
|
481
485
|
events: TraceItem[],
|
|
482
486
|
env: Env,
|
|
483
|
-
ctx: ExecutionContext
|
|
487
|
+
ctx: ExecutionContext<Props>,
|
|
484
488
|
) => void | Promise<void>;
|
|
485
|
-
type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
489
|
+
type ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (
|
|
486
490
|
traces: TraceItem[],
|
|
487
491
|
env: Env,
|
|
488
|
-
ctx: ExecutionContext
|
|
492
|
+
ctx: ExecutionContext<Props>,
|
|
489
493
|
) => void | Promise<void>;
|
|
490
|
-
type ExportedHandlerTailStreamHandler<Env = unknown> = (
|
|
494
|
+
type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (
|
|
491
495
|
event: TailStream.TailEvent<TailStream.Onset>,
|
|
492
496
|
env: Env,
|
|
493
|
-
ctx: ExecutionContext
|
|
497
|
+
ctx: ExecutionContext<Props>,
|
|
494
498
|
) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
|
|
495
|
-
type ExportedHandlerScheduledHandler<Env = unknown> = (
|
|
499
|
+
type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (
|
|
496
500
|
controller: ScheduledController,
|
|
497
501
|
env: Env,
|
|
498
|
-
ctx: ExecutionContext
|
|
502
|
+
ctx: ExecutionContext<Props>,
|
|
499
503
|
) => void | Promise<void>;
|
|
500
|
-
type ExportedHandlerQueueHandler<
|
|
504
|
+
type ExportedHandlerQueueHandler<
|
|
505
|
+
Env = unknown,
|
|
506
|
+
Message = unknown,
|
|
507
|
+
Props = unknown,
|
|
508
|
+
> = (
|
|
501
509
|
batch: MessageBatch<Message>,
|
|
502
510
|
env: Env,
|
|
503
|
-
ctx: ExecutionContext
|
|
511
|
+
ctx: ExecutionContext<Props>,
|
|
504
512
|
) => void | Promise<void>;
|
|
505
|
-
type ExportedHandlerTestHandler<Env = unknown> = (
|
|
513
|
+
type ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (
|
|
506
514
|
controller: TestController,
|
|
507
515
|
env: Env,
|
|
508
|
-
ctx: ExecutionContext
|
|
516
|
+
ctx: ExecutionContext<Props>,
|
|
509
517
|
) => void | Promise<void>;
|
|
510
518
|
interface ExportedHandler<
|
|
511
519
|
Env = unknown,
|
|
512
520
|
QueueHandlerMessage = unknown,
|
|
513
521
|
CfHostMetadata = unknown,
|
|
522
|
+
Props = unknown,
|
|
514
523
|
> {
|
|
515
|
-
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
516
|
-
tail?: ExportedHandlerTailHandler<Env>;
|
|
517
|
-
trace?: ExportedHandlerTraceHandler<Env>;
|
|
518
|
-
tailStream?: ExportedHandlerTailStreamHandler<Env>;
|
|
519
|
-
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
520
|
-
test?: ExportedHandlerTestHandler<Env>;
|
|
521
|
-
email?: EmailExportedHandler<Env>;
|
|
522
|
-
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
|
|
524
|
+
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
|
|
525
|
+
tail?: ExportedHandlerTailHandler<Env, Props>;
|
|
526
|
+
trace?: ExportedHandlerTraceHandler<Env, Props>;
|
|
527
|
+
tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
|
|
528
|
+
scheduled?: ExportedHandlerScheduledHandler<Env, Props>;
|
|
529
|
+
test?: ExportedHandlerTestHandler<Env, Props>;
|
|
530
|
+
email?: EmailExportedHandler<Env, Props>;
|
|
531
|
+
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;
|
|
523
532
|
}
|
|
524
533
|
interface StructuredSerializeOptions {
|
|
525
534
|
transfer?: any[];
|
|
@@ -3529,7 +3538,7 @@ declare var WebSocket: {
|
|
|
3529
3538
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
|
|
3530
3539
|
*/
|
|
3531
3540
|
interface WebSocket extends EventTarget<WebSocketEventMap> {
|
|
3532
|
-
accept(): void;
|
|
3541
|
+
accept(options?: WebSocketAcceptOptions): void;
|
|
3533
3542
|
/**
|
|
3534
3543
|
* The **`WebSocket.send()`** method enqueues the specified data to be transmitted to the server over the WebSocket connection, increasing the value of `bufferedAmount` by the number of bytes needed to contain the data.
|
|
3535
3544
|
*
|
|
@@ -3575,6 +3584,16 @@ interface WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
3575
3584
|
*/
|
|
3576
3585
|
binaryType: "blob" | "arraybuffer";
|
|
3577
3586
|
}
|
|
3587
|
+
interface WebSocketAcceptOptions {
|
|
3588
|
+
/**
|
|
3589
|
+
* When set to `true`, receiving a server-initiated WebSocket Close frame will not
|
|
3590
|
+
* automatically send a reciprocal Close frame, leaving the connection in a half-open
|
|
3591
|
+
* state. This is useful for proxying scenarios where you need to coordinate closing
|
|
3592
|
+
* both sides independently. Defaults to `false` when the
|
|
3593
|
+
* `no_web_socket_half_open_by_default` compatibility flag is enabled.
|
|
3594
|
+
*/
|
|
3595
|
+
allowHalfOpen?: boolean;
|
|
3596
|
+
}
|
|
3578
3597
|
declare const WebSocketPair: {
|
|
3579
3598
|
new (): {
|
|
3580
3599
|
0: WebSocket;
|
|
@@ -3698,6 +3717,8 @@ interface Container {
|
|
|
3698
3717
|
signal(signo: number): void;
|
|
3699
3718
|
getTcpPort(port: number): Fetcher;
|
|
3700
3719
|
setInactivityTimeout(durationMs: number | bigint): Promise<void>;
|
|
3720
|
+
interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
|
|
3721
|
+
interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
|
|
3701
3722
|
}
|
|
3702
3723
|
interface ContainerStartupOptions {
|
|
3703
3724
|
entrypoint?: string[];
|
|
@@ -11066,10 +11087,10 @@ interface SendEmail {
|
|
|
11066
11087
|
declare abstract class EmailEvent extends ExtendableEvent {
|
|
11067
11088
|
readonly message: ForwardableEmailMessage;
|
|
11068
11089
|
}
|
|
11069
|
-
declare type EmailExportedHandler<Env = unknown> = (
|
|
11090
|
+
declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
|
|
11070
11091
|
message: ForwardableEmailMessage,
|
|
11071
11092
|
env: Env,
|
|
11072
|
-
ctx: ExecutionContext
|
|
11093
|
+
ctx: ExecutionContext<Props>,
|
|
11073
11094
|
) => void | Promise<void>;
|
|
11074
11095
|
declare module "cloudflare:email" {
|
|
11075
11096
|
let _EmailMessage: {
|