@replit/river 0.209.1 → 0.209.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.
- package/dist/{chunk-UC4MQ5FP.js → chunk-DVAIJ57I.js} +10 -10
- package/dist/{chunk-2AV3IIW5.js → chunk-L3KNTJU3.js} +316 -303
- package/dist/chunk-L3KNTJU3.js.map +1 -0
- package/dist/{chunk-2DRHPFKM.js → chunk-OTL2R22H.js} +2 -2
- package/dist/{client-CRY4aeRv.d.cts → client-BX3IXUA2.d.cts} +1 -1
- package/dist/{client-Cvl0bF5y.d.ts → client-CBak1h8Q.d.ts} +1 -1
- package/dist/codec/index.js +2 -2
- package/dist/{connection-BVE0wfE7.d.cts → connection-_eetKnva.d.cts} +1 -1
- package/dist/{connection-BphUYGjL.d.ts → connection-zMlysQKs.d.ts} +1 -1
- package/dist/{common-MmS1PQN7.d.cts → handshake-B3iu79B0.d.cts} +131 -131
- package/dist/{common-yodP-WNy.d.ts → handshake-DNinPBA3.d.ts} +131 -131
- package/dist/router/index.cjs +300 -285
- package/dist/router/index.cjs.map +1 -1
- package/dist/router/index.d.cts +7 -7
- package/dist/router/index.d.ts +7 -7
- package/dist/router/index.js +5 -1
- package/dist/{server-BKZTIlAc.d.cts → server-BV7GXuhz.d.cts} +1 -1
- package/dist/{server-hDGOXIRA.d.ts → server-B_H1zn-R.d.ts} +1 -1
- package/dist/{services-9I3wdkpy.d.cts → services-BIMmk-v4.d.cts} +96 -3
- package/dist/{services-BFGny14R.d.ts → services-DtsSIaec.d.ts} +96 -3
- package/dist/testUtil/index.cjs +1 -1
- package/dist/testUtil/index.cjs.map +1 -1
- package/dist/testUtil/index.d.cts +4 -4
- package/dist/testUtil/index.d.ts +4 -4
- package/dist/testUtil/index.js +3 -3
- package/dist/transport/impls/ws/client.cjs +1 -1
- package/dist/transport/impls/ws/client.cjs.map +1 -1
- package/dist/transport/impls/ws/client.d.cts +3 -3
- package/dist/transport/impls/ws/client.d.ts +3 -3
- package/dist/transport/impls/ws/client.js +3 -3
- package/dist/transport/impls/ws/server.cjs +1 -1
- package/dist/transport/impls/ws/server.cjs.map +1 -1
- package/dist/transport/impls/ws/server.d.cts +3 -3
- package/dist/transport/impls/ws/server.d.ts +3 -3
- package/dist/transport/impls/ws/server.js +3 -3
- package/dist/transport/index.cjs +1 -1
- package/dist/transport/index.cjs.map +1 -1
- package/dist/transport/index.d.cts +3 -3
- package/dist/transport/index.d.ts +3 -3
- package/dist/transport/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-2AV3IIW5.js.map +0 -1
- /package/dist/{chunk-UC4MQ5FP.js.map → chunk-DVAIJ57I.js.map} +0 -0
- /package/dist/{chunk-2DRHPFKM.js.map → chunk-OTL2R22H.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { f as TelemetryInfo,
|
|
2
|
-
import { M as MessageMetadata,
|
|
1
|
+
import { f as TelemetryInfo, c as TransportClientId, P as ProtocolVersion, b as OpaqueTransportMessage, e as PartialTransportMessage, a as TransportMessage, H as HandshakeErrorResponseCodes, g as HandshakeErrorCustomHandlerFatalResponseCodes } from './message-Dlsh5WDF.cjs';
|
|
2
|
+
import { M as MessageMetadata, L as Logger, T as Tags, a as LogFn, b as LoggingLevel } from './index-D9R6UTMl.cjs';
|
|
3
3
|
import { Static, TSchema } from '@sinclair/typebox';
|
|
4
|
-
import {
|
|
4
|
+
import { C as Codec, a as CodecMessageAdapter, S as SendResult, b as SendBufferResult } from './adapter-DjiEwOYi.cjs';
|
|
5
5
|
import { Tracer } from '@opentelemetry/api';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -59,6 +59,134 @@ 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
|
+
|
|
62
190
|
interface SessionConnectingListeners extends IdentifiedSessionWithGracePeriodListeners {
|
|
63
191
|
onConnectionEstablished: (conn: Connection) => void;
|
|
64
192
|
onConnectionFailed: (err: unknown) => void;
|
|
@@ -446,132 +574,4 @@ interface ServerHandshakeOptions<MetadataSchema extends TSchema = TSchema, Parse
|
|
|
446
574
|
declare function createClientHandshakeOptions<MetadataSchema extends TSchema = TSchema>(schema: MetadataSchema, construct: ConstructHandshake<MetadataSchema>): ClientHandshakeOptions;
|
|
447
575
|
declare function createServerHandshakeOptions<MetadataSchema extends TSchema = TSchema, ParsedMetadata extends object = object>(schema: MetadataSchema, validate: ValidateHandshake<MetadataSchema, ParsedMetadata>): ServerHandshakeOptions<MetadataSchema, ParsedMetadata>;
|
|
448
576
|
|
|
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 };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { f as TelemetryInfo,
|
|
2
|
-
import { M as MessageMetadata,
|
|
1
|
+
import { f as TelemetryInfo, c as TransportClientId, P as ProtocolVersion, b as OpaqueTransportMessage, e as PartialTransportMessage, a as TransportMessage, H as HandshakeErrorResponseCodes, g as HandshakeErrorCustomHandlerFatalResponseCodes } from './message-Dlsh5WDF.js';
|
|
2
|
+
import { M as MessageMetadata, L as Logger, T as Tags, a as LogFn, b as LoggingLevel } from './index-CSM8soK7.js';
|
|
3
3
|
import { Static, TSchema } from '@sinclair/typebox';
|
|
4
|
-
import {
|
|
4
|
+
import { C as Codec, a as CodecMessageAdapter, S as SendResult, b as SendBufferResult } from './adapter-Cp7_gIVA.js';
|
|
5
5
|
import { Tracer } from '@opentelemetry/api';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -59,6 +59,134 @@ 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
|
+
|
|
62
190
|
interface SessionConnectingListeners extends IdentifiedSessionWithGracePeriodListeners {
|
|
63
191
|
onConnectionEstablished: (conn: Connection) => void;
|
|
64
192
|
onConnectionFailed: (err: unknown) => void;
|
|
@@ -446,132 +574,4 @@ interface ServerHandshakeOptions<MetadataSchema extends TSchema = TSchema, Parse
|
|
|
446
574
|
declare function createClientHandshakeOptions<MetadataSchema extends TSchema = TSchema>(schema: MetadataSchema, construct: ConstructHandshake<MetadataSchema>): ClientHandshakeOptions;
|
|
447
575
|
declare function createServerHandshakeOptions<MetadataSchema extends TSchema = TSchema, ParsedMetadata extends object = object>(schema: MetadataSchema, validate: ValidateHandshake<MetadataSchema, ParsedMetadata>): ServerHandshakeOptions<MetadataSchema, ParsedMetadata>;
|
|
448
576
|
|
|
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 };
|