@replit/river 0.215.1 → 0.216.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 (70) hide show
  1. package/README.md +47 -0
  2. package/dist/{adapter-Dtt4bYL-.d.ts → adapter-BXCk-dmy.d.ts} +3 -21
  3. package/dist/{adapter-CjgmjtUJ.d.cts → adapter-D5X11kmP.d.cts} +3 -21
  4. package/dist/{chunk-3DDZCLJM.js → chunk-75ZMPCKC.js} +22 -6
  5. package/dist/{chunk-3DDZCLJM.js.map → chunk-75ZMPCKC.js.map} +1 -1
  6. package/dist/chunk-SHND2JG6.js +86 -0
  7. package/dist/chunk-SHND2JG6.js.map +1 -0
  8. package/dist/{chunk-NUGV5QWU.js → chunk-ZLMQQI43.js} +12 -2
  9. package/dist/chunk-ZLMQQI43.js.map +1 -0
  10. package/dist/{client-BOc8blGj.d.ts → client-BNc5Pj_4.d.ts} +2 -2
  11. package/dist/{client-B9aKi9Li.d.cts → client-BZUvFL6B.d.cts} +2 -2
  12. package/dist/codec/index.cjs.map +1 -1
  13. package/dist/codec/index.d.cts +3 -3
  14. package/dist/codec/index.d.ts +3 -3
  15. package/dist/codec/index.js +2 -2
  16. package/dist/{connection-DnMYvolf.d.ts → connection-ou9w2dSY.d.ts} +3 -3
  17. package/dist/{connection-1hFoyxuX.d.cts → connection-xxgJHs2o.d.cts} +3 -3
  18. package/dist/{index-Bf9PGbS4.d.cts → index-BAGGleT3.d.cts} +1 -1
  19. package/dist/{index-DiAq34gk.d.ts → index-ZWkoesQD.d.ts} +1 -1
  20. package/dist/logging/index.d.cts +2 -2
  21. package/dist/logging/index.d.ts +2 -2
  22. package/dist/{message-DL74OqsX.d.cts → message-CpXWqmJw.d.cts} +1 -1
  23. package/dist/{message-DL74OqsX.d.ts → message-CpXWqmJw.d.ts} +1 -1
  24. package/dist/protobuf/codec.cjs +107 -0
  25. package/dist/protobuf/codec.cjs.map +1 -0
  26. package/dist/protobuf/codec.d.cts +13 -0
  27. package/dist/protobuf/codec.d.ts +13 -0
  28. package/dist/protobuf/codec.js +7 -0
  29. package/dist/protobuf/codec.js.map +1 -0
  30. package/dist/protobuf/index.cjs +1877 -0
  31. package/dist/protobuf/index.cjs.map +1 -0
  32. package/dist/protobuf/index.d.cts +488 -0
  33. package/dist/protobuf/index.d.ts +488 -0
  34. package/dist/protobuf/index.js +1260 -0
  35. package/dist/protobuf/index.js.map +1 -0
  36. package/dist/router/index.cjs +1 -1
  37. package/dist/router/index.cjs.map +1 -1
  38. package/dist/router/index.d.cts +11 -10
  39. package/dist/router/index.d.ts +11 -10
  40. package/dist/router/index.js +1 -1
  41. package/dist/{server-_bfE7LYc.d.ts → server-BPu7Td80.d.ts} +4 -4
  42. package/dist/{server-BkEzDYIv.d.cts → server-JdnoVO11.d.cts} +4 -4
  43. package/dist/{services-KdKBWdJr.d.ts → services-BrTFTO5Q.d.ts} +104 -93
  44. package/dist/{services-zaansuuR.d.cts → services-cwGAC2rB.d.cts} +104 -93
  45. package/dist/testUtil/index.cjs +21 -5
  46. package/dist/testUtil/index.cjs.map +1 -1
  47. package/dist/testUtil/index.d.cts +8 -7
  48. package/dist/testUtil/index.d.ts +8 -7
  49. package/dist/testUtil/index.js +2 -2
  50. package/dist/transport/impls/ws/client.cjs +1 -1
  51. package/dist/transport/impls/ws/client.cjs.map +1 -1
  52. package/dist/transport/impls/ws/client.d.cts +7 -6
  53. package/dist/transport/impls/ws/client.d.ts +7 -6
  54. package/dist/transport/impls/ws/client.js +2 -2
  55. package/dist/transport/impls/ws/server.cjs +21 -5
  56. package/dist/transport/impls/ws/server.cjs.map +1 -1
  57. package/dist/transport/impls/ws/server.d.cts +7 -6
  58. package/dist/transport/impls/ws/server.d.ts +7 -6
  59. package/dist/transport/impls/ws/server.js +2 -2
  60. package/dist/transport/index.cjs +21 -5
  61. package/dist/transport/index.cjs.map +1 -1
  62. package/dist/transport/index.d.cts +8 -7
  63. package/dist/transport/index.d.ts +8 -7
  64. package/dist/transport/index.js +2 -2
  65. package/dist/{transport-CCBNESLA.d.cts → transport-B1MUtXL7.d.ts} +5 -4
  66. package/dist/{transport-kW92H6x-.d.ts → transport-BnU3Zb0Q.d.cts} +5 -4
  67. package/dist/types-BGGvYIJM.d.cts +20 -0
  68. package/dist/types-BGGvYIJM.d.ts +20 -0
  69. package/package.json +12 -1
  70. package/dist/chunk-NUGV5QWU.js.map +0 -1
@@ -1,10 +1,11 @@
1
- export { P as ClientTransportOptions, C as Connection, E as EventHandler, a as EventMap, b as EventTypes, c as ProtocolError, d as ProtocolErrorType, e as ServerTransportOptions, S as Session, f as SessionConnected, g as SessionConnecting, h as SessionHandshaking, i as SessionNoConnection, j as SessionState, T as Transport, k as TransportOptions, l as TransportStatus } from '../transport-CCBNESLA.cjs';
2
- export { C as ClientTransport } from '../client-B9aKi9Li.cjs';
3
- export { S as ServerTransport, a as SessionWaitingForHandshake } from '../server-BkEzDYIv.cjs';
4
- export { W as WebSocketCloseError, a as WebSocketConnection } from '../connection-1hFoyxuX.cjs';
5
- export { O as OpaqueTransportMessage, a as OpaqueTransportMessageSchema, T as TransportClientId, b as TransportMessage, c as TransportMessageSchema, i as isStreamClose, d as isStreamOpen } from '../message-DL74OqsX.cjs';
1
+ export { P as ClientTransportOptions, C as Connection, E as EventHandler, a as EventMap, b as EventTypes, c as ProtocolError, d as ProtocolErrorType, e as ServerTransportOptions, S as Session, f as SessionConnected, g as SessionConnecting, h as SessionHandshaking, i as SessionNoConnection, j as SessionState, T as Transport, k as TransportOptions, l as TransportStatus } from '../transport-BnU3Zb0Q.cjs';
2
+ export { C as ClientTransport } from '../client-BZUvFL6B.cjs';
3
+ export { S as ServerTransport, a as SessionWaitingForHandshake } from '../server-JdnoVO11.cjs';
4
+ export { W as WebSocketCloseError, a as WebSocketConnection } from '../connection-xxgJHs2o.cjs';
5
+ export { O as OpaqueTransportMessage, a as OpaqueTransportMessageSchema, T as TransportClientId, b as TransportMessage, c as TransportMessageSchema, i as isStreamClose, d as isStreamOpen } from '../message-CpXWqmJw.cjs';
6
6
  import '@sinclair/typebox';
7
- import '../index-Bf9PGbS4.cjs';
8
- import '../adapter-CjgmjtUJ.cjs';
7
+ import '../index-BAGGleT3.cjs';
8
+ import '../types-BGGvYIJM.cjs';
9
+ import '../adapter-D5X11kmP.cjs';
9
10
  import '@opentelemetry/api';
10
11
  import '../wslike-Dng9H1C7.cjs';
@@ -1,10 +1,11 @@
1
- export { P as ClientTransportOptions, C as Connection, E as EventHandler, a as EventMap, b as EventTypes, c as ProtocolError, d as ProtocolErrorType, e as ServerTransportOptions, S as Session, f as SessionConnected, g as SessionConnecting, h as SessionHandshaking, i as SessionNoConnection, j as SessionState, T as Transport, k as TransportOptions, l as TransportStatus } from '../transport-kW92H6x-.js';
2
- export { C as ClientTransport } from '../client-BOc8blGj.js';
3
- export { S as ServerTransport, a as SessionWaitingForHandshake } from '../server-_bfE7LYc.js';
4
- export { W as WebSocketCloseError, a as WebSocketConnection } from '../connection-DnMYvolf.js';
5
- export { O as OpaqueTransportMessage, a as OpaqueTransportMessageSchema, T as TransportClientId, b as TransportMessage, c as TransportMessageSchema, i as isStreamClose, d as isStreamOpen } from '../message-DL74OqsX.js';
1
+ export { P as ClientTransportOptions, C as Connection, E as EventHandler, a as EventMap, b as EventTypes, c as ProtocolError, d as ProtocolErrorType, e as ServerTransportOptions, S as Session, f as SessionConnected, g as SessionConnecting, h as SessionHandshaking, i as SessionNoConnection, j as SessionState, T as Transport, k as TransportOptions, l as TransportStatus } from '../transport-B1MUtXL7.js';
2
+ export { C as ClientTransport } from '../client-BNc5Pj_4.js';
3
+ export { S as ServerTransport, a as SessionWaitingForHandshake } from '../server-BPu7Td80.js';
4
+ export { W as WebSocketCloseError, a as WebSocketConnection } from '../connection-ou9w2dSY.js';
5
+ export { O as OpaqueTransportMessage, a as OpaqueTransportMessageSchema, T as TransportClientId, b as TransportMessage, c as TransportMessageSchema, i as isStreamClose, d as isStreamOpen } from '../message-CpXWqmJw.js';
6
6
  import '@sinclair/typebox';
7
- import '../index-DiAq34gk.js';
8
- import '../adapter-Dtt4bYL-.js';
7
+ import '../index-ZWkoesQD.js';
8
+ import '../types-BGGvYIJM.js';
9
+ import '../adapter-BXCk-dmy.js';
9
10
  import '@opentelemetry/api';
10
11
  import '../wslike-Dng9H1C7.js';
@@ -7,12 +7,12 @@ import {
7
7
  Transport,
8
8
  WebSocketCloseError,
9
9
  WebSocketConnection
10
- } from "../chunk-3DDZCLJM.js";
10
+ } from "../chunk-75ZMPCKC.js";
11
11
  import "../chunk-CC7RN7GI.js";
12
12
  import {
13
13
  OpaqueTransportMessageSchema,
14
14
  TransportMessageSchema
15
- } from "../chunk-NUGV5QWU.js";
15
+ } from "../chunk-ZLMQQI43.js";
16
16
  export {
17
17
  ClientTransport,
18
18
  Connection,
@@ -1,7 +1,8 @@
1
1
  import { TSchema, Static } from '@sinclair/typebox';
2
- import { T as TransportClientId, f as TelemetryInfo, P as ProtocolVersion, e as PartialTransportMessage, E as EncodedTransportMessage, g as HandshakeErrorCustomHandlerFatalResponseCodes, O as OpaqueTransportMessage, H as HandshakeErrorResponseCodes, b as TransportMessage } from './message-DL74OqsX.cjs';
3
- import { L as Logger, M as MessageMetadata, T as Tags, a as LogFn, b as LoggingLevel } from './index-Bf9PGbS4.cjs';
4
- import { C as Codec, a as CodecMessageAdapter, E as EncodeResult, S as SendResult, b as SendBufferResult } from './adapter-CjgmjtUJ.cjs';
2
+ import { T as TransportClientId, g as TelemetryInfo, P as ProtocolVersion, e as PartialTransportMessage, E as EncodedTransportMessage, f as HandshakeErrorCustomHandlerFatalResponseCodes, O as OpaqueTransportMessage, H as HandshakeErrorResponseCodes, b as TransportMessage } from './message-CpXWqmJw.js';
3
+ import { L as Logger, M as MessageMetadata, T as Tags, a as LogFn, b as LoggingLevel } from './index-ZWkoesQD.js';
4
+ import { C as Codec } from './types-BGGvYIJM.js';
5
+ import { C as CodecMessageAdapter, E as EncodeResult, S as SendResult, a as SendBufferResult } from './adapter-BXCk-dmy.js';
5
6
  import { Tracer } from '@opentelemetry/api';
6
7
 
7
8
  declare const enum SessionState {
@@ -226,7 +227,7 @@ interface ServerHandshakeOptions<MetadataSchema extends TSchema = TSchema, Parse
226
227
  */
227
228
  validate: ValidateHandshake<MetadataSchema, ParsedMetadata>;
228
229
  }
229
- declare function createClientHandshakeOptions<MetadataSchema extends TSchema = TSchema>(schema: MetadataSchema, construct: ConstructHandshake<MetadataSchema>): ClientHandshakeOptions;
230
+ declare function createClientHandshakeOptions<MetadataSchema extends TSchema = TSchema>(schema: MetadataSchema, construct: ConstructHandshake<MetadataSchema>): ClientHandshakeOptions<MetadataSchema>;
230
231
  declare function createServerHandshakeOptions<MetadataSchema extends TSchema = TSchema, ParsedMetadata extends object = object>(schema: MetadataSchema, validate: ValidateHandshake<MetadataSchema, ParsedMetadata>): ServerHandshakeOptions<MetadataSchema, ParsedMetadata>;
231
232
 
232
233
  /**
@@ -1,7 +1,8 @@
1
1
  import { TSchema, Static } from '@sinclair/typebox';
2
- import { T as TransportClientId, f as TelemetryInfo, P as ProtocolVersion, e as PartialTransportMessage, E as EncodedTransportMessage, g as HandshakeErrorCustomHandlerFatalResponseCodes, O as OpaqueTransportMessage, H as HandshakeErrorResponseCodes, b as TransportMessage } from './message-DL74OqsX.js';
3
- import { L as Logger, M as MessageMetadata, T as Tags, a as LogFn, b as LoggingLevel } from './index-DiAq34gk.js';
4
- import { C as Codec, a as CodecMessageAdapter, E as EncodeResult, S as SendResult, b as SendBufferResult } from './adapter-Dtt4bYL-.js';
2
+ import { T as TransportClientId, g as TelemetryInfo, P as ProtocolVersion, e as PartialTransportMessage, E as EncodedTransportMessage, f as HandshakeErrorCustomHandlerFatalResponseCodes, O as OpaqueTransportMessage, H as HandshakeErrorResponseCodes, b as TransportMessage } from './message-CpXWqmJw.cjs';
3
+ import { L as Logger, M as MessageMetadata, T as Tags, a as LogFn, b as LoggingLevel } from './index-BAGGleT3.cjs';
4
+ import { C as Codec } from './types-BGGvYIJM.cjs';
5
+ import { C as CodecMessageAdapter, E as EncodeResult, S as SendResult, a as SendBufferResult } from './adapter-D5X11kmP.cjs';
5
6
  import { Tracer } from '@opentelemetry/api';
6
7
 
7
8
  declare const enum SessionState {
@@ -226,7 +227,7 @@ interface ServerHandshakeOptions<MetadataSchema extends TSchema = TSchema, Parse
226
227
  */
227
228
  validate: ValidateHandshake<MetadataSchema, ParsedMetadata>;
228
229
  }
229
- declare function createClientHandshakeOptions<MetadataSchema extends TSchema = TSchema>(schema: MetadataSchema, construct: ConstructHandshake<MetadataSchema>): ClientHandshakeOptions;
230
+ declare function createClientHandshakeOptions<MetadataSchema extends TSchema = TSchema>(schema: MetadataSchema, construct: ConstructHandshake<MetadataSchema>): ClientHandshakeOptions<MetadataSchema>;
230
231
  declare function createServerHandshakeOptions<MetadataSchema extends TSchema = TSchema, ParsedMetadata extends object = object>(schema: MetadataSchema, validate: ValidateHandshake<MetadataSchema, ParsedMetadata>): ServerHandshakeOptions<MetadataSchema, ParsedMetadata>;
231
232
 
232
233
  /**
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Codec interface for encoding and decoding objects to and from Uint8 buffers.
3
+ * Used to prepare messages for use by the transport layer.
4
+ */
5
+ interface Codec {
6
+ /**
7
+ * Encodes an object to a Uint8 buffer.
8
+ * @param obj - The object to encode.
9
+ * @returns The encoded Uint8 buffer.
10
+ */
11
+ toBuffer(obj: object): Uint8Array;
12
+ /**
13
+ * Decodes an object from a Uint8 buffer.
14
+ * @param buf - The Uint8 buffer to decode.
15
+ * @returns The decoded object, or null if decoding failed.
16
+ */
17
+ fromBuffer(buf: Uint8Array): object;
18
+ }
19
+
20
+ export type { Codec as C };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Codec interface for encoding and decoding objects to and from Uint8 buffers.
3
+ * Used to prepare messages for use by the transport layer.
4
+ */
5
+ interface Codec {
6
+ /**
7
+ * Encodes an object to a Uint8 buffer.
8
+ * @param obj - The object to encode.
9
+ * @returns The encoded Uint8 buffer.
10
+ */
11
+ toBuffer(obj: object): Uint8Array;
12
+ /**
13
+ * Decodes an object from a Uint8 buffer.
14
+ * @param buf - The Uint8 buffer to decode.
15
+ * @returns The decoded object, or null if decoding failed.
16
+ */
17
+ fromBuffer(buf: Uint8Array): object;
18
+ }
19
+
20
+ export type { Codec as C };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@replit/river",
3
3
  "description": "It's like tRPC but... with JSON Schema Support, duplex streaming and support for service multiplexing. Transport agnostic!",
4
- "version": "0.215.1",
4
+ "version": "0.216.0",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
@@ -12,6 +12,14 @@
12
12
  "import": "./dist/logging/index.js",
13
13
  "require": "./dist/logging/index.cjs"
14
14
  },
15
+ "./protobuf": {
16
+ "import": "./dist/protobuf/index.js",
17
+ "require": "./dist/protobuf/index.cjs"
18
+ },
19
+ "./protobuf/codec": {
20
+ "import": "./dist/protobuf/codec.js",
21
+ "require": "./dist/protobuf/codec.cjs"
22
+ },
15
23
  "./codec": {
16
24
  "import": "./dist/codec/index.js",
17
25
  "require": "./dist/codec/index.cjs"
@@ -40,6 +48,7 @@
40
48
  "dist"
41
49
  ],
42
50
  "dependencies": {
51
+ "@bufbuild/protobuf": "^2.11.0",
43
52
  "@msgpack/msgpack": "^3.1.2",
44
53
  "nanoid": "^5.0.9",
45
54
  "ws": "^8.17.0"
@@ -49,6 +58,7 @@
49
58
  "@sinclair/typebox": "~0.34.0"
50
59
  },
51
60
  "devDependencies": {
61
+ "@bufbuild/buf": "^1.67.0",
52
62
  "@opentelemetry/api": "^1.7.0",
53
63
  "@opentelemetry/context-async-hooks": "^1.26.0",
54
64
  "@opentelemetry/core": "^1.7.0",
@@ -74,6 +84,7 @@
74
84
  "lint": "eslint .",
75
85
  "lint:fix": "eslint . --fix",
76
86
  "fix": "npm run format:fix && npm run lint:fix",
87
+ "proto:generate": "buf generate --template buf.gen.yaml --clean --path proto/transport.proto && buf generate --template buf.gen.test.yaml --clean --path proto/test/test_service.proto",
77
88
  "build": "rm -rf dist && tsup && du -sh dist",
78
89
  "prepack": "npm run build",
79
90
  "release": "npm publish --access public",