@replit/river 0.209.0 → 0.209.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 (44) hide show
  1. package/dist/{chunk-RATCBAZE.js → chunk-2AV3IIW5.js} +2 -2
  2. package/dist/chunk-2AV3IIW5.js.map +1 -0
  3. package/dist/{chunk-LPWARXI3.js → chunk-2DRHPFKM.js} +2 -2
  4. package/dist/{chunk-TVN2TB6X.js → chunk-UC4MQ5FP.js} +2 -2
  5. package/dist/{client-aETS93z1.d.cts → client-CRY4aeRv.d.cts} +1 -1
  6. package/dist/{client-BzJwq-hg.d.ts → client-Cvl0bF5y.d.ts} +1 -1
  7. package/dist/codec/index.js +2 -2
  8. package/dist/{transport-CxjUaGhi.d.cts → common-MmS1PQN7.d.cts} +232 -232
  9. package/dist/{transport-DwEB67zY.d.ts → common-yodP-WNy.d.ts} +232 -232
  10. package/dist/{connection-hUWlS-hg.d.cts → connection-BVE0wfE7.d.cts} +1 -1
  11. package/dist/{connection-b1wd5XrC.d.ts → connection-BphUYGjL.d.ts} +1 -1
  12. package/dist/router/index.cjs +1 -1
  13. package/dist/router/index.cjs.map +1 -1
  14. package/dist/router/index.d.cts +7 -7
  15. package/dist/router/index.d.ts +7 -7
  16. package/dist/router/index.js +1 -1
  17. package/dist/{server-BBgDVOzk.d.cts → server-BKZTIlAc.d.cts} +1 -1
  18. package/dist/{server-DZ0Yzmpf.d.ts → server-hDGOXIRA.d.ts} +1 -1
  19. package/dist/{services-DC_uol9A.d.cts → services-9I3wdkpy.d.cts} +3 -3
  20. package/dist/{services-DBvjc-Mq.d.ts → services-BFGny14R.d.ts} +3 -3
  21. package/dist/testUtil/index.cjs +1 -1
  22. package/dist/testUtil/index.cjs.map +1 -1
  23. package/dist/testUtil/index.d.cts +4 -4
  24. package/dist/testUtil/index.d.ts +4 -4
  25. package/dist/testUtil/index.js +2 -2
  26. package/dist/transport/impls/ws/client.cjs +1 -1
  27. package/dist/transport/impls/ws/client.cjs.map +1 -1
  28. package/dist/transport/impls/ws/client.d.cts +3 -3
  29. package/dist/transport/impls/ws/client.d.ts +3 -3
  30. package/dist/transport/impls/ws/client.js +3 -3
  31. package/dist/transport/impls/ws/server.cjs +1 -1
  32. package/dist/transport/impls/ws/server.cjs.map +1 -1
  33. package/dist/transport/impls/ws/server.d.cts +3 -3
  34. package/dist/transport/impls/ws/server.d.ts +3 -3
  35. package/dist/transport/impls/ws/server.js +3 -3
  36. package/dist/transport/index.cjs +1 -1
  37. package/dist/transport/index.cjs.map +1 -1
  38. package/dist/transport/index.d.cts +4 -4
  39. package/dist/transport/index.d.ts +4 -4
  40. package/dist/transport/index.js +2 -2
  41. package/package.json +1 -1
  42. package/dist/chunk-RATCBAZE.js.map +0 -1
  43. /package/dist/{chunk-LPWARXI3.js.map → chunk-2DRHPFKM.js.map} +0 -0
  44. /package/dist/{chunk-TVN2TB6X.js.map → chunk-UC4MQ5FP.js.map} +0 -0
@@ -1,7 +1,7 @@
1
- import { TSchema, Static } from '@sinclair/typebox';
2
- import { f as TelemetryInfo, c as TransportClientId, P as ProtocolVersion, b as OpaqueTransportMessage, e as PartialTransportMessage, a as TransportMessage, g as HandshakeErrorCustomHandlerFatalResponseCodes, H as HandshakeErrorResponseCodes } from './message-Dlsh5WDF.cjs';
3
- import { M as MessageMetadata, L as Logger, T as Tags, a as LogFn, b as LoggingLevel } from './index-D9R6UTMl.cjs';
4
- import { C as Codec, a as CodecMessageAdapter, S as SendResult, b as SendBufferResult } from './adapter-DjiEwOYi.cjs';
1
+ import { f as TelemetryInfo, b as OpaqueTransportMessage, H as HandshakeErrorResponseCodes, P as ProtocolVersion, a as TransportMessage, e as PartialTransportMessage, c as TransportClientId, g as HandshakeErrorCustomHandlerFatalResponseCodes } from './message-Dlsh5WDF.cjs';
2
+ import { M as MessageMetadata, T as Tags, L as Logger, a as LogFn, b as LoggingLevel } from './index-D9R6UTMl.cjs';
3
+ import { Static, TSchema } from '@sinclair/typebox';
4
+ import { S as SendResult, b as SendBufferResult, C as Codec, a as CodecMessageAdapter } from './adapter-DjiEwOYi.cjs';
5
5
  import { Tracer } from '@opentelemetry/api';
6
6
 
7
7
  /**
@@ -59,228 +59,6 @@ declare abstract class Connection {
59
59
  abstract close(): void;
60
60
  }
61
61
 
62
- declare const enum SessionState {
63
- NoConnection = "NoConnection",
64
- BackingOff = "BackingOff",
65
- Connecting = "Connecting",
66
- Handshaking = "Handshaking",
67
- Connected = "Connected",
68
- WaitingForHandshake = "WaitingForHandshake"
69
- }
70
- declare abstract class StateMachineState {
71
- abstract readonly state: SessionState;
72
- _isConsumed: boolean;
73
- abstract _handleStateExit(): void;
74
- abstract _handleClose(): void;
75
- /**
76
- * Cleanup this state machine state and mark it as consumed.
77
- * After calling close, it is an error to access any properties on the state.
78
- * You should never need to call this as a consumer.
79
- *
80
- * If you're looking to close the session from the client,
81
- * use `.hardDisconnect` on the client transport.
82
- */
83
- close(): void;
84
- constructor();
85
- }
86
- interface SessionOptions {
87
- /**
88
- * Frequency at which to send heartbeat acknowledgements
89
- */
90
- heartbeatIntervalMs: number;
91
- /**
92
- * Number of elapsed heartbeats without a response message before we consider
93
- * the connection dead.
94
- */
95
- heartbeatsUntilDead: number;
96
- /**
97
- * Max duration that a session can be without a connection before we consider
98
- * it dead. This deadline is carried between states and is used to determine
99
- * when to consider the session a lost cause and delete it entirely.
100
- * Generally, this should be strictly greater than the sum of
101
- * {@link connectionTimeoutMs} and {@link handshakeTimeoutMs}.
102
- */
103
- sessionDisconnectGraceMs: number;
104
- /**
105
- * Connection timeout in milliseconds
106
- */
107
- connectionTimeoutMs: number;
108
- /**
109
- * Handshake timeout in milliseconds
110
- */
111
- handshakeTimeoutMs: number;
112
- /**
113
- * Whether to enable transparent session reconnects
114
- */
115
- enableTransparentSessionReconnects: boolean;
116
- /**
117
- * The codec to use for encoding/decoding messages over the wire
118
- */
119
- codec: Codec;
120
- }
121
- interface CommonSessionProps {
122
- from: TransportClientId;
123
- options: SessionOptions;
124
- codec: CodecMessageAdapter;
125
- tracer: Tracer;
126
- log: Logger | undefined;
127
- }
128
- declare abstract class CommonSession extends StateMachineState {
129
- readonly from: TransportClientId;
130
- readonly options: SessionOptions;
131
- readonly codec: CodecMessageAdapter;
132
- tracer: Tracer;
133
- log?: Logger;
134
- abstract get loggingMetadata(): MessageMetadata;
135
- constructor({ from, options, log, tracer, codec }: CommonSessionProps);
136
- }
137
- type SessionId = string;
138
- interface IdentifiedSessionProps extends CommonSessionProps {
139
- id: SessionId;
140
- to: TransportClientId;
141
- seq: number;
142
- ack: number;
143
- seqSent: number;
144
- sendBuffer: Array<OpaqueTransportMessage>;
145
- telemetry: TelemetryInfo;
146
- protocolVersion: ProtocolVersion;
147
- }
148
- declare abstract class IdentifiedSession extends CommonSession {
149
- readonly id: SessionId;
150
- readonly telemetry: TelemetryInfo;
151
- readonly to: TransportClientId;
152
- readonly protocolVersion: ProtocolVersion;
153
- /**
154
- * Index of the message we will send next (excluding handshake)
155
- */
156
- seq: number;
157
- /**
158
- * Last seq we sent over the wire this session (excluding handshake) and retransmissions
159
- */
160
- seqSent: number;
161
- /**
162
- * Number of unique messages we've received this session (excluding handshake)
163
- */
164
- ack: number;
165
- sendBuffer: Array<OpaqueTransportMessage>;
166
- constructor(props: IdentifiedSessionProps);
167
- get loggingMetadata(): MessageMetadata;
168
- constructMsg<Payload>(partialMsg: PartialTransportMessage<Payload>): TransportMessage<Payload>;
169
- nextSeq(): number;
170
- send(msg: PartialTransportMessage): SendResult;
171
- _handleStateExit(): void;
172
- _handleClose(): void;
173
- }
174
- interface IdentifiedSessionWithGracePeriodListeners {
175
- onSessionGracePeriodElapsed: () => void;
176
- }
177
- interface IdentifiedSessionWithGracePeriodProps extends IdentifiedSessionProps {
178
- graceExpiryTime: number;
179
- listeners: IdentifiedSessionWithGracePeriodListeners;
180
- }
181
- declare abstract class IdentifiedSessionWithGracePeriod extends IdentifiedSession {
182
- graceExpiryTime: number;
183
- protected gracePeriodTimeout?: ReturnType<typeof setTimeout>;
184
- listeners: IdentifiedSessionWithGracePeriodListeners;
185
- constructor(props: IdentifiedSessionWithGracePeriodProps);
186
- _handleStateExit(): void;
187
- _handleClose(): void;
188
- }
189
-
190
- type ConstructHandshake<T extends TSchema> = () => Static<T> | Promise<Static<T>>;
191
- type ValidateHandshake<T extends TSchema, ParsedMetadata> = (metadata: Static<T>, previousParsedMetadata?: ParsedMetadata) => Static<typeof HandshakeErrorCustomHandlerFatalResponseCodes> | ParsedMetadata | Promise<Static<typeof HandshakeErrorCustomHandlerFatalResponseCodes> | ParsedMetadata>;
192
- interface ClientHandshakeOptions<MetadataSchema extends TSchema = TSchema> {
193
- /**
194
- * Schema for the metadata that the client sends to the server
195
- * during the handshake.
196
- */
197
- schema: MetadataSchema;
198
- /**
199
- * Gets the {@link HandshakeRequestMetadata} to send to the server.
200
- */
201
- construct: ConstructHandshake<MetadataSchema>;
202
- }
203
- interface ServerHandshakeOptions<MetadataSchema extends TSchema = TSchema, ParsedMetadata extends object = object> {
204
- /**
205
- * Schema for the metadata that the server receives from the client
206
- * during the handshake.
207
- */
208
- schema: MetadataSchema;
209
- /**
210
- * Parses the {@link HandshakeRequestMetadata} sent by the client, transforming
211
- * it into {@link ParsedHandshakeMetadata}.
212
- *
213
- * May return `false` if the client should be rejected.
214
- *
215
- * @param metadata - The metadata sent by the client.
216
- * @param session - The session that the client would be associated with.
217
- * @param isReconnect - Whether the client is reconnecting to the session,
218
- * or if this is a new session.
219
- */
220
- validate: ValidateHandshake<MetadataSchema, ParsedMetadata>;
221
- }
222
- declare function createClientHandshakeOptions<MetadataSchema extends TSchema = TSchema>(schema: MetadataSchema, construct: ConstructHandshake<MetadataSchema>): ClientHandshakeOptions;
223
- declare function createServerHandshakeOptions<MetadataSchema extends TSchema = TSchema, ParsedMetadata extends object = object>(schema: MetadataSchema, validate: ValidateHandshake<MetadataSchema, ParsedMetadata>): ServerHandshakeOptions<MetadataSchema, ParsedMetadata>;
224
-
225
- /**
226
- * Options to control the backoff and retry behavior of the client transport's connection behaviour.
227
- *
228
- * River implements exponential backoff with jitter to prevent flooding the server
229
- * when there's an issue with connection establishment.
230
- *
231
- * The backoff is calculated via the following:
232
- * backOff = min(jitter + {@link baseIntervalMs} * 2 ^ budget_consumed, {@link maxBackoffMs})
233
- *
234
- * We use a leaky bucket rate limit with a budget of {@link attemptBudgetCapacity} reconnection attempts.
235
- * Budget only starts to restore after a successful handshake at a rate of one budget per {@link budgetRestoreIntervalMs}.
236
- */
237
- interface ConnectionRetryOptions {
238
- /**
239
- * The base interval to wait before retrying a connection.
240
- */
241
- baseIntervalMs: number;
242
- /**
243
- * The maximum random jitter to add to the total backoff time.
244
- */
245
- maxJitterMs: number;
246
- /**
247
- * The maximum amount of time to wait before retrying a connection.
248
- * This does not include the jitter.
249
- */
250
- maxBackoffMs: number;
251
- /**
252
- * The max number of times to attempt a connection before a successful handshake.
253
- * This persists across connections but starts restoring budget after a successful handshake.
254
- * The restoration interval depends on {@link budgetRestoreIntervalMs}
255
- */
256
- attemptBudgetCapacity: number;
257
- /**
258
- * After a successful connection attempt, how long to wait before we restore a single budget.
259
- */
260
- budgetRestoreIntervalMs: number;
261
- }
262
- declare class LeakyBucketRateLimit {
263
- private budgetConsumed;
264
- private intervalHandle?;
265
- private readonly options;
266
- constructor(options: ConnectionRetryOptions);
267
- getBackoffMs(): number;
268
- get totalBudgetRestoreTime(): number;
269
- consumeBudget(): void;
270
- getBudgetConsumed(): number;
271
- hasBudget(): boolean;
272
- startRestoringBudget(): void;
273
- private stopLeak;
274
- close(): void;
275
- }
276
-
277
- type TransportOptions = SessionOptions;
278
- type ProvidedTransportOptions = Partial<TransportOptions>;
279
- type ClientTransportOptions = TransportOptions & ConnectionRetryOptions;
280
- type ProvidedClientTransportOptions = Partial<ClientTransportOptions>;
281
- type ServerTransportOptions = TransportOptions;
282
- type ProvidedServerTransportOptions = Partial<ServerTransportOptions>;
283
-
284
62
  interface SessionConnectingListeners extends IdentifiedSessionWithGracePeriodListeners {
285
63
  onConnectionEstablished: (conn: Connection) => void;
286
64
  onConnectionFailed: (err: unknown) => void;
@@ -301,6 +79,12 @@ declare class SessionConnecting<ConnType extends Connection> extends IdentifiedS
301
79
  _handleClose(): void;
302
80
  }
303
81
 
82
+ declare class SessionNoConnection extends IdentifiedSessionWithGracePeriod {
83
+ readonly state: SessionState.NoConnection;
84
+ _handleClose(): void;
85
+ _handleStateExit(): void;
86
+ }
87
+
304
88
  interface SessionHandshakingListeners extends IdentifiedSessionWithGracePeriodListeners {
305
89
  onConnectionErrored: (err: unknown) => void;
306
90
  onConnectionClosed: () => void;
@@ -391,12 +175,6 @@ declare class SessionConnected<ConnType extends Connection> extends IdentifiedSe
391
175
  _handleClose(): void;
392
176
  }
393
177
 
394
- declare class SessionNoConnection extends IdentifiedSessionWithGracePeriod {
395
- readonly state: SessionState.NoConnection;
396
- _handleClose(): void;
397
- _handleStateExit(): void;
398
- }
399
-
400
178
  interface SessionBackingOffListeners extends IdentifiedSessionWithGracePeriodListeners {
401
179
  onBackoffFinished: () => void;
402
180
  }
@@ -473,6 +251,65 @@ declare class EventDispatcher<T extends EventTypes> {
473
251
  dispatchEvent<K extends T>(eventType: K, event: EventMap[K]): void;
474
252
  }
475
253
 
254
+ /**
255
+ * Options to control the backoff and retry behavior of the client transport's connection behaviour.
256
+ *
257
+ * River implements exponential backoff with jitter to prevent flooding the server
258
+ * when there's an issue with connection establishment.
259
+ *
260
+ * The backoff is calculated via the following:
261
+ * backOff = min(jitter + {@link baseIntervalMs} * 2 ^ budget_consumed, {@link maxBackoffMs})
262
+ *
263
+ * We use a leaky bucket rate limit with a budget of {@link attemptBudgetCapacity} reconnection attempts.
264
+ * Budget only starts to restore after a successful handshake at a rate of one budget per {@link budgetRestoreIntervalMs}.
265
+ */
266
+ interface ConnectionRetryOptions {
267
+ /**
268
+ * The base interval to wait before retrying a connection.
269
+ */
270
+ baseIntervalMs: number;
271
+ /**
272
+ * The maximum random jitter to add to the total backoff time.
273
+ */
274
+ maxJitterMs: number;
275
+ /**
276
+ * The maximum amount of time to wait before retrying a connection.
277
+ * This does not include the jitter.
278
+ */
279
+ maxBackoffMs: number;
280
+ /**
281
+ * The max number of times to attempt a connection before a successful handshake.
282
+ * This persists across connections but starts restoring budget after a successful handshake.
283
+ * The restoration interval depends on {@link budgetRestoreIntervalMs}
284
+ */
285
+ attemptBudgetCapacity: number;
286
+ /**
287
+ * After a successful connection attempt, how long to wait before we restore a single budget.
288
+ */
289
+ budgetRestoreIntervalMs: number;
290
+ }
291
+ declare class LeakyBucketRateLimit {
292
+ private budgetConsumed;
293
+ private intervalHandle?;
294
+ private readonly options;
295
+ constructor(options: ConnectionRetryOptions);
296
+ getBackoffMs(): number;
297
+ get totalBudgetRestoreTime(): number;
298
+ consumeBudget(): void;
299
+ getBudgetConsumed(): number;
300
+ hasBudget(): boolean;
301
+ startRestoringBudget(): void;
302
+ private stopLeak;
303
+ close(): void;
304
+ }
305
+
306
+ type TransportOptions = SessionOptions;
307
+ type ProvidedTransportOptions = Partial<TransportOptions>;
308
+ type ClientTransportOptions = TransportOptions & ConnectionRetryOptions;
309
+ type ProvidedClientTransportOptions = Partial<ClientTransportOptions>;
310
+ type ServerTransportOptions = TransportOptions;
311
+ type ProvidedServerTransportOptions = Partial<ServerTransportOptions>;
312
+
476
313
  /**
477
314
  * Represents the possible states of a transport.
478
315
  * @property {'open'} open - The transport is open and operational (note that this doesn't mean it is actively connected)
@@ -574,4 +411,167 @@ declare abstract class Transport<ConnType extends Connection> {
574
411
  getSessionBoundSendFn(to: TransportClientId, sessionId: SessionId): SessionBoundSendFn;
575
412
  }
576
413
 
414
+ type ConstructHandshake<T extends TSchema> = () => Static<T> | Promise<Static<T>>;
415
+ type ValidateHandshake<T extends TSchema, ParsedMetadata> = (metadata: Static<T>, previousParsedMetadata?: ParsedMetadata) => Static<typeof HandshakeErrorCustomHandlerFatalResponseCodes> | ParsedMetadata | Promise<Static<typeof HandshakeErrorCustomHandlerFatalResponseCodes> | ParsedMetadata>;
416
+ interface ClientHandshakeOptions<MetadataSchema extends TSchema = TSchema> {
417
+ /**
418
+ * Schema for the metadata that the client sends to the server
419
+ * during the handshake.
420
+ */
421
+ schema: MetadataSchema;
422
+ /**
423
+ * Gets the {@link HandshakeRequestMetadata} to send to the server.
424
+ */
425
+ construct: ConstructHandshake<MetadataSchema>;
426
+ }
427
+ interface ServerHandshakeOptions<MetadataSchema extends TSchema = TSchema, ParsedMetadata extends object = object> {
428
+ /**
429
+ * Schema for the metadata that the server receives from the client
430
+ * during the handshake.
431
+ */
432
+ schema: MetadataSchema;
433
+ /**
434
+ * Parses the {@link HandshakeRequestMetadata} sent by the client, transforming
435
+ * it into {@link ParsedHandshakeMetadata}.
436
+ *
437
+ * May return `false` if the client should be rejected.
438
+ *
439
+ * @param metadata - The metadata sent by the client.
440
+ * @param session - The session that the client would be associated with.
441
+ * @param isReconnect - Whether the client is reconnecting to the session,
442
+ * or if this is a new session.
443
+ */
444
+ validate: ValidateHandshake<MetadataSchema, ParsedMetadata>;
445
+ }
446
+ declare function createClientHandshakeOptions<MetadataSchema extends TSchema = TSchema>(schema: MetadataSchema, construct: ConstructHandshake<MetadataSchema>): ClientHandshakeOptions;
447
+ declare function createServerHandshakeOptions<MetadataSchema extends TSchema = TSchema, ParsedMetadata extends object = object>(schema: MetadataSchema, validate: ValidateHandshake<MetadataSchema, ParsedMetadata>): ServerHandshakeOptions<MetadataSchema, ParsedMetadata>;
448
+
449
+ declare const enum SessionState {
450
+ NoConnection = "NoConnection",
451
+ BackingOff = "BackingOff",
452
+ Connecting = "Connecting",
453
+ Handshaking = "Handshaking",
454
+ Connected = "Connected",
455
+ WaitingForHandshake = "WaitingForHandshake"
456
+ }
457
+ declare abstract class StateMachineState {
458
+ abstract readonly state: SessionState;
459
+ _isConsumed: boolean;
460
+ abstract _handleStateExit(): void;
461
+ abstract _handleClose(): void;
462
+ /**
463
+ * Cleanup this state machine state and mark it as consumed.
464
+ * After calling close, it is an error to access any properties on the state.
465
+ * You should never need to call this as a consumer.
466
+ *
467
+ * If you're looking to close the session from the client,
468
+ * use `.hardDisconnect` on the client transport.
469
+ */
470
+ close(): void;
471
+ constructor();
472
+ }
473
+ interface SessionOptions {
474
+ /**
475
+ * Frequency at which to send heartbeat acknowledgements
476
+ */
477
+ heartbeatIntervalMs: number;
478
+ /**
479
+ * Number of elapsed heartbeats without a response message before we consider
480
+ * the connection dead.
481
+ */
482
+ heartbeatsUntilDead: number;
483
+ /**
484
+ * Max duration that a session can be without a connection before we consider
485
+ * it dead. This deadline is carried between states and is used to determine
486
+ * when to consider the session a lost cause and delete it entirely.
487
+ * Generally, this should be strictly greater than the sum of
488
+ * {@link connectionTimeoutMs} and {@link handshakeTimeoutMs}.
489
+ */
490
+ sessionDisconnectGraceMs: number;
491
+ /**
492
+ * Connection timeout in milliseconds
493
+ */
494
+ connectionTimeoutMs: number;
495
+ /**
496
+ * Handshake timeout in milliseconds
497
+ */
498
+ handshakeTimeoutMs: number;
499
+ /**
500
+ * Whether to enable transparent session reconnects
501
+ */
502
+ enableTransparentSessionReconnects: boolean;
503
+ /**
504
+ * The codec to use for encoding/decoding messages over the wire
505
+ */
506
+ codec: Codec;
507
+ }
508
+ interface CommonSessionProps {
509
+ from: TransportClientId;
510
+ options: SessionOptions;
511
+ codec: CodecMessageAdapter;
512
+ tracer: Tracer;
513
+ log: Logger | undefined;
514
+ }
515
+ declare abstract class CommonSession extends StateMachineState {
516
+ readonly from: TransportClientId;
517
+ readonly options: SessionOptions;
518
+ readonly codec: CodecMessageAdapter;
519
+ tracer: Tracer;
520
+ log?: Logger;
521
+ abstract get loggingMetadata(): MessageMetadata;
522
+ constructor({ from, options, log, tracer, codec }: CommonSessionProps);
523
+ }
524
+ type SessionId = string;
525
+ interface IdentifiedSessionProps extends CommonSessionProps {
526
+ id: SessionId;
527
+ to: TransportClientId;
528
+ seq: number;
529
+ ack: number;
530
+ seqSent: number;
531
+ sendBuffer: Array<OpaqueTransportMessage>;
532
+ telemetry: TelemetryInfo;
533
+ protocolVersion: ProtocolVersion;
534
+ }
535
+ declare abstract class IdentifiedSession extends CommonSession {
536
+ readonly id: SessionId;
537
+ readonly telemetry: TelemetryInfo;
538
+ readonly to: TransportClientId;
539
+ readonly protocolVersion: ProtocolVersion;
540
+ /**
541
+ * Index of the message we will send next (excluding handshake)
542
+ */
543
+ seq: number;
544
+ /**
545
+ * Last seq we sent over the wire this session (excluding handshake) and retransmissions
546
+ */
547
+ seqSent: number;
548
+ /**
549
+ * Number of unique messages we've received this session (excluding handshake)
550
+ */
551
+ ack: number;
552
+ sendBuffer: Array<OpaqueTransportMessage>;
553
+ constructor(props: IdentifiedSessionProps);
554
+ get loggingMetadata(): MessageMetadata;
555
+ constructMsg<Payload>(partialMsg: PartialTransportMessage<Payload>): TransportMessage<Payload>;
556
+ nextSeq(): number;
557
+ send(msg: PartialTransportMessage): SendResult;
558
+ _handleStateExit(): void;
559
+ _handleClose(): void;
560
+ }
561
+ interface IdentifiedSessionWithGracePeriodListeners {
562
+ onSessionGracePeriodElapsed: () => void;
563
+ }
564
+ interface IdentifiedSessionWithGracePeriodProps extends IdentifiedSessionProps {
565
+ graceExpiryTime: number;
566
+ listeners: IdentifiedSessionWithGracePeriodListeners;
567
+ }
568
+ declare abstract class IdentifiedSessionWithGracePeriod extends IdentifiedSession {
569
+ graceExpiryTime: number;
570
+ protected gracePeriodTimeout?: ReturnType<typeof setTimeout>;
571
+ listeners: IdentifiedSessionWithGracePeriodListeners;
572
+ constructor(props: IdentifiedSessionWithGracePeriodProps);
573
+ _handleStateExit(): void;
574
+ _handleClose(): void;
575
+ }
576
+
577
577
  export { Connection as C, type DeleteSessionOptions as D, type EventMap as E, LeakyBucketRateLimit as L, type ProvidedTransportOptions as P, type Session as S, Transport as T, type TransportStatus as a, type ProvidedClientTransportOptions as b, type ProvidedServerTransportOptions as c, SessionState as d, SessionNoConnection as e, SessionConnecting as f, SessionHandshaking as g, SessionConnected as h, type EventTypes as i, type EventHandler as j, ProtocolError as k, type ProtocolErrorType as l, type ClientTransportOptions as m, type ClientHandshakeOptions as n, type ClientSession as o, SessionBackingOff as p, type ServerHandshakeOptions as q, createClientHandshakeOptions as r, createServerHandshakeOptions as s, CommonSession as t, type CommonSessionProps as u, type ServerTransportOptions as v, type ServerSession as w, type SessionOptions as x, type SessionBoundSendFn as y, type SessionId as z };