@replit/river 0.23.0 → 0.23.2

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 (63) hide show
  1. package/dist/{chunk-PCKHBAVP.js → chunk-3ZS3RHZF.js} +2 -2
  2. package/dist/chunk-3ZS3RHZF.js.map +1 -0
  3. package/dist/{chunk-DZOATC6M.js → chunk-6Z4YTBOM.js} +2 -2
  4. package/dist/{chunk-ZF2UFTNN.js → chunk-KPLLLP3F.js} +2 -2
  5. package/dist/{chunk-MJUFKPBT.js → chunk-LHLQY5FR.js} +45 -25
  6. package/dist/chunk-LHLQY5FR.js.map +1 -0
  7. package/dist/{chunk-OTQNCLFH.js → chunk-SPP7ACQN.js} +29 -5
  8. package/dist/chunk-SPP7ACQN.js.map +1 -0
  9. package/dist/{chunk-VOJVLWVX.js → chunk-ZPUDMABQ.js} +32 -16
  10. package/dist/chunk-ZPUDMABQ.js.map +1 -0
  11. package/dist/{connection-7582fb92.d.ts → connection-6eb86e22.d.ts} +1 -1
  12. package/dist/{connection-5685d817.d.ts → connection-a25109b5.d.ts} +1 -1
  13. package/dist/{index-a6fe0edd.d.ts → index-72b688b7.d.ts} +16 -16
  14. package/dist/logging/index.cjs +28 -4
  15. package/dist/logging/index.cjs.map +1 -1
  16. package/dist/logging/index.d.cts +3 -2
  17. package/dist/logging/index.d.ts +3 -2
  18. package/dist/logging/index.js +1 -1
  19. package/dist/router/index.cjs +30 -14
  20. package/dist/router/index.cjs.map +1 -1
  21. package/dist/router/index.d.cts +6 -5
  22. package/dist/router/index.d.ts +6 -5
  23. package/dist/router/index.js +3 -3
  24. package/dist/{services-be91b485.d.ts → services-0af830a4.d.ts} +3 -1
  25. package/dist/{services-eb9326a1.d.ts → services-eeb6e56f.d.ts} +3 -1
  26. package/dist/transport/impls/uds/client.cjs +31 -19
  27. package/dist/transport/impls/uds/client.cjs.map +1 -1
  28. package/dist/transport/impls/uds/client.d.cts +3 -2
  29. package/dist/transport/impls/uds/client.d.ts +3 -2
  30. package/dist/transport/impls/uds/client.js +4 -4
  31. package/dist/transport/impls/uds/server.cjs +30 -19
  32. package/dist/transport/impls/uds/server.cjs.map +1 -1
  33. package/dist/transport/impls/uds/server.d.cts +3 -2
  34. package/dist/transport/impls/uds/server.d.ts +3 -2
  35. package/dist/transport/impls/uds/server.js +4 -4
  36. package/dist/transport/impls/ws/client.cjs +31 -19
  37. package/dist/transport/impls/ws/client.cjs.map +1 -1
  38. package/dist/transport/impls/ws/client.d.cts +3 -2
  39. package/dist/transport/impls/ws/client.d.ts +3 -2
  40. package/dist/transport/impls/ws/client.js +4 -4
  41. package/dist/transport/impls/ws/server.cjs +30 -19
  42. package/dist/transport/impls/ws/server.cjs.map +1 -1
  43. package/dist/transport/impls/ws/server.d.cts +4 -3
  44. package/dist/transport/impls/ws/server.d.ts +4 -3
  45. package/dist/transport/impls/ws/server.js +4 -4
  46. package/dist/transport/index.cjs +43 -23
  47. package/dist/transport/index.cjs.map +1 -1
  48. package/dist/transport/index.d.cts +3 -2
  49. package/dist/transport/index.d.ts +3 -2
  50. package/dist/transport/index.js +3 -3
  51. package/dist/util/testHelpers.cjs +7 -7
  52. package/dist/util/testHelpers.cjs.map +1 -1
  53. package/dist/util/testHelpers.d.cts +3 -2
  54. package/dist/util/testHelpers.d.ts +3 -2
  55. package/dist/util/testHelpers.js +4 -4
  56. package/dist/util/testHelpers.js.map +1 -1
  57. package/package.json +4 -4
  58. package/dist/chunk-MJUFKPBT.js.map +0 -1
  59. package/dist/chunk-OTQNCLFH.js.map +0 -1
  60. package/dist/chunk-PCKHBAVP.js.map +0 -1
  61. package/dist/chunk-VOJVLWVX.js.map +0 -1
  62. /package/dist/{chunk-DZOATC6M.js.map → chunk-6Z4YTBOM.js.map} +0 -0
  63. /package/dist/{chunk-ZF2UFTNN.js.map → chunk-KPLLLP3F.js.map} +0 -0
@@ -1,11 +1,12 @@
1
- import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError } from '../services-eb9326a1.js';
2
- export { C as Client, E as Err, O as Ok, x as Output, j as ProcErrors, f as ProcHandler, g as ProcInit, h as ProcInput, i as ProcOutput, k as ProcType, a as Procedure, n as ProcedureMap, d as ProcedureResult, o as RPCProcedure, w as ResultUnwrapErr, v as ResultUnwrapOk, u as RiverErrorSchema, c as RiverUncaughtSchema, m as SerializedServerSchema, S as Service, e as ServiceConfiguration, l as ServiceSchema, q as StreamProcedure, p as SubscriptionProcedure, t as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, r as createClient, s as serializeSchema } from '../services-eb9326a1.js';
1
+ import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError } from '../services-eeb6e56f.js';
2
+ export { C as Client, E as Err, O as Ok, x as Output, j as ProcErrors, f as ProcHandler, g as ProcInit, h as ProcInput, i as ProcOutput, k as ProcType, a as Procedure, n as ProcedureMap, d as ProcedureResult, o as RPCProcedure, w as ResultUnwrapErr, v as ResultUnwrapOk, u as RiverErrorSchema, c as RiverUncaughtSchema, m as SerializedServerSchema, S as Service, e as ServiceConfiguration, l as ServiceSchema, q as StreamProcedure, p as SubscriptionProcedure, t as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, r as createClient, s as serializeSchema } from '../services-eeb6e56f.js';
3
3
  import { Static, TSchema } from '@sinclair/typebox';
4
4
  import { ServerTransport } from '../transport/index.cjs';
5
5
  import { Pushable } from 'it-pushable';
6
- import { C as Connection, c as ServerHandshakeOptions, a as ServiceContext } from '../index-a6fe0edd.js';
7
- export { d as ServiceContextWithState, e as ServiceContextWithTransportInfo } from '../index-a6fe0edd.js';
6
+ import { C as Connection, c as ServerHandshakeOptions, a as ServiceContext } from '../index-72b688b7.js';
7
+ export { d as ServiceContextWithState, e as ServiceContextWithTransportInfo } from '../index-72b688b7.js';
8
8
  import '../types-3e5768ec.js';
9
+ import '@sinclair/typebox/value';
9
10
  import '@opentelemetry/api';
10
11
 
11
12
  /**
@@ -42,6 +43,6 @@ declare function createServer<Services extends AnyServiceSchemaMap, MetadataSche
42
43
  extendedContext?: Omit<ServiceContext, 'state'>;
43
44
  }>): Server<Services>;
44
45
 
45
- var version = "0.23.0";
46
+ var version = "0.23.2";
46
47
 
47
48
  export { PayloadType, version as RIVER_VERSION, Result, RiverError, Server, ServiceContext, createServer };
@@ -1,11 +1,12 @@
1
- import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError } from '../services-be91b485.js';
2
- export { C as Client, E as Err, O as Ok, x as Output, j as ProcErrors, f as ProcHandler, g as ProcInit, h as ProcInput, i as ProcOutput, k as ProcType, a as Procedure, n as ProcedureMap, d as ProcedureResult, o as RPCProcedure, w as ResultUnwrapErr, v as ResultUnwrapOk, u as RiverErrorSchema, c as RiverUncaughtSchema, m as SerializedServerSchema, S as Service, e as ServiceConfiguration, l as ServiceSchema, q as StreamProcedure, p as SubscriptionProcedure, t as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, r as createClient, s as serializeSchema } from '../services-be91b485.js';
1
+ import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError } from '../services-0af830a4.js';
2
+ export { C as Client, E as Err, O as Ok, x as Output, j as ProcErrors, f as ProcHandler, g as ProcInit, h as ProcInput, i as ProcOutput, k as ProcType, a as Procedure, n as ProcedureMap, d as ProcedureResult, o as RPCProcedure, w as ResultUnwrapErr, v as ResultUnwrapOk, u as RiverErrorSchema, c as RiverUncaughtSchema, m as SerializedServerSchema, S as Service, e as ServiceConfiguration, l as ServiceSchema, q as StreamProcedure, p as SubscriptionProcedure, t as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, r as createClient, s as serializeSchema } from '../services-0af830a4.js';
3
3
  import { Static, TSchema } from '@sinclair/typebox';
4
4
  import { ServerTransport } from '../transport/index.js';
5
5
  import { Pushable } from 'it-pushable';
6
- import { C as Connection, c as ServerHandshakeOptions, a as ServiceContext } from '../index-a6fe0edd.js';
7
- export { d as ServiceContextWithState, e as ServiceContextWithTransportInfo } from '../index-a6fe0edd.js';
6
+ import { C as Connection, c as ServerHandshakeOptions, a as ServiceContext } from '../index-72b688b7.js';
7
+ export { d as ServiceContextWithState, e as ServiceContextWithTransportInfo } from '../index-72b688b7.js';
8
8
  import '../types-3e5768ec.js';
9
+ import '@sinclair/typebox/value';
9
10
  import '@opentelemetry/api';
10
11
 
11
12
  /**
@@ -42,6 +43,6 @@ declare function createServer<Services extends AnyServiceSchemaMap, MetadataSche
42
43
  extendedContext?: Omit<ServiceContext, 'state'>;
43
44
  }>): Server<Services>;
44
45
 
45
- var version = "0.23.0";
46
+ var version = "0.23.2";
46
47
 
47
48
  export { PayloadType, version as RIVER_VERSION, Result, RiverError, Server, ServiceContext, createServer };
@@ -8,11 +8,11 @@ import {
8
8
  createClient,
9
9
  createServer,
10
10
  serializeSchema
11
- } from "../chunk-VOJVLWVX.js";
11
+ } from "../chunk-ZPUDMABQ.js";
12
12
  import {
13
13
  version
14
- } from "../chunk-PCKHBAVP.js";
15
- import "../chunk-OTQNCLFH.js";
14
+ } from "../chunk-3ZS3RHZF.js";
15
+ import "../chunk-SPP7ACQN.js";
16
16
  export {
17
17
  Err,
18
18
  Ok,
@@ -1,7 +1,7 @@
1
1
  import { TSchema, Static, TObject, TUnion, TString, 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, f as ClientHandshakeOptions, e as ServiceContextWithTransportInfo } from './index-a6fe0edd.js';
4
+ import { C as Connection, T as TransportClientId, f as ClientHandshakeOptions, e as ServiceContextWithTransportInfo } from './index-72b688b7.js';
5
5
 
6
6
  type AsyncIter<T> = AsyncGenerator<T, T>;
7
7
  /**
@@ -93,6 +93,8 @@ type Result<T, E> = {
93
93
  ok: false;
94
94
  payload: E;
95
95
  };
96
+ declare function Ok<const T extends Array<unknown>, const E>(p: T): Result<T, E>;
97
+ declare function Ok<const T extends ReadonlyArray<unknown>, const E>(p: T): Result<T, E>;
96
98
  declare function Ok<const T, const E>(payload: T): Result<T, E>;
97
99
  declare function Err<const T, const E>(error: E): Result<T, E>;
98
100
  /**
@@ -1,7 +1,7 @@
1
1
  import { TSchema, Static, TObject, TUnion, TString, 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, f as ClientHandshakeOptions, e as ServiceContextWithTransportInfo } from './index-a6fe0edd.js';
4
+ import { C as Connection, T as TransportClientId, f as ClientHandshakeOptions, e as ServiceContextWithTransportInfo } from './index-72b688b7.js';
5
5
 
6
6
  type AsyncIter<T> = AsyncGenerator<T, T>;
7
7
  /**
@@ -93,6 +93,8 @@ type Result<T, E> = {
93
93
  ok: false;
94
94
  payload: E;
95
95
  };
96
+ declare function Ok<const T extends Array<unknown>, const E>(p: T): Result<T, E>;
97
+ declare function Ok<const T extends ReadonlyArray<unknown>, const E>(p: T): Result<T, E>;
96
98
  declare function Ok<const T, const E>(payload: T): Result<T, E>;
97
99
  declare function Err<const T, const E>(error: E): Result<T, E>;
98
100
  /**
@@ -113,7 +113,7 @@ function isAck(controlFlag) {
113
113
  var import_api = require("@opentelemetry/api");
114
114
 
115
115
  // package.json
116
- var version = "0.23.0";
116
+ var version = "0.23.2";
117
117
 
118
118
  // tracing/index.ts
119
119
  function getPropagationContext(ctx) {
@@ -247,7 +247,7 @@ var Session = class {
247
247
  const fullMsg = this.constructMsg(msg);
248
248
  log?.debug(`sending msg`, {
249
249
  ...this.loggingMetadata,
250
- fullTransportMessage: fullMsg
250
+ transportMessage: fullMsg
251
251
  });
252
252
  if (this.connection) {
253
253
  const ok = this.connection.send(this.codec.toBuffer(fullMsg));
@@ -257,13 +257,13 @@ var Session = class {
257
257
  `failed to send msg to ${fullMsg.to}, connection is probably dead`,
258
258
  {
259
259
  ...this.loggingMetadata,
260
- fullTransportMessage: fullMsg
260
+ transportMessage: fullMsg
261
261
  }
262
262
  );
263
263
  } else {
264
264
  log?.info(
265
265
  `failed to send msg to ${fullMsg.to}, connection not ready yet`,
266
- { ...this.loggingMetadata, fullTransportMessage: fullMsg }
266
+ { ...this.loggingMetadata, transportMessage: fullMsg }
267
267
  );
268
268
  }
269
269
  return fullMsg.id;
@@ -304,7 +304,7 @@ var Session = class {
304
304
  for (const msg of this.sendBuffer) {
305
305
  log?.debug(`resending msg`, {
306
306
  ...this.loggingMetadata,
307
- fullTransportMessage: msg,
307
+ transportMessage: msg,
308
308
  connId: conn.id
309
309
  });
310
310
  const ok = conn.send(this.codec.toBuffer(msg));
@@ -316,7 +316,7 @@ var Session = class {
316
316
  });
317
317
  log?.error(errMsg, {
318
318
  ...this.loggingMetadata,
319
- fullTransportMessage: msg,
319
+ transportMessage: msg,
320
320
  connId: conn.id,
321
321
  tags: ["invariant-violation"]
322
322
  });
@@ -349,8 +349,8 @@ var Session = class {
349
349
  replaceWithNewConnection(newConn) {
350
350
  this.closeStaleConnection(newConn);
351
351
  this.cancelGrace();
352
- this.connection = newConn;
353
352
  this.sendBufferedMessages(newConn);
353
+ this.connection = newConn;
354
354
  }
355
355
  beginGrace(cb) {
356
356
  log?.info(
@@ -840,7 +840,10 @@ var Transport = class {
840
840
  }
841
841
  if (!import_value.Value.Check(OpaqueTransportMessageSchema, parsedMsg)) {
842
842
  log?.error(`received invalid msg: ${JSON.stringify(parsedMsg)}`, {
843
- clientId: this.clientId
843
+ clientId: this.clientId,
844
+ validationErrors: [
845
+ ...import_value.Value.Errors(OpaqueTransportMessageSchema, parsedMsg)
846
+ ]
844
847
  });
845
848
  return null;
846
849
  }
@@ -858,7 +861,7 @@ var Transport = class {
858
861
  if (!session) {
859
862
  log?.error(`no existing session for ${msg.from}`, {
860
863
  clientId: this.clientId,
861
- fullTransportMessage: msg,
864
+ transportMessage: msg,
862
865
  tags: ["invariant-violation"]
863
866
  });
864
867
  return;
@@ -866,19 +869,19 @@ var Transport = class {
866
869
  session.cancelGrace();
867
870
  log?.debug(`received msg`, {
868
871
  clientId: this.clientId,
869
- fullTransportMessage: msg
872
+ transportMessage: msg
870
873
  });
871
874
  if (msg.seq !== session.nextExpectedSeq) {
872
875
  if (msg.seq < session.nextExpectedSeq) {
873
876
  log?.debug(
874
877
  `received duplicate msg (got seq: ${msg.seq}, wanted seq: ${session.nextExpectedSeq}), discarding`,
875
- { clientId: this.clientId, fullTransportMessage: msg }
878
+ { clientId: this.clientId, transportMessage: msg }
876
879
  );
877
880
  } else {
878
881
  const errMsg = `received out-of-order msg (got seq: ${msg.seq}, wanted seq: ${session.nextExpectedSeq})`;
879
882
  log?.error(`${errMsg}, marking connection as dead`, {
880
883
  clientId: this.clientId,
881
- fullTransportMessage: msg,
884
+ transportMessage: msg,
882
885
  tags: ["invariant-violation"]
883
886
  });
884
887
  this.protocolError(ProtocolError.MessageOrderingViolated, errMsg);
@@ -896,7 +899,7 @@ var Transport = class {
896
899
  } else {
897
900
  log?.debug(`discarding msg (ack bit set)`, {
898
901
  clientId: this.clientId,
899
- fullTransportMessage: msg
902
+ transportMessage: msg
900
903
  });
901
904
  }
902
905
  }
@@ -927,7 +930,7 @@ var Transport = class {
927
930
  const err = "transport is destroyed, cant send";
928
931
  log?.error(err, {
929
932
  clientId: this.clientId,
930
- partialTransportMessage: msg,
933
+ transportMessage: msg,
931
934
  tags: ["invariant-violation"]
932
935
  });
933
936
  this.protocolError(ProtocolError.UseAfterDestroy, err);
@@ -935,7 +938,7 @@ var Transport = class {
935
938
  } else if (this.state === "closed") {
936
939
  log?.info(`transport closed when sending, discarding`, {
937
940
  clientId: this.clientId,
938
- partialTransportMessage: msg
941
+ transportMessage: msg
939
942
  });
940
943
  return void 0;
941
944
  }
@@ -1096,7 +1099,13 @@ var ClientTransport = class extends Transport {
1096
1099
  log?.warn(`received invalid handshake resp`, {
1097
1100
  clientId: this.clientId,
1098
1101
  connectedTo: parsed.from,
1099
- fullTransportMessage: parsed
1102
+ transportMessage: parsed,
1103
+ validationErrors: [
1104
+ ...import_value.Value.Errors(
1105
+ ControlMessageHandshakeResponseSchema,
1106
+ parsed.payload
1107
+ )
1108
+ ]
1100
1109
  });
1101
1110
  this.protocolError(
1102
1111
  ProtocolError.HandshakeFailed,
@@ -1112,7 +1121,7 @@ var ClientTransport = class extends Transport {
1112
1121
  log?.warn(`received handshake rejection`, {
1113
1122
  clientId: this.clientId,
1114
1123
  connectedTo: parsed.from,
1115
- fullTransportMessage: parsed
1124
+ transportMessage: parsed
1116
1125
  });
1117
1126
  this.protocolError(
1118
1127
  ProtocolError.HandshakeFailed,
@@ -1123,7 +1132,7 @@ var ClientTransport = class extends Transport {
1123
1132
  log?.debug(`handshake from ${parsed.from} ok`, {
1124
1133
  clientId: this.clientId,
1125
1134
  connectedTo: parsed.from,
1126
- fullTransportMessage: parsed
1135
+ transportMessage: parsed
1127
1136
  });
1128
1137
  const { session, isReconnect } = this.getOrCreateSession(
1129
1138
  parsed.from,
@@ -1241,6 +1250,9 @@ var ClientTransport = class extends Transport {
1241
1250
  log?.error(`constructed handshake metadata did not match schema`, {
1242
1251
  clientId: this.clientId,
1243
1252
  connectedTo: to,
1253
+ validationErrors: [
1254
+ ...import_value.Value.Errors(this.handshakeExtensions.schema, metadata)
1255
+ ],
1244
1256
  tags: ["invariant-violation"]
1245
1257
  });
1246
1258
  this.protocolError(
@@ -1254,7 +1266,7 @@ var ClientTransport = class extends Transport {
1254
1266
  return false;
1255
1267
  }
1256
1268
  }
1257
- const { session } = this.getOrCreateSession(to, conn);
1269
+ const { session } = this.getOrCreateSession(to);
1258
1270
  const requestMsg = handshakeRequestMessage(
1259
1271
  this.clientId,
1260
1272
  to,