@replit/river 0.12.1 → 0.12.2

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.
@@ -143,7 +143,7 @@ var Session = class {
143
143
  log?.info(
144
144
  `${this.from} -- closing connection (id: ${this.connection.debugId}) to ${this.to} due to inactivity`
145
145
  );
146
- this.halfCloseConnection();
146
+ this.closeStaleConnection(this.connection);
147
147
  }
148
148
  return;
149
149
  }
@@ -241,6 +241,7 @@ var Session = class {
241
241
  */
242
242
  halfCloseConnection() {
243
243
  this.connection?.close();
244
+ clearInterval(this.heartbeat);
244
245
  }
245
246
  inspectSendBuffer() {
246
247
  return this.sendBuffer;
@@ -335,11 +336,11 @@ var Transport = class {
335
336
  let session = this.sessions.get(connectedTo);
336
337
  const lastInstanceId = this.connectedInstanceIds.get(connectedTo);
337
338
  if (session && lastInstanceId !== instanceId && lastInstanceId !== void 0) {
338
- log?.debug(
339
+ log?.warn(
339
340
  `${this.clientId} -- handshake from ${connectedTo} has different server instance (got: ${instanceId}, last connected to: ${lastInstanceId}), starting a new session`
340
341
  );
341
342
  session.resetBufferedMessages();
342
- session.closeStaleConnection();
343
+ session.closeStaleConnection(conn);
343
344
  this.deleteSession(session);
344
345
  session = void 0;
345
346
  }
@@ -374,13 +375,13 @@ var Transport = class {
374
375
  }
375
376
  deleteSession(session) {
376
377
  this.sessions.delete(session.to);
378
+ log?.info(
379
+ `${this.clientId} -- session ${session.debugId} disconnect from ${session.to}`
380
+ );
377
381
  this.eventDispatcher.dispatchEvent("sessionStatus", {
378
382
  status: "disconnect",
379
383
  session
380
384
  });
381
- log?.info(
382
- `${this.clientId} -- session ${session.debugId} disconnect from ${session.to}`
383
- );
384
385
  }
385
386
  /**
386
387
  * The downstream implementation needs to call this when a connection is closed.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Connection
3
- } from "./chunk-QEYN2Z6O.js";
3
+ } from "./chunk-CT57CKBS.js";
4
4
 
5
5
  // transport/impls/ws/connection.ts
6
6
  var WebSocketConnection = class extends Connection {
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-IIBVKYDB.js";
4
4
  import {
5
5
  Connection
6
- } from "./chunk-QEYN2Z6O.js";
6
+ } from "./chunk-CT57CKBS.js";
7
7
 
8
8
  // transport/impls/uds/connection.ts
9
9
  var UdsConnection = class extends Connection {
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-IIBVKYDB.js";
4
4
  import {
5
5
  Connection
6
- } from "./chunk-QEYN2Z6O.js";
6
+ } from "./chunk-CT57CKBS.js";
7
7
 
8
8
  // transport/impls/stdio/connection.ts
9
9
  var StreamConnection = class extends Connection {
@@ -227,7 +227,7 @@ var Session = class {
227
227
  log?.info(
228
228
  `${this.from} -- closing connection (id: ${this.connection.debugId}) to ${this.to} due to inactivity`
229
229
  );
230
- this.halfCloseConnection();
230
+ this.closeStaleConnection(this.connection);
231
231
  }
232
232
  return;
233
233
  }
@@ -325,6 +325,7 @@ var Session = class {
325
325
  */
326
326
  halfCloseConnection() {
327
327
  this.connection?.close();
328
+ clearInterval(this.heartbeat);
328
329
  }
329
330
  inspectSendBuffer() {
330
331
  return this.sendBuffer;
@@ -480,11 +481,11 @@ var Transport = class {
480
481
  let session = this.sessions.get(connectedTo);
481
482
  const lastInstanceId = this.connectedInstanceIds.get(connectedTo);
482
483
  if (session && lastInstanceId !== instanceId && lastInstanceId !== void 0) {
483
- log?.debug(
484
+ log?.warn(
484
485
  `${this.clientId} -- handshake from ${connectedTo} has different server instance (got: ${instanceId}, last connected to: ${lastInstanceId}), starting a new session`
485
486
  );
486
487
  session.resetBufferedMessages();
487
- session.closeStaleConnection();
488
+ session.closeStaleConnection(conn);
488
489
  this.deleteSession(session);
489
490
  session = void 0;
490
491
  }
@@ -519,13 +520,13 @@ var Transport = class {
519
520
  }
520
521
  deleteSession(session) {
521
522
  this.sessions.delete(session.to);
523
+ log?.info(
524
+ `${this.clientId} -- session ${session.debugId} disconnect from ${session.to}`
525
+ );
522
526
  this.eventDispatcher.dispatchEvent("sessionStatus", {
523
527
  status: "disconnect",
524
528
  session
525
529
  });
526
- log?.info(
527
- `${this.clientId} -- session ${session.debugId} disconnect from ${session.to}`
528
- );
529
530
  }
530
531
  /**
531
532
  * The downstream implementation needs to call this when a connection is closed.
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  StreamConnection
3
- } from "../../../chunk-M6LY25P2.js";
3
+ } from "../../../chunk-R6YJHJV7.js";
4
4
  import "../../../chunk-5IZ2UHWV.js";
5
5
  import "../../../chunk-IIBVKYDB.js";
6
6
  import {
7
7
  ClientTransport
8
- } from "../../../chunk-QEYN2Z6O.js";
8
+ } from "../../../chunk-CT57CKBS.js";
9
9
  import "../../../chunk-GZ7HCLLM.js";
10
10
  import "../../../chunk-XFFS4UOD.js";
11
11
  import {
@@ -235,7 +235,7 @@ var Session = class {
235
235
  log?.info(
236
236
  `${this.from} -- closing connection (id: ${this.connection.debugId}) to ${this.to} due to inactivity`
237
237
  );
238
- this.halfCloseConnection();
238
+ this.closeStaleConnection(this.connection);
239
239
  }
240
240
  return;
241
241
  }
@@ -333,6 +333,7 @@ var Session = class {
333
333
  */
334
334
  halfCloseConnection() {
335
335
  this.connection?.close();
336
+ clearInterval(this.heartbeat);
336
337
  }
337
338
  inspectSendBuffer() {
338
339
  return this.sendBuffer;
@@ -488,11 +489,11 @@ var Transport = class {
488
489
  let session = this.sessions.get(connectedTo);
489
490
  const lastInstanceId = this.connectedInstanceIds.get(connectedTo);
490
491
  if (session && lastInstanceId !== instanceId && lastInstanceId !== void 0) {
491
- log?.debug(
492
+ log?.warn(
492
493
  `${this.clientId} -- handshake from ${connectedTo} has different server instance (got: ${instanceId}, last connected to: ${lastInstanceId}), starting a new session`
493
494
  );
494
495
  session.resetBufferedMessages();
495
- session.closeStaleConnection();
496
+ session.closeStaleConnection(conn);
496
497
  this.deleteSession(session);
497
498
  session = void 0;
498
499
  }
@@ -527,13 +528,13 @@ var Transport = class {
527
528
  }
528
529
  deleteSession(session) {
529
530
  this.sessions.delete(session.to);
531
+ log?.info(
532
+ `${this.clientId} -- session ${session.debugId} disconnect from ${session.to}`
533
+ );
530
534
  this.eventDispatcher.dispatchEvent("sessionStatus", {
531
535
  status: "disconnect",
532
536
  session
533
537
  });
534
- log?.info(
535
- `${this.clientId} -- session ${session.debugId} disconnect from ${session.to}`
536
- );
537
538
  }
538
539
  /**
539
540
  * The downstream implementation needs to call this when a connection is closed.
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  StreamConnection
3
- } from "../../../chunk-M6LY25P2.js";
3
+ } from "../../../chunk-R6YJHJV7.js";
4
4
  import "../../../chunk-5IZ2UHWV.js";
5
5
  import "../../../chunk-IIBVKYDB.js";
6
6
  import {
7
7
  ServerTransport
8
- } from "../../../chunk-QEYN2Z6O.js";
8
+ } from "../../../chunk-CT57CKBS.js";
9
9
  import "../../../chunk-GZ7HCLLM.js";
10
10
  import "../../../chunk-XFFS4UOD.js";
11
11
  import "../../../chunk-H4BYJELI.js";
@@ -199,7 +199,7 @@ var Session = class {
199
199
  log?.info(
200
200
  `${this.from} -- closing connection (id: ${this.connection.debugId}) to ${this.to} due to inactivity`
201
201
  );
202
- this.halfCloseConnection();
202
+ this.closeStaleConnection(this.connection);
203
203
  }
204
204
  return;
205
205
  }
@@ -297,6 +297,7 @@ var Session = class {
297
297
  */
298
298
  halfCloseConnection() {
299
299
  this.connection?.close();
300
+ clearInterval(this.heartbeat);
300
301
  }
301
302
  inspectSendBuffer() {
302
303
  return this.sendBuffer;
@@ -576,11 +577,11 @@ var Transport = class {
576
577
  let session = this.sessions.get(connectedTo);
577
578
  const lastInstanceId = this.connectedInstanceIds.get(connectedTo);
578
579
  if (session && lastInstanceId !== instanceId && lastInstanceId !== void 0) {
579
- log?.debug(
580
+ log?.warn(
580
581
  `${this.clientId} -- handshake from ${connectedTo} has different server instance (got: ${instanceId}, last connected to: ${lastInstanceId}), starting a new session`
581
582
  );
582
583
  session.resetBufferedMessages();
583
- session.closeStaleConnection();
584
+ session.closeStaleConnection(conn);
584
585
  this.deleteSession(session);
585
586
  session = void 0;
586
587
  }
@@ -615,13 +616,13 @@ var Transport = class {
615
616
  }
616
617
  deleteSession(session) {
617
618
  this.sessions.delete(session.to);
619
+ log?.info(
620
+ `${this.clientId} -- session ${session.debugId} disconnect from ${session.to}`
621
+ );
618
622
  this.eventDispatcher.dispatchEvent("sessionStatus", {
619
623
  status: "disconnect",
620
624
  session
621
625
  });
622
- log?.info(
623
- `${this.clientId} -- session ${session.debugId} disconnect from ${session.to}`
624
- );
625
626
  }
626
627
  /**
627
628
  * The downstream implementation needs to call this when a connection is closed.
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  UdsConnection
3
- } from "../../../chunk-TKINU53F.js";
3
+ } from "../../../chunk-PIF32FUL.js";
4
4
  import "../../../chunk-IIBVKYDB.js";
5
5
  import {
6
6
  ClientTransport
7
- } from "../../../chunk-QEYN2Z6O.js";
7
+ } from "../../../chunk-CT57CKBS.js";
8
8
  import "../../../chunk-GZ7HCLLM.js";
9
9
  import "../../../chunk-XFFS4UOD.js";
10
10
  import {
@@ -235,7 +235,7 @@ var Session = class {
235
235
  log?.info(
236
236
  `${this.from} -- closing connection (id: ${this.connection.debugId}) to ${this.to} due to inactivity`
237
237
  );
238
- this.halfCloseConnection();
238
+ this.closeStaleConnection(this.connection);
239
239
  }
240
240
  return;
241
241
  }
@@ -333,6 +333,7 @@ var Session = class {
333
333
  */
334
334
  halfCloseConnection() {
335
335
  this.connection?.close();
336
+ clearInterval(this.heartbeat);
336
337
  }
337
338
  inspectSendBuffer() {
338
339
  return this.sendBuffer;
@@ -488,11 +489,11 @@ var Transport = class {
488
489
  let session = this.sessions.get(connectedTo);
489
490
  const lastInstanceId = this.connectedInstanceIds.get(connectedTo);
490
491
  if (session && lastInstanceId !== instanceId && lastInstanceId !== void 0) {
491
- log?.debug(
492
+ log?.warn(
492
493
  `${this.clientId} -- handshake from ${connectedTo} has different server instance (got: ${instanceId}, last connected to: ${lastInstanceId}), starting a new session`
493
494
  );
494
495
  session.resetBufferedMessages();
495
- session.closeStaleConnection();
496
+ session.closeStaleConnection(conn);
496
497
  this.deleteSession(session);
497
498
  session = void 0;
498
499
  }
@@ -527,13 +528,13 @@ var Transport = class {
527
528
  }
528
529
  deleteSession(session) {
529
530
  this.sessions.delete(session.to);
531
+ log?.info(
532
+ `${this.clientId} -- session ${session.debugId} disconnect from ${session.to}`
533
+ );
530
534
  this.eventDispatcher.dispatchEvent("sessionStatus", {
531
535
  status: "disconnect",
532
536
  session
533
537
  });
534
- log?.info(
535
- `${this.clientId} -- session ${session.debugId} disconnect from ${session.to}`
536
- );
537
538
  }
538
539
  /**
539
540
  * The downstream implementation needs to call this when a connection is closed.
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  UdsConnection
3
- } from "../../../chunk-TKINU53F.js";
3
+ } from "../../../chunk-PIF32FUL.js";
4
4
  import "../../../chunk-IIBVKYDB.js";
5
5
  import {
6
6
  ServerTransport
7
- } from "../../../chunk-QEYN2Z6O.js";
7
+ } from "../../../chunk-CT57CKBS.js";
8
8
  import "../../../chunk-GZ7HCLLM.js";
9
9
  import "../../../chunk-XFFS4UOD.js";
10
10
  import {
@@ -227,7 +227,7 @@ var Session = class {
227
227
  log?.info(
228
228
  `${this.from} -- closing connection (id: ${this.connection.debugId}) to ${this.to} due to inactivity`
229
229
  );
230
- this.halfCloseConnection();
230
+ this.closeStaleConnection(this.connection);
231
231
  }
232
232
  return;
233
233
  }
@@ -325,6 +325,7 @@ var Session = class {
325
325
  */
326
326
  halfCloseConnection() {
327
327
  this.connection?.close();
328
+ clearInterval(this.heartbeat);
328
329
  }
329
330
  inspectSendBuffer() {
330
331
  return this.sendBuffer;
@@ -480,11 +481,11 @@ var Transport = class {
480
481
  let session = this.sessions.get(connectedTo);
481
482
  const lastInstanceId = this.connectedInstanceIds.get(connectedTo);
482
483
  if (session && lastInstanceId !== instanceId && lastInstanceId !== void 0) {
483
- log?.debug(
484
+ log?.warn(
484
485
  `${this.clientId} -- handshake from ${connectedTo} has different server instance (got: ${instanceId}, last connected to: ${lastInstanceId}), starting a new session`
485
486
  );
486
487
  session.resetBufferedMessages();
487
- session.closeStaleConnection();
488
+ session.closeStaleConnection(conn);
488
489
  this.deleteSession(session);
489
490
  session = void 0;
490
491
  }
@@ -519,13 +520,13 @@ var Transport = class {
519
520
  }
520
521
  deleteSession(session) {
521
522
  this.sessions.delete(session.to);
523
+ log?.info(
524
+ `${this.clientId} -- session ${session.debugId} disconnect from ${session.to}`
525
+ );
522
526
  this.eventDispatcher.dispatchEvent("sessionStatus", {
523
527
  status: "disconnect",
524
528
  session
525
529
  });
526
- log?.info(
527
- `${this.clientId} -- session ${session.debugId} disconnect from ${session.to}`
528
- );
529
530
  }
530
531
  /**
531
532
  * The downstream implementation needs to call this when a connection is closed.
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  WebSocketConnection
3
- } from "../../../chunk-RDTTKCGV.js";
3
+ } from "../../../chunk-NHSJ4RDY.js";
4
4
  import {
5
5
  ClientTransport
6
- } from "../../../chunk-QEYN2Z6O.js";
6
+ } from "../../../chunk-CT57CKBS.js";
7
7
  import "../../../chunk-GZ7HCLLM.js";
8
8
  import "../../../chunk-XFFS4UOD.js";
9
9
  import {
@@ -235,7 +235,7 @@ var Session = class {
235
235
  log?.info(
236
236
  `${this.from} -- closing connection (id: ${this.connection.debugId}) to ${this.to} due to inactivity`
237
237
  );
238
- this.halfCloseConnection();
238
+ this.closeStaleConnection(this.connection);
239
239
  }
240
240
  return;
241
241
  }
@@ -333,6 +333,7 @@ var Session = class {
333
333
  */
334
334
  halfCloseConnection() {
335
335
  this.connection?.close();
336
+ clearInterval(this.heartbeat);
336
337
  }
337
338
  inspectSendBuffer() {
338
339
  return this.sendBuffer;
@@ -488,11 +489,11 @@ var Transport = class {
488
489
  let session = this.sessions.get(connectedTo);
489
490
  const lastInstanceId = this.connectedInstanceIds.get(connectedTo);
490
491
  if (session && lastInstanceId !== instanceId && lastInstanceId !== void 0) {
491
- log?.debug(
492
+ log?.warn(
492
493
  `${this.clientId} -- handshake from ${connectedTo} has different server instance (got: ${instanceId}, last connected to: ${lastInstanceId}), starting a new session`
493
494
  );
494
495
  session.resetBufferedMessages();
495
- session.closeStaleConnection();
496
+ session.closeStaleConnection(conn);
496
497
  this.deleteSession(session);
497
498
  session = void 0;
498
499
  }
@@ -527,13 +528,13 @@ var Transport = class {
527
528
  }
528
529
  deleteSession(session) {
529
530
  this.sessions.delete(session.to);
531
+ log?.info(
532
+ `${this.clientId} -- session ${session.debugId} disconnect from ${session.to}`
533
+ );
530
534
  this.eventDispatcher.dispatchEvent("sessionStatus", {
531
535
  status: "disconnect",
532
536
  session
533
537
  });
534
- log?.info(
535
- `${this.clientId} -- session ${session.debugId} disconnect from ${session.to}`
536
- );
537
538
  }
538
539
  /**
539
540
  * The downstream implementation needs to call this when a connection is closed.
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  WebSocketConnection
3
- } from "../../../chunk-RDTTKCGV.js";
3
+ } from "../../../chunk-NHSJ4RDY.js";
4
4
  import {
5
5
  ServerTransport
6
- } from "../../../chunk-QEYN2Z6O.js";
6
+ } from "../../../chunk-CT57CKBS.js";
7
7
  import "../../../chunk-GZ7HCLLM.js";
8
8
  import "../../../chunk-XFFS4UOD.js";
9
9
  import {
@@ -257,7 +257,7 @@ var Session = class {
257
257
  log?.info(
258
258
  `${this.from} -- closing connection (id: ${this.connection.debugId}) to ${this.to} due to inactivity`
259
259
  );
260
- this.halfCloseConnection();
260
+ this.closeStaleConnection(this.connection);
261
261
  }
262
262
  return;
263
263
  }
@@ -355,6 +355,7 @@ var Session = class {
355
355
  */
356
356
  halfCloseConnection() {
357
357
  this.connection?.close();
358
+ clearInterval(this.heartbeat);
358
359
  }
359
360
  inspectSendBuffer() {
360
361
  return this.sendBuffer;
@@ -510,11 +511,11 @@ var Transport = class {
510
511
  let session = this.sessions.get(connectedTo);
511
512
  const lastInstanceId = this.connectedInstanceIds.get(connectedTo);
512
513
  if (session && lastInstanceId !== instanceId && lastInstanceId !== void 0) {
513
- log?.debug(
514
+ log?.warn(
514
515
  `${this.clientId} -- handshake from ${connectedTo} has different server instance (got: ${instanceId}, last connected to: ${lastInstanceId}), starting a new session`
515
516
  );
516
517
  session.resetBufferedMessages();
517
- session.closeStaleConnection();
518
+ session.closeStaleConnection(conn);
518
519
  this.deleteSession(session);
519
520
  session = void 0;
520
521
  }
@@ -549,13 +550,13 @@ var Transport = class {
549
550
  }
550
551
  deleteSession(session) {
551
552
  this.sessions.delete(session.to);
553
+ log?.info(
554
+ `${this.clientId} -- session ${session.debugId} disconnect from ${session.to}`
555
+ );
552
556
  this.eventDispatcher.dispatchEvent("sessionStatus", {
553
557
  status: "disconnect",
554
558
  session
555
559
  });
556
- log?.info(
557
- `${this.clientId} -- session ${session.debugId} disconnect from ${session.to}`
558
- );
559
560
  }
560
561
  /**
561
562
  * The downstream implementation needs to call this when a connection is closed.
@@ -5,7 +5,7 @@ import {
5
5
  ServerTransport,
6
6
  Session,
7
7
  Transport
8
- } from "../chunk-QEYN2Z6O.js";
8
+ } from "../chunk-CT57CKBS.js";
9
9
  import "../chunk-GZ7HCLLM.js";
10
10
  import {
11
11
  OpaqueTransportMessageSchema,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@replit/river",
3
3
  "description": "It's like tRPC but... with JSON Schema Support, duplex streaming and support for service multiplexing. Transport agnostic!",
4
- "version": "0.12.1",
4
+ "version": "0.12.2",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {