@replit/river 0.15.3 → 0.15.5

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Connection
3
- } from "./chunk-5XMMDOLH.js";
3
+ } from "./chunk-EZQFVTBL.js";
4
4
 
5
5
  // transport/transforms/messageFraming.ts
6
6
  import { Transform } from "node:stream";
@@ -520,6 +520,8 @@ var Transport = class {
520
520
  session.updateBookkeeping(msg.ack, msg.seq);
521
521
  if (!isAck(msg.controlFlags)) {
522
522
  this.eventDispatcher.dispatchEvent("message", msg);
523
+ } else {
524
+ log?.debug(`${this.clientId} -- discarding msg ${msg.id} (ack bit set)`);
523
525
  }
524
526
  }
525
527
  /**
@@ -706,6 +708,7 @@ var ClientTransport = class extends Transport {
706
708
  log?.debug(
707
709
  `${this.clientId} -- handshake from ${parsed.from} ok (instance: ${instanceId})`
708
710
  );
711
+ this.retryBudget.startRestoringBudget(parsed.from);
709
712
  return { instanceId, from: parsed.from };
710
713
  }
711
714
  /**
@@ -722,10 +725,9 @@ var ClientTransport = class extends Transport {
722
725
  }
723
726
  let reconnectPromise = this.inflightConnectionPromises.get(to);
724
727
  if (!reconnectPromise) {
725
- log?.info(`${this.clientId} -- attempting connection to ${to}`);
726
728
  const budgetConsumed = this.retryBudget.getBudgetConsumed(to);
727
729
  if (!this.retryBudget.hasBudget(to)) {
728
- const errMsg = `not attempting to connect to ${to}, retry budget exceeded (more than ${budgetConsumed} attempts in the last ${this.retryBudget.totalBudgetRestoreTime}ms)`;
730
+ const errMsg = `tried to connect to ${to} but retry budget exceeded (more than ${budgetConsumed} attempts in the last ${this.retryBudget.totalBudgetRestoreTime}ms)`;
729
731
  log?.warn(`${this.clientId} -- ${errMsg}`);
730
732
  this.protocolError(ProtocolError.RetriesExceeded, errMsg);
731
733
  return;
@@ -735,6 +737,9 @@ var ClientTransport = class extends Transport {
735
737
  if (backoffMs > 0) {
736
738
  sleep = new Promise((resolve) => setTimeout(resolve, backoffMs));
737
739
  }
740
+ log?.info(
741
+ `${this.clientId} -- attempting connection to ${to} (${backoffMs}ms backoff)`
742
+ );
738
743
  this.retryBudget.consumeBudget(to);
739
744
  reconnectPromise = sleep.then(() => {
740
745
  if (!canProceedWithConnection()) {
@@ -748,7 +753,6 @@ var ClientTransport = class extends Transport {
748
753
  conn.close();
749
754
  throw new Error("transport state is no longer open");
750
755
  }
751
- this.retryBudget.startRestoringBudget(to);
752
756
  this.sendHandshake(to, conn);
753
757
  return conn;
754
758
  });
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Connection
3
- } from "./chunk-5XMMDOLH.js";
3
+ } from "./chunk-EZQFVTBL.js";
4
4
 
5
5
  // transport/impls/ws/connection.ts
6
6
  var WebSocketConnection = class extends Connection {
@@ -759,6 +759,8 @@ var Transport = class {
759
759
  session.updateBookkeeping(msg.ack, msg.seq);
760
760
  if (!isAck(msg.controlFlags)) {
761
761
  this.eventDispatcher.dispatchEvent("message", msg);
762
+ } else {
763
+ log?.debug(`${this.clientId} -- discarding msg ${msg.id} (ack bit set)`);
762
764
  }
763
765
  }
764
766
  /**
@@ -945,6 +947,7 @@ var ClientTransport = class extends Transport {
945
947
  log?.debug(
946
948
  `${this.clientId} -- handshake from ${parsed.from} ok (instance: ${instanceId})`
947
949
  );
950
+ this.retryBudget.startRestoringBudget(parsed.from);
948
951
  return { instanceId, from: parsed.from };
949
952
  }
950
953
  /**
@@ -961,10 +964,9 @@ var ClientTransport = class extends Transport {
961
964
  }
962
965
  let reconnectPromise = this.inflightConnectionPromises.get(to);
963
966
  if (!reconnectPromise) {
964
- log?.info(`${this.clientId} -- attempting connection to ${to}`);
965
967
  const budgetConsumed = this.retryBudget.getBudgetConsumed(to);
966
968
  if (!this.retryBudget.hasBudget(to)) {
967
- const errMsg = `not attempting to connect to ${to}, retry budget exceeded (more than ${budgetConsumed} attempts in the last ${this.retryBudget.totalBudgetRestoreTime}ms)`;
969
+ const errMsg = `tried to connect to ${to} but retry budget exceeded (more than ${budgetConsumed} attempts in the last ${this.retryBudget.totalBudgetRestoreTime}ms)`;
968
970
  log?.warn(`${this.clientId} -- ${errMsg}`);
969
971
  this.protocolError(ProtocolError.RetriesExceeded, errMsg);
970
972
  return;
@@ -974,6 +976,9 @@ var ClientTransport = class extends Transport {
974
976
  if (backoffMs > 0) {
975
977
  sleep = new Promise((resolve) => setTimeout(resolve, backoffMs));
976
978
  }
979
+ log?.info(
980
+ `${this.clientId} -- attempting connection to ${to} (${backoffMs}ms backoff)`
981
+ );
977
982
  this.retryBudget.consumeBudget(to);
978
983
  reconnectPromise = sleep.then(() => {
979
984
  if (!canProceedWithConnection()) {
@@ -987,7 +992,6 @@ var ClientTransport = class extends Transport {
987
992
  conn.close();
988
993
  throw new Error("transport state is no longer open");
989
994
  }
990
- this.retryBudget.startRestoringBudget(to);
991
995
  this.sendHandshake(to, conn);
992
996
  return conn;
993
997
  });
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  UdsConnection
3
- } from "../../../chunk-MXHIHC3U.js";
3
+ } from "../../../chunk-EVH5D43D.js";
4
4
  import {
5
5
  ClientTransport
6
- } from "../../../chunk-5XMMDOLH.js";
6
+ } from "../../../chunk-EZQFVTBL.js";
7
7
  import "../../../chunk-GFRAOY75.js";
8
8
  import {
9
9
  log
@@ -599,6 +599,8 @@ var Transport = class {
599
599
  session.updateBookkeeping(msg.ack, msg.seq);
600
600
  if (!isAck(msg.controlFlags)) {
601
601
  this.eventDispatcher.dispatchEvent("message", msg);
602
+ } else {
603
+ log?.debug(`${this.clientId} -- discarding msg ${msg.id} (ack bit set)`);
602
604
  }
603
605
  }
604
606
  /**
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  UdsConnection
3
- } from "../../../chunk-MXHIHC3U.js";
3
+ } from "../../../chunk-EVH5D43D.js";
4
4
  import {
5
5
  ServerTransport
6
- } from "../../../chunk-5XMMDOLH.js";
6
+ } from "../../../chunk-EZQFVTBL.js";
7
7
  import "../../../chunk-GFRAOY75.js";
8
8
  import {
9
9
  log
@@ -663,6 +663,8 @@ var Transport = class {
663
663
  session.updateBookkeeping(msg.ack, msg.seq);
664
664
  if (!isAck(msg.controlFlags)) {
665
665
  this.eventDispatcher.dispatchEvent("message", msg);
666
+ } else {
667
+ log?.debug(`${this.clientId} -- discarding msg ${msg.id} (ack bit set)`);
666
668
  }
667
669
  }
668
670
  /**
@@ -849,6 +851,7 @@ var ClientTransport = class extends Transport {
849
851
  log?.debug(
850
852
  `${this.clientId} -- handshake from ${parsed.from} ok (instance: ${instanceId})`
851
853
  );
854
+ this.retryBudget.startRestoringBudget(parsed.from);
852
855
  return { instanceId, from: parsed.from };
853
856
  }
854
857
  /**
@@ -865,10 +868,9 @@ var ClientTransport = class extends Transport {
865
868
  }
866
869
  let reconnectPromise = this.inflightConnectionPromises.get(to);
867
870
  if (!reconnectPromise) {
868
- log?.info(`${this.clientId} -- attempting connection to ${to}`);
869
871
  const budgetConsumed = this.retryBudget.getBudgetConsumed(to);
870
872
  if (!this.retryBudget.hasBudget(to)) {
871
- const errMsg = `not attempting to connect to ${to}, retry budget exceeded (more than ${budgetConsumed} attempts in the last ${this.retryBudget.totalBudgetRestoreTime}ms)`;
873
+ const errMsg = `tried to connect to ${to} but retry budget exceeded (more than ${budgetConsumed} attempts in the last ${this.retryBudget.totalBudgetRestoreTime}ms)`;
872
874
  log?.warn(`${this.clientId} -- ${errMsg}`);
873
875
  this.protocolError(ProtocolError.RetriesExceeded, errMsg);
874
876
  return;
@@ -878,6 +880,9 @@ var ClientTransport = class extends Transport {
878
880
  if (backoffMs > 0) {
879
881
  sleep = new Promise((resolve) => setTimeout(resolve, backoffMs));
880
882
  }
883
+ log?.info(
884
+ `${this.clientId} -- attempting connection to ${to} (${backoffMs}ms backoff)`
885
+ );
881
886
  this.retryBudget.consumeBudget(to);
882
887
  reconnectPromise = sleep.then(() => {
883
888
  if (!canProceedWithConnection()) {
@@ -891,7 +896,6 @@ var ClientTransport = class extends Transport {
891
896
  conn.close();
892
897
  throw new Error("transport state is no longer open");
893
898
  }
894
- this.retryBudget.startRestoringBudget(to);
895
899
  this.sendHandshake(to, conn);
896
900
  return conn;
897
901
  });
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  WebSocketConnection
3
- } from "../../../chunk-NSJVTNVQ.js";
3
+ } from "../../../chunk-PTRHVS6L.js";
4
4
  import {
5
5
  ClientTransport
6
- } from "../../../chunk-5XMMDOLH.js";
6
+ } from "../../../chunk-EZQFVTBL.js";
7
7
  import "../../../chunk-GFRAOY75.js";
8
8
  import {
9
9
  log
@@ -599,6 +599,8 @@ var Transport = class {
599
599
  session.updateBookkeeping(msg.ack, msg.seq);
600
600
  if (!isAck(msg.controlFlags)) {
601
601
  this.eventDispatcher.dispatchEvent("message", msg);
602
+ } else {
603
+ log?.debug(`${this.clientId} -- discarding msg ${msg.id} (ack bit set)`);
602
604
  }
603
605
  }
604
606
  /**
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  WebSocketConnection
3
- } from "../../../chunk-NSJVTNVQ.js";
3
+ } from "../../../chunk-PTRHVS6L.js";
4
4
  import {
5
5
  ServerTransport
6
- } from "../../../chunk-5XMMDOLH.js";
6
+ } from "../../../chunk-EZQFVTBL.js";
7
7
  import "../../../chunk-GFRAOY75.js";
8
8
  import "../../../chunk-H4BYJELI.js";
9
9
  import "../../../chunk-GZ7HCLLM.js";
@@ -694,6 +694,8 @@ var Transport = class {
694
694
  session.updateBookkeeping(msg.ack, msg.seq);
695
695
  if (!isAck(msg.controlFlags)) {
696
696
  this.eventDispatcher.dispatchEvent("message", msg);
697
+ } else {
698
+ log?.debug(`${this.clientId} -- discarding msg ${msg.id} (ack bit set)`);
697
699
  }
698
700
  }
699
701
  /**
@@ -880,6 +882,7 @@ var ClientTransport = class extends Transport {
880
882
  log?.debug(
881
883
  `${this.clientId} -- handshake from ${parsed.from} ok (instance: ${instanceId})`
882
884
  );
885
+ this.retryBudget.startRestoringBudget(parsed.from);
883
886
  return { instanceId, from: parsed.from };
884
887
  }
885
888
  /**
@@ -896,10 +899,9 @@ var ClientTransport = class extends Transport {
896
899
  }
897
900
  let reconnectPromise = this.inflightConnectionPromises.get(to);
898
901
  if (!reconnectPromise) {
899
- log?.info(`${this.clientId} -- attempting connection to ${to}`);
900
902
  const budgetConsumed = this.retryBudget.getBudgetConsumed(to);
901
903
  if (!this.retryBudget.hasBudget(to)) {
902
- const errMsg = `not attempting to connect to ${to}, retry budget exceeded (more than ${budgetConsumed} attempts in the last ${this.retryBudget.totalBudgetRestoreTime}ms)`;
904
+ const errMsg = `tried to connect to ${to} but retry budget exceeded (more than ${budgetConsumed} attempts in the last ${this.retryBudget.totalBudgetRestoreTime}ms)`;
903
905
  log?.warn(`${this.clientId} -- ${errMsg}`);
904
906
  this.protocolError(ProtocolError.RetriesExceeded, errMsg);
905
907
  return;
@@ -909,6 +911,9 @@ var ClientTransport = class extends Transport {
909
911
  if (backoffMs > 0) {
910
912
  sleep = new Promise((resolve) => setTimeout(resolve, backoffMs));
911
913
  }
914
+ log?.info(
915
+ `${this.clientId} -- attempting connection to ${to} (${backoffMs}ms backoff)`
916
+ );
912
917
  this.retryBudget.consumeBudget(to);
913
918
  reconnectPromise = sleep.then(() => {
914
919
  if (!canProceedWithConnection()) {
@@ -922,7 +927,6 @@ var ClientTransport = class extends Transport {
922
927
  conn.close();
923
928
  throw new Error("transport state is no longer open");
924
929
  }
925
- this.retryBudget.startRestoringBudget(to);
926
930
  this.sendHandshake(to, conn);
927
931
  return conn;
928
932
  });
@@ -6,7 +6,7 @@ import {
6
6
  ServerTransport,
7
7
  Session,
8
8
  Transport
9
- } from "../chunk-5XMMDOLH.js";
9
+ } from "../chunk-EZQFVTBL.js";
10
10
  import {
11
11
  OpaqueTransportMessageSchema,
12
12
  TransportMessageSchema
@@ -5,7 +5,7 @@ import {
5
5
  import "../chunk-RPIDSIQG.js";
6
6
  import {
7
7
  Session
8
- } from "../chunk-5XMMDOLH.js";
8
+ } from "../chunk-EZQFVTBL.js";
9
9
  import {
10
10
  coerceErrorString
11
11
  } from "../chunk-GFRAOY75.js";
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.15.3",
4
+ "version": "0.15.5",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {