@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.
@@ -477,54 +477,60 @@ export interface ExecutionContext<Props = unknown> {
477
477
  export type ExportedHandlerFetchHandler<
478
478
  Env = unknown,
479
479
  CfHostMetadata = unknown,
480
+ Props = unknown,
480
481
  > = (
481
482
  request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
482
483
  env: Env,
483
- ctx: ExecutionContext,
484
+ ctx: ExecutionContext<Props>,
484
485
  ) => Response | Promise<Response>;
485
- export type ExportedHandlerTailHandler<Env = unknown> = (
486
+ export type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (
486
487
  events: TraceItem[],
487
488
  env: Env,
488
- ctx: ExecutionContext,
489
+ ctx: ExecutionContext<Props>,
489
490
  ) => void | Promise<void>;
490
- export type ExportedHandlerTraceHandler<Env = unknown> = (
491
+ export type ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (
491
492
  traces: TraceItem[],
492
493
  env: Env,
493
- ctx: ExecutionContext,
494
+ ctx: ExecutionContext<Props>,
494
495
  ) => void | Promise<void>;
495
- export type ExportedHandlerTailStreamHandler<Env = unknown> = (
496
+ export type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (
496
497
  event: TailStream.TailEvent<TailStream.Onset>,
497
498
  env: Env,
498
- ctx: ExecutionContext,
499
+ ctx: ExecutionContext<Props>,
499
500
  ) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
500
- export type ExportedHandlerScheduledHandler<Env = unknown> = (
501
+ export type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (
501
502
  controller: ScheduledController,
502
503
  env: Env,
503
- ctx: ExecutionContext,
504
+ ctx: ExecutionContext<Props>,
504
505
  ) => void | Promise<void>;
505
- export type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
506
+ export type ExportedHandlerQueueHandler<
507
+ Env = unknown,
508
+ Message = unknown,
509
+ Props = unknown,
510
+ > = (
506
511
  batch: MessageBatch<Message>,
507
512
  env: Env,
508
- ctx: ExecutionContext,
513
+ ctx: ExecutionContext<Props>,
509
514
  ) => void | Promise<void>;
510
- export type ExportedHandlerTestHandler<Env = unknown> = (
515
+ export type ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (
511
516
  controller: TestController,
512
517
  env: Env,
513
- ctx: ExecutionContext,
518
+ ctx: ExecutionContext<Props>,
514
519
  ) => void | Promise<void>;
515
520
  export interface ExportedHandler<
516
521
  Env = unknown,
517
522
  QueueHandlerMessage = unknown,
518
523
  CfHostMetadata = unknown,
524
+ Props = unknown,
519
525
  > {
520
- fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
521
- tail?: ExportedHandlerTailHandler<Env>;
522
- trace?: ExportedHandlerTraceHandler<Env>;
523
- tailStream?: ExportedHandlerTailStreamHandler<Env>;
524
- scheduled?: ExportedHandlerScheduledHandler<Env>;
525
- test?: ExportedHandlerTestHandler<Env>;
526
- email?: EmailExportedHandler<Env>;
527
- queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
526
+ fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
527
+ tail?: ExportedHandlerTailHandler<Env, Props>;
528
+ trace?: ExportedHandlerTraceHandler<Env, Props>;
529
+ tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
530
+ scheduled?: ExportedHandlerScheduledHandler<Env, Props>;
531
+ test?: ExportedHandlerTestHandler<Env, Props>;
532
+ email?: EmailExportedHandler<Env, Props>;
533
+ queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;
528
534
  }
529
535
  export interface StructuredSerializeOptions {
530
536
  transfer?: any[];
@@ -3538,7 +3544,7 @@ export declare var WebSocket: {
3538
3544
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
3539
3545
  */
3540
3546
  export interface WebSocket extends EventTarget<WebSocketEventMap> {
3541
- accept(): void;
3547
+ accept(options?: WebSocketAcceptOptions): void;
3542
3548
  /**
3543
3549
  * 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.
3544
3550
  *
@@ -3584,6 +3590,16 @@ export interface WebSocket extends EventTarget<WebSocketEventMap> {
3584
3590
  */
3585
3591
  binaryType: "blob" | "arraybuffer";
3586
3592
  }
3593
+ export interface WebSocketAcceptOptions {
3594
+ /**
3595
+ * When set to `true`, receiving a server-initiated WebSocket Close frame will not
3596
+ * automatically send a reciprocal Close frame, leaving the connection in a half-open
3597
+ * state. This is useful for proxying scenarios where you need to coordinate closing
3598
+ * both sides independently. Defaults to `false` when the
3599
+ * `no_web_socket_half_open_by_default` compatibility flag is enabled.
3600
+ */
3601
+ allowHalfOpen?: boolean;
3602
+ }
3587
3603
  export declare const WebSocketPair: {
3588
3604
  new (): {
3589
3605
  0: WebSocket;
@@ -3707,6 +3723,8 @@ export interface Container {
3707
3723
  signal(signo: number): void;
3708
3724
  getTcpPort(port: number): Fetcher;
3709
3725
  setInactivityTimeout(durationMs: number | bigint): Promise<void>;
3726
+ interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
3727
+ interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
3710
3728
  }
3711
3729
  export interface ContainerStartupOptions {
3712
3730
  entrypoint?: string[];
@@ -11090,10 +11108,10 @@ export interface SendEmail {
11090
11108
  export declare abstract class EmailEvent extends ExtendableEvent {
11091
11109
  readonly message: ForwardableEmailMessage;
11092
11110
  }
11093
- export declare type EmailExportedHandler<Env = unknown> = (
11111
+ export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
11094
11112
  message: ForwardableEmailMessage,
11095
11113
  env: Env,
11096
- ctx: ExecutionContext,
11114
+ ctx: ExecutionContext<Props>,
11097
11115
  ) => void | Promise<void>;
11098
11116
  /**
11099
11117
  * Hello World binding to serve as an explanatory example. DO NOT USE
@@ -472,54 +472,63 @@ interface ExecutionContext<Props = unknown> {
472
472
  passThroughOnException(): void;
473
473
  readonly props: Props;
474
474
  }
475
- type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown> = (
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<Env = unknown, Message = unknown> = (
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[];
@@ -3530,7 +3539,7 @@ declare var WebSocket: {
3530
3539
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
3531
3540
  */
3532
3541
  interface WebSocket extends EventTarget<WebSocketEventMap> {
3533
- accept(): void;
3542
+ accept(options?: WebSocketAcceptOptions): void;
3534
3543
  /**
3535
3544
  * 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
3545
  *
@@ -3576,6 +3585,16 @@ interface WebSocket extends EventTarget<WebSocketEventMap> {
3576
3585
  */
3577
3586
  binaryType: "blob" | "arraybuffer";
3578
3587
  }
3588
+ interface WebSocketAcceptOptions {
3589
+ /**
3590
+ * When set to `true`, receiving a server-initiated WebSocket Close frame will not
3591
+ * automatically send a reciprocal Close frame, leaving the connection in a half-open
3592
+ * state. This is useful for proxying scenarios where you need to coordinate closing
3593
+ * both sides independently. Defaults to `false` when the
3594
+ * `no_web_socket_half_open_by_default` compatibility flag is enabled.
3595
+ */
3596
+ allowHalfOpen?: boolean;
3597
+ }
3579
3598
  declare const WebSocketPair: {
3580
3599
  new (): {
3581
3600
  0: WebSocket;
@@ -3699,6 +3718,8 @@ interface Container {
3699
3718
  signal(signo: number): void;
3700
3719
  getTcpPort(port: number): Fetcher;
3701
3720
  setInactivityTimeout(durationMs: number | bigint): Promise<void>;
3721
+ interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
3722
+ interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
3702
3723
  }
3703
3724
  interface ContainerStartupOptions {
3704
3725
  entrypoint?: string[];
@@ -11067,10 +11088,10 @@ interface SendEmail {
11067
11088
  declare abstract class EmailEvent extends ExtendableEvent {
11068
11089
  readonly message: ForwardableEmailMessage;
11069
11090
  }
11070
- declare type EmailExportedHandler<Env = unknown> = (
11091
+ declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
11071
11092
  message: ForwardableEmailMessage,
11072
11093
  env: Env,
11073
- ctx: ExecutionContext,
11094
+ ctx: ExecutionContext<Props>,
11074
11095
  ) => void | Promise<void>;
11075
11096
  declare module "cloudflare:email" {
11076
11097
  let _EmailMessage: {
@@ -477,54 +477,60 @@ export interface ExecutionContext<Props = unknown> {
477
477
  export type ExportedHandlerFetchHandler<
478
478
  Env = unknown,
479
479
  CfHostMetadata = unknown,
480
+ Props = unknown,
480
481
  > = (
481
482
  request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
482
483
  env: Env,
483
- ctx: ExecutionContext,
484
+ ctx: ExecutionContext<Props>,
484
485
  ) => Response | Promise<Response>;
485
- export type ExportedHandlerTailHandler<Env = unknown> = (
486
+ export type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (
486
487
  events: TraceItem[],
487
488
  env: Env,
488
- ctx: ExecutionContext,
489
+ ctx: ExecutionContext<Props>,
489
490
  ) => void | Promise<void>;
490
- export type ExportedHandlerTraceHandler<Env = unknown> = (
491
+ export type ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (
491
492
  traces: TraceItem[],
492
493
  env: Env,
493
- ctx: ExecutionContext,
494
+ ctx: ExecutionContext<Props>,
494
495
  ) => void | Promise<void>;
495
- export type ExportedHandlerTailStreamHandler<Env = unknown> = (
496
+ export type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (
496
497
  event: TailStream.TailEvent<TailStream.Onset>,
497
498
  env: Env,
498
- ctx: ExecutionContext,
499
+ ctx: ExecutionContext<Props>,
499
500
  ) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
500
- export type ExportedHandlerScheduledHandler<Env = unknown> = (
501
+ export type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (
501
502
  controller: ScheduledController,
502
503
  env: Env,
503
- ctx: ExecutionContext,
504
+ ctx: ExecutionContext<Props>,
504
505
  ) => void | Promise<void>;
505
- export type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
506
+ export type ExportedHandlerQueueHandler<
507
+ Env = unknown,
508
+ Message = unknown,
509
+ Props = unknown,
510
+ > = (
506
511
  batch: MessageBatch<Message>,
507
512
  env: Env,
508
- ctx: ExecutionContext,
513
+ ctx: ExecutionContext<Props>,
509
514
  ) => void | Promise<void>;
510
- export type ExportedHandlerTestHandler<Env = unknown> = (
515
+ export type ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (
511
516
  controller: TestController,
512
517
  env: Env,
513
- ctx: ExecutionContext,
518
+ ctx: ExecutionContext<Props>,
514
519
  ) => void | Promise<void>;
515
520
  export interface ExportedHandler<
516
521
  Env = unknown,
517
522
  QueueHandlerMessage = unknown,
518
523
  CfHostMetadata = unknown,
524
+ Props = unknown,
519
525
  > {
520
- fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
521
- tail?: ExportedHandlerTailHandler<Env>;
522
- trace?: ExportedHandlerTraceHandler<Env>;
523
- tailStream?: ExportedHandlerTailStreamHandler<Env>;
524
- scheduled?: ExportedHandlerScheduledHandler<Env>;
525
- test?: ExportedHandlerTestHandler<Env>;
526
- email?: EmailExportedHandler<Env>;
527
- queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
526
+ fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
527
+ tail?: ExportedHandlerTailHandler<Env, Props>;
528
+ trace?: ExportedHandlerTraceHandler<Env, Props>;
529
+ tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
530
+ scheduled?: ExportedHandlerScheduledHandler<Env, Props>;
531
+ test?: ExportedHandlerTestHandler<Env, Props>;
532
+ email?: EmailExportedHandler<Env, Props>;
533
+ queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;
528
534
  }
529
535
  export interface StructuredSerializeOptions {
530
536
  transfer?: any[];
@@ -3539,7 +3545,7 @@ export declare var WebSocket: {
3539
3545
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
3540
3546
  */
3541
3547
  export interface WebSocket extends EventTarget<WebSocketEventMap> {
3542
- accept(): void;
3548
+ accept(options?: WebSocketAcceptOptions): void;
3543
3549
  /**
3544
3550
  * 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.
3545
3551
  *
@@ -3585,6 +3591,16 @@ export interface WebSocket extends EventTarget<WebSocketEventMap> {
3585
3591
  */
3586
3592
  binaryType: "blob" | "arraybuffer";
3587
3593
  }
3594
+ export interface WebSocketAcceptOptions {
3595
+ /**
3596
+ * When set to `true`, receiving a server-initiated WebSocket Close frame will not
3597
+ * automatically send a reciprocal Close frame, leaving the connection in a half-open
3598
+ * state. This is useful for proxying scenarios where you need to coordinate closing
3599
+ * both sides independently. Defaults to `false` when the
3600
+ * `no_web_socket_half_open_by_default` compatibility flag is enabled.
3601
+ */
3602
+ allowHalfOpen?: boolean;
3603
+ }
3588
3604
  export declare const WebSocketPair: {
3589
3605
  new (): {
3590
3606
  0: WebSocket;
@@ -3708,6 +3724,8 @@ export interface Container {
3708
3724
  signal(signo: number): void;
3709
3725
  getTcpPort(port: number): Fetcher;
3710
3726
  setInactivityTimeout(durationMs: number | bigint): Promise<void>;
3727
+ interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
3728
+ interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
3711
3729
  }
3712
3730
  export interface ContainerStartupOptions {
3713
3731
  entrypoint?: string[];
@@ -11091,10 +11109,10 @@ export interface SendEmail {
11091
11109
  export declare abstract class EmailEvent extends ExtendableEvent {
11092
11110
  readonly message: ForwardableEmailMessage;
11093
11111
  }
11094
- export declare type EmailExportedHandler<Env = unknown> = (
11112
+ export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
11095
11113
  message: ForwardableEmailMessage,
11096
11114
  env: Env,
11097
- ctx: ExecutionContext,
11115
+ ctx: ExecutionContext<Props>,
11098
11116
  ) => void | Promise<void>;
11099
11117
  /**
11100
11118
  * Hello World binding to serve as an explanatory example. DO NOT USE
@@ -472,54 +472,63 @@ interface ExecutionContext<Props = unknown> {
472
472
  passThroughOnException(): void;
473
473
  readonly props: Props;
474
474
  }
475
- type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown> = (
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<Env = unknown, Message = unknown> = (
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[];
@@ -3550,7 +3559,7 @@ declare var WebSocket: {
3550
3559
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
3551
3560
  */
3552
3561
  interface WebSocket extends EventTarget<WebSocketEventMap> {
3553
- accept(): void;
3562
+ accept(options?: WebSocketAcceptOptions): void;
3554
3563
  /**
3555
3564
  * 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.
3556
3565
  *
@@ -3596,6 +3605,16 @@ interface WebSocket extends EventTarget<WebSocketEventMap> {
3596
3605
  */
3597
3606
  binaryType: "blob" | "arraybuffer";
3598
3607
  }
3608
+ interface WebSocketAcceptOptions {
3609
+ /**
3610
+ * When set to `true`, receiving a server-initiated WebSocket Close frame will not
3611
+ * automatically send a reciprocal Close frame, leaving the connection in a half-open
3612
+ * state. This is useful for proxying scenarios where you need to coordinate closing
3613
+ * both sides independently. Defaults to `false` when the
3614
+ * `no_web_socket_half_open_by_default` compatibility flag is enabled.
3615
+ */
3616
+ allowHalfOpen?: boolean;
3617
+ }
3599
3618
  declare const WebSocketPair: {
3600
3619
  new (): {
3601
3620
  0: WebSocket;
@@ -3719,6 +3738,8 @@ interface Container {
3719
3738
  signal(signo: number): void;
3720
3739
  getTcpPort(port: number): Fetcher;
3721
3740
  setInactivityTimeout(durationMs: number | bigint): Promise<void>;
3741
+ interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
3742
+ interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
3722
3743
  }
3723
3744
  interface ContainerStartupOptions {
3724
3745
  entrypoint?: string[];
@@ -11087,10 +11108,10 @@ interface SendEmail {
11087
11108
  declare abstract class EmailEvent extends ExtendableEvent {
11088
11109
  readonly message: ForwardableEmailMessage;
11089
11110
  }
11090
- declare type EmailExportedHandler<Env = unknown> = (
11111
+ declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
11091
11112
  message: ForwardableEmailMessage,
11092
11113
  env: Env,
11093
- ctx: ExecutionContext,
11114
+ ctx: ExecutionContext<Props>,
11094
11115
  ) => void | Promise<void>;
11095
11116
  declare module "cloudflare:email" {
11096
11117
  let _EmailMessage: {
@@ -477,54 +477,60 @@ export interface ExecutionContext<Props = unknown> {
477
477
  export type ExportedHandlerFetchHandler<
478
478
  Env = unknown,
479
479
  CfHostMetadata = unknown,
480
+ Props = unknown,
480
481
  > = (
481
482
  request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
482
483
  env: Env,
483
- ctx: ExecutionContext,
484
+ ctx: ExecutionContext<Props>,
484
485
  ) => Response | Promise<Response>;
485
- export type ExportedHandlerTailHandler<Env = unknown> = (
486
+ export type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (
486
487
  events: TraceItem[],
487
488
  env: Env,
488
- ctx: ExecutionContext,
489
+ ctx: ExecutionContext<Props>,
489
490
  ) => void | Promise<void>;
490
- export type ExportedHandlerTraceHandler<Env = unknown> = (
491
+ export type ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (
491
492
  traces: TraceItem[],
492
493
  env: Env,
493
- ctx: ExecutionContext,
494
+ ctx: ExecutionContext<Props>,
494
495
  ) => void | Promise<void>;
495
- export type ExportedHandlerTailStreamHandler<Env = unknown> = (
496
+ export type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (
496
497
  event: TailStream.TailEvent<TailStream.Onset>,
497
498
  env: Env,
498
- ctx: ExecutionContext,
499
+ ctx: ExecutionContext<Props>,
499
500
  ) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
500
- export type ExportedHandlerScheduledHandler<Env = unknown> = (
501
+ export type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (
501
502
  controller: ScheduledController,
502
503
  env: Env,
503
- ctx: ExecutionContext,
504
+ ctx: ExecutionContext<Props>,
504
505
  ) => void | Promise<void>;
505
- export type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
506
+ export type ExportedHandlerQueueHandler<
507
+ Env = unknown,
508
+ Message = unknown,
509
+ Props = unknown,
510
+ > = (
506
511
  batch: MessageBatch<Message>,
507
512
  env: Env,
508
- ctx: ExecutionContext,
513
+ ctx: ExecutionContext<Props>,
509
514
  ) => void | Promise<void>;
510
- export type ExportedHandlerTestHandler<Env = unknown> = (
515
+ export type ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (
511
516
  controller: TestController,
512
517
  env: Env,
513
- ctx: ExecutionContext,
518
+ ctx: ExecutionContext<Props>,
514
519
  ) => void | Promise<void>;
515
520
  export interface ExportedHandler<
516
521
  Env = unknown,
517
522
  QueueHandlerMessage = unknown,
518
523
  CfHostMetadata = unknown,
524
+ Props = unknown,
519
525
  > {
520
- fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
521
- tail?: ExportedHandlerTailHandler<Env>;
522
- trace?: ExportedHandlerTraceHandler<Env>;
523
- tailStream?: ExportedHandlerTailStreamHandler<Env>;
524
- scheduled?: ExportedHandlerScheduledHandler<Env>;
525
- test?: ExportedHandlerTestHandler<Env>;
526
- email?: EmailExportedHandler<Env>;
527
- queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
526
+ fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
527
+ tail?: ExportedHandlerTailHandler<Env, Props>;
528
+ trace?: ExportedHandlerTraceHandler<Env, Props>;
529
+ tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
530
+ scheduled?: ExportedHandlerScheduledHandler<Env, Props>;
531
+ test?: ExportedHandlerTestHandler<Env, Props>;
532
+ email?: EmailExportedHandler<Env, Props>;
533
+ queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;
528
534
  }
529
535
  export interface StructuredSerializeOptions {
530
536
  transfer?: any[];
@@ -3559,7 +3565,7 @@ export declare var WebSocket: {
3559
3565
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
3560
3566
  */
3561
3567
  export interface WebSocket extends EventTarget<WebSocketEventMap> {
3562
- accept(): void;
3568
+ accept(options?: WebSocketAcceptOptions): void;
3563
3569
  /**
3564
3570
  * 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.
3565
3571
  *
@@ -3605,6 +3611,16 @@ export interface WebSocket extends EventTarget<WebSocketEventMap> {
3605
3611
  */
3606
3612
  binaryType: "blob" | "arraybuffer";
3607
3613
  }
3614
+ export interface WebSocketAcceptOptions {
3615
+ /**
3616
+ * When set to `true`, receiving a server-initiated WebSocket Close frame will not
3617
+ * automatically send a reciprocal Close frame, leaving the connection in a half-open
3618
+ * state. This is useful for proxying scenarios where you need to coordinate closing
3619
+ * both sides independently. Defaults to `false` when the
3620
+ * `no_web_socket_half_open_by_default` compatibility flag is enabled.
3621
+ */
3622
+ allowHalfOpen?: boolean;
3623
+ }
3608
3624
  export declare const WebSocketPair: {
3609
3625
  new (): {
3610
3626
  0: WebSocket;
@@ -3728,6 +3744,8 @@ export interface Container {
3728
3744
  signal(signo: number): void;
3729
3745
  getTcpPort(port: number): Fetcher;
3730
3746
  setInactivityTimeout(durationMs: number | bigint): Promise<void>;
3747
+ interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
3748
+ interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
3731
3749
  }
3732
3750
  export interface ContainerStartupOptions {
3733
3751
  entrypoint?: string[];
@@ -11111,10 +11129,10 @@ export interface SendEmail {
11111
11129
  export declare abstract class EmailEvent extends ExtendableEvent {
11112
11130
  readonly message: ForwardableEmailMessage;
11113
11131
  }
11114
- export declare type EmailExportedHandler<Env = unknown> = (
11132
+ export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
11115
11133
  message: ForwardableEmailMessage,
11116
11134
  env: Env,
11117
- ctx: ExecutionContext,
11135
+ ctx: ExecutionContext<Props>,
11118
11136
  ) => void | Promise<void>;
11119
11137
  /**
11120
11138
  * Hello World binding to serve as an explanatory example. DO NOT USE