@replit/river 0.204.0 → 0.205.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 (52) hide show
  1. package/README.md +7 -3
  2. package/dist/{chunk-QSW7AWEP.js → chunk-356UADV3.js} +2 -2
  3. package/dist/{chunk-3V7VMJNA.js → chunk-3XCLUGDM.js} +5 -4
  4. package/dist/chunk-3XCLUGDM.js.map +1 -0
  5. package/dist/{chunk-WBGKPIFS.js → chunk-CC7RN7GI.js} +1 -1
  6. package/dist/chunk-CC7RN7GI.js.map +1 -0
  7. package/dist/{chunk-LJCR3ADI.js → chunk-HNBYBRJ7.js} +43 -15
  8. package/dist/chunk-HNBYBRJ7.js.map +1 -0
  9. package/dist/{chunk-YODW2ZMU.js → chunk-OVLZDQF4.js} +3 -3
  10. package/dist/{chunk-6YUDEFCS.js → chunk-Y2N4EJYG.js} +11 -6
  11. package/dist/{chunk-6YUDEFCS.js.map → chunk-Y2N4EJYG.js.map} +1 -1
  12. package/dist/{client-0c0a4a5e.d.ts → client-c44d1c69.d.ts} +2 -2
  13. package/dist/{connection-7b62dfec.d.ts → connection-03726441.d.ts} +6 -4
  14. package/dist/{context-3cf1ed4e.d.ts → context-ebf88958.d.ts} +13 -5
  15. package/dist/logging/index.cjs.map +1 -1
  16. package/dist/logging/index.d.cts +1 -2
  17. package/dist/logging/index.d.ts +1 -2
  18. package/dist/logging/index.js +1 -1
  19. package/dist/{message-3def9ded.d.ts → message-865bba35.d.ts} +4 -2
  20. package/dist/router/index.cjs +42 -14
  21. package/dist/router/index.cjs.map +1 -1
  22. package/dist/router/index.d.cts +8 -10
  23. package/dist/router/index.d.ts +8 -10
  24. package/dist/router/index.js +1 -1
  25. package/dist/{server-a287de55.d.ts → server-b169b234.d.ts} +6 -4
  26. package/dist/{services-51980ecd.d.ts → services-47b312aa.d.ts} +11 -3
  27. package/dist/testUtil/index.cjs +11 -5
  28. package/dist/testUtil/index.cjs.map +1 -1
  29. package/dist/testUtil/index.d.cts +5 -7
  30. package/dist/testUtil/index.d.ts +5 -7
  31. package/dist/testUtil/index.js +5 -5
  32. package/dist/transport/impls/ws/client.cjs +11 -5
  33. package/dist/transport/impls/ws/client.cjs.map +1 -1
  34. package/dist/transport/impls/ws/client.d.cts +4 -6
  35. package/dist/transport/impls/ws/client.d.ts +4 -6
  36. package/dist/transport/impls/ws/client.js +5 -5
  37. package/dist/transport/impls/ws/server.cjs +9 -4
  38. package/dist/transport/impls/ws/server.cjs.map +1 -1
  39. package/dist/transport/impls/ws/server.d.cts +4 -6
  40. package/dist/transport/impls/ws/server.d.ts +4 -6
  41. package/dist/transport/impls/ws/server.js +5 -5
  42. package/dist/transport/index.cjs +11 -5
  43. package/dist/transport/index.cjs.map +1 -1
  44. package/dist/transport/index.d.cts +4 -6
  45. package/dist/transport/index.d.ts +4 -6
  46. package/dist/transport/index.js +5 -5
  47. package/package.json +1 -1
  48. package/dist/chunk-3V7VMJNA.js.map +0 -1
  49. package/dist/chunk-LJCR3ADI.js.map +0 -1
  50. package/dist/chunk-WBGKPIFS.js.map +0 -1
  51. /package/dist/{chunk-QSW7AWEP.js.map → chunk-356UADV3.js.map} +0 -0
  52. /package/dist/{chunk-YODW2ZMU.js.map → chunk-OVLZDQF4.js.map} +0 -0
@@ -54,6 +54,21 @@ var ErrResultSchema = (t) => import_typebox.Type.Object({
54
54
  ok: import_typebox.Type.Literal(false),
55
55
  payload: t
56
56
  });
57
+ var ValidationErrorDetails = import_typebox.Type.Object({
58
+ path: import_typebox.Type.String(),
59
+ message: import_typebox.Type.String()
60
+ });
61
+ var ValidationErrors = import_typebox.Type.Array(ValidationErrorDetails);
62
+ function castTypeboxValueErrors(errors) {
63
+ const result = [];
64
+ for (const error of errors) {
65
+ result.push({
66
+ path: error.path,
67
+ message: error.message
68
+ });
69
+ }
70
+ return result;
71
+ }
57
72
  var ReaderErrorSchema = import_typebox.Type.Union([
58
73
  import_typebox.Type.Object({
59
74
  code: import_typebox.Type.Literal(UNCAUGHT_ERROR_CODE),
@@ -65,7 +80,13 @@ var ReaderErrorSchema = import_typebox.Type.Union([
65
80
  }),
66
81
  import_typebox.Type.Object({
67
82
  code: import_typebox.Type.Literal(INVALID_REQUEST_CODE),
68
- message: import_typebox.Type.String()
83
+ message: import_typebox.Type.String(),
84
+ extras: import_typebox.Type.Optional(
85
+ import_typebox.Type.Object({
86
+ firstValidationErrors: import_typebox.Type.Array(ValidationErrorDetails),
87
+ totalErrors: import_typebox.Type.Number()
88
+ })
89
+ )
69
90
  }),
70
91
  import_typebox.Type.Object({
71
92
  code: import_typebox.Type.Literal(CANCEL_CODE),
@@ -1096,7 +1117,7 @@ function handleProc(procType, transport, serverId, init, serviceName, procedureN
1096
1117
  }
1097
1118
  }
1098
1119
  function onSessionStatus(evt) {
1099
- if (evt.status !== "disconnect" || evt.session.to !== serverId || session.id !== evt.session.id) {
1120
+ if (evt.status !== "closing" || evt.session.to !== serverId || session.id !== evt.session.id) {
1100
1121
  return;
1101
1122
  }
1102
1123
  cleanClose = false;
@@ -1255,7 +1276,7 @@ var RiverServer = class {
1255
1276
  );
1256
1277
  };
1257
1278
  const handleSessionStatus = (evt) => {
1258
- if (evt.status !== "disconnect")
1279
+ if (evt.status !== "closing")
1259
1280
  return;
1260
1281
  const disconnectedClientId = evt.session.to;
1261
1282
  this.log?.info(
@@ -1370,25 +1391,32 @@ var RiverServer = class {
1370
1391
  let validationErrors;
1371
1392
  let errMessage;
1372
1393
  if ("requestData" in procedure) {
1373
- errMessage = "expected requestData or control payload";
1374
- validationErrors = [
1375
- ...import_value2.Value.Errors(procedure.responseData, msg.payload)
1376
- ];
1394
+ errMessage = "message in requestData position did not match schema";
1395
+ validationErrors = castTypeboxValueErrors(
1396
+ import_value2.Value.Errors(procedure.requestData, msg.payload)
1397
+ );
1377
1398
  } else {
1378
- validationErrors = [
1379
- ...import_value2.Value.Errors(ControlMessagePayloadSchema, msg.payload)
1380
- ];
1381
- errMessage = "expected control payload";
1399
+ validationErrors = castTypeboxValueErrors(
1400
+ import_value2.Value.Errors(ControlMessagePayloadSchema, msg.payload)
1401
+ );
1402
+ errMessage = "message in control payload position did not match schema";
1382
1403
  }
1383
1404
  this.log?.warn(errMessage, {
1384
1405
  ...loggingMetadata,
1385
1406
  transportMessage: msg,
1386
- validationErrors,
1407
+ validationErrors: validationErrors.map((error) => ({
1408
+ path: error.path,
1409
+ message: error.message
1410
+ })),
1387
1411
  tags: ["invalid-request"]
1388
1412
  });
1389
1413
  onServerCancel({
1390
1414
  code: INVALID_REQUEST_CODE,
1391
- message: errMessage
1415
+ message: errMessage,
1416
+ extras: {
1417
+ totalErrors: validationErrors.length,
1418
+ firstValidationErrors: validationErrors.slice(0, 5)
1419
+ }
1392
1420
  });
1393
1421
  };
1394
1422
  const finishedController = new AbortController();
@@ -1858,7 +1886,7 @@ function createServerHandshakeOptions(schema, validate) {
1858
1886
  }
1859
1887
 
1860
1888
  // package.json
1861
- var version = "0.204.0";
1889
+ var version = "0.205.1";
1862
1890
  // Annotate the CommonJS export names for ESM import in node:
1863
1891
  0 && (module.exports = {
1864
1892
  CANCEL_CODE,