@replit/river 0.26.0 → 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.
- package/dist/{chunk-KP4UB5NW.js → chunk-AWCUCZY4.js} +2 -2
- package/dist/{chunk-5S64PXTU.js → chunk-IV27BICV.js} +36 -9
- package/dist/chunk-IV27BICV.js.map +1 -0
- package/dist/{chunk-5FDAIAQ5.js → chunk-M5X4JTU3.js} +5 -5
- package/dist/chunk-M5X4JTU3.js.map +1 -0
- package/dist/{chunk-CCUYKR5C.js → chunk-M75K5TJS.js} +2 -2
- package/dist/{chunk-CCUYKR5C.js.map → chunk-M75K5TJS.js.map} +1 -1
- package/dist/{chunk-BNNELZM4.js → chunk-MREEJE3X.js} +2 -2
- package/dist/{chunk-JSU2KACV.js → chunk-NC54BC47.js} +98 -35
- package/dist/chunk-NC54BC47.js.map +1 -0
- package/dist/{chunk-7ETNUCOL.js → chunk-YQABPD3C.js} +29 -14
- package/dist/chunk-YQABPD3C.js.map +1 -0
- package/dist/{client-162c509c.d.ts → client-654098be.d.ts} +2 -4
- package/dist/{connection-6a404bb8.d.ts → connection-bc2454dc.d.ts} +1 -1
- package/dist/{handshake-3342bb94.d.ts → handshake-1a86f06d.d.ts} +60 -42
- package/dist/logging/index.d.cts +1 -1
- package/dist/logging/index.d.ts +1 -1
- package/dist/{message-1a434848.d.ts → message-57296605.d.ts} +2 -1
- package/dist/router/index.cjs +1 -1
- package/dist/router/index.cjs.map +1 -1
- package/dist/router/index.d.cts +8 -8
- package/dist/router/index.d.ts +8 -8
- package/dist/router/index.js +2 -2
- package/dist/{server-1b695374.d.ts → server-9a6b5a8e.d.ts} +12 -4
- package/dist/{services-c17f7eff.d.ts → services-7daa60a0.d.ts} +3 -3
- package/dist/transport/impls/ws/client.cjs +131 -41
- package/dist/transport/impls/ws/client.cjs.map +1 -1
- package/dist/transport/impls/ws/client.d.cts +4 -4
- package/dist/transport/impls/ws/client.d.ts +4 -4
- package/dist/transport/impls/ws/client.js +5 -5
- package/dist/transport/impls/ws/server.cjs +124 -46
- package/dist/transport/impls/ws/server.cjs.map +1 -1
- package/dist/transport/impls/ws/server.d.cts +4 -4
- package/dist/transport/impls/ws/server.d.ts +4 -4
- package/dist/transport/impls/ws/server.js +5 -5
- package/dist/transport/index.cjs +156 -51
- package/dist/transport/index.cjs.map +1 -1
- package/dist/transport/index.d.cts +4 -4
- package/dist/transport/index.d.ts +4 -4
- package/dist/transport/index.js +5 -5
- package/dist/util/testHelpers.cjs +97 -34
- package/dist/util/testHelpers.cjs.map +1 -1
- package/dist/util/testHelpers.d.cts +4 -4
- package/dist/util/testHelpers.d.ts +4 -4
- package/dist/util/testHelpers.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-5FDAIAQ5.js.map +0 -1
- package/dist/chunk-5S64PXTU.js.map +0 -1
- package/dist/chunk-7ETNUCOL.js.map +0 -1
- package/dist/chunk-JSU2KACV.js.map +0 -1
- /package/dist/{chunk-KP4UB5NW.js.map → chunk-AWCUCZY4.js.map} +0 -0
- /package/dist/{chunk-BNNELZM4.js.map → chunk-MREEJE3X.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as TelemetryInfo, M as MessageMetadata, c as TransportClientId, L as Logger, b as OpaqueTransportMessage, P as PartialTransportMessage, a as TransportMessage, f as LogFn, g as LoggingLevel,
|
|
2
|
-
import {
|
|
1
|
+
import { e as TelemetryInfo, M as MessageMetadata, c as TransportClientId, L as Logger, b as OpaqueTransportMessage, P as PartialTransportMessage, a as TransportMessage, H as HandshakeErrorResponseCodes, f as LogFn, g as LoggingLevel, h as HandshakeErrorCustomHandlerFatalResponseCodes } from './message-57296605.js';
|
|
2
|
+
import { Static, TSchema } from '@sinclair/typebox';
|
|
3
3
|
import { C as Codec } from './types-3e5768ec.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -84,7 +84,11 @@ interface SessionOptions {
|
|
|
84
84
|
*/
|
|
85
85
|
heartbeatsUntilDead: number;
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
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
|
-
|
|
148
|
-
onConnectionErrored: (err: unknown) => void;
|
|
149
|
-
onConnectionClosed: () => void;
|
|
150
|
-
onHandshake: (msg: OpaqueTransportMessage) => void;
|
|
151
|
-
onInvalidHandshake: (reason: string) => void;
|
|
152
|
-
onHandshakeTimeout: () => void;
|
|
154
|
+
interface IdentifiedSessionWithGracePeriodListeners {
|
|
155
|
+
onSessionGracePeriodElapsed: () => void;
|
|
153
156
|
}
|
|
154
|
-
interface
|
|
155
|
-
|
|
156
|
-
listeners:
|
|
157
|
+
interface IdentifiedSessionWithGracePeriodProps extends IdentifiedSessionProps {
|
|
158
|
+
graceExpiryTime: number;
|
|
159
|
+
listeners: IdentifiedSessionWithGracePeriodListeners;
|
|
157
160
|
}
|
|
158
|
-
declare class
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
listeners:
|
|
162
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
249
|
+
interface SessionBackingOffProps extends IdentifiedSessionWithGracePeriodProps {
|
|
236
250
|
backoffMs: number;
|
|
237
251
|
listeners: SessionBackingOffListeners;
|
|
238
252
|
}
|
|
239
|
-
declare class SessionBackingOff extends
|
|
253
|
+
declare class SessionBackingOff extends IdentifiedSessionWithGracePeriod {
|
|
240
254
|
readonly state: SessionState.BackingOff;
|
|
241
255
|
listeners: SessionBackingOffListeners;
|
|
242
256
|
backoffTimeout?: ReturnType<typeof setTimeout>;
|
|
@@ -273,7 +287,11 @@ interface EventMap {
|
|
|
273
287
|
state: SessionState.NoConnection;
|
|
274
288
|
};
|
|
275
289
|
protocolError: {
|
|
276
|
-
type:
|
|
290
|
+
type: (typeof ProtocolError)['HandshakeFailed'];
|
|
291
|
+
code: Static<typeof HandshakeErrorResponseCodes>;
|
|
292
|
+
message: string;
|
|
293
|
+
} | {
|
|
294
|
+
type: Omit<ProtocolErrorType, (typeof ProtocolError)['HandshakeFailed']>;
|
|
277
295
|
message: string;
|
|
278
296
|
};
|
|
279
297
|
transportStatus: {
|
|
@@ -428,7 +446,7 @@ declare abstract class Transport<ConnType extends Connection> {
|
|
|
428
446
|
* @returns The ID of the sent message or undefined if it wasn't sent
|
|
429
447
|
*/
|
|
430
448
|
abstract send(to: TransportClientId, msg: PartialTransportMessage): string;
|
|
431
|
-
protected protocolError(
|
|
449
|
+
protected protocolError(message: EventMap['protocolError']): void;
|
|
432
450
|
/**
|
|
433
451
|
* Default close implementation for transports. You should override this in the downstream
|
|
434
452
|
* implementation if you need to do any additional cleanup and call super.close() at the end.
|
|
@@ -438,7 +456,7 @@ declare abstract class Transport<ConnType extends Connection> {
|
|
|
438
456
|
getStatus(): TransportStatus;
|
|
439
457
|
protected updateSession<S extends Session<ConnType>>(session: S): S;
|
|
440
458
|
protected deleteSession(session: Session<ConnType>): void;
|
|
441
|
-
protected onSessionGracePeriodElapsed(session:
|
|
459
|
+
protected onSessionGracePeriodElapsed(session: Session<ConnType>): void;
|
|
442
460
|
protected onConnectingFailed(session: SessionConnecting<ConnType>): SessionNoConnection;
|
|
443
461
|
protected onConnClosed(session: SessionHandshaking<ConnType> | SessionConnected<ConnType>): SessionNoConnection;
|
|
444
462
|
}
|
|
@@ -481,7 +499,7 @@ interface ServiceContext {
|
|
|
481
499
|
* }
|
|
482
500
|
* ```
|
|
483
501
|
*/
|
|
484
|
-
interface ParsedMetadata {
|
|
502
|
+
interface ParsedMetadata extends Record<string, unknown> {
|
|
485
503
|
}
|
|
486
504
|
/**
|
|
487
505
|
* The {@link ServiceContext} with state. This is what is passed to procedures.
|
|
@@ -533,4 +551,4 @@ interface ServerHandshakeOptions<MetadataSchema extends TSchema = TSchema> {
|
|
|
533
551
|
declare function createClientHandshakeOptions<MetadataSchema extends TSchema = TSchema>(schema: MetadataSchema, construct: ConstructHandshake<MetadataSchema>): ClientHandshakeOptions;
|
|
534
552
|
declare function createServerHandshakeOptions<MetadataSchema extends TSchema = TSchema>(schema: MetadataSchema, validate: ValidateHandshake<MetadataSchema>): ServerHandshakeOptions;
|
|
535
553
|
|
|
536
|
-
export {
|
|
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 };
|
package/dist/logging/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { f as LogFn, L as Logger, M as MessageMetadata,
|
|
1
|
+
export { f as LogFn, L as Logger, M as MessageMetadata, j as coloredStringLogger, k as jsonLogger, s as stringLogger } from '../message-57296605.js';
|
|
2
2
|
import '@sinclair/typebox/value';
|
|
3
3
|
import '@sinclair/typebox';
|
|
4
4
|
import '@opentelemetry/api';
|
package/dist/logging/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { f as LogFn, L as Logger, M as MessageMetadata,
|
|
1
|
+
export { f as LogFn, L as Logger, M as MessageMetadata, j as coloredStringLogger, k as jsonLogger, s as stringLogger } from '../message-57296605.js';
|
|
2
2
|
import '@sinclair/typebox/value';
|
|
3
3
|
import '@sinclair/typebox';
|
|
4
4
|
import '@opentelemetry/api';
|
|
@@ -65,6 +65,7 @@ declare const TransportMessageSchema: <T extends TSchema>(t: T) => _sinclair_typ
|
|
|
65
65
|
payload: T;
|
|
66
66
|
}>;
|
|
67
67
|
declare const HandshakeErrorCustomHandlerFatalResponseCodes: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"REJECTED_UNSUPPORTED_CLIENT">, _sinclair_typebox.TLiteral<"REJECTED_BY_CUSTOM_HANDLER">]>;
|
|
68
|
+
declare const HandshakeErrorResponseCodes: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"SESSION_STATE_MISMATCH">, _sinclair_typebox.TUnion<[_sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"REJECTED_UNSUPPORTED_CLIENT">, _sinclair_typebox.TLiteral<"REJECTED_BY_CUSTOM_HANDLER">]>, _sinclair_typebox.TLiteral<"MALFORMED_HANDSHAKE_META">, _sinclair_typebox.TLiteral<"MALFORMED_HANDSHAKE">, _sinclair_typebox.TLiteral<"PROTOCOL_VERSION_MISMATCH">]>]>;
|
|
68
69
|
/**
|
|
69
70
|
* Defines the schema for an opaque transport message that is agnostic to any
|
|
70
71
|
* procedure/service.
|
|
@@ -134,4 +135,4 @@ declare function isStreamOpen(controlFlag: number): boolean;
|
|
|
134
135
|
*/
|
|
135
136
|
declare function isStreamClose(controlFlag: number): boolean;
|
|
136
137
|
|
|
137
|
-
export {
|
|
138
|
+
export { HandshakeErrorResponseCodes as H, Logger as L, MessageMetadata as M, OpaqueTransportMessageSchema as O, PartialTransportMessage as P, TransportMessageSchema as T, TransportMessage as a, OpaqueTransportMessage as b, TransportClientId as c, isStreamClose as d, TelemetryInfo as e, LogFn as f, LoggingLevel as g, HandshakeErrorCustomHandlerFatalResponseCodes as h, isStreamOpen as i, coloredStringLogger as j, jsonLogger as k, stringLogger as s };
|
package/dist/router/index.cjs
CHANGED