@replit/river 0.21.0 → 0.21.1

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 (58) hide show
  1. package/dist/{chunk-2ERP6FUE.js → chunk-3Y7AB5EB.js} +2 -2
  2. package/dist/{chunk-MJR36SUY.js → chunk-FDLAPYCK.js} +2 -2
  3. package/dist/{chunk-QU2EE6YU.js → chunk-JMXO5L2X.js} +21 -14
  4. package/dist/chunk-JMXO5L2X.js.map +1 -0
  5. package/dist/{chunk-NFV77C2M.js → chunk-NCXUFDVL.js} +14 -9
  6. package/dist/{chunk-NFV77C2M.js.map → chunk-NCXUFDVL.js.map} +1 -1
  7. package/dist/{chunk-DT5JS6TM.js → chunk-OTQNCLFH.js} +1 -1
  8. package/dist/chunk-OTQNCLFH.js.map +1 -0
  9. package/dist/{connection-8a71dbe2.d.ts → connection-76c5ed01.d.ts} +1 -1
  10. package/dist/{connection-d49d5d56.d.ts → connection-975b25c9.d.ts} +1 -1
  11. package/dist/{index-3ac92295.d.ts → index-dfad460e.d.ts} +2 -0
  12. package/dist/logging/index.cjs.map +1 -1
  13. package/dist/logging/index.d.cts +1 -1
  14. package/dist/logging/index.d.ts +1 -1
  15. package/dist/logging/index.js +1 -1
  16. package/dist/router/index.cjs +12 -7
  17. package/dist/router/index.cjs.map +1 -1
  18. package/dist/router/index.d.cts +4 -4
  19. package/dist/router/index.d.ts +4 -4
  20. package/dist/router/index.js +2 -2
  21. package/dist/{services-abc077db.d.ts → services-7b716dcf.d.ts} +1 -1
  22. package/dist/{services-8496d6e8.d.ts → services-9c496c6e.d.ts} +1 -1
  23. package/dist/transport/impls/uds/client.cjs +17 -11
  24. package/dist/transport/impls/uds/client.cjs.map +1 -1
  25. package/dist/transport/impls/uds/client.d.cts +2 -2
  26. package/dist/transport/impls/uds/client.d.ts +2 -2
  27. package/dist/transport/impls/uds/client.js +3 -3
  28. package/dist/transport/impls/uds/server.cjs +17 -11
  29. package/dist/transport/impls/uds/server.cjs.map +1 -1
  30. package/dist/transport/impls/uds/server.d.cts +2 -2
  31. package/dist/transport/impls/uds/server.d.ts +2 -2
  32. package/dist/transport/impls/uds/server.js +3 -3
  33. package/dist/transport/impls/ws/client.cjs +17 -11
  34. package/dist/transport/impls/ws/client.cjs.map +1 -1
  35. package/dist/transport/impls/ws/client.d.cts +2 -2
  36. package/dist/transport/impls/ws/client.d.ts +2 -2
  37. package/dist/transport/impls/ws/client.js +3 -3
  38. package/dist/transport/impls/ws/server.cjs +17 -11
  39. package/dist/transport/impls/ws/server.cjs.map +1 -1
  40. package/dist/transport/impls/ws/server.d.cts +2 -2
  41. package/dist/transport/impls/ws/server.d.ts +2 -2
  42. package/dist/transport/impls/ws/server.js +3 -3
  43. package/dist/transport/index.cjs +19 -12
  44. package/dist/transport/index.cjs.map +1 -1
  45. package/dist/transport/index.d.cts +2 -2
  46. package/dist/transport/index.d.ts +2 -2
  47. package/dist/transport/index.js +2 -2
  48. package/dist/util/testHelpers.cjs +15 -13
  49. package/dist/util/testHelpers.cjs.map +1 -1
  50. package/dist/util/testHelpers.d.cts +8 -5
  51. package/dist/util/testHelpers.d.ts +8 -5
  52. package/dist/util/testHelpers.js +5 -10
  53. package/dist/util/testHelpers.js.map +1 -1
  54. package/package.json +1 -1
  55. package/dist/chunk-DT5JS6TM.js.map +0 -1
  56. package/dist/chunk-QU2EE6YU.js.map +0 -1
  57. /package/dist/{chunk-2ERP6FUE.js.map → chunk-3Y7AB5EB.js.map} +0 -0
  58. /package/dist/{chunk-MJR36SUY.js.map → chunk-FDLAPYCK.js.map} +0 -0
@@ -1,9 +1,9 @@
1
- import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError, S as ServiceContext } from '../services-abc077db.js';
2
- export { C as Client, E as Err, O as Ok, B as Output, k as ProcErrors, g as ProcHandler, h as ProcInit, i as ProcInput, j as ProcOutput, l as ProcType, a as Procedure, o as ProcedureMap, d as ProcedureResult, p as RPCProcedure, z as ResultUnwrapErr, y as ResultUnwrapOk, x as RiverErrorSchema, c as RiverUncaughtSchema, n as SerializedServerSchema, e as Service, f as ServiceConfiguration, u as ServiceContextWithState, v as ServiceContextWithTransportInfo, m as ServiceSchema, r as StreamProcedure, q as SubscriptionProcedure, w as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, t as createClient, s as serializeSchema } from '../services-abc077db.js';
1
+ import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError, S as ServiceContext } from '../services-7b716dcf.js';
2
+ export { C as Client, E as Err, O as Ok, B as Output, k as ProcErrors, g as ProcHandler, h as ProcInit, i as ProcInput, j as ProcOutput, l as ProcType, a as Procedure, o as ProcedureMap, d as ProcedureResult, p as RPCProcedure, z as ResultUnwrapErr, y as ResultUnwrapOk, x as RiverErrorSchema, c as RiverUncaughtSchema, n as SerializedServerSchema, e as Service, f as ServiceConfiguration, u as ServiceContextWithState, v as ServiceContextWithTransportInfo, m as ServiceSchema, r as StreamProcedure, q as SubscriptionProcedure, w as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, t as createClient, s as serializeSchema } from '../services-7b716dcf.js';
3
3
  import { Static } from '@sinclair/typebox';
4
4
  import { ServerTransport } from '../transport/index.cjs';
5
5
  import { Pushable } from 'it-pushable';
6
- import { C as Connection } from '../index-3ac92295.js';
6
+ import { C as Connection } from '../index-dfad460e.js';
7
7
  import '../types-3e5768ec.js';
8
8
 
9
9
  /**
@@ -36,6 +36,6 @@ interface ProcStream {
36
36
  */
37
37
  declare function createServer<Services extends AnyServiceSchemaMap>(transport: ServerTransport<Connection>, services: Services, extendedContext?: Omit<ServiceContext, 'state'>): Server<Services>;
38
38
 
39
- var version = "0.21.0";
39
+ var version = "0.21.1";
40
40
 
41
41
  export { PayloadType, version as RIVER_VERSION, Result, RiverError, Server, ServiceContext, createServer };
@@ -1,9 +1,9 @@
1
- import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError, S as ServiceContext } from '../services-8496d6e8.js';
2
- export { C as Client, E as Err, O as Ok, B as Output, k as ProcErrors, g as ProcHandler, h as ProcInit, i as ProcInput, j as ProcOutput, l as ProcType, a as Procedure, o as ProcedureMap, d as ProcedureResult, p as RPCProcedure, z as ResultUnwrapErr, y as ResultUnwrapOk, x as RiverErrorSchema, c as RiverUncaughtSchema, n as SerializedServerSchema, e as Service, f as ServiceConfiguration, u as ServiceContextWithState, v as ServiceContextWithTransportInfo, m as ServiceSchema, r as StreamProcedure, q as SubscriptionProcedure, w as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, t as createClient, s as serializeSchema } from '../services-8496d6e8.js';
1
+ import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError, S as ServiceContext } from '../services-9c496c6e.js';
2
+ export { C as Client, E as Err, O as Ok, B as Output, k as ProcErrors, g as ProcHandler, h as ProcInit, i as ProcInput, j as ProcOutput, l as ProcType, a as Procedure, o as ProcedureMap, d as ProcedureResult, p as RPCProcedure, z as ResultUnwrapErr, y as ResultUnwrapOk, x as RiverErrorSchema, c as RiverUncaughtSchema, n as SerializedServerSchema, e as Service, f as ServiceConfiguration, u as ServiceContextWithState, v as ServiceContextWithTransportInfo, m as ServiceSchema, r as StreamProcedure, q as SubscriptionProcedure, w as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, t as createClient, s as serializeSchema } from '../services-9c496c6e.js';
3
3
  import { Static } from '@sinclair/typebox';
4
4
  import { ServerTransport } from '../transport/index.js';
5
5
  import { Pushable } from 'it-pushable';
6
- import { C as Connection } from '../index-3ac92295.js';
6
+ import { C as Connection } from '../index-dfad460e.js';
7
7
  import '../types-3e5768ec.js';
8
8
 
9
9
  /**
@@ -36,6 +36,6 @@ interface ProcStream {
36
36
  */
37
37
  declare function createServer<Services extends AnyServiceSchemaMap>(transport: ServerTransport<Connection>, services: Services, extendedContext?: Omit<ServiceContext, 'state'>): Server<Services>;
38
38
 
39
- var version = "0.21.0";
39
+ var version = "0.21.1";
40
40
 
41
41
  export { PayloadType, version as RIVER_VERSION, Result, RiverError, Server, ServiceContext, createServer };
@@ -9,9 +9,9 @@ import {
9
9
  createServer,
10
10
  serializeSchema,
11
11
  version
12
- } from "../chunk-NFV77C2M.js";
12
+ } from "../chunk-NCXUFDVL.js";
13
13
  import "../chunk-5WFL722S.js";
14
- import "../chunk-DT5JS6TM.js";
14
+ import "../chunk-OTQNCLFH.js";
15
15
  export {
16
16
  Err,
17
17
  Ok,
@@ -1,7 +1,7 @@
1
1
  import { Static, TObject, TUnion, TString, TSchema, TNever, TLiteral } from '@sinclair/typebox';
2
2
  import { ClientTransport } from './transport/index.cjs';
3
3
  import { Pushable } from 'it-pushable';
4
- import { C as Connection, T as TransportClientId, a as Session, b as ParsedHandshakeMetadata } from './index-3ac92295.js';
4
+ import { C as Connection, T as TransportClientId, a as Session, b as ParsedHandshakeMetadata } from './index-dfad460e.js';
5
5
 
6
6
  type AsyncIter<T> = AsyncGenerator<T, T>;
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  import { Static, TObject, TUnion, TString, TSchema, TNever, TLiteral } from '@sinclair/typebox';
2
2
  import { ClientTransport } from './transport/index.js';
3
3
  import { Pushable } from 'it-pushable';
4
- import { C as Connection, T as TransportClientId, a as Session, b as ParsedHandshakeMetadata } from './index-3ac92295.js';
4
+ import { C as Connection, T as TransportClientId, a as Session, b as ParsedHandshakeMetadata } from './index-dfad460e.js';
5
5
 
6
6
  type AsyncIter<T> = AsyncGenerator<T, T>;
7
7
  /**
@@ -265,18 +265,20 @@ var Session = class {
265
265
  log?.error(errMsg, {
266
266
  ...this.loggingMetadata,
267
267
  fullTransportMessage: msg,
268
- connId: conn.debugId
268
+ connId: conn.debugId,
269
+ tags: ["invariant-violation"]
269
270
  });
270
- throw new Error(errMsg);
271
+ conn.close();
272
+ return;
271
273
  }
272
274
  }
273
275
  }
274
276
  updateBookkeeping(ack, seq) {
275
277
  if (seq + 1 < this.ack) {
276
- log?.error(
277
- `received stale seq ${seq} + 1 < ${this.ack}`,
278
- this.loggingMetadata
279
- );
278
+ log?.error(`received stale seq ${seq} + 1 < ${this.ack}`, {
279
+ ...this.loggingMetadata,
280
+ tags: ["invariant-violation"]
281
+ });
280
282
  return;
281
283
  }
282
284
  this.sendBuffer = this.sendBuffer.filter((unacked) => unacked.seq >= ack);
@@ -797,9 +799,10 @@ var Transport = class {
797
799
  return;
798
800
  const session = this.sessions.get(msg.from);
799
801
  if (!session) {
800
- log?.error(`(invariant violation) no existing session for ${msg.from}`, {
802
+ log?.error(`no existing session for ${msg.from}`, {
801
803
  clientId: this.clientId,
802
- fullTransportMessage: msg
804
+ fullTransportMessage: msg,
805
+ tags: ["invariant-violation"]
803
806
  });
804
807
  return;
805
808
  }
@@ -818,7 +821,8 @@ var Transport = class {
818
821
  const errMsg = `received out-of-order msg (got seq: ${msg.seq}, wanted seq: ${session.nextExpectedSeq})`;
819
822
  log?.error(`${errMsg}, marking connection as dead`, {
820
823
  clientId: this.clientId,
821
- fullTransportMessage: msg
824
+ fullTransportMessage: msg,
825
+ tags: ["invariant-violation"]
822
826
  });
823
827
  this.protocolError(ProtocolError.MessageOrderingViolated, errMsg);
824
828
  session.close();
@@ -862,7 +866,8 @@ var Transport = class {
862
866
  const err = "transport is destroyed, cant send";
863
867
  log?.error(err, {
864
868
  clientId: this.clientId,
865
- partialTransportMessage: msg
869
+ partialTransportMessage: msg,
870
+ tags: ["invariant-violation"]
866
871
  });
867
872
  this.protocolError(ProtocolError.UseAfterDestroy, err);
868
873
  return void 0;
@@ -1197,7 +1202,8 @@ var ClientTransport = class extends Transport {
1197
1202
  if (!import_value.Value.Check(this.options.handshake.schema, metadata)) {
1198
1203
  log?.error(`handshake metadata did not match schema`, {
1199
1204
  clientId: this.clientId,
1200
- connectedTo: to
1205
+ connectedTo: to,
1206
+ tags: ["invariant-violation"]
1201
1207
  });
1202
1208
  this.protocolError(
1203
1209
  ProtocolError.HandshakeFailed,