mqtt-plus 0.9.5 → 0.9.6
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 +12 -9
- package/doc/mqtt-plus-1-event-emission.d2 +2 -2
- package/doc/mqtt-plus-4-resource-transfer.d2 +0 -2
- package/doc/mqtt-plus-4-resource-transfer.svg +90 -92
- package/dst-stage1/mqtt-plus-msg.d.ts +4 -3
- package/dst-stage1/mqtt-plus-msg.js +15 -11
- package/dst-stage1/mqtt-plus-resource.js +10 -12
- package/dst-stage2/mqtt-plus.cjs.js +27 -24
- package/dst-stage2/mqtt-plus.esm.js +27 -24
- package/dst-stage2/mqtt-plus.umd.js +9 -9
- package/etc/eslint.mts +1 -1
- package/package.json +1 -1
- package/src/mqtt-plus-api.ts +1 -1
- package/src/mqtt-plus-msg.ts +17 -11
- package/src/mqtt-plus-resource.ts +14 -17
package/README.md
CHANGED
|
@@ -86,15 +86,6 @@ communication patterns with type safety:
|
|
|
86
86
|
|
|
87
87
|

|
|
88
88
|
|
|
89
|
-
> [!Note]
|
|
90
|
-
> **MQTT+** is similar to and derived from
|
|
91
|
-
> [MQTT-JSON-RPC](https://github.com/rse/mqtt-json-rpc) of the same
|
|
92
|
-
> author, but instead of just JSON, MQTT+ encodes packets as JSON
|
|
93
|
-
> or CBOR (default), uses an own packet format (allowing sender and
|
|
94
|
-
> receiver information), uses shorter NanoIDs instead of longer UUIDs
|
|
95
|
-
> for identification of sender, receiver and requests, and additionally
|
|
96
|
-
> provides stream transfer and resource transfer support.
|
|
97
|
-
|
|
98
89
|
Usage
|
|
99
90
|
-----
|
|
100
91
|
|
|
@@ -582,6 +573,18 @@ example/hello success: world:42
|
|
|
582
573
|
CLOSE
|
|
583
574
|
```
|
|
584
575
|
|
|
576
|
+
Notice
|
|
577
|
+
------
|
|
578
|
+
|
|
579
|
+
> [!Note]
|
|
580
|
+
> **MQTT+** is somewhat similar to and originally derived from
|
|
581
|
+
> [MQTT-JSON-RPC](https://github.com/rse/mqtt-json-rpc) of the same
|
|
582
|
+
> author, but instead of just JSON, MQTT+ encodes packets as JSON
|
|
583
|
+
> or CBOR (default), uses an own packet format (allowing sender and
|
|
584
|
+
> receiver information), uses shorter NanoIDs instead of longer UUIDs
|
|
585
|
+
> for identification of sender, receiver and requests, and additionally
|
|
586
|
+
> provides stream transfer and resource transfer support.
|
|
587
|
+
|
|
585
588
|
License
|
|
586
589
|
-------
|
|
587
590
|
|
|
@@ -7,11 +7,11 @@ server: "Server"
|
|
|
7
7
|
|
|
8
8
|
broker.class: brown
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
subscribe("foo/bar"): {
|
|
11
11
|
server -> broker: "op: subscribe\ntopic: foo/bar/event-emission/any"
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
emit("foo/bar"): {
|
|
15
15
|
client -> broker: "op: publish\ntopic: foo/bar/event-emission/any\ndata: Event-Emission"
|
|
16
16
|
broker -> server: "op: publish\ntopic: foo/bar/event-emission/any\ndata: Event-Emission"
|
|
17
17
|
}
|
|
@@ -19,7 +19,5 @@ transfer("foo/bar") {
|
|
|
19
19
|
client <- broker: "op: publish\ntopic: foo/bar/resource-response/XXX\ndata: Resource-Transfer-Response #1"
|
|
20
20
|
broker <- server: "op: publish\ntopic: foo/bar/resource-response/XXX\ndata: Resource-Transfer-Response #N"
|
|
21
21
|
client <- broker: "op: publish\ntopic: foo/bar/resource-response/XXX\ndata: Resource-Transfer-Response #N"
|
|
22
|
-
broker <- server: "op: publish\ntopic: foo/bar/resource-response/XXX\ndata: Resource-Transfer-Response EoS"
|
|
23
|
-
client <- broker: "op: publish\ntopic: foo/bar/resource-response/XXX\ndata: Resource-Transfer-Response EoS"
|
|
24
22
|
}
|
|
25
23
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" data-d2-version="v0.7.0-HEAD" preserveAspectRatio="xMinYMin meet" viewBox="0 0
|
|
2
|
-
.d2-
|
|
3
|
-
font-family: "d2-
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" data-d2-version="v0.7.0-HEAD" preserveAspectRatio="xMinYMin meet" viewBox="0 0 714 1118"><svg class="d2-3961372893 d2-svg" width="714" height="1118" viewBox="11 51 714 1118"><rect x="11.000000" y="51.000000" width="714.000000" height="1118.000000" rx="0.000000" fill="#ffffff" class=" fill-N7" stroke-width="0" /><style type="text/css"><![CDATA[
|
|
2
|
+
.d2-3961372893 .text {
|
|
3
|
+
font-family: "d2-3961372893-font-regular";
|
|
4
4
|
}
|
|
5
5
|
@font-face {
|
|
6
|
-
font-family: d2-
|
|
7
|
-
src: url("data:application/font-woff;base64,
|
|
6
|
+
font-family: d2-3961372893-font-regular;
|
|
7
|
+
src: url("data:application/font-woff;base64,d09GRgABAAAAAA7kAAoAAAAAFrwAAguFAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAAA9AAAAGAAAABgXd/Vo2NtYXAAAAFUAAAAsgAAAPYEVgWhZ2x5ZgAAAggAAAgyAAALEFSFZWloZWFkAAAKPAAAADYAAAA2G4Ue32hoZWEAAAp0AAAAJAAAACQKhAXraG10eAAACpgAAACUAAAApEUFCJ5sb2NhAAALLAAAAFQAAABUPvxCHG1heHAAAAuAAAAAIAAAACAAQQD2bmFtZQAAC6AAAAMjAAAIFAbDVU1wb3N0AAAOxAAAAB0AAAAg/9EAMgADAgkBkAAFAAACigJYAAAASwKKAlgAAAFeADIBIwAAAgsFAwMEAwICBGAAAvcAAAADAAAAAAAAAABBREJPAEAAIP//Au7/BgAAA9gBESAAAZ8AAAAAAeYClAAAACAAA3ichM07K4UBAIfx3+u87sf9fn+dcwYGyWpkP4MMZ7WIyKh8HrmMSpl9FWWSjcWgv0hWz/yrB4WaAnWlF7RUSqVKQ9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mFfvqwRmJokZydWIVdgl4wS67vOLFWs0OhxzQY/8OHBdZPQ54fWtnXadlFWd1/hSbtvg6nl2vXt5br8/v4MsvNFE3L2Nf2vhuX1i1G/+fEDHzXNzW6p3cE4L/AAAA//8BAAD//wdbTDAAeJxiYGYAg//nGIwYsAAAAAAA//8BAAD//y8BAgMAAAA=");
|
|
8
8
|
}
|
|
9
|
-
.d2-
|
|
10
|
-
font-family: "d2-
|
|
9
|
+
.d2-3961372893 .text-italic {
|
|
10
|
+
font-family: "d2-3961372893-font-italic";
|
|
11
11
|
}
|
|
12
12
|
@font-face {
|
|
13
|
-
font-family: d2-
|
|
14
|
-
src: url("data:application/font-woff;base64,
|
|
13
|
+
font-family: d2-3961372893-font-italic;
|
|
14
|
+
src: url("data:application/font-woff;base64,d09GRgABAAAAAA9QAAoAAAAAF5gAARhRAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAAA9AAAAGAAAABgW1SVeGNtYXAAAAFUAAAAsgAAAPYEVgWhZ2x5ZgAAAggAAAiMAAALzF9NPBZoZWFkAAAKlAAAADYAAAA2G7Ur2mhoZWEAAArMAAAAJAAAACQLeAjNaG10eAAACvAAAACkAAAApELKBRtsb2NhAAALlAAAAFQAAABUQt5GLm1heHAAAAvoAAAAIAAAACAAQQD2bmFtZQAADAgAAAMmAAAIMgntVzNwb3N0AAAPMAAAACAAAAAg/8YAMgADAeEBkAAFAAACigJY//EASwKKAlgARAFeADIBIwAAAgsFAwMEAwkCBCAAAHcAAAADAAAAAAAAAABBREJPAAEAIP//Au7/BgAAA9gBESAAAZMAAAAAAeYClAAAACAAA3ichM07K4UBAIfx3+u87sf9fn+dcwYGyWpkP4MMZ7WIyKh8HrmMSpl9FWWSjcWgv0hWz/yrB4WaAnWlF7RUSqVKQ9O6DZu2bNvVtq/j0LFT5y4SftXan9rRtqfjwJETZ98qT/lU5CNvec9rnvOYh9znLre5yXWucvnz/7/CipZVDZWmJcu61JS69ejVp9+AQXVDho0YNWbchElTps2YNW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1y3nEaHiLnb7Q6/ADs/ZZY+xsvR1M7+886+Et9hTB05JZDWUpn0NjwnYJeApu+zynKfv9XLJxhkft8ZnNX+bA/bpsHdtNQvbDvu8XIv28cx/ie2O6nE8ujw9u/U0H9xAtd9o367eza4m56cxt2hX23FMzNRzcVurNbn7BP8DAAD//wEAAP//cqFRQAAAAAMAAP/1AAD/zgAyAAAAAAAAAAAAAAAAAAAAAAAAAAA=");
|
|
15
15
|
}]]></style><style type="text/css"><![CDATA[.shape {
|
|
16
16
|
shape-rendering: geometricPrecision;
|
|
17
17
|
stroke-linejoin: round;
|
|
@@ -25,87 +25,85 @@
|
|
|
25
25
|
opacity: 0.5;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.d2-
|
|
29
|
-
.d2-
|
|
30
|
-
.d2-
|
|
31
|
-
.d2-
|
|
32
|
-
.d2-
|
|
33
|
-
.d2-
|
|
34
|
-
.d2-
|
|
35
|
-
.d2-
|
|
36
|
-
.d2-
|
|
37
|
-
.d2-
|
|
38
|
-
.d2-
|
|
39
|
-
.d2-
|
|
40
|
-
.d2-
|
|
41
|
-
.d2-
|
|
42
|
-
.d2-
|
|
43
|
-
.d2-
|
|
44
|
-
.d2-
|
|
45
|
-
.d2-
|
|
46
|
-
.d2-
|
|
47
|
-
.d2-
|
|
48
|
-
.d2-
|
|
49
|
-
.d2-
|
|
50
|
-
.d2-
|
|
51
|
-
.d2-
|
|
52
|
-
.d2-
|
|
53
|
-
.d2-
|
|
54
|
-
.d2-
|
|
55
|
-
.d2-
|
|
56
|
-
.d2-
|
|
57
|
-
.d2-
|
|
58
|
-
.d2-
|
|
59
|
-
.d2-
|
|
60
|
-
.d2-
|
|
61
|
-
.d2-
|
|
62
|
-
.d2-
|
|
63
|
-
.d2-
|
|
64
|
-
.d2-
|
|
65
|
-
.d2-
|
|
66
|
-
.d2-
|
|
67
|
-
.d2-
|
|
68
|
-
.d2-
|
|
69
|
-
.d2-
|
|
70
|
-
.d2-
|
|
71
|
-
.d2-
|
|
72
|
-
.d2-
|
|
73
|
-
.d2-
|
|
74
|
-
.d2-
|
|
75
|
-
.d2-
|
|
76
|
-
.d2-
|
|
77
|
-
.d2-
|
|
78
|
-
.d2-
|
|
79
|
-
.d2-
|
|
80
|
-
.d2-
|
|
81
|
-
.d2-
|
|
82
|
-
.d2-
|
|
83
|
-
.d2-
|
|
84
|
-
.d2-
|
|
85
|
-
.d2-
|
|
86
|
-
.d2-
|
|
87
|
-
.d2-
|
|
88
|
-
.d2-
|
|
89
|
-
.d2-
|
|
90
|
-
.d2-
|
|
91
|
-
.d2-
|
|
92
|
-
.d2-
|
|
93
|
-
.d2-
|
|
94
|
-
.d2-
|
|
95
|
-
.d2-
|
|
96
|
-
.d2-
|
|
97
|
-
.d2-
|
|
98
|
-
.d2-
|
|
99
|
-
.d2-790283124 .color-AB5{color:#ffe0c8;}.appendix text.text{fill:#303030}.md{--color-fg-default:#303030;--color-fg-muted:#606060;--color-fg-subtle:#909090;--color-canvas-default:#ffffff;--color-canvas-subtle:#f0f0f0;--color-border-default:#336699;--color-border-muted:#6699cc;--color-neutral-muted:#f0f0f0;--color-accent-fg:#6699cc;--color-accent-emphasis:#6699cc;--color-attention-subtle:#606060;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-dark-d2-790283124);mix-blend-mode:overlay}.sketch-overlay-B2{fill:url(#streaks-normal-d2-790283124);mix-blend-mode:color-burn}.sketch-overlay-B3{fill:url(#streaks-normal-d2-790283124);mix-blend-mode:color-burn}.sketch-overlay-B4{fill:url(#streaks-normal-d2-790283124);mix-blend-mode:color-burn}.sketch-overlay-B5{fill:url(#streaks-bright-d2-790283124);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright-d2-790283124);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-normal-d2-790283124);mix-blend-mode:color-burn}.sketch-overlay-AA4{fill:url(#streaks-normal-d2-790283124);mix-blend-mode:color-burn}.sketch-overlay-AA5{fill:url(#streaks-bright-d2-790283124);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-normal-d2-790283124);mix-blend-mode:color-burn}.sketch-overlay-AB5{fill:url(#streaks-bright-d2-790283124);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker-d2-790283124);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark-d2-790283124);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal-d2-790283124);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal-d2-790283124);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-normal-d2-790283124);mix-blend-mode:color-burn}.sketch-overlay-N6{fill:url(#streaks-bright-d2-790283124);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright-d2-790283124);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]></style><g class="Y2xpZW50"><g class="shape" ><rect x="12.000000" y="52.000000" width="100.000000" height="66.000000" stroke="#336699" fill="#e0f0ff" class=" stroke-B1 fill-B5" style="stroke-width:2;" /></g><text x="62.000000" y="90.500000" fill="#303030" class="text fill-N1" style="text-anchor:middle;font-size:16px">Client</text></g><g class="YnJva2Vy brown"><g class="shape" ><rect x="326.000000" y="52.000000" width="100.000000" height="66.000000" stroke="#cfb098" fill="#ffe0c9" style="stroke-width:2;" /></g><text x="376.000000" y="90.500000" fill="#303030" class="text fill-N1" style="text-anchor:middle;font-size:16px">Broker</text></g><g class="c2VydmVy"><g class="shape" ><rect x="640.000000" y="52.000000" width="100.000000" height="66.000000" stroke="#336699" fill="#e0f0ff" class=" stroke-B1 fill-B5" style="stroke-width:2;" /></g><text x="690.000000" y="90.500000" fill="#303030" class="text fill-N1" style="text-anchor:middle;font-size:16px">Server</text></g><g class="KGNsaWVudCAtLSApWzBd"><path d="M 62.000000 120.000000 L 62.000000 1411.000000" stroke="#6699cc" fill="none" class="connection stroke-B2" style="stroke-width:2;stroke-dasharray:12.000000,11.838767;" mask="url(#d2-790283124)" /></g><g class="KGJyb2tlciAtLSApWzBd"><path d="M 376.000000 120.000000 L 376.000000 1411.000000" stroke="#cfb098" fill="none" class="connection" style="stroke-width:2;stroke-dasharray:12.000000,11.838767;" mask="url(#d2-790283124)" /></g><g class="KHNlcnZlciAtLSApWzBd"><path d="M 690.000000 120.000000 L 690.000000 1411.000000" stroke="#6699cc" fill="none" class="connection stroke-B2" style="stroke-width:2;stroke-dasharray:12.000000,11.838767;" mask="url(#d2-790283124)" /></g><g class="JiMzOTtwcm92aXNpb24oJiMzNDtmb28vYmFyJiMzNDspJiMzOTs="><g class="shape blend" ><rect x="336.000000" y="175.000000" width="394.000000" height="92.000000" stroke="#336699" fill="#e0e0e0" class=" stroke-B1 fill-N5" style="stroke-width:0;" /></g><rect x="341.000000" y="180.000000" width="135.000000" height="21.000000" fill="#e0e0e0" class=" fill-N5" /><text x="408.500000" y="196.000000" fill="#303030" class="text fill-N1" style="text-anchor:middle;font-size:16px">provision("foo/bar")</text></g><g class="JiMzOTt0cmFuc2ZlcigmIzM0O2Zvby9iYXImIzM0OykmIzM5Ow=="><g class="shape blend" ><rect x="22.000000" y="312.000000" width="708.000000" height="1068.000000" stroke="#336699" fill="#e0e0e0" class=" stroke-B1 fill-N5" style="stroke-width:0;" /></g><rect x="27.000000" y="317.000000" width="126.000000" height="21.000000" fill="#e0e0e0" class=" fill-N5" /><text x="90.000000" y="333.000000" fill="#303030" class="text fill-N1" style="text-anchor:middle;font-size:16px">transfer("foo/bar")</text></g><g class="KHNlcnZlciAtJmd0OyBicm9rZXIpWzBd"><marker id="mk-d2-790283124-3488378134" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" fill="#336699" class="connection fill-B1" stroke-width="2" /> </marker><path d="M 688.000000 237.000000 L 380.000000 237.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-790283124-3488378134)" mask="url(#d2-790283124)" /><text x="533.000000" y="235.000000" fill="#606060" class="text-italic fill-N2" style="text-anchor:middle;font-size:16px"><tspan x="533.000000" dy="0.000000">op: subscribe</tspan><tspan x="533.000000" dy="18.500000">topic: foo/bar/resource-transfer/any</tspan></text></g><g class="KGNsaWVudCAtJmd0OyBicm9rZXIpWzBd"><path d="M 64.000000 374.000000 L 372.000000 374.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-790283124-3488378134)" mask="url(#d2-790283124)" /><text x="219.000000" y="372.000000" fill="#606060" class="text-italic fill-N2" style="text-anchor:middle;font-size:16px"><tspan x="219.000000" dy="0.000000">op: subscribe</tspan><tspan x="219.000000" dy="18.500000">topic: foo/bar/resource-transfer/XXX</tspan></text></g><g class="KGNsaWVudCAtJmd0OyBicm9rZXIpWzFd"><path d="M 64.000000 488.000000 L 372.000000 488.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-790283124-3488378134)" mask="url(#d2-790283124)" /><text x="219.000000" y="478.000000" fill="#606060" class="text-italic fill-N2" style="text-anchor:middle;font-size:16px"><tspan x="219.000000" dy="0.000000">op: publish</tspan><tspan x="219.000000" dy="17.666667">topic: foo/bar/resource-transfer/any</tspan><tspan x="219.000000" dy="17.666667">data: Resource-Transfer-Request</tspan></text></g><g class="KGJyb2tlciAtJmd0OyBzZXJ2ZXIpWzBd"><path d="M 378.000000 610.000000 L 686.000000 610.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-790283124-3488378134)" mask="url(#d2-790283124)" /><text x="533.000000" y="600.000000" fill="#606060" class="text-italic fill-N2" style="text-anchor:middle;font-size:16px"><tspan x="533.000000" dy="0.000000">op: publish</tspan><tspan x="533.000000" dy="17.666667">topic: foo/bar/resource-transfer/any</tspan><tspan x="533.000000" dy="17.666667">data: Resource-Transfer-Request</tspan></text></g><g class="KGJyb2tlciAmbHQ7LSBzZXJ2ZXIpWzBd"><marker id="mk-d2-790283124-2451250203" markerWidth="10.000000" markerHeight="12.000000" refX="3.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon points="10.000000,0.000000 0.000000,6.000000 10.000000,12.000000" fill="#336699" class="connection fill-B1" stroke-width="2" /> </marker><path d="M 380.000000 732.000000 L 688.000000 732.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-start="url(#mk-d2-790283124-2451250203)" mask="url(#d2-790283124)" /><text x="533.500000" y="722.000000" fill="#606060" class="text-italic fill-N2" style="text-anchor:middle;font-size:16px"><tspan x="533.500000" dy="0.000000">op: publish</tspan><tspan x="533.500000" dy="17.666667">topic: foo/bar/resource-response/XXX</tspan><tspan x="533.500000" dy="17.666667">data: Resource-Transfer-Response #1</tspan></text></g><g class="KGNsaWVudCAmbHQ7LSBicm9rZXIpWzBd"><path d="M 66.000000 854.000000 L 374.000000 854.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-start="url(#mk-d2-790283124-2451250203)" mask="url(#d2-790283124)" /><text x="219.500000" y="844.000000" fill="#606060" class="text-italic fill-N2" style="text-anchor:middle;font-size:16px"><tspan x="219.500000" dy="0.000000">op: publish</tspan><tspan x="219.500000" dy="17.666667">topic: foo/bar/resource-response/XXX</tspan><tspan x="219.500000" dy="17.666667">data: Resource-Transfer-Response #1</tspan></text></g><g class="KGJyb2tlciAmbHQ7LSBzZXJ2ZXIpWzFd"><path d="M 380.000000 976.000000 L 688.000000 976.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-start="url(#mk-d2-790283124-2451250203)" mask="url(#d2-790283124)" /><text x="533.000000" y="966.000000" fill="#606060" class="text-italic fill-N2" style="text-anchor:middle;font-size:16px"><tspan x="533.000000" dy="0.000000">op: publish</tspan><tspan x="533.000000" dy="17.666667">topic: foo/bar/resource-response/XXX</tspan><tspan x="533.000000" dy="17.666667">data: Resource-Transfer-Response #N</tspan></text></g><g class="KGNsaWVudCAmbHQ7LSBicm9rZXIpWzFd"><path d="M 66.000000 1098.000000 L 374.000000 1098.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-start="url(#mk-d2-790283124-2451250203)" mask="url(#d2-790283124)" /><text x="219.000000" y="1088.000000" fill="#606060" class="text-italic fill-N2" style="text-anchor:middle;font-size:16px"><tspan x="219.000000" dy="0.000000">op: publish</tspan><tspan x="219.000000" dy="17.666667">topic: foo/bar/resource-response/XXX</tspan><tspan x="219.000000" dy="17.666667">data: Resource-Transfer-Response #N</tspan></text></g><g class="KGJyb2tlciAmbHQ7LSBzZXJ2ZXIpWzJd"><path d="M 380.000000 1220.000000 L 688.000000 1220.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-start="url(#mk-d2-790283124-2451250203)" mask="url(#d2-790283124)" /><text x="533.000000" y="1210.000000" fill="#606060" class="text-italic fill-N2" style="text-anchor:middle;font-size:16px"><tspan x="533.000000" dy="0.000000">op: publish</tspan><tspan x="533.000000" dy="17.666667">topic: foo/bar/resource-response/XXX</tspan><tspan x="533.000000" dy="17.666667">data: Resource-Transfer-Response EoS</tspan></text></g><g class="KGNsaWVudCAmbHQ7LSBicm9rZXIpWzJd"><path d="M 66.000000 1342.000000 L 374.000000 1342.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-start="url(#mk-d2-790283124-2451250203)" mask="url(#d2-790283124)" /><text x="219.000000" y="1332.000000" fill="#606060" class="text-italic fill-N2" style="text-anchor:middle;font-size:16px"><tspan x="219.000000" dy="0.000000">op: publish</tspan><tspan x="219.000000" dy="17.666667">topic: foo/bar/resource-response/XXX</tspan><tspan x="219.000000" dy="17.666667">data: Resource-Transfer-Response EoS</tspan></text></g><mask id="d2-790283124" maskUnits="userSpaceOnUse" x="11" y="51" width="730" height="1362">
|
|
100
|
-
<rect x="11" y="51" width="
|
|
101
|
-
<rect x="
|
|
102
|
-
<rect x="
|
|
103
|
-
<rect x="
|
|
104
|
-
<rect x="
|
|
105
|
-
<rect x="
|
|
106
|
-
<rect x="
|
|
107
|
-
<rect x="
|
|
108
|
-
<rect x="
|
|
109
|
-
<rect x="404.000000" y="1194.000000" width="258" height="53" fill="black"></rect>
|
|
110
|
-
<rect x="90.000000" y="1316.000000" width="258" height="53" fill="black"></rect>
|
|
28
|
+
.d2-3961372893 .fill-N1{fill:#303030;}
|
|
29
|
+
.d2-3961372893 .fill-N2{fill:#606060;}
|
|
30
|
+
.d2-3961372893 .fill-N3{fill:#909090;}
|
|
31
|
+
.d2-3961372893 .fill-N4{fill:#c0c0c0;}
|
|
32
|
+
.d2-3961372893 .fill-N5{fill:#e0e0e0;}
|
|
33
|
+
.d2-3961372893 .fill-N6{fill:#f0f0f0;}
|
|
34
|
+
.d2-3961372893 .fill-N7{fill:#ffffff;}
|
|
35
|
+
.d2-3961372893 .fill-B1{fill:#336699;}
|
|
36
|
+
.d2-3961372893 .fill-B2{fill:#6699cc;}
|
|
37
|
+
.d2-3961372893 .fill-B3{fill:#99ccff;}
|
|
38
|
+
.d2-3961372893 .fill-B4{fill:#c0d0ff;}
|
|
39
|
+
.d2-3961372893 .fill-B5{fill:#e0f0ff;}
|
|
40
|
+
.d2-3961372893 .fill-B6{fill:#f0f8ff;}
|
|
41
|
+
.d2-3961372893 .fill-AA2{fill:#cfb098;}
|
|
42
|
+
.d2-3961372893 .fill-AA4{fill:#efd0b8;}
|
|
43
|
+
.d2-3961372893 .fill-AA5{fill:#ffe0c8;}
|
|
44
|
+
.d2-3961372893 .fill-AB4{fill:#efd0b8;}
|
|
45
|
+
.d2-3961372893 .fill-AB5{fill:#ffe0c8;}
|
|
46
|
+
.d2-3961372893 .stroke-N1{stroke:#303030;}
|
|
47
|
+
.d2-3961372893 .stroke-N2{stroke:#606060;}
|
|
48
|
+
.d2-3961372893 .stroke-N3{stroke:#909090;}
|
|
49
|
+
.d2-3961372893 .stroke-N4{stroke:#c0c0c0;}
|
|
50
|
+
.d2-3961372893 .stroke-N5{stroke:#e0e0e0;}
|
|
51
|
+
.d2-3961372893 .stroke-N6{stroke:#f0f0f0;}
|
|
52
|
+
.d2-3961372893 .stroke-N7{stroke:#ffffff;}
|
|
53
|
+
.d2-3961372893 .stroke-B1{stroke:#336699;}
|
|
54
|
+
.d2-3961372893 .stroke-B2{stroke:#6699cc;}
|
|
55
|
+
.d2-3961372893 .stroke-B3{stroke:#99ccff;}
|
|
56
|
+
.d2-3961372893 .stroke-B4{stroke:#c0d0ff;}
|
|
57
|
+
.d2-3961372893 .stroke-B5{stroke:#e0f0ff;}
|
|
58
|
+
.d2-3961372893 .stroke-B6{stroke:#f0f8ff;}
|
|
59
|
+
.d2-3961372893 .stroke-AA2{stroke:#cfb098;}
|
|
60
|
+
.d2-3961372893 .stroke-AA4{stroke:#efd0b8;}
|
|
61
|
+
.d2-3961372893 .stroke-AA5{stroke:#ffe0c8;}
|
|
62
|
+
.d2-3961372893 .stroke-AB4{stroke:#efd0b8;}
|
|
63
|
+
.d2-3961372893 .stroke-AB5{stroke:#ffe0c8;}
|
|
64
|
+
.d2-3961372893 .background-color-N1{background-color:#303030;}
|
|
65
|
+
.d2-3961372893 .background-color-N2{background-color:#606060;}
|
|
66
|
+
.d2-3961372893 .background-color-N3{background-color:#909090;}
|
|
67
|
+
.d2-3961372893 .background-color-N4{background-color:#c0c0c0;}
|
|
68
|
+
.d2-3961372893 .background-color-N5{background-color:#e0e0e0;}
|
|
69
|
+
.d2-3961372893 .background-color-N6{background-color:#f0f0f0;}
|
|
70
|
+
.d2-3961372893 .background-color-N7{background-color:#ffffff;}
|
|
71
|
+
.d2-3961372893 .background-color-B1{background-color:#336699;}
|
|
72
|
+
.d2-3961372893 .background-color-B2{background-color:#6699cc;}
|
|
73
|
+
.d2-3961372893 .background-color-B3{background-color:#99ccff;}
|
|
74
|
+
.d2-3961372893 .background-color-B4{background-color:#c0d0ff;}
|
|
75
|
+
.d2-3961372893 .background-color-B5{background-color:#e0f0ff;}
|
|
76
|
+
.d2-3961372893 .background-color-B6{background-color:#f0f8ff;}
|
|
77
|
+
.d2-3961372893 .background-color-AA2{background-color:#cfb098;}
|
|
78
|
+
.d2-3961372893 .background-color-AA4{background-color:#efd0b8;}
|
|
79
|
+
.d2-3961372893 .background-color-AA5{background-color:#ffe0c8;}
|
|
80
|
+
.d2-3961372893 .background-color-AB4{background-color:#efd0b8;}
|
|
81
|
+
.d2-3961372893 .background-color-AB5{background-color:#ffe0c8;}
|
|
82
|
+
.d2-3961372893 .color-N1{color:#303030;}
|
|
83
|
+
.d2-3961372893 .color-N2{color:#606060;}
|
|
84
|
+
.d2-3961372893 .color-N3{color:#909090;}
|
|
85
|
+
.d2-3961372893 .color-N4{color:#c0c0c0;}
|
|
86
|
+
.d2-3961372893 .color-N5{color:#e0e0e0;}
|
|
87
|
+
.d2-3961372893 .color-N6{color:#f0f0f0;}
|
|
88
|
+
.d2-3961372893 .color-N7{color:#ffffff;}
|
|
89
|
+
.d2-3961372893 .color-B1{color:#336699;}
|
|
90
|
+
.d2-3961372893 .color-B2{color:#6699cc;}
|
|
91
|
+
.d2-3961372893 .color-B3{color:#99ccff;}
|
|
92
|
+
.d2-3961372893 .color-B4{color:#c0d0ff;}
|
|
93
|
+
.d2-3961372893 .color-B5{color:#e0f0ff;}
|
|
94
|
+
.d2-3961372893 .color-B6{color:#f0f8ff;}
|
|
95
|
+
.d2-3961372893 .color-AA2{color:#cfb098;}
|
|
96
|
+
.d2-3961372893 .color-AA4{color:#efd0b8;}
|
|
97
|
+
.d2-3961372893 .color-AA5{color:#ffe0c8;}
|
|
98
|
+
.d2-3961372893 .color-AB4{color:#efd0b8;}
|
|
99
|
+
.d2-3961372893 .color-AB5{color:#ffe0c8;}.appendix text.text{fill:#303030}.md{--color-fg-default:#303030;--color-fg-muted:#606060;--color-fg-subtle:#909090;--color-canvas-default:#ffffff;--color-canvas-subtle:#f0f0f0;--color-border-default:#336699;--color-border-muted:#6699cc;--color-neutral-muted:#f0f0f0;--color-accent-fg:#6699cc;--color-accent-emphasis:#6699cc;--color-attention-subtle:#606060;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-dark-d2-3961372893);mix-blend-mode:overlay}.sketch-overlay-B2{fill:url(#streaks-normal-d2-3961372893);mix-blend-mode:color-burn}.sketch-overlay-B3{fill:url(#streaks-normal-d2-3961372893);mix-blend-mode:color-burn}.sketch-overlay-B4{fill:url(#streaks-normal-d2-3961372893);mix-blend-mode:color-burn}.sketch-overlay-B5{fill:url(#streaks-bright-d2-3961372893);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright-d2-3961372893);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-normal-d2-3961372893);mix-blend-mode:color-burn}.sketch-overlay-AA4{fill:url(#streaks-normal-d2-3961372893);mix-blend-mode:color-burn}.sketch-overlay-AA5{fill:url(#streaks-bright-d2-3961372893);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-normal-d2-3961372893);mix-blend-mode:color-burn}.sketch-overlay-AB5{fill:url(#streaks-bright-d2-3961372893);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker-d2-3961372893);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark-d2-3961372893);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal-d2-3961372893);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal-d2-3961372893);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-normal-d2-3961372893);mix-blend-mode:color-burn}.sketch-overlay-N6{fill:url(#streaks-bright-d2-3961372893);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright-d2-3961372893);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]></style><g class="Y2xpZW50"><g class="shape" ><rect x="12.000000" y="52.000000" width="100.000000" height="66.000000" stroke="#336699" fill="#e0f0ff" class=" stroke-B1 fill-B5" style="stroke-width:2;" /></g><text x="62.000000" y="90.500000" fill="#303030" class="text fill-N1" style="text-anchor:middle;font-size:16px">Client</text></g><g class="YnJva2Vy brown"><g class="shape" ><rect x="318.000000" y="52.000000" width="100.000000" height="66.000000" stroke="#cfb098" fill="#ffe0c9" style="stroke-width:2;" /></g><text x="368.000000" y="90.500000" fill="#303030" class="text fill-N1" style="text-anchor:middle;font-size:16px">Broker</text></g><g class="c2VydmVy"><g class="shape" ><rect x="624.000000" y="52.000000" width="100.000000" height="66.000000" stroke="#336699" fill="#e0f0ff" class=" stroke-B1 fill-B5" style="stroke-width:2;" /></g><text x="674.000000" y="90.500000" fill="#303030" class="text fill-N1" style="text-anchor:middle;font-size:16px">Server</text></g><g class="KGNsaWVudCAtLSApWzBd"><path d="M 62.000000 120.000000 L 62.000000 1167.000000" stroke="#6699cc" fill="none" class="connection stroke-B2" style="stroke-width:2;stroke-dasharray:12.000000,11.838767;" mask="url(#d2-3961372893)" /></g><g class="KGJyb2tlciAtLSApWzBd"><path d="M 368.000000 120.000000 L 368.000000 1167.000000" stroke="#cfb098" fill="none" class="connection" style="stroke-width:2;stroke-dasharray:12.000000,11.838767;" mask="url(#d2-3961372893)" /></g><g class="KHNlcnZlciAtLSApWzBd"><path d="M 674.000000 120.000000 L 674.000000 1167.000000" stroke="#6699cc" fill="none" class="connection stroke-B2" style="stroke-width:2;stroke-dasharray:12.000000,11.838767;" mask="url(#d2-3961372893)" /></g><g class="JiMzOTtwcm92aXNpb24oJiMzNDtmb28vYmFyJiMzNDspJiMzOTs="><g class="shape blend" ><rect x="328.000000" y="175.000000" width="386.000000" height="92.000000" stroke="#336699" fill="#e0e0e0" class=" stroke-B1 fill-N5" style="stroke-width:0;" /></g><rect x="333.000000" y="180.000000" width="135.000000" height="21.000000" fill="#e0e0e0" class=" fill-N5" /><text x="400.500000" y="196.000000" fill="#303030" class="text fill-N1" style="text-anchor:middle;font-size:16px">provision("foo/bar")</text></g><g class="JiMzOTt0cmFuc2ZlcigmIzM0O2Zvby9iYXImIzM0OykmIzM5Ow=="><g class="shape blend" ><rect x="22.000000" y="312.000000" width="692.000000" height="824.000000" stroke="#336699" fill="#e0e0e0" class=" stroke-B1 fill-N5" style="stroke-width:0;" /></g><rect x="27.000000" y="317.000000" width="126.000000" height="21.000000" fill="#e0e0e0" class=" fill-N5" /><text x="90.000000" y="333.000000" fill="#303030" class="text fill-N1" style="text-anchor:middle;font-size:16px">transfer("foo/bar")</text></g><g class="KHNlcnZlciAtJmd0OyBicm9rZXIpWzBd"><marker id="mk-d2-3961372893-3488378134" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" fill="#336699" class="connection fill-B1" stroke-width="2" /> </marker><path d="M 672.000000 237.000000 L 372.000000 237.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3961372893-3488378134)" mask="url(#d2-3961372893)" /><text x="521.000000" y="235.000000" fill="#606060" class="text-italic fill-N2" style="text-anchor:middle;font-size:16px"><tspan x="521.000000" dy="0.000000">op: subscribe</tspan><tspan x="521.000000" dy="18.500000">topic: foo/bar/resource-transfer/any</tspan></text></g><g class="KGNsaWVudCAtJmd0OyBicm9rZXIpWzBd"><path d="M 64.000000 374.000000 L 364.000000 374.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3961372893-3488378134)" mask="url(#d2-3961372893)" /><text x="215.000000" y="372.000000" fill="#606060" class="text-italic fill-N2" style="text-anchor:middle;font-size:16px"><tspan x="215.000000" dy="0.000000">op: subscribe</tspan><tspan x="215.000000" dy="18.500000">topic: foo/bar/resource-transfer/XXX</tspan></text></g><g class="KGNsaWVudCAtJmd0OyBicm9rZXIpWzFd"><path d="M 64.000000 488.000000 L 364.000000 488.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3961372893-3488378134)" mask="url(#d2-3961372893)" /><text x="215.000000" y="478.000000" fill="#606060" class="text-italic fill-N2" style="text-anchor:middle;font-size:16px"><tspan x="215.000000" dy="0.000000">op: publish</tspan><tspan x="215.000000" dy="17.666667">topic: foo/bar/resource-transfer/any</tspan><tspan x="215.000000" dy="17.666667">data: Resource-Transfer-Request</tspan></text></g><g class="KGJyb2tlciAtJmd0OyBzZXJ2ZXIpWzBd"><path d="M 370.000000 610.000000 L 670.000000 610.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3961372893-3488378134)" mask="url(#d2-3961372893)" /><text x="521.000000" y="600.000000" fill="#606060" class="text-italic fill-N2" style="text-anchor:middle;font-size:16px"><tspan x="521.000000" dy="0.000000">op: publish</tspan><tspan x="521.000000" dy="17.666667">topic: foo/bar/resource-transfer/any</tspan><tspan x="521.000000" dy="17.666667">data: Resource-Transfer-Request</tspan></text></g><g class="KGJyb2tlciAmbHQ7LSBzZXJ2ZXIpWzBd"><marker id="mk-d2-3961372893-2451250203" markerWidth="10.000000" markerHeight="12.000000" refX="3.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon points="10.000000,0.000000 0.000000,6.000000 10.000000,12.000000" fill="#336699" class="connection fill-B1" stroke-width="2" /> </marker><path d="M 372.000000 732.000000 L 672.000000 732.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-start="url(#mk-d2-3961372893-2451250203)" mask="url(#d2-3961372893)" /><text x="521.500000" y="722.000000" fill="#606060" class="text-italic fill-N2" style="text-anchor:middle;font-size:16px"><tspan x="521.500000" dy="0.000000">op: publish</tspan><tspan x="521.500000" dy="17.666667">topic: foo/bar/resource-response/XXX</tspan><tspan x="521.500000" dy="17.666667">data: Resource-Transfer-Response #1</tspan></text></g><g class="KGNsaWVudCAmbHQ7LSBicm9rZXIpWzBd"><path d="M 66.000000 854.000000 L 366.000000 854.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-start="url(#mk-d2-3961372893-2451250203)" mask="url(#d2-3961372893)" /><text x="215.500000" y="844.000000" fill="#606060" class="text-italic fill-N2" style="text-anchor:middle;font-size:16px"><tspan x="215.500000" dy="0.000000">op: publish</tspan><tspan x="215.500000" dy="17.666667">topic: foo/bar/resource-response/XXX</tspan><tspan x="215.500000" dy="17.666667">data: Resource-Transfer-Response #1</tspan></text></g><g class="KGJyb2tlciAmbHQ7LSBzZXJ2ZXIpWzFd"><path d="M 372.000000 976.000000 L 672.000000 976.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-start="url(#mk-d2-3961372893-2451250203)" mask="url(#d2-3961372893)" /><text x="521.000000" y="966.000000" fill="#606060" class="text-italic fill-N2" style="text-anchor:middle;font-size:16px"><tspan x="521.000000" dy="0.000000">op: publish</tspan><tspan x="521.000000" dy="17.666667">topic: foo/bar/resource-response/XXX</tspan><tspan x="521.000000" dy="17.666667">data: Resource-Transfer-Response #N</tspan></text></g><g class="KGNsaWVudCAmbHQ7LSBicm9rZXIpWzFd"><path d="M 66.000000 1098.000000 L 366.000000 1098.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-start="url(#mk-d2-3961372893-2451250203)" mask="url(#d2-3961372893)" /><text x="215.000000" y="1088.000000" fill="#606060" class="text-italic fill-N2" style="text-anchor:middle;font-size:16px"><tspan x="215.000000" dy="0.000000">op: publish</tspan><tspan x="215.000000" dy="17.666667">topic: foo/bar/resource-response/XXX</tspan><tspan x="215.000000" dy="17.666667">data: Resource-Transfer-Response #N</tspan></text></g><mask id="d2-3961372893" maskUnits="userSpaceOnUse" x="11" y="51" width="714" height="1118">
|
|
100
|
+
<rect x="11" y="51" width="714" height="1118" fill="white"></rect>
|
|
101
|
+
<rect x="400.000000" y="219.000000" width="242" height="37" fill="black"></rect>
|
|
102
|
+
<rect x="94.000000" y="356.000000" width="242" height="37" fill="black"></rect>
|
|
103
|
+
<rect x="94.000000" y="462.000000" width="242" height="53" fill="black"></rect>
|
|
104
|
+
<rect x="400.000000" y="584.000000" width="242" height="53" fill="black"></rect>
|
|
105
|
+
<rect x="397.000000" y="706.000000" width="249" height="53" fill="black"></rect>
|
|
106
|
+
<rect x="91.000000" y="828.000000" width="249" height="53" fill="black"></rect>
|
|
107
|
+
<rect x="396.000000" y="950.000000" width="250" height="53" fill="black"></rect>
|
|
108
|
+
<rect x="90.000000" y="1072.000000" width="250" height="53" fill="black"></rect>
|
|
111
109
|
</mask></svg></svg>
|
|
@@ -34,9 +34,10 @@ export declare class ResourceTransferRequest extends Base {
|
|
|
34
34
|
constructor(id: string, resource: string, params?: any[] | undefined, sender?: string, receiver?: string);
|
|
35
35
|
}
|
|
36
36
|
export declare class ResourceTransferResponse extends Base {
|
|
37
|
-
chunk: Buffer |
|
|
37
|
+
chunk: Buffer | undefined;
|
|
38
38
|
error: string | undefined;
|
|
39
|
-
|
|
39
|
+
final: boolean | undefined;
|
|
40
|
+
constructor(id: string, chunk: Buffer | undefined, error: string | undefined, final: boolean | undefined, sender?: string, receiver?: string);
|
|
40
41
|
}
|
|
41
42
|
export default class Msg {
|
|
42
43
|
makeEventEmission(id: string, event: string, params?: any[], sender?: string, receiver?: string): EventEmission;
|
|
@@ -44,7 +45,7 @@ export default class Msg {
|
|
|
44
45
|
makeServiceCallRequest(id: string, service: string, params?: any[], sender?: string, receiver?: string): ServiceCallRequest;
|
|
45
46
|
makeServiceCallResponse(id: string, result?: any, error?: string, sender?: string, receiver?: string): ServiceCallResponse;
|
|
46
47
|
makeResourceTransferRequest(id: string, resource: string, params?: any[], sender?: string, receiver?: string): ResourceTransferRequest;
|
|
47
|
-
makeResourceTransferResponse(id: string, chunk?: Buffer
|
|
48
|
+
makeResourceTransferResponse(id: string, chunk?: Buffer, error?: string, final?: boolean, sender?: string, receiver?: string): ResourceTransferResponse;
|
|
48
49
|
parse(obj: any): EventEmission | StreamTransfer | ServiceCallRequest | ServiceCallResponse | ResourceTransferRequest | ResourceTransferResponse;
|
|
49
50
|
}
|
|
50
51
|
export declare class MsgTrait<T extends APISchema = APISchema> extends CodecTrait<T> {
|
|
@@ -74,10 +74,11 @@ export class ResourceTransferRequest extends Base {
|
|
|
74
74
|
}
|
|
75
75
|
/* resource response */
|
|
76
76
|
export class ResourceTransferResponse extends Base {
|
|
77
|
-
constructor(id, chunk, error, sender, receiver) {
|
|
77
|
+
constructor(id, chunk, error, final, sender, receiver) {
|
|
78
78
|
super("resource-transfer-response", id, sender, receiver);
|
|
79
79
|
this.chunk = chunk;
|
|
80
80
|
this.error = error;
|
|
81
|
+
this.final = final;
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
84
|
/* utility class */
|
|
@@ -103,8 +104,8 @@ export default class Msg {
|
|
|
103
104
|
return new ResourceTransferRequest(id, resource, params, sender, receiver);
|
|
104
105
|
}
|
|
105
106
|
/* factory for resource response */
|
|
106
|
-
makeResourceTransferResponse(id, chunk, error, sender, receiver) {
|
|
107
|
-
return new ResourceTransferResponse(id, chunk, error, sender, receiver);
|
|
107
|
+
makeResourceTransferResponse(id, chunk, error, final, sender, receiver) {
|
|
108
|
+
return new ResourceTransferResponse(id, chunk, error, final, sender, receiver);
|
|
108
109
|
}
|
|
109
110
|
/* parse any object into typed object */
|
|
110
111
|
parse(obj) {
|
|
@@ -115,19 +116,20 @@ export default class Msg {
|
|
|
115
116
|
throw new Error("invalid object: missing or invalid \"type\" field");
|
|
116
117
|
if (!("id" in obj) || typeof obj.id !== "string")
|
|
117
118
|
throw new Error("invalid object: missing or invalid \"id\" field");
|
|
118
|
-
if (
|
|
119
|
+
if ("sender" in obj && obj.sender !== undefined && typeof obj.sender !== "string")
|
|
119
120
|
throw new Error("invalid object: invalid \"sender\" field");
|
|
120
121
|
if ("receiver" in obj && obj.receiver !== undefined && typeof obj.receiver !== "string")
|
|
121
122
|
throw new Error("invalid object: invalid \"receiver\" field");
|
|
122
123
|
/* dispatch according to type indication by field */
|
|
123
124
|
const anyFieldsExcept = (obj, allowed) => Object.keys(obj).some((key) => !allowed.includes(key));
|
|
125
|
+
const validParams = (obj) => obj.params === undefined || (typeof obj.params === "object" && Array.isArray(obj.params));
|
|
124
126
|
if (obj.type === "event-emission") {
|
|
125
127
|
/* detect and parse event emission */
|
|
126
128
|
if (typeof obj.event !== "string")
|
|
127
129
|
throw new Error("invalid EventEmission object: \"event\" field must be a string");
|
|
128
130
|
if (anyFieldsExcept(obj, ["type", "id", "event", "params", "sender", "receiver"]))
|
|
129
131
|
throw new Error("invalid EventEmission object: contains unknown fields");
|
|
130
|
-
if (
|
|
132
|
+
if (!validParams(obj))
|
|
131
133
|
throw new Error("invalid EventEmission object: \"params\" field must be an array");
|
|
132
134
|
return this.makeEventEmission(obj.id, obj.event, obj.params, obj.sender, obj.receiver);
|
|
133
135
|
}
|
|
@@ -139,7 +141,7 @@ export default class Msg {
|
|
|
139
141
|
throw new Error("invalid StreamTransfer object: contains unknown fields");
|
|
140
142
|
if (obj.chunk !== undefined && typeof obj.chunk !== "object")
|
|
141
143
|
throw new Error("invalid StreamTransfer object: \"chunk\" field must be an object or null");
|
|
142
|
-
if (
|
|
144
|
+
if (!validParams(obj))
|
|
143
145
|
throw new Error("invalid StreamTransfer object: \"params\" field must be an array");
|
|
144
146
|
return this.makeStreamTransfer(obj.id, obj.stream, obj.chunk, obj.params, obj.sender, obj.receiver);
|
|
145
147
|
}
|
|
@@ -149,7 +151,7 @@ export default class Msg {
|
|
|
149
151
|
throw new Error("invalid ServiceCallRequest object: \"service\" field must be a string");
|
|
150
152
|
if (anyFieldsExcept(obj, ["type", "id", "service", "params", "sender", "receiver"]))
|
|
151
153
|
throw new Error("invalid ServiceCallRequest object: contains unknown fields");
|
|
152
|
-
if (
|
|
154
|
+
if (!validParams(obj))
|
|
153
155
|
throw new Error("invalid ServiceCallRequest object: \"params\" field must be an array");
|
|
154
156
|
return this.makeServiceCallRequest(obj.id, obj.service, obj.params, obj.sender, obj.receiver);
|
|
155
157
|
}
|
|
@@ -165,18 +167,20 @@ export default class Msg {
|
|
|
165
167
|
throw new Error("invalid ResourceTransferRequest object: \"resource\" field must be a string");
|
|
166
168
|
if (anyFieldsExcept(obj, ["type", "id", "resource", "params", "sender", "receiver"]))
|
|
167
169
|
throw new Error("invalid ResourceTransferRequest object: contains unknown fields");
|
|
168
|
-
if (
|
|
170
|
+
if (!validParams(obj))
|
|
169
171
|
throw new Error("invalid ResourceTransferRequest object: \"params\" field must be an array");
|
|
170
172
|
return this.makeResourceTransferRequest(obj.id, obj.resource, obj.params, obj.sender, obj.receiver);
|
|
171
173
|
}
|
|
172
174
|
else if (obj.type === "resource-transfer-response") {
|
|
173
175
|
if (obj.chunk !== undefined && typeof obj.chunk !== "object")
|
|
174
|
-
throw new Error("invalid ResourceTransferResponse object: \"chunk\" field must be an object
|
|
176
|
+
throw new Error("invalid ResourceTransferResponse object: \"chunk\" field must be an object");
|
|
175
177
|
if (obj.error !== undefined && typeof obj.error !== "string")
|
|
176
178
|
throw new Error("invalid ResourceTransferResponse object: \"error\" field must be a string");
|
|
177
|
-
if (
|
|
179
|
+
if (obj.final !== undefined && typeof obj.final !== "boolean")
|
|
180
|
+
throw new Error("invalid ResourceTransferResponse object: \"final\" field must be a boolean");
|
|
181
|
+
if (anyFieldsExcept(obj, ["type", "id", "chunk", "error", "final", "sender", "receiver"]))
|
|
178
182
|
throw new Error("invalid ResourceTransferResponse object: contains unknown fields");
|
|
179
|
-
return this.makeResourceTransferResponse(obj.id, obj.chunk, obj.error, obj.sender, obj.receiver);
|
|
183
|
+
return this.makeResourceTransferResponse(obj.id, obj.chunk, obj.error, obj.final, obj.sender, obj.receiver);
|
|
180
184
|
}
|
|
181
185
|
else
|
|
182
186
|
throw new Error("invalid object: not of any known type");
|
|
@@ -102,15 +102,15 @@ export class ResourceTrait extends ServiceTrait {
|
|
|
102
102
|
const chunks = [];
|
|
103
103
|
this.fetchCallback.set(requestId, {
|
|
104
104
|
resource,
|
|
105
|
-
callback: (error, chunk) => {
|
|
105
|
+
callback: (error, chunk, final) => {
|
|
106
106
|
if (error !== undefined) {
|
|
107
107
|
cleanup();
|
|
108
108
|
reject(error);
|
|
109
109
|
}
|
|
110
|
-
else
|
|
111
|
-
if (chunk !==
|
|
110
|
+
else {
|
|
111
|
+
if (chunk !== undefined)
|
|
112
112
|
chunks.push(chunk);
|
|
113
|
-
|
|
113
|
+
if (final) {
|
|
114
114
|
cleanup();
|
|
115
115
|
resolve(Buffer.concat(chunks));
|
|
116
116
|
}
|
|
@@ -159,22 +159,19 @@ export class ResourceTrait extends ServiceTrait {
|
|
|
159
159
|
for (let i = 0; i < info.resource.byteLength; i += chunkSize) {
|
|
160
160
|
const size = Math.min(info.resource.byteLength - i, chunkSize);
|
|
161
161
|
const chunk = info.resource.subarray(i, i + size);
|
|
162
|
+
const final = (i + size >= info.resource.byteLength);
|
|
162
163
|
/* generate encoded message */
|
|
163
|
-
const request = this.msg.makeResourceTransferResponse(requestId, chunk, undefined, this.options.id, sender);
|
|
164
|
+
const request = this.msg.makeResourceTransferResponse(requestId, chunk, undefined, final, this.options.id, sender);
|
|
164
165
|
const message = this.codec.encode(request);
|
|
165
166
|
/* publish message to MQTT topic */
|
|
166
167
|
this.mqtt.publish(topic, message, { qos: 2 });
|
|
167
168
|
}
|
|
168
|
-
/* send "null" chunk to signal end of stream */
|
|
169
|
-
const request = this.msg.makeResourceTransferResponse(requestId, null, undefined, this.options.id, sender);
|
|
170
|
-
const message = this.codec.encode(request);
|
|
171
|
-
this.mqtt.publish(topic, message, { qos: 2 });
|
|
172
169
|
})
|
|
173
170
|
.catch((err) => {
|
|
174
171
|
/* generate corresponding MQTT topic */
|
|
175
172
|
const topic = this.options.topicMake(resource, "resource-transfer-response", sender);
|
|
176
173
|
/* send error */
|
|
177
|
-
const request = this.msg.makeResourceTransferResponse(requestId,
|
|
174
|
+
const request = this.msg.makeResourceTransferResponse(requestId, undefined, err.message, true, this.options.id, sender);
|
|
178
175
|
const message = this.codec.encode(request);
|
|
179
176
|
this.mqtt.publish(topic, message, { qos: 2 });
|
|
180
177
|
});
|
|
@@ -186,11 +183,12 @@ export class ResourceTrait extends ServiceTrait {
|
|
|
186
183
|
/* handle resource response */
|
|
187
184
|
const requestId = parsed.id;
|
|
188
185
|
const error = parsed.error;
|
|
186
|
+
const final = parsed.final;
|
|
189
187
|
let chunk = parsed.chunk;
|
|
190
|
-
if (chunk !==
|
|
188
|
+
if (chunk !== undefined && !Buffer.isBuffer(chunk))
|
|
191
189
|
chunk = Buffer.from(chunk);
|
|
192
190
|
const handler = this.fetchCallback.get(requestId);
|
|
193
|
-
handler?.callback(error ? new Error(error) : undefined, chunk);
|
|
191
|
+
handler?.callback(error ? new Error(error) : undefined, chunk, final);
|
|
194
192
|
}
|
|
195
193
|
}
|
|
196
194
|
}
|