@synnaxlabs/client 0.56.2 → 0.57.1
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-DDACDVZ-.js +14505 -0
- package/dist/client-DDACDVZ-.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 +91 -0
- package/dist/src/framer/cache/dynamic.d.ts.map +1 -0
- package/dist/src/framer/cache/reader.d.ts +57 -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 +39 -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 +39 -16
- 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 +340 -0
- package/src/framer/cache/reader.ts +231 -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 +108 -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 +19 -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
|
@@ -3,8 +3,8 @@ import { ontology } from '../ontology';
|
|
|
3
3
|
export declare const keyZ: z.ZodUUID;
|
|
4
4
|
export type Key = z.infer<typeof keyZ>;
|
|
5
5
|
/**
|
|
6
|
-
* User is an account entity representing a person accessing the Synnax system.
|
|
7
|
-
*
|
|
6
|
+
* User is an account entity representing a person accessing the Synnax system. Users
|
|
7
|
+
* can have roles assigned for permission management.
|
|
8
8
|
*/
|
|
9
9
|
export declare const userZ: z.ZodObject<{
|
|
10
10
|
key: z.ZodUUID;
|
|
@@ -26,10 +26,10 @@ export interface New extends z.input<typeof newZ> {
|
|
|
26
26
|
}
|
|
27
27
|
export declare const ontologyID: ontology.CreateID<string>;
|
|
28
28
|
export declare const TYPE_ONTOLOGY_ID: {
|
|
29
|
-
type: "arc" | "builtin" | "channel" | "device" | "framer" | "group" | "label" | "lineplot" | "log" | "node" | "policy" | "rack" | "range" | "range-alias" | "role" | "schematic" | "schematic_symbol" | "status" | "table" | "task" | "user" | "view"
|
|
29
|
+
type: "arc" | "builtin" | "channel" | "device" | "framer" | "group" | "label" | "lineplot" | "log" | "node" | "panel" | "policy" | "project" | "rack" | "range" | "range-alias" | "role" | "schematic" | "schematic_symbol" | "status" | "table" | "task" | "user" | "view";
|
|
30
30
|
key: string;
|
|
31
31
|
} | {
|
|
32
|
-
type: "arc" | "builtin" | "channel" | "device" | "framer" | "group" | "label" | "lineplot" | "log" | "node" | "policy" | "rack" | "range" | "range-alias" | "role" | "schematic" | "schematic_symbol" | "status" | "table" | "task" | "user" | "view"
|
|
32
|
+
type: "arc" | "builtin" | "channel" | "device" | "framer" | "group" | "label" | "lineplot" | "log" | "node" | "panel" | "policy" | "project" | "rack" | "range" | "range-alias" | "role" | "schematic" | "schematic_symbol" | "status" | "table" | "task" | "user" | "view";
|
|
33
33
|
key: string;
|
|
34
34
|
};
|
|
35
35
|
//# sourceMappingURL=types.gen.d.ts.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { primitive } from '@synnaxlabs/x';
|
|
2
2
|
export type SingleParamAnalysisResult<T extends primitive.Value, K extends PartialTypeNameRecord<T>> = T extends unknown ? {
|
|
3
3
|
single: true;
|
|
4
|
-
variant: K[
|
|
4
|
+
variant: K[TypeName<T>];
|
|
5
5
|
normalized: T[];
|
|
6
6
|
actual: T;
|
|
7
7
|
} : never;
|
|
8
8
|
export type MultiParamAnalysisResult<T extends primitive.Value, K extends PartialTypeNameRecord<T>> = T extends unknown ? {
|
|
9
9
|
single: false;
|
|
10
|
-
variant: K[
|
|
10
|
+
variant: K[TypeName<T>];
|
|
11
11
|
normalized: T[];
|
|
12
12
|
actual: T[];
|
|
13
13
|
} : never;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retrieve.d.ts","sourceRoot":"","sources":["../../../src/util/retrieve.ts"],"names":[],"mappings":"AASA,OAAO,EAAS,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAItD,MAAM,MAAM,yBAAyB,CACnC,CAAC,SAAS,SAAS,CAAC,KAAK,EACzB,CAAC,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AAS,CAAC,KAAK,IAAI,OAAO,CACpE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAC5B,CAAC;AAEF,MAAM,MAAM,mBAAmB,CAC7B,CAAC,SAAS,SAAS,CAAC,KAAK,EACzB,CAAC,SAAS,qBAAqB,CAAC,CAAC,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC,IAC3D,yBAAyB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,wBAAwB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAErE,MAAM,WAAW,oBAAoB;IACnC,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,eAAO,MAAM,aAAa,GACxB,CAAC,SAAS,SAAS,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,EAC3C,CAAC,SAAS,qBAAqB,CAAC,CAAC,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC,EAE7D,MAAM,CAAC,SAAS,OAAO,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,EACzC,YAAY,CAAC,EACb,4BAAkC,oBAAyB,KAC1D,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAkB1B,CAAC;AAEF,eAAO,MAAM,2BAA2B,GAAI,CAAC,EAAE,CAAC,EAC9C,MAAM,MAAM,EACZ,QAAQ,CAAC,GAAG,CAAC,EAAE,EACf,SAAS,CAAC,EAAE,EACZ,UAAU,OAAO,KAChB,IAQF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telem.d.ts","sourceRoot":"","sources":["../../../src/util/telem.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAE/D,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,EAAE,UAAU,QAAQ,KAAG,
|
|
1
|
+
{"version":3,"file":"telem.d.ts","sourceRoot":"","sources":["../../../src/util/telem.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAE/D,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,EAAE,UAAU,QAAQ,KAAG,UAIjE,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { UnaryClient } from '@synnaxlabs/freighter';
|
|
2
|
+
import { destructor } from '@synnaxlabs/x';
|
|
2
3
|
import { z } from 'zod';
|
|
4
|
+
import { ontology } from '../ontology';
|
|
5
|
+
import { query } from '../query';
|
|
3
6
|
import { Key, New, View } from './types.gen';
|
|
4
7
|
export declare const SET_CHANNEL_NAME = "sy_view_set";
|
|
5
8
|
export declare const DELETE_CHANNEL_NAME = "sy_view_delete";
|
|
@@ -10,25 +13,38 @@ declare const retrieveRequestZ: z.ZodObject<{
|
|
|
10
13
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
11
14
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
12
15
|
}, z.core.$strip>;
|
|
13
|
-
declare const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
declare const retrieveMultiParamsZ: z.ZodUnion<[z.ZodObject<{
|
|
17
|
+
keys: z.ZodOptional<z.ZodArray<z.ZodUUID>>;
|
|
18
|
+
types: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
19
|
+
searchTerm: z.ZodOptional<z.ZodString>;
|
|
20
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
}, z.core.$strip>, z.ZodPipe<z.ZodArray<z.ZodUUID>, z.ZodTransform<{
|
|
16
23
|
keys: string[];
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
24
|
+
}, string[]>>]>;
|
|
25
|
+
export type RetrieveSingleParams = {
|
|
26
|
+
key: Key;
|
|
27
|
+
};
|
|
22
28
|
export interface RetrieveMultipleParams extends z.input<typeof retrieveRequestZ> {
|
|
23
29
|
}
|
|
24
|
-
export
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
export interface ClientConfig {
|
|
31
|
+
unary: UnaryClient;
|
|
32
|
+
cache: query.Cache;
|
|
33
|
+
ontology: ontology.Client;
|
|
34
|
+
}
|
|
35
|
+
export declare class Client extends query.Retriever<typeof retrieveMultiParamsZ, Key, View> {
|
|
36
|
+
private readonly cfg;
|
|
37
|
+
private readonly store;
|
|
38
|
+
constructor(cfg: ClientConfig);
|
|
29
39
|
create(view: New): Promise<View>;
|
|
30
40
|
create(views: New[]): Promise<View[]>;
|
|
31
|
-
|
|
41
|
+
rename(key: Key, name: string, opts?: query.WriteOptions): Promise<void>;
|
|
42
|
+
delete(keys: Key | Key[], opts?: query.WriteOptions): Promise<void>;
|
|
43
|
+
/** Subscribes to every view set delivered to the cache. */
|
|
44
|
+
onSet(handler: (view: View) => void): destructor.Destructor;
|
|
45
|
+
/** Subscribes to every view delete delivered to the cache. */
|
|
46
|
+
onDelete(handler: (key: Key) => void): destructor.Destructor;
|
|
47
|
+
private execRetrieve;
|
|
32
48
|
}
|
|
33
49
|
export {};
|
|
34
50
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/view/client.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/view/client.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAS,KAAK,UAAU,EAAa,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE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AK,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,GAAG,UAAU,CAAC,UAAU;IAM3D,8DAA8D;IAC9D,QAAQ,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,GAAG,UAAU,CAAC,UAAU;YAM9C,YAAY;CAS3B"}
|
|
@@ -1,35 +1,27 @@
|
|
|
1
|
-
import { record } from '@synnaxlabs/x';
|
|
2
1
|
import { z } from 'zod';
|
|
3
2
|
import { ontology } from '../ontology';
|
|
4
3
|
export declare const keyZ: z.ZodUUID;
|
|
5
4
|
export type Key = z.infer<typeof keyZ>;
|
|
6
5
|
/**
|
|
7
|
-
* View is a persisted view configuration storing visualization settings and
|
|
8
|
-
*
|
|
9
|
-
* types.
|
|
6
|
+
* View is a persisted view configuration storing visualization settings and query
|
|
7
|
+
* parameters for line plots, tables, schematics, and other view types.
|
|
10
8
|
*/
|
|
11
9
|
export declare const viewZ: z.ZodObject<{
|
|
12
|
-
key: z.ZodUUID
|
|
10
|
+
key: z.ZodDefault<z.ZodUUID>;
|
|
13
11
|
name: z.ZodString;
|
|
14
12
|
type: z.ZodString;
|
|
15
|
-
query: z.
|
|
13
|
+
query: z.ZodDefault<z.ZodRecord<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodUnknown>>;
|
|
16
14
|
}, z.core.$strip>;
|
|
17
15
|
export interface View extends z.infer<typeof viewZ> {
|
|
18
16
|
}
|
|
19
|
-
export
|
|
20
|
-
key: z.ZodOptional<z.ZodUUID>;
|
|
21
|
-
name: z.ZodString;
|
|
22
|
-
type: z.ZodString;
|
|
23
|
-
query: z.ZodType<record.Unknown, unknown, z.core.$ZodTypeInternals<record.Unknown, unknown>>;
|
|
24
|
-
}, z.core.$strip>;
|
|
25
|
-
export interface New extends z.input<typeof newZ> {
|
|
17
|
+
export interface New extends z.input<typeof viewZ> {
|
|
26
18
|
}
|
|
27
19
|
export declare const ontologyID: ontology.CreateID<string>;
|
|
28
20
|
export declare const TYPE_ONTOLOGY_ID: {
|
|
29
|
-
type: "arc" | "builtin" | "channel" | "device" | "framer" | "group" | "label" | "lineplot" | "log" | "node" | "policy" | "rack" | "range" | "range-alias" | "role" | "schematic" | "schematic_symbol" | "status" | "table" | "task" | "user" | "view"
|
|
21
|
+
type: "arc" | "builtin" | "channel" | "device" | "framer" | "group" | "label" | "lineplot" | "log" | "node" | "panel" | "policy" | "project" | "rack" | "range" | "range-alias" | "role" | "schematic" | "schematic_symbol" | "status" | "table" | "task" | "user" | "view";
|
|
30
22
|
key: string;
|
|
31
23
|
} | {
|
|
32
|
-
type: "arc" | "builtin" | "channel" | "device" | "framer" | "group" | "label" | "lineplot" | "log" | "node" | "policy" | "rack" | "range" | "range-alias" | "role" | "schematic" | "schematic_symbol" | "status" | "table" | "task" | "user" | "view"
|
|
24
|
+
type: "arc" | "builtin" | "channel" | "device" | "framer" | "group" | "label" | "lineplot" | "log" | "node" | "panel" | "policy" | "project" | "rack" | "range" | "range-alias" | "role" | "schematic" | "schematic_symbol" | "status" | "table" | "task" | "user" | "view";
|
|
33
25
|
key: string;
|
|
34
26
|
};
|
|
35
27
|
//# sourceMappingURL=types.gen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.gen.d.ts","sourceRoot":"","sources":["../../../src/view/types.gen.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.gen.d.ts","sourceRoot":"","sources":["../../../src/view/types.gen.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,eAAO,MAAM,IAAI,WAAW,CAAC;AAC7B,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAEvC;;;GAGG;AACH,eAAO,MAAM,KAAK;;;;;iBAYhB,CAAC;AACH,MAAM,WAAW,IAAK,SAAQ,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC;CAAG;AACtD,MAAM,WAAW,GAAI,SAAQ,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC;CAAG;AAErD,eAAO,MAAM,UAAU,2BAAwC,CAAC;AAChE,eAAO,MAAM,gBAAgB;;;;;;CAAiB,CAAC"}
|
package/dist/testutil.js
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { B as e, G as t, K as n, V as r, W as i, Z as a, d as o, t as s, z as c } from "./client-DDACDVZ-.js";
|
|
2
|
+
import { DataType as l, TimeSpan as u, TimeStamp as d, array as f, errors as p, id as m } from "@synnaxlabs/x";
|
|
3
|
+
import { afterAll as h } from "vitest";
|
|
4
|
+
import { connect as g, createServer as _ } from "node:net";
|
|
5
|
+
//#region src/testutil/client.ts
|
|
6
|
+
var v = {
|
|
7
|
+
host: "localhost",
|
|
8
|
+
port: 9090,
|
|
9
|
+
username: "synnax",
|
|
10
|
+
password: "seldon",
|
|
11
|
+
retry: {
|
|
12
|
+
maxRetries: 4,
|
|
13
|
+
baseInterval: u.seconds(1),
|
|
14
|
+
scale: 1.5
|
|
15
|
+
}
|
|
16
|
+
}, y = [];
|
|
17
|
+
h(async () => {
|
|
18
|
+
let e = (await Promise.allSettled(y.map((e) => e.close()))).filter((e) => e.status === "rejected");
|
|
19
|
+
if (e.length > 0) throw AggregateError(e.map((e) => e.reason), "failed to close test clients");
|
|
20
|
+
});
|
|
21
|
+
var b = (e) => {
|
|
22
|
+
let t = new s({
|
|
23
|
+
...v,
|
|
24
|
+
...e
|
|
25
|
+
});
|
|
26
|
+
return y.push(t), t;
|
|
27
|
+
}, x = (e) => n.matches(e) || e instanceof Error && e.cause != null && x(e.cause), S = async (e, t) => {
|
|
28
|
+
let n = b({
|
|
29
|
+
username: e,
|
|
30
|
+
password: "test",
|
|
31
|
+
onInternalError: (e) => {
|
|
32
|
+
x(e) || console.error(e);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
try {
|
|
36
|
+
await n.access.policies.retrieveForSubject(c(t));
|
|
37
|
+
} catch (e) {
|
|
38
|
+
if (!x(e)) throw p.fromUnknown(e);
|
|
39
|
+
}
|
|
40
|
+
return n;
|
|
41
|
+
}, C = async (e) => {
|
|
42
|
+
let t = m.create();
|
|
43
|
+
return {
|
|
44
|
+
username: t,
|
|
45
|
+
key: (await e.users.create({
|
|
46
|
+
username: t,
|
|
47
|
+
password: "test",
|
|
48
|
+
firstName: "test",
|
|
49
|
+
lastName: "test"
|
|
50
|
+
})).key
|
|
51
|
+
};
|
|
52
|
+
}, w = async (t, n) => {
|
|
53
|
+
let i = await C(t), a = await Promise.all(f.toArray(n).map(async (e) => await t.access.policies.create(e))), o = await t.access.roles.create({
|
|
54
|
+
name: "test",
|
|
55
|
+
description: "test"
|
|
56
|
+
});
|
|
57
|
+
return await t.ontology.addChildren(e(o.key), ...a.map(({ key: e }) => r(e))), await t.access.roles.assign({
|
|
58
|
+
user: i.key,
|
|
59
|
+
role: o.key
|
|
60
|
+
}), await S(i.username, i.key);
|
|
61
|
+
}, T = [
|
|
62
|
+
"Owner",
|
|
63
|
+
"Engineer",
|
|
64
|
+
"Host",
|
|
65
|
+
"Operator",
|
|
66
|
+
"Viewer"
|
|
67
|
+
], E = async (e, t) => {
|
|
68
|
+
let n = (await e.access.roles.retrieve({})).find((e) => e.name === t);
|
|
69
|
+
if (n == null) throw new a(`no built-in role named ${t}`);
|
|
70
|
+
let r = await C(e);
|
|
71
|
+
return await e.access.roles.assign({
|
|
72
|
+
user: r.key,
|
|
73
|
+
role: n.key
|
|
74
|
+
}), await S(r.username, r.key);
|
|
75
|
+
}, D = class {
|
|
76
|
+
client;
|
|
77
|
+
byRole = /* @__PURE__ */ new Map();
|
|
78
|
+
constructor(e) {
|
|
79
|
+
this.client = e;
|
|
80
|
+
}
|
|
81
|
+
async get(e) {
|
|
82
|
+
let t = this.byRole.get(e);
|
|
83
|
+
if (t != null) return await t;
|
|
84
|
+
let n = E(this.client, e);
|
|
85
|
+
return this.byRole.set(e, n), await n;
|
|
86
|
+
}
|
|
87
|
+
}, O = async (e) => {
|
|
88
|
+
let t = await e.channels.create({
|
|
89
|
+
leaseholder: 1,
|
|
90
|
+
name: m.create(),
|
|
91
|
+
dataType: l.TIMESTAMP,
|
|
92
|
+
isIndex: !0
|
|
93
|
+
});
|
|
94
|
+
return [t, await e.channels.create({
|
|
95
|
+
leaseholder: 1,
|
|
96
|
+
name: m.create(),
|
|
97
|
+
dataType: l.FLOAT64,
|
|
98
|
+
index: t.key
|
|
99
|
+
})];
|
|
100
|
+
}, k = async (e) => {
|
|
101
|
+
let t = await e.channels.create({
|
|
102
|
+
leaseholder: 1,
|
|
103
|
+
name: m.create(),
|
|
104
|
+
dataType: l.TIMESTAMP,
|
|
105
|
+
isIndex: !0
|
|
106
|
+
});
|
|
107
|
+
return [t, await e.channels.create({
|
|
108
|
+
leaseholder: 1,
|
|
109
|
+
name: m.create(),
|
|
110
|
+
dataType: l.BOOLEAN,
|
|
111
|
+
index: t.key
|
|
112
|
+
})];
|
|
113
|
+
}, A = async (e) => await e.channels.create({
|
|
114
|
+
name: m.create(),
|
|
115
|
+
dataType: l.FLOAT64,
|
|
116
|
+
virtual: !0
|
|
117
|
+
}), j = async (e) => await e.channels.create({
|
|
118
|
+
name: m.create(),
|
|
119
|
+
dataType: l.BOOLEAN,
|
|
120
|
+
virtual: !0
|
|
121
|
+
}), M = async (e, t, n = u.seconds(5)) => t(e.status) ? e.status : await new Promise((r, i) => {
|
|
122
|
+
let a = setTimeout(() => {
|
|
123
|
+
o(), i(/* @__PURE__ */ Error("timed out waiting for connection status"));
|
|
124
|
+
}, n.milliseconds), o = e.onChange((e) => {
|
|
125
|
+
t(e) && (clearTimeout(a), o(), r(e));
|
|
126
|
+
});
|
|
127
|
+
}), N = async (e, t) => await M(e, ({ variant: e, details: t }) => e === "success" && t.streamLive, t), P = async (e) => {
|
|
128
|
+
let t = await e.projects.create({
|
|
129
|
+
name: `project-${m.create()}`,
|
|
130
|
+
layout: {}
|
|
131
|
+
});
|
|
132
|
+
return o(t.key);
|
|
133
|
+
}, F = {
|
|
134
|
+
host: "localhost",
|
|
135
|
+
port: 9090
|
|
136
|
+
}, I = {
|
|
137
|
+
baseInterval: u.milliseconds(10),
|
|
138
|
+
maxInterval: u.milliseconds(50),
|
|
139
|
+
scale: 1.5
|
|
140
|
+
}, L = async (e = {}) => {
|
|
141
|
+
let { host: t, port: n } = {
|
|
142
|
+
...F,
|
|
143
|
+
...e
|
|
144
|
+
}, r = /* @__PURE__ */ new Set(), i = !1, a = _((e) => {
|
|
145
|
+
if (i) {
|
|
146
|
+
e.destroy();
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
let a = g(n, t);
|
|
150
|
+
r.add(e).add(a);
|
|
151
|
+
let o = () => {
|
|
152
|
+
r.delete(e), r.delete(a), e.destroy(), a.destroy();
|
|
153
|
+
};
|
|
154
|
+
e.on("error", o), a.on("error", o), e.on("close", o), a.on("close", o), e.pipe(a), a.pipe(e);
|
|
155
|
+
}), o = async (e) => await new Promise((t, n) => {
|
|
156
|
+
a.once("error", n), a.listen(e, () => {
|
|
157
|
+
a.removeListener("error", n), t();
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
await o(0);
|
|
161
|
+
let s = a.address();
|
|
162
|
+
if (s == null || typeof s == "string") throw Error("proxy failed to bind a port");
|
|
163
|
+
let c = s.port, l = async () => {
|
|
164
|
+
i = !0;
|
|
165
|
+
let e = new Promise((e) => a.close(() => e()));
|
|
166
|
+
r.forEach((e) => e.destroy()), r.clear(), await e;
|
|
167
|
+
};
|
|
168
|
+
return {
|
|
169
|
+
port: c,
|
|
170
|
+
sever: l,
|
|
171
|
+
restore: async () => {
|
|
172
|
+
i = !1, await o(c);
|
|
173
|
+
},
|
|
174
|
+
close: l
|
|
175
|
+
};
|
|
176
|
+
}, R = (e) => {
|
|
177
|
+
if (!i(e)) throw Error("expected a live cached answer");
|
|
178
|
+
return e;
|
|
179
|
+
}, z = (e) => {
|
|
180
|
+
if (!t.matches(e)) throw Error("expected a deleted answer");
|
|
181
|
+
return e;
|
|
182
|
+
}, B = (e, t) => Array.from({ length: t }, (t, n) => e + n).map((e) => d.seconds(e)), V = (e) => e.isVariable || e.equals(l.UINT8), H = {
|
|
183
|
+
resolveDataType: (e) => V(e) ? e : l.FLOAT32,
|
|
184
|
+
convert: (e, t) => V(e.dataType) ? e : (t == null && e.dataType.usesBigInt && e.length > 0 && (t = BigInt(e.data[0])), e.convert(l.FLOAT32, t))
|
|
185
|
+
};
|
|
186
|
+
//#endregion
|
|
187
|
+
export { T as BUILT_IN_ROLES, I as FAST_RETRY, D as RoleClients, v as TEST_CLIENT_PARAMS, P as createPanelParent, L as createSeverableProxy, b as createTestClient, w as createTestClientWithPolicy, E as createTestClientWithRole, z as expectDeleted, R as expectLive, H as glTransform, i as isLive, k as newIndexedBoolPair, O as newIndexedPair, j as newVirtualBoolChannel, A as newVirtualChannel, B as secondsLinspace, M as waitForStatus, N as waitForStreamLive };
|
|
188
|
+
|
|
189
|
+
//# sourceMappingURL=testutil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testutil.js","names":[],"sources":["../src/testutil/client.ts","../src/testutil/access.ts","../src/testutil/channels.ts","../src/testutil/connection.ts","../src/testutil/panels.ts","../src/testutil/proxy.ts","../src/testutil/query.ts","../src/testutil/telem.ts"],"sourcesContent":["// Copyright 2026 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { TimeSpan } from \"@synnaxlabs/x\";\nimport { afterAll } from \"vitest\";\n\nimport Synnax, { type SynnaxParams } from \"@/client\";\n\nexport const TEST_CLIENT_PARAMS: SynnaxParams = {\n host: \"localhost\",\n port: 9090,\n username: \"synnax\",\n password: \"seldon\",\n retry: {\n maxRetries: 4,\n baseInterval: TimeSpan.seconds(1),\n scale: 1.5,\n },\n};\n\n// A hook registered mid-test is silently dropped by vitest, so per-client afterAll\n// calls leak clients created inside test bodies. This module-level hook registers\n// during spec collection (import time) and covers every call site.\nconst openClients: Synnax[] = [];\n// Awaited so every close finishes before vitest tears down the worker; a close\n// still in flight at teardown races its logging against the closing RPC channel.\nafterAll(async () => {\n const results = await Promise.allSettled(openClients.map((client) => client.close()));\n const failures = results.filter((result) => result.status === \"rejected\");\n if (failures.length > 0)\n throw new AggregateError(\n failures.map((failure) => failure.reason),\n \"failed to close test clients\",\n );\n});\n\n/**\n * Creates a client connected to the local test cluster. The client is closed\n * automatically once every test in the current spec file has finished, so callers do\n * not need to close it themselves.\n */\nexport const createTestClient = (params?: Partial<SynnaxParams>): Synnax => {\n const client = new Synnax({ ...TEST_CLIENT_PARAMS, ...params });\n openClients.push(client);\n return client;\n};\n","// Copyright 2026 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { array, errors, id } from \"@synnaxlabs/x\";\n\nimport { policy } from \"@/access/policy\";\nimport { role } from \"@/access/role\";\nimport type Synnax from \"@/client\";\nimport { AccessDeniedError, NotFoundError } from \"@/errors\";\nimport { createTestClient } from \"@/testutil/client\";\nimport { user } from \"@/user\";\n\n/** Reports whether the error, or any error in its cause chain, is an access denial. */\nconst isDenial = (err: unknown): boolean =>\n AccessDeniedError.matches(err) ||\n (err instanceof Error && err.cause != null && isDenial(err.cause));\n\n/**\n * Connects as a new user and primes its policy cache. Denials are tolerated: the Core\n * refuses restricted subjects by design, and the change-stream refusal logs after\n * teardown, which vitest counts as an unhandled error.\n */\nconst connectAs = async (username: string, key: user.Key) => {\n const client = createTestClient({\n username,\n password: \"test\",\n onInternalError: (err) => {\n if (!isDenial(err)) console.error(err);\n },\n });\n try {\n await client.access.policies.retrieveForSubject(user.ontologyID(key));\n } catch (err) {\n if (!isDenial(err)) throw errors.fromUnknown(err);\n }\n return client;\n};\n\nconst createUser = async (client: Synnax) => {\n const username = id.create();\n const u = await client.users.create({\n username,\n password: \"test\",\n firstName: \"test\",\n lastName: \"test\",\n });\n return { username, key: u.key };\n};\n\n/**\n * Creates a client authenticated as a new user holding a role that carries the\n * policies. Pass several to grant different actions on different objects, which one\n * policy cannot express.\n */\nexport const createTestClientWithPolicy = async (\n client: Synnax,\n pol: policy.New | policy.New[],\n) => {\n const u = await createUser(client);\n const policies = await Promise.all(\n array.toArray(pol).map(async (p) => await client.access.policies.create(p)),\n );\n const r = await client.access.roles.create({\n name: \"test\",\n description: \"test\",\n });\n await client.ontology.addChildren(\n role.ontologyID(r.key),\n ...policies.map(({ key }) => policy.ontologyID(key)),\n );\n await client.access.roles.assign({ user: u.key, role: r.key });\n return await connectAs(u.username, u.key);\n};\n\n/** The roles the Core provisions on startup. */\nexport const BUILT_IN_ROLES = [\n \"Owner\",\n \"Engineer\",\n \"Host\",\n \"Operator\",\n \"Viewer\",\n] as const;\n\nexport type BuiltInRole = (typeof BUILT_IN_ROLES)[number];\n\n/**\n * Creates a client authenticated as a new user holding one of the Core's built-in\n * roles, for exercising a real role's permission set instead of a synthetic policy.\n * @param name - The built-in role to assign.\n * @throws {NotFoundError} if the Core provisions no role under the name.\n */\nexport const createTestClientWithRole = async (\n client: Synnax,\n name: BuiltInRole,\n): Promise<Synnax> => {\n const roles = await client.access.roles.retrieve({});\n const r = roles.find((r) => r.name === name);\n if (r == null) throw new NotFoundError(`no built-in role named ${name}`);\n const u = await createUser(client);\n await client.access.roles.assign({ user: u.key, role: r.key });\n return await connectAs(u.username, u.key);\n};\n\n/**\n * Caches one client per built-in role, so a spec covering many roles pays the user\n * creation cost once each. Construct one per spec file.\n */\nexport class RoleClients {\n private readonly client: Synnax;\n private readonly byRole = new Map<BuiltInRole, Promise<Synnax>>();\n\n constructor(client: Synnax) {\n this.client = client;\n }\n\n /** Returns a client authenticated as a user holding the role. */\n async get(name: BuiltInRole): Promise<Synnax> {\n const existing = this.byRole.get(name);\n if (existing != null) return await existing;\n const created = createTestClientWithRole(this.client, name);\n this.byRole.set(name, created);\n return await created;\n }\n}\n","// Copyright 2026 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { DataType, id } from \"@synnaxlabs/x\";\n\nimport { type channel } from \"@/channel\";\nimport type Synnax from \"@/client\";\n\nexport const newIndexedPair = async (\n client: Synnax,\n): Promise<[channel.Channel, channel.Channel]> => {\n const index = await client.channels.create({\n leaseholder: 1,\n name: id.create(),\n dataType: DataType.TIMESTAMP,\n isIndex: true,\n });\n const data = await client.channels.create({\n leaseholder: 1,\n name: id.create(),\n dataType: DataType.FLOAT64,\n index: index.key,\n });\n return [index, data];\n};\n\nexport const newIndexedBoolPair = async (\n client: Synnax,\n): Promise<[channel.Channel, channel.Channel]> => {\n const index = await client.channels.create({\n leaseholder: 1,\n name: id.create(),\n dataType: DataType.TIMESTAMP,\n isIndex: true,\n });\n const data = await client.channels.create({\n leaseholder: 1,\n name: id.create(),\n dataType: DataType.BOOLEAN,\n index: index.key,\n });\n return [index, data];\n};\n\nexport const newVirtualChannel = async (client: Synnax): Promise<channel.Channel> => {\n const ch = await client.channels.create({\n name: id.create(),\n dataType: DataType.FLOAT64,\n virtual: true,\n });\n return ch;\n};\n\nexport const newVirtualBoolChannel = async (\n client: Synnax,\n): Promise<channel.Channel> => {\n const ch = await client.channels.create({\n name: id.create(),\n dataType: DataType.BOOLEAN,\n virtual: true,\n });\n return ch;\n};\n","// Copyright 2026 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { TimeSpan } from \"@synnaxlabs/x\";\n\nimport { type connection } from \"@/connection\";\n\n/** Resolves once the handle's status satisfies the predicate. */\nexport const waitForStatus = async (\n handle: connection.Handle,\n predicate: (status: connection.Status) => boolean,\n timeout: TimeSpan = TimeSpan.seconds(5),\n): Promise<connection.Status> => {\n if (predicate(handle.status)) return handle.status;\n return await new Promise<connection.Status>((resolve, reject) => {\n const timer = setTimeout(() => {\n detach();\n reject(new Error(\"timed out waiting for connection status\"));\n }, timeout.milliseconds);\n const detach = handle.onChange((status) => {\n if (!predicate(status)) return;\n clearTimeout(timer);\n detach();\n resolve(status);\n });\n });\n};\n\n/**\n * Resolves once the handle's change stream is live, so every later cluster write\n * reaches the client's cache.\n */\nexport const waitForStreamLive = async (\n handle: connection.Handle,\n timeout?: TimeSpan,\n): Promise<connection.Status> =>\n await waitForStatus(\n handle,\n ({ variant, details }) => variant === \"success\" && details.streamLive,\n timeout,\n );\n","// Copyright 2026 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { id } from \"@synnaxlabs/x\";\n\nimport type Synnax from \"@/client\";\nimport { type ontology } from \"@/ontology\";\nimport { project } from \"@/project\";\n\n/**\n * Creates a throwaway project and returns its ontology ID. Panel creation requires a\n * parent, so tests that mint panels directly parent them here.\n */\nexport const createPanelParent = async (client: Synnax): Promise<ontology.ID> => {\n const proj = await client.projects.create({\n name: `project-${id.create()}`,\n layout: {},\n });\n return project.ontologyID(proj.key);\n};\n","// Copyright 2026 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { connect, createServer, type Socket } from \"node:net\";\n\nimport { type breaker, TimeSpan } from \"@synnaxlabs/x\";\n\nconst DEFAULT_TARGET = { host: \"localhost\", port: 9090 };\n\n/**\n * Retry policy for a client pointed at a severable proxy. A spec drives its own\n * retries, so the client's must finish well inside one assertion budget: the\n * default policy waits seconds per request and outlasts a single `expect.poll`\n * attempt, which reports as a timeout rather than the real answer.\n */\nexport const FAST_RETRY: breaker.Config = {\n baseInterval: TimeSpan.milliseconds(10),\n maxInterval: TimeSpan.milliseconds(50),\n scale: 1.5,\n};\n\nexport interface SeverableProxyTarget {\n host?: string;\n port?: number;\n}\n\nexport interface SeverableProxy {\n /** Port the proxy accepts connections on. Point the client here. */\n port: number;\n /** Drops every live connection and refuses new ones, as if the cluster died. */\n sever: () => Promise<void>;\n /** Accepts connections again on the same port. */\n restore: () => Promise<void>;\n /** Shuts the proxy down for good. */\n close: () => Promise<void>;\n}\n\n/**\n * Creates a TCP proxy in front of the live test cluster so specs can simulate\n * cluster downtime without touching the cluster itself. Connect a client to\n * the returned port, then sever() and restore() the link.\n */\nexport const createSeverableProxy = async (\n target: SeverableProxyTarget = {},\n): Promise<SeverableProxy> => {\n const { host, port } = { ...DEFAULT_TARGET, ...target };\n const sockets = new Set<Socket>();\n let severed = false;\n const server = createServer((downstream) => {\n // A connection the kernel accepted before the sever is still delivered after it,\n // and forwarding it would let a request through a severed link.\n if (severed) {\n downstream.destroy();\n return;\n }\n const upstream = connect(port, host);\n sockets.add(downstream).add(upstream);\n const destroy = (): void => {\n sockets.delete(downstream);\n sockets.delete(upstream);\n downstream.destroy();\n upstream.destroy();\n };\n downstream.on(\"error\", destroy);\n upstream.on(\"error\", destroy);\n downstream.on(\"close\", destroy);\n upstream.on(\"close\", destroy);\n downstream.pipe(upstream);\n upstream.pipe(downstream);\n });\n const listen = async (listenPort: number): Promise<void> =>\n await new Promise((resolve, reject) => {\n server.once(\"error\", reject);\n server.listen(listenPort, () => {\n server.removeListener(\"error\", reject);\n resolve();\n });\n });\n await listen(0);\n const address = server.address();\n if (address == null || typeof address === \"string\")\n throw new Error(\"proxy failed to bind a port\");\n const boundPort = address.port;\n const sever = async (): Promise<void> => {\n severed = true;\n const closed = new Promise<void>((resolve) => server.close(() => resolve()));\n sockets.forEach((socket) => socket.destroy());\n sockets.clear();\n await closed;\n };\n return {\n port: boundPort,\n sever,\n restore: async () => {\n severed = false;\n await listen(boundPort);\n },\n close: sever,\n };\n};\n","// Copyright 2026 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { query } from \"@/query\";\n\nexport { isLive } from \"@/query/query\";\n\n/** Asserts the cached answer is live (present and not deleted) and returns it. */\nexport const expectLive = <D extends query.Data>(\n value: query.Cached<D> | undefined,\n): D => {\n if (!query.isLive<D>(value)) throw new Error(\"expected a live cached answer\");\n return value;\n};\n\n/** Asserts the cached answer is a deletion and returns it. */\nexport const expectDeleted = <D extends query.Data>(\n value: query.Cached<D> | undefined,\n): query.Deleted<D> => {\n if (!query.Deleted.matches<D>(value)) throw new Error(\"expected a deleted answer\");\n return value;\n};\n","// Copyright 2026 Synnax Labs, Inc.\n//\n// Use of this software is governed by the Business Source License included in the file\n// licenses/BSL.txt.\n//\n// As of the Change Date specified in that file, in accordance with the Business Source\n// License, use of this software will be governed by the Apache License, Version 2.0,\n// included in the file licenses/APL.txt.\n\nimport { DataType, type Series, TimeStamp } from \"@synnaxlabs/x\";\n\nimport { type framer } from \"@/framer\";\n\nexport const secondsLinspace = (start: number, n: number): TimeStamp[] =>\n Array.from({ length: n }, (_, i) => start + i).map((n) => TimeStamp.seconds(n));\n\nconst isRaw = (dt: DataType): boolean => dt.isVariable || dt.equals(DataType.UINT8);\n\n/** Narrows every numeric series to float32, anchoring bigints on an offset. Mirrors\n * the transform the visualization layer injects for WebGL rendering. */\nexport const glTransform: framer.Transform = {\n resolveDataType: (dt: DataType) => (isRaw(dt) ? dt : DataType.FLOAT32),\n convert: (series: Series, offset) => {\n if (isRaw(series.dataType)) return series;\n if (offset == null && series.dataType.usesBigInt && series.length > 0)\n offset = BigInt(series.data[0]);\n return series.convert(DataType.FLOAT32, offset);\n },\n};\n"],"mappings":";;;;;AAcA,IAAa,IAAmC;CAC9C,MAAM;CACN,MAAM;CACN,UAAU;CACV,UAAU;CACV,OAAO;EACL,YAAY;EACZ,cAAc,EAAS,QAAQ,CAAC;EAChC,OAAO;CACT;AACF,GAKM,IAAwB,CAAC;AAG/B,EAAS,YAAY;CAEnB,IAAM,KAAW,MADK,QAAQ,WAAW,EAAY,KAAK,MAAW,EAAO,MAAM,CAAC,CAAC,EAAA,CAC3D,QAAQ,MAAW,EAAO,WAAW,UAAU;CACxE,IAAI,EAAS,SAAS,GACpB,MAAU,eACR,EAAS,KAAK,MAAY,EAAQ,MAAM,GACxC,8BACF;AACJ,CAAC;AAOD,IAAa,KAAoB,MAA2C;CAC1E,IAAM,IAAS,IAAI,EAAO;EAAE,GAAG;EAAoB,GAAG;CAAO,CAAC;CAE9D,OADA,EAAY,KAAK,CAAM,GAChB;AACT,GChCM,KAAY,MAChB,EAAkB,QAAQ,CAAG,KAC5B,aAAe,SAAS,EAAI,SAAS,QAAQ,EAAS,EAAI,KAAK,GAO5D,IAAY,OAAO,GAAkB,MAAkB;CAC3D,IAAM,IAAS,EAAiB;EAC9B;EACA,UAAU;EACV,kBAAkB,MAAQ;GACxB,AAAK,EAAS,CAAG,KAAG,QAAQ,MAAM,CAAG;EACvC;CACF,CAAC;CACD,IAAI;EACF,MAAM,EAAO,OAAO,SAAS,mBAAmB,EAAgB,CAAG,CAAC;CACtE,SAAS,GAAK;EACZ,IAAI,CAAC,EAAS,CAAG,GAAG,MAAM,EAAO,YAAY,CAAG;CAClD;CACA,OAAO;AACT,GAEM,IAAa,OA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labs/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.57.1",
|
|
4
4
|
"description": "The Synnax Client Library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"synnax",
|
|
@@ -17,39 +17,62 @@
|
|
|
17
17
|
"url": "https://github.com/synnaxlabs/synnax/issues"
|
|
18
18
|
},
|
|
19
19
|
"license": "BUSL-1.1",
|
|
20
|
-
"main": "dist/client.cjs",
|
|
21
20
|
"repository": {
|
|
22
21
|
"type": "git",
|
|
23
22
|
"url": "git+https://github.com/synnaxlabs/synnax.git",
|
|
24
23
|
"directory": "client/ts"
|
|
25
24
|
},
|
|
26
25
|
"dependencies": {
|
|
27
|
-
"
|
|
28
|
-
"immer": "^11.1.8",
|
|
26
|
+
"immer": "^11.1.15",
|
|
29
27
|
"zod": "^4.4.3",
|
|
30
|
-
"@synnaxlabs/
|
|
31
|
-
"@synnaxlabs/
|
|
28
|
+
"@synnaxlabs/alamos": "^0.57.0",
|
|
29
|
+
"@synnaxlabs/freighter": "^0.57.0",
|
|
30
|
+
"@synnaxlabs/x": "^0.57.1"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"vitest": "^4.1.10"
|
|
34
|
+
},
|
|
35
|
+
"peerDependenciesMeta": {
|
|
36
|
+
"vitest": {
|
|
37
|
+
"optional": true
|
|
38
|
+
}
|
|
32
39
|
},
|
|
33
40
|
"devDependencies": {
|
|
34
|
-
"@vitest/coverage-v8": "^4.1.
|
|
35
|
-
"@types/node": "^
|
|
36
|
-
"eslint": "^10.
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"vitest": "^4.1.6",
|
|
41
|
-
"@synnaxlabs/vite-plugin": "^0.0.0",
|
|
41
|
+
"@vitest/coverage-v8": "^4.1.10",
|
|
42
|
+
"@types/node": "^26.1.2",
|
|
43
|
+
"eslint": "^10.8.0",
|
|
44
|
+
"typescript": "^7.0.2",
|
|
45
|
+
"vite": "^8.2.0",
|
|
46
|
+
"vitest": "^4.1.10",
|
|
42
47
|
"@synnaxlabs/eslint-config": "^0.0.0",
|
|
48
|
+
"@synnaxlabs/madge": "^0.0.0",
|
|
49
|
+
"@synnaxlabs/vite-plugin": "^0.0.0",
|
|
43
50
|
"@synnaxlabs/tsconfig": "^0.0.0"
|
|
44
51
|
},
|
|
45
52
|
"type": "module",
|
|
46
|
-
"
|
|
47
|
-
|
|
53
|
+
"files": [
|
|
54
|
+
"dist",
|
|
55
|
+
"src",
|
|
56
|
+
"!**/*.spec.*",
|
|
57
|
+
"!**/*.bench.*",
|
|
58
|
+
"!dist/eslint.config.*"
|
|
59
|
+
],
|
|
60
|
+
"exports": {
|
|
61
|
+
".": {
|
|
62
|
+
"types": "./dist/src/index.d.ts",
|
|
63
|
+
"default": "./dist/client.js"
|
|
64
|
+
},
|
|
65
|
+
"./testutil": {
|
|
66
|
+
"types": "./dist/src/testutil/index.d.ts",
|
|
67
|
+
"default": "./dist/testutil.js"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
48
70
|
"scripts": {
|
|
49
71
|
"build": "tsc --noEmit && vite build",
|
|
50
72
|
"check-types": "tsc --noEmit",
|
|
51
73
|
"watch": "tsc --noEmit && vite build --watch",
|
|
52
74
|
"test": "vitest",
|
|
75
|
+
"bench": "vitest bench",
|
|
53
76
|
"cov": "vitest --coverage",
|
|
54
77
|
"lint": "eslint",
|
|
55
78
|
"fix": "eslint --fix",
|
package/src/access/client.ts
CHANGED
|
@@ -9,15 +9,26 @@
|
|
|
9
9
|
|
|
10
10
|
import { type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
11
|
|
|
12
|
+
import { Granted } from "@/access/granted";
|
|
12
13
|
import { policy } from "@/access/policy";
|
|
13
14
|
import { role } from "@/access/role";
|
|
15
|
+
import { type ontology } from "@/ontology";
|
|
16
|
+
import { type query } from "@/query";
|
|
17
|
+
|
|
18
|
+
export interface ClientConfig {
|
|
19
|
+
unary: UnaryClient;
|
|
20
|
+
cache: query.Cache;
|
|
21
|
+
ontology: ontology.Client;
|
|
22
|
+
}
|
|
14
23
|
|
|
15
24
|
export class Client {
|
|
16
25
|
readonly policies: policy.Client;
|
|
17
26
|
readonly roles: role.Client;
|
|
27
|
+
readonly granted: Granted;
|
|
18
28
|
|
|
19
|
-
constructor(
|
|
20
|
-
this.policies = new policy.Client(
|
|
21
|
-
this.roles = new role.Client(
|
|
29
|
+
constructor(cfg: ClientConfig) {
|
|
30
|
+
this.policies = new policy.Client(cfg);
|
|
31
|
+
this.roles = new role.Client(cfg);
|
|
32
|
+
this.granted = new Granted({ policies: this.policies });
|
|
22
33
|
}
|
|
23
34
|
}
|
package/src/access/enforce.ts
CHANGED
|
@@ -51,7 +51,6 @@ export const allowRequest = (req: Request, policies: Policy[]): boolean => {
|
|
|
51
51
|
let allowed = false;
|
|
52
52
|
|
|
53
53
|
for (const policy of policies) {
|
|
54
|
-
// Check if every requested action is allowed by this policy
|
|
55
54
|
const actionAllowed = policy.actions.includes(action);
|
|
56
55
|
if (!actionAllowed) continue;
|
|
57
56
|
|
|
@@ -75,10 +74,8 @@ export const allowRequest = (req: Request, policies: Policy[]): boolean => {
|
|
|
75
74
|
if (allowed) break;
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
// If any object is not allowed, the entire request fails
|
|
79
77
|
if (!allowed) return false;
|
|
80
78
|
}
|
|
81
79
|
|
|
82
|
-
// All objects are allowed
|
|
83
80
|
return true;
|
|
84
81
|
};
|
package/src/access/external.ts
CHANGED