react-websocket 4.22.1 → 4.22.3

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.
Files changed (60) hide show
  1. package/dist/ag-ui.cjs +8 -9
  2. package/dist/ag-ui.cjs.map +1 -1
  3. package/dist/ag-ui.d.cts +3 -8
  4. package/dist/ag-ui.d.ts +0 -2
  5. package/dist/ag-ui.js +8 -9
  6. package/dist/ag-ui.js.map +1 -1
  7. package/dist/chaos.cjs +60 -13
  8. package/dist/chaos.cjs.map +1 -1
  9. package/dist/chaos.d.cts +1 -2
  10. package/dist/chaos.d.ts +1 -2
  11. package/dist/chaos.js +60 -13
  12. package/dist/chaos.js.map +1 -1
  13. package/dist/core.cjs +93 -65
  14. package/dist/core.cjs.map +1 -1
  15. package/dist/core.d.cts +4 -25
  16. package/dist/core.d.ts +4 -25
  17. package/dist/core.js +93 -65
  18. package/dist/core.js.map +1 -1
  19. package/dist/devtools.cjs +1 -2
  20. package/dist/devtools.d.cts +0 -2
  21. package/dist/devtools.d.ts +0 -2
  22. package/dist/devtools.js +1 -2
  23. package/dist/index.cjs +1 -2
  24. package/dist/index.d.cts +4 -31
  25. package/dist/index.d.ts +3 -24
  26. package/dist/index.development.cjs +1 -2
  27. package/dist/index.development.js +1 -2
  28. package/dist/index.js +1 -2
  29. package/dist/outbox.cjs +15 -10
  30. package/dist/outbox.cjs.map +1 -1
  31. package/dist/outbox.d.cts +1 -3
  32. package/dist/outbox.d.ts +0 -2
  33. package/dist/outbox.js +15 -10
  34. package/dist/outbox.js.map +1 -1
  35. package/dist/replay.cjs +13 -9
  36. package/dist/replay.cjs.map +1 -1
  37. package/dist/replay.d.cts +8 -4
  38. package/dist/replay.d.ts +8 -4
  39. package/dist/replay.js +13 -9
  40. package/dist/replay.js.map +1 -1
  41. package/dist/tabs.cjs +12 -16
  42. package/dist/tabs.cjs.map +1 -1
  43. package/dist/tabs.d.cts +0 -2
  44. package/dist/tabs.d.ts +0 -2
  45. package/dist/tabs.js +12 -16
  46. package/dist/tabs.js.map +1 -1
  47. package/dist/timeline.cjs +4 -3
  48. package/dist/timeline.cjs.map +1 -1
  49. package/dist/timeline.d.cts +3 -7
  50. package/dist/timeline.d.ts +2 -4
  51. package/dist/timeline.js +4 -3
  52. package/dist/timeline.js.map +1 -1
  53. package/dist/{types-paLT8yQF.d.cts → types-DyZm2F7B.d.cts} +4 -5
  54. package/dist/webtransport.cjs +13 -12
  55. package/dist/webtransport.cjs.map +1 -1
  56. package/dist/webtransport.d.cts +0 -2
  57. package/dist/webtransport.d.ts +0 -2
  58. package/dist/webtransport.js +13 -12
  59. package/dist/webtransport.js.map +1 -1
  60. package/package.json +9 -9
package/dist/core.d.cts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/types.d.ts
2
1
  /**
3
2
  * Where to connect: a URL, or a function that returns one (sync or async).
4
3
  *
@@ -447,8 +446,9 @@ interface WebSocketClient<In = unknown, Out = unknown> {
447
446
  close(code?: number, reason?: string): void;
448
447
  /**
449
448
  * Drop the current socket (if any) and connect again immediately, resetting the
450
- * backoff. Also restarts a `closed` client. The send queue and a `migrate()` target are
451
- * kept: when another user signs in, call `close()` and then `connect()` instead.
449
+ * backoff. Also restarts a `closed` client: one that `connect()` had started stays connected
450
+ * again until `close()`, even with no hook holding it. The send queue and a `migrate()` target
451
+ * are kept: when another user signs in, call `close()` and then `connect()` instead.
452
452
  */
453
453
  reconnect(): void;
454
454
  /**
@@ -480,8 +480,6 @@ interface WebSocketClient<In = unknown, Out = unknown> {
480
480
  */
481
481
  acquire(): () => void;
482
482
  }
483
- //#endregion
484
- //#region src/client.d.ts
485
483
  /**
486
484
  * The default `reconnect.shouldReconnect`: retry every close except `1002` (protocol error),
487
485
  * `1003` (unsupported data) and `1008` (policy violation, often a rejected login), which
@@ -530,8 +528,6 @@ export declare function retryAfter(close: CloseInfo): number | undefined;
530
528
  * ```
531
529
  */
532
530
  export declare function createWebSocket<In = unknown, Out = unknown>(url: UrlSource, options?: WebSocketOptions<In, Out>): WebSocketClient<In, Out>;
533
- //#endregion
534
- //#region src/topics.d.ts
535
531
  /** @internal Option key for a callback run when nothing holds a topic anymore. Used by feeds. */
536
532
  declare const ON_RELEASE: unique symbol;
537
533
  /** Options for {@link createWebSocketTopics}: the messages your server expects. */
@@ -580,8 +576,6 @@ interface WebSocketTopics {
580
576
  export declare function createWebSocketTopics<const Out>(client: WebSocketClient<any, Out>, options: WebSocketTopicsOptions<NoInfer<Out>> & {
581
577
  [ON_RELEASE]?: (topic: string) => void;
582
578
  }): WebSocketTopics;
583
- //#endregion
584
- //#region src/feeds.d.ts
585
579
  /** Where a numbered message belongs: its topic, and its sequence number in that topic. */
586
580
  interface FeedPosition {
587
581
  readonly topic: string;
@@ -661,8 +655,6 @@ interface WebSocketFeeds<In> extends WebSocketTopics {
661
655
  * ```
662
656
  */
663
657
  export declare function createWebSocketFeeds<In, const Out>(client: WebSocketClient<In, Out>, options: WebSocketFeedsOptions<NoInfer<In>, NoInfer<Out>>): WebSocketFeeds<In>;
664
- //#endregion
665
- //#region src/latency.d.ts
666
658
  /** Options for {@link createWebSocketLatency}: how pings and pongs look on the wire. */
667
659
  interface WebSocketLatencyOptions<In, Out> {
668
660
  /** The ping message, tagged with `id`. Sent with `volatile`, so pings are never queued. */
@@ -738,8 +730,6 @@ interface WebSocketLatency {
738
730
  * ```
739
731
  */
740
732
  export declare function createWebSocketLatency<In, const Out>(client: WebSocketClient<In, Out>, options: WebSocketLatencyOptions<NoInfer<In>, NoInfer<Out>>): WebSocketLatency;
741
- //#endregion
742
- //#region src/presence.d.ts
743
733
  /** Another client's shared state, such as its cursor or what it's selected. */
744
734
  interface PresencePeer<P> {
745
735
  /** The peer's id, as the server reports it. */
@@ -823,8 +813,6 @@ interface WebSocketPresence<P> {
823
813
  * ```
824
814
  */
825
815
  export declare function createWebSocketPresence<P, In, const Out>(client: WebSocketClient<In, Out>, options: WebSocketPresenceOptions<P, NoInfer<In>, NoInfer<Out>>): WebSocketPresence<P>;
826
- //#endregion
827
- //#region src/requests.d.ts
828
816
  /** Options for {@link createWebSocketRequests}: how requests and replies look on the wire. */
829
817
  interface WebSocketRequestsOptions<Req, In, Out> {
830
818
  /**
@@ -856,7 +844,7 @@ interface WebSocketRequestsOptions<Req, In, Out> {
856
844
  cancel?: (id: number) => Out;
857
845
  /**
858
846
  * Default time to wait for a reply, in ms. For a stream, the time to wait for each reply,
859
- * including the first. `Infinity` waits forever.
847
+ * including the first. `Infinity`, or anything over about 24.8 days, waits forever.
860
848
  * @default 10000
861
849
  */
862
850
  timeout?: number;
@@ -928,8 +916,6 @@ interface WebSocketRequests<Req, In> {
928
916
  * ```
929
917
  */
930
918
  export declare function createWebSocketRequests<Req, In, const Out>(client: WebSocketClient<In, Out>, options: WebSocketRequestsOptions<Req, NoInfer<In>, NoInfer<Out>>): WebSocketRequests<Req, In>;
931
- //#endregion
932
- //#region src/responder.d.ts
933
919
  /** What `request` returns for a request: any object with these fields, such as the message itself. */
934
920
  type RequestFields = {
935
921
  id: number | string;
@@ -1065,8 +1051,6 @@ interface WebSocketResponder<P = unknown, R = unknown> {
1065
1051
  * ```
1066
1052
  */
1067
1053
  export declare function createWebSocketResponder<Q extends RequestFields, R, In, const Out>(client: WebSocketClient<In, Out>, options: WebSocketResponderOptions<Q, R, NoInfer<In>, NoInfer<Out>>): WebSocketResponder<ParamsOf<Q>, R>;
1068
- //#endregion
1069
- //#region src/runs.d.ts
1070
1054
  /**
1071
1055
  * What happens to a run when its connection drops: `keep` resumes it on the next connection,
1072
1056
  * for agents that keep working in the background; `cancel` aborts it and tells the server, for
@@ -1204,8 +1188,6 @@ interface WebSocketRuns<Req, T> {
1204
1188
  * ```
1205
1189
  */
1206
1190
  export declare function createWebSocketRuns<Req, T, In, const Out>(client: WebSocketClient<In, Out>, options: WebSocketRunsOptions<Req, T, NoInfer<In>, NoInfer<Out>>): WebSocketRuns<Req, T>;
1207
- //#endregion
1208
- //#region src/sendrate.d.ts
1209
1191
  /** Options for {@link createWebSocketSendRate}. */
1210
1192
  interface WebSocketSendRateOptions {
1211
1193
  /**
@@ -1283,8 +1265,6 @@ interface WebSocketSendRate<Out> {
1283
1265
  * ```
1284
1266
  */
1285
1267
  export declare function createWebSocketSendRate<Out>(client: WebSocketClient<any, Out>, options?: WebSocketSendRateOptions): WebSocketSendRate<Out>;
1286
- //#endregion
1287
- //#region src/state.d.ts
1288
1268
  /** Options for {@link createWebSocketState}. */
1289
1269
  interface WebSocketStateOptions<S, In> {
1290
1270
  /** The state before any message arrives, and what `reset()` returns to. */
@@ -1359,6 +1339,5 @@ interface WebSocketState<S> {
1359
1339
  * ```
1360
1340
  */
1361
1341
  export declare function createWebSocketState<S, In>(source: WebSocketClient<In, any> | MessageSource<In>, options: WebSocketStateOptions<S, NoInfer<In>>): WebSocketState<S>;
1362
- //#endregion
1363
1342
  export type { AgentRun, CloseInfo, EventMap, FeedPosition, HeartbeatOptions, IncomingRequest, Latency, MessageSource, MigrateOptions, PresencePeer, QueueOptions, ReconnectOptions, RequestHandler, RequestOptions, RunPolicy, RunStatus, RunStorage, SendData, SendOptions, SendRate, Snapshot, StandardSchemaV1, Status, UrlSource, WebSocketClient, WebSocketFeeds, WebSocketFeedsOptions, WebSocketLatency, WebSocketLatencyOptions, WebSocketOptions, WebSocketPresence, WebSocketPresenceOptions, WebSocketRequests, WebSocketRequestsOptions, WebSocketResponder, WebSocketResponderOptions, WebSocketRuns, WebSocketRunsOptions, WebSocketSendRate, WebSocketSendRateOptions, WebSocketState, WebSocketStateOptions, WebSocketTopics, WebSocketTopicsOptions };
1364
1343
  //# sourceMappingURL=core.d.cts.map
package/dist/core.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/types.d.ts
2
1
  /**
3
2
  * Where to connect: a URL, or a function that returns one (sync or async).
4
3
  *
@@ -447,8 +446,9 @@ interface WebSocketClient<In = unknown, Out = unknown> {
447
446
  close(code?: number, reason?: string): void;
448
447
  /**
449
448
  * Drop the current socket (if any) and connect again immediately, resetting the
450
- * backoff. Also restarts a `closed` client. The send queue and a `migrate()` target are
451
- * kept: when another user signs in, call `close()` and then `connect()` instead.
449
+ * backoff. Also restarts a `closed` client: one that `connect()` had started stays connected
450
+ * again until `close()`, even with no hook holding it. The send queue and a `migrate()` target
451
+ * are kept: when another user signs in, call `close()` and then `connect()` instead.
452
452
  */
453
453
  reconnect(): void;
454
454
  /**
@@ -480,8 +480,6 @@ interface WebSocketClient<In = unknown, Out = unknown> {
480
480
  */
481
481
  acquire(): () => void;
482
482
  }
483
- //#endregion
484
- //#region src/client.d.ts
485
483
  /**
486
484
  * The default `reconnect.shouldReconnect`: retry every close except `1002` (protocol error),
487
485
  * `1003` (unsupported data) and `1008` (policy violation, often a rejected login), which
@@ -530,8 +528,6 @@ export declare function retryAfter(close: CloseInfo): number | undefined;
530
528
  * ```
531
529
  */
532
530
  export declare function createWebSocket<In = unknown, Out = unknown>(url: UrlSource, options?: WebSocketOptions<In, Out>): WebSocketClient<In, Out>;
533
- //#endregion
534
- //#region src/topics.d.ts
535
531
  /** @internal Option key for a callback run when nothing holds a topic anymore. Used by feeds. */
536
532
  declare const ON_RELEASE: unique symbol;
537
533
  /** Options for {@link createWebSocketTopics}: the messages your server expects. */
@@ -580,8 +576,6 @@ interface WebSocketTopics {
580
576
  export declare function createWebSocketTopics<const Out>(client: WebSocketClient<any, Out>, options: WebSocketTopicsOptions<NoInfer<Out>> & {
581
577
  [ON_RELEASE]?: (topic: string) => void;
582
578
  }): WebSocketTopics;
583
- //#endregion
584
- //#region src/feeds.d.ts
585
579
  /** Where a numbered message belongs: its topic, and its sequence number in that topic. */
586
580
  interface FeedPosition {
587
581
  readonly topic: string;
@@ -661,8 +655,6 @@ interface WebSocketFeeds<In> extends WebSocketTopics {
661
655
  * ```
662
656
  */
663
657
  export declare function createWebSocketFeeds<In, const Out>(client: WebSocketClient<In, Out>, options: WebSocketFeedsOptions<NoInfer<In>, NoInfer<Out>>): WebSocketFeeds<In>;
664
- //#endregion
665
- //#region src/latency.d.ts
666
658
  /** Options for {@link createWebSocketLatency}: how pings and pongs look on the wire. */
667
659
  interface WebSocketLatencyOptions<In, Out> {
668
660
  /** The ping message, tagged with `id`. Sent with `volatile`, so pings are never queued. */
@@ -738,8 +730,6 @@ interface WebSocketLatency {
738
730
  * ```
739
731
  */
740
732
  export declare function createWebSocketLatency<In, const Out>(client: WebSocketClient<In, Out>, options: WebSocketLatencyOptions<NoInfer<In>, NoInfer<Out>>): WebSocketLatency;
741
- //#endregion
742
- //#region src/presence.d.ts
743
733
  /** Another client's shared state, such as its cursor or what it's selected. */
744
734
  interface PresencePeer<P> {
745
735
  /** The peer's id, as the server reports it. */
@@ -823,8 +813,6 @@ interface WebSocketPresence<P> {
823
813
  * ```
824
814
  */
825
815
  export declare function createWebSocketPresence<P, In, const Out>(client: WebSocketClient<In, Out>, options: WebSocketPresenceOptions<P, NoInfer<In>, NoInfer<Out>>): WebSocketPresence<P>;
826
- //#endregion
827
- //#region src/requests.d.ts
828
816
  /** Options for {@link createWebSocketRequests}: how requests and replies look on the wire. */
829
817
  interface WebSocketRequestsOptions<Req, In, Out> {
830
818
  /**
@@ -856,7 +844,7 @@ interface WebSocketRequestsOptions<Req, In, Out> {
856
844
  cancel?: (id: number) => Out;
857
845
  /**
858
846
  * Default time to wait for a reply, in ms. For a stream, the time to wait for each reply,
859
- * including the first. `Infinity` waits forever.
847
+ * including the first. `Infinity`, or anything over about 24.8 days, waits forever.
860
848
  * @default 10000
861
849
  */
862
850
  timeout?: number;
@@ -928,8 +916,6 @@ interface WebSocketRequests<Req, In> {
928
916
  * ```
929
917
  */
930
918
  export declare function createWebSocketRequests<Req, In, const Out>(client: WebSocketClient<In, Out>, options: WebSocketRequestsOptions<Req, NoInfer<In>, NoInfer<Out>>): WebSocketRequests<Req, In>;
931
- //#endregion
932
- //#region src/responder.d.ts
933
919
  /** What `request` returns for a request: any object with these fields, such as the message itself. */
934
920
  type RequestFields = {
935
921
  id: number | string;
@@ -1065,8 +1051,6 @@ interface WebSocketResponder<P = unknown, R = unknown> {
1065
1051
  * ```
1066
1052
  */
1067
1053
  export declare function createWebSocketResponder<Q extends RequestFields, R, In, const Out>(client: WebSocketClient<In, Out>, options: WebSocketResponderOptions<Q, R, NoInfer<In>, NoInfer<Out>>): WebSocketResponder<ParamsOf<Q>, R>;
1068
- //#endregion
1069
- //#region src/runs.d.ts
1070
1054
  /**
1071
1055
  * What happens to a run when its connection drops: `keep` resumes it on the next connection,
1072
1056
  * for agents that keep working in the background; `cancel` aborts it and tells the server, for
@@ -1204,8 +1188,6 @@ interface WebSocketRuns<Req, T> {
1204
1188
  * ```
1205
1189
  */
1206
1190
  export declare function createWebSocketRuns<Req, T, In, const Out>(client: WebSocketClient<In, Out>, options: WebSocketRunsOptions<Req, T, NoInfer<In>, NoInfer<Out>>): WebSocketRuns<Req, T>;
1207
- //#endregion
1208
- //#region src/sendrate.d.ts
1209
1191
  /** Options for {@link createWebSocketSendRate}. */
1210
1192
  interface WebSocketSendRateOptions {
1211
1193
  /**
@@ -1283,8 +1265,6 @@ interface WebSocketSendRate<Out> {
1283
1265
  * ```
1284
1266
  */
1285
1267
  export declare function createWebSocketSendRate<Out>(client: WebSocketClient<any, Out>, options?: WebSocketSendRateOptions): WebSocketSendRate<Out>;
1286
- //#endregion
1287
- //#region src/state.d.ts
1288
1268
  /** Options for {@link createWebSocketState}. */
1289
1269
  interface WebSocketStateOptions<S, In> {
1290
1270
  /** The state before any message arrives, and what `reset()` returns to. */
@@ -1359,6 +1339,5 @@ interface WebSocketState<S> {
1359
1339
  * ```
1360
1340
  */
1361
1341
  export declare function createWebSocketState<S, In>(source: WebSocketClient<In, any> | MessageSource<In>, options: WebSocketStateOptions<S, NoInfer<In>>): WebSocketState<S>;
1362
- //#endregion
1363
1342
  export type { AgentRun, CloseInfo, EventMap, FeedPosition, HeartbeatOptions, IncomingRequest, Latency, MessageSource, MigrateOptions, PresencePeer, QueueOptions, ReconnectOptions, RequestHandler, RequestOptions, RunPolicy, RunStatus, RunStorage, SendData, SendOptions, SendRate, Snapshot, StandardSchemaV1, Status, UrlSource, WebSocketClient, WebSocketFeeds, WebSocketFeedsOptions, WebSocketLatency, WebSocketLatencyOptions, WebSocketOptions, WebSocketPresence, WebSocketPresenceOptions, WebSocketRequests, WebSocketRequestsOptions, WebSocketResponder, WebSocketResponderOptions, WebSocketRuns, WebSocketRunsOptions, WebSocketSendRate, WebSocketSendRateOptions, WebSocketState, WebSocketStateOptions, WebSocketTopics, WebSocketTopicsOptions };
1364
1343
  //# sourceMappingURL=core.d.ts.map