@moqtap/codec 0.1.0 → 0.2.0
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 +99 -95
- package/dist/chunk-4RIXXEII.js +1275 -0
- package/dist/chunk-4XYGE53S.cjs +698 -0
- package/dist/chunk-4YJANAXU.cjs +1109 -0
- package/dist/chunk-6AEHWULA.cjs +641 -0
- package/dist/chunk-7DUBLRXC.js +680 -0
- package/dist/{chunk-WNTXF3DE.cjs → chunk-7IVGHMKJ.cjs} +164 -62
- package/dist/{chunk-YBSEOSSP.js → chunk-A27S7HW7.js} +5 -1
- package/dist/chunk-BISI45MN.cjs +680 -0
- package/dist/{chunk-3BSZ55L3.cjs → chunk-BPNL5YFQ.cjs} +158 -24
- package/dist/chunk-CXDHOMHG.js +1097 -0
- package/dist/chunk-DUBCL3WF.cjs +749 -0
- package/dist/chunk-DWK5ZQZ4.js +642 -0
- package/dist/chunk-E6E3NQYU.js +680 -0
- package/dist/chunk-EFM5T7OM.js +698 -0
- package/dist/chunk-ENURAVHI.cjs +680 -0
- package/dist/{chunk-5WFXFLL4.cjs → chunk-FUFTMAQD.cjs} +96 -63
- package/dist/{chunk-2NARXGVA.cjs → chunk-FWISIR26.cjs} +5 -1
- package/dist/{chunk-YPXLV5YK.js → chunk-FXZ2MYKJ.js} +376 -38
- package/dist/chunk-G26SJ6XS.cjs +1341 -0
- package/dist/chunk-G7GI7LJA.js +737 -0
- package/dist/chunk-GXEW4COZ.cjs +737 -0
- package/dist/chunk-HSVYF6XX.cjs +1361 -0
- package/dist/chunk-IBVM4DMJ.cjs +1097 -0
- package/dist/chunk-IV2H5CFI.cjs +1275 -0
- package/dist/chunk-IV2HRJVT.js +1198 -0
- package/dist/chunk-JSQM2MG3.js +680 -0
- package/dist/chunk-K4OLITS2.cjs +1055 -0
- package/dist/{chunk-UOBWHJA5.js → chunk-KFTCU2P6.js} +2 -3
- package/dist/chunk-LH4NTURO.js +1361 -0
- package/dist/{chunk-DC4L6ZIT.js → chunk-MFAP7R6L.js} +154 -20
- package/dist/chunk-NGVE2RZT.js +1097 -0
- package/dist/chunk-NUX5BHWO.js +1341 -0
- package/dist/chunk-PJRA2TQ5.js +1055 -0
- package/dist/chunk-RVJAGE4S.cjs +1198 -0
- package/dist/{chunk-QYG6KGOV.cjs → chunk-RWQ43Z4F.cjs} +2 -3
- package/dist/chunk-RZHAPEXO.js +749 -0
- package/dist/chunk-ST24APEO.js +1109 -0
- package/dist/chunk-SYHW3FLI.cjs +642 -0
- package/dist/chunk-TLYNOOQP.cjs +432 -0
- package/dist/{chunk-23YG7F46.js → chunk-TMNGRIPL.js} +153 -51
- package/dist/{chunk-IQPDRQVC.js → chunk-U2B3B42P.js} +62 -29
- package/dist/chunk-UNS34PTA.cjs +680 -0
- package/dist/chunk-UR6JKS56.js +432 -0
- package/dist/{chunk-GDRGWFEK.cjs → chunk-UYXTY6ZQ.cjs} +376 -38
- package/dist/chunk-XUUCOLWU.cjs +1097 -0
- package/dist/chunk-YG5KJESI.js +641 -0
- package/dist/chunk-ZBKE2QRQ.js +1401 -0
- package/dist/chunk-ZSPO2GF2.cjs +1401 -0
- package/dist/codec-95k8CAu5.d.cts +35 -0
- package/dist/codec-AFuOxfsO.d.ts +60 -0
- package/dist/codec-B-UJ5Iow.d.cts +75 -0
- package/dist/codec-BC5jfvMb.d.ts +35 -0
- package/dist/codec-BECYPfY8.d.ts +35 -0
- package/dist/codec-BsPU1vNC.d.ts +39 -0
- package/dist/codec-BvpuF-6u.d.cts +39 -0
- package/dist/codec-C8jZI5Cx.d.cts +39 -0
- package/dist/codec-CAevkgf5.d.cts +33 -0
- package/dist/codec-CSUqCrRs.d.ts +39 -0
- package/dist/codec-C_HMXNK_.d.ts +33 -0
- package/dist/{codec-CTvFtQQI.d.cts → codec-CpuvYTSV.d.cts} +5 -5
- package/dist/codec-D0x8-SCw.d.cts +35 -0
- package/dist/codec-D7ARhpG1.d.ts +75 -0
- package/dist/codec-DNAUGshO.d.cts +60 -0
- package/dist/codec-DPx_QNn0.d.ts +31 -0
- package/dist/{codec-qPzfmLNu.d.ts → codec-DRhCx_hw.d.ts} +5 -5
- package/dist/codec-Db7YPe3l.d.ts +31 -0
- package/dist/codec-axkJpb7D.d.cts +31 -0
- package/dist/codec-ujAbFaep.d.cts +31 -0
- package/dist/draft10-session.cjs +6 -0
- package/dist/draft10-session.d.cts +8 -0
- package/dist/draft10-session.d.ts +8 -0
- package/dist/draft10-session.js +6 -0
- package/dist/draft10.cjs +115 -0
- package/dist/draft10.d.cts +95 -0
- package/dist/draft10.d.ts +95 -0
- package/dist/draft10.js +115 -0
- package/dist/draft11-session.cjs +6 -0
- package/dist/draft11-session.d.cts +8 -0
- package/dist/draft11-session.d.ts +8 -0
- package/dist/draft11-session.js +6 -0
- package/dist/draft11.cjs +109 -0
- package/dist/draft11.d.cts +99 -0
- package/dist/draft11.d.ts +99 -0
- package/dist/draft11.js +109 -0
- package/dist/draft12-session.cjs +6 -0
- package/dist/draft12-session.d.cts +8 -0
- package/dist/draft12-session.d.ts +8 -0
- package/dist/draft12-session.js +6 -0
- package/dist/draft12.cjs +117 -0
- package/dist/draft12.d.cts +106 -0
- package/dist/draft12.d.ts +106 -0
- package/dist/draft12.js +117 -0
- package/dist/draft13-session.cjs +6 -0
- package/dist/draft13-session.d.cts +8 -0
- package/dist/draft13-session.d.ts +8 -0
- package/dist/draft13-session.js +6 -0
- package/dist/draft13.cjs +119 -0
- package/dist/draft13.d.cts +108 -0
- package/dist/draft13.d.ts +108 -0
- package/dist/draft13.js +119 -0
- package/dist/draft14-session.cjs +2 -2
- package/dist/draft14-session.d.cts +4 -4
- package/dist/draft14-session.d.ts +4 -4
- package/dist/draft14-session.js +1 -1
- package/dist/draft14.cjs +4 -4
- package/dist/draft14.d.cts +27 -15
- package/dist/draft14.d.ts +27 -15
- package/dist/draft14.js +3 -3
- package/dist/draft15-session.cjs +6 -0
- package/dist/draft15-session.d.cts +8 -0
- package/dist/draft15-session.d.ts +8 -0
- package/dist/draft15-session.js +6 -0
- package/dist/draft15.cjs +111 -0
- package/dist/draft15.d.cts +93 -0
- package/dist/draft15.d.ts +93 -0
- package/dist/draft15.js +111 -0
- package/dist/draft16-session.cjs +6 -0
- package/dist/draft16-session.d.cts +8 -0
- package/dist/draft16-session.d.ts +8 -0
- package/dist/draft16-session.js +6 -0
- package/dist/draft16.cjs +113 -0
- package/dist/draft16.d.cts +94 -0
- package/dist/draft16.d.ts +94 -0
- package/dist/draft16.js +113 -0
- package/dist/draft17-session.cjs +8 -0
- package/dist/draft17-session.d.cts +51 -0
- package/dist/draft17-session.d.ts +51 -0
- package/dist/draft17-session.js +8 -0
- package/dist/draft17.cjs +99 -0
- package/dist/draft17.d.cts +40 -0
- package/dist/draft17.d.ts +40 -0
- package/dist/draft17.js +99 -0
- package/dist/draft7-session.cjs +3 -3
- package/dist/draft7-session.d.cts +3 -3
- package/dist/draft7-session.d.ts +3 -3
- package/dist/draft7-session.js +2 -2
- package/dist/draft7.cjs +6 -6
- package/dist/draft7.d.cts +10 -10
- package/dist/draft7.d.ts +10 -10
- package/dist/draft7.js +3 -3
- package/dist/draft8-session.cjs +6 -0
- package/dist/draft8-session.d.cts +8 -0
- package/dist/draft8-session.d.ts +8 -0
- package/dist/draft8-session.js +6 -0
- package/dist/draft8.cjs +115 -0
- package/dist/draft8.d.cts +95 -0
- package/dist/draft8.d.ts +95 -0
- package/dist/draft8.js +115 -0
- package/dist/draft9-session.cjs +6 -0
- package/dist/draft9-session.d.cts +8 -0
- package/dist/draft9-session.d.ts +8 -0
- package/dist/draft9-session.js +6 -0
- package/dist/draft9.cjs +115 -0
- package/dist/draft9.d.cts +95 -0
- package/dist/draft9.d.ts +95 -0
- package/dist/draft9.js +115 -0
- package/dist/index.cjs +79 -7
- package/dist/index.d.cts +71 -8
- package/dist/index.d.ts +71 -8
- package/dist/index.js +77 -5
- package/dist/{session-types-B9NIf7_F.d.ts → session-types-CJIFbTPd.d.ts} +20 -20
- package/dist/{session-types-CCo-oA-d.d.cts → session-types-Cbq8IGCP.d.cts} +20 -20
- package/dist/session.cjs +5 -5
- package/dist/session.d.cts +3 -3
- package/dist/session.d.ts +3 -3
- package/dist/session.js +5 -5
- package/dist/types-4VxSL2Ho.d.cts +261 -0
- package/dist/types-4VxSL2Ho.d.ts +261 -0
- package/dist/types-B2afJZM-.d.cts +236 -0
- package/dist/types-B2afJZM-.d.ts +236 -0
- package/dist/{types-CIk5W10V.d.ts → types-BTFeKYCb.d.cts} +37 -37
- package/dist/{types-CIk5W10V.d.cts → types-BTFeKYCb.d.ts} +37 -37
- package/dist/types-Bg6QYNVt.d.cts +290 -0
- package/dist/types-Bg6QYNVt.d.ts +290 -0
- package/dist/types-C_1HrqBl.d.cts +306 -0
- package/dist/types-C_1HrqBl.d.ts +306 -0
- package/dist/types-Cw4WE9dh.d.cts +261 -0
- package/dist/types-Cw4WE9dh.d.ts +261 -0
- package/dist/types-D5gNQiDj.d.cts +261 -0
- package/dist/types-D5gNQiDj.d.ts +261 -0
- package/dist/types-DqCDFqgB.d.cts +230 -0
- package/dist/types-DqCDFqgB.d.ts +230 -0
- package/dist/types-ERexTpT8.d.cts +217 -0
- package/dist/types-ERexTpT8.d.ts +217 -0
- package/dist/{types-ClXELFGN.d.cts → types-QNXoxC9Y.d.cts} +36 -41
- package/dist/{types-ClXELFGN.d.ts → types-QNXoxC9Y.d.ts} +36 -41
- package/dist/types-r-CasCf1.d.cts +262 -0
- package/dist/types-r-CasCf1.d.ts +262 -0
- package/package.json +116 -8
- package/src/core/buffer-reader.ts +16 -9
- package/src/core/buffer-writer.ts +2 -2
- package/src/core/errors.ts +1 -1
- package/src/core/session-types.ts +28 -41
- package/src/core/types.ts +92 -75
- package/src/drafts/draft07/announce-fsm.ts +1 -1
- package/src/drafts/draft07/codec.ts +235 -118
- package/src/drafts/draft07/index.ts +43 -44
- package/src/drafts/draft07/messages.ts +1 -1
- package/src/drafts/draft07/parameters.ts +2 -2
- package/src/drafts/draft07/rules.ts +67 -38
- package/src/drafts/draft07/session-fsm.ts +330 -117
- package/src/drafts/draft07/session.ts +10 -10
- package/src/drafts/draft07/subscription-fsm.ts +1 -1
- package/src/drafts/draft07/varint.ts +4 -4
- package/src/drafts/draft08/codec.ts +1254 -0
- package/src/drafts/draft08/index.ts +125 -0
- package/src/drafts/draft08/messages.ts +72 -0
- package/src/drafts/draft08/rules.ts +91 -0
- package/src/drafts/draft08/session-fsm.ts +718 -0
- package/src/drafts/draft08/session.ts +26 -0
- package/src/drafts/draft08/types.ts +377 -0
- package/src/drafts/draft09/codec.ts +1235 -0
- package/src/drafts/draft09/index.ts +125 -0
- package/src/drafts/draft09/messages.ts +72 -0
- package/src/drafts/draft09/rules.ts +91 -0
- package/src/drafts/draft09/session-fsm.ts +718 -0
- package/src/drafts/draft09/session.ts +26 -0
- package/src/drafts/draft09/types.ts +376 -0
- package/src/drafts/draft10/codec.ts +1235 -0
- package/src/drafts/draft10/index.ts +125 -0
- package/src/drafts/draft10/messages.ts +72 -0
- package/src/drafts/draft10/rules.ts +91 -0
- package/src/drafts/draft10/session-fsm.ts +718 -0
- package/src/drafts/draft10/session.ts +26 -0
- package/src/drafts/draft10/types.ts +376 -0
- package/src/drafts/draft11/codec.ts +1198 -0
- package/src/drafts/draft11/index.ts +123 -0
- package/src/drafts/draft11/messages.ts +71 -0
- package/src/drafts/draft11/rules.ts +100 -0
- package/src/drafts/draft11/session-fsm.ts +758 -0
- package/src/drafts/draft11/session.ts +26 -0
- package/src/drafts/draft11/types.ts +375 -0
- package/src/drafts/draft12/codec.ts +1354 -0
- package/src/drafts/draft12/index.ts +130 -0
- package/src/drafts/draft12/messages.ts +84 -0
- package/src/drafts/draft12/rules.ts +106 -0
- package/src/drafts/draft12/session-fsm.ts +805 -0
- package/src/drafts/draft12/session.ts +26 -0
- package/src/drafts/draft12/types.ts +414 -0
- package/src/drafts/draft13/codec.ts +1438 -0
- package/src/drafts/draft13/index.ts +132 -0
- package/src/drafts/draft13/messages.ts +86 -0
- package/src/drafts/draft13/rules.ts +108 -0
- package/src/drafts/draft13/session-fsm.ts +819 -0
- package/src/drafts/draft13/session.ts +26 -0
- package/src/drafts/draft13/types.ts +433 -0
- package/src/drafts/draft14/codec.ts +339 -189
- package/src/drafts/draft14/index.ts +103 -108
- package/src/drafts/draft14/messages.ts +61 -61
- package/src/drafts/draft14/rules.ts +77 -34
- package/src/drafts/draft14/session-fsm.ts +640 -147
- package/src/drafts/draft14/session.ts +13 -13
- package/src/drafts/draft14/types.ts +68 -68
- package/src/drafts/draft15/codec.ts +1661 -0
- package/src/drafts/draft15/index.ts +121 -0
- package/src/drafts/draft15/messages.ts +64 -0
- package/src/drafts/draft15/rules.ts +95 -0
- package/src/drafts/draft15/session-fsm.ts +687 -0
- package/src/drafts/draft15/session.ts +26 -0
- package/src/drafts/draft15/types.ts +336 -0
- package/src/drafts/draft16/codec.ts +1623 -0
- package/src/drafts/draft16/index.ts +123 -0
- package/src/drafts/draft16/messages.ts +67 -0
- package/src/drafts/draft16/rules.ts +96 -0
- package/src/drafts/draft16/session-fsm.ts +682 -0
- package/src/drafts/draft16/session.ts +26 -0
- package/src/drafts/draft16/types.ts +354 -0
- package/src/drafts/draft17/codec.ts +1621 -0
- package/src/drafts/draft17/index.ts +105 -0
- package/src/drafts/draft17/messages.ts +53 -0
- package/src/drafts/draft17/rules.ts +85 -0
- package/src/drafts/draft17/session-fsm.ts +437 -0
- package/src/drafts/draft17/session.ts +15 -0
- package/src/drafts/draft17/types.ts +310 -0
- package/src/index.ts +283 -33
- package/src/session.ts +20 -20
|
@@ -1,132 +1,127 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type { Draft14Codec } from './codec.js';
|
|
3
|
-
|
|
1
|
+
export type { Draft14Codec } from "./codec.js";
|
|
4
2
|
export {
|
|
5
|
-
|
|
3
|
+
createDataStreamDecoder,
|
|
4
|
+
createDraft14Codec,
|
|
5
|
+
createFetchStreamDecoder,
|
|
6
|
+
createStreamDecoder,
|
|
7
|
+
createSubgroupStreamDecoder,
|
|
8
|
+
decodeDatagram,
|
|
9
|
+
decodeDataStream,
|
|
10
|
+
decodeFetchStream,
|
|
6
11
|
decodeMessage,
|
|
7
|
-
|
|
12
|
+
decodeSubgroupStream,
|
|
8
13
|
encodeDatagram,
|
|
9
14
|
encodeFetchStream,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
decodeDataStream,
|
|
14
|
-
createStreamDecoder,
|
|
15
|
-
createSubgroupStreamDecoder,
|
|
16
|
-
createFetchStreamDecoder,
|
|
17
|
-
createDataStreamDecoder,
|
|
18
|
-
} from './codec.js';
|
|
19
|
-
|
|
20
|
-
export type {
|
|
21
|
-
Draft14Message,
|
|
22
|
-
Draft14MessageType,
|
|
23
|
-
Draft14BaseMessage,
|
|
24
|
-
Draft14Params,
|
|
25
|
-
UnknownParam,
|
|
26
|
-
Draft14ClientSetup,
|
|
27
|
-
Draft14ServerSetup,
|
|
28
|
-
Draft14Subscribe,
|
|
29
|
-
Draft14SubscribeOk,
|
|
30
|
-
Draft14SubscribeUpdate,
|
|
31
|
-
Draft14SubscribeError,
|
|
32
|
-
Draft14Unsubscribe,
|
|
33
|
-
Draft14Publish,
|
|
34
|
-
Draft14PublishOk,
|
|
35
|
-
Draft14PublishError,
|
|
36
|
-
Draft14PublishDone,
|
|
37
|
-
Draft14PublishNamespace,
|
|
38
|
-
Draft14PublishNamespaceOk,
|
|
39
|
-
Draft14PublishNamespaceError,
|
|
40
|
-
Draft14PublishNamespaceDone,
|
|
41
|
-
Draft14PublishNamespaceCancel,
|
|
42
|
-
Draft14SubscribeNamespace,
|
|
43
|
-
Draft14SubscribeNamespaceOk,
|
|
44
|
-
Draft14SubscribeNamespaceError,
|
|
45
|
-
Draft14UnsubscribeNamespace,
|
|
46
|
-
Draft14Fetch,
|
|
47
|
-
Draft14FetchOk,
|
|
48
|
-
Draft14FetchError,
|
|
49
|
-
Draft14FetchCancel,
|
|
50
|
-
Draft14TrackStatus,
|
|
51
|
-
Draft14TrackStatusOk,
|
|
52
|
-
Draft14TrackStatusError,
|
|
53
|
-
Draft14GoAway,
|
|
54
|
-
Draft14MaxRequestId,
|
|
55
|
-
Draft14RequestsBlocked,
|
|
56
|
-
Draft14DataStream,
|
|
57
|
-
SubgroupStream,
|
|
58
|
-
DatagramObject,
|
|
59
|
-
FetchStream,
|
|
60
|
-
ObjectPayload,
|
|
61
|
-
SubgroupStreamHeader,
|
|
62
|
-
FetchStreamHeader,
|
|
63
|
-
DataStreamHeader,
|
|
64
|
-
DataStreamEvent,
|
|
65
|
-
} from './types.js';
|
|
66
|
-
|
|
15
|
+
encodeMessage,
|
|
16
|
+
encodeSubgroupStream,
|
|
17
|
+
} from "./codec.js";
|
|
67
18
|
export {
|
|
19
|
+
MESSAGE_ID_MAP,
|
|
20
|
+
MESSAGE_TYPE_MAP,
|
|
68
21
|
MSG_CLIENT_SETUP,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
22
|
+
MSG_FETCH,
|
|
23
|
+
MSG_FETCH_CANCEL,
|
|
24
|
+
MSG_FETCH_ERROR,
|
|
25
|
+
MSG_FETCH_OK,
|
|
26
|
+
MSG_GOAWAY,
|
|
27
|
+
MSG_MAX_REQUEST_ID,
|
|
75
28
|
MSG_PUBLISH,
|
|
76
|
-
MSG_PUBLISH_OK,
|
|
77
|
-
MSG_PUBLISH_ERROR,
|
|
78
29
|
MSG_PUBLISH_DONE,
|
|
30
|
+
MSG_PUBLISH_ERROR,
|
|
79
31
|
MSG_PUBLISH_NAMESPACE,
|
|
80
|
-
MSG_PUBLISH_NAMESPACE_OK,
|
|
81
|
-
MSG_PUBLISH_NAMESPACE_ERROR,
|
|
82
|
-
MSG_PUBLISH_NAMESPACE_DONE,
|
|
83
32
|
MSG_PUBLISH_NAMESPACE_CANCEL,
|
|
33
|
+
MSG_PUBLISH_NAMESPACE_DONE,
|
|
34
|
+
MSG_PUBLISH_NAMESPACE_ERROR,
|
|
35
|
+
MSG_PUBLISH_NAMESPACE_OK,
|
|
36
|
+
MSG_PUBLISH_OK,
|
|
37
|
+
MSG_REQUESTS_BLOCKED,
|
|
38
|
+
MSG_SERVER_SETUP,
|
|
39
|
+
MSG_SUBSCRIBE,
|
|
40
|
+
MSG_SUBSCRIBE_ERROR,
|
|
84
41
|
MSG_SUBSCRIBE_NAMESPACE,
|
|
85
|
-
MSG_SUBSCRIBE_NAMESPACE_OK,
|
|
86
42
|
MSG_SUBSCRIBE_NAMESPACE_ERROR,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
MSG_FETCH_ERROR,
|
|
91
|
-
MSG_FETCH_CANCEL,
|
|
43
|
+
MSG_SUBSCRIBE_NAMESPACE_OK,
|
|
44
|
+
MSG_SUBSCRIBE_OK,
|
|
45
|
+
MSG_SUBSCRIBE_UPDATE,
|
|
92
46
|
MSG_TRACK_STATUS,
|
|
93
|
-
MSG_TRACK_STATUS_OK,
|
|
94
47
|
MSG_TRACK_STATUS_ERROR,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
MESSAGE_TYPE_MAP,
|
|
99
|
-
MESSAGE_ID_MAP,
|
|
100
|
-
PARAM_ROLE,
|
|
101
|
-
PARAM_PATH,
|
|
48
|
+
MSG_TRACK_STATUS_OK,
|
|
49
|
+
MSG_UNSUBSCRIBE,
|
|
50
|
+
MSG_UNSUBSCRIBE_NAMESPACE,
|
|
102
51
|
PARAM_MAX_REQUEST_ID,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
export { createDraft14SessionState } from './session.js';
|
|
107
|
-
export { Draft14SessionFSM } from './session-fsm.js';
|
|
52
|
+
PARAM_PATH,
|
|
53
|
+
PARAM_ROLE,
|
|
54
|
+
} from "./messages.js";
|
|
108
55
|
export {
|
|
109
|
-
CONTROL_MESSAGES,
|
|
110
|
-
CLIENT_ONLY_MESSAGES,
|
|
111
|
-
SERVER_ONLY_MESSAGES,
|
|
112
56
|
BIDIRECTIONAL_MESSAGES,
|
|
113
|
-
|
|
57
|
+
CLIENT_ONLY_MESSAGES,
|
|
58
|
+
CONTROL_MESSAGES,
|
|
114
59
|
getLegalIncoming,
|
|
115
|
-
|
|
116
|
-
|
|
60
|
+
getLegalOutgoing,
|
|
61
|
+
SERVER_ONLY_MESSAGES,
|
|
62
|
+
} from "./rules.js";
|
|
117
63
|
export type {
|
|
64
|
+
FetchPhase,
|
|
65
|
+
FetchState,
|
|
66
|
+
ProtocolViolation,
|
|
67
|
+
ProtocolViolationCode,
|
|
68
|
+
PublishPhase,
|
|
69
|
+
PublishState,
|
|
70
|
+
SessionPhase,
|
|
118
71
|
SessionState,
|
|
119
72
|
SessionStateOptions,
|
|
120
|
-
|
|
121
|
-
SubscriptionState,
|
|
73
|
+
SideEffect,
|
|
122
74
|
SubscriptionPhase,
|
|
123
|
-
|
|
124
|
-
PublishPhase,
|
|
125
|
-
FetchState,
|
|
126
|
-
FetchPhase,
|
|
75
|
+
SubscriptionState,
|
|
127
76
|
TransitionResult,
|
|
128
77
|
ValidationResult,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
} from
|
|
78
|
+
} from "./session.js";
|
|
79
|
+
// Session state machine
|
|
80
|
+
export { createDraft14SessionState } from "./session.js";
|
|
81
|
+
export { Draft14SessionFSM } from "./session-fsm.js";
|
|
82
|
+
export type {
|
|
83
|
+
DatagramObject,
|
|
84
|
+
DataStreamEvent,
|
|
85
|
+
DataStreamHeader,
|
|
86
|
+
Draft14BaseMessage,
|
|
87
|
+
Draft14ClientSetup,
|
|
88
|
+
Draft14DataStream,
|
|
89
|
+
Draft14Fetch,
|
|
90
|
+
Draft14FetchCancel,
|
|
91
|
+
Draft14FetchError,
|
|
92
|
+
Draft14FetchOk,
|
|
93
|
+
Draft14GoAway,
|
|
94
|
+
Draft14MaxRequestId,
|
|
95
|
+
Draft14Message,
|
|
96
|
+
Draft14MessageType,
|
|
97
|
+
Draft14Params,
|
|
98
|
+
Draft14Publish,
|
|
99
|
+
Draft14PublishDone,
|
|
100
|
+
Draft14PublishError,
|
|
101
|
+
Draft14PublishNamespace,
|
|
102
|
+
Draft14PublishNamespaceCancel,
|
|
103
|
+
Draft14PublishNamespaceDone,
|
|
104
|
+
Draft14PublishNamespaceError,
|
|
105
|
+
Draft14PublishNamespaceOk,
|
|
106
|
+
Draft14PublishOk,
|
|
107
|
+
Draft14RequestsBlocked,
|
|
108
|
+
Draft14ServerSetup,
|
|
109
|
+
Draft14Subscribe,
|
|
110
|
+
Draft14SubscribeError,
|
|
111
|
+
Draft14SubscribeNamespace,
|
|
112
|
+
Draft14SubscribeNamespaceError,
|
|
113
|
+
Draft14SubscribeNamespaceOk,
|
|
114
|
+
Draft14SubscribeOk,
|
|
115
|
+
Draft14SubscribeUpdate,
|
|
116
|
+
Draft14TrackStatus,
|
|
117
|
+
Draft14TrackStatusError,
|
|
118
|
+
Draft14TrackStatusOk,
|
|
119
|
+
Draft14Unsubscribe,
|
|
120
|
+
Draft14UnsubscribeNamespace,
|
|
121
|
+
FetchStream,
|
|
122
|
+
FetchStreamHeader,
|
|
123
|
+
ObjectPayload,
|
|
124
|
+
SubgroupStream,
|
|
125
|
+
SubgroupStreamHeader,
|
|
126
|
+
UnknownParam,
|
|
127
|
+
} from "./types.js";
|
|
@@ -1,76 +1,76 @@
|
|
|
1
1
|
// Draft-14 message type wire IDs
|
|
2
2
|
|
|
3
|
-
export const MSG_SUBSCRIBE_UPDATE
|
|
4
|
-
export const MSG_SUBSCRIBE
|
|
5
|
-
export const MSG_SUBSCRIBE_OK
|
|
6
|
-
export const MSG_SUBSCRIBE_ERROR
|
|
7
|
-
export const MSG_PUBLISH_NAMESPACE
|
|
8
|
-
export const MSG_PUBLISH_NAMESPACE_OK
|
|
3
|
+
export const MSG_SUBSCRIBE_UPDATE = 0x02n;
|
|
4
|
+
export const MSG_SUBSCRIBE = 0x03n;
|
|
5
|
+
export const MSG_SUBSCRIBE_OK = 0x04n;
|
|
6
|
+
export const MSG_SUBSCRIBE_ERROR = 0x05n;
|
|
7
|
+
export const MSG_PUBLISH_NAMESPACE = 0x06n;
|
|
8
|
+
export const MSG_PUBLISH_NAMESPACE_OK = 0x07n;
|
|
9
9
|
export const MSG_PUBLISH_NAMESPACE_ERROR = 0x08n;
|
|
10
|
-
export const MSG_PUBLISH_NAMESPACE_DONE
|
|
11
|
-
export const MSG_UNSUBSCRIBE
|
|
12
|
-
export const MSG_PUBLISH_DONE
|
|
13
|
-
export const MSG_PUBLISH_NAMESPACE_CANCEL =
|
|
14
|
-
export const MSG_TRACK_STATUS
|
|
15
|
-
export const MSG_TRACK_STATUS_OK
|
|
16
|
-
export const MSG_TRACK_STATUS_ERROR
|
|
17
|
-
export const MSG_GOAWAY
|
|
10
|
+
export const MSG_PUBLISH_NAMESPACE_DONE = 0x09n;
|
|
11
|
+
export const MSG_UNSUBSCRIBE = 0x0an;
|
|
12
|
+
export const MSG_PUBLISH_DONE = 0x0bn;
|
|
13
|
+
export const MSG_PUBLISH_NAMESPACE_CANCEL = 0x0cn;
|
|
14
|
+
export const MSG_TRACK_STATUS = 0x0dn;
|
|
15
|
+
export const MSG_TRACK_STATUS_OK = 0x0en;
|
|
16
|
+
export const MSG_TRACK_STATUS_ERROR = 0x0fn;
|
|
17
|
+
export const MSG_GOAWAY = 0x10n;
|
|
18
18
|
export const MSG_SUBSCRIBE_NAMESPACE = 0x11n;
|
|
19
|
-
export const MSG_SUBSCRIBE_NAMESPACE_OK
|
|
19
|
+
export const MSG_SUBSCRIBE_NAMESPACE_OK = 0x12n;
|
|
20
20
|
export const MSG_SUBSCRIBE_NAMESPACE_ERROR = 0x13n;
|
|
21
|
-
export const MSG_UNSUBSCRIBE_NAMESPACE
|
|
22
|
-
export const MSG_MAX_REQUEST_ID
|
|
23
|
-
export const MSG_FETCH
|
|
24
|
-
export const MSG_FETCH_CANCEL
|
|
25
|
-
export const MSG_FETCH_OK
|
|
26
|
-
export const MSG_FETCH_ERROR
|
|
27
|
-
export const MSG_REQUESTS_BLOCKED
|
|
28
|
-
export const MSG_PUBLISH
|
|
29
|
-
export const MSG_PUBLISH_OK
|
|
30
|
-
export const MSG_PUBLISH_ERROR
|
|
31
|
-
export const MSG_CLIENT_SETUP
|
|
32
|
-
export const MSG_SERVER_SETUP
|
|
21
|
+
export const MSG_UNSUBSCRIBE_NAMESPACE = 0x14n;
|
|
22
|
+
export const MSG_MAX_REQUEST_ID = 0x15n;
|
|
23
|
+
export const MSG_FETCH = 0x16n;
|
|
24
|
+
export const MSG_FETCH_CANCEL = 0x17n;
|
|
25
|
+
export const MSG_FETCH_OK = 0x18n;
|
|
26
|
+
export const MSG_FETCH_ERROR = 0x19n;
|
|
27
|
+
export const MSG_REQUESTS_BLOCKED = 0x1an;
|
|
28
|
+
export const MSG_PUBLISH = 0x1dn;
|
|
29
|
+
export const MSG_PUBLISH_OK = 0x1en;
|
|
30
|
+
export const MSG_PUBLISH_ERROR = 0x1fn;
|
|
31
|
+
export const MSG_CLIENT_SETUP = 0x20n;
|
|
32
|
+
export const MSG_SERVER_SETUP = 0x21n;
|
|
33
33
|
|
|
34
34
|
// Parameter type IDs
|
|
35
|
-
export const PARAM_ROLE
|
|
36
|
-
export const PARAM_PATH
|
|
37
|
-
export const PARAM_MAX_REQUEST_ID
|
|
35
|
+
export const PARAM_ROLE = 0x00n;
|
|
36
|
+
export const PARAM_PATH = 0x01n;
|
|
37
|
+
export const PARAM_MAX_REQUEST_ID = 0x02n;
|
|
38
38
|
|
|
39
39
|
// Map from wire ID to message type name
|
|
40
40
|
export const MESSAGE_TYPE_MAP: ReadonlyMap<bigint, string> = new Map([
|
|
41
|
-
[MSG_CLIENT_SETUP,
|
|
42
|
-
[MSG_SERVER_SETUP,
|
|
43
|
-
[MSG_SUBSCRIBE,
|
|
44
|
-
[MSG_SUBSCRIBE_OK,
|
|
45
|
-
[MSG_SUBSCRIBE_UPDATE,
|
|
46
|
-
[MSG_SUBSCRIBE_ERROR,
|
|
47
|
-
[MSG_UNSUBSCRIBE,
|
|
48
|
-
[MSG_PUBLISH,
|
|
49
|
-
[MSG_PUBLISH_OK,
|
|
50
|
-
[MSG_PUBLISH_ERROR,
|
|
51
|
-
[MSG_PUBLISH_DONE,
|
|
52
|
-
[MSG_PUBLISH_NAMESPACE,
|
|
53
|
-
[MSG_PUBLISH_NAMESPACE_OK,
|
|
54
|
-
[MSG_PUBLISH_NAMESPACE_ERROR,
|
|
55
|
-
[MSG_PUBLISH_NAMESPACE_DONE,
|
|
56
|
-
[MSG_PUBLISH_NAMESPACE_CANCEL,
|
|
57
|
-
[MSG_SUBSCRIBE_NAMESPACE,
|
|
58
|
-
[MSG_SUBSCRIBE_NAMESPACE_OK,
|
|
59
|
-
[MSG_SUBSCRIBE_NAMESPACE_ERROR,
|
|
60
|
-
[MSG_UNSUBSCRIBE_NAMESPACE,
|
|
61
|
-
[MSG_FETCH,
|
|
62
|
-
[MSG_FETCH_OK,
|
|
63
|
-
[MSG_FETCH_ERROR,
|
|
64
|
-
[MSG_FETCH_CANCEL,
|
|
65
|
-
[MSG_TRACK_STATUS,
|
|
66
|
-
[MSG_TRACK_STATUS_OK,
|
|
67
|
-
[MSG_TRACK_STATUS_ERROR,
|
|
68
|
-
[MSG_GOAWAY,
|
|
69
|
-
[MSG_MAX_REQUEST_ID,
|
|
70
|
-
[MSG_REQUESTS_BLOCKED,
|
|
41
|
+
[MSG_CLIENT_SETUP, "client_setup"],
|
|
42
|
+
[MSG_SERVER_SETUP, "server_setup"],
|
|
43
|
+
[MSG_SUBSCRIBE, "subscribe"],
|
|
44
|
+
[MSG_SUBSCRIBE_OK, "subscribe_ok"],
|
|
45
|
+
[MSG_SUBSCRIBE_UPDATE, "subscribe_update"],
|
|
46
|
+
[MSG_SUBSCRIBE_ERROR, "subscribe_error"],
|
|
47
|
+
[MSG_UNSUBSCRIBE, "unsubscribe"],
|
|
48
|
+
[MSG_PUBLISH, "publish"],
|
|
49
|
+
[MSG_PUBLISH_OK, "publish_ok"],
|
|
50
|
+
[MSG_PUBLISH_ERROR, "publish_error"],
|
|
51
|
+
[MSG_PUBLISH_DONE, "publish_done"],
|
|
52
|
+
[MSG_PUBLISH_NAMESPACE, "publish_namespace"],
|
|
53
|
+
[MSG_PUBLISH_NAMESPACE_OK, "publish_namespace_ok"],
|
|
54
|
+
[MSG_PUBLISH_NAMESPACE_ERROR, "publish_namespace_error"],
|
|
55
|
+
[MSG_PUBLISH_NAMESPACE_DONE, "publish_namespace_done"],
|
|
56
|
+
[MSG_PUBLISH_NAMESPACE_CANCEL, "publish_namespace_cancel"],
|
|
57
|
+
[MSG_SUBSCRIBE_NAMESPACE, "subscribe_namespace"],
|
|
58
|
+
[MSG_SUBSCRIBE_NAMESPACE_OK, "subscribe_namespace_ok"],
|
|
59
|
+
[MSG_SUBSCRIBE_NAMESPACE_ERROR, "subscribe_namespace_error"],
|
|
60
|
+
[MSG_UNSUBSCRIBE_NAMESPACE, "unsubscribe_namespace"],
|
|
61
|
+
[MSG_FETCH, "fetch"],
|
|
62
|
+
[MSG_FETCH_OK, "fetch_ok"],
|
|
63
|
+
[MSG_FETCH_ERROR, "fetch_error"],
|
|
64
|
+
[MSG_FETCH_CANCEL, "fetch_cancel"],
|
|
65
|
+
[MSG_TRACK_STATUS, "track_status"],
|
|
66
|
+
[MSG_TRACK_STATUS_OK, "track_status_ok"],
|
|
67
|
+
[MSG_TRACK_STATUS_ERROR, "track_status_error"],
|
|
68
|
+
[MSG_GOAWAY, "goaway"],
|
|
69
|
+
[MSG_MAX_REQUEST_ID, "max_request_id"],
|
|
70
|
+
[MSG_REQUESTS_BLOCKED, "requests_blocked"],
|
|
71
71
|
]);
|
|
72
72
|
|
|
73
73
|
// Reverse map from message type name to wire ID
|
|
74
74
|
export const MESSAGE_ID_MAP: ReadonlyMap<string, bigint> = new Map(
|
|
75
|
-
[...MESSAGE_TYPE_MAP.entries()].map(([id, name]) => [name, id])
|
|
75
|
+
[...MESSAGE_TYPE_MAP.entries()].map(([id, name]) => [name, id]),
|
|
76
76
|
);
|
|
@@ -1,61 +1,101 @@
|
|
|
1
|
-
import type { Draft14MessageType } from
|
|
1
|
+
import type { Draft14MessageType } from "./types.js";
|
|
2
2
|
|
|
3
3
|
// All draft-14 control messages
|
|
4
4
|
export const CONTROL_MESSAGES: ReadonlySet<Draft14MessageType> = new Set([
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
"client_setup",
|
|
6
|
+
"server_setup",
|
|
7
|
+
"subscribe",
|
|
8
|
+
"subscribe_ok",
|
|
9
|
+
"subscribe_update",
|
|
10
|
+
"subscribe_error",
|
|
11
|
+
"unsubscribe",
|
|
12
|
+
"publish",
|
|
13
|
+
"publish_ok",
|
|
14
|
+
"publish_error",
|
|
15
|
+
"publish_done",
|
|
16
|
+
"publish_namespace",
|
|
17
|
+
"publish_namespace_ok",
|
|
18
|
+
"publish_namespace_error",
|
|
19
|
+
"publish_namespace_done",
|
|
20
|
+
"publish_namespace_cancel",
|
|
21
|
+
"subscribe_namespace",
|
|
22
|
+
"subscribe_namespace_ok",
|
|
23
|
+
"subscribe_namespace_error",
|
|
24
|
+
"unsubscribe_namespace",
|
|
25
|
+
"fetch",
|
|
26
|
+
"fetch_ok",
|
|
27
|
+
"fetch_error",
|
|
28
|
+
"fetch_cancel",
|
|
29
|
+
"track_status",
|
|
30
|
+
"track_status_ok",
|
|
31
|
+
"track_status_error",
|
|
32
|
+
"goaway",
|
|
33
|
+
"max_request_id",
|
|
34
|
+
"requests_blocked",
|
|
14
35
|
]);
|
|
15
36
|
|
|
16
37
|
// Draft-14 is more symmetric: only setup messages are role-restricted.
|
|
17
38
|
// All other messages can be sent by both client and server.
|
|
18
|
-
export const CLIENT_ONLY_MESSAGES: ReadonlySet<Draft14MessageType> = new Set([
|
|
19
|
-
'client_setup',
|
|
20
|
-
]);
|
|
39
|
+
export const CLIENT_ONLY_MESSAGES: ReadonlySet<Draft14MessageType> = new Set(["client_setup"]);
|
|
21
40
|
|
|
22
|
-
export const SERVER_ONLY_MESSAGES: ReadonlySet<Draft14MessageType> = new Set([
|
|
23
|
-
'server_setup',
|
|
24
|
-
]);
|
|
41
|
+
export const SERVER_ONLY_MESSAGES: ReadonlySet<Draft14MessageType> = new Set(["server_setup"]);
|
|
25
42
|
|
|
26
43
|
// Messages that are bidirectional (both client and server can send)
|
|
27
44
|
export const BIDIRECTIONAL_MESSAGES: ReadonlySet<Draft14MessageType> = new Set([
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
45
|
+
"subscribe",
|
|
46
|
+
"subscribe_ok",
|
|
47
|
+
"subscribe_update",
|
|
48
|
+
"subscribe_error",
|
|
49
|
+
"unsubscribe",
|
|
50
|
+
"publish",
|
|
51
|
+
"publish_ok",
|
|
52
|
+
"publish_error",
|
|
53
|
+
"publish_done",
|
|
54
|
+
"publish_namespace",
|
|
55
|
+
"publish_namespace_ok",
|
|
56
|
+
"publish_namespace_error",
|
|
57
|
+
"publish_namespace_done",
|
|
58
|
+
"publish_namespace_cancel",
|
|
59
|
+
"subscribe_namespace",
|
|
60
|
+
"subscribe_namespace_ok",
|
|
61
|
+
"subscribe_namespace_error",
|
|
62
|
+
"unsubscribe_namespace",
|
|
63
|
+
"fetch",
|
|
64
|
+
"fetch_ok",
|
|
65
|
+
"fetch_error",
|
|
66
|
+
"fetch_cancel",
|
|
67
|
+
"track_status",
|
|
68
|
+
"track_status_ok",
|
|
69
|
+
"track_status_error",
|
|
70
|
+
"goaway",
|
|
71
|
+
"max_request_id",
|
|
72
|
+
"requests_blocked",
|
|
36
73
|
]);
|
|
37
74
|
|
|
38
75
|
// Messages legal in each session phase -- for outbound validation
|
|
39
|
-
export function getLegalOutgoing(
|
|
76
|
+
export function getLegalOutgoing(
|
|
77
|
+
phase: string,
|
|
78
|
+
role: "client" | "server",
|
|
79
|
+
): Set<Draft14MessageType> {
|
|
40
80
|
const legal = new Set<Draft14MessageType>();
|
|
41
81
|
|
|
42
82
|
switch (phase) {
|
|
43
|
-
case
|
|
44
|
-
if (role ===
|
|
83
|
+
case "idle":
|
|
84
|
+
if (role === "client") legal.add("client_setup");
|
|
45
85
|
break;
|
|
46
|
-
case
|
|
47
|
-
if (role ===
|
|
86
|
+
case "setup":
|
|
87
|
+
if (role === "server") legal.add("server_setup");
|
|
48
88
|
break;
|
|
49
|
-
case
|
|
89
|
+
case "ready": {
|
|
50
90
|
// Both roles can send goaway
|
|
51
|
-
legal.add(
|
|
91
|
+
legal.add("goaway");
|
|
52
92
|
// All bidirectional messages are legal for both roles
|
|
53
93
|
for (const msg of BIDIRECTIONAL_MESSAGES) {
|
|
54
94
|
legal.add(msg);
|
|
55
95
|
}
|
|
56
96
|
break;
|
|
57
97
|
}
|
|
58
|
-
case
|
|
98
|
+
case "draining":
|
|
59
99
|
// Limited set during draining - can still finish active operations
|
|
60
100
|
break;
|
|
61
101
|
}
|
|
@@ -63,8 +103,11 @@ export function getLegalOutgoing(phase: string, role: 'client' | 'server'): Set<
|
|
|
63
103
|
return legal;
|
|
64
104
|
}
|
|
65
105
|
|
|
66
|
-
export function getLegalIncoming(
|
|
106
|
+
export function getLegalIncoming(
|
|
107
|
+
phase: string,
|
|
108
|
+
role: "client" | "server",
|
|
109
|
+
): Set<Draft14MessageType> {
|
|
67
110
|
// Incoming from remote = the other role's outgoing
|
|
68
|
-
const remoteRole = role ===
|
|
111
|
+
const remoteRole = role === "client" ? "server" : "client";
|
|
69
112
|
return getLegalOutgoing(phase, remoteRole);
|
|
70
113
|
}
|