@replit/river 0.209.1 → 0.209.3

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-2AV3IIW5.js → chunk-EHTVQM2C.js} +304 -287
  2. package/dist/chunk-EHTVQM2C.js.map +1 -0
  3. package/dist/{chunk-UC4MQ5FP.js → chunk-I24PIZXW.js} +2 -2
  4. package/dist/{chunk-2DRHPFKM.js → chunk-JRBDMLR3.js} +2 -2
  5. package/dist/{client-Cvl0bF5y.d.ts → client-BzJwq-hg.d.ts} +1 -1
  6. package/dist/{client-CRY4aeRv.d.cts → client-aETS93z1.d.cts} +1 -1
  7. package/dist/codec/index.js +2 -2
  8. package/dist/{connection-BphUYGjL.d.ts → connection-b1wd5XrC.d.ts} +1 -1
  9. package/dist/{connection-BVE0wfE7.d.cts → connection-hUWlS-hg.d.cts} +1 -1
  10. package/dist/router/index.cjs +304 -285
  11. package/dist/router/index.cjs.map +1 -1
  12. package/dist/router/index.d.cts +7 -7
  13. package/dist/router/index.d.ts +7 -7
  14. package/dist/router/index.js +5 -1
  15. package/dist/{server-BKZTIlAc.d.cts → server-BBgDVOzk.d.cts} +1 -1
  16. package/dist/{server-hDGOXIRA.d.ts → server-DZ0Yzmpf.d.ts} +1 -1
  17. package/dist/{services-9I3wdkpy.d.cts → services-C53K219K.d.cts} +91 -6
  18. package/dist/{services-BFGny14R.d.ts → services-DYik59tk.d.ts} +91 -6
  19. package/dist/testUtil/index.cjs +1 -1
  20. package/dist/testUtil/index.cjs.map +1 -1
  21. package/dist/testUtil/index.d.cts +4 -4
  22. package/dist/testUtil/index.d.ts +4 -4
  23. package/dist/testUtil/index.js +2 -2
  24. package/dist/transport/impls/ws/client.cjs +1 -1
  25. package/dist/transport/impls/ws/client.cjs.map +1 -1
  26. package/dist/transport/impls/ws/client.d.cts +3 -3
  27. package/dist/transport/impls/ws/client.d.ts +3 -3
  28. package/dist/transport/impls/ws/client.js +3 -3
  29. package/dist/transport/impls/ws/server.cjs +1 -1
  30. package/dist/transport/impls/ws/server.cjs.map +1 -1
  31. package/dist/transport/impls/ws/server.d.cts +3 -3
  32. package/dist/transport/impls/ws/server.d.ts +3 -3
  33. package/dist/transport/impls/ws/server.js +3 -3
  34. package/dist/transport/index.cjs +1 -1
  35. package/dist/transport/index.cjs.map +1 -1
  36. package/dist/transport/index.d.cts +4 -4
  37. package/dist/transport/index.d.ts +4 -4
  38. package/dist/transport/index.js +2 -2
  39. package/dist/{common-MmS1PQN7.d.cts → transport-CxjUaGhi.d.cts} +232 -232
  40. package/dist/{common-yodP-WNy.d.ts → transport-DwEB67zY.d.ts} +232 -232
  41. package/package.json +1 -1
  42. package/dist/chunk-2AV3IIW5.js.map +0 -1
  43. /package/dist/{chunk-UC4MQ5FP.js.map → chunk-I24PIZXW.js.map} +0 -0
  44. /package/dist/{chunk-2DRHPFKM.js.map → chunk-JRBDMLR3.js.map} +0 -0
@@ -354,12 +354,258 @@ var ServiceScaffold = class {
354
354
  }
355
355
  };
356
356
 
357
- // router/procedures.ts
357
+ // router/result.ts
358
358
  import { Type as Type3 } from "@sinclair/typebox";
359
+ var AnyResultSchema = Type3.Union([
360
+ Type3.Object({
361
+ ok: Type3.Literal(false),
362
+ payload: Type3.Object({
363
+ code: Type3.String(),
364
+ message: Type3.String(),
365
+ extras: Type3.Optional(Type3.Unknown())
366
+ })
367
+ }),
368
+ Type3.Object({
369
+ ok: Type3.Literal(true),
370
+ payload: Type3.Unknown()
371
+ })
372
+ ]);
373
+ function Ok(payload) {
374
+ return {
375
+ ok: true,
376
+ payload
377
+ };
378
+ }
379
+ function Err(error) {
380
+ return {
381
+ ok: false,
382
+ payload: error
383
+ };
384
+ }
385
+
386
+ // router/streams.ts
387
+ var ReadableBrokenError = {
388
+ code: "READABLE_BROKEN",
389
+ message: "Readable was broken before it is fully consumed"
390
+ };
391
+ function createPromiseWithResolvers() {
392
+ let resolve;
393
+ let reject;
394
+ const promise = new Promise((res, rej) => {
395
+ resolve = res;
396
+ reject = rej;
397
+ });
398
+ return {
399
+ promise,
400
+ // @ts-expect-error promise callbacks are sync
401
+ resolve,
402
+ // @ts-expect-error promise callbacks are sync
403
+ reject
404
+ };
405
+ }
406
+ var ReadableImpl = class {
407
+ /**
408
+ * Whether the {@link Readable} is closed.
409
+ *
410
+ * Closed {@link Readable}s are done receiving values, but that doesn't affect
411
+ * any other aspect of the {@link Readable} such as it's consumability.
412
+ */
413
+ closed = false;
414
+ /**
415
+ * Whether the {@link Readable} is locked.
416
+ *
417
+ * @see {@link Readable}'s typedoc to understand locking
418
+ */
419
+ locked = false;
420
+ /**
421
+ * Whether {@link break} was called.
422
+ *
423
+ * @see {@link break} for more information
424
+ */
425
+ broken = false;
426
+ /**
427
+ * This flag allows us to avoid emitting a {@link ReadableBrokenError} after {@link break} was called
428
+ * in cases where the {@link queue} is fully consumed and {@link ReadableImpl} is {@link closed}. This is just an
429
+ * ergonomic feature to avoid emitting an error in our iteration when we don't have to.
430
+ */
431
+ brokenWithValuesLeftToRead = false;
432
+ /**
433
+ * A list of values that have been pushed to the {@link ReadableImpl} but not yet emitted to the user.
434
+ */
435
+ queue = [];
436
+ /**
437
+ * Used by methods in the class to signal to the iterator that it
438
+ * should check for the next value.
439
+ */
440
+ next = null;
441
+ /**
442
+ * Consumes the {@link Readable} and returns an {@link AsyncIterator} that can be used
443
+ * to iterate over the values in the {@link Readable}.
444
+ */
445
+ [Symbol.asyncIterator]() {
446
+ if (this.locked) {
447
+ throw new TypeError("Readable is already locked");
448
+ }
449
+ this.locked = true;
450
+ let didSignalBreak = false;
451
+ return {
452
+ next: async () => {
453
+ if (didSignalBreak) {
454
+ return {
455
+ done: true,
456
+ value: void 0
457
+ };
458
+ }
459
+ while (this.queue.length === 0) {
460
+ if (this.closed && !this.brokenWithValuesLeftToRead) {
461
+ return {
462
+ done: true,
463
+ value: void 0
464
+ };
465
+ }
466
+ if (this.broken) {
467
+ didSignalBreak = true;
468
+ return {
469
+ done: false,
470
+ value: Err(ReadableBrokenError)
471
+ };
472
+ }
473
+ if (!this.next) {
474
+ this.next = createPromiseWithResolvers();
475
+ }
476
+ await this.next.promise;
477
+ this.next = null;
478
+ }
479
+ const value = this.queue.shift();
480
+ return { done: false, value };
481
+ },
482
+ return: async () => {
483
+ this.break();
484
+ return { done: true, value: void 0 };
485
+ }
486
+ };
487
+ }
488
+ /**
489
+ * Collects all the values from the {@link Readable} into an array.
490
+ *
491
+ * @see {@link Readable}'s typedoc for more information
492
+ */
493
+ async collect() {
494
+ const array = [];
495
+ for await (const value of this) {
496
+ array.push(value);
497
+ }
498
+ return array;
499
+ }
500
+ /**
501
+ * Breaks the {@link Readable} and signals an error to any iterators waiting for the next value.
502
+ *
503
+ * @see {@link Readable}'s typedoc for more information
504
+ */
505
+ break() {
506
+ if (this.broken) {
507
+ return;
508
+ }
509
+ this.locked = true;
510
+ this.broken = true;
511
+ this.brokenWithValuesLeftToRead = this.queue.length > 0;
512
+ this.queue.length = 0;
513
+ this.next?.resolve();
514
+ }
515
+ /**
516
+ * Whether the {@link Readable} is readable.
517
+ *
518
+ * @see {@link Readable}'s typedoc for more information
519
+ */
520
+ isReadable() {
521
+ return !this.locked && !this.broken;
522
+ }
523
+ /**
524
+ * Pushes a value to be read.
525
+ */
526
+ _pushValue(value) {
527
+ if (this.broken) {
528
+ return;
529
+ }
530
+ if (this.closed) {
531
+ throw new Error("Cannot push to closed Readable");
532
+ }
533
+ this.queue.push(value);
534
+ this.next?.resolve();
535
+ }
536
+ /**
537
+ * Triggers the close of the {@link Readable}. Make sure to push all remaining
538
+ * values before calling this method.
539
+ */
540
+ _triggerClose() {
541
+ if (this.closed) {
542
+ throw new Error("Unexpected closing multiple times");
543
+ }
544
+ this.closed = true;
545
+ this.next?.resolve();
546
+ }
547
+ /**
548
+ * @internal meant for use within river, not exposed as a public API
549
+ */
550
+ _hasValuesInQueue() {
551
+ return this.queue.length > 0;
552
+ }
553
+ /**
554
+ * Whether the {@link Readable} is closed.
555
+ */
556
+ isClosed() {
557
+ return this.closed;
558
+ }
559
+ };
560
+ var WritableImpl = class {
561
+ /**
562
+ * Passed via constructor to pass on calls to {@link write}
563
+ */
564
+ writeCb;
565
+ /**
566
+ * Passed via constructor to pass on calls to {@link close}
567
+ */
568
+ closeCb;
569
+ /**
570
+ * Whether {@link close} was called, and {@link Writable} is not writable anymore.
571
+ */
572
+ closed = false;
573
+ constructor(callbacks) {
574
+ this.writeCb = callbacks.writeCb;
575
+ this.closeCb = callbacks.closeCb;
576
+ }
577
+ write(value) {
578
+ if (this.closed) {
579
+ throw new Error("Cannot write to closed Writable");
580
+ }
581
+ this.writeCb(value);
582
+ }
583
+ isWritable() {
584
+ return !this.closed;
585
+ }
586
+ close() {
587
+ if (this.closed) {
588
+ return;
589
+ }
590
+ this.closed = true;
591
+ this.writeCb = () => void 0;
592
+ this.closeCb();
593
+ this.closeCb = () => void 0;
594
+ }
595
+ /**
596
+ * @internal meant for use within river, not exposed as a public API
597
+ */
598
+ isClosed() {
599
+ return this.closed;
600
+ }
601
+ };
602
+
603
+ // router/procedures.ts
604
+ import { Type as Type4 } from "@sinclair/typebox";
359
605
  function rpc({
360
606
  requestInit,
361
607
  responseData,
362
- responseError = Type3.Never(),
608
+ responseError = Type4.Never(),
363
609
  description,
364
610
  handler
365
611
  }) {
@@ -376,7 +622,7 @@ function upload({
376
622
  requestInit,
377
623
  requestData,
378
624
  responseData,
379
- responseError = Type3.Never(),
625
+ responseError = Type4.Never(),
380
626
  description,
381
627
  handler
382
628
  }) {
@@ -393,7 +639,7 @@ function upload({
393
639
  function subscription({
394
640
  requestInit,
395
641
  responseData,
396
- responseError = Type3.Never(),
642
+ responseError = Type4.Never(),
397
643
  description,
398
644
  handler
399
645
  }) {
@@ -410,7 +656,7 @@ function stream({
410
656
  requestInit,
411
657
  requestData,
412
658
  responseData,
413
- responseError = Type3.Never(),
659
+ responseError = Type4.Never(),
414
660
  description,
415
661
  handler
416
662
  }) {
@@ -432,7 +678,7 @@ var Procedure = {
432
678
  };
433
679
 
434
680
  // transport/message.ts
435
- import { Type as Type4 } from "@sinclair/typebox";
681
+ import { Type as Type5 } from "@sinclair/typebox";
436
682
 
437
683
  // transport/id.ts
438
684
  import { customAlphabet } from "nanoid";
@@ -442,95 +688,95 @@ var alphabet = customAlphabet(
442
688
  var generateId = () => alphabet(12);
443
689
 
444
690
  // transport/message.ts
445
- var TransportMessageSchema = (t) => Type4.Object({
446
- id: Type4.String(),
447
- from: Type4.String(),
448
- to: Type4.String(),
449
- seq: Type4.Integer(),
450
- ack: Type4.Integer(),
451
- serviceName: Type4.Optional(Type4.String()),
452
- procedureName: Type4.Optional(Type4.String()),
453
- streamId: Type4.String(),
454
- controlFlags: Type4.Integer(),
455
- tracing: Type4.Optional(
456
- Type4.Object({
457
- traceparent: Type4.String(),
458
- tracestate: Type4.String()
691
+ var TransportMessageSchema = (t) => Type5.Object({
692
+ id: Type5.String(),
693
+ from: Type5.String(),
694
+ to: Type5.String(),
695
+ seq: Type5.Integer(),
696
+ ack: Type5.Integer(),
697
+ serviceName: Type5.Optional(Type5.String()),
698
+ procedureName: Type5.Optional(Type5.String()),
699
+ streamId: Type5.String(),
700
+ controlFlags: Type5.Integer(),
701
+ tracing: Type5.Optional(
702
+ Type5.Object({
703
+ traceparent: Type5.String(),
704
+ tracestate: Type5.String()
459
705
  })
460
706
  ),
461
707
  payload: t
462
708
  });
463
- var ControlMessageAckSchema = Type4.Object({
464
- type: Type4.Literal("ACK")
709
+ var ControlMessageAckSchema = Type5.Object({
710
+ type: Type5.Literal("ACK")
465
711
  });
466
- var ControlMessageCloseSchema = Type4.Object({
467
- type: Type4.Literal("CLOSE")
712
+ var ControlMessageCloseSchema = Type5.Object({
713
+ type: Type5.Literal("CLOSE")
468
714
  });
469
715
  var currentProtocolVersion = "v2.0";
470
716
  var acceptedProtocolVersions = ["v1.1", currentProtocolVersion];
471
717
  function isAcceptedProtocolVersion(version2) {
472
718
  return acceptedProtocolVersions.includes(version2);
473
719
  }
474
- var ControlMessageHandshakeRequestSchema = Type4.Object({
475
- type: Type4.Literal("HANDSHAKE_REQ"),
476
- protocolVersion: Type4.String(),
477
- sessionId: Type4.String(),
720
+ var ControlMessageHandshakeRequestSchema = Type5.Object({
721
+ type: Type5.Literal("HANDSHAKE_REQ"),
722
+ protocolVersion: Type5.String(),
723
+ sessionId: Type5.String(),
478
724
  /**
479
725
  * Specifies what the server's expected session state (from the pov of the client). This can be
480
726
  * used by the server to know whether this is a new or a reestablished connection, and whether it
481
727
  * is compatible with what it already has.
482
728
  */
483
- expectedSessionState: Type4.Object({
729
+ expectedSessionState: Type5.Object({
484
730
  // what the client expects the server to send next
485
- nextExpectedSeq: Type4.Integer(),
486
- nextSentSeq: Type4.Integer()
731
+ nextExpectedSeq: Type5.Integer(),
732
+ nextSentSeq: Type5.Integer()
487
733
  }),
488
- metadata: Type4.Optional(Type4.Unknown())
734
+ metadata: Type5.Optional(Type5.Unknown())
489
735
  });
490
- var HandshakeErrorRetriableResponseCodes = Type4.Union([
491
- Type4.Literal("SESSION_STATE_MISMATCH")
736
+ var HandshakeErrorRetriableResponseCodes = Type5.Union([
737
+ Type5.Literal("SESSION_STATE_MISMATCH")
492
738
  ]);
493
- var HandshakeErrorCustomHandlerFatalResponseCodes = Type4.Union([
739
+ var HandshakeErrorCustomHandlerFatalResponseCodes = Type5.Union([
494
740
  // The custom validation handler rejected the handler because the client is unsupported.
495
- Type4.Literal("REJECTED_UNSUPPORTED_CLIENT"),
741
+ Type5.Literal("REJECTED_UNSUPPORTED_CLIENT"),
496
742
  // The custom validation handler rejected the handshake.
497
- Type4.Literal("REJECTED_BY_CUSTOM_HANDLER")
743
+ Type5.Literal("REJECTED_BY_CUSTOM_HANDLER")
498
744
  ]);
499
- var HandshakeErrorFatalResponseCodes = Type4.Union([
745
+ var HandshakeErrorFatalResponseCodes = Type5.Union([
500
746
  HandshakeErrorCustomHandlerFatalResponseCodes,
501
747
  // The ciient sent a handshake that doesn't comply with the extended handshake metadata.
502
- Type4.Literal("MALFORMED_HANDSHAKE_META"),
748
+ Type5.Literal("MALFORMED_HANDSHAKE_META"),
503
749
  // The ciient sent a handshake that doesn't comply with ControlMessageHandshakeRequestSchema.
504
- Type4.Literal("MALFORMED_HANDSHAKE"),
750
+ Type5.Literal("MALFORMED_HANDSHAKE"),
505
751
  // The client's protocol version does not match the server's.
506
- Type4.Literal("PROTOCOL_VERSION_MISMATCH")
752
+ Type5.Literal("PROTOCOL_VERSION_MISMATCH")
507
753
  ]);
508
- var HandshakeErrorResponseCodes = Type4.Union([
754
+ var HandshakeErrorResponseCodes = Type5.Union([
509
755
  HandshakeErrorRetriableResponseCodes,
510
756
  HandshakeErrorFatalResponseCodes
511
757
  ]);
512
- var ControlMessageHandshakeResponseSchema = Type4.Object({
513
- type: Type4.Literal("HANDSHAKE_RESP"),
514
- status: Type4.Union([
515
- Type4.Object({
516
- ok: Type4.Literal(true),
517
- sessionId: Type4.String()
758
+ var ControlMessageHandshakeResponseSchema = Type5.Object({
759
+ type: Type5.Literal("HANDSHAKE_RESP"),
760
+ status: Type5.Union([
761
+ Type5.Object({
762
+ ok: Type5.Literal(true),
763
+ sessionId: Type5.String()
518
764
  }),
519
- Type4.Object({
520
- ok: Type4.Literal(false),
521
- reason: Type4.String(),
765
+ Type5.Object({
766
+ ok: Type5.Literal(false),
767
+ reason: Type5.String(),
522
768
  code: HandshakeErrorResponseCodes
523
769
  })
524
770
  ])
525
771
  });
526
- var ControlMessagePayloadSchema = Type4.Union([
772
+ var ControlMessagePayloadSchema = Type5.Union([
527
773
  ControlMessageCloseSchema,
528
774
  ControlMessageAckSchema,
529
775
  ControlMessageHandshakeRequestSchema,
530
776
  ControlMessageHandshakeResponseSchema
531
777
  ]);
532
778
  var OpaqueTransportMessageSchema = TransportMessageSchema(
533
- Type4.Unknown()
779
+ Type5.Unknown()
534
780
  );
535
781
  function handshakeRequestMessage({
536
782
  from,
@@ -615,35 +861,6 @@ function isStreamCancel(controlFlag) {
615
861
  );
616
862
  }
617
863
 
618
- // router/result.ts
619
- import { Type as Type5 } from "@sinclair/typebox";
620
- var AnyResultSchema = Type5.Union([
621
- Type5.Object({
622
- ok: Type5.Literal(false),
623
- payload: Type5.Object({
624
- code: Type5.String(),
625
- message: Type5.String(),
626
- extras: Type5.Optional(Type5.Unknown())
627
- })
628
- }),
629
- Type5.Object({
630
- ok: Type5.Literal(true),
631
- payload: Type5.Unknown()
632
- })
633
- ]);
634
- function Ok(payload) {
635
- return {
636
- ok: true,
637
- payload
638
- };
639
- }
640
- function Err(error) {
641
- return {
642
- ok: false,
643
- payload: error
644
- };
645
- }
646
-
647
864
  // tracing/index.ts
648
865
  import {
649
866
  SpanKind,
@@ -761,208 +978,6 @@ function getTracer() {
761
978
  return trace.getTracer("river", version);
762
979
  }
763
980
 
764
- // router/streams.ts
765
- var ReadableBrokenError = {
766
- code: "READABLE_BROKEN",
767
- message: "Readable was broken before it is fully consumed"
768
- };
769
- function createPromiseWithResolvers() {
770
- let resolve;
771
- let reject;
772
- const promise = new Promise((res, rej) => {
773
- resolve = res;
774
- reject = rej;
775
- });
776
- return {
777
- promise,
778
- // @ts-expect-error promise callbacks are sync
779
- resolve,
780
- // @ts-expect-error promise callbacks are sync
781
- reject
782
- };
783
- }
784
- var ReadableImpl = class {
785
- /**
786
- * Whether the {@link Readable} is closed.
787
- *
788
- * Closed {@link Readable}s are done receiving values, but that doesn't affect
789
- * any other aspect of the {@link Readable} such as it's consumability.
790
- */
791
- closed = false;
792
- /**
793
- * Whether the {@link Readable} is locked.
794
- *
795
- * @see {@link Readable}'s typedoc to understand locking
796
- */
797
- locked = false;
798
- /**
799
- * Whether {@link break} was called.
800
- *
801
- * @see {@link break} for more information
802
- */
803
- broken = false;
804
- /**
805
- * This flag allows us to avoid emitting a {@link ReadableBrokenError} after {@link break} was called
806
- * in cases where the {@link queue} is fully consumed and {@link ReadableImpl} is {@link closed}. This is just an
807
- * ergonomic feature to avoid emitting an error in our iteration when we don't have to.
808
- */
809
- brokenWithValuesLeftToRead = false;
810
- /**
811
- * A list of values that have been pushed to the {@link ReadableImpl} but not yet emitted to the user.
812
- */
813
- queue = [];
814
- /**
815
- * Used by methods in the class to signal to the iterator that it
816
- * should check for the next value.
817
- */
818
- next = null;
819
- [Symbol.asyncIterator]() {
820
- if (this.locked) {
821
- throw new TypeError("Readable is already locked");
822
- }
823
- this.locked = true;
824
- let didSignalBreak = false;
825
- return {
826
- next: async () => {
827
- if (didSignalBreak) {
828
- return {
829
- done: true,
830
- value: void 0
831
- };
832
- }
833
- while (this.queue.length === 0) {
834
- if (this.closed && !this.brokenWithValuesLeftToRead) {
835
- return {
836
- done: true,
837
- value: void 0
838
- };
839
- }
840
- if (this.broken) {
841
- didSignalBreak = true;
842
- return {
843
- done: false,
844
- value: Err(ReadableBrokenError)
845
- };
846
- }
847
- if (!this.next) {
848
- this.next = createPromiseWithResolvers();
849
- }
850
- await this.next.promise;
851
- this.next = null;
852
- }
853
- const value = this.queue.shift();
854
- return { done: false, value };
855
- },
856
- return: () => {
857
- this.break();
858
- return { done: true, value: void 0 };
859
- }
860
- };
861
- }
862
- async collect() {
863
- const array = [];
864
- for await (const value of this) {
865
- array.push(value);
866
- }
867
- return array;
868
- }
869
- break() {
870
- if (this.broken) {
871
- return;
872
- }
873
- this.locked = true;
874
- this.broken = true;
875
- this.brokenWithValuesLeftToRead = this.queue.length > 0;
876
- this.queue.length = 0;
877
- this.next?.resolve();
878
- }
879
- isReadable() {
880
- return !this.locked && !this.broken;
881
- }
882
- /**
883
- * @internal meant for use within river, not exposed as a public API
884
- *
885
- * Pushes a value to be read.
886
- */
887
- _pushValue(value) {
888
- if (this.broken) {
889
- return;
890
- }
891
- if (this.closed) {
892
- throw new Error("Cannot push to closed Readable");
893
- }
894
- this.queue.push(value);
895
- this.next?.resolve();
896
- }
897
- /**
898
- * @internal meant for use within river, not exposed as a public API
899
- *
900
- * Triggers the close of the {@link Readable}. Make sure to push all remaining
901
- * values before calling this method.
902
- */
903
- _triggerClose() {
904
- if (this.closed) {
905
- throw new Error("Unexpected closing multiple times");
906
- }
907
- this.closed = true;
908
- this.next?.resolve();
909
- }
910
- /**
911
- * @internal meant for use within river, not exposed as a public API
912
- */
913
- _hasValuesInQueue() {
914
- return this.queue.length > 0;
915
- }
916
- /**
917
- * @internal meant for use within river, not exposed as a public API
918
- */
919
- isClosed() {
920
- return this.closed;
921
- }
922
- };
923
- var WritableImpl = class {
924
- /**
925
- * Passed via constructor to pass on calls to {@link write}
926
- */
927
- writeCb;
928
- /**
929
- * Passed via constructor to pass on calls to {@link close}
930
- */
931
- closeCb;
932
- /**
933
- * Whether {@link close} was called, and {@link Writable} is not writable anymore.
934
- */
935
- closed = false;
936
- constructor(callbacks) {
937
- this.writeCb = callbacks.writeCb;
938
- this.closeCb = callbacks.closeCb;
939
- }
940
- write(value) {
941
- if (this.closed) {
942
- throw new Error("Cannot write to closed Writable");
943
- }
944
- this.writeCb(value);
945
- }
946
- isWritable() {
947
- return !this.closed;
948
- }
949
- close() {
950
- if (this.closed) {
951
- return;
952
- }
953
- this.closed = true;
954
- this.writeCb = () => void 0;
955
- this.closeCb();
956
- this.closeCb = () => void 0;
957
- }
958
- /**
959
- * @internal meant for use within river, not exposed as a public API
960
- */
961
- isClosed() {
962
- return this.closed;
963
- }
964
- };
965
-
966
981
  // router/client.ts
967
982
  import { Value } from "@sinclair/typebox/value";
968
983
  var noop = () => {
@@ -1979,7 +1994,7 @@ function createServerHandshakeOptions(schema, validate) {
1979
1994
  }
1980
1995
 
1981
1996
  // package.json
1982
- var version = "0.209.1";
1997
+ var version = "0.209.3";
1983
1998
 
1984
1999
  export {
1985
2000
  generateId,
@@ -2004,9 +2019,11 @@ export {
2004
2019
  serializeSchemaV1Compat,
2005
2020
  serializeSchema,
2006
2021
  createServiceSchema,
2007
- Procedure,
2008
2022
  Ok,
2009
2023
  Err,
2024
+ ReadableBrokenError,
2025
+ ReadableImpl,
2026
+ Procedure,
2010
2027
  createClient,
2011
2028
  coerceErrorString,
2012
2029
  createServer,
@@ -2018,4 +2035,4 @@ export {
2018
2035
  createConnectionTelemetryInfo,
2019
2036
  getTracer
2020
2037
  };
2021
- //# sourceMappingURL=chunk-2AV3IIW5.js.map
2038
+ //# sourceMappingURL=chunk-EHTVQM2C.js.map