@replit/river 0.26.9 → 0.26.11
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/README.md +1 -1
- package/dist/{chunk-6LX3MQEH.js → chunk-4DEPQJLU.js} +21 -19
- package/dist/chunk-4DEPQJLU.js.map +1 -0
- package/dist/{chunk-OPWZHQ7Z.js → chunk-ACAIVD7K.js} +3 -3
- package/dist/{chunk-YHILUN2S.js → chunk-BWFKJB6J.js} +4 -4
- package/dist/{chunk-SKWHS7YK.js → chunk-DKUZRRKE.js} +4 -4
- package/dist/{chunk-JVPSOBWJ.js → chunk-WXH5YYLA.js} +2 -2
- package/dist/{chunk-LODVVI6A.js → chunk-Z4Z7BX4W.js} +2 -2
- package/dist/{chunk-VPXUTLMK.js → chunk-ZWU5OYTF.js} +2 -2
- package/dist/chunk-ZWU5OYTF.js.map +1 -0
- package/dist/router/index.cjs +68 -66
- package/dist/router/index.cjs.map +1 -1
- package/dist/router/index.d.cts +1 -1
- package/dist/router/index.d.ts +1 -1
- package/dist/router/index.js +2 -2
- 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.js +5 -5
- 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.js +5 -5
- package/dist/transport/index.cjs +1 -1
- package/dist/transport/index.cjs.map +1 -1
- package/dist/transport/index.js +5 -5
- package/dist/util/testHelpers.cjs +1 -1
- package/dist/util/testHelpers.cjs.map +1 -1
- package/dist/util/testHelpers.d.cts +6 -2
- package/dist/util/testHelpers.d.ts +6 -2
- package/dist/util/testHelpers.js +3 -3
- package/package.json +3 -3
- package/dist/chunk-6LX3MQEH.js.map +0 -1
- package/dist/chunk-VPXUTLMK.js.map +0 -1
- /package/dist/{chunk-OPWZHQ7Z.js.map → chunk-ACAIVD7K.js.map} +0 -0
- /package/dist/{chunk-YHILUN2S.js.map → chunk-BWFKJB6J.js.map} +0 -0
- /package/dist/{chunk-SKWHS7YK.js.map → chunk-DKUZRRKE.js.map} +0 -0
- /package/dist/{chunk-JVPSOBWJ.js.map → chunk-WXH5YYLA.js.map} +0 -0
- /package/dist/{chunk-LODVVI6A.js.map → chunk-Z4Z7BX4W.js.map} +0 -0
package/dist/router/index.cjs
CHANGED
|
@@ -36,7 +36,9 @@ __export(router_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(router_exports);
|
|
37
37
|
|
|
38
38
|
// router/services.ts
|
|
39
|
-
|
|
39
|
+
function Strict(schema) {
|
|
40
|
+
return JSON.parse(JSON.stringify(schema));
|
|
41
|
+
}
|
|
40
42
|
function serializeSchema(services, handshakeSchema) {
|
|
41
43
|
const serializedServiceObject = Object.entries(services).reduce((acc, [name, value]) => {
|
|
42
44
|
acc[name] = value.serialize();
|
|
@@ -46,7 +48,7 @@ function serializeSchema(services, handshakeSchema) {
|
|
|
46
48
|
services: serializedServiceObject
|
|
47
49
|
};
|
|
48
50
|
if (handshakeSchema) {
|
|
49
|
-
schema.handshakeSchema =
|
|
51
|
+
schema.handshakeSchema = Strict(handshakeSchema);
|
|
50
52
|
}
|
|
51
53
|
return schema;
|
|
52
54
|
}
|
|
@@ -149,18 +151,18 @@ var ServiceSchema = class _ServiceSchema {
|
|
|
149
151
|
Object.entries(this.procedures).map(([procName, procDef]) => [
|
|
150
152
|
procName,
|
|
151
153
|
{
|
|
152
|
-
input:
|
|
153
|
-
output:
|
|
154
|
+
input: Strict(procDef.input),
|
|
155
|
+
output: Strict(procDef.output),
|
|
154
156
|
// Only add `description` field if the type declares it.
|
|
155
157
|
..."description" in procDef ? { description: procDef.description } : {},
|
|
156
158
|
// Only add the `errors` field if the type declares it.
|
|
157
159
|
..."errors" in procDef ? {
|
|
158
|
-
errors:
|
|
160
|
+
errors: Strict(procDef.errors)
|
|
159
161
|
} : {},
|
|
160
162
|
type: procDef.type,
|
|
161
163
|
// Only add the `init` field if the type declares it.
|
|
162
164
|
..."init" in procDef ? {
|
|
163
|
-
init:
|
|
165
|
+
init: Strict(procDef.init)
|
|
164
166
|
} : {}
|
|
165
167
|
}
|
|
166
168
|
])
|
|
@@ -238,11 +240,11 @@ var ServiceScaffold = class {
|
|
|
238
240
|
};
|
|
239
241
|
|
|
240
242
|
// router/procedures.ts
|
|
241
|
-
var
|
|
243
|
+
var import_typebox = require("@sinclair/typebox");
|
|
242
244
|
function rpc({
|
|
243
245
|
input,
|
|
244
246
|
output,
|
|
245
|
-
errors =
|
|
247
|
+
errors = import_typebox.Type.Never(),
|
|
246
248
|
description,
|
|
247
249
|
handler
|
|
248
250
|
}) {
|
|
@@ -259,7 +261,7 @@ function upload({
|
|
|
259
261
|
init,
|
|
260
262
|
input,
|
|
261
263
|
output,
|
|
262
|
-
errors =
|
|
264
|
+
errors = import_typebox.Type.Never(),
|
|
263
265
|
description,
|
|
264
266
|
handler
|
|
265
267
|
}) {
|
|
@@ -283,7 +285,7 @@ function upload({
|
|
|
283
285
|
function subscription({
|
|
284
286
|
input,
|
|
285
287
|
output,
|
|
286
|
-
errors =
|
|
288
|
+
errors = import_typebox.Type.Never(),
|
|
287
289
|
description,
|
|
288
290
|
handler
|
|
289
291
|
}) {
|
|
@@ -300,7 +302,7 @@ function stream({
|
|
|
300
302
|
init,
|
|
301
303
|
input,
|
|
302
304
|
output,
|
|
303
|
-
errors =
|
|
305
|
+
errors = import_typebox.Type.Never(),
|
|
304
306
|
description,
|
|
305
307
|
handler
|
|
306
308
|
}) {
|
|
@@ -611,7 +613,7 @@ function _pushable(getNext, options) {
|
|
|
611
613
|
}
|
|
612
614
|
|
|
613
615
|
// transport/message.ts
|
|
614
|
-
var
|
|
616
|
+
var import_typebox2 = require("@sinclair/typebox");
|
|
615
617
|
|
|
616
618
|
// transport/id.ts
|
|
617
619
|
var import_nanoid = require("nanoid");
|
|
@@ -621,90 +623,90 @@ var alphabet = (0, import_nanoid.customAlphabet)(
|
|
|
621
623
|
var generateId = () => alphabet(12);
|
|
622
624
|
|
|
623
625
|
// transport/message.ts
|
|
624
|
-
var TransportMessageSchema = (t) =>
|
|
625
|
-
id:
|
|
626
|
-
from:
|
|
627
|
-
to:
|
|
628
|
-
seq:
|
|
629
|
-
ack:
|
|
630
|
-
serviceName:
|
|
631
|
-
procedureName:
|
|
632
|
-
streamId:
|
|
633
|
-
controlFlags:
|
|
634
|
-
tracing:
|
|
635
|
-
|
|
636
|
-
traceparent:
|
|
637
|
-
tracestate:
|
|
626
|
+
var TransportMessageSchema = (t) => import_typebox2.Type.Object({
|
|
627
|
+
id: import_typebox2.Type.String(),
|
|
628
|
+
from: import_typebox2.Type.String(),
|
|
629
|
+
to: import_typebox2.Type.String(),
|
|
630
|
+
seq: import_typebox2.Type.Integer(),
|
|
631
|
+
ack: import_typebox2.Type.Integer(),
|
|
632
|
+
serviceName: import_typebox2.Type.Optional(import_typebox2.Type.String()),
|
|
633
|
+
procedureName: import_typebox2.Type.Optional(import_typebox2.Type.String()),
|
|
634
|
+
streamId: import_typebox2.Type.String(),
|
|
635
|
+
controlFlags: import_typebox2.Type.Integer(),
|
|
636
|
+
tracing: import_typebox2.Type.Optional(
|
|
637
|
+
import_typebox2.Type.Object({
|
|
638
|
+
traceparent: import_typebox2.Type.String(),
|
|
639
|
+
tracestate: import_typebox2.Type.String()
|
|
638
640
|
})
|
|
639
641
|
),
|
|
640
642
|
payload: t
|
|
641
643
|
});
|
|
642
|
-
var ControlMessageAckSchema =
|
|
643
|
-
type:
|
|
644
|
+
var ControlMessageAckSchema = import_typebox2.Type.Object({
|
|
645
|
+
type: import_typebox2.Type.Literal("ACK")
|
|
644
646
|
});
|
|
645
|
-
var ControlMessageCloseSchema =
|
|
646
|
-
type:
|
|
647
|
+
var ControlMessageCloseSchema = import_typebox2.Type.Object({
|
|
648
|
+
type: import_typebox2.Type.Literal("CLOSE")
|
|
647
649
|
});
|
|
648
|
-
var ControlMessageHandshakeRequestSchema =
|
|
649
|
-
type:
|
|
650
|
-
protocolVersion:
|
|
651
|
-
sessionId:
|
|
650
|
+
var ControlMessageHandshakeRequestSchema = import_typebox2.Type.Object({
|
|
651
|
+
type: import_typebox2.Type.Literal("HANDSHAKE_REQ"),
|
|
652
|
+
protocolVersion: import_typebox2.Type.String(),
|
|
653
|
+
sessionId: import_typebox2.Type.String(),
|
|
652
654
|
/**
|
|
653
655
|
* Specifies what the server's expected session state (from the pov of the client). This can be
|
|
654
656
|
* used by the server to know whether this is a new or a reestablished connection, and whether it
|
|
655
657
|
* is compatible with what it already has.
|
|
656
658
|
*/
|
|
657
|
-
expectedSessionState:
|
|
659
|
+
expectedSessionState: import_typebox2.Type.Object({
|
|
658
660
|
// what the client expects the server to send next
|
|
659
|
-
nextExpectedSeq:
|
|
660
|
-
nextSentSeq:
|
|
661
|
+
nextExpectedSeq: import_typebox2.Type.Integer(),
|
|
662
|
+
nextSentSeq: import_typebox2.Type.Integer()
|
|
661
663
|
}),
|
|
662
|
-
metadata:
|
|
664
|
+
metadata: import_typebox2.Type.Optional(import_typebox2.Type.Unknown())
|
|
663
665
|
});
|
|
664
|
-
var HandshakeErrorRetriableResponseCodes =
|
|
665
|
-
|
|
666
|
+
var HandshakeErrorRetriableResponseCodes = import_typebox2.Type.Union([
|
|
667
|
+
import_typebox2.Type.Literal("SESSION_STATE_MISMATCH")
|
|
666
668
|
]);
|
|
667
|
-
var HandshakeErrorCustomHandlerFatalResponseCodes =
|
|
669
|
+
var HandshakeErrorCustomHandlerFatalResponseCodes = import_typebox2.Type.Union([
|
|
668
670
|
// The custom validation handler rejected the handler because the client is unsupported.
|
|
669
|
-
|
|
671
|
+
import_typebox2.Type.Literal("REJECTED_UNSUPPORTED_CLIENT"),
|
|
670
672
|
// The custom validation handler rejected the handshake.
|
|
671
|
-
|
|
673
|
+
import_typebox2.Type.Literal("REJECTED_BY_CUSTOM_HANDLER")
|
|
672
674
|
]);
|
|
673
|
-
var HandshakeErrorFatalResponseCodes =
|
|
675
|
+
var HandshakeErrorFatalResponseCodes = import_typebox2.Type.Union([
|
|
674
676
|
HandshakeErrorCustomHandlerFatalResponseCodes,
|
|
675
677
|
// The ciient sent a handshake that doesn't comply with the extended handshake metadata.
|
|
676
|
-
|
|
678
|
+
import_typebox2.Type.Literal("MALFORMED_HANDSHAKE_META"),
|
|
677
679
|
// The ciient sent a handshake that doesn't comply with ControlMessageHandshakeRequestSchema.
|
|
678
|
-
|
|
680
|
+
import_typebox2.Type.Literal("MALFORMED_HANDSHAKE"),
|
|
679
681
|
// The client's protocol version does not match the server's.
|
|
680
|
-
|
|
682
|
+
import_typebox2.Type.Literal("PROTOCOL_VERSION_MISMATCH")
|
|
681
683
|
]);
|
|
682
|
-
var HandshakeErrorResponseCodes =
|
|
684
|
+
var HandshakeErrorResponseCodes = import_typebox2.Type.Union([
|
|
683
685
|
HandshakeErrorRetriableResponseCodes,
|
|
684
686
|
HandshakeErrorFatalResponseCodes
|
|
685
687
|
]);
|
|
686
|
-
var ControlMessageHandshakeResponseSchema =
|
|
687
|
-
type:
|
|
688
|
-
status:
|
|
689
|
-
|
|
690
|
-
ok:
|
|
691
|
-
sessionId:
|
|
688
|
+
var ControlMessageHandshakeResponseSchema = import_typebox2.Type.Object({
|
|
689
|
+
type: import_typebox2.Type.Literal("HANDSHAKE_RESP"),
|
|
690
|
+
status: import_typebox2.Type.Union([
|
|
691
|
+
import_typebox2.Type.Object({
|
|
692
|
+
ok: import_typebox2.Type.Literal(true),
|
|
693
|
+
sessionId: import_typebox2.Type.String()
|
|
692
694
|
}),
|
|
693
|
-
|
|
694
|
-
ok:
|
|
695
|
-
reason:
|
|
695
|
+
import_typebox2.Type.Object({
|
|
696
|
+
ok: import_typebox2.Type.Literal(false),
|
|
697
|
+
reason: import_typebox2.Type.String(),
|
|
696
698
|
code: HandshakeErrorResponseCodes
|
|
697
699
|
})
|
|
698
700
|
])
|
|
699
701
|
});
|
|
700
|
-
var ControlMessagePayloadSchema =
|
|
702
|
+
var ControlMessagePayloadSchema = import_typebox2.Type.Union([
|
|
701
703
|
ControlMessageCloseSchema,
|
|
702
704
|
ControlMessageAckSchema,
|
|
703
705
|
ControlMessageHandshakeRequestSchema,
|
|
704
706
|
ControlMessageHandshakeResponseSchema
|
|
705
707
|
]);
|
|
706
708
|
var OpaqueTransportMessageSchema = TransportMessageSchema(
|
|
707
|
-
|
|
709
|
+
import_typebox2.Type.Unknown()
|
|
708
710
|
);
|
|
709
711
|
function closeStreamMessage(streamId) {
|
|
710
712
|
return {
|
|
@@ -729,15 +731,15 @@ function isStreamClose(controlFlag) {
|
|
|
729
731
|
}
|
|
730
732
|
|
|
731
733
|
// router/result.ts
|
|
732
|
-
var
|
|
734
|
+
var import_typebox3 = require("@sinclair/typebox");
|
|
733
735
|
var UNCAUGHT_ERROR = "UNCAUGHT_ERROR";
|
|
734
736
|
var UNEXPECTED_DISCONNECT = "UNEXPECTED_DISCONNECT";
|
|
735
|
-
var RiverUncaughtSchema =
|
|
736
|
-
code:
|
|
737
|
-
|
|
738
|
-
|
|
737
|
+
var RiverUncaughtSchema = import_typebox3.Type.Object({
|
|
738
|
+
code: import_typebox3.Type.Union([
|
|
739
|
+
import_typebox3.Type.Literal(UNCAUGHT_ERROR),
|
|
740
|
+
import_typebox3.Type.Literal(UNEXPECTED_DISCONNECT)
|
|
739
741
|
]),
|
|
740
|
-
message:
|
|
742
|
+
message: import_typebox3.Type.String()
|
|
741
743
|
});
|
|
742
744
|
function Ok(payload) {
|
|
743
745
|
return {
|
|
@@ -756,7 +758,7 @@ function Err(error) {
|
|
|
756
758
|
var import_api = require("@opentelemetry/api");
|
|
757
759
|
|
|
758
760
|
// package.json
|
|
759
|
-
var version = "0.26.
|
|
761
|
+
var version = "0.26.11";
|
|
760
762
|
|
|
761
763
|
// tracing/index.ts
|
|
762
764
|
function getPropagationContext(ctx) {
|