@replit/river 0.201.0 → 0.203.0

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 (44) hide show
  1. package/dist/{chunk-UBUD2LMZ.js → chunk-D5EIDBUT.js} +3 -3
  2. package/dist/{chunk-OZ3ITXW5.js → chunk-DGT3MPD4.js} +13 -3
  3. package/dist/chunk-DGT3MPD4.js.map +1 -0
  4. package/dist/{chunk-PJ4GJ5CU.js → chunk-FG22HHCY.js} +11 -4
  5. package/dist/chunk-FG22HHCY.js.map +1 -0
  6. package/dist/{chunk-7IUEEQP7.js → chunk-SZHNMLKC.js} +2 -2
  7. package/dist/{chunk-7IUEEQP7.js.map → chunk-SZHNMLKC.js.map} +1 -1
  8. package/dist/{chunk-52DVJUVZ.js → chunk-XBPEUVWN.js} +2 -2
  9. package/dist/{client-a32692b0.d.ts → client-5d2e41a3.d.ts} +7 -1
  10. package/dist/{connection-48d021ca.d.ts → connection-11a4af0f.d.ts} +1 -1
  11. package/dist/{context-8d263a7f.d.ts → context-d6dd8a1a.d.ts} +14 -0
  12. package/dist/router/index.cjs +27 -9
  13. package/dist/router/index.cjs.map +1 -1
  14. package/dist/router/index.d.cts +9 -8
  15. package/dist/router/index.d.ts +9 -8
  16. package/dist/router/index.js +27 -9
  17. package/dist/router/index.js.map +1 -1
  18. package/dist/{server-48d90a77.d.ts → server-e46399f9.d.ts} +1 -1
  19. package/dist/{services-e71ea921.d.ts → services-56cbea0d.d.ts} +9 -4
  20. package/dist/testUtil/index.cjs +20 -3
  21. package/dist/testUtil/index.cjs.map +1 -1
  22. package/dist/testUtil/index.d.cts +5 -5
  23. package/dist/testUtil/index.d.ts +5 -5
  24. package/dist/testUtil/index.js +4 -4
  25. package/dist/transport/impls/ws/client.cjs +20 -3
  26. package/dist/transport/impls/ws/client.cjs.map +1 -1
  27. package/dist/transport/impls/ws/client.d.cts +3 -3
  28. package/dist/transport/impls/ws/client.d.ts +3 -3
  29. package/dist/transport/impls/ws/client.js +4 -4
  30. package/dist/transport/impls/ws/server.cjs +10 -3
  31. package/dist/transport/impls/ws/server.cjs.map +1 -1
  32. package/dist/transport/impls/ws/server.d.cts +3 -3
  33. package/dist/transport/impls/ws/server.d.ts +3 -3
  34. package/dist/transport/impls/ws/server.js +4 -4
  35. package/dist/transport/index.cjs +20 -3
  36. package/dist/transport/index.cjs.map +1 -1
  37. package/dist/transport/index.d.cts +4 -4
  38. package/dist/transport/index.d.ts +4 -4
  39. package/dist/transport/index.js +4 -4
  40. package/package.json +1 -1
  41. package/dist/chunk-OZ3ITXW5.js.map +0 -1
  42. package/dist/chunk-PJ4GJ5CU.js.map +0 -1
  43. /package/dist/{chunk-UBUD2LMZ.js.map → chunk-D5EIDBUT.js.map} +0 -0
  44. /package/dist/{chunk-52DVJUVZ.js.map → chunk-XBPEUVWN.js.map} +0 -0
@@ -1,17 +1,17 @@
1
- import { b as ProvidedClientTransportOptions, c as ProvidedServerTransportOptions, n as ClientHandshakeOptions, C as Connection, r as ServerHandshakeOptions, T as Transport, A as SessionOptions, m as ClientTransportOptions, e as SessionNoConnection, B as SessionBoundSendFn } from '../context-8d263a7f.js';
2
- import { C as ClientTransport } from '../client-a32692b0.js';
3
- import { S as ServerTransport } from '../server-48d90a77.js';
1
+ import { b as ProvidedClientTransportOptions, c as ProvidedServerTransportOptions, n as ClientHandshakeOptions, C as Connection, r as ServerHandshakeOptions, T as Transport, A as SessionOptions, m as ClientTransportOptions, e as SessionNoConnection, B as SessionBoundSendFn } from '../context-d6dd8a1a.js';
2
+ import { C as ClientTransport } from '../client-5d2e41a3.js';
3
+ import { S as ServerTransport } from '../server-e46399f9.js';
4
4
  import { c as TransportClientId, f as PartialTransportMessage, b as OpaqueTransportMessage } from '../message-3def9ded.js';
5
5
  import { Static } from '@sinclair/typebox';
6
- import { E as BaseErrorSchemaType, u as Readable, X as ReadableIterator, Y as ReadableResult } from '../services-e71ea921.js';
6
+ import { E as BaseErrorSchemaType, u as Readable, X as ReadableIterator, Y as ReadableResult } from '../services-56cbea0d.js';
7
7
  import NodeWs from 'ws';
8
8
  import http from 'node:http';
9
9
  import { W as WsLike } from '../wslike-e0b32dd5.js';
10
10
  import { Duplex } from 'node:stream';
11
11
  import '@sinclair/typebox/errors';
12
+ import '@opentelemetry/api';
12
13
  import '../types-3e5768ec.js';
13
14
  import '@sinclair/typebox/value';
14
- import '@opentelemetry/api';
15
15
 
16
16
  interface TestTransportOptions {
17
17
  client?: ProvidedClientTransportOptions;
@@ -1,17 +1,17 @@
1
- import { b as ProvidedClientTransportOptions, c as ProvidedServerTransportOptions, n as ClientHandshakeOptions, C as Connection, r as ServerHandshakeOptions, T as Transport, A as SessionOptions, m as ClientTransportOptions, e as SessionNoConnection, B as SessionBoundSendFn } from '../context-8d263a7f.js';
2
- import { C as ClientTransport } from '../client-a32692b0.js';
3
- import { S as ServerTransport } from '../server-48d90a77.js';
1
+ import { b as ProvidedClientTransportOptions, c as ProvidedServerTransportOptions, n as ClientHandshakeOptions, C as Connection, r as ServerHandshakeOptions, T as Transport, A as SessionOptions, m as ClientTransportOptions, e as SessionNoConnection, B as SessionBoundSendFn } from '../context-d6dd8a1a.js';
2
+ import { C as ClientTransport } from '../client-5d2e41a3.js';
3
+ import { S as ServerTransport } from '../server-e46399f9.js';
4
4
  import { c as TransportClientId, f as PartialTransportMessage, b as OpaqueTransportMessage } from '../message-3def9ded.js';
5
5
  import { Static } from '@sinclair/typebox';
6
- import { E as BaseErrorSchemaType, u as Readable, X as ReadableIterator, Y as ReadableResult } from '../services-e71ea921.js';
6
+ import { E as BaseErrorSchemaType, u as Readable, X as ReadableIterator, Y as ReadableResult } from '../services-56cbea0d.js';
7
7
  import NodeWs from 'ws';
8
8
  import http from 'node:http';
9
9
  import { W as WsLike } from '../wslike-e0b32dd5.js';
10
10
  import { Duplex } from 'node:stream';
11
11
  import '@sinclair/typebox/errors';
12
+ import '@opentelemetry/api';
12
13
  import '../types-3e5768ec.js';
13
14
  import '@sinclair/typebox/value';
14
- import '@opentelemetry/api';
15
15
 
16
16
  interface TestTransportOptions {
17
17
  client?: ProvidedClientTransportOptions;
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  ClientTransport
3
- } from "../chunk-OZ3ITXW5.js";
3
+ } from "../chunk-DGT3MPD4.js";
4
4
  import {
5
5
  ServerTransport
6
- } from "../chunk-UBUD2LMZ.js";
6
+ } from "../chunk-D5EIDBUT.js";
7
7
  import {
8
8
  Connection,
9
9
  SessionStateGraph,
10
10
  defaultClientTransportOptions,
11
11
  defaultTransportOptions
12
- } from "../chunk-PJ4GJ5CU.js";
12
+ } from "../chunk-FG22HHCY.js";
13
13
  import {
14
14
  currentProtocolVersion
15
- } from "../chunk-7IUEEQP7.js";
15
+ } from "../chunk-SZHNMLKC.js";
16
16
  import "../chunk-LHH5LQ7C.js";
17
17
  import "../chunk-AJGIY2UB.js";
18
18
 
@@ -398,6 +398,14 @@ var StateMachineState = class {
398
398
  * and we've moved on to another state
399
399
  */
400
400
  _isConsumed;
401
+ /**
402
+ * Cleanup this state machine state and mark it as consumed.
403
+ * After calling close, it is an error to access any properties on the state.
404
+ * You should never need to call this as a consumer.
405
+ *
406
+ * If you're looking to close the session from the client,
407
+ * use `.hardDisconnect` on the client transport.
408
+ */
401
409
  close() {
402
410
  this._handleClose();
403
411
  }
@@ -452,9 +460,8 @@ var CommonSession = class extends StateMachineState {
452
460
  parseMsg(msg) {
453
461
  const parsedMsg = this.options.codec.fromBuffer(msg);
454
462
  if (parsedMsg === null) {
455
- const decodedBuffer = new TextDecoder().decode(Buffer.from(msg));
456
463
  this.log?.error(
457
- `received malformed msg: ${decodedBuffer}`,
464
+ `received malformed msg: ${Buffer.from(msg).toString("base64")}`,
458
465
  this.loggingMetadata
459
466
  );
460
467
  return null;
@@ -634,7 +641,7 @@ var SessionNoConnection = class extends IdentifiedSessionWithGracePeriod {
634
641
  var import_api = require("@opentelemetry/api");
635
642
 
636
643
  // package.json
637
- var version = "0.201.0";
644
+ var version = "0.203.0";
638
645
 
639
646
  // tracing/index.ts
640
647
  function getPropagationContext(ctx) {
@@ -1705,6 +1712,16 @@ var ClientTransport = class extends Transport {
1705
1712
  );
1706
1713
  this.updateSession(backingOffSession);
1707
1714
  }
1715
+ /**
1716
+ * Manually kills all sessions to the server (including all pending state).
1717
+ * This is useful for when you want to close all connections to a server
1718
+ * and don't want to wait for the grace period to elapse.
1719
+ */
1720
+ hardDisconnect() {
1721
+ for (const session of this.sessions.values()) {
1722
+ this.deleteSession(session);
1723
+ }
1724
+ }
1708
1725
  onBackoffFinished(session) {
1709
1726
  const connPromise = tracing_default.startActiveSpan("connect", async (span) => {
1710
1727
  try {