@replit/river 0.24.3 → 0.25.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.
Files changed (63) hide show
  1. package/dist/{chunk-XKHLA5MP.js → chunk-5CNNIOAO.js} +4 -4
  2. package/dist/{chunk-FKBXIWWN.js → chunk-D5O3ERJU.js} +3 -3
  3. package/dist/{chunk-EHXKU4TW.js → chunk-MBMEJIPU.js} +2 -2
  4. package/dist/{chunk-W3CY6PNC.js → chunk-PCBPPTXH.js} +28 -23
  5. package/dist/chunk-PCBPPTXH.js.map +1 -0
  6. package/dist/{chunk-LSHUPI6U.js → chunk-SGSRNAWJ.js} +41 -18
  7. package/dist/{chunk-LSHUPI6U.js.map → chunk-SGSRNAWJ.js.map} +1 -1
  8. package/dist/{chunk-DZNP3EI5.js → chunk-SZ5NBBX7.js} +2 -2
  9. package/dist/{chunk-DZNP3EI5.js.map → chunk-SZ5NBBX7.js.map} +1 -1
  10. package/dist/{chunk-KVLCQ24J.js → chunk-YM5Y4NAT.js} +34 -13
  11. package/dist/chunk-YM5Y4NAT.js.map +1 -0
  12. package/dist/{client-2ba72e89.d.ts → client-1321630c.d.ts} +1 -1
  13. package/dist/{connection-55cba970.d.ts → connection-bd907ca6.d.ts} +1 -1
  14. package/dist/{handshake-0b88e8fc.d.ts → handshake-3772d7ca.d.ts} +4 -2
  15. package/dist/router/index.cjs +40 -17
  16. package/dist/router/index.cjs.map +1 -1
  17. package/dist/router/index.d.cts +7 -7
  18. package/dist/router/index.d.ts +7 -7
  19. package/dist/router/index.js +2 -2
  20. package/dist/{server-732e7014.d.ts → server-f0fd2b98.d.ts} +1 -1
  21. package/dist/{services-adfd0bc3.d.ts → services-8d14ae16.d.ts} +2 -2
  22. package/dist/transport/impls/ws/client.cjs +33 -12
  23. package/dist/transport/impls/ws/client.cjs.map +1 -1
  24. package/dist/transport/impls/ws/client.d.cts +3 -3
  25. package/dist/transport/impls/ws/client.d.ts +3 -3
  26. package/dist/transport/impls/ws/client.js +7 -7
  27. package/dist/transport/impls/ws/server.cjs +57 -31
  28. package/dist/transport/impls/ws/server.cjs.map +1 -1
  29. package/dist/transport/impls/ws/server.d.cts +3 -3
  30. package/dist/transport/impls/ws/server.d.ts +3 -3
  31. package/dist/transport/impls/ws/server.js +5 -5
  32. package/dist/transport/index.cjs +57 -31
  33. package/dist/transport/index.cjs.map +1 -1
  34. package/dist/transport/index.d.cts +3 -3
  35. package/dist/transport/index.d.ts +3 -3
  36. package/dist/transport/index.js +7 -7
  37. package/dist/util/testHelpers.cjs +33 -27
  38. package/dist/util/testHelpers.cjs.map +1 -1
  39. package/dist/util/testHelpers.d.cts +4 -7
  40. package/dist/util/testHelpers.d.ts +4 -7
  41. package/dist/util/testHelpers.js +3 -14
  42. package/dist/util/testHelpers.js.map +1 -1
  43. package/package.json +13 -14
  44. package/dist/chunk-KVLCQ24J.js.map +0 -1
  45. package/dist/chunk-TDFWZIXR.js +0 -106
  46. package/dist/chunk-TDFWZIXR.js.map +0 -1
  47. package/dist/chunk-W3CY6PNC.js.map +0 -1
  48. package/dist/connection-c6db05d9.d.ts +0 -31
  49. package/dist/transport/impls/uds/client.cjs +0 -1684
  50. package/dist/transport/impls/uds/client.cjs.map +0 -1
  51. package/dist/transport/impls/uds/client.d.cts +0 -18
  52. package/dist/transport/impls/uds/client.d.ts +0 -18
  53. package/dist/transport/impls/uds/client.js +0 -38
  54. package/dist/transport/impls/uds/client.js.map +0 -1
  55. package/dist/transport/impls/uds/server.cjs +0 -1650
  56. package/dist/transport/impls/uds/server.cjs.map +0 -1
  57. package/dist/transport/impls/uds/server.d.cts +0 -19
  58. package/dist/transport/impls/uds/server.d.ts +0 -19
  59. package/dist/transport/impls/uds/server.js +0 -33
  60. package/dist/transport/impls/uds/server.js.map +0 -1
  61. /package/dist/{chunk-XKHLA5MP.js.map → chunk-5CNNIOAO.js.map} +0 -0
  62. /package/dist/{chunk-FKBXIWWN.js.map → chunk-D5O3ERJU.js.map} +0 -0
  63. /package/dist/{chunk-EHXKU4TW.js.map → chunk-MBMEJIPU.js.map} +0 -0
@@ -1,14 +1,14 @@
1
- import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError } from '../services-adfd0bc3.js';
2
- export { C as Client, E as Err, O as Ok, z as Output, j as ProcErrors, f as ProcHandler, g as ProcInit, h as ProcInput, i as ProcOutput, k as ProcType, a as Procedure, p as ProcedureMap, d as ProcedureResult, q as RPCProcedure, y as ResultUnwrapErr, x as ResultUnwrapOk, w as RiverErrorSchema, c as RiverUncaughtSchema, o as SerializedProcedureSchema, m as SerializedServerSchema, n as SerializedServiceSchema, S as Service, e as ServiceConfiguration, l as ServiceSchema, t as StreamProcedure, r as SubscriptionProcedure, v as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, u as createClient, s as serializeSchema } from '../services-adfd0bc3.js';
1
+ import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError } from '../services-8d14ae16.js';
2
+ export { C as Client, E as Err, O as Ok, z as Output, j as ProcErrors, f as ProcHandler, g as ProcInit, h as ProcInput, i as ProcOutput, k as ProcType, a as Procedure, p as ProcedureMap, d as ProcedureResult, q as RPCProcedure, y as ResultUnwrapErr, x as ResultUnwrapOk, w as RiverErrorSchema, c as RiverUncaughtSchema, o as SerializedProcedureSchema, m as SerializedServerSchema, n as SerializedServiceSchema, S as Service, e as ServiceConfiguration, l as ServiceSchema, t as StreamProcedure, r as SubscriptionProcedure, v as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, u as createClient, s as serializeSchema } from '../services-8d14ae16.js';
3
3
  import { Static } from '@sinclair/typebox';
4
4
  import { Pushable } from 'it-pushable';
5
- import { C as Connection, q as ServerHandshakeOptions, n as ServiceContext } from '../handshake-0b88e8fc.js';
6
- export { r as ParsedMetadata, s as ServiceContextWithState, t as ServiceContextWithTransportInfo, u as createClientHandshakeOptions, v as createServerHandshakeOptions } from '../handshake-0b88e8fc.js';
7
- import { S as ServerTransport } from '../server-732e7014.js';
5
+ import { C as Connection, q as ServerHandshakeOptions, n as ServiceContext } from '../handshake-3772d7ca.js';
6
+ export { r as ParsedMetadata, s as ServiceContextWithState, t as ServiceContextWithTransportInfo, u as createClientHandshakeOptions, v as createServerHandshakeOptions } from '../handshake-3772d7ca.js';
7
+ import { S as ServerTransport } from '../server-f0fd2b98.js';
8
8
  import '../message-e6c560fd.js';
9
9
  import '@sinclair/typebox/value';
10
10
  import '@opentelemetry/api';
11
- import '../client-2ba72e89.js';
11
+ import '../client-1321630c.js';
12
12
  import '../types-3e5768ec.js';
13
13
 
14
14
  /**
@@ -45,6 +45,6 @@ declare function createServer<Services extends AnyServiceSchemaMap>(transport: S
45
45
  extendedContext?: Omit<ServiceContext, 'state'>;
46
46
  }>): Server<Services>;
47
47
 
48
- var version = "0.24.3";
48
+ var version = "0.25.1";
49
49
 
50
50
  export { PayloadType, version as RIVER_VERSION, Result, RiverError, Server, ServiceContext, createServer };
@@ -1,14 +1,14 @@
1
- import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError } from '../services-adfd0bc3.js';
2
- export { C as Client, E as Err, O as Ok, z as Output, j as ProcErrors, f as ProcHandler, g as ProcInit, h as ProcInput, i as ProcOutput, k as ProcType, a as Procedure, p as ProcedureMap, d as ProcedureResult, q as RPCProcedure, y as ResultUnwrapErr, x as ResultUnwrapOk, w as RiverErrorSchema, c as RiverUncaughtSchema, o as SerializedProcedureSchema, m as SerializedServerSchema, n as SerializedServiceSchema, S as Service, e as ServiceConfiguration, l as ServiceSchema, t as StreamProcedure, r as SubscriptionProcedure, v as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, u as createClient, s as serializeSchema } from '../services-adfd0bc3.js';
1
+ import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError } from '../services-8d14ae16.js';
2
+ export { C as Client, E as Err, O as Ok, z as Output, j as ProcErrors, f as ProcHandler, g as ProcInit, h as ProcInput, i as ProcOutput, k as ProcType, a as Procedure, p as ProcedureMap, d as ProcedureResult, q as RPCProcedure, y as ResultUnwrapErr, x as ResultUnwrapOk, w as RiverErrorSchema, c as RiverUncaughtSchema, o as SerializedProcedureSchema, m as SerializedServerSchema, n as SerializedServiceSchema, S as Service, e as ServiceConfiguration, l as ServiceSchema, t as StreamProcedure, r as SubscriptionProcedure, v as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, u as createClient, s as serializeSchema } from '../services-8d14ae16.js';
3
3
  import { Static } from '@sinclair/typebox';
4
4
  import { Pushable } from 'it-pushable';
5
- import { C as Connection, q as ServerHandshakeOptions, n as ServiceContext } from '../handshake-0b88e8fc.js';
6
- export { r as ParsedMetadata, s as ServiceContextWithState, t as ServiceContextWithTransportInfo, u as createClientHandshakeOptions, v as createServerHandshakeOptions } from '../handshake-0b88e8fc.js';
7
- import { S as ServerTransport } from '../server-732e7014.js';
5
+ import { C as Connection, q as ServerHandshakeOptions, n as ServiceContext } from '../handshake-3772d7ca.js';
6
+ export { r as ParsedMetadata, s as ServiceContextWithState, t as ServiceContextWithTransportInfo, u as createClientHandshakeOptions, v as createServerHandshakeOptions } from '../handshake-3772d7ca.js';
7
+ import { S as ServerTransport } from '../server-f0fd2b98.js';
8
8
  import '../message-e6c560fd.js';
9
9
  import '@sinclair/typebox/value';
10
10
  import '@opentelemetry/api';
11
- import '../client-2ba72e89.js';
11
+ import '../client-1321630c.js';
12
12
  import '../types-3e5768ec.js';
13
13
 
14
14
  /**
@@ -45,6 +45,6 @@ declare function createServer<Services extends AnyServiceSchemaMap>(transport: S
45
45
  extendedContext?: Omit<ServiceContext, 'state'>;
46
46
  }>): Server<Services>;
47
47
 
48
- var version = "0.24.3";
48
+ var version = "0.25.1";
49
49
 
50
50
  export { PayloadType, version as RIVER_VERSION, Result, RiverError, Server, ServiceContext, createServer };
@@ -10,10 +10,10 @@ import {
10
10
  createServer,
11
11
  createServerHandshakeOptions,
12
12
  serializeSchema
13
- } from "../chunk-LSHUPI6U.js";
13
+ } from "../chunk-SGSRNAWJ.js";
14
14
  import {
15
15
  version
16
- } from "../chunk-DZNP3EI5.js";
16
+ } from "../chunk-SZ5NBBX7.js";
17
17
  export {
18
18
  Err,
19
19
  Ok,
@@ -1,4 +1,4 @@
1
- import { C as Connection, w as CommonSession, d as SessionState, x as SessionHandshakingListeners, T as Transport, y as ServerTransportOptions, q as ServerHandshakeOptions, r as ParsedMetadata, c as ProvidedServerTransportOptions, S as Session } from './handshake-0b88e8fc.js';
1
+ import { C as Connection, w as CommonSession, d as SessionState, x as SessionHandshakingListeners, T as Transport, y as ServerTransportOptions, q as ServerHandshakeOptions, r as ParsedMetadata, c as ProvidedServerTransportOptions, S as Session } from './handshake-3772d7ca.js';
2
2
  import { M as MessageMetadata, a as TransportMessage, c as TransportClientId, P as PartialTransportMessage, b as OpaqueTransportMessage } from './message-e6c560fd.js';
3
3
 
4
4
  declare class SessionWaitingForHandshake<ConnType extends Connection> extends CommonSession {
@@ -1,8 +1,8 @@
1
1
  import { Static, TObject, TUnion, TString, TSchema, TNever, TLiteral } from '@sinclair/typebox';
2
2
  import { Pushable } from 'it-pushable';
3
- import { C as Connection, p as ClientHandshakeOptions, t as ServiceContextWithTransportInfo, n as ServiceContext } from './handshake-0b88e8fc.js';
3
+ import { C as Connection, p as ClientHandshakeOptions, t as ServiceContextWithTransportInfo, n as ServiceContext } from './handshake-3772d7ca.js';
4
4
  import { c as TransportClientId } from './message-e6c560fd.js';
5
- import { C as ClientTransport } from './client-2ba72e89.js';
5
+ import { C as ClientTransport } from './client-1321630c.js';
6
6
 
7
7
  type AsyncIter<T> = AsyncGenerator<T, T>;
8
8
  /**
@@ -602,7 +602,7 @@ var SessionNoConnection = class extends IdentifiedSession {
602
602
  var import_api = require("@opentelemetry/api");
603
603
 
604
604
  // package.json
605
- var version = "0.24.3";
605
+ var version = "0.25.1";
606
606
 
607
607
  // tracing/index.ts
608
608
  function getPropagationContext(ctx) {
@@ -726,15 +726,16 @@ var SessionConnected = class extends IdentifiedSession {
726
726
  state = "Connected" /* Connected */;
727
727
  conn;
728
728
  listeners;
729
- heartbeatHandle;
730
- heartbeatMisses = 0;
729
+ activeHeartbeatHandle;
730
+ activeHeartbeatMisses = 0;
731
+ passiveHeartbeatHandle;
731
732
  get isActivelyHeartbeating() {
732
- return this.heartbeatHandle !== void 0;
733
+ return this.activeHeartbeatHandle !== void 0;
733
734
  }
734
735
  updateBookkeeping(ack, seq) {
735
736
  this.sendBuffer = this.sendBuffer.filter((unacked) => unacked.seq >= ack);
736
737
  this.ack = seq + 1;
737
- this.heartbeatMisses = 0;
738
+ this.activeHeartbeatMisses = 0;
738
739
  }
739
740
  send(msg) {
740
741
  const constructedMsg = this.constructMsg(msg);
@@ -760,8 +761,8 @@ var SessionConnected = class extends IdentifiedSession {
760
761
  }
761
762
  }
762
763
  startActiveHeartbeat() {
763
- this.heartbeatHandle = setInterval(() => {
764
- const misses = this.heartbeatMisses;
764
+ this.activeHeartbeatHandle = setInterval(() => {
765
+ const misses = this.activeHeartbeatMisses;
765
766
  const missDuration = misses * this.options.heartbeatIntervalMs;
766
767
  if (misses >= this.options.heartbeatsUntilDead) {
767
768
  this.log?.info(
@@ -770,15 +771,32 @@ var SessionConnected = class extends IdentifiedSession {
770
771
  );
771
772
  this.telemetry.span.addEvent("closing connection due to inactivity");
772
773
  this.conn.close();
773
- clearInterval(this.heartbeatHandle);
774
- this.heartbeatHandle = void 0;
774
+ clearInterval(this.activeHeartbeatHandle);
775
+ this.activeHeartbeatHandle = void 0;
775
776
  return;
776
777
  }
777
778
  this.sendHeartbeat();
778
- this.heartbeatMisses++;
779
+ this.activeHeartbeatMisses++;
779
780
  }, this.options.heartbeatIntervalMs);
780
781
  }
782
+ waitForNextHeartbeat() {
783
+ const duration = this.options.heartbeatsUntilDead * this.options.heartbeatIntervalMs;
784
+ if (this.passiveHeartbeatHandle) {
785
+ clearTimeout(this.passiveHeartbeatHandle);
786
+ this.passiveHeartbeatHandle = void 0;
787
+ }
788
+ this.passiveHeartbeatHandle = setTimeout(() => {
789
+ this.log?.info(
790
+ `closing connection to ${this.to} due to not receiving a heartbeat in the last ${duration}ms`,
791
+ this.loggingMetadata
792
+ );
793
+ this.telemetry.span.addEvent("closing connection due to inactivity");
794
+ this.conn.close();
795
+ this.passiveHeartbeatHandle = void 0;
796
+ }, duration);
797
+ }
781
798
  sendHeartbeat() {
799
+ this.log?.debug("sending heartbeat", this.loggingMetadata);
782
800
  this.send({
783
801
  streamId: "heartbeat",
784
802
  controlFlags: 1 /* AckBit */,
@@ -830,6 +848,7 @@ var SessionConnected = class extends IdentifiedSession {
830
848
  });
831
849
  if (!this.isActivelyHeartbeating) {
832
850
  this.sendHeartbeat();
851
+ this.waitForNextHeartbeat();
833
852
  }
834
853
  };
835
854
  _handleStateExit() {
@@ -837,8 +856,10 @@ var SessionConnected = class extends IdentifiedSession {
837
856
  this.conn.removeDataListener(this.onMessageData);
838
857
  this.conn.removeCloseListener(this.listeners.onConnectionClosed);
839
858
  this.conn.removeErrorListener(this.listeners.onConnectionErrored);
840
- clearInterval(this.heartbeatHandle);
841
- this.heartbeatHandle = void 0;
859
+ clearInterval(this.activeHeartbeatHandle);
860
+ clearTimeout(this.passiveHeartbeatHandle);
861
+ this.activeHeartbeatHandle = void 0;
862
+ this.passiveHeartbeatHandle = void 0;
842
863
  }
843
864
  _handleClose() {
844
865
  super._handleClose();