@synnaxlabs/client 0.49.3 → 0.52.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +10 -10
- package/CONTRIBUTING.md +1 -2
- package/README.md +1 -1
- package/dist/client.cjs +58 -34
- package/dist/client.js +5256 -4528
- package/dist/eslint.config.d.ts +2 -2
- package/dist/eslint.config.d.ts.map +1 -1
- package/dist/src/access/policy/client.d.ts +90 -76
- package/dist/src/access/policy/client.d.ts.map +1 -1
- package/dist/src/access/policy/payload.d.ts +17 -14
- package/dist/src/access/policy/payload.d.ts.map +1 -1
- package/dist/src/access/role/payload.d.ts +2 -2
- package/dist/src/arc/payload.d.ts +21 -20
- package/dist/src/arc/payload.d.ts.map +1 -1
- package/dist/src/channel/client.d.ts +9 -15
- package/dist/src/channel/client.d.ts.map +1 -1
- package/dist/src/channel/payload.d.ts +18 -18
- package/dist/src/channel/payload.d.ts.map +1 -1
- package/dist/src/channel/retriever.d.ts.map +1 -1
- package/dist/src/client.d.ts +12 -0
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/device/client.d.ts +14 -7
- package/dist/src/device/client.d.ts.map +1 -1
- package/dist/src/device/payload.d.ts +65 -32
- package/dist/src/device/payload.d.ts.map +1 -1
- package/dist/src/device/payload.spec.d.ts +2 -0
- package/dist/src/device/payload.spec.d.ts.map +1 -0
- package/dist/src/framer/adapter.d.ts.map +1 -1
- package/dist/src/framer/client.d.ts +2 -2
- package/dist/src/framer/frame.d.ts +5 -5
- package/dist/src/framer/frame.d.ts.map +1 -1
- package/dist/src/framer/streamer.d.ts +7 -17
- package/dist/src/framer/streamer.d.ts.map +1 -1
- package/dist/src/framer/writer.d.ts +9 -19
- package/dist/src/framer/writer.d.ts.map +1 -1
- package/dist/src/group/access.spec.d.ts.map +1 -0
- package/dist/src/{ontology/group → group}/client.d.ts +3 -2
- package/dist/src/group/client.d.ts.map +1 -0
- package/dist/src/group/external.d.ts.map +1 -0
- package/dist/src/group/group.spec.d.ts.map +1 -0
- package/dist/src/group/index.d.ts.map +1 -0
- package/dist/src/{ontology/group → group}/payload.d.ts +1 -1
- package/dist/src/group/payload.d.ts.map +1 -0
- package/dist/src/index.d.ts +6 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/label/client.d.ts +27 -10
- package/dist/src/label/client.d.ts.map +1 -1
- package/dist/src/label/payload.d.ts +15 -1
- package/dist/src/label/payload.d.ts.map +1 -1
- package/dist/src/lineplot/access.spec.d.ts.map +1 -0
- package/dist/src/{workspace/lineplot → lineplot}/client.d.ts +6 -6
- package/dist/src/lineplot/client.d.ts.map +1 -0
- package/dist/src/lineplot/external.d.ts.map +1 -0
- package/dist/src/lineplot/index.d.ts.map +1 -0
- package/dist/src/lineplot/lineplot.spec.d.ts.map +1 -0
- package/dist/src/{workspace/lineplot → lineplot}/payload.d.ts +3 -3
- package/dist/src/lineplot/payload.d.ts.map +1 -0
- package/dist/src/log/access.spec.d.ts.map +1 -0
- package/dist/src/{workspace/log → log}/client.d.ts +6 -6
- package/dist/src/log/client.d.ts.map +1 -0
- package/dist/src/log/external.d.ts.map +1 -0
- package/dist/src/log/index.d.ts.map +1 -0
- package/dist/src/log/log.spec.d.ts.map +1 -0
- package/dist/src/{workspace/log → log}/payload.d.ts +3 -3
- package/dist/src/log/payload.d.ts.map +1 -0
- package/dist/src/ontology/client.d.ts +7 -9
- package/dist/src/ontology/client.d.ts.map +1 -1
- package/dist/src/ontology/payload.d.ts +25 -20
- package/dist/src/ontology/payload.d.ts.map +1 -1
- package/dist/src/ontology/writer.d.ts +15 -10
- package/dist/src/ontology/writer.d.ts.map +1 -1
- package/dist/src/rack/client.d.ts +2 -2
- package/dist/src/rack/payload.d.ts +44 -16
- package/dist/src/rack/payload.d.ts.map +1 -1
- package/dist/src/ranger/alias/client.d.ts +17 -0
- package/dist/src/ranger/alias/client.d.ts.map +1 -0
- package/dist/src/ranger/alias/external.d.ts +2 -0
- package/dist/src/ranger/alias/external.d.ts.map +1 -0
- package/dist/src/ranger/alias/index.d.ts +2 -0
- package/dist/src/ranger/alias/index.d.ts.map +1 -0
- package/dist/src/ranger/{alias.d.ts → alias/payload.d.ts} +14 -20
- package/dist/src/ranger/alias/payload.d.ts.map +1 -0
- package/dist/src/ranger/client.d.ts +10 -10
- package/dist/src/ranger/client.d.ts.map +1 -1
- package/dist/src/ranger/external.d.ts +20 -0
- package/dist/src/ranger/external.d.ts.map +1 -1
- package/dist/src/ranger/kv/client.d.ts +14 -0
- package/dist/src/ranger/kv/client.d.ts.map +1 -0
- package/dist/src/ranger/kv/external.d.ts +2 -0
- package/dist/src/ranger/kv/external.d.ts.map +1 -0
- package/dist/src/ranger/kv/index.d.ts +2 -0
- package/dist/src/ranger/kv/index.d.ts.map +1 -0
- package/dist/src/ranger/kv/payload.d.ts +26 -0
- package/dist/src/ranger/kv/payload.d.ts.map +1 -0
- package/dist/src/ranger/payload.d.ts +45 -3
- package/dist/src/ranger/payload.d.ts.map +1 -1
- package/dist/src/ranger/writer.d.ts +18 -3
- package/dist/src/ranger/writer.d.ts.map +1 -1
- package/dist/src/schematic/access.spec.d.ts.map +1 -0
- package/dist/src/{workspace/schematic → schematic}/client.d.ts +6 -6
- package/dist/src/schematic/client.d.ts.map +1 -0
- package/dist/src/schematic/external.d.ts.map +1 -0
- package/dist/src/schematic/index.d.ts.map +1 -0
- package/dist/src/{workspace/schematic → schematic}/payload.d.ts +3 -3
- package/dist/src/schematic/payload.d.ts.map +1 -0
- package/dist/src/schematic/schematic.spec.d.ts.map +1 -0
- package/dist/src/schematic/symbol/access.spec.d.ts.map +1 -0
- package/dist/src/{workspace/schematic → schematic}/symbol/client.d.ts +2 -2
- package/dist/src/schematic/symbol/client.d.ts.map +1 -0
- package/dist/src/schematic/symbol/client.spec.d.ts.map +1 -0
- package/dist/src/schematic/symbol/external.d.ts.map +1 -0
- package/dist/src/schematic/symbol/index.d.ts.map +1 -0
- package/dist/src/schematic/symbol/payload.d.ts.map +1 -0
- package/dist/src/status/payload.d.ts +43 -7
- package/dist/src/status/payload.d.ts.map +1 -1
- package/dist/src/table/access.spec.d.ts.map +1 -0
- package/dist/src/{workspace/table → table}/client.d.ts +6 -6
- package/dist/src/table/client.d.ts.map +1 -0
- package/dist/src/table/external.d.ts.map +1 -0
- package/dist/src/table/index.d.ts.map +1 -0
- package/dist/src/{workspace/table → table}/payload.d.ts +3 -3
- package/dist/src/table/payload.d.ts.map +1 -0
- package/dist/src/table/table.spec.d.ts.map +1 -0
- package/dist/src/task/client.d.ts +2 -2
- package/dist/src/task/client.d.ts.map +1 -1
- package/dist/src/task/payload.d.ts +5 -4
- package/dist/src/task/payload.d.ts.map +1 -1
- package/dist/src/task/payload.spec.d.ts +2 -0
- package/dist/src/task/payload.spec.d.ts.map +1 -0
- package/dist/src/user/client.d.ts +2 -2
- package/dist/src/view/client.d.ts +43 -0
- package/dist/src/view/client.d.ts.map +1 -0
- package/dist/src/view/external.d.ts +3 -0
- package/dist/src/view/external.d.ts.map +1 -0
- package/dist/src/view/index.d.ts +2 -0
- package/dist/src/view/index.d.ts.map +1 -0
- package/dist/src/view/payload.d.ts +20 -0
- package/dist/src/view/payload.d.ts.map +1 -0
- package/dist/src/view/view.spec.d.ts +2 -0
- package/dist/src/view/view.spec.d.ts.map +1 -0
- package/dist/src/workspace/client.d.ts +3 -11
- package/dist/src/workspace/client.d.ts.map +1 -1
- package/dist/src/workspace/payload.d.ts +3 -3
- package/eslint.config.ts +3 -4
- package/examples/node/basicReadWrite.js +1 -1
- package/examples/node/createChannels.js +50 -0
- package/examples/node/createRange.js +67 -0
- package/examples/node/readLatest.js +76 -0
- package/examples/node/seriesAndFrames.js +2 -2
- package/examples/node/{liveStream.js → streamRead.js} +1 -1
- package/examples/node/streamWrite.js +1 -1
- package/package.json +11 -10
- package/src/access/client.ts +1 -1
- package/src/access/enforce.spec.ts +1 -1
- package/src/access/enforce.ts +1 -1
- package/src/access/external.ts +1 -1
- package/src/access/index.ts +1 -1
- package/src/access/payload.ts +1 -1
- package/src/access/policy/access.spec.ts +1 -1
- package/src/access/policy/client.ts +1 -1
- package/src/access/policy/external.ts +1 -1
- package/src/access/policy/index.ts +1 -1
- package/src/access/policy/payload.ts +1 -1
- package/src/access/role/client.ts +1 -1
- package/src/access/role/external.ts +1 -1
- package/src/access/role/index.ts +1 -1
- package/src/access/role/payload.ts +1 -1
- package/src/access/role/role.spec.ts +1 -1
- package/src/arc/access.spec.ts +1 -7
- package/src/arc/client.ts +1 -1
- package/src/arc/external.ts +1 -1
- package/src/arc/index.ts +1 -1
- package/src/arc/lsp.spec.ts +156 -287
- package/src/arc/payload.ts +7 -12
- package/src/auth/auth.spec.ts +1 -1
- package/src/auth/auth.ts +1 -1
- package/src/auth/index.ts +1 -1
- package/src/channel/access.spec.ts +1 -1
- package/src/channel/batchRetriever.spec.ts +1 -3
- package/src/channel/channel.spec.ts +13 -20
- package/src/channel/client.ts +8 -41
- package/src/channel/external.ts +1 -1
- package/src/channel/index.ts +1 -1
- package/src/channel/payload.spec.ts +1 -58
- package/src/channel/payload.ts +19 -19
- package/src/channel/retriever.ts +7 -6
- package/src/channel/writer.ts +1 -1
- package/src/client.ts +24 -4
- package/src/connection/checker.ts +2 -2
- package/src/connection/connection.spec.ts +1 -1
- package/src/connection/index.ts +1 -1
- package/src/connection.spec.ts +1 -1
- package/src/control/client.ts +1 -1
- package/src/control/external.ts +1 -1
- package/src/control/index.ts +1 -1
- package/src/control/state.spec.ts +1 -1
- package/src/control/state.ts +1 -1
- package/src/device/access.spec.ts +1 -1
- package/src/device/client.ts +90 -44
- package/src/device/device.spec.ts +1 -1
- package/src/device/external.ts +1 -1
- package/src/device/index.ts +1 -1
- package/src/device/payload.spec.ts +118 -0
- package/src/device/payload.ts +56 -31
- package/src/errors.spec.ts +2 -2
- package/src/errors.ts +1 -1
- package/src/framer/adapter.spec.ts +1 -1
- package/src/framer/adapter.ts +6 -8
- package/src/framer/client.spec.ts +1 -1
- package/src/framer/client.ts +1 -1
- package/src/framer/codec.spec.ts +1 -1
- package/src/framer/codec.ts +1 -1
- package/src/framer/deleter.spec.ts +1 -1
- package/src/framer/deleter.ts +1 -1
- package/src/framer/external.ts +1 -1
- package/src/framer/frame.spec.ts +1 -1
- package/src/framer/frame.ts +9 -9
- package/src/framer/index.ts +1 -1
- package/src/framer/iterator.spec.ts +1 -1
- package/src/framer/iterator.ts +1 -1
- package/src/framer/payload.ts +1 -1
- package/src/framer/reader.spec.ts +1 -1
- package/src/framer/reader.ts +1 -1
- package/src/framer/streamProxy.ts +1 -1
- package/src/framer/streamer.spec.ts +1 -2
- package/src/framer/streamer.ts +4 -4
- package/src/framer/writer.spec.ts +1 -1
- package/src/framer/writer.ts +1 -1
- package/src/{ontology/group → group}/access.spec.ts +8 -8
- package/src/{ontology/group → group}/client.ts +2 -2
- package/src/group/external.ts +11 -0
- package/src/{ontology/group → group}/group.spec.ts +10 -10
- package/src/{workspace/log → group}/index.ts +2 -2
- package/src/{ontology/group → group}/payload.ts +1 -1
- package/src/index.ts +7 -6
- package/src/label/access.spec.ts +2 -2
- package/src/label/client.ts +2 -2
- package/src/label/external.ts +1 -1
- package/src/label/index.ts +1 -1
- package/src/label/label.spec.ts +5 -5
- package/src/label/payload.ts +1 -1
- package/src/{workspace/lineplot → lineplot}/access.spec.ts +15 -15
- package/src/{workspace/lineplot → lineplot}/client.ts +14 -14
- package/src/lineplot/external.ts +11 -0
- package/src/{ontology/group → lineplot}/index.ts +2 -2
- package/src/{workspace/lineplot → lineplot}/lineplot.spec.ts +13 -13
- package/src/{workspace/lineplot → lineplot}/payload.ts +1 -1
- package/src/{workspace/log → log}/access.spec.ts +17 -19
- package/src/{workspace/log → log}/client.ts +14 -14
- package/src/{workspace/schematic/index.ts → log/external.ts} +3 -2
- package/src/{workspace/table → log}/index.ts +2 -2
- package/src/{workspace/log → log}/log.spec.ts +11 -11
- package/src/{workspace/log → log}/payload.ts +1 -1
- package/src/ontology/client.ts +7 -14
- package/src/ontology/external.ts +1 -1
- package/src/ontology/index.ts +1 -1
- package/src/ontology/ontology.spec.ts +13 -13
- package/src/ontology/payload.ts +6 -3
- package/src/ontology/writer.ts +1 -1
- package/src/rack/access.spec.ts +1 -1
- package/src/rack/client.ts +1 -1
- package/src/rack/external.ts +1 -1
- package/src/rack/index.ts +1 -1
- package/src/rack/payload.ts +1 -1
- package/src/rack/rack.spec.ts +1 -1
- package/src/ranger/access.spec.ts +1 -1
- package/src/ranger/{alias.ts → alias/client.ts} +7 -38
- package/src/{workspace/lineplot → ranger/alias}/external.ts +11 -3
- package/src/{workspace/lineplot → ranger/alias}/index.ts +2 -2
- package/src/ranger/alias/payload.ts +50 -0
- package/src/ranger/client.ts +27 -20
- package/src/ranger/external.ts +23 -1
- package/src/ranger/index.ts +1 -1
- package/src/ranger/{kv.ts → kv/client.ts} +6 -20
- package/src/{workspace/schematic → ranger/kv}/external.ts +8 -4
- package/src/ranger/kv/index.ts +10 -0
- package/src/ranger/kv/payload.ts +32 -0
- package/src/ranger/payload.ts +3 -3
- package/src/ranger/ranger.spec.ts +2 -2
- package/src/ranger/writer.ts +1 -1
- package/src/{workspace/schematic → schematic}/access.spec.ts +15 -15
- package/src/{workspace/schematic → schematic}/client.ts +15 -15
- package/src/{workspace/log → schematic}/external.ts +4 -3
- package/src/schematic/index.ts +10 -0
- package/src/{workspace/schematic → schematic}/payload.ts +1 -1
- package/src/{workspace/schematic → schematic}/schematic.spec.ts +18 -18
- package/src/{workspace/schematic → schematic}/symbol/access.spec.ts +20 -20
- package/src/{workspace/schematic → schematic}/symbol/client.spec.ts +17 -17
- package/src/{workspace/schematic → schematic}/symbol/client.ts +9 -9
- package/src/{ontology/group → schematic/symbol}/external.ts +3 -3
- package/src/schematic/symbol/index.ts +10 -0
- package/src/{workspace/schematic → schematic}/symbol/payload.ts +1 -1
- package/src/status/access.spec.ts +1 -1
- package/src/status/client.ts +1 -1
- package/src/status/external.ts +1 -1
- package/src/status/index.ts +1 -1
- package/src/status/payload.ts +2 -2
- package/src/status/status.spec.ts +3 -3
- package/src/{workspace/table → table}/access.spec.ts +15 -15
- package/src/{workspace/table → table}/client.ts +16 -13
- package/src/table/external.ts +11 -0
- package/src/table/index.ts +10 -0
- package/src/{workspace/table → table}/payload.ts +1 -1
- package/src/{workspace/table → table}/table.spec.ts +13 -13
- package/src/task/access.spec.ts +1 -1
- package/src/task/client.ts +11 -6
- package/src/task/external.ts +1 -1
- package/src/task/index.ts +1 -1
- package/src/task/payload.spec.ts +113 -0
- package/src/task/payload.ts +14 -10
- package/src/task/task.spec.ts +1 -1
- package/src/testutil/access.ts +1 -1
- package/src/testutil/channels.ts +1 -1
- package/src/testutil/client.ts +1 -1
- package/src/testutil/telem.ts +1 -1
- package/src/transport.ts +1 -1
- package/src/user/access.spec.ts +1 -1
- package/src/user/client.ts +1 -1
- package/src/user/external.ts +1 -1
- package/src/user/index.ts +1 -1
- package/src/user/payload.ts +1 -1
- package/src/user/user.spec.ts +1 -1
- package/src/util/decodeJSONString.ts +1 -1
- package/src/util/parseWithoutKeyConversion.ts +1 -1
- package/src/util/retrieve.spec.ts +1 -1
- package/src/util/retrieve.ts +1 -1
- package/src/util/telem.ts +1 -1
- package/src/view/client.ts +96 -0
- package/src/view/external.ts +11 -0
- package/src/view/index.ts +10 -0
- package/src/view/payload.ts +25 -0
- package/src/view/view.spec.ts +161 -0
- package/src/vite-env.d.ts +1 -1
- package/src/workspace/access.spec.ts +1 -1
- package/src/workspace/client.ts +1 -13
- package/src/workspace/external.ts +1 -1
- package/src/workspace/index.ts +1 -1
- package/src/workspace/payload.ts +1 -1
- package/src/workspace/workspace.spec.ts +1 -1
- package/vite.config.ts +1 -1
- package/dist/src/ontology/group/access.spec.d.ts.map +0 -1
- package/dist/src/ontology/group/client.d.ts.map +0 -1
- package/dist/src/ontology/group/external.d.ts.map +0 -1
- package/dist/src/ontology/group/group.spec.d.ts.map +0 -1
- package/dist/src/ontology/group/index.d.ts.map +0 -1
- package/dist/src/ontology/group/payload.d.ts.map +0 -1
- package/dist/src/ranger/alias.d.ts.map +0 -1
- package/dist/src/ranger/kv.d.ts +0 -48
- package/dist/src/ranger/kv.d.ts.map +0 -1
- package/dist/src/workspace/lineplot/access.spec.d.ts.map +0 -1
- package/dist/src/workspace/lineplot/client.d.ts.map +0 -1
- package/dist/src/workspace/lineplot/external.d.ts.map +0 -1
- package/dist/src/workspace/lineplot/index.d.ts.map +0 -1
- package/dist/src/workspace/lineplot/lineplot.spec.d.ts.map +0 -1
- package/dist/src/workspace/lineplot/payload.d.ts.map +0 -1
- package/dist/src/workspace/log/access.spec.d.ts.map +0 -1
- package/dist/src/workspace/log/client.d.ts.map +0 -1
- package/dist/src/workspace/log/external.d.ts.map +0 -1
- package/dist/src/workspace/log/index.d.ts.map +0 -1
- package/dist/src/workspace/log/log.spec.d.ts.map +0 -1
- package/dist/src/workspace/log/payload.d.ts.map +0 -1
- package/dist/src/workspace/schematic/access.spec.d.ts.map +0 -1
- package/dist/src/workspace/schematic/client.d.ts.map +0 -1
- package/dist/src/workspace/schematic/external.d.ts.map +0 -1
- package/dist/src/workspace/schematic/index.d.ts.map +0 -1
- package/dist/src/workspace/schematic/payload.d.ts.map +0 -1
- package/dist/src/workspace/schematic/schematic.spec.d.ts.map +0 -1
- package/dist/src/workspace/schematic/symbol/access.spec.d.ts.map +0 -1
- package/dist/src/workspace/schematic/symbol/client.d.ts.map +0 -1
- package/dist/src/workspace/schematic/symbol/client.spec.d.ts.map +0 -1
- package/dist/src/workspace/schematic/symbol/external.d.ts.map +0 -1
- package/dist/src/workspace/schematic/symbol/index.d.ts.map +0 -1
- package/dist/src/workspace/schematic/symbol/payload.d.ts.map +0 -1
- package/dist/src/workspace/table/access.spec.d.ts.map +0 -1
- package/dist/src/workspace/table/client.d.ts.map +0 -1
- package/dist/src/workspace/table/external.d.ts.map +0 -1
- package/dist/src/workspace/table/index.d.ts.map +0 -1
- package/dist/src/workspace/table/payload.d.ts.map +0 -1
- package/dist/src/workspace/table/table.spec.d.ts.map +0 -1
- package/src/workspace/schematic/symbol/external.ts +0 -11
- package/src/workspace/schematic/symbol/index.ts +0 -10
- package/src/workspace/table/external.ts +0 -11
- /package/dist/src/{ontology/group → group}/access.spec.d.ts +0 -0
- /package/dist/src/{ontology/group → group}/external.d.ts +0 -0
- /package/dist/src/{ontology/group → group}/group.spec.d.ts +0 -0
- /package/dist/src/{ontology/group → group}/index.d.ts +0 -0
- /package/dist/src/{workspace/lineplot → lineplot}/access.spec.d.ts +0 -0
- /package/dist/src/{workspace/lineplot → lineplot}/external.d.ts +0 -0
- /package/dist/src/{workspace/lineplot → lineplot}/index.d.ts +0 -0
- /package/dist/src/{workspace/lineplot → lineplot}/lineplot.spec.d.ts +0 -0
- /package/dist/src/{workspace/log → log}/access.spec.d.ts +0 -0
- /package/dist/src/{workspace/log → log}/external.d.ts +0 -0
- /package/dist/src/{workspace/log → log}/index.d.ts +0 -0
- /package/dist/src/{workspace/log → log}/log.spec.d.ts +0 -0
- /package/dist/src/{workspace/schematic → schematic}/access.spec.d.ts +0 -0
- /package/dist/src/{workspace/schematic → schematic}/external.d.ts +0 -0
- /package/dist/src/{workspace/schematic → schematic}/index.d.ts +0 -0
- /package/dist/src/{workspace/schematic → schematic}/schematic.spec.d.ts +0 -0
- /package/dist/src/{workspace/schematic → schematic}/symbol/access.spec.d.ts +0 -0
- /package/dist/src/{workspace/schematic → schematic}/symbol/client.spec.d.ts +0 -0
- /package/dist/src/{workspace/schematic → schematic}/symbol/external.d.ts +0 -0
- /package/dist/src/{workspace/schematic → schematic}/symbol/index.d.ts +0 -0
- /package/dist/src/{workspace/schematic → schematic}/symbol/payload.d.ts +0 -0
- /package/dist/src/{workspace/table → table}/access.spec.d.ts +0 -0
- /package/dist/src/{workspace/table → table}/external.d.ts +0 -0
- /package/dist/src/{workspace/table → table}/index.d.ts +0 -0
- /package/dist/src/{workspace/table → table}/table.spec.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2026 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -12,8 +12,6 @@ import { array, type record } from "@synnaxlabs/x";
|
|
|
12
12
|
import { z } from "zod";
|
|
13
13
|
|
|
14
14
|
import { ontology } from "@/ontology";
|
|
15
|
-
import { checkForMultipleOrNoResults } from "@/util/retrieve";
|
|
16
|
-
import { type Key as WorkspaceKey, keyZ as workspaceKeyZ } from "@/workspace/payload";
|
|
17
15
|
import {
|
|
18
16
|
type Key,
|
|
19
17
|
keyZ,
|
|
@@ -22,7 +20,9 @@ import {
|
|
|
22
20
|
type Params,
|
|
23
21
|
remoteZ,
|
|
24
22
|
type Table,
|
|
25
|
-
} from "@/
|
|
23
|
+
} from "@/table/payload";
|
|
24
|
+
import { checkForMultipleOrNoResults } from "@/util/retrieve";
|
|
25
|
+
import { workspace } from "@/workspace";
|
|
26
26
|
|
|
27
27
|
const renameReqZ = z.object({ key: keyZ, name: z.string() });
|
|
28
28
|
|
|
@@ -41,7 +41,7 @@ export type RetrieveMultipleParams = z.input<typeof retrieveReqZ>;
|
|
|
41
41
|
|
|
42
42
|
const retrieveResZ = z.object({ tables: array.nullableZ(remoteZ) });
|
|
43
43
|
|
|
44
|
-
const createReqZ = z.object({ workspace:
|
|
44
|
+
const createReqZ = z.object({ workspace: workspace.keyZ, tables: newZ.array() });
|
|
45
45
|
const createResZ = z.object({ tables: remoteZ.array() });
|
|
46
46
|
|
|
47
47
|
const emptyResZ = z.object({});
|
|
@@ -53,13 +53,16 @@ export class Client {
|
|
|
53
53
|
this.client = client;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
async create(workspace:
|
|
57
|
-
async create(workspace:
|
|
58
|
-
async create(
|
|
56
|
+
async create(workspace: workspace.Key, table: New): Promise<Table>;
|
|
57
|
+
async create(workspace: workspace.Key, tables: New[]): Promise<Table[]>;
|
|
58
|
+
async create(
|
|
59
|
+
workspace: workspace.Key,
|
|
60
|
+
tables: New | New[],
|
|
61
|
+
): Promise<Table | Table[]> {
|
|
59
62
|
const isMany = Array.isArray(tables);
|
|
60
63
|
const res = await sendRequired(
|
|
61
64
|
this.client,
|
|
62
|
-
"/
|
|
65
|
+
"/table/create",
|
|
63
66
|
{ workspace, tables: array.toArray(tables) },
|
|
64
67
|
createReqZ,
|
|
65
68
|
createResZ,
|
|
@@ -70,7 +73,7 @@ export class Client {
|
|
|
70
73
|
async rename(key: Key, name: string): Promise<void> {
|
|
71
74
|
await sendRequired(
|
|
72
75
|
this.client,
|
|
73
|
-
"/
|
|
76
|
+
"/table/rename",
|
|
74
77
|
{ key, name },
|
|
75
78
|
renameReqZ,
|
|
76
79
|
emptyResZ,
|
|
@@ -80,7 +83,7 @@ export class Client {
|
|
|
80
83
|
async setData(key: Key, data: record.Unknown): Promise<void> {
|
|
81
84
|
await sendRequired(
|
|
82
85
|
this.client,
|
|
83
|
-
"/
|
|
86
|
+
"/table/set-data",
|
|
84
87
|
{ key, data: JSON.stringify(data) },
|
|
85
88
|
setDataReqZ,
|
|
86
89
|
emptyResZ,
|
|
@@ -95,7 +98,7 @@ export class Client {
|
|
|
95
98
|
const isSingle = singleRetrieveArgsZ.safeParse(args).success;
|
|
96
99
|
const res = await sendRequired(
|
|
97
100
|
this.client,
|
|
98
|
-
"/
|
|
101
|
+
"/table/retrieve",
|
|
99
102
|
args,
|
|
100
103
|
retrieveArgsZ,
|
|
101
104
|
retrieveResZ,
|
|
@@ -107,7 +110,7 @@ export class Client {
|
|
|
107
110
|
async delete(keys: Params): Promise<void> {
|
|
108
111
|
await sendRequired(
|
|
109
112
|
this.client,
|
|
110
|
-
"/
|
|
113
|
+
"/table/delete",
|
|
111
114
|
{ keys: array.toArray(keys) },
|
|
112
115
|
deleteReqZ,
|
|
113
116
|
emptyResZ,
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
export * from "@/table/client";
|
|
11
|
+
export * from "@/table/payload";
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
export * as table from "@/table/external";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2026 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -19,7 +19,7 @@ describe("Table", () => {
|
|
|
19
19
|
describe("create", () => {
|
|
20
20
|
test("create one", async () => {
|
|
21
21
|
const ws = await client.workspaces.create({ name: "Table", layout: { one: 1 } });
|
|
22
|
-
const table = await client.
|
|
22
|
+
const table = await client.tables.create(ws.key, {
|
|
23
23
|
name: "Table",
|
|
24
24
|
data: { one: 1 },
|
|
25
25
|
});
|
|
@@ -31,38 +31,38 @@ describe("Table", () => {
|
|
|
31
31
|
describe("rename", () => {
|
|
32
32
|
test("rename one", async () => {
|
|
33
33
|
const ws = await client.workspaces.create({ name: "Table", layout: { one: 1 } });
|
|
34
|
-
const table = await client.
|
|
34
|
+
const table = await client.tables.create(ws.key, {
|
|
35
35
|
name: "Table",
|
|
36
36
|
data: { one: 1 },
|
|
37
37
|
});
|
|
38
|
-
await client.
|
|
39
|
-
const res = await client.
|
|
38
|
+
await client.tables.rename(table.key, "Table2");
|
|
39
|
+
const res = await client.tables.retrieve({ key: table.key });
|
|
40
40
|
expect(res.name).toEqual("Table2");
|
|
41
41
|
});
|
|
42
42
|
});
|
|
43
43
|
describe("setData", () => {
|
|
44
44
|
test("set data", async () => {
|
|
45
45
|
const ws = await client.workspaces.create({ name: "Table", layout: { one: 1 } });
|
|
46
|
-
const table = await client.
|
|
46
|
+
const table = await client.tables.create(ws.key, {
|
|
47
47
|
name: "Table",
|
|
48
48
|
data: { one: 1 },
|
|
49
49
|
});
|
|
50
|
-
await client.
|
|
51
|
-
const res = await client.
|
|
50
|
+
await client.tables.setData(table.key, { two: 2 });
|
|
51
|
+
const res = await client.tables.retrieve({ key: table.key });
|
|
52
52
|
expect(res.data.two).toEqual(2);
|
|
53
53
|
});
|
|
54
54
|
});
|
|
55
55
|
describe("delete", () => {
|
|
56
56
|
test("delete one", async () => {
|
|
57
57
|
const ws = await client.workspaces.create({ name: "Table", layout: { one: 1 } });
|
|
58
|
-
const table = await client.
|
|
58
|
+
const table = await client.tables.create(ws.key, {
|
|
59
59
|
name: "Table",
|
|
60
60
|
data: { one: 1 },
|
|
61
61
|
});
|
|
62
|
-
await client.
|
|
63
|
-
await expect(
|
|
64
|
-
|
|
65
|
-
)
|
|
62
|
+
await client.tables.delete(table.key);
|
|
63
|
+
await expect(client.tables.retrieve({ key: table.key })).rejects.toThrow(
|
|
64
|
+
NotFoundError,
|
|
65
|
+
);
|
|
66
66
|
});
|
|
67
67
|
});
|
|
68
68
|
});
|
package/src/task/access.spec.ts
CHANGED
package/src/task/client.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2026 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -66,11 +66,15 @@ export interface TaskExecuteCommandSyncParams extends TaskExecuteCommandParams {
|
|
|
66
66
|
timeout?: CrudeTimeSpan;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
export interface ExecuteCommandsSyncParams<StatusData extends z.ZodType>
|
|
70
|
-
|
|
69
|
+
export interface ExecuteCommandsSyncParams<StatusData extends z.ZodType> extends Omit<
|
|
70
|
+
ExecuteCommandsSyncInternalParams<StatusData>,
|
|
71
|
+
"frameClient" | "name"
|
|
72
|
+
> {}
|
|
71
73
|
|
|
72
|
-
export interface ExecuteCommandSyncParams<StatusData extends z.ZodType>
|
|
73
|
-
|
|
74
|
+
export interface ExecuteCommandSyncParams<StatusData extends z.ZodType> extends Omit<
|
|
75
|
+
ExecuteCommandSyncInternalParams<StatusData>,
|
|
76
|
+
"frameClient" | "name"
|
|
77
|
+
> {}
|
|
74
78
|
|
|
75
79
|
export class Task<
|
|
76
80
|
Type extends z.ZodLiteral<string> = z.ZodLiteral<string>,
|
|
@@ -558,7 +562,8 @@ const executeCommands = async ({
|
|
|
558
562
|
};
|
|
559
563
|
|
|
560
564
|
interface ExecuteCommandSyncInternalParams<StatusData extends z.ZodType = z.ZodType>
|
|
561
|
-
extends
|
|
565
|
+
extends
|
|
566
|
+
Omit<ExecuteCommandsSyncInternalParams<StatusData>, "commands">,
|
|
562
567
|
TaskExecuteCommandSyncParams {
|
|
563
568
|
task: Key;
|
|
564
569
|
}
|
package/src/task/external.ts
CHANGED
package/src/task/index.ts
CHANGED
|
@@ -0,0 +1,113 @@
|
|
|
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 { describe, expect, it } from "vitest";
|
|
11
|
+
|
|
12
|
+
import { newKey, rackKey } from "@/task/payload";
|
|
13
|
+
|
|
14
|
+
describe("newKey", () => {
|
|
15
|
+
describe("basic key generation", () => {
|
|
16
|
+
// Verifies that newKey correctly combines rack and task keys via bit shifting.
|
|
17
|
+
// The rack key occupies the upper 32 bits, task key the lower 32.
|
|
18
|
+
const cases = [
|
|
19
|
+
{ rackKey: 1, taskKey: 1, expected: ((1n << 32n) + 1n).toString() },
|
|
20
|
+
{ rackKey: 1, taskKey: 0, expected: (1n << 32n).toString() },
|
|
21
|
+
{ rackKey: 0, taskKey: 1, expected: "1" },
|
|
22
|
+
{ rackKey: 0, taskKey: 0, expected: "0" },
|
|
23
|
+
{ rackKey: 255, taskKey: 65535, expected: ((255n << 32n) + 65535n).toString() },
|
|
24
|
+
];
|
|
25
|
+
cases.forEach(({ rackKey: r, taskKey: t, expected }) => {
|
|
26
|
+
it(`should combine rackKey=${r} and taskKey=${t}`, () => {
|
|
27
|
+
expect(newKey(r, t)).toBe(expected);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
describe("default taskKey", () => {
|
|
33
|
+
// Verifies that omitting taskKey defaults to 0, producing rackKey << 32.
|
|
34
|
+
const rackKeys = [0, 1, 42, 1000];
|
|
35
|
+
rackKeys.forEach((r) => {
|
|
36
|
+
it(`should default taskKey to 0 for rackKey=${r}`, () => {
|
|
37
|
+
expect(newKey(r)).toBe(newKey(r, 0));
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe("roundtrip with rackKey", () => {
|
|
43
|
+
// Verifies that rackKey correctly extracts the rack portion from a combined key.
|
|
44
|
+
// This ensures newKey and rackKey are inverse operations for the rack component.
|
|
45
|
+
const cases = [
|
|
46
|
+
{ rack: 1, task: 1 },
|
|
47
|
+
{ rack: 1, task: 0 },
|
|
48
|
+
{ rack: 0, task: 1 },
|
|
49
|
+
{ rack: 100, task: 50000 },
|
|
50
|
+
{ rack: 2147483647, task: 2147483647 }, // max 32-bit signed integers
|
|
51
|
+
];
|
|
52
|
+
cases.forEach(({ rack, task }) => {
|
|
53
|
+
it(`should extract rack=${rack} from key generated with task=${task}`, () => {
|
|
54
|
+
const key = newKey(rack, task);
|
|
55
|
+
expect(rackKey(key)).toBe(rack);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
describe("edge cases", () => {
|
|
61
|
+
// Verifies behavior at boundary values to ensure no overflow or precision issues.
|
|
62
|
+
it("should handle max 32-bit unsigned rack key", () => {
|
|
63
|
+
const maxUint32 = 0xffffffff;
|
|
64
|
+
const key = newKey(maxUint32, 0);
|
|
65
|
+
expect(rackKey(key)).toBe(maxUint32);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("should handle max 32-bit unsigned task key", () => {
|
|
69
|
+
const maxUint32 = 0xffffffff;
|
|
70
|
+
const key = newKey(1, maxUint32);
|
|
71
|
+
expect(key).toBe(((1n << 32n) + BigInt(maxUint32)).toString());
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it("should handle both max 32-bit values", () => {
|
|
75
|
+
const maxUint32 = 0xffffffff;
|
|
76
|
+
const key = newKey(maxUint32, maxUint32);
|
|
77
|
+
const expected = ((BigInt(maxUint32) << 32n) + BigInt(maxUint32)).toString();
|
|
78
|
+
expect(key).toBe(expected);
|
|
79
|
+
expect(rackKey(key)).toBe(maxUint32);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe("rackKey", () => {
|
|
85
|
+
// Verifies rackKey extracts upper 32 bits from various key formats.
|
|
86
|
+
// Keys can be string, bigint, or number per keyZ schema.
|
|
87
|
+
describe("key format handling", () => {
|
|
88
|
+
const rack = 42;
|
|
89
|
+
const task = 100;
|
|
90
|
+
const expectedKey = newKey(rack, task);
|
|
91
|
+
|
|
92
|
+
it("should extract rack from string key", () => {
|
|
93
|
+
expect(rackKey(expectedKey)).toBe(rack);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it("should extract rack from numeric string", () => {
|
|
97
|
+
const numericKey = ((42n << 32n) + 100n).toString();
|
|
98
|
+
expect(rackKey(numericKey)).toBe(42);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
describe("zero handling", () => {
|
|
103
|
+
// Verifies correct behavior when rack or task portions are zero.
|
|
104
|
+
it("should return 0 for key with zero rack", () => {
|
|
105
|
+
expect(rackKey("100")).toBe(0);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it("should return rack when task portion is zero", () => {
|
|
109
|
+
const key = newKey(5, 0);
|
|
110
|
+
expect(rackKey(key)).toBe(5);
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
});
|
package/src/task/payload.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2026 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -7,11 +7,10 @@
|
|
|
7
7
|
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { type observe, record, status } from "@synnaxlabs/x";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
|
|
13
13
|
import { type Key as RackKey } from "@/rack/payload";
|
|
14
|
-
import { decodeJSONString } from "@/util/decodeJSONString";
|
|
15
14
|
import { parseWithoutKeyConversion } from "@/util/parseWithoutKeyConversion";
|
|
16
15
|
|
|
17
16
|
export const keyZ = z.union([
|
|
@@ -46,8 +45,9 @@ const newStatusDetailsZ = <DataSchema extends z.ZodType>(data: DataSchema) =>
|
|
|
46
45
|
export const newStatusZ = <DataSchema extends z.ZodType>(data: DataSchema) =>
|
|
47
46
|
status.statusZ(newStatusDetailsZ(data)).partial({ key: true, name: true });
|
|
48
47
|
|
|
49
|
-
export interface NewStatus<DataSchema extends z.ZodType = z.ZodUnknown>
|
|
50
|
-
|
|
48
|
+
export interface NewStatus<DataSchema extends z.ZodType = z.ZodUnknown> extends z.infer<
|
|
49
|
+
ReturnType<typeof newStatusZ<DataSchema>>
|
|
50
|
+
> {}
|
|
51
51
|
|
|
52
52
|
export const taskZ = <
|
|
53
53
|
Type extends z.ZodLiteral<string> = z.ZodLiteral<string>,
|
|
@@ -56,7 +56,7 @@ export const taskZ = <
|
|
|
56
56
|
>(
|
|
57
57
|
schemas: Schemas<Type, Config, StatusData> = {
|
|
58
58
|
typeSchema: z.string() as unknown as Type,
|
|
59
|
-
configSchema:
|
|
59
|
+
configSchema: record.nullishToEmpty() as unknown as Config,
|
|
60
60
|
statusDataSchema: z.unknown() as unknown as StatusData,
|
|
61
61
|
},
|
|
62
62
|
) =>
|
|
@@ -65,7 +65,7 @@ export const taskZ = <
|
|
|
65
65
|
name: z.string(),
|
|
66
66
|
type: schemas.typeSchema,
|
|
67
67
|
internal: z.boolean().optional(),
|
|
68
|
-
config:
|
|
68
|
+
config: schemas.configSchema,
|
|
69
69
|
status: statusZ(schemas.statusDataSchema).optional().nullable(),
|
|
70
70
|
snapshot: z.boolean().optional(),
|
|
71
71
|
});
|
|
@@ -105,7 +105,7 @@ export const newZ = <
|
|
|
105
105
|
.omit({ key: true, status: true })
|
|
106
106
|
.extend({
|
|
107
107
|
key: keyZ.transform((k) => k.toString()).optional(),
|
|
108
|
-
config:
|
|
108
|
+
config: schemas?.configSchema ?? record.nullishToEmpty(),
|
|
109
109
|
status: newStatusZ(schemas?.statusDataSchema ?? z.unknown())
|
|
110
110
|
.optional()
|
|
111
111
|
.nullable(),
|
|
@@ -138,9 +138,13 @@ export interface Command extends Omit<z.infer<typeof commandZ>, "args"> {
|
|
|
138
138
|
args?: record.Unknown;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
export interface StateObservable<
|
|
142
|
-
extends
|
|
141
|
+
export interface StateObservable<
|
|
142
|
+
StatusData extends z.ZodType,
|
|
143
|
+
> extends observe.ObservableAsyncCloseable<Status<StatusData>> {}
|
|
143
144
|
|
|
144
145
|
export interface CommandObservable extends observe.ObservableAsyncCloseable<Command> {}
|
|
145
146
|
|
|
146
147
|
export const rackKey = (key: Key): RackKey => Number(BigInt(key) >> 32n);
|
|
148
|
+
|
|
149
|
+
export const newKey = (rackKey: RackKey, taskKey: number = 0): Key =>
|
|
150
|
+
((BigInt(rackKey) << 32n) + BigInt(taskKey)).toString();
|
package/src/task/task.spec.ts
CHANGED
package/src/testutil/access.ts
CHANGED
package/src/testutil/channels.ts
CHANGED
package/src/testutil/client.ts
CHANGED
package/src/testutil/telem.ts
CHANGED
package/src/transport.ts
CHANGED
package/src/user/access.spec.ts
CHANGED
package/src/user/client.ts
CHANGED
package/src/user/external.ts
CHANGED
package/src/user/index.ts
CHANGED
package/src/user/payload.ts
CHANGED
package/src/user/user.spec.ts
CHANGED
package/src/util/retrieve.ts
CHANGED
package/src/util/telem.ts
CHANGED
|
@@ -0,0 +1,96 @@
|
|
|
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 { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
|
+
import { array } from "@synnaxlabs/x";
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
|
|
14
|
+
import { type ontology } from "@/ontology";
|
|
15
|
+
import { checkForMultipleOrNoResults } from "@/util/retrieve";
|
|
16
|
+
import { type Key, keyZ, type New, newZ, type View, viewZ } from "@/view/payload";
|
|
17
|
+
|
|
18
|
+
export const SET_CHANNEL_NAME = "sy_view_set";
|
|
19
|
+
export const DELETE_CHANNEL_NAME = "sy_view_delete";
|
|
20
|
+
|
|
21
|
+
const createReqZ = z.object({ views: newZ.array() });
|
|
22
|
+
const createResZ = z.object({ views: viewZ.array() });
|
|
23
|
+
const deleteReqZ = z.object({ keys: keyZ.array() });
|
|
24
|
+
const emptyResZ = z.object({});
|
|
25
|
+
|
|
26
|
+
const retrieveRequestZ = z.object({
|
|
27
|
+
keys: keyZ.array().optional(),
|
|
28
|
+
types: z.string().array().optional(),
|
|
29
|
+
searchTerm: z.string().optional(),
|
|
30
|
+
offset: z.number().optional(),
|
|
31
|
+
limit: z.number().optional(),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const singleRetrieveArgsZ = z
|
|
35
|
+
.object({ key: keyZ })
|
|
36
|
+
.transform(({ key }) => ({ keys: [key] }));
|
|
37
|
+
|
|
38
|
+
const retrieveArgsZ = z.union([singleRetrieveArgsZ, retrieveRequestZ]);
|
|
39
|
+
|
|
40
|
+
export interface RetrieveSingleParams extends z.input<typeof singleRetrieveArgsZ> {}
|
|
41
|
+
export interface RetrieveMultipleParams extends z.input<typeof retrieveRequestZ> {}
|
|
42
|
+
|
|
43
|
+
const retrieveResponseZ = z.object({ views: array.nullableZ(viewZ) });
|
|
44
|
+
|
|
45
|
+
export class Client {
|
|
46
|
+
private readonly client: UnaryClient;
|
|
47
|
+
|
|
48
|
+
constructor(client: UnaryClient) {
|
|
49
|
+
this.client = client;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async retrieve(args: RetrieveSingleParams): Promise<View>;
|
|
53
|
+
async retrieve(args: RetrieveMultipleParams): Promise<View[]>;
|
|
54
|
+
async retrieve(
|
|
55
|
+
args: RetrieveSingleParams | RetrieveMultipleParams,
|
|
56
|
+
): Promise<View | View[]> {
|
|
57
|
+
const isSingle = "key" in args;
|
|
58
|
+
const res = await sendRequired(
|
|
59
|
+
this.client,
|
|
60
|
+
"/view/retrieve",
|
|
61
|
+
args,
|
|
62
|
+
retrieveArgsZ,
|
|
63
|
+
retrieveResponseZ,
|
|
64
|
+
);
|
|
65
|
+
checkForMultipleOrNoResults("View", args, res.views, isSingle);
|
|
66
|
+
return isSingle ? res.views[0] : res.views;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async create(view: New): Promise<View>;
|
|
70
|
+
async create(views: New[]): Promise<View[]>;
|
|
71
|
+
async create(views: New | New[]): Promise<View | View[]> {
|
|
72
|
+
const isMany = Array.isArray(views);
|
|
73
|
+
const res = await sendRequired<typeof createReqZ, typeof createResZ>(
|
|
74
|
+
this.client,
|
|
75
|
+
"/view/create",
|
|
76
|
+
{ views: array.toArray(views) },
|
|
77
|
+
createReqZ,
|
|
78
|
+
createResZ,
|
|
79
|
+
);
|
|
80
|
+
return isMany ? res.views : res.views[0];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async delete(keys: Key | Key[]): Promise<void> {
|
|
84
|
+
await sendRequired<typeof deleteReqZ, typeof emptyResZ>(
|
|
85
|
+
this.client,
|
|
86
|
+
"/view/delete",
|
|
87
|
+
{ keys: array.toArray(keys) },
|
|
88
|
+
deleteReqZ,
|
|
89
|
+
emptyResZ,
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const ontologyID = (key: Key): ontology.ID => ({ type: "view", key });
|
|
95
|
+
|
|
96
|
+
export const TYPE_ONTOLOGY_ID = ontologyID("");
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
export * from "@/view/client";
|
|
11
|
+
export * from "@/view/payload";
|