@synnaxlabs/client 0.56.1 → 0.57.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/dist/client-B08VDLSA.js +14463 -0
- package/dist/client-B08VDLSA.js.map +1 -0
- package/dist/client.js +1128 -14876
- package/dist/client.js.map +1 -0
- package/dist/src/access/client.d.ts +10 -1
- package/dist/src/access/client.d.ts.map +1 -1
- package/dist/src/access/enforce.d.ts.map +1 -1
- package/dist/src/access/external.d.ts +1 -0
- package/dist/src/access/external.d.ts.map +1 -1
- package/dist/src/access/granted.d.ts +39 -0
- package/dist/src/access/granted.d.ts.map +1 -0
- package/dist/src/access/policy/client.d.ts +136 -147
- package/dist/src/access/policy/client.d.ts.map +1 -1
- package/dist/src/access/policy/types.gen.d.ts +15 -68
- package/dist/src/access/policy/types.gen.d.ts.map +1 -1
- package/dist/src/access/role/client.d.ts +77 -58
- package/dist/src/access/role/client.d.ts.map +1 -1
- package/dist/src/access/role/types.gen.d.ts +8 -14
- package/dist/src/access/role/types.gen.d.ts.map +1 -1
- package/dist/src/actions/actions.d.ts +5 -6
- package/dist/src/actions/actions.d.ts.map +1 -1
- package/dist/src/actions/controller.d.ts +194 -0
- package/dist/src/actions/controller.d.ts.map +1 -0
- package/dist/src/actions/external.d.ts +1 -0
- package/dist/src/actions/external.d.ts.map +1 -1
- package/dist/src/arc/actions.d.ts +575 -0
- package/dist/src/arc/actions.d.ts.map +1 -0
- package/dist/src/arc/actions.gen.d.ts +1439 -0
- package/dist/src/arc/actions.gen.d.ts.map +1 -0
- package/dist/src/arc/client.d.ts +97 -13
- package/dist/src/arc/client.d.ts.map +1 -1
- package/dist/src/arc/compiler/types.gen.d.ts +3 -3
- package/dist/src/arc/compiler/types.gen.d.ts.map +1 -1
- package/dist/src/arc/external.d.ts +2 -0
- package/dist/src/arc/external.d.ts.map +1 -1
- package/dist/src/arc/graph/types.gen.d.ts +45 -597
- package/dist/src/arc/graph/types.gen.d.ts.map +1 -1
- package/dist/src/arc/ir/index.d.ts +1 -1
- package/dist/src/arc/ir/index.d.ts.map +1 -1
- package/dist/src/arc/ir/ir.d.ts +2 -0
- package/dist/src/arc/ir/ir.d.ts.map +1 -0
- package/dist/src/arc/ir/types.gen.d.ts +58 -2807
- package/dist/src/arc/ir/types.gen.d.ts.map +1 -1
- package/dist/src/arc/module/types.gen.d.ts +18 -1090
- package/dist/src/arc/module/types.gen.d.ts.map +1 -1
- package/dist/src/arc/program/types.gen.d.ts +18 -1090
- package/dist/src/arc/program/types.gen.d.ts.map +1 -1
- package/dist/src/arc/text/types.gen.d.ts +54 -1
- package/dist/src/arc/text/types.gen.d.ts.map +1 -1
- package/dist/src/arc/types/types.gen.d.ts +35 -153
- package/dist/src/arc/types/types.gen.d.ts.map +1 -1
- package/dist/src/arc/types.gen.d.ts +98 -2278
- package/dist/src/arc/types.gen.d.ts.map +1 -1
- package/dist/src/auth/auth.d.ts +14 -2
- package/dist/src/auth/auth.d.ts.map +1 -1
- package/dist/src/channel/client.d.ts +113 -75
- package/dist/src/channel/client.d.ts.map +1 -1
- package/dist/src/channel/external.d.ts +0 -1
- package/dist/src/channel/external.d.ts.map +1 -1
- package/dist/src/channel/payload.d.ts +65 -56
- package/dist/src/channel/payload.d.ts.map +1 -1
- package/dist/src/channel/types.gen.d.ts +26 -73
- package/dist/src/channel/types.gen.d.ts.map +1 -1
- package/dist/src/channel/writer.d.ts +1 -3
- package/dist/src/channel/writer.d.ts.map +1 -1
- package/dist/src/client.d.ts +55 -27
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/connection/client.d.ts +146 -0
- package/dist/src/connection/client.d.ts.map +1 -0
- package/dist/src/connection/external.d.ts +3 -0
- package/dist/src/connection/external.d.ts.map +1 -0
- package/dist/src/connection/index.d.ts +1 -1
- package/dist/src/connection/index.d.ts.map +1 -1
- package/dist/src/connection/status.d.ts +252 -0
- package/dist/src/connection/status.d.ts.map +1 -0
- package/dist/src/control/client.d.ts +31 -7
- package/dist/src/control/client.d.ts.map +1 -1
- package/dist/src/control/state.d.ts +47 -16
- package/dist/src/control/state.d.ts.map +1 -1
- package/dist/src/device/client.d.ts +59 -17
- package/dist/src/device/client.d.ts.map +1 -1
- package/dist/src/device/types.gen.d.ts +17 -67
- package/dist/src/device/types.gen.d.ts.map +1 -1
- package/dist/src/errors.d.ts +17 -20
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/ethercat/external.d.ts +2 -0
- package/dist/src/ethercat/external.d.ts.map +1 -0
- package/dist/src/ethercat/index.d.ts +2 -0
- package/dist/src/ethercat/index.d.ts.map +1 -0
- package/dist/src/ethercat/types.gen.d.ts +243 -0
- package/dist/src/ethercat/types.gen.d.ts.map +1 -0
- package/dist/src/framer/adapter.d.ts +8 -5
- package/dist/src/framer/adapter.d.ts.map +1 -1
- package/dist/src/framer/benchutil.d.ts +19 -0
- package/dist/src/framer/benchutil.d.ts.map +1 -0
- package/dist/src/framer/cache/cache.d.ts +38 -0
- package/dist/src/framer/cache/cache.d.ts.map +1 -0
- package/dist/src/framer/cache/dynamic.d.ts +71 -0
- package/dist/src/framer/cache/dynamic.d.ts.map +1 -0
- package/dist/src/framer/cache/reader.d.ts +43 -0
- package/dist/src/framer/cache/reader.d.ts.map +1 -0
- package/dist/src/framer/cache/static.d.ts +66 -0
- package/dist/src/framer/cache/static.d.ts.map +1 -0
- package/dist/src/framer/cache/streamer.d.ts +86 -0
- package/dist/src/framer/cache/streamer.d.ts.map +1 -0
- package/dist/src/framer/cache/transform.d.ts +18 -0
- package/dist/src/framer/cache/transform.d.ts.map +1 -0
- package/dist/src/framer/cache/unary.d.ts +37 -0
- package/dist/src/framer/cache/unary.d.ts.map +1 -0
- package/dist/src/framer/client.d.ts +35 -14
- package/dist/src/framer/client.d.ts.map +1 -1
- package/dist/src/framer/codec.d.ts.map +1 -1
- package/dist/src/framer/deleter.d.ts +3 -2
- package/dist/src/framer/deleter.d.ts.map +1 -1
- package/dist/src/framer/external.d.ts +6 -0
- package/dist/src/framer/external.d.ts.map +1 -1
- package/dist/src/framer/feed.d.ts +40 -0
- package/dist/src/framer/feed.d.ts.map +1 -0
- package/dist/src/framer/frame.d.ts +16 -20
- package/dist/src/framer/frame.d.ts.map +1 -1
- package/dist/src/framer/hardened.d.ts +70 -0
- package/dist/src/framer/hardened.d.ts.map +1 -0
- package/dist/src/framer/iterator.d.ts +36 -43
- package/dist/src/framer/iterator.d.ts.map +1 -1
- package/dist/src/framer/reader.d.ts +3 -2
- package/dist/src/framer/reader.d.ts.map +1 -1
- package/dist/src/framer/streamer.d.ts +132 -205
- package/dist/src/framer/streamer.d.ts.map +1 -1
- package/dist/src/framer/writer.d.ts +130 -161
- package/dist/src/framer/writer.d.ts.map +1 -1
- package/dist/src/group/client.d.ts +66 -9
- package/dist/src/group/client.d.ts.map +1 -1
- package/dist/src/group/types.gen.d.ts +2 -2
- package/dist/src/http/external.d.ts +2 -0
- package/dist/src/http/external.d.ts.map +1 -0
- package/dist/src/http/index.d.ts +2 -0
- package/dist/src/http/index.d.ts.map +1 -0
- package/dist/src/http/types.gen.d.ts +451 -0
- package/dist/src/http/types.gen.d.ts.map +1 -0
- package/dist/src/imex/client.d.ts +88 -0
- package/dist/src/imex/client.d.ts.map +1 -0
- package/dist/src/imex/index.d.ts +2 -0
- package/dist/src/imex/index.d.ts.map +1 -0
- package/dist/src/index.d.ts +18 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/label/client.d.ts +55 -36
- package/dist/src/label/client.d.ts.map +1 -1
- package/dist/src/label/external.d.ts +2 -0
- package/dist/src/label/external.d.ts.map +1 -1
- package/dist/src/label/payload.d.ts +4 -46
- package/dist/src/label/payload.d.ts.map +1 -1
- package/dist/src/label/store.d.ts +8 -0
- package/dist/src/label/store.d.ts.map +1 -0
- package/dist/src/label/types.gen.d.ts +45 -0
- package/dist/src/label/types.gen.d.ts.map +1 -0
- package/dist/src/labjack/external.d.ts +2 -0
- package/dist/src/labjack/external.d.ts.map +1 -0
- package/dist/src/labjack/index.d.ts +2 -0
- package/dist/src/labjack/index.d.ts.map +1 -0
- package/dist/src/labjack/types.gen.d.ts +442 -0
- package/dist/src/labjack/types.gen.d.ts.map +1 -0
- package/dist/src/lineplot/actions.d.ts +914 -0
- package/dist/src/lineplot/actions.d.ts.map +1 -0
- package/dist/src/lineplot/actions.gen.d.ts +4208 -0
- package/dist/src/lineplot/actions.gen.d.ts.map +1 -0
- package/dist/src/lineplot/client.d.ts +66 -16
- package/dist/src/lineplot/client.d.ts.map +1 -1
- package/dist/src/lineplot/external.d.ts +3 -0
- package/dist/src/lineplot/external.d.ts.map +1 -1
- package/dist/src/lineplot/line.d.ts +16 -0
- package/dist/src/lineplot/line.d.ts.map +1 -0
- package/dist/src/lineplot/types.gen.d.ts +837 -14
- package/dist/src/lineplot/types.gen.d.ts.map +1 -1
- package/dist/src/log/actions.d.ts +271 -0
- package/dist/src/log/actions.d.ts.map +1 -0
- package/dist/src/log/actions.gen.d.ts +1529 -0
- package/dist/src/log/actions.gen.d.ts.map +1 -0
- package/dist/src/log/client.d.ts +66 -16
- package/dist/src/log/client.d.ts.map +1 -1
- package/dist/src/log/external.d.ts +2 -0
- package/dist/src/log/external.d.ts.map +1 -1
- package/dist/src/log/types.gen.d.ts +139 -14
- package/dist/src/log/types.gen.d.ts.map +1 -1
- package/dist/src/modbus/external.d.ts +2 -0
- package/dist/src/modbus/external.d.ts.map +1 -0
- package/dist/src/modbus/index.d.ts +2 -0
- package/dist/src/modbus/index.d.ts.map +1 -0
- package/dist/src/modbus/types.gen.d.ts +280 -0
- package/dist/src/modbus/types.gen.d.ts.map +1 -0
- package/dist/src/ni/external.d.ts +2 -0
- package/dist/src/ni/external.d.ts.map +1 -0
- package/dist/src/ni/index.d.ts +2 -0
- package/dist/src/ni/index.d.ts.map +1 -0
- package/dist/src/ni/types.gen.d.ts +21029 -0
- package/dist/src/ni/types.gen.d.ts.map +1 -0
- package/dist/src/node/index.d.ts +2 -0
- package/dist/src/node/index.d.ts.map +1 -0
- package/dist/src/node/types.gen.d.ts +4 -0
- package/dist/src/node/types.gen.d.ts.map +1 -0
- package/dist/src/ontology/client.d.ts +314 -67
- package/dist/src/ontology/client.d.ts.map +1 -1
- package/dist/src/ontology/external.d.ts +1 -0
- package/dist/src/ontology/external.d.ts.map +1 -1
- package/dist/src/ontology/payload.d.ts +60 -18
- package/dist/src/ontology/payload.d.ts.map +1 -1
- package/dist/src/ontology/store.d.ts +32 -0
- package/dist/src/ontology/store.d.ts.map +1 -0
- package/dist/src/ontology/types.gen.d.ts +3 -2
- package/dist/src/ontology/types.gen.d.ts.map +1 -1
- package/dist/src/ontology/writer.d.ts +16 -10
- package/dist/src/ontology/writer.d.ts.map +1 -1
- package/dist/src/opcua/external.d.ts +2 -0
- package/dist/src/opcua/external.d.ts.map +1 -0
- package/dist/src/opcua/index.d.ts +2 -0
- package/dist/src/opcua/index.d.ts.map +1 -0
- package/dist/src/opcua/types.gen.d.ts +82 -0
- package/dist/src/opcua/types.gen.d.ts.map +1 -0
- package/dist/src/pagerduty/external.d.ts +2 -0
- package/dist/src/pagerduty/external.d.ts.map +1 -0
- package/dist/src/pagerduty/index.d.ts +2 -0
- package/dist/src/pagerduty/index.d.ts.map +1 -0
- package/dist/src/pagerduty/types.gen.d.ts +30 -0
- package/dist/src/pagerduty/types.gen.d.ts.map +1 -0
- package/dist/src/panel/actions.d.ts +273 -0
- package/dist/src/panel/actions.d.ts.map +1 -0
- package/dist/src/panel/actions.gen.d.ts +1255 -0
- package/dist/src/panel/actions.gen.d.ts.map +1 -0
- package/dist/src/panel/client.d.ts +148 -0
- package/dist/src/panel/client.d.ts.map +1 -0
- package/dist/src/panel/external.d.ts +6 -0
- package/dist/src/panel/external.d.ts.map +1 -0
- package/dist/src/panel/index.d.ts +2 -0
- package/dist/src/panel/index.d.ts.map +1 -0
- package/dist/src/panel/tree.d.ts +50 -0
- package/dist/src/panel/tree.d.ts.map +1 -0
- package/dist/src/panel/types.gen.d.ts +370 -0
- package/dist/src/panel/types.gen.d.ts.map +1 -0
- package/dist/src/project/client.d.ts +89 -0
- package/dist/src/project/client.d.ts.map +1 -0
- package/dist/src/project/external.d.ts.map +1 -0
- package/dist/src/project/index.d.ts +2 -0
- package/dist/src/project/index.d.ts.map +1 -0
- package/dist/src/project/types.gen.d.ts +27 -0
- package/dist/src/project/types.gen.d.ts.map +1 -0
- package/dist/src/query/cache.d.ts +132 -0
- package/dist/src/query/cache.d.ts.map +1 -0
- package/dist/src/query/deleted.d.ts +20 -0
- package/dist/src/query/deleted.d.ts.map +1 -0
- package/dist/src/query/derived.d.ts +33 -0
- package/dist/src/query/derived.d.ts.map +1 -0
- package/dist/src/query/external.d.ts +10 -0
- package/dist/src/query/external.d.ts.map +1 -0
- package/dist/src/query/index.d.ts +2 -0
- package/dist/src/query/index.d.ts.map +1 -0
- package/dist/src/query/query.d.ts +235 -0
- package/dist/src/query/query.d.ts.map +1 -0
- package/dist/src/query/retriever.d.ts +135 -0
- package/dist/src/query/retriever.d.ts.map +1 -0
- package/dist/src/query/streamer.d.ts +67 -0
- package/dist/src/query/streamer.d.ts.map +1 -0
- package/dist/src/query/table.d.ts +219 -0
- package/dist/src/query/table.d.ts.map +1 -0
- package/dist/src/query/types.d.ts +35 -0
- package/dist/src/query/types.d.ts.map +1 -0
- package/dist/src/query/write.d.ts +21 -0
- package/dist/src/query/write.d.ts.map +1 -0
- package/dist/src/rack/client.d.ts +58 -20
- package/dist/src/rack/client.d.ts.map +1 -1
- package/dist/src/rack/types.gen.d.ts +11 -12
- package/dist/src/rack/types.gen.d.ts.map +1 -1
- package/dist/src/range/alias/types.gen.d.ts +2 -3
- package/dist/src/range/alias/types.gen.d.ts.map +1 -1
- package/dist/src/ranger/client.d.ts +138 -27
- package/dist/src/ranger/client.d.ts.map +1 -1
- package/dist/src/ranger/kv/client.d.ts +7 -4
- package/dist/src/ranger/kv/client.d.ts.map +1 -1
- package/dist/src/ranger/payload.d.ts +3 -0
- package/dist/src/ranger/payload.d.ts.map +1 -1
- package/dist/src/ranger/types.gen.d.ts +45 -101
- package/dist/src/ranger/types.gen.d.ts.map +1 -1
- package/dist/src/ranger/writer.d.ts +2 -74
- package/dist/src/ranger/writer.d.ts.map +1 -1
- package/dist/src/schematic/actions.d.ts +90 -33
- package/dist/src/schematic/actions.d.ts.map +1 -1
- package/dist/src/schematic/actions.gen.d.ts +207 -114
- package/dist/src/schematic/actions.gen.d.ts.map +1 -1
- package/dist/src/schematic/client.d.ts +70 -68
- package/dist/src/schematic/client.d.ts.map +1 -1
- package/dist/src/schematic/symbol/client.d.ts +133 -27
- package/dist/src/schematic/symbol/client.d.ts.map +1 -1
- package/dist/src/schematic/symbol/types.gen.d.ts +258 -153
- package/dist/src/schematic/symbol/types.gen.d.ts.map +1 -1
- package/dist/src/schematic/types.gen.d.ts +17 -96
- package/dist/src/schematic/types.gen.d.ts.map +1 -1
- package/dist/src/status/client.d.ts +69 -14
- package/dist/src/status/client.d.ts.map +1 -1
- package/dist/src/status/external.d.ts +2 -0
- package/dist/src/status/external.d.ts.map +1 -1
- package/dist/src/status/payload.d.ts +2 -36
- package/dist/src/status/payload.d.ts.map +1 -1
- package/dist/src/status/status.d.ts +65 -0
- package/dist/src/status/status.d.ts.map +1 -0
- package/dist/src/status/types.gen.d.ts +58 -0
- package/dist/src/status/types.gen.d.ts.map +1 -0
- package/dist/src/table/actions.d.ts +72 -13
- package/dist/src/table/actions.d.ts.map +1 -1
- package/dist/src/table/actions.gen.d.ts +221 -137
- package/dist/src/table/actions.gen.d.ts.map +1 -1
- package/dist/src/table/client.d.ts +64 -40
- package/dist/src/table/client.d.ts.map +1 -1
- package/dist/src/table/types.gen.d.ts +20 -55
- package/dist/src/table/types.gen.d.ts.map +1 -1
- package/dist/src/task/client.d.ts +149 -28
- package/dist/src/task/client.d.ts.map +1 -1
- package/dist/src/task/types.gen.d.ts +71 -89
- package/dist/src/task/types.gen.d.ts.map +1 -1
- package/dist/src/testutil/access.d.ts +27 -1
- package/dist/src/testutil/access.d.ts.map +1 -1
- package/dist/src/testutil/channels.d.ts +2 -0
- package/dist/src/testutil/channels.d.ts.map +1 -1
- package/dist/src/testutil/client.d.ts +5 -0
- package/dist/src/testutil/client.d.ts.map +1 -1
- package/dist/src/testutil/connection.d.ts +10 -0
- package/dist/src/testutil/connection.d.ts.map +1 -0
- package/dist/src/testutil/index.d.ts +9 -0
- package/dist/src/testutil/index.d.ts.map +1 -0
- package/dist/src/testutil/panels.d.ts +8 -0
- package/dist/src/testutil/panels.d.ts.map +1 -0
- package/dist/src/testutil/proxy.d.ts +29 -0
- package/dist/src/testutil/proxy.d.ts.map +1 -0
- package/dist/src/testutil/query.d.ts +7 -0
- package/dist/src/testutil/query.d.ts.map +1 -0
- package/dist/src/testutil/telem.d.ts +4 -0
- package/dist/src/testutil/telem.d.ts.map +1 -1
- package/dist/src/transport.d.ts +10 -4
- package/dist/src/transport.d.ts.map +1 -1
- package/dist/src/user/client.d.ts +29 -28
- package/dist/src/user/client.d.ts.map +1 -1
- package/dist/src/user/external.d.ts +1 -1
- package/dist/src/user/external.d.ts.map +1 -1
- package/dist/src/user/types.gen.d.ts +4 -4
- package/dist/src/util/retrieve.d.ts +2 -2
- package/dist/src/util/retrieve.d.ts.map +1 -1
- package/dist/src/util/telem.d.ts.map +1 -1
- package/dist/src/view/client.d.ts +30 -14
- package/dist/src/view/client.d.ts.map +1 -1
- package/dist/src/view/types.gen.d.ts +7 -15
- package/dist/src/view/types.gen.d.ts.map +1 -1
- package/dist/testutil.js +189 -0
- package/dist/testutil.js.map +1 -0
- package/package.json +40 -17
- package/src/access/client.ts +14 -3
- package/src/access/enforce.ts +0 -3
- package/src/access/external.ts +1 -0
- package/src/access/granted.ts +114 -0
- package/src/access/policy/client.ts +135 -43
- package/src/access/policy/types.gen.ts +9 -11
- package/src/access/role/client.ts +160 -38
- package/src/access/role/types.gen.ts +8 -12
- package/src/actions/actions.ts +5 -6
- package/src/actions/controller.ts +626 -0
- package/src/actions/external.ts +11 -0
- package/src/arc/actions.gen.ts +313 -0
- package/src/arc/actions.ts +192 -0
- package/src/arc/client.ts +424 -41
- package/src/arc/compiler/types.gen.ts +5 -6
- package/src/arc/external.ts +2 -0
- package/src/arc/graph/types.gen.ts +24 -22
- package/src/arc/ir/index.ts +1 -1
- package/{eslint.config.ts → src/arc/ir/ir.ts} +1 -4
- package/src/arc/ir/types.gen.ts +42 -41
- package/src/arc/text/types.gen.ts +21 -2
- package/src/arc/types/types.gen.ts +40 -32
- package/src/arc/types.gen.ts +31 -29
- package/src/auth/auth.ts +40 -8
- package/src/channel/client.ts +529 -132
- package/src/channel/external.ts +0 -1
- package/src/channel/payload.ts +30 -3
- package/src/channel/types.gen.ts +37 -48
- package/src/channel/writer.ts +2 -11
- package/src/client.ts +215 -91
- package/src/connection/client.ts +495 -0
- package/src/connection/external.ts +34 -0
- package/src/connection/index.ts +1 -1
- package/src/connection/status.ts +442 -0
- package/src/control/client.ts +84 -12
- package/src/control/state.ts +17 -36
- package/src/device/client.ts +293 -41
- package/src/device/types.gen.ts +15 -26
- package/src/errors.ts +45 -22
- package/src/{workspace → ethercat}/external.ts +1 -2
- package/src/{workspace → ethercat}/index.ts +1 -1
- package/src/ethercat/types.gen.ts +151 -0
- package/src/framer/adapter.ts +60 -37
- package/src/framer/benchutil.ts +67 -0
- package/src/framer/cache/cache.ts +115 -0
- package/src/framer/cache/dynamic.ts +279 -0
- package/src/framer/cache/reader.ts +160 -0
- package/src/framer/cache/static.ts +215 -0
- package/src/framer/cache/streamer.ts +391 -0
- package/src/framer/cache/transform.ts +31 -0
- package/src/framer/cache/unary.ts +104 -0
- package/src/framer/client.ts +71 -43
- package/src/framer/codec.ts +55 -18
- package/src/framer/deleter.ts +4 -6
- package/src/framer/external.ts +10 -0
- package/src/framer/feed.ts +108 -0
- package/src/framer/frame.ts +13 -23
- package/src/framer/hardened.ts +283 -0
- package/src/framer/iterator.ts +31 -42
- package/src/framer/reader.ts +11 -11
- package/src/framer/streamer.ts +18 -178
- package/src/framer/writer.ts +39 -59
- package/src/group/client.ts +158 -23
- package/src/http/external.ts +10 -0
- package/src/{cluster → http}/index.ts +1 -1
- package/src/http/types.gen.ts +245 -0
- package/src/imex/client.ts +125 -0
- package/src/imex/index.ts +10 -0
- package/src/index.ts +18 -6
- package/src/label/client.ts +193 -54
- package/src/label/external.ts +2 -0
- package/src/label/payload.ts +4 -9
- package/src/label/store.ts +28 -0
- package/src/label/types.gen.ts +31 -0
- package/src/labjack/external.ts +10 -0
- package/src/labjack/index.ts +10 -0
- package/src/labjack/types.gen.ts +251 -0
- package/src/lineplot/actions.gen.ts +880 -0
- package/src/lineplot/actions.ts +535 -0
- package/src/lineplot/client.ts +224 -52
- package/src/lineplot/external.ts +3 -0
- package/src/lineplot/line.ts +80 -0
- package/src/lineplot/types.gen.ts +225 -12
- package/src/log/actions.gen.ts +474 -0
- package/src/log/actions.ts +242 -0
- package/src/log/client.ts +223 -52
- package/src/log/external.ts +2 -0
- package/src/log/types.gen.ts +45 -14
- package/src/modbus/external.ts +10 -0
- package/src/modbus/index.ts +10 -0
- package/src/modbus/types.gen.ts +185 -0
- package/src/ni/external.ts +10 -0
- package/src/ni/index.ts +10 -0
- package/src/ni/types.gen.ts +1632 -0
- package/src/node/index.ts +10 -0
- package/src/{cluster → node}/types.gen.ts +2 -2
- package/src/ontology/client.ts +408 -99
- package/src/ontology/external.ts +7 -0
- package/src/ontology/payload.ts +48 -7
- package/src/ontology/store.ts +83 -0
- package/src/ontology/types.gen.ts +2 -1
- package/src/ontology/writer.ts +1 -0
- package/src/opcua/external.ts +10 -0
- package/src/opcua/index.ts +10 -0
- package/src/opcua/types.gen.ts +65 -0
- package/src/pagerduty/external.ts +10 -0
- package/src/pagerduty/index.ts +10 -0
- package/src/pagerduty/types.gen.ts +41 -0
- package/src/panel/actions.gen.ts +267 -0
- package/src/panel/actions.ts +357 -0
- package/src/panel/client.ts +327 -0
- package/src/panel/external.ts +14 -0
- package/src/panel/index.ts +10 -0
- package/src/panel/tree.ts +163 -0
- package/src/panel/types.gen.ts +164 -0
- package/src/project/client.ts +273 -0
- package/src/project/external.ts +11 -0
- package/src/project/index.ts +10 -0
- package/src/project/types.gen.ts +40 -0
- package/src/query/cache.ts +326 -0
- package/src/query/deleted.ts +38 -0
- package/src/query/derived.ts +101 -0
- package/src/query/external.ts +51 -0
- package/src/query/index.ts +10 -0
- package/src/query/query.ts +865 -0
- package/src/query/retriever.ts +308 -0
- package/src/query/streamer.ts +207 -0
- package/src/query/table.ts +625 -0
- package/src/query/types.ts +54 -0
- package/src/query/write.ts +42 -0
- package/src/rack/client.ts +233 -45
- package/src/rack/types.gen.ts +15 -16
- package/src/range/alias/types.gen.ts +2 -3
- package/src/ranger/client.ts +581 -70
- package/src/ranger/kv/client.ts +52 -21
- package/src/ranger/payload.ts +3 -0
- package/src/ranger/types.gen.ts +21 -23
- package/src/ranger/writer.ts +4 -8
- package/src/schematic/actions.gen.ts +62 -53
- package/src/schematic/actions.ts +44 -42
- package/src/schematic/client.ts +226 -70
- package/src/schematic/symbol/client.ts +277 -48
- package/src/schematic/symbol/types.gen.ts +22 -34
- package/src/schematic/types.gen.ts +22 -29
- package/src/status/client.ts +321 -44
- package/src/status/external.ts +2 -0
- package/src/status/payload.ts +1 -23
- package/src/status/status.ts +241 -0
- package/src/status/types.gen.ts +108 -0
- package/src/table/actions.gen.ts +96 -63
- package/src/table/actions.ts +44 -19
- package/src/table/client.ts +220 -56
- package/src/table/types.gen.ts +24 -31
- package/src/task/client.ts +580 -101
- package/src/task/types.gen.ts +68 -75
- package/src/testutil/access.ts +102 -6
- package/src/testutil/channels.ts +29 -0
- package/src/testutil/client.ts +27 -2
- package/src/testutil/connection.ts +47 -0
- package/src/testutil/index.ts +17 -0
- package/src/testutil/panels.ts +26 -0
- package/src/testutil/proxy.ts +106 -0
- package/src/testutil/query.ts +28 -0
- package/src/testutil/telem.ts +17 -1
- package/src/transport.ts +18 -7
- package/src/user/client.ts +165 -64
- package/src/user/external.ts +1 -1
- package/src/user/types.gen.ts +5 -5
- package/src/util/retrieve.ts +4 -4
- package/src/util/telem.ts +0 -1
- package/src/view/client.ts +120 -37
- package/src/view/types.gen.ts +8 -11
- package/.turbo/turbo-build.log +0 -20
- package/.vscode/settings.json +0 -3
- package/CONTRIBUTING.md +0 -47
- package/dist/client.cjs +0 -118
- package/dist/eslint.config.d.ts +0 -4
- package/dist/eslint.config.d.ts.map +0 -1
- package/dist/src/access/enforce.spec.d.ts +0 -2
- package/dist/src/access/enforce.spec.d.ts.map +0 -1
- package/dist/src/access/policy/access.spec.d.ts +0 -2
- package/dist/src/access/policy/access.spec.d.ts.map +0 -1
- package/dist/src/access/role/role.spec.d.ts +0 -2
- package/dist/src/access/role/role.spec.d.ts.map +0 -1
- package/dist/src/actions/actions.spec.d.ts +0 -2
- package/dist/src/actions/actions.spec.d.ts.map +0 -1
- package/dist/src/arc/access.spec.d.ts +0 -2
- package/dist/src/arc/access.spec.d.ts.map +0 -1
- package/dist/src/arc/arc.spec.d.ts +0 -2
- package/dist/src/arc/arc.spec.d.ts.map +0 -1
- package/dist/src/arc/lsp.spec.d.ts +0 -2
- package/dist/src/arc/lsp.spec.d.ts.map +0 -1
- package/dist/src/auth/auth.spec.d.ts +0 -2
- package/dist/src/auth/auth.spec.d.ts.map +0 -1
- package/dist/src/channel/access.spec.d.ts +0 -2
- package/dist/src/channel/access.spec.d.ts.map +0 -1
- package/dist/src/channel/batchRetriever.spec.d.ts +0 -2
- package/dist/src/channel/batchRetriever.spec.d.ts.map +0 -1
- package/dist/src/channel/channel.spec.d.ts +0 -2
- package/dist/src/channel/channel.spec.d.ts.map +0 -1
- package/dist/src/channel/payload.spec.d.ts +0 -2
- package/dist/src/channel/payload.spec.d.ts.map +0 -1
- package/dist/src/channel/retriever.d.ts +0 -64
- package/dist/src/channel/retriever.d.ts.map +0 -1
- package/dist/src/cluster/index.d.ts +0 -2
- package/dist/src/cluster/index.d.ts.map +0 -1
- package/dist/src/cluster/types.gen.d.ts +0 -4
- package/dist/src/cluster/types.gen.d.ts.map +0 -1
- package/dist/src/connection/checker.d.ts +0 -86
- package/dist/src/connection/checker.d.ts.map +0 -1
- package/dist/src/connection/connection.spec.d.ts +0 -2
- package/dist/src/connection/connection.spec.d.ts.map +0 -1
- package/dist/src/connection.spec.d.ts +0 -2
- package/dist/src/connection.spec.d.ts.map +0 -1
- package/dist/src/control/state.spec.d.ts +0 -2
- package/dist/src/control/state.spec.d.ts.map +0 -1
- package/dist/src/device/access.spec.d.ts +0 -2
- package/dist/src/device/access.spec.d.ts.map +0 -1
- package/dist/src/device/device.spec.d.ts +0 -2
- package/dist/src/device/device.spec.d.ts.map +0 -1
- package/dist/src/device/payload.spec.d.ts +0 -2
- package/dist/src/device/payload.spec.d.ts.map +0 -1
- package/dist/src/errors.spec.d.ts +0 -2
- package/dist/src/errors.spec.d.ts.map +0 -1
- package/dist/src/framer/adapter.spec.d.ts +0 -2
- package/dist/src/framer/adapter.spec.d.ts.map +0 -1
- package/dist/src/framer/client.spec.d.ts +0 -2
- package/dist/src/framer/client.spec.d.ts.map +0 -1
- package/dist/src/framer/codec.spec.d.ts +0 -2
- package/dist/src/framer/codec.spec.d.ts.map +0 -1
- package/dist/src/framer/deleter.spec.d.ts +0 -2
- package/dist/src/framer/deleter.spec.d.ts.map +0 -1
- package/dist/src/framer/frame.spec.d.ts +0 -2
- package/dist/src/framer/frame.spec.d.ts.map +0 -1
- package/dist/src/framer/iterator.spec.d.ts +0 -2
- package/dist/src/framer/iterator.spec.d.ts.map +0 -1
- package/dist/src/framer/reader.spec.d.ts +0 -2
- package/dist/src/framer/reader.spec.d.ts.map +0 -1
- package/dist/src/framer/streamer.spec.d.ts +0 -2
- package/dist/src/framer/streamer.spec.d.ts.map +0 -1
- package/dist/src/framer/writer.spec.d.ts +0 -2
- package/dist/src/framer/writer.spec.d.ts.map +0 -1
- package/dist/src/group/access.spec.d.ts +0 -2
- package/dist/src/group/access.spec.d.ts.map +0 -1
- package/dist/src/group/group.spec.d.ts +0 -2
- package/dist/src/group/group.spec.d.ts.map +0 -1
- package/dist/src/label/access.spec.d.ts +0 -2
- package/dist/src/label/access.spec.d.ts.map +0 -1
- package/dist/src/label/label.spec.d.ts +0 -2
- package/dist/src/label/label.spec.d.ts.map +0 -1
- package/dist/src/lineplot/access.spec.d.ts +0 -2
- package/dist/src/lineplot/access.spec.d.ts.map +0 -1
- package/dist/src/lineplot/lineplot.spec.d.ts +0 -2
- package/dist/src/lineplot/lineplot.spec.d.ts.map +0 -1
- package/dist/src/log/access.spec.d.ts +0 -2
- package/dist/src/log/access.spec.d.ts.map +0 -1
- package/dist/src/log/log.spec.d.ts +0 -2
- package/dist/src/log/log.spec.d.ts.map +0 -1
- package/dist/src/ontology/ontology.spec.d.ts +0 -2
- package/dist/src/ontology/ontology.spec.d.ts.map +0 -1
- package/dist/src/rack/access.spec.d.ts +0 -2
- package/dist/src/rack/access.spec.d.ts.map +0 -1
- package/dist/src/rack/rack.spec.d.ts +0 -2
- package/dist/src/rack/rack.spec.d.ts.map +0 -1
- package/dist/src/ranger/access.spec.d.ts +0 -2
- package/dist/src/ranger/access.spec.d.ts.map +0 -1
- package/dist/src/ranger/alias/payload.spec.d.ts +0 -2
- package/dist/src/ranger/alias/payload.spec.d.ts.map +0 -1
- package/dist/src/ranger/ranger.spec.d.ts +0 -2
- package/dist/src/ranger/ranger.spec.d.ts.map +0 -1
- package/dist/src/schematic/access.spec.d.ts +0 -2
- package/dist/src/schematic/access.spec.d.ts.map +0 -1
- package/dist/src/schematic/actions.spec.d.ts +0 -2
- package/dist/src/schematic/actions.spec.d.ts.map +0 -1
- package/dist/src/schematic/schematic.spec.d.ts +0 -2
- package/dist/src/schematic/schematic.spec.d.ts.map +0 -1
- package/dist/src/schematic/symbol/access.spec.d.ts +0 -2
- package/dist/src/schematic/symbol/access.spec.d.ts.map +0 -1
- package/dist/src/schematic/symbol/client.spec.d.ts +0 -2
- package/dist/src/schematic/symbol/client.spec.d.ts.map +0 -1
- package/dist/src/status/access.spec.d.ts +0 -2
- package/dist/src/status/access.spec.d.ts.map +0 -1
- package/dist/src/status/status.spec.d.ts +0 -2
- package/dist/src/status/status.spec.d.ts.map +0 -1
- package/dist/src/table/access.spec.d.ts +0 -2
- package/dist/src/table/access.spec.d.ts.map +0 -1
- package/dist/src/table/table.spec.d.ts +0 -2
- package/dist/src/table/table.spec.d.ts.map +0 -1
- package/dist/src/task/access.spec.d.ts +0 -2
- package/dist/src/task/access.spec.d.ts.map +0 -1
- package/dist/src/task/payload.spec.d.ts +0 -2
- package/dist/src/task/payload.spec.d.ts.map +0 -1
- package/dist/src/task/task.spec.d.ts +0 -2
- package/dist/src/task/task.spec.d.ts.map +0 -1
- package/dist/src/user/access.spec.d.ts +0 -2
- package/dist/src/user/access.spec.d.ts.map +0 -1
- package/dist/src/user/user.spec.d.ts +0 -2
- package/dist/src/user/user.spec.d.ts.map +0 -1
- package/dist/src/util/retrieve.spec.d.ts +0 -2
- package/dist/src/util/retrieve.spec.d.ts.map +0 -1
- package/dist/src/view/view.spec.d.ts +0 -2
- package/dist/src/view/view.spec.d.ts.map +0 -1
- package/dist/src/workspace/access.spec.d.ts +0 -2
- package/dist/src/workspace/access.spec.d.ts.map +0 -1
- package/dist/src/workspace/client.d.ts +0 -36
- package/dist/src/workspace/client.d.ts.map +0 -1
- package/dist/src/workspace/external.d.ts.map +0 -1
- package/dist/src/workspace/index.d.ts +0 -2
- package/dist/src/workspace/index.d.ts.map +0 -1
- package/dist/src/workspace/types.gen.d.ts +0 -34
- package/dist/src/workspace/types.gen.d.ts.map +0 -1
- package/dist/src/workspace/workspace.spec.d.ts +0 -2
- package/dist/src/workspace/workspace.spec.d.ts.map +0 -1
- package/examples/node/basicReadWrite.js +0 -86
- package/examples/node/createChannels.js +0 -50
- package/examples/node/createRange.js +0 -67
- package/examples/node/package-lock.json +0 -133
- package/examples/node/package.json +0 -17
- package/examples/node/readLatest.js +0 -76
- package/examples/node/seriesAndFrames.js +0 -173
- package/examples/node/streamRead.js +0 -50
- package/examples/node/streamWrite.js +0 -87
- package/src/access/enforce.spec.ts +0 -188
- package/src/access/policy/access.spec.ts +0 -147
- package/src/access/role/role.spec.ts +0 -95
- package/src/actions/actions.spec.ts +0 -229
- package/src/arc/access.spec.ts +0 -149
- package/src/arc/arc.spec.ts +0 -44
- package/src/arc/lsp.spec.ts +0 -717
- package/src/auth/auth.spec.ts +0 -101
- package/src/channel/access.spec.ts +0 -116
- package/src/channel/batchRetriever.spec.ts +0 -115
- package/src/channel/channel.spec.ts +0 -352
- package/src/channel/payload.spec.ts +0 -117
- package/src/channel/retriever.ts +0 -252
- package/src/connection/checker.ts +0 -203
- package/src/connection/connection.spec.ts +0 -152
- package/src/connection.spec.ts +0 -145
- package/src/control/state.spec.ts +0 -22
- package/src/device/access.spec.ts +0 -159
- package/src/device/device.spec.ts +0 -461
- package/src/device/payload.spec.ts +0 -142
- package/src/errors.spec.ts +0 -71
- package/src/framer/adapter.spec.ts +0 -620
- package/src/framer/client.spec.ts +0 -180
- package/src/framer/codec.spec.ts +0 -383
- package/src/framer/deleter.spec.ts +0 -103
- package/src/framer/frame.spec.ts +0 -973
- package/src/framer/iterator.spec.ts +0 -169
- package/src/framer/reader.spec.ts +0 -865
- package/src/framer/streamer.spec.ts +0 -871
- package/src/framer/writer.spec.ts +0 -486
- package/src/group/access.spec.ts +0 -77
- package/src/group/group.spec.ts +0 -65
- package/src/label/access.spec.ts +0 -109
- package/src/label/label.spec.ts +0 -83
- package/src/lineplot/access.spec.ts +0 -134
- package/src/lineplot/lineplot.spec.ts +0 -120
- package/src/log/access.spec.ts +0 -132
- package/src/log/log.spec.ts +0 -106
- package/src/ontology/ontology.spec.ts +0 -521
- package/src/rack/access.spec.ts +0 -102
- package/src/rack/rack.spec.ts +0 -171
- package/src/ranger/access.spec.ts +0 -115
- package/src/ranger/alias/payload.spec.ts +0 -52
- package/src/ranger/ranger.spec.ts +0 -343
- package/src/schematic/access.spec.ts +0 -134
- package/src/schematic/actions.spec.ts +0 -699
- package/src/schematic/schematic.spec.ts +0 -340
- package/src/schematic/symbol/access.spec.ts +0 -172
- package/src/schematic/symbol/client.spec.ts +0 -160
- package/src/status/access.spec.ts +0 -129
- package/src/status/status.spec.ts +0 -448
- package/src/table/access.spec.ts +0 -128
- package/src/table/table.spec.ts +0 -651
- package/src/task/access.spec.ts +0 -131
- package/src/task/payload.spec.ts +0 -113
- package/src/task/task.spec.ts +0 -657
- package/src/user/access.spec.ts +0 -107
- package/src/user/user.spec.ts +0 -290
- package/src/util/retrieve.spec.ts +0 -49
- package/src/view/view.spec.ts +0 -165
- package/src/workspace/access.spec.ts +0 -108
- package/src/workspace/client.ts +0 -112
- package/src/workspace/types.gen.ts +0 -46
- package/src/workspace/workspace.spec.ts +0 -111
- package/tsconfig.json +0 -5
- package/tsconfig.vite.json +0 -4
- package/vite.config.ts +0 -29
- /package/dist/src/{workspace → project}/external.d.ts +0 -0
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 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 { id, TimeSpan, TimeStamp } from "@synnaxlabs/x";
|
|
11
|
-
import { describe, expect, it } from "vitest";
|
|
12
|
-
|
|
13
|
-
import { createTestClient } from "@/testutil/client";
|
|
14
|
-
|
|
15
|
-
const client = createTestClient();
|
|
16
|
-
|
|
17
|
-
describe("Client", () => {
|
|
18
|
-
describe("read + write", () => {
|
|
19
|
-
it("should correctly write and read a frame of data", async () => {
|
|
20
|
-
const time = await client.channels.create({
|
|
21
|
-
name: id.create(),
|
|
22
|
-
dataType: "timestamp",
|
|
23
|
-
isIndex: true,
|
|
24
|
-
});
|
|
25
|
-
const data = await client.channels.create({
|
|
26
|
-
name: id.create(),
|
|
27
|
-
dataType: "float32",
|
|
28
|
-
index: time.key,
|
|
29
|
-
});
|
|
30
|
-
const start = TimeStamp.now();
|
|
31
|
-
await client.write(start, { [time.key]: [start], [data.key]: [1] });
|
|
32
|
-
const frame = await client.read({ start, end: start.add(TimeSpan.seconds(1)) }, [
|
|
33
|
-
time.key,
|
|
34
|
-
data.key,
|
|
35
|
-
]);
|
|
36
|
-
expect(Array.from(frame.get(time.key))).toEqual([start.valueOf()]);
|
|
37
|
-
expect(Array.from(frame.get(data.key))).toEqual([1]);
|
|
38
|
-
});
|
|
39
|
-
it("should correctly write a single series of data", async () => {
|
|
40
|
-
const time = await client.channels.create({
|
|
41
|
-
name: id.create(),
|
|
42
|
-
dataType: "timestamp",
|
|
43
|
-
isIndex: true,
|
|
44
|
-
});
|
|
45
|
-
const data = await client.channels.create({
|
|
46
|
-
name: id.create(),
|
|
47
|
-
dataType: "float32",
|
|
48
|
-
index: time.key,
|
|
49
|
-
});
|
|
50
|
-
const start = TimeStamp.now();
|
|
51
|
-
await client.write(start, time.key, TimeStamp.now());
|
|
52
|
-
await client.write(start, data.key, 1);
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
describe("retrieveGroup", () => {
|
|
56
|
-
it("should correctly retrieve the main channel group", async () => {
|
|
57
|
-
const group = await client.channels.retrieveGroup();
|
|
58
|
-
expect(group.name).toEqual("Channels");
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
describe("readLatestN", () => {
|
|
62
|
-
it("should correctly read the latest N samples from a single channel", async () => {
|
|
63
|
-
const time = await client.channels.create({
|
|
64
|
-
name: id.create(),
|
|
65
|
-
dataType: "timestamp",
|
|
66
|
-
isIndex: true,
|
|
67
|
-
});
|
|
68
|
-
const data = await client.channels.create({
|
|
69
|
-
name: id.create(),
|
|
70
|
-
dataType: "float32",
|
|
71
|
-
index: time.key,
|
|
72
|
-
});
|
|
73
|
-
const start = TimeStamp.now();
|
|
74
|
-
const timeData = [
|
|
75
|
-
start,
|
|
76
|
-
start.add(TimeSpan.seconds(1)),
|
|
77
|
-
start.add(TimeSpan.seconds(2)),
|
|
78
|
-
start.add(TimeSpan.seconds(3)),
|
|
79
|
-
start.add(TimeSpan.seconds(4)),
|
|
80
|
-
start.add(TimeSpan.seconds(5)),
|
|
81
|
-
start.add(TimeSpan.seconds(6)),
|
|
82
|
-
start.add(TimeSpan.seconds(7)),
|
|
83
|
-
start.add(TimeSpan.seconds(8)),
|
|
84
|
-
start.add(TimeSpan.seconds(9)),
|
|
85
|
-
];
|
|
86
|
-
const dataValues = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
87
|
-
await client.write(start, { [time.key]: timeData, [data.key]: dataValues });
|
|
88
|
-
|
|
89
|
-
const result = await client.readLatest(data.key, 3);
|
|
90
|
-
expect(Array.from(result)).toEqual([8, 9, 10]);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it("should correctly read the latest N samples from multiple channels", async () => {
|
|
94
|
-
const time = await client.channels.create({
|
|
95
|
-
name: id.create(),
|
|
96
|
-
dataType: "timestamp",
|
|
97
|
-
isIndex: true,
|
|
98
|
-
});
|
|
99
|
-
const data1 = await client.channels.create({
|
|
100
|
-
name: id.create(),
|
|
101
|
-
dataType: "float32",
|
|
102
|
-
index: time.key,
|
|
103
|
-
});
|
|
104
|
-
const data2 = await client.channels.create({
|
|
105
|
-
name: id.create(),
|
|
106
|
-
dataType: "float32",
|
|
107
|
-
index: time.key,
|
|
108
|
-
});
|
|
109
|
-
const start = TimeStamp.now();
|
|
110
|
-
const timeData = [
|
|
111
|
-
start,
|
|
112
|
-
start.add(TimeSpan.seconds(1)),
|
|
113
|
-
start.add(TimeSpan.seconds(2)),
|
|
114
|
-
start.add(TimeSpan.seconds(3)),
|
|
115
|
-
start.add(TimeSpan.seconds(4)),
|
|
116
|
-
start.add(TimeSpan.seconds(5)),
|
|
117
|
-
start.add(TimeSpan.seconds(6)),
|
|
118
|
-
start.add(TimeSpan.seconds(7)),
|
|
119
|
-
start.add(TimeSpan.seconds(8)),
|
|
120
|
-
start.add(TimeSpan.seconds(9)),
|
|
121
|
-
];
|
|
122
|
-
const data1Values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
123
|
-
const data2Values = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100];
|
|
124
|
-
await client.write(start, {
|
|
125
|
-
[time.key]: timeData,
|
|
126
|
-
[data1.key]: data1Values,
|
|
127
|
-
[data2.key]: data2Values,
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
const frame = await client.readLatest([time.key, data1.key, data2.key], 3);
|
|
131
|
-
expect(Array.from(frame.get(data1.key))).toEqual([8, 9, 10]);
|
|
132
|
-
expect(Array.from(frame.get(data2.key))).toEqual([80, 90, 100]);
|
|
133
|
-
expect(Array.from(frame.get(time.key))).toEqual([
|
|
134
|
-
timeData[7].valueOf(),
|
|
135
|
-
timeData[8].valueOf(),
|
|
136
|
-
timeData[9].valueOf(),
|
|
137
|
-
]);
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
it("should return empty series when no data exists", async () => {
|
|
141
|
-
const time = await client.channels.create({
|
|
142
|
-
name: id.create(),
|
|
143
|
-
dataType: "timestamp",
|
|
144
|
-
isIndex: true,
|
|
145
|
-
});
|
|
146
|
-
const data = await client.channels.create({
|
|
147
|
-
name: id.create(),
|
|
148
|
-
dataType: "float32",
|
|
149
|
-
index: time.key,
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
const result = await client.readLatest(data.key, 5);
|
|
153
|
-
expect(Array.from(result)).toEqual([]);
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it("should correctly handle N larger than available data", async () => {
|
|
157
|
-
const time = await client.channels.create({
|
|
158
|
-
name: id.create(),
|
|
159
|
-
dataType: "timestamp",
|
|
160
|
-
isIndex: true,
|
|
161
|
-
});
|
|
162
|
-
const data = await client.channels.create({
|
|
163
|
-
name: id.create(),
|
|
164
|
-
dataType: "float32",
|
|
165
|
-
index: time.key,
|
|
166
|
-
});
|
|
167
|
-
const start = TimeStamp.now();
|
|
168
|
-
const timeData = [
|
|
169
|
-
start,
|
|
170
|
-
start.add(TimeSpan.seconds(1)),
|
|
171
|
-
start.add(TimeSpan.seconds(2)),
|
|
172
|
-
];
|
|
173
|
-
const dataValues = [1, 2, 3];
|
|
174
|
-
await client.write(start, { [time.key]: timeData, [data.key]: dataValues });
|
|
175
|
-
|
|
176
|
-
const result = await client.readLatest(data.key, 10);
|
|
177
|
-
expect(Array.from(result)).toEqual([1, 2, 3]);
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
});
|
package/src/framer/codec.spec.ts
DELETED
|
@@ -1,383 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 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 { type WebsocketMessage } from "@synnaxlabs/freighter";
|
|
11
|
-
import { DataType, Series, TimeStamp } from "@synnaxlabs/x";
|
|
12
|
-
import { describe, expect, it } from "vitest";
|
|
13
|
-
|
|
14
|
-
import { type channel } from "@/channel";
|
|
15
|
-
import { ValidationError } from "@/errors";
|
|
16
|
-
import { framer } from "@/framer";
|
|
17
|
-
import {
|
|
18
|
-
Codec,
|
|
19
|
-
HIGH_PERF_SPECIAL_CHAR,
|
|
20
|
-
LOW_PERF_SPECIAL_CHAR,
|
|
21
|
-
WSIteratorCodec,
|
|
22
|
-
WSWriterCodec,
|
|
23
|
-
} from "@/framer/codec";
|
|
24
|
-
import { Frame } from "@/framer/frame";
|
|
25
|
-
import { type IteratorResponse } from "@/framer/iterator";
|
|
26
|
-
import { IteratorResponseVariant, WriterCommand } from "@/framer/types.gen";
|
|
27
|
-
import { type WriteRequest } from "@/framer/writer";
|
|
28
|
-
|
|
29
|
-
describe("encoder", () => {
|
|
30
|
-
describe("base codec", () => {
|
|
31
|
-
interface Spec {
|
|
32
|
-
name: string;
|
|
33
|
-
channels: channel.Key[];
|
|
34
|
-
dataTypes: DataType[];
|
|
35
|
-
frame: framer.Frame;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const SPECS: Spec[] = [
|
|
39
|
-
{
|
|
40
|
-
name: "All Channels Present, In Order",
|
|
41
|
-
channels: [1, 2, 3],
|
|
42
|
-
dataTypes: [DataType.INT64, DataType.FLOAT32, DataType.FLOAT64],
|
|
43
|
-
frame: new framer.Frame(
|
|
44
|
-
[1, 2, 3],
|
|
45
|
-
[
|
|
46
|
-
new Series(new BigInt64Array([1n, 2n, 3n])),
|
|
47
|
-
new Series(new Float32Array([4, 5, 6])),
|
|
48
|
-
new Series(new Float64Array([7, 8, 9])),
|
|
49
|
-
],
|
|
50
|
-
),
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
name: "All Channels Present, Out of Order",
|
|
54
|
-
channels: [3, 1, 2],
|
|
55
|
-
dataTypes: [DataType.FLOAT64, DataType.INT64, DataType.FLOAT32],
|
|
56
|
-
frame: new framer.Frame(
|
|
57
|
-
[2, 3, 1],
|
|
58
|
-
[
|
|
59
|
-
new Series(new Float32Array([4, 5, 6])),
|
|
60
|
-
new Series(new Float64Array([7, 8, 9])),
|
|
61
|
-
new Series(new BigInt64Array([1n, 2n, 3n])),
|
|
62
|
-
],
|
|
63
|
-
),
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: "Some Channels Present, In Order",
|
|
67
|
-
channels: [1, 2, 3],
|
|
68
|
-
dataTypes: [DataType.UINT8, DataType.FLOAT32, DataType.FLOAT64],
|
|
69
|
-
frame: new framer.Frame(
|
|
70
|
-
[1, 3],
|
|
71
|
-
[
|
|
72
|
-
new Series(new Uint8Array([1, 2, 3])),
|
|
73
|
-
new Series(new Float64Array([7, 8, 9])),
|
|
74
|
-
],
|
|
75
|
-
),
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
name: "Some Channels Present, Out of Order",
|
|
79
|
-
channels: [1, 2, 3],
|
|
80
|
-
dataTypes: [DataType.UINT8, DataType.FLOAT32, DataType.FLOAT64],
|
|
81
|
-
frame: new framer.Frame(
|
|
82
|
-
[3, 1],
|
|
83
|
-
[
|
|
84
|
-
new Series(new Float64Array([7, 8, 9])),
|
|
85
|
-
new Series(new Uint8Array([1, 2, 3])),
|
|
86
|
-
],
|
|
87
|
-
),
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
name: "Only One Channel Present",
|
|
91
|
-
channels: [1, 2, 3, 4, 5],
|
|
92
|
-
dataTypes: [
|
|
93
|
-
DataType.UINT8,
|
|
94
|
-
DataType.UINT8,
|
|
95
|
-
DataType.UINT8,
|
|
96
|
-
DataType.UINT8,
|
|
97
|
-
DataType.UINT8,
|
|
98
|
-
],
|
|
99
|
-
frame: new framer.Frame([3], [new Series(new Uint8Array([1, 2, 3, 4, 5]))]),
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
name: "All Same Time Range",
|
|
103
|
-
channels: [1, 2],
|
|
104
|
-
dataTypes: [DataType.UINT8, DataType.FLOAT32],
|
|
105
|
-
frame: new framer.Frame(
|
|
106
|
-
[1, 2],
|
|
107
|
-
[
|
|
108
|
-
new Series({
|
|
109
|
-
dataType: DataType.UINT8,
|
|
110
|
-
data: new Uint8Array([1]),
|
|
111
|
-
timeRange: new TimeStamp(0).spanRange(5),
|
|
112
|
-
}),
|
|
113
|
-
new Series({
|
|
114
|
-
dataType: DataType.FLOAT32,
|
|
115
|
-
data: new Float32Array([1, 2, 3, 4]),
|
|
116
|
-
timeRange: new TimeStamp(0).spanRange(5),
|
|
117
|
-
}),
|
|
118
|
-
],
|
|
119
|
-
),
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
name: "All Same Non-Zero Time Range",
|
|
123
|
-
channels: [1, 2],
|
|
124
|
-
dataTypes: [DataType.UINT8, DataType.FLOAT32],
|
|
125
|
-
frame: new framer.Frame(
|
|
126
|
-
[1, 2],
|
|
127
|
-
[
|
|
128
|
-
new Series({
|
|
129
|
-
dataType: DataType.UINT8,
|
|
130
|
-
data: new Uint8Array([1]),
|
|
131
|
-
timeRange: new TimeStamp(1000000000).spanRange(5000000000),
|
|
132
|
-
}),
|
|
133
|
-
new Series({
|
|
134
|
-
dataType: DataType.FLOAT32,
|
|
135
|
-
data: new Float32Array([1, 2, 3, 4]),
|
|
136
|
-
timeRange: new TimeStamp(1000000000).spanRange(5000000000),
|
|
137
|
-
}),
|
|
138
|
-
],
|
|
139
|
-
),
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
name: "Different Non-Zero Time Ranges",
|
|
143
|
-
channels: [1, 2],
|
|
144
|
-
dataTypes: [DataType.UINT8, DataType.FLOAT32],
|
|
145
|
-
frame: new framer.Frame(
|
|
146
|
-
[1, 2],
|
|
147
|
-
[
|
|
148
|
-
new Series({
|
|
149
|
-
dataType: DataType.UINT8,
|
|
150
|
-
data: new Uint8Array([1]),
|
|
151
|
-
timeRange: new TimeStamp(1000000000).spanRange(5000000000),
|
|
152
|
-
}),
|
|
153
|
-
new Series({
|
|
154
|
-
dataType: DataType.FLOAT32,
|
|
155
|
-
data: new Float32Array([1, 2, 3, 4]),
|
|
156
|
-
timeRange: new TimeStamp(2000000000).spanRange(3000000000),
|
|
157
|
-
}),
|
|
158
|
-
],
|
|
159
|
-
),
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
name: "Partial Present, Different Lengths",
|
|
163
|
-
channels: [1, 2, 3],
|
|
164
|
-
dataTypes: [DataType.UINT8, DataType.FLOAT32, DataType.FLOAT64],
|
|
165
|
-
frame: new framer.Frame(
|
|
166
|
-
[1, 3],
|
|
167
|
-
[new Series(new Uint8Array([1])), new Series(new Float64Array([1, 2, 3, 4]))],
|
|
168
|
-
),
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
name: "Same Alignments",
|
|
172
|
-
channels: [1, 2],
|
|
173
|
-
dataTypes: [DataType.UINT8, DataType.FLOAT32],
|
|
174
|
-
frame: new framer.Frame(
|
|
175
|
-
[1, 2],
|
|
176
|
-
[
|
|
177
|
-
new Series({
|
|
178
|
-
dataType: DataType.UINT8,
|
|
179
|
-
data: new Uint8Array([1]),
|
|
180
|
-
alignment: 5n,
|
|
181
|
-
}),
|
|
182
|
-
new Series({
|
|
183
|
-
dataType: DataType.FLOAT32,
|
|
184
|
-
data: new Uint8Array([1, 2, 3, 4]),
|
|
185
|
-
alignment: 5n,
|
|
186
|
-
}),
|
|
187
|
-
],
|
|
188
|
-
),
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
name: "Different Alignments",
|
|
192
|
-
channels: [1, 2],
|
|
193
|
-
dataTypes: [DataType.UINT8, DataType.FLOAT32],
|
|
194
|
-
frame: new Frame(
|
|
195
|
-
[1, 2],
|
|
196
|
-
[
|
|
197
|
-
new Series({
|
|
198
|
-
dataType: DataType.UINT8,
|
|
199
|
-
data: new Uint8Array([1]),
|
|
200
|
-
alignment: 5n,
|
|
201
|
-
}),
|
|
202
|
-
new Series({
|
|
203
|
-
dataType: DataType.FLOAT32,
|
|
204
|
-
data: new Uint8Array([1, 2, 3, 4]),
|
|
205
|
-
alignment: 10n,
|
|
206
|
-
}),
|
|
207
|
-
],
|
|
208
|
-
),
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
name: "Variable Data Types",
|
|
212
|
-
channels: [1, 2, 3],
|
|
213
|
-
dataTypes: [DataType.UINT8, DataType.STRING, DataType.JSON],
|
|
214
|
-
frame: new framer.Frame(
|
|
215
|
-
[1, 2, 3],
|
|
216
|
-
[
|
|
217
|
-
new Series(new Uint8Array([1])),
|
|
218
|
-
new Series({
|
|
219
|
-
data: ["one", "two", "three"],
|
|
220
|
-
dataType: DataType.STRING,
|
|
221
|
-
}),
|
|
222
|
-
new Series({
|
|
223
|
-
data: [{ a: 1 }, { b: 2 }, { c: 3 }],
|
|
224
|
-
dataType: DataType.JSON,
|
|
225
|
-
}),
|
|
226
|
-
],
|
|
227
|
-
),
|
|
228
|
-
},
|
|
229
|
-
];
|
|
230
|
-
|
|
231
|
-
SPECS.forEach((spec) => {
|
|
232
|
-
it(`should encode & decode ${spec.name}`, () => {
|
|
233
|
-
const codec = new Codec(spec.channels, spec.dataTypes);
|
|
234
|
-
const encoded = codec.encode(spec.frame.toPayload());
|
|
235
|
-
const decoded = codec.decode(encoded);
|
|
236
|
-
decoded.keys.forEach((k, i) => {
|
|
237
|
-
const dcs = decoded.series[i];
|
|
238
|
-
const ser = spec.frame.get(k);
|
|
239
|
-
expect(ser.series.length).toBeGreaterThan(0);
|
|
240
|
-
const os = ser.series[0];
|
|
241
|
-
if (dcs.timeRange != null && !dcs.timeRange.span.isZero)
|
|
242
|
-
expect(dcs.timeRange.toString()).toEqual(os.timeRange?.toString());
|
|
243
|
-
expect(new Series(dcs).toString()).toEqual(os.toString());
|
|
244
|
-
});
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
describe("dynamic codec", () => {
|
|
250
|
-
it("should allow the caller to update the codec", () => {
|
|
251
|
-
const codec = new Codec();
|
|
252
|
-
codec.update([1], [DataType.INT32]);
|
|
253
|
-
const encoded = codec.encode(
|
|
254
|
-
new framer.Frame([1], [new Series(new Int32Array([1, 2, 3]))]),
|
|
255
|
-
);
|
|
256
|
-
const decoded1 = new Frame(codec.decode(encoded));
|
|
257
|
-
expect(Array.from(decoded1.series[0])).toEqual([1, 2, 3]);
|
|
258
|
-
expect(decoded1.keys[0]).toEqual(1);
|
|
259
|
-
codec.update([2], [DataType.INT64]);
|
|
260
|
-
const encoded2 = codec.encode(
|
|
261
|
-
new framer.Frame([2], [new Series(new BigInt64Array([1n, 2n, 3n]))]),
|
|
262
|
-
);
|
|
263
|
-
const decoded2 = new Frame(codec.decode(encoded2));
|
|
264
|
-
expect(Array.from(decoded2.series[0])).toEqual([1n, 2n, 3n]);
|
|
265
|
-
expect(decoded2.keys[0]).toEqual(2);
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
it("should throw an error if the codec is not initialized", () => {
|
|
269
|
-
const codec = new Codec();
|
|
270
|
-
expect(() =>
|
|
271
|
-
codec.encode(new framer.Frame([1], [new Series(new Int32Array([1, 2, 3]))])),
|
|
272
|
-
).toThrow(ValidationError);
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
it("should use the correct encode/decode state even if the codecs are out of sync", () => {
|
|
276
|
-
const encoder = new Codec();
|
|
277
|
-
const decoder = new Codec();
|
|
278
|
-
encoder.update([1], [DataType.INT32]);
|
|
279
|
-
decoder.update([1], [DataType.INT32]);
|
|
280
|
-
|
|
281
|
-
const fr = new framer.Frame([1], [new Series(new Int32Array([1, 2, 3]))]);
|
|
282
|
-
let encoded = encoder.encode(fr);
|
|
283
|
-
let decoded = new Frame(decoder.decode(encoded));
|
|
284
|
-
expect(decoded.keys[0]).toEqual(1);
|
|
285
|
-
expect(decoded.series[0].data).toEqual(fr.series[0].data);
|
|
286
|
-
|
|
287
|
-
decoder.update([2], [DataType.INT64]);
|
|
288
|
-
encoded = encoder.encode(fr);
|
|
289
|
-
decoded = new Frame(decoder.decode(encoded));
|
|
290
|
-
expect(decoded.keys[0]).toEqual(1);
|
|
291
|
-
expect(decoded.series[0].data).toEqual(fr.series[0].data);
|
|
292
|
-
|
|
293
|
-
encoder.update([2], [DataType.INT64]);
|
|
294
|
-
expect(() => encoder.encode(fr)).toThrow(ValidationError);
|
|
295
|
-
const fr2 = new framer.Frame([2], [new Series(new BigInt64Array([1n, 2n, 3n]))]);
|
|
296
|
-
encoded = encoder.encode(fr2);
|
|
297
|
-
decoded = new Frame(decoder.decode(encoded));
|
|
298
|
-
expect(decoded.keys[0]).toEqual(2);
|
|
299
|
-
expect(decoded.series[0].data).toEqual(fr2.series[0].data);
|
|
300
|
-
});
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
describe("websocket writer codec", () => {
|
|
304
|
-
it("should correctly encode and decode a websocket write request", () => {
|
|
305
|
-
const baseCodec = new Codec([1], [DataType.INT32]);
|
|
306
|
-
const fr = new framer.Frame([1], [new Series(new Int32Array([1, 2, 3]))]);
|
|
307
|
-
const writeReq: WriteRequest = {
|
|
308
|
-
command: WriterCommand.Write,
|
|
309
|
-
frame: fr.toPayload(),
|
|
310
|
-
};
|
|
311
|
-
const msg: WebsocketMessage<WriteRequest> = { type: "data", payload: writeReq };
|
|
312
|
-
const codec = new WSWriterCodec(baseCodec);
|
|
313
|
-
const encoded = codec.encode(msg);
|
|
314
|
-
expect(encoded[0]).toEqual(HIGH_PERF_SPECIAL_CHAR);
|
|
315
|
-
const decoded = codec.decode(encoded) as WebsocketMessage<WriteRequest>;
|
|
316
|
-
expect(decoded.payload?.command).toEqual(WriterCommand.Write);
|
|
317
|
-
const decodedFr = new Frame(decoded.payload?.frame);
|
|
318
|
-
expect(decodedFr.series[0].data).toEqual(fr.series[0].data);
|
|
319
|
-
});
|
|
320
|
-
|
|
321
|
-
it("should correctly e +d a WS write set authority request", () => {
|
|
322
|
-
const baseCodec = new Codec([1], [DataType.INT32]);
|
|
323
|
-
const writeReq: WriteRequest = {
|
|
324
|
-
command: WriterCommand.SetAuthority,
|
|
325
|
-
config: { authorities: [123] },
|
|
326
|
-
};
|
|
327
|
-
const codec = new WSWriterCodec(baseCodec);
|
|
328
|
-
const msg: WebsocketMessage<WriteRequest> = { type: "data", payload: writeReq };
|
|
329
|
-
const encoded = codec.encode(msg);
|
|
330
|
-
expect(encoded[0]).toEqual(LOW_PERF_SPECIAL_CHAR);
|
|
331
|
-
const decoded = codec.decode(encoded);
|
|
332
|
-
expect(decoded).toEqual(msg);
|
|
333
|
-
});
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
describe("websocket iterator codec", () => {
|
|
337
|
-
it("should JSON-encode an iterator request without a special char prefix", () => {
|
|
338
|
-
const baseCodec = new Codec([1], [DataType.INT32]);
|
|
339
|
-
const codec = new WSIteratorCodec(baseCodec);
|
|
340
|
-
const msg: WebsocketMessage<unknown> = {
|
|
341
|
-
type: "data",
|
|
342
|
-
payload: { command: 1, span: 0 },
|
|
343
|
-
};
|
|
344
|
-
const encoded = codec.encode(msg);
|
|
345
|
-
// Iterator requests are sent as raw JSON; no special-char prefix.
|
|
346
|
-
// Confirm the first byte is JSON ('{' or '[').
|
|
347
|
-
expect([0x7b, 0x5b]).toContain(encoded[0]);
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
it("should binary-decode a data variant response and synthesize variant=Data", () => {
|
|
351
|
-
const baseCodec = new Codec([1], [DataType.INT32]);
|
|
352
|
-
const fr = new framer.Frame([1], [new Series(new Int32Array([1, 2, 3]))]);
|
|
353
|
-
const codec = new WSIteratorCodec(baseCodec);
|
|
354
|
-
const encoded = new Uint8Array(baseCodec.encode(fr.toPayload(), 1));
|
|
355
|
-
encoded[0] = HIGH_PERF_SPECIAL_CHAR;
|
|
356
|
-
const decoded = codec.decode(encoded) as WebsocketMessage<IteratorResponse>;
|
|
357
|
-
expect(decoded.payload?.variant).toEqual(IteratorResponseVariant.Data);
|
|
358
|
-
const decodedFr = new Frame(decoded.payload?.frame);
|
|
359
|
-
expect(decodedFr.series[0].data).toEqual(fr.series[0].data);
|
|
360
|
-
});
|
|
361
|
-
|
|
362
|
-
it("should JSON-decode an ack variant response prefixed with the low-perf char", () => {
|
|
363
|
-
const baseCodec = new Codec([1], [DataType.INT32]);
|
|
364
|
-
const codec = new WSIteratorCodec(baseCodec);
|
|
365
|
-
const ackMsg: WebsocketMessage<IteratorResponse> = {
|
|
366
|
-
type: "data",
|
|
367
|
-
payload: {
|
|
368
|
-
variant: IteratorResponseVariant.Ack,
|
|
369
|
-
ack: true,
|
|
370
|
-
command: 1,
|
|
371
|
-
},
|
|
372
|
-
};
|
|
373
|
-
// Simulate what the server sends: LOW_PERF_SPECIAL_CHAR + JSON-encoded message.
|
|
374
|
-
const json = new TextEncoder().encode(JSON.stringify(ackMsg));
|
|
375
|
-
const encoded = new Uint8Array(json.byteLength + 1);
|
|
376
|
-
encoded[0] = LOW_PERF_SPECIAL_CHAR;
|
|
377
|
-
encoded.set(json, 1);
|
|
378
|
-
const decoded = codec.decode(encoded) as WebsocketMessage<IteratorResponse>;
|
|
379
|
-
expect(decoded.payload?.variant).toEqual(IteratorResponseVariant.Ack);
|
|
380
|
-
expect(decoded.payload?.ack).toEqual(true);
|
|
381
|
-
});
|
|
382
|
-
});
|
|
383
|
-
});
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 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 { TimeRange, TimeStamp } from "@synnaxlabs/x";
|
|
11
|
-
import { describe, expect, test } from "vitest";
|
|
12
|
-
|
|
13
|
-
import { NotFoundError, UnauthorizedError } from "@/errors";
|
|
14
|
-
import { newIndexedPair } from "@/testutil/channels";
|
|
15
|
-
import { createTestClient } from "@/testutil/client";
|
|
16
|
-
import { secondsLinspace } from "@/testutil/telem";
|
|
17
|
-
import { randomSeries } from "@/util/telem";
|
|
18
|
-
|
|
19
|
-
const client = createTestClient();
|
|
20
|
-
|
|
21
|
-
describe("Deleter", () => {
|
|
22
|
-
test("Client - basic delete", async () => {
|
|
23
|
-
const [indexCh, dataCh] = await newIndexedPair(client);
|
|
24
|
-
const data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
25
|
-
await client.write(TimeStamp.seconds(5), {
|
|
26
|
-
[indexCh.key]: secondsLinspace(5, 10),
|
|
27
|
-
[dataCh.key]: data,
|
|
28
|
-
});
|
|
29
|
-
const res = await client.read(TimeRange.MAX, dataCh.key);
|
|
30
|
-
expect(res.data.length).toEqual(10);
|
|
31
|
-
await client.delete(dataCh.key, TimeStamp.seconds(5).range(TimeStamp.seconds(7)));
|
|
32
|
-
|
|
33
|
-
const deletedRes = await client.read(TimeRange.MAX, dataCh.key);
|
|
34
|
-
expect(deletedRes.data.length).toEqual(8);
|
|
35
|
-
expect(Array.from(deletedRes)).toEqual([3, 4, 5, 6, 7, 8, 9, 10]);
|
|
36
|
-
});
|
|
37
|
-
test("Client - basic delete by name", async () => {
|
|
38
|
-
const [indexCh, dataCh] = await newIndexedPair(client);
|
|
39
|
-
const data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
40
|
-
await client.write(TimeStamp.seconds(5), {
|
|
41
|
-
[indexCh.key]: secondsLinspace(5, 10),
|
|
42
|
-
[dataCh.key]: data,
|
|
43
|
-
});
|
|
44
|
-
const res = await client.read(TimeRange.MAX, dataCh.key);
|
|
45
|
-
expect(res.data.length).toEqual(10);
|
|
46
|
-
await client.delete(dataCh.name, TimeStamp.seconds(5).range(TimeStamp.seconds(7)));
|
|
47
|
-
|
|
48
|
-
const deletedRes = await client.read(TimeRange.MAX, dataCh.key);
|
|
49
|
-
expect(deletedRes.data.length).toEqual(8);
|
|
50
|
-
expect(Array.from(deletedRes)).toEqual([3, 4, 5, 6, 7, 8, 9, 10]);
|
|
51
|
-
});
|
|
52
|
-
test("Client - delete key not found", async () => {
|
|
53
|
-
const [indexCh, dataCh] = await newIndexedPair(client);
|
|
54
|
-
const data = randomSeries(10, dataCh.dataType);
|
|
55
|
-
await client.write(TimeStamp.seconds(0), {
|
|
56
|
-
[indexCh.key]: secondsLinspace(0, 10),
|
|
57
|
-
[dataCh.key]: data,
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
await expect(client.delete([indexCh.key, 1232], TimeRange.MAX)).rejects.toThrow(
|
|
61
|
-
NotFoundError,
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
const res = await client.read(TimeRange.MAX, dataCh.key);
|
|
65
|
-
expect(res.data).toEqual(data);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
test("Client - delete with writer", async () => {
|
|
69
|
-
const [indexCh] = await newIndexedPair(client);
|
|
70
|
-
|
|
71
|
-
const writer = await client.openWriter({
|
|
72
|
-
start: TimeStamp.seconds(10),
|
|
73
|
-
channels: [indexCh.key],
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
await expect(
|
|
77
|
-
client.delete([indexCh.key], TimeStamp.seconds(12).range(TimeStamp.seconds(30))),
|
|
78
|
-
).rejects.toThrow(UnauthorizedError);
|
|
79
|
-
|
|
80
|
-
await writer.close();
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
test("Client - delete index channel alone", async () => {
|
|
84
|
-
const [indexCh, dataCh] = await newIndexedPair(client);
|
|
85
|
-
const index = indexCh;
|
|
86
|
-
const dat = dataCh;
|
|
87
|
-
const data = randomSeries(10, dat.dataType);
|
|
88
|
-
|
|
89
|
-
const time = BigInt64Array.from({ length: 10 }, (_, i) =>
|
|
90
|
-
TimeStamp.milliseconds(i).valueOf(),
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
await index.write(0, time);
|
|
94
|
-
await dat.write(0, data);
|
|
95
|
-
|
|
96
|
-
await expect(
|
|
97
|
-
client.delete(
|
|
98
|
-
[index.key],
|
|
99
|
-
TimeStamp.milliseconds(2).range(TimeStamp.milliseconds(5)),
|
|
100
|
-
),
|
|
101
|
-
).rejects.toThrow();
|
|
102
|
-
});
|
|
103
|
-
});
|