@replit/river 0.12.6 → 0.13.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 (51) hide show
  1. package/README.md +6 -1
  2. package/dist/{builder-c593de11.d.ts → builder-eef3b061.d.ts} +16 -7
  3. package/dist/{chunk-AFLZ6INU.js → chunk-JXKTY3GQ.js} +77 -49
  4. package/dist/{chunk-IIBVKYDB.js → chunk-JXO2SCQB.js} +39 -1
  5. package/dist/{chunk-4SDJ5VN4.js → chunk-LDUFHGZU.js} +150 -116
  6. package/dist/{chunk-VLBVQX5H.js → chunk-Q7AWJYDQ.js} +1 -1
  7. package/dist/{chunk-XFFS4UOD.js → chunk-SCG5S2EC.js} +9 -9
  8. package/dist/{messageFraming-b200ef25.d.ts → connection-03e650c8.d.ts} +17 -2
  9. package/dist/{connection-ba37d174.d.ts → connection-d052d027.d.ts} +1 -1
  10. package/dist/{index-54e0f99c.d.ts → index-9aa0aabb.d.ts} +29 -39
  11. package/dist/router/index.cjs +83 -56
  12. package/dist/router/index.d.cts +5 -5
  13. package/dist/router/index.d.ts +5 -5
  14. package/dist/router/index.js +2 -2
  15. package/dist/transport/impls/uds/client.cjs +144 -122
  16. package/dist/transport/impls/uds/client.d.cts +2 -3
  17. package/dist/transport/impls/uds/client.d.ts +2 -3
  18. package/dist/transport/impls/uds/client.js +5 -6
  19. package/dist/transport/impls/uds/server.cjs +153 -129
  20. package/dist/transport/impls/uds/server.d.cts +2 -3
  21. package/dist/transport/impls/uds/server.d.ts +2 -3
  22. package/dist/transport/impls/uds/server.js +4 -5
  23. package/dist/transport/impls/ws/client.cjs +151 -134
  24. package/dist/transport/impls/ws/client.d.cts +4 -4
  25. package/dist/transport/impls/ws/client.d.ts +4 -4
  26. package/dist/transport/impls/ws/client.js +10 -17
  27. package/dist/transport/impls/ws/server.cjs +153 -129
  28. package/dist/transport/impls/ws/server.d.cts +2 -2
  29. package/dist/transport/impls/ws/server.d.ts +2 -2
  30. package/dist/transport/impls/ws/server.js +4 -4
  31. package/dist/transport/index.cjs +204 -169
  32. package/dist/transport/index.d.cts +1 -1
  33. package/dist/transport/index.d.ts +1 -1
  34. package/dist/transport/index.js +3 -3
  35. package/dist/util/testHelpers.cjs +294 -16
  36. package/dist/util/testHelpers.d.cts +2 -2
  37. package/dist/util/testHelpers.d.ts +2 -2
  38. package/dist/util/testHelpers.js +30 -8
  39. package/package.json +1 -9
  40. package/dist/chunk-PBPXYLI6.js +0 -44
  41. package/dist/chunk-Q7GL34DZ.js +0 -47
  42. package/dist/connection-1f9971d8.d.ts +0 -17
  43. package/dist/connection-24d878ac.d.ts +0 -18
  44. package/dist/transport/impls/stdio/client.cjs +0 -904
  45. package/dist/transport/impls/stdio/client.d.cts +0 -27
  46. package/dist/transport/impls/stdio/client.d.ts +0 -27
  47. package/dist/transport/impls/stdio/client.js +0 -42
  48. package/dist/transport/impls/stdio/server.cjs +0 -879
  49. package/dist/transport/impls/stdio/server.d.cts +0 -25
  50. package/dist/transport/impls/stdio/server.d.ts +0 -25
  51. package/dist/transport/impls/stdio/server.js +0 -33
@@ -1,19 +1,19 @@
1
- import {
2
- NaiveJsonCodec
3
- } from "./chunk-GZ7HCLLM.js";
4
1
  import {
5
2
  ControlMessageHandshakeRequestSchema,
6
3
  ControlMessageHandshakeResponseSchema,
7
4
  OpaqueTransportMessageSchema,
8
5
  PROTOCOL_VERSION,
9
- bootRequestMessage,
10
- bootResponseMessage,
11
6
  coerceErrorString,
7
+ handshakeRequestMessage,
8
+ handshakeResponseMessage,
12
9
  isAck
13
- } from "./chunk-XFFS4UOD.js";
10
+ } from "./chunk-SCG5S2EC.js";
14
11
  import {
15
12
  log
16
13
  } from "./chunk-H4BYJELI.js";
14
+ import {
15
+ NaiveJsonCodec
16
+ } from "./chunk-GZ7HCLLM.js";
17
17
 
18
18
  // transport/events.ts
19
19
  var EventDispatcher = class {
@@ -56,8 +56,15 @@ var Connection = class {
56
56
  var HEARTBEAT_INTERVAL_MS = 1e3;
57
57
  var HEARTBEATS_TILL_DEAD = 2;
58
58
  var SESSION_DISCONNECT_GRACE_MS = 5e3;
59
+ var defaultSessionOptions = {
60
+ heartbeatIntervalMs: HEARTBEAT_INTERVAL_MS,
61
+ heartbeatsUntilDead: HEARTBEATS_TILL_DEAD,
62
+ sessionDisconnectGraceMs: SESSION_DISCONNECT_GRACE_MS,
63
+ codec: NaiveJsonCodec
64
+ };
59
65
  var Session = class {
60
66
  codec;
67
+ options;
61
68
  /**
62
69
  * The buffer of messages that have been sent but not yet acknowledged.
63
70
  */
@@ -93,16 +100,17 @@ var Session = class {
93
100
  * The interval for sending heartbeats.
94
101
  */
95
102
  heartbeat;
96
- constructor(codec, from, connectedTo, conn) {
103
+ constructor(from, connectedTo, conn, options) {
104
+ this.options = options;
97
105
  this.debugId = `sess-${unsafeId()}`;
98
106
  this.from = from;
99
107
  this.to = connectedTo;
100
108
  this.connection = conn;
101
- this.codec = codec;
109
+ this.codec = options.codec;
102
110
  this.heartbeatMisses = 0;
103
111
  this.heartbeat = setInterval(
104
112
  () => this.sendHeartbeat(),
105
- HEARTBEAT_INTERVAL_MS
113
+ options.heartbeatIntervalMs
106
114
  );
107
115
  }
108
116
  /**
@@ -138,7 +146,7 @@ var Session = class {
138
146
  return fullMsg.id;
139
147
  }
140
148
  sendHeartbeat() {
141
- if (this.heartbeatMisses >= HEARTBEATS_TILL_DEAD) {
149
+ if (this.heartbeatMisses >= this.options.heartbeatsUntilDead) {
142
150
  if (this.connection) {
143
151
  log?.info(
144
152
  `${this.from} -- closing connection (id: ${this.connection.debugId}) to ${this.to} due to inactivity`
@@ -208,7 +216,7 @@ var Session = class {
208
216
  this.disconnectionGrace = setTimeout(() => {
209
217
  this.close();
210
218
  cb();
211
- }, SESSION_DISCONNECT_GRACE_MS);
219
+ }, this.options.sessionDisconnectGraceMs);
212
220
  }
213
221
  // called on reconnect of the underlying session
214
222
  cancelGrace() {
@@ -249,13 +257,13 @@ var Session = class {
249
257
  // transport/transport.ts
250
258
  import { Value } from "@sinclair/typebox/value";
251
259
  import { nanoid as nanoid2 } from "nanoid";
252
- var DEFAULT_RECONNECT_JITTER_MAX_MS = 500;
253
- var DEFAULT_RECONNECT_INTERVAL_MS = 250;
260
+ var RECONNECT_JITTER_MAX_MS = 500;
261
+ var RECONNECT_INTERVAL_MS = 250;
254
262
  var defaultTransportOptions = {
255
- retryIntervalMs: DEFAULT_RECONNECT_INTERVAL_MS,
256
- retryJitterMs: DEFAULT_RECONNECT_JITTER_MAX_MS,
263
+ retryIntervalMs: RECONNECT_INTERVAL_MS,
264
+ retryJitterMs: RECONNECT_JITTER_MAX_MS,
257
265
  retryAttemptsMax: 5,
258
- codec: NaiveJsonCodec
266
+ ...defaultSessionOptions
259
267
  };
260
268
  var Transport = class {
261
269
  /**
@@ -326,7 +334,7 @@ var Transport = class {
326
334
  const lastInstanceId = this.connectedInstanceIds.get(connectedTo);
327
335
  if (oldSession && lastInstanceId !== void 0 && lastInstanceId !== instanceId) {
328
336
  log?.warn(
329
- `${this.clientId} -- handshake from ${connectedTo} is a different instance (got: ${instanceId}, last connected to: ${lastInstanceId}), starting a new session`
337
+ `${this.clientId} -- connection from ${connectedTo} is a different instance (got: ${instanceId}, last connected to: ${lastInstanceId}), starting a new session`
330
338
  );
331
339
  oldSession.close();
332
340
  this.deleteSession(oldSession);
@@ -349,10 +357,10 @@ var Transport = class {
349
357
  }
350
358
  createSession(connectedTo, conn) {
351
359
  const session = new Session(
352
- this.codec,
353
360
  this.clientId,
354
361
  connectedTo,
355
- conn
362
+ conn,
363
+ this.options
356
364
  );
357
365
  this.sessions.set(session.to, session);
358
366
  this.eventDispatcher.dispatchEvent("sessionStatus", {
@@ -395,7 +403,7 @@ var Transport = class {
395
403
  parseMsg(msg) {
396
404
  const parsedMsg = this.codec.fromBuffer(msg);
397
405
  if (parsedMsg === null) {
398
- const decodedBuffer = new TextDecoder().decode(msg);
406
+ const decodedBuffer = new TextDecoder().decode(Buffer.from(msg));
399
407
  log?.error(
400
408
  `${this.clientId} -- received malformed msg, killing conn: ${decodedBuffer}`
401
409
  );
@@ -409,11 +417,7 @@ var Transport = class {
409
417
  );
410
418
  return null;
411
419
  }
412
- return {
413
- ...parsedMsg,
414
- serviceName: parsedMsg.serviceName === null ? void 0 : parsedMsg.serviceName,
415
- procedureName: parsedMsg.procedureName === null ? void 0 : parsedMsg.procedureName
416
- };
420
+ return parsedMsg;
417
421
  }
418
422
  /**
419
423
  * Called when a message is received by this transport.
@@ -432,11 +436,18 @@ var Transport = class {
432
436
  session.cancelGrace();
433
437
  log?.debug(`${this.clientId} -- received msg: ${JSON.stringify(msg)}`);
434
438
  if (msg.seq !== session.nextExpectedSeq) {
435
- log?.warn(
436
- `${this.clientId} -- received out-of-order msg (got: ${msg.seq}, wanted: ${session.nextExpectedSeq}), discarding: ${JSON.stringify(
437
- msg
438
- )}`
439
- );
439
+ if (msg.seq < session.nextExpectedSeq) {
440
+ log?.debug(
441
+ `${this.clientId} -- received duplicate msg (got: ${msg.seq}, wanted: ${session.nextExpectedSeq}), discarding: ${JSON.stringify(
442
+ msg
443
+ )}`
444
+ );
445
+ } else {
446
+ log?.error(
447
+ `${this.clientId} -- received out-of-order msg (got: ${msg.seq}, wanted: ${session.nextExpectedSeq}), marking connection as dead: ${JSON.stringify(msg)}`
448
+ );
449
+ session.closeStaleConnection(session.connection);
450
+ }
440
451
  return;
441
452
  }
442
453
  if (!isAck(msg.controlFlags)) {
@@ -454,7 +465,7 @@ var Transport = class {
454
465
  }
455
466
  /**
456
467
  * Removes a listener from this transport.
457
- * @param the type of event to unlisten on
468
+ * @param the type of event to un-listen on
458
469
  * @param handler The message handler to remove.
459
470
  */
460
471
  removeEventListener(type, handler) {
@@ -531,23 +542,31 @@ var ClientTransport = class extends Transport {
531
542
  */
532
543
  inflightConnectionPromises;
533
544
  tryReconnecting = true;
534
- constructor(clientId, providedOptions) {
545
+ connectedTo;
546
+ constructor(clientId, connectedTo, providedOptions) {
535
547
  super(clientId, providedOptions);
548
+ this.connectedTo = connectedTo;
536
549
  this.inflightConnectionPromises = /* @__PURE__ */ new Map();
537
550
  }
538
551
  handleConnection(conn, to) {
539
- const bootHandler = this.receiveWithBootSequence(conn, () => {
540
- conn.removeDataListener(bootHandler);
541
- conn.addDataListener((data) => {
542
- const parsed = this.parseMsg(data);
552
+ const handshakeHandler = (data) => {
553
+ const handshake = this.receiveHandshakeResponseMessage(data);
554
+ if (!handshake) {
555
+ conn.close();
556
+ return;
557
+ }
558
+ this.onConnect(conn, handshake.from, handshake.instanceId);
559
+ conn.removeDataListener(handshakeHandler);
560
+ conn.addDataListener((data2) => {
561
+ const parsed = this.parseMsg(data2);
543
562
  if (!parsed) {
544
563
  conn.close();
545
564
  return;
546
565
  }
547
566
  this.handleMsg(parsed);
548
567
  });
549
- });
550
- conn.addDataListener(bootHandler);
568
+ };
569
+ conn.addDataListener(handshakeHandler);
551
570
  conn.addCloseListener(() => {
552
571
  this.onDisconnect(conn, to);
553
572
  void this.connect(to);
@@ -558,6 +577,32 @@ var ClientTransport = class extends Transport {
558
577
  );
559
578
  });
560
579
  }
580
+ receiveHandshakeResponseMessage(data) {
581
+ const parsed = this.parseMsg(data);
582
+ if (!parsed)
583
+ return false;
584
+ if (!Value.Check(ControlMessageHandshakeResponseSchema, parsed.payload)) {
585
+ log?.warn(
586
+ `${this.clientId} -- received invalid handshake resp: ${JSON.stringify(
587
+ parsed
588
+ )}`
589
+ );
590
+ return false;
591
+ }
592
+ if (!parsed.payload.status.ok) {
593
+ log?.warn(
594
+ `${this.clientId} -- received failed handshake resp: ${JSON.stringify(
595
+ parsed
596
+ )}`
597
+ );
598
+ return false;
599
+ }
600
+ const instanceId = parsed.payload.status.instanceId;
601
+ log?.debug(
602
+ `${this.clientId} -- handshake from ${parsed.from} ok (instance: ${instanceId})`
603
+ );
604
+ return { instanceId, from: parsed.from };
605
+ }
561
606
  /**
562
607
  * Manually attempts to connect to a client.
563
608
  * @param to The client ID of the node to connect to.
@@ -576,10 +621,7 @@ var ClientTransport = class extends Transport {
576
621
  }
577
622
  try {
578
623
  const conn = await reconnectPromise;
579
- this.state = "open";
580
- const requestMsg = bootRequestMessage(this.clientId, to, this.instanceId);
581
- log?.debug(`${this.clientId} -- sending boot handshake to ${to}`);
582
- conn.send(this.codec.toBuffer(requestMsg));
624
+ this.sendHandshake(to, conn);
583
625
  } catch (error) {
584
626
  const errStr = coerceErrorString(error);
585
627
  this.inflightConnectionPromises.delete(to);
@@ -597,34 +639,14 @@ var ClientTransport = class extends Transport {
597
639
  }
598
640
  }
599
641
  }
600
- receiveWithBootSequence(conn, sessionCb) {
601
- const bootHandler = (data) => {
602
- const parsed = this.parseMsg(data);
603
- if (!parsed) {
604
- conn.close();
605
- return;
606
- }
607
- if (!Value.Check(ControlMessageHandshakeResponseSchema, parsed.payload)) {
608
- log?.warn(
609
- `${this.clientId} -- received invalid handshake resp: ${JSON.stringify(parsed)}`
610
- );
611
- return;
612
- }
613
- if (!parsed.payload.status.ok) {
614
- log?.warn(
615
- `${this.clientId} -- received failed handshake resp: ${JSON.stringify(
616
- parsed
617
- )}`
618
- );
619
- return;
620
- }
621
- const serverInstanceId = parsed.payload.status.instanceId;
622
- log?.debug(
623
- `${this.clientId} -- handshake from ${parsed.from} ok (server instance: ${serverInstanceId})`
624
- );
625
- sessionCb(this.onConnect(conn, parsed.from, serverInstanceId));
626
- };
627
- return bootHandler;
642
+ sendHandshake(to, conn) {
643
+ const requestMsg = handshakeRequestMessage(
644
+ this.clientId,
645
+ to,
646
+ this.instanceId
647
+ );
648
+ log?.debug(`${this.clientId} -- sending handshake request to ${to}`);
649
+ conn.send(this.codec.toBuffer(requestMsg));
628
650
  }
629
651
  onDisconnect(conn, connectedTo) {
630
652
  this.inflightConnectionPromises.delete(connectedTo);
@@ -641,22 +663,24 @@ var ServerTransport = class extends Transport {
641
663
  handleConnection(conn) {
642
664
  let session = void 0;
643
665
  const client = () => session?.to ?? "unknown";
644
- const bootHandler = this.receiveWithBootSequence(
645
- conn,
646
- (establishedSession) => {
647
- session = establishedSession;
648
- conn.removeDataListener(bootHandler);
649
- conn.addDataListener((data) => {
650
- const parsed = this.parseMsg(data);
651
- if (!parsed) {
652
- conn.close();
653
- return;
654
- }
655
- this.handleMsg(parsed);
656
- });
666
+ const handshakeHandler = (data) => {
667
+ const handshake = this.receiveHandshakeRequestMessage(data, conn);
668
+ if (!handshake) {
669
+ conn.close();
670
+ return;
657
671
  }
658
- );
659
- conn.addDataListener(bootHandler);
672
+ session = this.onConnect(conn, handshake.from, handshake.instanceId);
673
+ conn.removeDataListener(handshakeHandler);
674
+ conn.addDataListener((data2) => {
675
+ const parsed = this.parseMsg(data2);
676
+ if (!parsed) {
677
+ conn.close();
678
+ return;
679
+ }
680
+ this.handleMsg(parsed);
681
+ });
682
+ };
683
+ conn.addDataListener(handshakeHandler);
660
684
  conn.addCloseListener(() => {
661
685
  if (!session)
662
686
  return;
@@ -673,47 +697,57 @@ var ServerTransport = class extends Transport {
673
697
  );
674
698
  });
675
699
  }
676
- receiveWithBootSequence(conn, sessionCb) {
677
- const bootHandler = (data) => {
678
- const parsed = this.parseMsg(data);
679
- if (!parsed) {
680
- conn.close();
681
- return;
682
- }
683
- if (!Value.Check(ControlMessageHandshakeRequestSchema, parsed.payload)) {
684
- const responseMsg2 = bootResponseMessage(
685
- this.clientId,
686
- this.instanceId,
687
- parsed.from,
688
- false
689
- );
690
- conn.send(this.codec.toBuffer(responseMsg2));
691
- log?.warn(
692
- `${this.clientId} -- received invalid handshake msg: ${JSON.stringify(
693
- parsed
694
- )}`
695
- );
696
- return;
697
- }
698
- const instanceId = parsed.payload.instanceId;
699
- log?.debug(
700
- `${this.clientId} -- handshake from ${parsed.from} ok (instance id: ${instanceId}), responding with handshake success`
700
+ receiveHandshakeRequestMessage(data, conn) {
701
+ const parsed = this.parseMsg(data);
702
+ if (!parsed)
703
+ return false;
704
+ if (!Value.Check(ControlMessageHandshakeRequestSchema, parsed.payload)) {
705
+ const responseMsg2 = handshakeResponseMessage(
706
+ this.clientId,
707
+ this.instanceId,
708
+ parsed.from,
709
+ false
710
+ );
711
+ conn.send(this.codec.toBuffer(responseMsg2));
712
+ log?.warn(
713
+ `${this.clientId} -- received invalid handshake msg: ${JSON.stringify(
714
+ parsed
715
+ )}`
701
716
  );
702
- const responseMsg = bootResponseMessage(
717
+ return false;
718
+ }
719
+ const gotVersion = parsed.payload.protocolVersion;
720
+ if (gotVersion !== PROTOCOL_VERSION) {
721
+ const responseMsg2 = handshakeResponseMessage(
703
722
  this.clientId,
704
723
  this.instanceId,
705
724
  parsed.from,
706
- true
725
+ false
707
726
  );
708
- conn.send(this.codec.toBuffer(responseMsg));
709
- sessionCb(this.onConnect(conn, parsed.from, instanceId));
710
- };
711
- return bootHandler;
727
+ conn.send(this.codec.toBuffer(responseMsg2));
728
+ log?.warn(
729
+ `${this.clientId} -- received handshake msg with incompatible protocol version (got: ${gotVersion}, expected: ${PROTOCOL_VERSION})`
730
+ );
731
+ return false;
732
+ }
733
+ const instanceId = parsed.payload.instanceId;
734
+ log?.debug(
735
+ `${this.clientId} -- handshake from ${parsed.from} ok (instance id: ${instanceId}), responding with handshake success`
736
+ );
737
+ const responseMsg = handshakeResponseMessage(
738
+ this.clientId,
739
+ this.instanceId,
740
+ parsed.from,
741
+ true
742
+ );
743
+ conn.send(this.codec.toBuffer(responseMsg));
744
+ return { instanceId, from: parsed.from };
712
745
  }
713
746
  };
714
747
 
715
748
  export {
716
749
  Connection,
750
+ defaultSessionOptions,
717
751
  Session,
718
752
  Transport,
719
753
  ClientTransport,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Connection
3
- } from "./chunk-4SDJ5VN4.js";
3
+ } from "./chunk-LDUFHGZU.js";
4
4
 
5
5
  // transport/impls/ws/connection.ts
6
6
  var WebSocketConnection = class extends Connection {
@@ -7,8 +7,8 @@ var TransportMessageSchema = (t) => Type.Object({
7
7
  to: Type.String(),
8
8
  seq: Type.Integer(),
9
9
  ack: Type.Integer(),
10
- serviceName: Type.Optional(Type.Union([Type.String(), Type.Null()])),
11
- procedureName: Type.Optional(Type.Union([Type.String(), Type.Null()])),
10
+ serviceName: Type.Optional(Type.String()),
11
+ procedureName: Type.Optional(Type.String()),
12
12
  streamId: Type.String(),
13
13
  controlFlags: Type.Integer(),
14
14
  payload: t
@@ -22,7 +22,7 @@ var ControlMessageCloseSchema = Type.Object({
22
22
  var PROTOCOL_VERSION = "v1";
23
23
  var ControlMessageHandshakeRequestSchema = Type.Object({
24
24
  type: Type.Literal("HANDSHAKE_REQ"),
25
- protocolVersion: Type.Literal(PROTOCOL_VERSION),
25
+ protocolVersion: Type.String(),
26
26
  instanceId: Type.String()
27
27
  });
28
28
  var ControlMessageHandshakeResponseSchema = Type.Object({
@@ -34,7 +34,7 @@ var ControlMessageHandshakeResponseSchema = Type.Object({
34
34
  }),
35
35
  Type.Object({
36
36
  ok: Type.Literal(false),
37
- reason: Type.Union([Type.Literal("VERSION_MISMATCH")])
37
+ reason: Type.String()
38
38
  })
39
39
  ])
40
40
  });
@@ -47,7 +47,7 @@ var ControlMessagePayloadSchema = Type.Union([
47
47
  var OpaqueTransportMessageSchema = TransportMessageSchema(
48
48
  Type.Unknown()
49
49
  );
50
- function bootRequestMessage(from, to, instanceId) {
50
+ function handshakeRequestMessage(from, to, instanceId) {
51
51
  return {
52
52
  id: nanoid(),
53
53
  from,
@@ -63,7 +63,7 @@ function bootRequestMessage(from, to, instanceId) {
63
63
  }
64
64
  };
65
65
  }
66
- function bootResponseMessage(from, instanceId, to, ok) {
66
+ function handshakeResponseMessage(from, instanceId, to, ok, reason) {
67
67
  return {
68
68
  id: nanoid(),
69
69
  from,
@@ -82,7 +82,7 @@ function bootResponseMessage(from, instanceId, to, ok) {
82
82
  type: "HANDSHAKE_RESP",
83
83
  status: {
84
84
  ok: false,
85
- reason: "VERSION_MISMATCH"
85
+ reason: reason ?? "Unknown reason"
86
86
  }
87
87
  }
88
88
  };
@@ -118,8 +118,8 @@ export {
118
118
  ControlMessageHandshakeResponseSchema,
119
119
  ControlMessagePayloadSchema,
120
120
  OpaqueTransportMessageSchema,
121
- bootRequestMessage,
122
- bootResponseMessage,
121
+ handshakeRequestMessage,
122
+ handshakeResponseMessage,
123
123
  isAck,
124
124
  isStreamOpen,
125
125
  isStreamClose,
@@ -1,4 +1,6 @@
1
- import { Transform, TransformCallback, TransformOptions } from 'node:stream';
1
+ import { C as Connection } from './index-9aa0aabb.js';
2
+ import { Socket } from 'node:net';
3
+ import stream, { Transform, TransformCallback, TransformOptions } from 'node:stream';
2
4
 
3
5
  interface LengthEncodedOptions extends TransformOptions {
4
6
  /** Maximum in-memory buffer size before we throw */
@@ -17,4 +19,17 @@ declare class Uint32LengthPrefixFraming extends Transform {
17
19
  _destroy(error: Error | null, callback: (error: Error | null) => void): void;
18
20
  }
19
21
 
20
- export { Uint32LengthPrefixFraming as U };
22
+ declare class UdsConnection extends Connection {
23
+ sock: Socket;
24
+ input: stream.Readable;
25
+ framer: Uint32LengthPrefixFraming;
26
+ constructor(sock: Socket);
27
+ addDataListener(cb: (msg: Uint8Array) => void): void;
28
+ removeDataListener(cb: (msg: Uint8Array) => void): void;
29
+ addCloseListener(cb: () => void): void;
30
+ addErrorListener(cb: (err: Error) => void): void;
31
+ send(payload: Uint8Array): boolean;
32
+ close(): void;
33
+ }
34
+
35
+ export { UdsConnection as U };
@@ -1,5 +1,5 @@
1
1
  import WebSocket from 'isomorphic-ws';
2
- import { C as Connection } from './index-54e0f99c.js';
2
+ import { C as Connection } from './index-9aa0aabb.js';
3
3
 
4
4
  declare class WebSocketConnection extends Connection {
5
5
  ws: WebSocket;