@synnaxlabs/client 0.18.3 → 0.20.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/.turbo/turbo-build.log +5 -5
- package/README.md +1 -1
- package/dist/auth/auth.d.ts +1 -0
- package/dist/auth/auth.d.ts.map +1 -0
- package/dist/auth/auth.spec.d.ts +1 -0
- package/dist/auth/auth.spec.d.ts.map +1 -0
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/channel/batchRetriever.spec.d.ts +1 -0
- package/dist/channel/batchRetriever.spec.d.ts.map +1 -0
- package/dist/channel/channel.spec.d.ts +1 -0
- package/dist/channel/channel.spec.d.ts.map +1 -0
- package/dist/channel/client.d.ts +9 -7
- package/dist/channel/client.d.ts.map +1 -0
- package/dist/channel/external.d.ts +2 -1
- package/dist/channel/external.d.ts.map +1 -0
- package/dist/channel/index.d.ts +1 -0
- package/dist/channel/index.d.ts.map +1 -0
- package/dist/channel/payload.d.ts +3 -3
- package/dist/channel/payload.d.ts.map +1 -0
- package/dist/channel/retriever.d.ts +1 -0
- package/dist/channel/retriever.d.ts.map +1 -0
- package/dist/channel/writer.d.ts +22 -0
- package/dist/channel/writer.d.ts.map +1 -0
- package/dist/client.cjs +18 -18
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +3 -3
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +8285 -8248
- package/dist/client.js.map +1 -1
- package/dist/connection/checker.d.ts +1 -0
- package/dist/connection/checker.d.ts.map +1 -0
- package/dist/connection/connection.spec.d.ts +1 -0
- package/dist/connection/connection.spec.d.ts.map +1 -0
- package/dist/connection/index.d.ts +1 -0
- package/dist/connection/index.d.ts.map +1 -0
- package/dist/control/authority.d.ts +1 -0
- package/dist/control/authority.d.ts.map +1 -0
- package/dist/control/external.d.ts +1 -0
- package/dist/control/external.d.ts.map +1 -0
- package/dist/control/index.d.ts +1 -0
- package/dist/control/index.d.ts.map +1 -0
- package/dist/control/state.d.ts +1 -0
- package/dist/control/state.d.ts.map +1 -0
- package/dist/control/state.spec.d.ts +1 -0
- package/dist/control/state.spec.d.ts.map +1 -0
- package/dist/errors.d.ts +3 -2
- package/dist/errors.d.ts.map +1 -0
- package/dist/framer/adapter.d.ts +1 -0
- package/dist/framer/adapter.d.ts.map +1 -0
- package/dist/framer/adapter.spec.d.ts +1 -0
- package/dist/framer/adapter.spec.d.ts.map +1 -0
- package/dist/framer/client.d.ts +9 -15
- package/dist/framer/client.d.ts.map +1 -0
- package/dist/framer/client.spec.d.ts +2 -0
- package/dist/framer/client.spec.d.ts.map +1 -0
- package/dist/framer/external.d.ts +1 -0
- package/dist/framer/external.d.ts.map +1 -0
- package/dist/framer/frame.d.ts +25 -24
- package/dist/framer/frame.d.ts.map +1 -0
- package/dist/framer/frame.spec.d.ts +1 -0
- package/dist/framer/frame.spec.d.ts.map +1 -0
- package/dist/framer/index.d.ts +1 -0
- package/dist/framer/index.d.ts.map +1 -0
- package/dist/framer/iterator.d.ts +3 -2
- package/dist/framer/iterator.d.ts.map +1 -0
- package/dist/framer/iterator.spec.d.ts +1 -0
- package/dist/framer/iterator.spec.d.ts.map +1 -0
- package/dist/framer/streamProxy.d.ts +1 -0
- package/dist/framer/streamProxy.d.ts.map +1 -0
- package/dist/framer/streamer.d.ts +1 -0
- package/dist/framer/streamer.d.ts.map +1 -0
- package/dist/framer/streamer.spec.d.ts +1 -0
- package/dist/framer/streamer.spec.d.ts.map +1 -0
- package/dist/framer/writer.d.ts +21 -19
- package/dist/framer/writer.d.ts.map +1 -0
- package/dist/framer/writer.spec.d.ts +1 -0
- package/dist/framer/writer.spec.d.ts.map +1 -0
- package/dist/hardware/client.d.ts +1 -0
- package/dist/hardware/client.d.ts.map +1 -0
- package/dist/hardware/device/client.d.ts +1 -0
- package/dist/hardware/device/client.d.ts.map +1 -0
- package/dist/hardware/device/device.spec.d.ts +1 -0
- package/dist/hardware/device/device.spec.d.ts.map +1 -0
- package/dist/hardware/device/external.d.ts +1 -0
- package/dist/hardware/device/external.d.ts.map +1 -0
- package/dist/hardware/device/index.d.ts +1 -0
- package/dist/hardware/device/index.d.ts.map +1 -0
- package/dist/hardware/device/payload.d.ts +1 -0
- package/dist/hardware/device/payload.d.ts.map +1 -0
- package/dist/hardware/device/retriever.d.ts +1 -0
- package/dist/hardware/device/retriever.d.ts.map +1 -0
- package/dist/hardware/device/writer.d.ts +1 -0
- package/dist/hardware/device/writer.d.ts.map +1 -0
- package/dist/hardware/external.d.ts +1 -0
- package/dist/hardware/external.d.ts.map +1 -0
- package/dist/hardware/index.d.ts +1 -0
- package/dist/hardware/index.d.ts.map +1 -0
- package/dist/hardware/rack/client.d.ts +1 -0
- package/dist/hardware/rack/client.d.ts.map +1 -0
- package/dist/hardware/rack/external.d.ts +1 -0
- package/dist/hardware/rack/external.d.ts.map +1 -0
- package/dist/hardware/rack/index.d.ts +1 -0
- package/dist/hardware/rack/index.d.ts.map +1 -0
- package/dist/hardware/rack/payload.d.ts +1 -0
- package/dist/hardware/rack/payload.d.ts.map +1 -0
- package/dist/hardware/rack/rack.spec.d.ts +1 -0
- package/dist/hardware/rack/rack.spec.d.ts.map +1 -0
- package/dist/hardware/rack/retriever.d.ts +1 -0
- package/dist/hardware/rack/retriever.d.ts.map +1 -0
- package/dist/hardware/rack/writer.d.ts +1 -0
- package/dist/hardware/rack/writer.d.ts.map +1 -0
- package/dist/hardware/task/client.d.ts +1 -0
- package/dist/hardware/task/client.d.ts.map +1 -0
- package/dist/hardware/task/external.d.ts +1 -0
- package/dist/hardware/task/external.d.ts.map +1 -0
- package/dist/hardware/task/index.d.ts +1 -0
- package/dist/hardware/task/index.d.ts.map +1 -0
- package/dist/hardware/task/payload.d.ts +1 -0
- package/dist/hardware/task/payload.d.ts.map +1 -0
- package/dist/hardware/task/retriever.d.ts +1 -0
- package/dist/hardware/task/retriever.d.ts.map +1 -0
- package/dist/hardware/task/task.spec.d.ts +1 -0
- package/dist/hardware/task/task.spec.d.ts.map +1 -0
- package/dist/hardware/task/writer.d.ts +1 -0
- package/dist/hardware/task/writer.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/label/client.d.ts +1 -0
- package/dist/label/client.d.ts.map +1 -0
- package/dist/label/external.d.ts +1 -0
- package/dist/label/external.d.ts.map +1 -0
- package/dist/label/index.d.ts +1 -0
- package/dist/label/index.d.ts.map +1 -0
- package/dist/label/label.spec.d.ts +1 -0
- package/dist/label/label.spec.d.ts.map +1 -0
- package/dist/label/payload.d.ts +1 -0
- package/dist/label/payload.d.ts.map +1 -0
- package/dist/label/retriever.d.ts +1 -0
- package/dist/label/retriever.d.ts.map +1 -0
- package/dist/label/writer.d.ts +1 -0
- package/dist/label/writer.d.ts.map +1 -0
- package/dist/ontology/client.d.ts +1 -0
- package/dist/ontology/client.d.ts.map +1 -0
- package/dist/ontology/external.d.ts +1 -0
- package/dist/ontology/external.d.ts.map +1 -0
- package/dist/ontology/group/client.d.ts +1 -0
- package/dist/ontology/group/client.d.ts.map +1 -0
- package/dist/ontology/group/external.d.ts +1 -0
- package/dist/ontology/group/external.d.ts.map +1 -0
- package/dist/ontology/group/group.d.ts +1 -0
- package/dist/ontology/group/group.d.ts.map +1 -0
- package/dist/ontology/group/group.spec.d.ts +1 -0
- package/dist/ontology/group/group.spec.d.ts.map +1 -0
- package/dist/ontology/group/index.d.ts +1 -0
- package/dist/ontology/group/index.d.ts.map +1 -0
- package/dist/ontology/group/payload.d.ts +1 -0
- package/dist/ontology/group/payload.d.ts.map +1 -0
- package/dist/ontology/group/writer.d.ts +1 -0
- package/dist/ontology/group/writer.d.ts.map +1 -0
- package/dist/ontology/index.d.ts +1 -0
- package/dist/ontology/index.d.ts.map +1 -0
- package/dist/ontology/ontology.spec.d.ts +1 -0
- package/dist/ontology/ontology.spec.d.ts.map +1 -0
- package/dist/ontology/payload.d.ts +1 -0
- package/dist/ontology/payload.d.ts.map +1 -0
- package/dist/ontology/retriever.d.ts +1 -0
- package/dist/ontology/retriever.d.ts.map +1 -0
- package/dist/ontology/signals.d.ts +1 -0
- package/dist/ontology/signals.d.ts.map +1 -0
- package/dist/ontology/writer.d.ts +1 -0
- package/dist/ontology/writer.d.ts.map +1 -0
- package/dist/ranger/active.d.ts +1 -0
- package/dist/ranger/active.d.ts.map +1 -0
- package/dist/ranger/alias.d.ts +1 -0
- package/dist/ranger/alias.d.ts.map +1 -0
- package/dist/ranger/client.d.ts +1 -0
- package/dist/ranger/client.d.ts.map +1 -0
- package/dist/ranger/external.d.ts +1 -0
- package/dist/ranger/external.d.ts.map +1 -0
- package/dist/ranger/index.d.ts +1 -0
- package/dist/ranger/index.d.ts.map +1 -0
- package/dist/ranger/kv.d.ts +1 -0
- package/dist/ranger/kv.d.ts.map +1 -0
- package/dist/ranger/payload.d.ts +29 -28
- package/dist/ranger/payload.d.ts.map +1 -0
- package/dist/ranger/range.d.ts +1 -0
- package/dist/ranger/range.d.ts.map +1 -0
- package/dist/ranger/ranger.spec.d.ts +1 -0
- package/dist/ranger/ranger.spec.d.ts.map +1 -0
- package/dist/ranger/retriever.d.ts +1 -0
- package/dist/ranger/retriever.d.ts.map +1 -0
- package/dist/ranger/writer.d.ts +1 -0
- package/dist/ranger/writer.d.ts.map +1 -0
- package/dist/setupspecs.d.ts +1 -0
- package/dist/setupspecs.d.ts.map +1 -0
- package/dist/signals/external.d.ts +1 -0
- package/dist/signals/external.d.ts.map +1 -0
- package/dist/signals/index.d.ts +1 -0
- package/dist/signals/index.d.ts.map +1 -0
- package/dist/signals/observable.d.ts +1 -0
- package/dist/signals/observable.d.ts.map +1 -0
- package/dist/transport.d.ts +1 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/user/index.d.ts +1 -0
- package/dist/user/index.d.ts.map +1 -0
- package/dist/user/payload.d.ts +1 -0
- package/dist/user/payload.d.ts.map +1 -0
- package/dist/util/telem.d.ts +1 -0
- package/dist/util/telem.d.ts.map +1 -0
- package/dist/workspace/client.d.ts +1 -0
- package/dist/workspace/client.d.ts.map +1 -0
- package/dist/workspace/external.d.ts +1 -0
- package/dist/workspace/external.d.ts.map +1 -0
- package/dist/workspace/index.d.ts +1 -0
- package/dist/workspace/index.d.ts.map +1 -0
- package/dist/workspace/lineplot/client.d.ts +1 -0
- package/dist/workspace/lineplot/client.d.ts.map +1 -0
- package/dist/workspace/lineplot/external.d.ts +1 -0
- package/dist/workspace/lineplot/external.d.ts.map +1 -0
- package/dist/workspace/lineplot/index.d.ts +1 -0
- package/dist/workspace/lineplot/index.d.ts.map +1 -0
- package/dist/workspace/lineplot/linePlot.spec.d.ts +1 -0
- package/dist/workspace/lineplot/linePlot.spec.d.ts.map +1 -0
- package/dist/workspace/lineplot/payload.d.ts +1 -0
- package/dist/workspace/lineplot/payload.d.ts.map +1 -0
- package/dist/workspace/lineplot/retriever.d.ts +1 -0
- package/dist/workspace/lineplot/retriever.d.ts.map +1 -0
- package/dist/workspace/lineplot/writer.d.ts +1 -0
- package/dist/workspace/lineplot/writer.d.ts.map +1 -0
- package/dist/workspace/payload.d.ts +1 -0
- package/dist/workspace/payload.d.ts.map +1 -0
- package/dist/workspace/pid/client.d.ts +1 -0
- package/dist/workspace/pid/client.d.ts.map +1 -0
- package/dist/workspace/pid/external.d.ts +1 -0
- package/dist/workspace/pid/external.d.ts.map +1 -0
- package/dist/workspace/pid/index.d.ts +1 -0
- package/dist/workspace/pid/index.d.ts.map +1 -0
- package/dist/workspace/pid/payload.d.ts +1 -0
- package/dist/workspace/pid/payload.d.ts.map +1 -0
- package/dist/workspace/pid/pid.spec.d.ts +1 -0
- package/dist/workspace/pid/pid.spec.d.ts.map +1 -0
- package/dist/workspace/pid/retriever.d.ts +1 -0
- package/dist/workspace/pid/retriever.d.ts.map +1 -0
- package/dist/workspace/pid/writer.d.ts +1 -0
- package/dist/workspace/pid/writer.d.ts.map +1 -0
- package/dist/workspace/retriever.d.ts +1 -0
- package/dist/workspace/retriever.d.ts.map +1 -0
- package/dist/workspace/workspace.spec.d.ts +1 -0
- package/dist/workspace/workspace.spec.d.ts.map +1 -0
- package/dist/workspace/writer.d.ts +1 -0
- package/dist/workspace/writer.d.ts.map +1 -0
- package/examples/node/liveStream.js +1 -1
- package/examples/node/package-lock.json +46 -47
- package/examples/node/package.json +2 -2
- package/examples/node/streamWrite.js +1 -1
- package/package.json +11 -11
- package/src/channel/channel.spec.ts +27 -0
- package/src/channel/client.ts +19 -13
- package/src/channel/external.ts +1 -1
- package/src/channel/payload.ts +1 -11
- package/src/channel/retriever.ts +1 -1
- package/src/channel/writer.ts +63 -0
- package/src/client.ts +24 -27
- package/src/control/state.spec.ts +2 -2
- package/src/errors.ts +2 -2
- package/src/framer/client.spec.ts +63 -0
- package/src/framer/client.ts +46 -14
- package/src/framer/iterator.spec.ts +2 -2
- package/src/framer/iterator.ts +7 -2
- package/src/framer/streamer.spec.ts +4 -4
- package/src/framer/writer.spec.ts +6 -6
- package/src/framer/writer.ts +6 -1
- package/dist/channel/creator.d.ts +0 -8
- package/src/channel/creator.ts +0 -44
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"version": "1.0.0",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@synnaxlabs/client": "^0.
|
|
12
|
+
"@synnaxlabs/client": "^0.19.0"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"node_modules/@grpc/grpc-js": {
|
|
@@ -3653,35 +3653,23 @@
|
|
|
3653
3653
|
}
|
|
3654
3654
|
},
|
|
3655
3655
|
"node_modules/@synnaxlabs/client": {
|
|
3656
|
-
"version": "0.
|
|
3657
|
-
"resolved": "https://registry.npmjs.org/@synnaxlabs/client/-/client-0.
|
|
3658
|
-
"integrity": "sha512-
|
|
3656
|
+
"version": "0.19.0",
|
|
3657
|
+
"resolved": "https://registry.npmjs.org/@synnaxlabs/client/-/client-0.19.0.tgz",
|
|
3658
|
+
"integrity": "sha512-GS0TOznRbxMeRS1wMGo3tz91goM2tmaqN/QEUebfCY6UjTKAmLZEUKqtjQZGvrk/0k4euP5DoEf4i1YE0julCg==",
|
|
3659
3659
|
"dependencies": {
|
|
3660
|
-
"@synnaxlabs/freighter": "0.9.
|
|
3661
|
-
"@synnaxlabs/x": "0.15.
|
|
3660
|
+
"@synnaxlabs/freighter": "0.9.4",
|
|
3661
|
+
"@synnaxlabs/x": "0.15.4",
|
|
3662
3662
|
"async-mutex": "^0.4.0",
|
|
3663
3663
|
"zod": "3.22.4"
|
|
3664
3664
|
}
|
|
3665
3665
|
},
|
|
3666
|
-
"node_modules/@synnaxlabs/client/node_modules/@synnaxlabs/x": {
|
|
3667
|
-
"version": "0.15.2",
|
|
3668
|
-
"resolved": "https://registry.npmjs.org/@synnaxlabs/x/-/x-0.15.2.tgz",
|
|
3669
|
-
"integrity": "sha512-d0XP4tk7dx7847aeXppAFVCKLmPSGIWRnsyDvTkbU9rEZdt1XLnQh1+PoWBmlYUNtliGhcgOKkbCv3Tj9Di38Q==",
|
|
3670
|
-
"dependencies": {
|
|
3671
|
-
"async-mutex": "^0.4.0",
|
|
3672
|
-
"js-convert-case": "^4.2.0",
|
|
3673
|
-
"nanoid": "^5.0.2",
|
|
3674
|
-
"typescript": "^5.3.3",
|
|
3675
|
-
"zod": "3.22.4"
|
|
3676
|
-
}
|
|
3677
|
-
},
|
|
3678
3666
|
"node_modules/@synnaxlabs/freighter": {
|
|
3679
|
-
"version": "0.9.
|
|
3680
|
-
"resolved": "https://registry.npmjs.org/@synnaxlabs/freighter/-/freighter-0.9.
|
|
3681
|
-
"integrity": "sha512-
|
|
3667
|
+
"version": "0.9.4",
|
|
3668
|
+
"resolved": "https://registry.npmjs.org/@synnaxlabs/freighter/-/freighter-0.9.4.tgz",
|
|
3669
|
+
"integrity": "sha512-WgkpLPuJrX3DA5+6c3i+OGJ/aeTFcEVGb1vf1nz47GGzAMRI4LikVSvodG9FuM2i2oTWsdbJJJpweX84PKDRvw==",
|
|
3682
3670
|
"dependencies": {
|
|
3683
3671
|
"@synnaxlabs/alamos": "0.3.0",
|
|
3684
|
-
"@synnaxlabs/x": "0.15.
|
|
3672
|
+
"@synnaxlabs/x": "0.15.3",
|
|
3685
3673
|
"js-convert-case": "^4.2.0",
|
|
3686
3674
|
"node-fetch": "2.6.11",
|
|
3687
3675
|
"ws": "^8.15.1",
|
|
@@ -3691,14 +3679,25 @@
|
|
|
3691
3679
|
"node": ">=18"
|
|
3692
3680
|
}
|
|
3693
3681
|
},
|
|
3682
|
+
"node_modules/@synnaxlabs/freighter/node_modules/@synnaxlabs/x": {
|
|
3683
|
+
"version": "0.15.3",
|
|
3684
|
+
"resolved": "https://registry.npmjs.org/@synnaxlabs/x/-/x-0.15.3.tgz",
|
|
3685
|
+
"integrity": "sha512-gVIh1xSvvIlkuOr4QPMeFdzAStX+YhSjL2Pc7sytxDnm0iYhIJn+4kGSBE7GAqBqFbaeaIVNoo1Iif4v+mlYOg==",
|
|
3686
|
+
"dependencies": {
|
|
3687
|
+
"async-mutex": "^0.4.0",
|
|
3688
|
+
"js-convert-case": "^4.2.0",
|
|
3689
|
+
"nanoid": "^5.0.2",
|
|
3690
|
+
"typescript": "^5.3.3",
|
|
3691
|
+
"zod": "3.22.4"
|
|
3692
|
+
}
|
|
3693
|
+
},
|
|
3694
3694
|
"node_modules/@synnaxlabs/x": {
|
|
3695
|
-
"version": "0.15.
|
|
3696
|
-
"resolved": "https://registry.npmjs.org/@synnaxlabs/x/-/x-0.15.
|
|
3697
|
-
"integrity": "sha512-
|
|
3695
|
+
"version": "0.15.4",
|
|
3696
|
+
"resolved": "https://registry.npmjs.org/@synnaxlabs/x/-/x-0.15.4.tgz",
|
|
3697
|
+
"integrity": "sha512-uk9A+wDy5d0F3grB3M/sIxpetj7Zs06nMpgMw/6AKc7op+GWoqqh2ohhnV4LxEDtku9CfDYySa1OngtCGZKzDA==",
|
|
3698
3698
|
"dependencies": {
|
|
3699
3699
|
"async-mutex": "^0.4.0",
|
|
3700
3700
|
"js-convert-case": "^4.2.0",
|
|
3701
|
-
"msgpackr": "^1.9.9",
|
|
3702
3701
|
"nanoid": "^5.0.2",
|
|
3703
3702
|
"typescript": "^5.3.3",
|
|
3704
3703
|
"zod": "3.22.4"
|
|
@@ -3770,9 +3769,9 @@
|
|
|
3770
3769
|
}
|
|
3771
3770
|
},
|
|
3772
3771
|
"node_modules/@types/express-serve-static-core": {
|
|
3773
|
-
"version": "4.
|
|
3774
|
-
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.
|
|
3775
|
-
"integrity": "sha512-
|
|
3772
|
+
"version": "4.19.0",
|
|
3773
|
+
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.0.tgz",
|
|
3774
|
+
"integrity": "sha512-bGyep3JqPCRry1wq+O5n7oiBgGWmeIJXPjXXCo8EK0u8duZGSYar7cGqd3ML2JUsLGeB7fmc06KYo9fLGWqPvQ==",
|
|
3776
3775
|
"dependencies": {
|
|
3777
3776
|
"@types/node": "*",
|
|
3778
3777
|
"@types/qs": "*",
|
|
@@ -3898,9 +3897,9 @@
|
|
|
3898
3897
|
}
|
|
3899
3898
|
},
|
|
3900
3899
|
"node_modules/@types/node": {
|
|
3901
|
-
"version": "20.12.
|
|
3902
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.
|
|
3903
|
-
"integrity": "sha512-
|
|
3900
|
+
"version": "20.12.7",
|
|
3901
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.7.tgz",
|
|
3902
|
+
"integrity": "sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg==",
|
|
3904
3903
|
"dependencies": {
|
|
3905
3904
|
"undici-types": "~5.26.4"
|
|
3906
3905
|
}
|
|
@@ -3924,9 +3923,9 @@
|
|
|
3924
3923
|
}
|
|
3925
3924
|
},
|
|
3926
3925
|
"node_modules/@types/qs": {
|
|
3927
|
-
"version": "6.9.
|
|
3928
|
-
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.
|
|
3929
|
-
"integrity": "sha512-
|
|
3926
|
+
"version": "6.9.15",
|
|
3927
|
+
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.15.tgz",
|
|
3928
|
+
"integrity": "sha512-uXHQKES6DQKKCLh441Xv/dwxOq1TVS3JPUMlEqoEglvlhR6Mxnlew/Xq/LRVHpLyk7iK3zODe1qYHIMltO7XGg=="
|
|
3930
3929
|
},
|
|
3931
3930
|
"node_modules/@types/range-parser": {
|
|
3932
3931
|
"version": "1.2.7",
|
|
@@ -4426,9 +4425,9 @@
|
|
|
4426
4425
|
}
|
|
4427
4426
|
},
|
|
4428
4427
|
"node_modules/gaxios": {
|
|
4429
|
-
"version": "6.
|
|
4430
|
-
"resolved": "https://registry.npmjs.org/gaxios/-/gaxios-6.
|
|
4431
|
-
"integrity": "sha512-
|
|
4428
|
+
"version": "6.5.0",
|
|
4429
|
+
"resolved": "https://registry.npmjs.org/gaxios/-/gaxios-6.5.0.tgz",
|
|
4430
|
+
"integrity": "sha512-R9QGdv8j4/dlNoQbX3hSaK/S0rkMijqjVvW3YM06CoBdbU/VdKd159j4hePpng0KuE6Lh6JJ7UdmVGJZFcAG1w==",
|
|
4432
4431
|
"dependencies": {
|
|
4433
4432
|
"extend": "^3.0.2",
|
|
4434
4433
|
"https-proxy-agent": "^7.0.1",
|
|
@@ -4525,9 +4524,9 @@
|
|
|
4525
4524
|
}
|
|
4526
4525
|
},
|
|
4527
4526
|
"node_modules/joi": {
|
|
4528
|
-
"version": "17.
|
|
4529
|
-
"resolved": "https://registry.npmjs.org/joi/-/joi-17.
|
|
4530
|
-
"integrity": "sha512-
|
|
4527
|
+
"version": "17.13.0",
|
|
4528
|
+
"resolved": "https://registry.npmjs.org/joi/-/joi-17.13.0.tgz",
|
|
4529
|
+
"integrity": "sha512-9qcrTyoBmFZRNHeVP4edKqIUEgFzq7MHvTNSDuHSqkpOPtiBkgNgcmTSqmiw1kw9tdKaiddvIDv/eCJDxmqWCA==",
|
|
4531
4530
|
"dependencies": {
|
|
4532
4531
|
"@hapi/hoek": "^9.3.0",
|
|
4533
4532
|
"@hapi/topo": "^5.1.0",
|
|
@@ -4615,9 +4614,9 @@
|
|
|
4615
4614
|
}
|
|
4616
4615
|
},
|
|
4617
4616
|
"node_modules/nanoid": {
|
|
4618
|
-
"version": "5.0.
|
|
4619
|
-
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.0.
|
|
4620
|
-
"integrity": "sha512-
|
|
4617
|
+
"version": "5.0.7",
|
|
4618
|
+
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.0.7.tgz",
|
|
4619
|
+
"integrity": "sha512-oLxFY2gd2IqnjcYyOXD8XGCftpGtZP2AbHbOkthDkvRywH5ayNtPVy9YlOPcHckXzbLTCHpkb7FB+yuxKV13pQ==",
|
|
4621
4620
|
"funding": [
|
|
4622
4621
|
{
|
|
4623
4622
|
"type": "github",
|
|
@@ -4854,9 +4853,9 @@
|
|
|
4854
4853
|
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
|
|
4855
4854
|
},
|
|
4856
4855
|
"node_modules/typescript": {
|
|
4857
|
-
"version": "5.4.
|
|
4858
|
-
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.
|
|
4859
|
-
"integrity": "sha512-
|
|
4856
|
+
"version": "5.4.5",
|
|
4857
|
+
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz",
|
|
4858
|
+
"integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==",
|
|
4860
4859
|
"bin": {
|
|
4861
4860
|
"tsc": "bin/tsc",
|
|
4862
4861
|
"tsserver": "bin/tsserver"
|
|
@@ -48,7 +48,7 @@ const roughRate = Rate.hz(40);
|
|
|
48
48
|
// historical reads every 500 samples.
|
|
49
49
|
const commitInterval = 500;
|
|
50
50
|
|
|
51
|
-
const writer = await client.
|
|
51
|
+
const writer = await client.openWriter({
|
|
52
52
|
start,
|
|
53
53
|
channels: [timeChannel.key, dataChannel1.key, dataChannel2.key]
|
|
54
54
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synnaxlabs/client",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.20.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "The Client Library for Synnax",
|
|
7
7
|
"repository": "https://github.com/synnaxlabs/synnax/tree/main/client/ts",
|
|
@@ -16,21 +16,21 @@
|
|
|
16
16
|
"control systems"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"async-mutex": "^0.4.
|
|
19
|
+
"async-mutex": "^0.4.1",
|
|
20
20
|
"zod": "3.22.4",
|
|
21
21
|
"@synnaxlabs/freighter": "0.9.4",
|
|
22
|
-
"@synnaxlabs/x": "0.
|
|
22
|
+
"@synnaxlabs/x": "0.16.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@types/node": "^20.
|
|
26
|
-
"@vitest/coverage-v8": "
|
|
27
|
-
"eslint": "^8.
|
|
28
|
-
"typescript": "^5.
|
|
29
|
-
"vite": "
|
|
30
|
-
"vitest": "
|
|
25
|
+
"@types/node": "^20.12.7",
|
|
26
|
+
"@vitest/coverage-v8": "1.2.2",
|
|
27
|
+
"eslint": "^8.57.0",
|
|
28
|
+
"typescript": "^5.4.5",
|
|
29
|
+
"vite": "5.1.2",
|
|
30
|
+
"vitest": "1.2.2",
|
|
31
31
|
"@synnaxlabs/tsconfig": "0.0.2",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
32
|
+
"@synnaxlabs/vite-plugin": "0.0.1",
|
|
33
|
+
"eslint-config-synnaxlabs": "0.0.1"
|
|
34
34
|
},
|
|
35
35
|
"main": "dist/client.cjs",
|
|
36
36
|
"module": "dist/client.js",
|
|
@@ -193,4 +193,31 @@ describe("Channel", () => {
|
|
|
193
193
|
expect(retrieved.length).toBeGreaterThan(0);
|
|
194
194
|
retrieved.forEach((ch) => expect(ch.name).toEqual("test"));
|
|
195
195
|
});
|
|
196
|
+
|
|
197
|
+
describe("delete", async () => {
|
|
198
|
+
test("delete by key", async () => {
|
|
199
|
+
const channel = await client.channels.create({
|
|
200
|
+
name: "test",
|
|
201
|
+
leaseholder: 1,
|
|
202
|
+
rate: Rate.hz(1),
|
|
203
|
+
dataType: DataType.FLOAT32,
|
|
204
|
+
});
|
|
205
|
+
await client.channels.delete(channel.key);
|
|
206
|
+
await expect(
|
|
207
|
+
async () => await client.channels.retrieve(channel.key),
|
|
208
|
+
).rejects.toThrow(QueryError);
|
|
209
|
+
});
|
|
210
|
+
test("delete by name", async () => {
|
|
211
|
+
const channel = await client.channels.create({
|
|
212
|
+
name: "test",
|
|
213
|
+
leaseholder: 1,
|
|
214
|
+
rate: Rate.hz(1),
|
|
215
|
+
dataType: DataType.FLOAT32,
|
|
216
|
+
});
|
|
217
|
+
await client.channels.delete(["test"]);
|
|
218
|
+
await expect(
|
|
219
|
+
async () => await client.channels.retrieve(channel.key),
|
|
220
|
+
).rejects.toThrow(QueryError);
|
|
221
|
+
});
|
|
222
|
+
});
|
|
196
223
|
});
|
package/src/channel/client.ts
CHANGED
|
@@ -13,14 +13,13 @@ import {
|
|
|
13
13
|
Rate,
|
|
14
14
|
type TypedArray,
|
|
15
15
|
type CrudeDensity,
|
|
16
|
-
type Series,
|
|
17
16
|
type TimeRange,
|
|
18
17
|
type AsyncTermSearcher,
|
|
19
18
|
toArray,
|
|
20
19
|
type CrudeTimeStamp,
|
|
20
|
+
type MultiSeries,
|
|
21
21
|
} from "@synnaxlabs/x";
|
|
22
22
|
|
|
23
|
-
import { type Creator } from "@/channel/creator";
|
|
24
23
|
import {
|
|
25
24
|
type Key,
|
|
26
25
|
type KeyOrName,
|
|
@@ -36,7 +35,8 @@ import {
|
|
|
36
35
|
DebouncedBatchRetriever,
|
|
37
36
|
type Retriever,
|
|
38
37
|
} from "@/channel/retriever";
|
|
39
|
-
import {
|
|
38
|
+
import { type Writer } from "@/channel/writer";
|
|
39
|
+
import { MultipleFoundError, NotFoundError, ValidationError } from "@/errors";
|
|
40
40
|
import { type framer } from "@/framer";
|
|
41
41
|
|
|
42
42
|
interface CreateOptions {
|
|
@@ -148,7 +148,7 @@ export class Channel {
|
|
|
148
148
|
* @param end - The ending timestamp of the range to read from.
|
|
149
149
|
* @returns A typed array containing the retrieved
|
|
150
150
|
*/
|
|
151
|
-
async read(tr: TimeRange): Promise<
|
|
151
|
+
async read(tr: TimeRange): Promise<MultiSeries> {
|
|
152
152
|
return await this.framer.read(tr, this.key);
|
|
153
153
|
}
|
|
154
154
|
|
|
@@ -159,7 +159,7 @@ export class Channel {
|
|
|
159
159
|
* @param data - THe telemetry to write to the channel.
|
|
160
160
|
*/
|
|
161
161
|
async write(start: CrudeTimeStamp, data: TypedArray): Promise<void> {
|
|
162
|
-
return await this.framer.write(this.key,
|
|
162
|
+
return await this.framer.write(start, this.key, data);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
|
|
@@ -170,20 +170,20 @@ export class Channel {
|
|
|
170
170
|
*/
|
|
171
171
|
export class Client implements AsyncTermSearcher<string, Key, Channel> {
|
|
172
172
|
private readonly frameClient: framer.Client;
|
|
173
|
-
readonly retriever: Retriever;
|
|
174
|
-
private readonly creator: Creator;
|
|
175
173
|
private readonly client: UnaryClient;
|
|
174
|
+
readonly retriever: Retriever;
|
|
175
|
+
readonly writer: Writer;
|
|
176
176
|
|
|
177
177
|
constructor(
|
|
178
178
|
frameClient: framer.Client,
|
|
179
179
|
retriever: Retriever,
|
|
180
180
|
client: UnaryClient,
|
|
181
|
-
|
|
181
|
+
writer: Writer,
|
|
182
182
|
) {
|
|
183
183
|
this.frameClient = frameClient;
|
|
184
184
|
this.retriever = retriever;
|
|
185
185
|
this.client = client;
|
|
186
|
-
this.
|
|
186
|
+
this.writer = writer;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
/**
|
|
@@ -261,7 +261,7 @@ export class Client implements AsyncTermSearcher<string, Key, Channel> {
|
|
|
261
261
|
toCreate = toCreate.filter((c) => !existingNames.has(c.name));
|
|
262
262
|
created = this.sugar(res);
|
|
263
263
|
}
|
|
264
|
-
created = created.concat(this.sugar(await this.
|
|
264
|
+
created = created.concat(this.sugar(await this.writer.create(toCreate)));
|
|
265
265
|
return single ? created[0] : created;
|
|
266
266
|
}
|
|
267
267
|
|
|
@@ -277,7 +277,7 @@ export class Client implements AsyncTermSearcher<string, Key, Channel> {
|
|
|
277
277
|
*
|
|
278
278
|
* @returns The retrieved channel.
|
|
279
279
|
* @throws {NotFoundError} if the channel does not exist in the cluster.
|
|
280
|
-
* @throws {
|
|
280
|
+
* @throws {MultipleFoundError} is only thrown if the channel is retrieved by name,
|
|
281
281
|
* and multiple channels with the same name exist in the cluster.
|
|
282
282
|
*
|
|
283
283
|
* @example
|
|
@@ -316,12 +316,18 @@ export class Client implements AsyncTermSearcher<string, Key, Channel> {
|
|
|
316
316
|
const res = this.sugar(await this.retriever.retrieve(channels, rangeKey));
|
|
317
317
|
if (!single) return res;
|
|
318
318
|
if (res.length === 0)
|
|
319
|
-
throw new
|
|
319
|
+
throw new NotFoundError(`channel matching ${actual} not found`);
|
|
320
320
|
if (res.length > 1)
|
|
321
|
-
throw new
|
|
321
|
+
throw new MultipleFoundError(`multiple channels matching ${actual} found`);
|
|
322
322
|
return res[0];
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
+
async delete(channels: Params): Promise<void> {
|
|
326
|
+
const { normalized, variant } = analyzeParams(channels);
|
|
327
|
+
if (variant === "keys") return await this.writer.delete({ keys: normalized });
|
|
328
|
+
return await this.writer.delete({ names: normalized });
|
|
329
|
+
}
|
|
330
|
+
|
|
325
331
|
async search(term: string, rangeKey?: string): Promise<Channel[]> {
|
|
326
332
|
return this.sugar(await this.retriever.search(term, rangeKey));
|
|
327
333
|
}
|
package/src/channel/external.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
|
-
export * from "@/channel/
|
|
10
|
+
export * from "@/channel/writer";
|
|
11
11
|
export * from "@/channel/client";
|
|
12
12
|
export * from "@/channel/payload";
|
|
13
13
|
export * from "@/channel/retriever";
|
package/src/channel/payload.ts
CHANGED
|
@@ -36,18 +36,8 @@ export const newPayload = payload.extend({
|
|
|
36
36
|
key: z.number().optional(),
|
|
37
37
|
leaseholder: z.number().optional(),
|
|
38
38
|
index: z.number().optional(),
|
|
39
|
-
rate: Rate.z.optional(),
|
|
39
|
+
rate: Rate.z.optional().default(0),
|
|
40
40
|
isIndex: z.boolean().optional(),
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
export type NewPayload = z.input<typeof newPayload>;
|
|
44
|
-
|
|
45
|
-
export const parseChannels = (channels: NewPayload[]): NewPayload[] =>
|
|
46
|
-
channels.map((channel) => ({
|
|
47
|
-
name: channel.name,
|
|
48
|
-
dataType: channel.dataType,
|
|
49
|
-
rate: channel.rate ?? 0,
|
|
50
|
-
leaseholder: channel.leaseholder,
|
|
51
|
-
index: channel.index,
|
|
52
|
-
isIndex: channel.isIndex,
|
|
53
|
-
}));
|
package/src/channel/retriever.ts
CHANGED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Copyright 2023 Synnax Labs, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Use of this software is governed by the Business Source License included in the file
|
|
4
|
+
// licenses/BSL.txt.
|
|
5
|
+
//
|
|
6
|
+
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
7
|
+
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
|
+
// included in the file licenses/APL.txt.
|
|
9
|
+
|
|
10
|
+
import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
type Payload,
|
|
15
|
+
payload,
|
|
16
|
+
newPayload,
|
|
17
|
+
type NewPayload,
|
|
18
|
+
keyZ,
|
|
19
|
+
} from "@/channel/payload";
|
|
20
|
+
|
|
21
|
+
const createReqZ = z.object({ channels: newPayload.array() });
|
|
22
|
+
const createResZ = z.object({ channels: payload.array() });
|
|
23
|
+
|
|
24
|
+
const deleteReqZ = z.object({
|
|
25
|
+
keys: keyZ.array().optional(),
|
|
26
|
+
names: z.string().array().optional(),
|
|
27
|
+
});
|
|
28
|
+
const deleteResZ = z.object({});
|
|
29
|
+
|
|
30
|
+
const CREATE_ENDPOINT = "/channel/create";
|
|
31
|
+
const DELETE_ENDPOINT = "/channel/delete";
|
|
32
|
+
|
|
33
|
+
export type DeleteProps = z.input<typeof deleteReqZ>;
|
|
34
|
+
|
|
35
|
+
export class Writer {
|
|
36
|
+
private readonly client: UnaryClient;
|
|
37
|
+
|
|
38
|
+
constructor(client: UnaryClient) {
|
|
39
|
+
this.client = client;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async create(channels: NewPayload[]): Promise<Payload[]> {
|
|
43
|
+
return (
|
|
44
|
+
await sendRequired<typeof createReqZ, typeof createResZ>(
|
|
45
|
+
this.client,
|
|
46
|
+
CREATE_ENDPOINT,
|
|
47
|
+
{ channels },
|
|
48
|
+
createReqZ,
|
|
49
|
+
createResZ,
|
|
50
|
+
)
|
|
51
|
+
).channels;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async delete(props: DeleteProps): Promise<void> {
|
|
55
|
+
await sendRequired<typeof deleteReqZ, typeof deleteResZ>(
|
|
56
|
+
this.client,
|
|
57
|
+
DELETE_ENDPOINT,
|
|
58
|
+
props,
|
|
59
|
+
deleteReqZ,
|
|
60
|
+
deleteResZ,
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
}
|
package/src/client.ts
CHANGED
|
@@ -47,10 +47,9 @@ export type ParsedSynnaxProps = z.output<typeof synnaxPropsZ>;
|
|
|
47
47
|
* @property ontology - Client for querying the cluster's ontology.
|
|
48
48
|
*/
|
|
49
49
|
// eslint-disable-next-line import/no-default-export
|
|
50
|
-
export default class Synnax {
|
|
50
|
+
export default class Synnax extends framer.Client {
|
|
51
51
|
readonly createdAt: TimeStamp;
|
|
52
52
|
readonly props: ParsedSynnaxProps;
|
|
53
|
-
readonly telem: framer.Client;
|
|
54
53
|
readonly ranges: ranger.Client;
|
|
55
54
|
readonly channels: channel.Client;
|
|
56
55
|
readonly auth: auth.Client | undefined;
|
|
@@ -77,42 +76,40 @@ export default class Synnax {
|
|
|
77
76
|
* A Synnax client must be closed when it is no longer needed. This will stop
|
|
78
77
|
* the client from polling the cluster for connectivity information.
|
|
79
78
|
*/
|
|
80
|
-
constructor(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const { host, port
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
this.transport.use(errorsMiddleware);
|
|
79
|
+
constructor(props_: SynnaxProps) {
|
|
80
|
+
const props = synnaxPropsZ.parse(props_);
|
|
81
|
+
const { host, port, username, password, connectivityPollFrequency, secure } = props;
|
|
82
|
+
const transport = new Transport(new URL({ host, port: Number(port) }), secure);
|
|
83
|
+
transport.use(errorsMiddleware);
|
|
84
|
+
let auth_: auth.Client | undefined;
|
|
87
85
|
if (username != null && password != null) {
|
|
88
|
-
|
|
86
|
+
const auth_ = new auth.Client(transport.unary, {
|
|
89
87
|
username,
|
|
90
88
|
password,
|
|
91
89
|
});
|
|
92
|
-
|
|
90
|
+
transport.use(auth_.middleware());
|
|
93
91
|
}
|
|
94
92
|
const chRetriever = new channel.CacheRetriever(
|
|
95
|
-
new channel.ClusterRetriever(
|
|
96
|
-
);
|
|
97
|
-
const chCreator = new channel.Creator(this.transport.unary);
|
|
98
|
-
this.telem = new framer.Client(this.transport.stream, chRetriever);
|
|
99
|
-
this.channels = new channel.Client(
|
|
100
|
-
this.telem,
|
|
101
|
-
chRetriever,
|
|
102
|
-
this.transport.unary,
|
|
103
|
-
chCreator,
|
|
93
|
+
new channel.ClusterRetriever(transport.unary),
|
|
104
94
|
);
|
|
95
|
+
const chCreator = new channel.Writer(transport.unary);
|
|
96
|
+
super(transport.stream, chRetriever);
|
|
97
|
+
this.createdAt = TimeStamp.now();
|
|
98
|
+
this.props = props;
|
|
99
|
+
this.auth = auth_;
|
|
100
|
+
this.transport = transport;
|
|
101
|
+
this.channels = new channel.Client(this, chRetriever, transport.unary, chCreator);
|
|
105
102
|
this.connectivity = new connection.Checker(
|
|
106
|
-
|
|
103
|
+
transport.unary,
|
|
107
104
|
connectivityPollFrequency,
|
|
108
105
|
props.name,
|
|
109
106
|
);
|
|
110
|
-
this.ontology = new ontology.Client(
|
|
111
|
-
const rangeRetriever = new ranger.Retriever(
|
|
107
|
+
this.ontology = new ontology.Client(transport.unary, this);
|
|
108
|
+
const rangeRetriever = new ranger.Retriever(transport.unary);
|
|
112
109
|
const rangeWriter = new ranger.Writer(this.transport.unary);
|
|
113
|
-
this.labels = new label.Client(this.transport.unary, this
|
|
110
|
+
this.labels = new label.Client(this.transport.unary, this);
|
|
114
111
|
this.ranges = new ranger.Client(
|
|
115
|
-
this
|
|
112
|
+
this,
|
|
116
113
|
rangeRetriever,
|
|
117
114
|
rangeWriter,
|
|
118
115
|
this.transport.unary,
|
|
@@ -123,7 +120,7 @@ export default class Synnax {
|
|
|
123
120
|
const devices = new device.Client(
|
|
124
121
|
new device.Retriever(this.transport.unary),
|
|
125
122
|
new device.Writer(this.transport.unary),
|
|
126
|
-
this
|
|
123
|
+
this,
|
|
127
124
|
);
|
|
128
125
|
const taskRetriever = new task.Retriever(this.transport.unary);
|
|
129
126
|
const taskWriter = new task.Writer(this.transport.unary);
|
|
@@ -131,7 +128,7 @@ export default class Synnax {
|
|
|
131
128
|
const racks = new rack.Client(
|
|
132
129
|
new rack.Retriever(this.transport.unary),
|
|
133
130
|
new rack.Writer(this.transport.unary),
|
|
134
|
-
this
|
|
131
|
+
this,
|
|
135
132
|
taskWriter,
|
|
136
133
|
taskRetriever,
|
|
137
134
|
);
|
|
@@ -16,9 +16,9 @@ const client = newClient();
|
|
|
16
16
|
|
|
17
17
|
describe("state", () => {
|
|
18
18
|
it("should receive the initial control state from the cluster", async () => {
|
|
19
|
-
const s = await control.StateTracker.open(client
|
|
19
|
+
const s = await control.StateTracker.open(client);
|
|
20
20
|
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
21
21
|
expect(s.states.size).toBeGreaterThan(0);
|
|
22
|
-
s.close();
|
|
22
|
+
await s.close();
|
|
23
23
|
});
|
|
24
24
|
});
|
package/src/errors.ts
CHANGED
|
@@ -95,9 +95,9 @@ export class UnexpectedError extends BaseError {
|
|
|
95
95
|
*/
|
|
96
96
|
export class QueryError extends BaseError {}
|
|
97
97
|
|
|
98
|
-
export class
|
|
98
|
+
export class NotFoundError extends QueryError {}
|
|
99
99
|
|
|
100
|
-
export class
|
|
100
|
+
export class MultipleFoundError extends QueryError {}
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
103
|
* RouteError is raised when a routing error occurs.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Copyright 2023 Synnax Labs, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Use of this software is governed by the Business Source License included in the file
|
|
4
|
+
// licenses/BSL.txt.
|
|
5
|
+
//
|
|
6
|
+
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
7
|
+
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
|
+
// included in the file licenses/APL.txt.
|
|
9
|
+
|
|
10
|
+
import { TimeSpan, TimeStamp } from "@synnaxlabs/x";
|
|
11
|
+
import { describe, expect, it } from "vitest";
|
|
12
|
+
|
|
13
|
+
import { newClient } from "@/setupspecs";
|
|
14
|
+
|
|
15
|
+
const client = newClient();
|
|
16
|
+
|
|
17
|
+
describe("Client", () => {
|
|
18
|
+
describe("read + write", () => {
|
|
19
|
+
it("should correctly write and read a frame of data", async () => {
|
|
20
|
+
const rand = `${TimeStamp.now().toString()}${Math.random()}`;
|
|
21
|
+
const time = await client.channels.create({
|
|
22
|
+
name: `time-${rand}`,
|
|
23
|
+
dataType: "timestamp",
|
|
24
|
+
isIndex: true,
|
|
25
|
+
});
|
|
26
|
+
const data = await client.channels.create({
|
|
27
|
+
name: `data-${rand}`,
|
|
28
|
+
dataType: "float32",
|
|
29
|
+
index: time.key,
|
|
30
|
+
});
|
|
31
|
+
const start = TimeStamp.now();
|
|
32
|
+
await client.write(start, {
|
|
33
|
+
[time.key]: [start],
|
|
34
|
+
[data.key]: [1],
|
|
35
|
+
});
|
|
36
|
+
const frame = await client.read(
|
|
37
|
+
{
|
|
38
|
+
start,
|
|
39
|
+
end: start.add(TimeSpan.seconds(1)),
|
|
40
|
+
},
|
|
41
|
+
[time.key, data.key],
|
|
42
|
+
);
|
|
43
|
+
expect(Array.from(frame.get(time.key))).toEqual([start.valueOf()]);
|
|
44
|
+
expect(Array.from(frame.get(data.key))).toEqual([1]);
|
|
45
|
+
});
|
|
46
|
+
it("should correctly write a single series of data", async () => {
|
|
47
|
+
const rand = `${TimeStamp.now().toString()}${Math.random()}`;
|
|
48
|
+
const time = await client.channels.create({
|
|
49
|
+
name: `time-${rand}`,
|
|
50
|
+
dataType: "timestamp",
|
|
51
|
+
isIndex: true,
|
|
52
|
+
});
|
|
53
|
+
const data = await client.channels.create({
|
|
54
|
+
name: `data-${rand}`,
|
|
55
|
+
dataType: "float32",
|
|
56
|
+
index: time.key,
|
|
57
|
+
});
|
|
58
|
+
const start = TimeStamp.now();
|
|
59
|
+
await client.write(start, time.key, TimeStamp.now());
|
|
60
|
+
await client.write(start, data.key, 1);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
});
|