@replit/river 0.26.1 → 0.26.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 (48) hide show
  1. package/dist/{chunk-AYIMQWS7.js → chunk-AWCUCZY4.js} +2 -2
  2. package/dist/{chunk-XRI2BXMM.js → chunk-IV27BICV.js} +17 -4
  3. package/dist/chunk-IV27BICV.js.map +1 -0
  4. package/dist/{chunk-6UVTCZ6K.js → chunk-M5X4JTU3.js} +3 -3
  5. package/dist/{chunk-6UVTCZ6K.js.map → chunk-M5X4JTU3.js.map} +1 -1
  6. package/dist/{chunk-UQOD22AN.js → chunk-M75K5TJS.js} +2 -2
  7. package/dist/{chunk-UQOD22AN.js.map → chunk-M75K5TJS.js.map} +1 -1
  8. package/dist/{chunk-4W5LENT2.js → chunk-MREEJE3X.js} +2 -2
  9. package/dist/{chunk-M43R4RPL.js → chunk-NC54BC47.js} +90 -33
  10. package/dist/chunk-NC54BC47.js.map +1 -0
  11. package/dist/{chunk-IVNX5H6C.js → chunk-YQABPD3C.js} +14 -10
  12. package/dist/chunk-YQABPD3C.js.map +1 -0
  13. package/dist/{client-0f636b3a.d.ts → client-654098be.d.ts} +1 -3
  14. package/dist/{connection-07e97a79.d.ts → connection-bc2454dc.d.ts} +1 -1
  15. package/dist/{handshake-8752f79e.d.ts → handshake-1a86f06d.d.ts} +52 -38
  16. package/dist/router/index.cjs +1 -1
  17. package/dist/router/index.cjs.map +1 -1
  18. package/dist/router/index.d.cts +7 -7
  19. package/dist/router/index.d.ts +7 -7
  20. package/dist/router/index.js +2 -2
  21. package/dist/{server-e304daec.d.ts → server-9a6b5a8e.d.ts} +12 -4
  22. package/dist/{services-fc99aae1.d.ts → services-7daa60a0.d.ts} +2 -2
  23. package/dist/transport/impls/ws/client.cjs +102 -32
  24. package/dist/transport/impls/ws/client.cjs.map +1 -1
  25. package/dist/transport/impls/ws/client.d.cts +3 -3
  26. package/dist/transport/impls/ws/client.d.ts +3 -3
  27. package/dist/transport/impls/ws/client.js +5 -5
  28. package/dist/transport/impls/ws/server.cjs +99 -38
  29. package/dist/transport/impls/ws/server.cjs.map +1 -1
  30. package/dist/transport/impls/ws/server.d.cts +3 -3
  31. package/dist/transport/impls/ws/server.d.ts +3 -3
  32. package/dist/transport/impls/ws/server.js +5 -5
  33. package/dist/transport/index.cjs +112 -38
  34. package/dist/transport/index.cjs.map +1 -1
  35. package/dist/transport/index.d.cts +3 -3
  36. package/dist/transport/index.d.ts +3 -3
  37. package/dist/transport/index.js +5 -5
  38. package/dist/util/testHelpers.cjs +89 -32
  39. package/dist/util/testHelpers.cjs.map +1 -1
  40. package/dist/util/testHelpers.d.cts +3 -3
  41. package/dist/util/testHelpers.d.ts +3 -3
  42. package/dist/util/testHelpers.js +3 -3
  43. package/package.json +1 -1
  44. package/dist/chunk-IVNX5H6C.js.map +0 -1
  45. package/dist/chunk-M43R4RPL.js.map +0 -1
  46. package/dist/chunk-XRI2BXMM.js.map +0 -1
  47. /package/dist/{chunk-AYIMQWS7.js.map → chunk-AWCUCZY4.js.map} +0 -0
  48. /package/dist/{chunk-4W5LENT2.js.map → chunk-MREEJE3X.js.map} +0 -0
@@ -84,7 +84,11 @@ interface SessionOptions {
84
84
  */
85
85
  heartbeatsUntilDead: number;
86
86
  /**
87
- * Duration to wait between connection disconnect and actual session disconnect
87
+ * Max duration that a session can be without a connection before we consider
88
+ * it dead. This deadline is carried between states and is used to determine
89
+ * when to consider the session a lost cause and delete it entirely.
90
+ * Generally, this should be strictly greater than the sum of
91
+ * {@link connectionTimeoutMs} and {@link handshakeTimeoutMs}.
88
92
  */
89
93
  sessionDisconnectGraceMs: number;
90
94
  /**
@@ -95,6 +99,10 @@ interface SessionOptions {
95
99
  * Handshake timeout in milliseconds
96
100
  */
97
101
  handshakeTimeoutMs: number;
102
+ /**
103
+ * Whether to enable transparent session reconnects
104
+ */
105
+ enableTransparentSessionReconnects: boolean;
98
106
  /**
99
107
  * The codec to use for encoding/decoding messages over the wire
100
108
  */
@@ -143,40 +151,32 @@ declare abstract class IdentifiedSession extends CommonSession {
143
151
  _handleStateExit(): void;
144
152
  _handleClose(): void;
145
153
  }
146
-
147
- interface SessionHandshakingListeners {
148
- onConnectionErrored: (err: unknown) => void;
149
- onConnectionClosed: () => void;
150
- onHandshake: (msg: OpaqueTransportMessage) => void;
151
- onInvalidHandshake: (reason: string, code: Static<typeof HandshakeErrorResponseCodes>) => void;
152
- onHandshakeTimeout: () => void;
154
+ interface IdentifiedSessionWithGracePeriodListeners {
155
+ onSessionGracePeriodElapsed: () => void;
153
156
  }
154
- interface SessionHandshakingProps<ConnType extends Connection> extends IdentifiedSessionProps {
155
- conn: ConnType;
156
- listeners: SessionHandshakingListeners;
157
+ interface IdentifiedSessionWithGracePeriodProps extends IdentifiedSessionProps {
158
+ graceExpiryTime: number;
159
+ listeners: IdentifiedSessionWithGracePeriodListeners;
157
160
  }
158
- declare class SessionHandshaking<ConnType extends Connection> extends IdentifiedSession {
159
- readonly state: SessionState.Handshaking;
160
- conn: ConnType;
161
- listeners: SessionHandshakingListeners;
162
- handshakeTimeout: ReturnType<typeof setTimeout>;
163
- constructor(props: SessionHandshakingProps<ConnType>);
164
- onHandshakeData: (msg: Uint8Array) => void;
165
- sendHandshake(msg: TransportMessage): boolean;
161
+ declare abstract class IdentifiedSessionWithGracePeriod extends IdentifiedSession {
162
+ graceExpiryTime: number;
163
+ protected gracePeriodTimeout?: ReturnType<typeof setTimeout>;
164
+ listeners: IdentifiedSessionWithGracePeriodListeners;
165
+ constructor(props: IdentifiedSessionWithGracePeriodProps);
166
166
  _handleStateExit(): void;
167
167
  _handleClose(): void;
168
168
  }
169
169
 
170
- interface SessionConnectingListeners {
170
+ interface SessionConnectingListeners extends IdentifiedSessionWithGracePeriodListeners {
171
171
  onConnectionEstablished: (conn: Connection) => void;
172
172
  onConnectionFailed: (err: unknown) => void;
173
173
  onConnectionTimeout: () => void;
174
174
  }
175
- interface SessionConnectingProps<ConnType extends Connection> extends IdentifiedSessionProps {
175
+ interface SessionConnectingProps<ConnType extends Connection> extends IdentifiedSessionWithGracePeriodProps {
176
176
  connPromise: Promise<ConnType>;
177
177
  listeners: SessionConnectingListeners;
178
178
  }
179
- declare class SessionConnecting<ConnType extends Connection> extends IdentifiedSession {
179
+ declare class SessionConnecting<ConnType extends Connection> extends IdentifiedSessionWithGracePeriod {
180
180
  readonly state: SessionState.Connecting;
181
181
  connPromise: Promise<ConnType>;
182
182
  listeners: SessionConnectingListeners;
@@ -187,21 +187,35 @@ declare class SessionConnecting<ConnType extends Connection> extends IdentifiedS
187
187
  _handleClose(): void;
188
188
  }
189
189
 
190
- interface SessionNoConnectionListeners {
191
- onSessionGracePeriodElapsed: () => void;
192
- }
193
- interface SessionNoConnectionProps extends IdentifiedSessionProps {
194
- listeners: SessionNoConnectionListeners;
195
- }
196
- declare class SessionNoConnection extends IdentifiedSession {
190
+ declare class SessionNoConnection extends IdentifiedSessionWithGracePeriod {
197
191
  readonly state: SessionState.NoConnection;
198
- listeners: SessionNoConnectionListeners;
199
- gracePeriodTimeout?: ReturnType<typeof setTimeout>;
200
- constructor(props: SessionNoConnectionProps);
201
192
  _handleClose(): void;
202
193
  _handleStateExit(): void;
203
194
  }
204
195
 
196
+ interface SessionHandshakingListeners extends IdentifiedSessionWithGracePeriodListeners {
197
+ onConnectionErrored: (err: unknown) => void;
198
+ onConnectionClosed: () => void;
199
+ onHandshake: (msg: OpaqueTransportMessage) => void;
200
+ onInvalidHandshake: (reason: string, code: Static<typeof HandshakeErrorResponseCodes>) => void;
201
+ onHandshakeTimeout: () => void;
202
+ }
203
+ interface SessionHandshakingProps<ConnType extends Connection> extends IdentifiedSessionWithGracePeriodProps {
204
+ conn: ConnType;
205
+ listeners: SessionHandshakingListeners;
206
+ }
207
+ declare class SessionHandshaking<ConnType extends Connection> extends IdentifiedSessionWithGracePeriod {
208
+ readonly state: SessionState.Handshaking;
209
+ conn: ConnType;
210
+ listeners: SessionHandshakingListeners;
211
+ handshakeTimeout?: ReturnType<typeof setTimeout>;
212
+ constructor(props: SessionHandshakingProps<ConnType>);
213
+ onHandshakeData: (msg: Uint8Array) => void;
214
+ sendHandshake(msg: TransportMessage): boolean;
215
+ _handleStateExit(): void;
216
+ _handleClose(): void;
217
+ }
218
+
205
219
  interface SessionConnectedListeners {
206
220
  onConnectionErrored: (err: unknown) => void;
207
221
  onConnectionClosed: () => void;
@@ -229,14 +243,14 @@ declare class SessionConnected<ConnType extends Connection> extends IdentifiedSe
229
243
  _handleClose(): void;
230
244
  }
231
245
 
232
- interface SessionBackingOffListeners {
246
+ interface SessionBackingOffListeners extends IdentifiedSessionWithGracePeriodListeners {
233
247
  onBackoffFinished: () => void;
234
248
  }
235
- interface SessionBackingOffProps extends IdentifiedSessionProps {
249
+ interface SessionBackingOffProps extends IdentifiedSessionWithGracePeriodProps {
236
250
  backoffMs: number;
237
251
  listeners: SessionBackingOffListeners;
238
252
  }
239
- declare class SessionBackingOff extends IdentifiedSession {
253
+ declare class SessionBackingOff extends IdentifiedSessionWithGracePeriod {
240
254
  readonly state: SessionState.BackingOff;
241
255
  listeners: SessionBackingOffListeners;
242
256
  backoffTimeout?: ReturnType<typeof setTimeout>;
@@ -442,7 +456,7 @@ declare abstract class Transport<ConnType extends Connection> {
442
456
  getStatus(): TransportStatus;
443
457
  protected updateSession<S extends Session<ConnType>>(session: S): S;
444
458
  protected deleteSession(session: Session<ConnType>): void;
445
- protected onSessionGracePeriodElapsed(session: SessionNoConnection): void;
459
+ protected onSessionGracePeriodElapsed(session: Session<ConnType>): void;
446
460
  protected onConnectingFailed(session: SessionConnecting<ConnType>): SessionNoConnection;
447
461
  protected onConnClosed(session: SessionHandshaking<ConnType> | SessionConnected<ConnType>): SessionNoConnection;
448
462
  }
@@ -485,7 +499,7 @@ interface ServiceContext {
485
499
  * }
486
500
  * ```
487
501
  */
488
- interface ParsedMetadata {
502
+ interface ParsedMetadata extends Record<string, unknown> {
489
503
  }
490
504
  /**
491
505
  * The {@link ServiceContext} with state. This is what is passed to procedures.
@@ -537,4 +551,4 @@ interface ServerHandshakeOptions<MetadataSchema extends TSchema = TSchema> {
537
551
  declare function createClientHandshakeOptions<MetadataSchema extends TSchema = TSchema>(schema: MetadataSchema, construct: ConstructHandshake<MetadataSchema>): ClientHandshakeOptions;
538
552
  declare function createServerHandshakeOptions<MetadataSchema extends TSchema = TSchema>(schema: MetadataSchema, validate: ValidateHandshake<MetadataSchema>): ServerHandshakeOptions;
539
553
 
540
- export { CommonSessionProps as A, ServerTransportOptions as B, Connection as C, ServerSession as D, EventMap as E, LeakyBucketRateLimit as L, ProvidedTransportOptions as P, Session as S, Transport as T, TransportStatus as a, ProvidedClientTransportOptions as b, ProvidedServerTransportOptions as c, SessionState as d, SessionNoConnection as e, SessionConnecting as f, SessionHandshaking as g, SessionConnected as h, EventTypes as i, EventHandler as j, ProtocolError as k, ProtocolErrorType as l, SessionOptions as m, ClientTransportOptions as n, ServiceContext as o, ClientHandshakeOptions as p, ClientSession as q, SessionBackingOff as r, ServerHandshakeOptions as s, ParsedMetadata as t, ServiceContextWithState as u, ServiceContextWithTransportInfo as v, createClientHandshakeOptions as w, createServerHandshakeOptions as x, CommonSession as y, SessionHandshakingListeners as z };
554
+ export { ServerTransportOptions as A, ServerSession as B, Connection as C, EventMap as E, LeakyBucketRateLimit as L, ProvidedTransportOptions as P, Session as S, Transport as T, TransportStatus as a, ProvidedClientTransportOptions as b, ProvidedServerTransportOptions as c, SessionState as d, SessionNoConnection as e, SessionConnecting as f, SessionHandshaking as g, SessionConnected as h, EventTypes as i, EventHandler as j, ProtocolError as k, ProtocolErrorType as l, SessionOptions as m, ClientTransportOptions as n, ServiceContext as o, ClientHandshakeOptions as p, ClientSession as q, SessionBackingOff as r, ServerHandshakeOptions as s, ParsedMetadata as t, ServiceContextWithState as u, ServiceContextWithTransportInfo as v, createClientHandshakeOptions as w, createServerHandshakeOptions as x, CommonSession as y, CommonSessionProps as z };
@@ -761,7 +761,7 @@ function Err(error) {
761
761
  var import_api = require("@opentelemetry/api");
762
762
 
763
763
  // package.json
764
- var version = "0.26.1";
764
+ var version = "0.26.2";
765
765
 
766
766
  // tracing/index.ts
767
767
  function getPropagationContext(ctx) {