@replit/river 0.15.4 → 0.15.6

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.
@@ -296,7 +296,6 @@ var LeakyBucketRateLimit = class {
296
296
  }
297
297
  this.budgetConsumed.set(user, newBudget);
298
298
  };
299
- restoreBudgetForUser();
300
299
  const intervalHandle = setInterval(
301
300
  restoreBudgetForUser,
302
301
  this.options.budgetRestoreIntervalMs
@@ -328,7 +327,7 @@ var defaultConnectionRetryOptions = {
328
327
  baseIntervalMs: 250,
329
328
  maxJitterMs: 200,
330
329
  maxBackoffMs: 32e3,
331
- attemptBudgetCapacity: 15,
330
+ attemptBudgetCapacity: 5,
332
331
  budgetRestoreIntervalMs: 200
333
332
  };
334
333
  var defaultClientTransportOptions = {
@@ -513,13 +512,15 @@ var Transport = class {
513
512
  log?.error(
514
513
  `${this.clientId} -- received out-of-order msg (got: ${msg.seq}, wanted: ${session.nextExpectedSeq}), marking connection as dead: ${JSON.stringify(msg)}`
515
514
  );
516
- session.closeStaleConnection(session.connection);
515
+ session.close();
517
516
  }
518
517
  return;
519
518
  }
520
519
  session.updateBookkeeping(msg.ack, msg.seq);
521
520
  if (!isAck(msg.controlFlags)) {
522
521
  this.eventDispatcher.dispatchEvent("message", msg);
522
+ } else {
523
+ log?.debug(`${this.clientId} -- discarding msg ${msg.id} (ack bit set)`);
523
524
  }
524
525
  }
525
526
  /**
@@ -736,7 +737,7 @@ var ClientTransport = class extends Transport {
736
737
  sleep = new Promise((resolve) => setTimeout(resolve, backoffMs));
737
738
  }
738
739
  log?.info(
739
- `${this.clientId} -- attempting connection to ${to} (${backoffMs} backoff)`
740
+ `${this.clientId} -- attempting connection to ${to} (${backoffMs}ms backoff)`
740
741
  );
741
742
  this.retryBudget.consumeBudget(to);
742
743
  reconnectPromise = sleep.then(() => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Connection
3
- } from "./chunk-5TYDJKOP.js";
3
+ } from "./chunk-37HZIKJO.js";
4
4
 
5
5
  // transport/transforms/messageFraming.ts
6
6
  import { Transform } from "node:stream";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Connection
3
- } from "./chunk-5TYDJKOP.js";
3
+ } from "./chunk-37HZIKJO.js";
4
4
 
5
5
  // transport/impls/ws/connection.ts
6
6
  var WebSocketConnection = class extends Connection {
@@ -483,7 +483,6 @@ var LeakyBucketRateLimit = class {
483
483
  }
484
484
  this.budgetConsumed.set(user, newBudget);
485
485
  };
486
- restoreBudgetForUser();
487
486
  const intervalHandle = setInterval(
488
487
  restoreBudgetForUser,
489
488
  this.options.budgetRestoreIntervalMs
@@ -567,7 +566,7 @@ var defaultConnectionRetryOptions = {
567
566
  baseIntervalMs: 250,
568
567
  maxJitterMs: 200,
569
568
  maxBackoffMs: 32e3,
570
- attemptBudgetCapacity: 15,
569
+ attemptBudgetCapacity: 5,
571
570
  budgetRestoreIntervalMs: 200
572
571
  };
573
572
  var defaultClientTransportOptions = {
@@ -752,13 +751,15 @@ var Transport = class {
752
751
  log?.error(
753
752
  `${this.clientId} -- received out-of-order msg (got: ${msg.seq}, wanted: ${session.nextExpectedSeq}), marking connection as dead: ${JSON.stringify(msg)}`
754
753
  );
755
- session.closeStaleConnection(session.connection);
754
+ session.close();
756
755
  }
757
756
  return;
758
757
  }
759
758
  session.updateBookkeeping(msg.ack, msg.seq);
760
759
  if (!isAck(msg.controlFlags)) {
761
760
  this.eventDispatcher.dispatchEvent("message", msg);
761
+ } else {
762
+ log?.debug(`${this.clientId} -- discarding msg ${msg.id} (ack bit set)`);
762
763
  }
763
764
  }
764
765
  /**
@@ -975,7 +976,7 @@ var ClientTransport = class extends Transport {
975
976
  sleep = new Promise((resolve) => setTimeout(resolve, backoffMs));
976
977
  }
977
978
  log?.info(
978
- `${this.clientId} -- attempting connection to ${to} (${backoffMs} backoff)`
979
+ `${this.clientId} -- attempting connection to ${to} (${backoffMs}ms backoff)`
979
980
  );
980
981
  this.retryBudget.consumeBudget(to);
981
982
  reconnectPromise = sleep.then(() => {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  UdsConnection
3
- } from "../../../chunk-QF3XH65C.js";
3
+ } from "../../../chunk-IZLLS6QJ.js";
4
4
  import {
5
5
  ClientTransport
6
- } from "../../../chunk-5TYDJKOP.js";
6
+ } from "../../../chunk-37HZIKJO.js";
7
7
  import "../../../chunk-GFRAOY75.js";
8
8
  import {
9
9
  log
@@ -407,7 +407,7 @@ var defaultConnectionRetryOptions = {
407
407
  baseIntervalMs: 250,
408
408
  maxJitterMs: 200,
409
409
  maxBackoffMs: 32e3,
410
- attemptBudgetCapacity: 15,
410
+ attemptBudgetCapacity: 5,
411
411
  budgetRestoreIntervalMs: 200
412
412
  };
413
413
  var defaultClientTransportOptions = {
@@ -592,13 +592,15 @@ var Transport = class {
592
592
  log?.error(
593
593
  `${this.clientId} -- received out-of-order msg (got: ${msg.seq}, wanted: ${session.nextExpectedSeq}), marking connection as dead: ${JSON.stringify(msg)}`
594
594
  );
595
- session.closeStaleConnection(session.connection);
595
+ session.close();
596
596
  }
597
597
  return;
598
598
  }
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-QF3XH65C.js";
3
+ } from "../../../chunk-IZLLS6QJ.js";
4
4
  import {
5
5
  ServerTransport
6
- } from "../../../chunk-5TYDJKOP.js";
6
+ } from "../../../chunk-37HZIKJO.js";
7
7
  import "../../../chunk-GFRAOY75.js";
8
8
  import {
9
9
  log
@@ -387,7 +387,6 @@ var LeakyBucketRateLimit = class {
387
387
  }
388
388
  this.budgetConsumed.set(user, newBudget);
389
389
  };
390
- restoreBudgetForUser();
391
390
  const intervalHandle = setInterval(
392
391
  restoreBudgetForUser,
393
392
  this.options.budgetRestoreIntervalMs
@@ -471,7 +470,7 @@ var defaultConnectionRetryOptions = {
471
470
  baseIntervalMs: 250,
472
471
  maxJitterMs: 200,
473
472
  maxBackoffMs: 32e3,
474
- attemptBudgetCapacity: 15,
473
+ attemptBudgetCapacity: 5,
475
474
  budgetRestoreIntervalMs: 200
476
475
  };
477
476
  var defaultClientTransportOptions = {
@@ -656,13 +655,15 @@ var Transport = class {
656
655
  log?.error(
657
656
  `${this.clientId} -- received out-of-order msg (got: ${msg.seq}, wanted: ${session.nextExpectedSeq}), marking connection as dead: ${JSON.stringify(msg)}`
658
657
  );
659
- session.closeStaleConnection(session.connection);
658
+ session.close();
660
659
  }
661
660
  return;
662
661
  }
663
662
  session.updateBookkeeping(msg.ack, msg.seq);
664
663
  if (!isAck(msg.controlFlags)) {
665
664
  this.eventDispatcher.dispatchEvent("message", msg);
665
+ } else {
666
+ log?.debug(`${this.clientId} -- discarding msg ${msg.id} (ack bit set)`);
666
667
  }
667
668
  }
668
669
  /**
@@ -879,7 +880,7 @@ var ClientTransport = class extends Transport {
879
880
  sleep = new Promise((resolve) => setTimeout(resolve, backoffMs));
880
881
  }
881
882
  log?.info(
882
- `${this.clientId} -- attempting connection to ${to} (${backoffMs} backoff)`
883
+ `${this.clientId} -- attempting connection to ${to} (${backoffMs}ms backoff)`
883
884
  );
884
885
  this.retryBudget.consumeBudget(to);
885
886
  reconnectPromise = sleep.then(() => {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  WebSocketConnection
3
- } from "../../../chunk-DEYIG5LG.js";
3
+ } from "../../../chunk-UPMTISRG.js";
4
4
  import {
5
5
  ClientTransport
6
- } from "../../../chunk-5TYDJKOP.js";
6
+ } from "../../../chunk-37HZIKJO.js";
7
7
  import "../../../chunk-GFRAOY75.js";
8
8
  import {
9
9
  log
@@ -407,7 +407,7 @@ var defaultConnectionRetryOptions = {
407
407
  baseIntervalMs: 250,
408
408
  maxJitterMs: 200,
409
409
  maxBackoffMs: 32e3,
410
- attemptBudgetCapacity: 15,
410
+ attemptBudgetCapacity: 5,
411
411
  budgetRestoreIntervalMs: 200
412
412
  };
413
413
  var defaultClientTransportOptions = {
@@ -592,13 +592,15 @@ var Transport = class {
592
592
  log?.error(
593
593
  `${this.clientId} -- received out-of-order msg (got: ${msg.seq}, wanted: ${session.nextExpectedSeq}), marking connection as dead: ${JSON.stringify(msg)}`
594
594
  );
595
- session.closeStaleConnection(session.connection);
595
+ session.close();
596
596
  }
597
597
  return;
598
598
  }
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-DEYIG5LG.js";
3
+ } from "../../../chunk-UPMTISRG.js";
4
4
  import {
5
5
  ServerTransport
6
- } from "../../../chunk-5TYDJKOP.js";
6
+ } from "../../../chunk-37HZIKJO.js";
7
7
  import "../../../chunk-GFRAOY75.js";
8
8
  import "../../../chunk-H4BYJELI.js";
9
9
  import "../../../chunk-GZ7HCLLM.js";
@@ -418,7 +418,6 @@ var LeakyBucketRateLimit = class {
418
418
  }
419
419
  this.budgetConsumed.set(user, newBudget);
420
420
  };
421
- restoreBudgetForUser();
422
421
  const intervalHandle = setInterval(
423
422
  restoreBudgetForUser,
424
423
  this.options.budgetRestoreIntervalMs
@@ -502,7 +501,7 @@ var defaultConnectionRetryOptions = {
502
501
  baseIntervalMs: 250,
503
502
  maxJitterMs: 200,
504
503
  maxBackoffMs: 32e3,
505
- attemptBudgetCapacity: 15,
504
+ attemptBudgetCapacity: 5,
506
505
  budgetRestoreIntervalMs: 200
507
506
  };
508
507
  var defaultClientTransportOptions = {
@@ -687,13 +686,15 @@ var Transport = class {
687
686
  log?.error(
688
687
  `${this.clientId} -- received out-of-order msg (got: ${msg.seq}, wanted: ${session.nextExpectedSeq}), marking connection as dead: ${JSON.stringify(msg)}`
689
688
  );
690
- session.closeStaleConnection(session.connection);
689
+ session.close();
691
690
  }
692
691
  return;
693
692
  }
694
693
  session.updateBookkeeping(msg.ack, msg.seq);
695
694
  if (!isAck(msg.controlFlags)) {
696
695
  this.eventDispatcher.dispatchEvent("message", msg);
696
+ } else {
697
+ log?.debug(`${this.clientId} -- discarding msg ${msg.id} (ack bit set)`);
697
698
  }
698
699
  }
699
700
  /**
@@ -910,7 +911,7 @@ var ClientTransport = class extends Transport {
910
911
  sleep = new Promise((resolve) => setTimeout(resolve, backoffMs));
911
912
  }
912
913
  log?.info(
913
- `${this.clientId} -- attempting connection to ${to} (${backoffMs} backoff)`
914
+ `${this.clientId} -- attempting connection to ${to} (${backoffMs}ms backoff)`
914
915
  );
915
916
  this.retryBudget.consumeBudget(to);
916
917
  reconnectPromise = sleep.then(() => {
@@ -6,7 +6,7 @@ import {
6
6
  ServerTransport,
7
7
  Session,
8
8
  Transport
9
- } from "../chunk-5TYDJKOP.js";
9
+ } from "../chunk-37HZIKJO.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-5TYDJKOP.js";
8
+ } from "../chunk-37HZIKJO.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.4",
4
+ "version": "0.15.6",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {