@replit/river 0.26.3 → 0.26.4

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 (42) hide show
  1. package/dist/{chunk-OCL2FUTQ.js → chunk-42SXIIHP.js} +10 -8
  2. package/dist/chunk-42SXIIHP.js.map +1 -0
  3. package/dist/{chunk-MZELCWJK.js → chunk-65EMTMCV.js} +2 -2
  4. package/dist/{chunk-MZELCWJK.js.map → chunk-65EMTMCV.js.map} +1 -1
  5. package/dist/{chunk-ZY2HYJ5Y.js → chunk-CYD6GTCU.js} +2 -2
  6. package/dist/{chunk-X35QRIA5.js → chunk-DS5LF6PS.js} +4 -4
  7. package/dist/{chunk-BB2E5L4U.js → chunk-HPOR6FST.js} +22 -22
  8. package/dist/chunk-HPOR6FST.js.map +1 -0
  9. package/dist/{chunk-3JCZNGF7.js → chunk-PXRKBNWN.js} +2 -2
  10. package/dist/{chunk-JI6FFDY5.js → chunk-RSCUADHY.js} +3 -3
  11. package/dist/{client-1894a9c9.d.ts → client-6c67339a.d.ts} +1 -1
  12. package/dist/router/index.cjs +1 -1
  13. package/dist/router/index.cjs.map +1 -1
  14. package/dist/router/index.d.cts +4 -4
  15. package/dist/router/index.d.ts +4 -4
  16. package/dist/router/index.js +2 -2
  17. package/dist/{services-491d8c32.d.ts → services-6140f578.d.ts} +1 -1
  18. package/dist/transport/impls/ws/client.cjs +27 -25
  19. package/dist/transport/impls/ws/client.cjs.map +1 -1
  20. package/dist/transport/impls/ws/client.d.cts +1 -1
  21. package/dist/transport/impls/ws/client.d.ts +1 -1
  22. package/dist/transport/impls/ws/client.js +5 -5
  23. package/dist/transport/impls/ws/server.cjs +9 -7
  24. package/dist/transport/impls/ws/server.cjs.map +1 -1
  25. package/dist/transport/impls/ws/server.js +5 -5
  26. package/dist/transport/index.cjs +27 -25
  27. package/dist/transport/index.cjs.map +1 -1
  28. package/dist/transport/index.d.cts +1 -1
  29. package/dist/transport/index.d.ts +1 -1
  30. package/dist/transport/index.js +5 -5
  31. package/dist/util/testHelpers.cjs +9 -7
  32. package/dist/util/testHelpers.cjs.map +1 -1
  33. package/dist/util/testHelpers.d.cts +2 -2
  34. package/dist/util/testHelpers.d.ts +2 -2
  35. package/dist/util/testHelpers.js +3 -3
  36. package/package.json +1 -1
  37. package/dist/chunk-BB2E5L4U.js.map +0 -1
  38. package/dist/chunk-OCL2FUTQ.js.map +0 -1
  39. /package/dist/{chunk-ZY2HYJ5Y.js.map → chunk-CYD6GTCU.js.map} +0 -0
  40. /package/dist/{chunk-X35QRIA5.js.map → chunk-DS5LF6PS.js.map} +0 -0
  41. /package/dist/{chunk-3JCZNGF7.js.map → chunk-PXRKBNWN.js.map} +0 -0
  42. /package/dist/{chunk-JI6FFDY5.js.map → chunk-RSCUADHY.js.map} +0 -0
@@ -1,5 +1,5 @@
1
- import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError } from '../services-491d8c32.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-491d8c32.js';
1
+ import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError } from '../services-6140f578.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-6140f578.js';
3
3
  import { Static } from '@sinclair/typebox';
4
4
  import { Pushable } from 'it-pushable';
5
5
  import { C as Connection, s as ServerHandshakeOptions, o as ServiceContext } from '../handshake-154a0bb2.js';
@@ -8,7 +8,7 @@ import { S as ServerTransport } from '../server-1f5eb427.js';
8
8
  import '../message-ff78a233.js';
9
9
  import '@sinclair/typebox/value';
10
10
  import '@opentelemetry/api';
11
- import '../client-1894a9c9.js';
11
+ import '../client-6c67339a.js';
12
12
  import '@sinclair/typebox/errors';
13
13
  import '../types-3e5768ec.js';
14
14
 
@@ -46,6 +46,6 @@ declare function createServer<Services extends AnyServiceSchemaMap>(transport: S
46
46
  extendedContext?: Omit<ServiceContext, 'state'>;
47
47
  }>): Server<Services>;
48
48
 
49
- var version = "0.26.3";
49
+ var version = "0.26.4";
50
50
 
51
51
  export { PayloadType, version as RIVER_VERSION, Result, RiverError, Server, ServiceContext, createServer };
@@ -1,5 +1,5 @@
1
- import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError } from '../services-491d8c32.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-491d8c32.js';
1
+ import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError } from '../services-6140f578.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-6140f578.js';
3
3
  import { Static } from '@sinclair/typebox';
4
4
  import { Pushable } from 'it-pushable';
5
5
  import { C as Connection, s as ServerHandshakeOptions, o as ServiceContext } from '../handshake-154a0bb2.js';
@@ -8,7 +8,7 @@ import { S as ServerTransport } from '../server-1f5eb427.js';
8
8
  import '../message-ff78a233.js';
9
9
  import '@sinclair/typebox/value';
10
10
  import '@opentelemetry/api';
11
- import '../client-1894a9c9.js';
11
+ import '../client-6c67339a.js';
12
12
  import '@sinclair/typebox/errors';
13
13
  import '../types-3e5768ec.js';
14
14
 
@@ -46,6 +46,6 @@ declare function createServer<Services extends AnyServiceSchemaMap>(transport: S
46
46
  extendedContext?: Omit<ServiceContext, 'state'>;
47
47
  }>): Server<Services>;
48
48
 
49
- var version = "0.26.3";
49
+ var version = "0.26.4";
50
50
 
51
51
  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-3JCZNGF7.js";
13
+ } from "../chunk-PXRKBNWN.js";
14
14
  import {
15
15
  version
16
- } from "../chunk-MZELCWJK.js";
16
+ } from "../chunk-65EMTMCV.js";
17
17
  export {
18
18
  Err,
19
19
  Ok,
@@ -2,7 +2,7 @@ import { Static, TObject, TUnion, TString, TSchema, TNever, TLiteral } from '@si
2
2
  import { Pushable } from 'it-pushable';
3
3
  import { C as Connection, p as ClientHandshakeOptions, v as ServiceContextWithTransportInfo, o as ServiceContext } from './handshake-154a0bb2.js';
4
4
  import { c as TransportClientId } from './message-ff78a233.js';
5
- import { C as ClientTransport } from './client-1894a9c9.js';
5
+ import { C as ClientTransport } from './client-6c67339a.js';
6
6
 
7
7
  type AsyncIter<T> = AsyncGenerator<T, T>;
8
8
  /**
@@ -575,9 +575,6 @@ var SessionConnecting = class extends IdentifiedSessionWithGracePeriod {
575
575
  super(props);
576
576
  this.connPromise = props.connPromise;
577
577
  this.listeners = props.listeners;
578
- this.connectionTimeout = setTimeout(() => {
579
- this.listeners.onConnectionTimeout();
580
- }, this.options.connectionTimeoutMs);
581
578
  this.connPromise.then(
582
579
  (conn) => {
583
580
  if (this._isConsumed)
@@ -590,16 +587,21 @@ var SessionConnecting = class extends IdentifiedSessionWithGracePeriod {
590
587
  this.listeners.onConnectionFailed(err);
591
588
  }
592
589
  );
590
+ this.connectionTimeout = setTimeout(() => {
591
+ this.listeners.onConnectionTimeout();
592
+ }, this.options.connectionTimeoutMs);
593
593
  }
594
594
  // close a pending connection if it resolves, ignore errors if the promise
595
595
  // ends up rejected anyways
596
596
  bestEffortClose() {
597
- void this.connPromise.then((conn) => {
597
+ const logger = this.log;
598
+ const metadata = this.loggingMetadata;
599
+ this.connPromise.then((conn) => {
598
600
  conn.close();
599
- this.log?.info(
601
+ logger?.info(
600
602
  "connection eventually resolved but session has transitioned, closed connection",
601
603
  {
602
- ...this.loggingMetadata,
604
+ ...metadata,
603
605
  ...conn.loggingMetadata
604
606
  }
605
607
  );
@@ -634,7 +636,7 @@ var SessionNoConnection = class extends IdentifiedSessionWithGracePeriod {
634
636
  var import_api = require("@opentelemetry/api");
635
637
 
636
638
  // package.json
637
- var version = "0.26.3";
639
+ var version = "0.26.4";
638
640
 
639
641
  // tracing/index.ts
640
642
  function getPropagationContext(ctx) {
@@ -1634,22 +1636,7 @@ var ClientTransport = class extends Transport {
1634
1636
  backoffMs,
1635
1637
  {
1636
1638
  onBackoffFinished: () => {
1637
- const reconnectPromise = tracing_default.startActiveSpan(
1638
- "connect",
1639
- async (span) => {
1640
- try {
1641
- return await this.createNewOutgoingConnection(to);
1642
- } catch (err) {
1643
- const errStr = coerceErrorString(err);
1644
- span.recordException(errStr);
1645
- span.setStatus({ code: import_api3.SpanStatusCode.ERROR });
1646
- throw err;
1647
- } finally {
1648
- span.end();
1649
- }
1650
- }
1651
- );
1652
- this.onBackoffFinished(backingOffSession, reconnectPromise);
1639
+ this.onBackoffFinished(backingOffSession);
1653
1640
  },
1654
1641
  onSessionGracePeriodElapsed: () => {
1655
1642
  this.onSessionGracePeriodElapsed(backingOffSession);
@@ -1658,7 +1645,19 @@ var ClientTransport = class extends Transport {
1658
1645
  );
1659
1646
  this.updateSession(backingOffSession);
1660
1647
  }
1661
- onBackoffFinished(session, connPromise) {
1648
+ onBackoffFinished(session) {
1649
+ const connPromise = tracing_default.startActiveSpan("connect", async (span) => {
1650
+ try {
1651
+ return await this.createNewOutgoingConnection(session.to);
1652
+ } catch (err) {
1653
+ const errStr = coerceErrorString(err);
1654
+ span.recordException(errStr);
1655
+ span.setStatus({ code: import_api3.SpanStatusCode.ERROR });
1656
+ throw err;
1657
+ } finally {
1658
+ span.end();
1659
+ }
1660
+ });
1662
1661
  const connectingSession = ClientSessionStateGraph.transition.BackingOffToConnecting(
1663
1662
  session,
1664
1663
  connPromise,
@@ -1666,7 +1665,10 @@ var ClientTransport = class extends Transport {
1666
1665
  onConnectionEstablished: (conn) => {
1667
1666
  this.log?.debug(
1668
1667
  `connection to ${connectingSession.to} established`,
1669
- connectingSession.loggingMetadata
1668
+ {
1669
+ ...conn.loggingMetadata,
1670
+ ...connectingSession.loggingMetadata
1671
+ }
1670
1672
  );
1671
1673
  this.onConnectionEstablished(connectingSession, conn);
1672
1674
  },