@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/latest/index.d.ts CHANGED
@@ -480,54 +480,63 @@ interface ExecutionContext<Props = unknown> {
480
480
  readonly exports: Cloudflare.Exports;
481
481
  readonly props: Props;
482
482
  }
483
- type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown> = (
483
+ type ExportedHandlerFetchHandler<
484
+ Env = unknown,
485
+ CfHostMetadata = unknown,
486
+ Props = unknown,
487
+ > = (
484
488
  request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
485
489
  env: Env,
486
- ctx: ExecutionContext,
490
+ ctx: ExecutionContext<Props>,
487
491
  ) => Response | Promise<Response>;
488
- type ExportedHandlerTailHandler<Env = unknown> = (
492
+ type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (
489
493
  events: TraceItem[],
490
494
  env: Env,
491
- ctx: ExecutionContext,
495
+ ctx: ExecutionContext<Props>,
492
496
  ) => void | Promise<void>;
493
- type ExportedHandlerTraceHandler<Env = unknown> = (
497
+ type ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (
494
498
  traces: TraceItem[],
495
499
  env: Env,
496
- ctx: ExecutionContext,
500
+ ctx: ExecutionContext<Props>,
497
501
  ) => void | Promise<void>;
498
- type ExportedHandlerTailStreamHandler<Env = unknown> = (
502
+ type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (
499
503
  event: TailStream.TailEvent<TailStream.Onset>,
500
504
  env: Env,
501
- ctx: ExecutionContext,
505
+ ctx: ExecutionContext<Props>,
502
506
  ) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
503
- type ExportedHandlerScheduledHandler<Env = unknown> = (
507
+ type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (
504
508
  controller: ScheduledController,
505
509
  env: Env,
506
- ctx: ExecutionContext,
510
+ ctx: ExecutionContext<Props>,
507
511
  ) => void | Promise<void>;
508
- type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
512
+ type ExportedHandlerQueueHandler<
513
+ Env = unknown,
514
+ Message = unknown,
515
+ Props = unknown,
516
+ > = (
509
517
  batch: MessageBatch<Message>,
510
518
  env: Env,
511
- ctx: ExecutionContext,
519
+ ctx: ExecutionContext<Props>,
512
520
  ) => void | Promise<void>;
513
- type ExportedHandlerTestHandler<Env = unknown> = (
521
+ type ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (
514
522
  controller: TestController,
515
523
  env: Env,
516
- ctx: ExecutionContext,
524
+ ctx: ExecutionContext<Props>,
517
525
  ) => void | Promise<void>;
518
526
  interface ExportedHandler<
519
527
  Env = unknown,
520
528
  QueueHandlerMessage = unknown,
521
529
  CfHostMetadata = unknown,
530
+ Props = unknown,
522
531
  > {
523
- fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
524
- tail?: ExportedHandlerTailHandler<Env>;
525
- trace?: ExportedHandlerTraceHandler<Env>;
526
- tailStream?: ExportedHandlerTailStreamHandler<Env>;
527
- scheduled?: ExportedHandlerScheduledHandler<Env>;
528
- test?: ExportedHandlerTestHandler<Env>;
529
- email?: EmailExportedHandler<Env>;
530
- queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
532
+ fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
533
+ tail?: ExportedHandlerTailHandler<Env, Props>;
534
+ trace?: ExportedHandlerTraceHandler<Env, Props>;
535
+ tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
536
+ scheduled?: ExportedHandlerScheduledHandler<Env, Props>;
537
+ test?: ExportedHandlerTestHandler<Env, Props>;
538
+ email?: EmailExportedHandler<Env, Props>;
539
+ queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;
531
540
  }
532
541
  interface StructuredSerializeOptions {
533
542
  transfer?: any[];
@@ -3574,7 +3583,7 @@ declare var WebSocket: {
3574
3583
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
3575
3584
  */
3576
3585
  interface WebSocket extends EventTarget<WebSocketEventMap> {
3577
- accept(): void;
3586
+ accept(options?: WebSocketAcceptOptions): void;
3578
3587
  /**
3579
3588
  * 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.
3580
3589
  *
@@ -3620,6 +3629,16 @@ interface WebSocket extends EventTarget<WebSocketEventMap> {
3620
3629
  */
3621
3630
  binaryType: "blob" | "arraybuffer";
3622
3631
  }
3632
+ interface WebSocketAcceptOptions {
3633
+ /**
3634
+ * When set to `true`, receiving a server-initiated WebSocket Close frame will not
3635
+ * automatically send a reciprocal Close frame, leaving the connection in a half-open
3636
+ * state. This is useful for proxying scenarios where you need to coordinate closing
3637
+ * both sides independently. Defaults to `false` when the
3638
+ * `no_web_socket_half_open_by_default` compatibility flag is enabled.
3639
+ */
3640
+ allowHalfOpen?: boolean;
3641
+ }
3623
3642
  declare const WebSocketPair: {
3624
3643
  new (): {
3625
3644
  0: WebSocket;
@@ -3743,6 +3762,8 @@ interface Container {
3743
3762
  signal(signo: number): void;
3744
3763
  getTcpPort(port: number): Fetcher;
3745
3764
  setInactivityTimeout(durationMs: number | bigint): Promise<void>;
3765
+ interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
3766
+ interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
3746
3767
  }
3747
3768
  interface ContainerStartupOptions {
3748
3769
  entrypoint?: string[];
@@ -11131,10 +11152,10 @@ interface SendEmail {
11131
11152
  declare abstract class EmailEvent extends ExtendableEvent {
11132
11153
  readonly message: ForwardableEmailMessage;
11133
11154
  }
11134
- declare type EmailExportedHandler<Env = unknown> = (
11155
+ declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
11135
11156
  message: ForwardableEmailMessage,
11136
11157
  env: Env,
11137
- ctx: ExecutionContext,
11158
+ ctx: ExecutionContext<Props>,
11138
11159
  ) => void | Promise<void>;
11139
11160
  declare module "cloudflare:email" {
11140
11161
  let _EmailMessage: {
package/latest/index.ts CHANGED
@@ -485,54 +485,60 @@ export interface ExecutionContext<Props = unknown> {
485
485
  export type ExportedHandlerFetchHandler<
486
486
  Env = unknown,
487
487
  CfHostMetadata = unknown,
488
+ Props = unknown,
488
489
  > = (
489
490
  request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
490
491
  env: Env,
491
- ctx: ExecutionContext,
492
+ ctx: ExecutionContext<Props>,
492
493
  ) => Response | Promise<Response>;
493
- export type ExportedHandlerTailHandler<Env = unknown> = (
494
+ export type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (
494
495
  events: TraceItem[],
495
496
  env: Env,
496
- ctx: ExecutionContext,
497
+ ctx: ExecutionContext<Props>,
497
498
  ) => void | Promise<void>;
498
- export type ExportedHandlerTraceHandler<Env = unknown> = (
499
+ export type ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (
499
500
  traces: TraceItem[],
500
501
  env: Env,
501
- ctx: ExecutionContext,
502
+ ctx: ExecutionContext<Props>,
502
503
  ) => void | Promise<void>;
503
- export type ExportedHandlerTailStreamHandler<Env = unknown> = (
504
+ export type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (
504
505
  event: TailStream.TailEvent<TailStream.Onset>,
505
506
  env: Env,
506
- ctx: ExecutionContext,
507
+ ctx: ExecutionContext<Props>,
507
508
  ) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
508
- export type ExportedHandlerScheduledHandler<Env = unknown> = (
509
+ export type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (
509
510
  controller: ScheduledController,
510
511
  env: Env,
511
- ctx: ExecutionContext,
512
+ ctx: ExecutionContext<Props>,
512
513
  ) => void | Promise<void>;
513
- export type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
514
+ export type ExportedHandlerQueueHandler<
515
+ Env = unknown,
516
+ Message = unknown,
517
+ Props = unknown,
518
+ > = (
514
519
  batch: MessageBatch<Message>,
515
520
  env: Env,
516
- ctx: ExecutionContext,
521
+ ctx: ExecutionContext<Props>,
517
522
  ) => void | Promise<void>;
518
- export type ExportedHandlerTestHandler<Env = unknown> = (
523
+ export type ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (
519
524
  controller: TestController,
520
525
  env: Env,
521
- ctx: ExecutionContext,
526
+ ctx: ExecutionContext<Props>,
522
527
  ) => void | Promise<void>;
523
528
  export interface ExportedHandler<
524
529
  Env = unknown,
525
530
  QueueHandlerMessage = unknown,
526
531
  CfHostMetadata = unknown,
532
+ Props = unknown,
527
533
  > {
528
- fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
529
- tail?: ExportedHandlerTailHandler<Env>;
530
- trace?: ExportedHandlerTraceHandler<Env>;
531
- tailStream?: ExportedHandlerTailStreamHandler<Env>;
532
- scheduled?: ExportedHandlerScheduledHandler<Env>;
533
- test?: ExportedHandlerTestHandler<Env>;
534
- email?: EmailExportedHandler<Env>;
535
- queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
534
+ fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
535
+ tail?: ExportedHandlerTailHandler<Env, Props>;
536
+ trace?: ExportedHandlerTraceHandler<Env, Props>;
537
+ tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
538
+ scheduled?: ExportedHandlerScheduledHandler<Env, Props>;
539
+ test?: ExportedHandlerTestHandler<Env, Props>;
540
+ email?: EmailExportedHandler<Env, Props>;
541
+ queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;
536
542
  }
537
543
  export interface StructuredSerializeOptions {
538
544
  transfer?: any[];
@@ -3583,7 +3589,7 @@ export declare var WebSocket: {
3583
3589
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
3584
3590
  */
3585
3591
  export interface WebSocket extends EventTarget<WebSocketEventMap> {
3586
- accept(): void;
3592
+ accept(options?: WebSocketAcceptOptions): void;
3587
3593
  /**
3588
3594
  * 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.
3589
3595
  *
@@ -3629,6 +3635,16 @@ export interface WebSocket extends EventTarget<WebSocketEventMap> {
3629
3635
  */
3630
3636
  binaryType: "blob" | "arraybuffer";
3631
3637
  }
3638
+ export interface WebSocketAcceptOptions {
3639
+ /**
3640
+ * When set to `true`, receiving a server-initiated WebSocket Close frame will not
3641
+ * automatically send a reciprocal Close frame, leaving the connection in a half-open
3642
+ * state. This is useful for proxying scenarios where you need to coordinate closing
3643
+ * both sides independently. Defaults to `false` when the
3644
+ * `no_web_socket_half_open_by_default` compatibility flag is enabled.
3645
+ */
3646
+ allowHalfOpen?: boolean;
3647
+ }
3632
3648
  export declare const WebSocketPair: {
3633
3649
  new (): {
3634
3650
  0: WebSocket;
@@ -3752,6 +3768,8 @@ export interface Container {
3752
3768
  signal(signo: number): void;
3753
3769
  getTcpPort(port: number): Fetcher;
3754
3770
  setInactivityTimeout(durationMs: number | bigint): Promise<void>;
3771
+ interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
3772
+ interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
3755
3773
  }
3756
3774
  export interface ContainerStartupOptions {
3757
3775
  entrypoint?: string[];
@@ -11155,10 +11173,10 @@ export interface SendEmail {
11155
11173
  export declare abstract class EmailEvent extends ExtendableEvent {
11156
11174
  readonly message: ForwardableEmailMessage;
11157
11175
  }
11158
- export declare type EmailExportedHandler<Env = unknown> = (
11176
+ export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
11159
11177
  message: ForwardableEmailMessage,
11160
11178
  env: Env,
11161
- ctx: ExecutionContext,
11179
+ ctx: ExecutionContext<Props>,
11162
11180
  ) => void | Promise<void>;
11163
11181
  /**
11164
11182
  * Hello World binding to serve as an explanatory example. DO NOT USE
package/oldest/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<Env = unknown, CfHostMetadata = unknown> = (
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<Env = unknown, Message = unknown> = (
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/oldest/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<Env = unknown, Message = unknown> = (
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/package.json CHANGED
@@ -7,5 +7,5 @@
7
7
  },
8
8
  "author": "Cloudflare Workers DevProd Team <workers-devprod@cloudflare.com> (https://workers.cloudflare.com)",
9
9
  "license": "MIT OR Apache-2.0",
10
- "version": "4.20260307.1"
10
+ "version": "4.20260312.1"
11
11
  }