@replit/river 0.207.1 → 0.207.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.
Files changed (39) hide show
  1. package/dist/{chunk-QMAVXV4Z.js → chunk-24EWYOGK.js} +21 -10
  2. package/dist/chunk-24EWYOGK.js.map +1 -0
  3. package/dist/{chunk-BCCZA7SX.js → chunk-46IVOKJU.js} +2 -2
  4. package/dist/{chunk-BCCZA7SX.js.map → chunk-46IVOKJU.js.map} +1 -1
  5. package/dist/{chunk-7LMZNSVC.js → chunk-4HE7UYRL.js} +2 -2
  6. package/dist/{chunk-CRD3HDVN.js → chunk-A7RGOVRV.js} +3 -3
  7. package/dist/{chunk-I27WBSMZ.js → chunk-XV4RQ62N.js} +3 -3
  8. package/dist/{connection-933c87b2.d.ts → connection-a18e31d5.d.ts} +1 -1
  9. package/dist/router/index.cjs +1 -1
  10. package/dist/router/index.cjs.map +1 -1
  11. package/dist/router/index.d.cts +3 -3
  12. package/dist/router/index.d.ts +3 -3
  13. package/dist/router/index.js +1 -1
  14. package/dist/{services-4cd29829.d.ts → services-43528f4b.d.ts} +2 -1
  15. package/dist/testUtil/index.cjs +20 -9
  16. package/dist/testUtil/index.cjs.map +1 -1
  17. package/dist/testUtil/index.d.cts +1 -1
  18. package/dist/testUtil/index.d.ts +1 -1
  19. package/dist/testUtil/index.js +4 -4
  20. package/dist/transport/impls/ws/client.cjs +20 -9
  21. package/dist/transport/impls/ws/client.cjs.map +1 -1
  22. package/dist/transport/impls/ws/client.d.cts +2 -2
  23. package/dist/transport/impls/ws/client.d.ts +2 -2
  24. package/dist/transport/impls/ws/client.js +4 -4
  25. package/dist/transport/impls/ws/server.cjs +20 -9
  26. package/dist/transport/impls/ws/server.cjs.map +1 -1
  27. package/dist/transport/impls/ws/server.d.cts +2 -2
  28. package/dist/transport/impls/ws/server.d.ts +2 -2
  29. package/dist/transport/impls/ws/server.js +4 -4
  30. package/dist/transport/index.cjs +20 -9
  31. package/dist/transport/index.cjs.map +1 -1
  32. package/dist/transport/index.d.cts +2 -2
  33. package/dist/transport/index.d.ts +2 -2
  34. package/dist/transport/index.js +4 -4
  35. package/package.json +1 -1
  36. package/dist/chunk-QMAVXV4Z.js.map +0 -1
  37. /package/dist/{chunk-7LMZNSVC.js.map → chunk-4HE7UYRL.js.map} +0 -0
  38. /package/dist/{chunk-CRD3HDVN.js.map → chunk-A7RGOVRV.js.map} +0 -0
  39. /package/dist/{chunk-I27WBSMZ.js.map → chunk-XV4RQ62N.js.map} +0 -0
@@ -1,5 +1,5 @@
1
- import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, c as ParsedMetadata, d as AnyProcedure, b as Connection, S as ServerHandshakeOptions, e as ServiceContext } from '../services-4cd29829.js';
2
- export { M as BaseErrorSchemaType, K as CANCEL_CODE, O as Client, X as Err, Z as ErrResult, J as INVALID_REQUEST_CODE, T as Ok, _ as OkResult, w as PayloadType, l as ProcErrors, h as ProcHandler, i as ProcInit, j as ProcRequest, k as ProcResponse, m as ProcType, D as Procedure, E as ProcedureErrorSchemaType, Q as ProcedureHandlerContext, x as ProcedureMap, R as RPCProcedure, B as Readable, L as ReaderErrorSchema, a1 as ResponseData, Y as Result, a0 as ResultUnwrapErr, $ as ResultUnwrapOk, q as SerializedProcedureSchema, v as SerializedProcedureSchemaProtocolv1, o as SerializedServerSchema, t as SerializedServerSchemaProtocolv1, p as SerializedServiceSchema, u as SerializedServiceSchemaProtocolv1, f as Service, g as ServiceConfiguration, n as ServiceSchema, z as StreamProcedure, y as SubscriptionProcedure, G as UNCAUGHT_ERROR_CODE, H as UNEXPECTED_DISCONNECT_CODE, U as UploadProcedure, V as ValidProcType, W as Writable, N as createClient, a2 as createClientHandshakeOptions, a3 as createServerHandshakeOptions, F as flattenErrorType, s as serializeSchema, r as serializeSchemaV1Compat } from '../services-4cd29829.js';
1
+ import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, c as ParsedMetadata, d as AnyProcedure, b as Connection, S as ServerHandshakeOptions, e as ServiceContext } from '../services-43528f4b.js';
2
+ export { M as BaseErrorSchemaType, K as CANCEL_CODE, O as Client, X as Err, Z as ErrResult, J as INVALID_REQUEST_CODE, T as Ok, _ as OkResult, w as PayloadType, l as ProcErrors, h as ProcHandler, i as ProcInit, j as ProcRequest, k as ProcResponse, m as ProcType, D as Procedure, E as ProcedureErrorSchemaType, Q as ProcedureHandlerContext, x as ProcedureMap, R as RPCProcedure, B as Readable, L as ReaderErrorSchema, a1 as ResponseData, Y as Result, a0 as ResultUnwrapErr, $ as ResultUnwrapOk, q as SerializedProcedureSchema, v as SerializedProcedureSchemaProtocolv1, o as SerializedServerSchema, t as SerializedServerSchemaProtocolv1, p as SerializedServiceSchema, u as SerializedServiceSchemaProtocolv1, f as Service, g as ServiceConfiguration, n as ServiceSchema, z as StreamProcedure, y as SubscriptionProcedure, G as UNCAUGHT_ERROR_CODE, H as UNEXPECTED_DISCONNECT_CODE, U as UploadProcedure, V as ValidProcType, W as Writable, N as createClient, a2 as createClientHandshakeOptions, a3 as createServerHandshakeOptions, F as flattenErrorType, s as serializeSchema, r as serializeSchemaV1Compat } from '../services-43528f4b.js';
3
3
  import { T as TransportClientId, O as OpaqueTransportMessage } from '../message-ffacb98a.js';
4
4
  import { ServerTransport } from '../transport/index.cjs';
5
5
  import '@sinclair/typebox';
@@ -51,6 +51,6 @@ declare function createServer<Services extends AnyServiceSchemaMap>(transport: S
51
51
  maxCancelledStreamTombstonesPerSession?: number;
52
52
  }>): Server<Services>;
53
53
 
54
- var version = "0.207.1";
54
+ var version = "0.207.2";
55
55
 
56
56
  export { ParsedMetadata, version as RIVER_VERSION, Server, ServiceContext, createServer };
@@ -1,5 +1,5 @@
1
- import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, c as ParsedMetadata, d as AnyProcedure, b as Connection, S as ServerHandshakeOptions, e as ServiceContext } from '../services-4cd29829.js';
2
- export { M as BaseErrorSchemaType, K as CANCEL_CODE, O as Client, X as Err, Z as ErrResult, J as INVALID_REQUEST_CODE, T as Ok, _ as OkResult, w as PayloadType, l as ProcErrors, h as ProcHandler, i as ProcInit, j as ProcRequest, k as ProcResponse, m as ProcType, D as Procedure, E as ProcedureErrorSchemaType, Q as ProcedureHandlerContext, x as ProcedureMap, R as RPCProcedure, B as Readable, L as ReaderErrorSchema, a1 as ResponseData, Y as Result, a0 as ResultUnwrapErr, $ as ResultUnwrapOk, q as SerializedProcedureSchema, v as SerializedProcedureSchemaProtocolv1, o as SerializedServerSchema, t as SerializedServerSchemaProtocolv1, p as SerializedServiceSchema, u as SerializedServiceSchemaProtocolv1, f as Service, g as ServiceConfiguration, n as ServiceSchema, z as StreamProcedure, y as SubscriptionProcedure, G as UNCAUGHT_ERROR_CODE, H as UNEXPECTED_DISCONNECT_CODE, U as UploadProcedure, V as ValidProcType, W as Writable, N as createClient, a2 as createClientHandshakeOptions, a3 as createServerHandshakeOptions, F as flattenErrorType, s as serializeSchema, r as serializeSchemaV1Compat } from '../services-4cd29829.js';
1
+ import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, c as ParsedMetadata, d as AnyProcedure, b as Connection, S as ServerHandshakeOptions, e as ServiceContext } from '../services-43528f4b.js';
2
+ export { M as BaseErrorSchemaType, K as CANCEL_CODE, O as Client, X as Err, Z as ErrResult, J as INVALID_REQUEST_CODE, T as Ok, _ as OkResult, w as PayloadType, l as ProcErrors, h as ProcHandler, i as ProcInit, j as ProcRequest, k as ProcResponse, m as ProcType, D as Procedure, E as ProcedureErrorSchemaType, Q as ProcedureHandlerContext, x as ProcedureMap, R as RPCProcedure, B as Readable, L as ReaderErrorSchema, a1 as ResponseData, Y as Result, a0 as ResultUnwrapErr, $ as ResultUnwrapOk, q as SerializedProcedureSchema, v as SerializedProcedureSchemaProtocolv1, o as SerializedServerSchema, t as SerializedServerSchemaProtocolv1, p as SerializedServiceSchema, u as SerializedServiceSchemaProtocolv1, f as Service, g as ServiceConfiguration, n as ServiceSchema, z as StreamProcedure, y as SubscriptionProcedure, G as UNCAUGHT_ERROR_CODE, H as UNEXPECTED_DISCONNECT_CODE, U as UploadProcedure, V as ValidProcType, W as Writable, N as createClient, a2 as createClientHandshakeOptions, a3 as createServerHandshakeOptions, F as flattenErrorType, s as serializeSchema, r as serializeSchemaV1Compat } from '../services-43528f4b.js';
3
3
  import { T as TransportClientId, O as OpaqueTransportMessage } from '../message-ffacb98a.js';
4
4
  import { ServerTransport } from '../transport/index.js';
5
5
  import '@sinclair/typebox';
@@ -51,6 +51,6 @@ declare function createServer<Services extends AnyServiceSchemaMap>(transport: S
51
51
  maxCancelledStreamTombstonesPerSession?: number;
52
52
  }>): Server<Services>;
53
53
 
54
- var version = "0.207.1";
54
+ var version = "0.207.2";
55
55
 
56
56
  export { ParsedMetadata, version as RIVER_VERSION, Server, ServiceContext, createServer };
@@ -16,7 +16,7 @@ import {
16
16
  serializeSchema,
17
17
  serializeSchemaV1Compat,
18
18
  version
19
- } from "../chunk-BCCZA7SX.js";
19
+ } from "../chunk-46IVOKJU.js";
20
20
  export {
21
21
  CANCEL_CODE,
22
22
  Err,
@@ -273,6 +273,8 @@ declare class SessionConnected<ConnType extends Connection> extends IdentifiedSe
273
273
  private heartbeatHandle?;
274
274
  private heartbeatMisses;
275
275
  isActivelyHeartbeating: boolean;
276
+ private lastConstructedMsgs;
277
+ private pushLastConstructedMsgs;
276
278
  updateBookkeeping(ack: number, seq: number): void;
277
279
  private assertSendOrdering;
278
280
  send(msg: PartialTransportMessage): string;
@@ -297,7 +299,6 @@ declare class SessionConnected<ConnType extends Connection> extends IdentifiedSe
297
299
  };
298
300
  startActiveHeartbeat(): void;
299
301
  private sendHeartbeat;
300
- closeConnection(): void;
301
302
  onMessageData: (msg: Uint8Array) => void;
302
303
  _handleStateExit(): void;
303
304
  _handleClose(): void;
@@ -560,7 +560,7 @@ function coerceErrorString(err) {
560
560
  }
561
561
 
562
562
  // package.json
563
- var version = "0.207.1";
563
+ var version = "0.207.2";
564
564
 
565
565
  // tracing/index.ts
566
566
  function getPropagationContext(ctx) {
@@ -719,6 +719,19 @@ var SessionConnected = class extends IdentifiedSession {
719
719
  heartbeatHandle;
720
720
  heartbeatMisses = 0;
721
721
  isActivelyHeartbeating;
722
+ lastConstructedMsgs = [];
723
+ pushLastConstructedMsgs = (msg) => {
724
+ const trackedMsg = {
725
+ id: msg.id,
726
+ seq: msg.seq,
727
+ streamId: msg.streamId,
728
+ stack: new Error().stack
729
+ };
730
+ this.lastConstructedMsgs.push(trackedMsg);
731
+ if (this.lastConstructedMsgs.length > 10) {
732
+ this.lastConstructedMsgs.shift();
733
+ }
734
+ };
722
735
  updateBookkeeping(ack, seq) {
723
736
  this.sendBuffer = this.sendBuffer.filter((unacked) => unacked.seq >= ack);
724
737
  this.ack = seq + 1;
@@ -730,13 +743,17 @@ var SessionConnected = class extends IdentifiedSession {
730
743
  this.log?.error(msg, {
731
744
  ...this.loggingMetadata,
732
745
  transportMessage: constructedMsg,
733
- tags: ["invariant-violation"]
746
+ tags: ["invariant-violation"],
747
+ extras: {
748
+ lastConstructedMsgs: this.lastConstructedMsgs
749
+ }
734
750
  });
735
751
  throw new Error(msg);
736
752
  }
737
753
  }
738
754
  send(msg) {
739
755
  const constructedMsg = this.constructMsg(msg);
756
+ this.pushLastConstructedMsgs(constructedMsg);
740
757
  this.assertSendOrdering(constructedMsg);
741
758
  this.sendBuffer.push(constructedMsg);
742
759
  this.conn.send(this.options.codec.toBuffer(constructedMsg));
@@ -801,12 +818,6 @@ var SessionConnected = class extends IdentifiedSession {
801
818
  }
802
819
  });
803
820
  }
804
- closeConnection() {
805
- this.conn.removeDataListener(this.onMessageData);
806
- this.conn.removeCloseListener(this.listeners.onConnectionClosed);
807
- this.conn.removeErrorListener(this.listeners.onConnectionErrored);
808
- this.conn.close();
809
- }
810
821
  onMessageData = (msg) => {
811
822
  const parsedMsg = this.parseMsg(msg);
812
823
  if (parsedMsg === null) {
@@ -833,7 +844,7 @@ var SessionConnected = class extends IdentifiedSession {
833
844
  code: import_api2.SpanStatusCode.ERROR,
834
845
  message: reason
835
846
  });
836
- this.closeConnection();
847
+ this.conn.close();
837
848
  }
838
849
  return;
839
850
  }