@replit/river 0.207.3 → 0.208.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.
- package/dist/{chunk-BO7MFCO6.js → chunk-2WFRHXDZ.js} +47 -84
- package/dist/chunk-2WFRHXDZ.js.map +1 -0
- package/dist/{chunk-B7REV3ZV.js → chunk-BXKBENJE.js} +2 -2
- package/dist/{chunk-QGPYCXV4.js → chunk-EVAQ2QMB.js} +61 -38
- package/dist/chunk-EVAQ2QMB.js.map +1 -0
- package/dist/codec/index.cjs +1 -1
- package/dist/codec/index.cjs.map +1 -1
- package/dist/codec/index.js +2 -2
- package/dist/{connection-06d72f2e.d.ts → connection-098d4aad.d.ts} +1 -1
- package/dist/router/index.cjs +58 -35
- package/dist/router/index.cjs.map +1 -1
- package/dist/router/index.d.cts +24 -5
- package/dist/router/index.d.ts +24 -5
- package/dist/router/index.js +1 -1
- package/dist/{services-87887bc5.d.ts → services-44be1b6b.d.ts} +22 -25
- package/dist/testUtil/index.cjs +51 -94
- package/dist/testUtil/index.cjs.map +1 -1
- package/dist/testUtil/index.d.cts +1 -1
- package/dist/testUtil/index.d.ts +1 -1
- package/dist/testUtil/index.js +5 -11
- package/dist/testUtil/index.js.map +1 -1
- package/dist/transport/impls/ws/client.cjs +48 -73
- package/dist/transport/impls/ws/client.cjs.map +1 -1
- package/dist/transport/impls/ws/client.d.cts +2 -2
- package/dist/transport/impls/ws/client.d.ts +2 -2
- package/dist/transport/impls/ws/client.js +3 -3
- package/dist/transport/impls/ws/server.cjs +48 -76
- package/dist/transport/impls/ws/server.cjs.map +1 -1
- package/dist/transport/impls/ws/server.d.cts +2 -2
- package/dist/transport/impls/ws/server.d.ts +2 -2
- package/dist/transport/impls/ws/server.js +3 -3
- package/dist/transport/index.cjs +48 -85
- package/dist/transport/index.cjs.map +1 -1
- package/dist/transport/index.d.cts +2 -2
- package/dist/transport/index.d.ts +2 -2
- package/dist/transport/index.js +2 -2
- package/package.json +3 -3
- package/dist/chunk-BO7MFCO6.js.map +0 -1
- package/dist/chunk-QGPYCXV4.js.map +0 -1
- /package/dist/{chunk-B7REV3ZV.js.map → chunk-BXKBENJE.js.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { T as TransportClientId } from '../../../message-01c3e85a.js';
|
|
2
2
|
import { WebSocketServer } from 'ws';
|
|
3
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
3
|
+
import { W as WebSocketConnection } from '../../../connection-098d4aad.js';
|
|
4
4
|
import { W as WsLike } from '../../../wslike-e0b32dd5.js';
|
|
5
5
|
import { ServerTransport } from '../../index.cjs';
|
|
6
|
-
import { a as ProvidedServerTransportOptions } from '../../../services-
|
|
6
|
+
import { a as ProvidedServerTransportOptions } from '../../../services-44be1b6b.js';
|
|
7
7
|
import { IncomingMessage } from 'http';
|
|
8
8
|
import '@sinclair/typebox';
|
|
9
9
|
import '@opentelemetry/api';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { T as TransportClientId } from '../../../message-01c3e85a.js';
|
|
2
2
|
import { WebSocketServer } from 'ws';
|
|
3
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
3
|
+
import { W as WebSocketConnection } from '../../../connection-098d4aad.js';
|
|
4
4
|
import { W as WsLike } from '../../../wslike-e0b32dd5.js';
|
|
5
5
|
import { ServerTransport } from '../../index.js';
|
|
6
|
-
import { a as ProvidedServerTransportOptions } from '../../../services-
|
|
6
|
+
import { a as ProvidedServerTransportOptions } from '../../../services-44be1b6b.js';
|
|
7
7
|
import { IncomingMessage } from 'http';
|
|
8
8
|
import '@sinclair/typebox';
|
|
9
9
|
import '@opentelemetry/api';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WebSocketConnection
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-BXKBENJE.js";
|
|
4
4
|
import {
|
|
5
5
|
ServerTransport
|
|
6
|
-
} from "../../../chunk-
|
|
7
|
-
import "../../../chunk-
|
|
6
|
+
} from "../../../chunk-2WFRHXDZ.js";
|
|
7
|
+
import "../../../chunk-EVAQ2QMB.js";
|
|
8
8
|
import "../../../chunk-CC7RN7GI.js";
|
|
9
9
|
|
|
10
10
|
// transport/impls/ws/server.ts
|
package/dist/transport/index.cjs
CHANGED
|
@@ -168,7 +168,7 @@ var NaiveJsonCodec = {
|
|
|
168
168
|
const parsed = JSON.parse(
|
|
169
169
|
decoder.decode(buff),
|
|
170
170
|
function reviver(_key, val) {
|
|
171
|
-
if (val?.$t) {
|
|
171
|
+
if (val?.$t !== void 0) {
|
|
172
172
|
return base64ToUint8Array(val.$t);
|
|
173
173
|
} else {
|
|
174
174
|
return val;
|
|
@@ -642,7 +642,7 @@ function coerceErrorString(err) {
|
|
|
642
642
|
}
|
|
643
643
|
|
|
644
644
|
// package.json
|
|
645
|
-
var version = "0.
|
|
645
|
+
var version = "0.208.1";
|
|
646
646
|
|
|
647
647
|
// tracing/index.ts
|
|
648
648
|
function getPropagationContext(ctx) {
|
|
@@ -656,7 +656,7 @@ function getPropagationContext(ctx) {
|
|
|
656
656
|
function createSessionTelemetryInfo(tracer, sessionId, to, from, propagationCtx) {
|
|
657
657
|
const parentCtx = propagationCtx ? import_api2.propagation.extract(import_api2.context.active(), propagationCtx) : import_api2.context.active();
|
|
658
658
|
const span = tracer.startSpan(
|
|
659
|
-
`river.session
|
|
659
|
+
`river.session`,
|
|
660
660
|
{
|
|
661
661
|
attributes: {
|
|
662
662
|
component: "river",
|
|
@@ -672,7 +672,7 @@ function createSessionTelemetryInfo(tracer, sessionId, to, from, propagationCtx)
|
|
|
672
672
|
}
|
|
673
673
|
function createConnectionTelemetryInfo(tracer, connection, info) {
|
|
674
674
|
const span = tracer.startSpan(
|
|
675
|
-
`connection
|
|
675
|
+
`river.connection`,
|
|
676
676
|
{
|
|
677
677
|
attributes: {
|
|
678
678
|
component: "river",
|
|
@@ -702,9 +702,9 @@ var SessionWaitingForHandshake = class extends CommonSession {
|
|
|
702
702
|
this.handshakeTimeout = setTimeout(() => {
|
|
703
703
|
this.listeners.onHandshakeTimeout();
|
|
704
704
|
}, this.options.handshakeTimeoutMs);
|
|
705
|
-
this.conn.
|
|
706
|
-
this.conn.
|
|
707
|
-
this.conn.
|
|
705
|
+
this.conn.setDataListener(this.onHandshakeData);
|
|
706
|
+
this.conn.setErrorListener(this.listeners.onConnectionErrored);
|
|
707
|
+
this.conn.setCloseListener(this.listeners.onConnectionClosed);
|
|
708
708
|
}
|
|
709
709
|
get loggingMetadata() {
|
|
710
710
|
return {
|
|
@@ -728,9 +728,9 @@ var SessionWaitingForHandshake = class extends CommonSession {
|
|
|
728
728
|
return sendMessage(this.conn, this.codec, msg);
|
|
729
729
|
}
|
|
730
730
|
_handleStateExit() {
|
|
731
|
-
this.conn.removeDataListener(
|
|
732
|
-
this.conn.removeErrorListener(
|
|
733
|
-
this.conn.removeCloseListener(
|
|
731
|
+
this.conn.removeDataListener();
|
|
732
|
+
this.conn.removeErrorListener();
|
|
733
|
+
this.conn.removeCloseListener();
|
|
734
734
|
clearTimeout(this.handshakeTimeout);
|
|
735
735
|
this.handshakeTimeout = void 0;
|
|
736
736
|
}
|
|
@@ -752,9 +752,9 @@ var SessionHandshaking = class extends IdentifiedSessionWithGracePeriod {
|
|
|
752
752
|
this.handshakeTimeout = setTimeout(() => {
|
|
753
753
|
this.listeners.onHandshakeTimeout();
|
|
754
754
|
}, this.options.handshakeTimeoutMs);
|
|
755
|
-
this.conn.
|
|
756
|
-
this.conn.
|
|
757
|
-
this.conn.
|
|
755
|
+
this.conn.setDataListener(this.onHandshakeData);
|
|
756
|
+
this.conn.setErrorListener(this.listeners.onConnectionErrored);
|
|
757
|
+
this.conn.setCloseListener(this.listeners.onConnectionClosed);
|
|
758
758
|
}
|
|
759
759
|
get loggingMetadata() {
|
|
760
760
|
return {
|
|
@@ -778,9 +778,9 @@ var SessionHandshaking = class extends IdentifiedSessionWithGracePeriod {
|
|
|
778
778
|
}
|
|
779
779
|
_handleStateExit() {
|
|
780
780
|
super._handleStateExit();
|
|
781
|
-
this.conn.removeDataListener(
|
|
782
|
-
this.conn.removeErrorListener(
|
|
783
|
-
this.conn.removeCloseListener(
|
|
781
|
+
this.conn.removeDataListener();
|
|
782
|
+
this.conn.removeErrorListener();
|
|
783
|
+
this.conn.removeCloseListener();
|
|
784
784
|
if (this.handshakeTimeout) {
|
|
785
785
|
clearTimeout(this.handshakeTimeout);
|
|
786
786
|
this.handshakeTimeout = void 0;
|
|
@@ -836,9 +836,9 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
836
836
|
super(props);
|
|
837
837
|
this.conn = props.conn;
|
|
838
838
|
this.listeners = props.listeners;
|
|
839
|
-
this.conn.
|
|
840
|
-
this.conn.
|
|
841
|
-
this.conn.
|
|
839
|
+
this.conn.setDataListener(this.onMessageData);
|
|
840
|
+
this.conn.setCloseListener(this.listeners.onConnectionClosed);
|
|
841
|
+
this.conn.setErrorListener(this.listeners.onConnectionErrored);
|
|
842
842
|
}
|
|
843
843
|
sendBufferedMessages() {
|
|
844
844
|
if (this.sendBuffer.length > 0) {
|
|
@@ -947,9 +947,9 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
947
947
|
};
|
|
948
948
|
_handleStateExit() {
|
|
949
949
|
super._handleStateExit();
|
|
950
|
-
this.conn.removeDataListener(
|
|
951
|
-
this.conn.removeCloseListener(
|
|
952
|
-
this.conn.removeErrorListener(
|
|
950
|
+
this.conn.removeDataListener();
|
|
951
|
+
this.conn.removeCloseListener();
|
|
952
|
+
this.conn.removeErrorListener();
|
|
953
953
|
if (this.heartbeatHandle) {
|
|
954
954
|
clearInterval(this.heartbeatHandle);
|
|
955
955
|
this.heartbeatHandle = void 0;
|
|
@@ -1504,7 +1504,7 @@ var Transport = class {
|
|
|
1504
1504
|
}
|
|
1505
1505
|
// common listeners
|
|
1506
1506
|
onSessionGracePeriodElapsed(session) {
|
|
1507
|
-
this.log?.
|
|
1507
|
+
this.log?.info(
|
|
1508
1508
|
`session to ${session.to} grace period elapsed, closing`,
|
|
1509
1509
|
session.loggingMetadata
|
|
1510
1510
|
);
|
|
@@ -1861,15 +1861,6 @@ var ClientTransport = class extends Transport {
|
|
|
1861
1861
|
});
|
|
1862
1862
|
const res = connectedSession.sendBufferedMessages();
|
|
1863
1863
|
if (!res.ok) {
|
|
1864
|
-
this.log?.error(`failed to send buffered messages: ${res.reason}`, {
|
|
1865
|
-
...connectedSession.loggingMetadata,
|
|
1866
|
-
transportMessage: msg
|
|
1867
|
-
});
|
|
1868
|
-
this.protocolError({
|
|
1869
|
-
type: ProtocolError.MessageSendFailure,
|
|
1870
|
-
message: res.reason
|
|
1871
|
-
});
|
|
1872
|
-
this.deleteSession(connectedSession, { unhealthy: true });
|
|
1873
1864
|
return;
|
|
1874
1865
|
}
|
|
1875
1866
|
this.updateSession(connectedSession);
|
|
@@ -2416,18 +2407,6 @@ var ServerTransport = class extends Transport {
|
|
|
2416
2407
|
);
|
|
2417
2408
|
const bufferSendRes = connectedSession.sendBufferedMessages();
|
|
2418
2409
|
if (!bufferSendRes.ok) {
|
|
2419
|
-
this.log?.error(
|
|
2420
|
-
`failed to send buffered messages: ${bufferSendRes.reason}`,
|
|
2421
|
-
{
|
|
2422
|
-
...connectedSession.loggingMetadata,
|
|
2423
|
-
transportMessage: msg
|
|
2424
|
-
}
|
|
2425
|
-
);
|
|
2426
|
-
this.protocolError({
|
|
2427
|
-
type: ProtocolError.MessageSendFailure,
|
|
2428
|
-
message: bufferSendRes.reason
|
|
2429
|
-
});
|
|
2430
|
-
this.deleteSession(connectedSession, { unhealthy: true });
|
|
2431
2410
|
return;
|
|
2432
2411
|
}
|
|
2433
2412
|
this.sessionHandshakeMetadata.set(connectedSession.to, parsedMetadata);
|
|
@@ -2458,60 +2437,44 @@ var Connection = class {
|
|
|
2458
2437
|
}
|
|
2459
2438
|
return metadata;
|
|
2460
2439
|
}
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
_errorListeners = /* @__PURE__ */ new Set();
|
|
2465
|
-
get dataListeners() {
|
|
2466
|
-
return [...this._dataListeners];
|
|
2467
|
-
}
|
|
2468
|
-
get closeListeners() {
|
|
2469
|
-
return [...this._closeListeners];
|
|
2470
|
-
}
|
|
2471
|
-
get errorListeners() {
|
|
2472
|
-
return [...this._errorListeners];
|
|
2473
|
-
}
|
|
2440
|
+
dataListener;
|
|
2441
|
+
closeListener;
|
|
2442
|
+
errorListener;
|
|
2474
2443
|
onData(msg) {
|
|
2475
|
-
|
|
2476
|
-
cb(msg);
|
|
2477
|
-
}
|
|
2444
|
+
this.dataListener?.(msg);
|
|
2478
2445
|
}
|
|
2479
2446
|
onError(err) {
|
|
2480
|
-
|
|
2481
|
-
cb(err);
|
|
2482
|
-
}
|
|
2447
|
+
this.errorListener?.(err);
|
|
2483
2448
|
}
|
|
2484
2449
|
onClose() {
|
|
2485
|
-
|
|
2486
|
-
cb();
|
|
2487
|
-
}
|
|
2450
|
+
this.closeListener?.();
|
|
2488
2451
|
this.telemetry?.span.end();
|
|
2489
2452
|
}
|
|
2490
2453
|
/**
|
|
2491
|
-
*
|
|
2492
|
-
* @param
|
|
2454
|
+
* Set the callback for when a message is received.
|
|
2455
|
+
* @param cb The message handler callback.
|
|
2493
2456
|
*/
|
|
2494
|
-
|
|
2495
|
-
this.
|
|
2457
|
+
setDataListener(cb) {
|
|
2458
|
+
this.dataListener = cb;
|
|
2496
2459
|
}
|
|
2497
|
-
removeDataListener(
|
|
2498
|
-
this.
|
|
2460
|
+
removeDataListener() {
|
|
2461
|
+
this.dataListener = void 0;
|
|
2499
2462
|
}
|
|
2500
2463
|
/**
|
|
2501
|
-
*
|
|
2502
|
-
* This should also be called if an error happens and after notifying
|
|
2464
|
+
* Set the callback for when the connection is closed.
|
|
2465
|
+
* This should also be called if an error happens and after notifying the error listener.
|
|
2503
2466
|
* @param cb The callback to call when the connection is closed.
|
|
2504
2467
|
*/
|
|
2505
|
-
|
|
2506
|
-
this.
|
|
2468
|
+
setCloseListener(cb) {
|
|
2469
|
+
this.closeListener = cb;
|
|
2507
2470
|
}
|
|
2508
|
-
removeCloseListener(
|
|
2509
|
-
this.
|
|
2471
|
+
removeCloseListener() {
|
|
2472
|
+
this.closeListener = void 0;
|
|
2510
2473
|
}
|
|
2511
2474
|
/**
|
|
2512
|
-
*
|
|
2513
|
-
* This should only be used for
|
|
2514
|
-
* should be delegated to
|
|
2475
|
+
* Set the callback for when an error is received.
|
|
2476
|
+
* This should only be used for logging errors, all cleanup
|
|
2477
|
+
* should be delegated to setCloseListener.
|
|
2515
2478
|
*
|
|
2516
2479
|
* The implementer should take care such that the implemented
|
|
2517
2480
|
* connection will call both the close and error callbacks
|
|
@@ -2519,11 +2482,11 @@ var Connection = class {
|
|
|
2519
2482
|
*
|
|
2520
2483
|
* @param cb The callback to call when an error is received.
|
|
2521
2484
|
*/
|
|
2522
|
-
|
|
2523
|
-
this.
|
|
2485
|
+
setErrorListener(cb) {
|
|
2486
|
+
this.errorListener = cb;
|
|
2524
2487
|
}
|
|
2525
|
-
removeErrorListener(
|
|
2526
|
-
this.
|
|
2488
|
+
removeErrorListener() {
|
|
2489
|
+
this.errorListener = void 0;
|
|
2527
2490
|
}
|
|
2528
2491
|
};
|
|
2529
2492
|
// Annotate the CommonJS export names for ESM import in node:
|