@synnaxlabs/client 0.53.1 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +14 -8
- package/dist/client.cjs +48 -54
- package/dist/client.js +12360 -15508
- package/dist/src/access/action/index.d.ts +2 -0
- package/dist/src/access/action/index.d.ts.map +1 -0
- package/dist/src/access/{payload.d.ts → action/types.gen.d.ts} +2 -1
- package/dist/src/access/action/types.gen.d.ts.map +1 -0
- package/dist/src/access/enforce.d.ts +2 -2
- package/dist/src/access/enforce.d.ts.map +1 -1
- package/dist/src/access/external.d.ts +1 -1
- package/dist/src/access/external.d.ts.map +1 -1
- package/dist/src/access/policy/client.d.ts +233 -389
- package/dist/src/access/policy/client.d.ts.map +1 -1
- package/dist/src/access/policy/external.d.ts +1 -1
- package/dist/src/access/policy/external.d.ts.map +1 -1
- package/dist/src/access/policy/types.gen.d.ts +120 -0
- package/dist/src/access/policy/types.gen.d.ts.map +1 -0
- package/dist/src/access/role/client.d.ts +1 -1
- package/dist/src/access/role/client.d.ts.map +1 -1
- package/dist/src/access/role/external.d.ts +1 -1
- package/dist/src/access/role/external.d.ts.map +1 -1
- package/dist/src/access/role/types.gen.d.ts +34 -0
- package/dist/src/access/role/types.gen.d.ts.map +1 -0
- package/dist/src/arc/client.d.ts +2 -2
- package/dist/src/arc/client.d.ts.map +1 -1
- package/dist/src/arc/compiler/index.d.ts +2 -0
- package/dist/src/arc/compiler/index.d.ts.map +1 -0
- package/dist/src/arc/compiler/types.gen.d.ts +12 -0
- package/dist/src/arc/compiler/types.gen.d.ts.map +1 -0
- package/dist/src/arc/external.d.ts +6 -1
- package/dist/src/arc/external.d.ts.map +1 -1
- package/dist/src/arc/graph/index.d.ts +2 -0
- package/dist/src/arc/graph/index.d.ts.map +1 -0
- package/dist/src/arc/graph/types.gen.d.ts +644 -0
- package/dist/src/arc/graph/types.gen.d.ts.map +1 -0
- package/dist/src/arc/ir/index.d.ts +2 -0
- package/dist/src/arc/ir/index.d.ts.map +1 -0
- package/dist/src/arc/ir/types.gen.d.ts +2988 -0
- package/dist/src/arc/ir/types.gen.d.ts.map +1 -0
- package/dist/src/arc/module/index.d.ts +2 -0
- package/dist/src/arc/module/index.d.ts.map +1 -0
- package/dist/src/arc/module/types.gen.d.ts +1138 -0
- package/dist/src/arc/module/types.gen.d.ts.map +1 -0
- package/dist/src/arc/program/index.d.ts +2 -0
- package/dist/src/arc/program/index.d.ts.map +1 -0
- package/dist/src/arc/program/types.gen.d.ts +1138 -0
- package/dist/src/arc/program/types.gen.d.ts.map +1 -0
- package/dist/src/arc/text/index.d.ts +2 -0
- package/dist/src/arc/text/index.d.ts.map +1 -0
- package/dist/src/arc/text/types.gen.d.ts +8 -0
- package/dist/src/arc/text/types.gen.d.ts.map +1 -0
- package/dist/src/arc/types/index.d.ts +2 -0
- package/dist/src/arc/types/index.d.ts.map +1 -0
- package/dist/src/arc/types/types.gen.d.ts +237 -0
- package/dist/src/arc/types/types.gen.d.ts.map +1 -0
- package/dist/src/arc/types.gen.d.ts +2394 -0
- package/dist/src/arc/types.gen.d.ts.map +1 -0
- package/dist/src/channel/client.d.ts +5 -4
- package/dist/src/channel/client.d.ts.map +1 -1
- package/dist/src/channel/external.d.ts +1 -0
- package/dist/src/channel/external.d.ts.map +1 -1
- package/dist/src/channel/payload.d.ts +93 -178
- package/dist/src/channel/payload.d.ts.map +1 -1
- package/dist/src/channel/retriever.d.ts +3 -2
- package/dist/src/channel/retriever.d.ts.map +1 -1
- package/dist/src/channel/types.gen.d.ts +151 -0
- package/dist/src/channel/types.gen.d.ts.map +1 -0
- package/dist/src/channel/writer.d.ts +1 -1
- package/dist/src/channel/writer.d.ts.map +1 -1
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/cluster/index.d.ts +2 -0
- package/dist/src/cluster/index.d.ts.map +1 -0
- package/dist/src/cluster/types.gen.d.ts +4 -0
- package/dist/src/cluster/types.gen.d.ts.map +1 -0
- package/dist/src/control/state.d.ts +14 -9
- package/dist/src/control/state.d.ts.map +1 -1
- package/dist/src/device/client.d.ts +7 -12
- package/dist/src/device/client.d.ts.map +1 -1
- package/dist/src/device/external.d.ts +1 -1
- package/dist/src/device/external.d.ts.map +1 -1
- package/dist/src/device/types.gen.d.ts +163 -0
- package/dist/src/device/types.gen.d.ts.map +1 -0
- package/dist/src/framer/adapter.d.ts +2 -2
- package/dist/src/framer/adapter.d.ts.map +1 -1
- package/dist/src/framer/client.d.ts +7 -7
- package/dist/src/framer/client.d.ts.map +1 -1
- package/dist/src/framer/codec.d.ts +5 -5
- package/dist/src/framer/codec.d.ts.map +1 -1
- package/dist/src/framer/external.d.ts +1 -1
- package/dist/src/framer/external.d.ts.map +1 -1
- package/dist/src/framer/frame.d.ts +18 -18
- package/dist/src/framer/frame.d.ts.map +1 -1
- package/dist/src/framer/reader.d.ts +1 -1
- package/dist/src/framer/reader.d.ts.map +1 -1
- package/dist/src/framer/streamer.d.ts +177 -114
- package/dist/src/framer/streamer.d.ts.map +1 -1
- package/dist/src/framer/types.gen.d.ts +9 -0
- package/dist/src/framer/types.gen.d.ts.map +1 -0
- package/dist/src/framer/writer.d.ts +192 -128
- package/dist/src/framer/writer.d.ts.map +1 -1
- package/dist/src/group/client.d.ts +17 -17
- package/dist/src/group/client.d.ts.map +1 -1
- package/dist/src/group/external.d.ts +1 -1
- package/dist/src/group/external.d.ts.map +1 -1
- package/dist/src/group/types.gen.d.ts +23 -0
- package/dist/src/group/types.gen.d.ts.map +1 -0
- package/dist/src/label/client.d.ts +51 -72
- package/dist/src/label/client.d.ts.map +1 -1
- package/dist/src/label/payload.d.ts +30 -8
- package/dist/src/label/payload.d.ts.map +1 -1
- package/dist/src/lineplot/client.d.ts +2 -11
- package/dist/src/lineplot/client.d.ts.map +1 -1
- package/dist/src/lineplot/external.d.ts +1 -1
- package/dist/src/lineplot/external.d.ts.map +1 -1
- package/dist/src/lineplot/types.gen.d.ts +33 -0
- package/dist/src/lineplot/types.gen.d.ts.map +1 -0
- package/dist/src/log/client.d.ts +2 -11
- package/dist/src/log/client.d.ts.map +1 -1
- package/dist/src/log/external.d.ts +1 -1
- package/dist/src/log/external.d.ts.map +1 -1
- package/dist/src/log/types.gen.d.ts +33 -0
- package/dist/src/log/types.gen.d.ts.map +1 -0
- package/dist/src/ontology/client.d.ts +31 -31
- package/dist/src/ontology/payload.d.ts +74 -99
- package/dist/src/ontology/payload.d.ts.map +1 -1
- package/dist/src/ontology/types.gen.d.ts +30 -0
- package/dist/src/ontology/types.gen.d.ts.map +1 -0
- package/dist/src/ontology/writer.d.ts +80 -80
- package/dist/src/rack/client.d.ts +22 -11
- package/dist/src/rack/client.d.ts.map +1 -1
- package/dist/src/rack/external.d.ts +1 -1
- package/dist/src/rack/external.d.ts.map +1 -1
- package/dist/src/rack/types.gen.d.ts +72 -0
- package/dist/src/rack/types.gen.d.ts.map +1 -0
- package/dist/src/range/alias/types.gen.d.ts +14 -0
- package/dist/src/range/alias/types.gen.d.ts.map +1 -0
- package/dist/src/range/kv/types.gen.d.ts +13 -0
- package/dist/src/range/kv/types.gen.d.ts.map +1 -0
- package/dist/src/ranger/alias/client.d.ts +1 -1
- package/dist/src/ranger/alias/client.d.ts.map +1 -1
- package/dist/src/ranger/alias/external.d.ts +3 -1
- package/dist/src/ranger/alias/external.d.ts.map +1 -1
- package/dist/src/ranger/alias/payload.d.ts +5 -9
- package/dist/src/ranger/alias/payload.d.ts.map +1 -1
- package/dist/src/ranger/alias/payload.spec.d.ts +2 -0
- package/dist/src/ranger/alias/payload.spec.d.ts.map +1 -0
- package/dist/src/ranger/alias/types.gen.d.ts +14 -0
- package/dist/src/ranger/alias/types.gen.d.ts.map +1 -0
- package/dist/src/ranger/client.d.ts +10 -15
- package/dist/src/ranger/client.d.ts.map +1 -1
- package/dist/src/ranger/external.d.ts +4 -4
- package/dist/src/ranger/external.d.ts.map +1 -1
- package/dist/src/ranger/kv/client.d.ts +1 -1
- package/dist/src/ranger/kv/client.d.ts.map +1 -1
- package/dist/src/ranger/kv/external.d.ts +3 -1
- package/dist/src/ranger/kv/external.d.ts.map +1 -1
- package/dist/src/ranger/kv/payload.d.ts +6 -13
- package/dist/src/ranger/kv/payload.d.ts.map +1 -1
- package/dist/src/ranger/kv/types.gen.d.ts +13 -0
- package/dist/src/ranger/kv/types.gen.d.ts.map +1 -0
- package/dist/src/ranger/payload.d.ts +2 -97
- package/dist/src/ranger/payload.d.ts.map +1 -1
- package/dist/src/ranger/types.gen.d.ts +219 -0
- package/dist/src/ranger/types.gen.d.ts.map +1 -0
- package/dist/src/ranger/writer.d.ts +25 -25
- package/dist/src/ranger/writer.d.ts.map +1 -1
- package/dist/src/schematic/client.d.ts +2 -11
- package/dist/src/schematic/client.d.ts.map +1 -1
- package/dist/src/schematic/external.d.ts +1 -1
- package/dist/src/schematic/external.d.ts.map +1 -1
- package/dist/src/schematic/symbol/client.d.ts +1 -2
- package/dist/src/schematic/symbol/client.d.ts.map +1 -1
- package/dist/src/schematic/symbol/external.d.ts +1 -1
- package/dist/src/schematic/symbol/external.d.ts.map +1 -1
- package/dist/src/schematic/symbol/types.gen.d.ts +277 -0
- package/dist/src/schematic/symbol/types.gen.d.ts.map +1 -0
- package/dist/src/schematic/types.gen.d.ts +35 -0
- package/dist/src/schematic/types.gen.d.ts.map +1 -0
- package/dist/src/status/client.d.ts +2 -0
- package/dist/src/status/client.d.ts.map +1 -1
- package/dist/src/status/payload.d.ts +25 -54
- package/dist/src/status/payload.d.ts.map +1 -1
- package/dist/src/table/client.d.ts +2 -11
- package/dist/src/table/client.d.ts.map +1 -1
- package/dist/src/table/external.d.ts +1 -1
- package/dist/src/table/external.d.ts.map +1 -1
- package/dist/src/table/types.gen.d.ts +33 -0
- package/dist/src/table/types.gen.d.ts.map +1 -0
- package/dist/src/task/client.d.ts +15 -20
- package/dist/src/task/client.d.ts.map +1 -1
- package/dist/src/task/external.d.ts +1 -1
- package/dist/src/task/external.d.ts.map +1 -1
- package/dist/src/task/types.gen.d.ts +155 -0
- package/dist/src/task/types.gen.d.ts.map +1 -0
- package/dist/src/user/client.d.ts +3 -3
- 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 +35 -0
- package/dist/src/user/types.gen.d.ts.map +1 -0
- package/dist/src/util/decodeJSONString.d.ts.map +1 -1
- package/dist/src/view/client.d.ts +1 -10
- package/dist/src/view/client.d.ts.map +1 -1
- package/dist/src/view/external.d.ts +1 -1
- package/dist/src/view/external.d.ts.map +1 -1
- package/dist/src/view/types.gen.d.ts +35 -0
- package/dist/src/view/types.gen.d.ts.map +1 -0
- package/dist/src/workspace/client.d.ts +2 -11
- package/dist/src/workspace/client.d.ts.map +1 -1
- package/dist/src/workspace/external.d.ts +1 -1
- package/dist/src/workspace/external.d.ts.map +1 -1
- package/dist/src/workspace/types.gen.d.ts +34 -0
- package/dist/src/workspace/types.gen.d.ts.map +1 -0
- package/package.json +11 -11
- package/src/access/action/index.ts +11 -0
- package/src/access/{payload.ts → action/types.gen.ts} +4 -1
- package/src/access/enforce.spec.ts +1 -2
- package/src/access/enforce.ts +2 -2
- package/src/access/external.ts +1 -1
- package/src/access/policy/client.ts +2 -2
- package/src/access/policy/external.ts +1 -1
- package/src/access/policy/types.gen.ts +44 -0
- package/src/access/role/client.ts +2 -2
- package/src/access/role/external.ts +1 -1
- package/src/access/role/types.gen.ts +46 -0
- package/src/arc/access.spec.ts +18 -6
- package/src/arc/client.ts +3 -3
- package/src/{framer/payload.ts → arc/compiler/index.ts} +1 -6
- package/src/arc/compiler/types.gen.ts +27 -0
- package/src/arc/external.ts +6 -1
- package/src/arc/graph/index.ts +10 -0
- package/src/arc/graph/types.gen.ts +59 -0
- package/src/arc/ir/index.ts +10 -0
- package/src/arc/ir/types.gen.ts +166 -0
- package/src/arc/module/index.ts +10 -0
- package/src/arc/module/types.gen.ts +18 -0
- package/src/arc/program/index.ts +10 -0
- package/src/arc/program/types.gen.ts +18 -0
- package/src/arc/text/index.ts +10 -0
- package/src/arc/text/types.gen.ts +19 -0
- package/src/arc/types/index.ts +10 -0
- package/src/arc/types/types.gen.ts +132 -0
- package/src/arc/types.gen.ts +85 -0
- package/src/channel/client.ts +14 -15
- package/src/channel/external.ts +1 -0
- package/src/channel/payload.spec.ts +19 -16
- package/src/channel/payload.ts +14 -82
- package/src/channel/retriever.ts +9 -18
- package/src/channel/types.gen.ts +137 -0
- package/src/channel/writer.ts +2 -2
- package/src/client.ts +4 -0
- package/src/cluster/index.ts +10 -0
- package/src/cluster/types.gen.ts +16 -0
- package/src/control/state.ts +8 -6
- package/src/device/client.ts +14 -11
- package/src/device/device.spec.ts +95 -1
- package/src/device/external.ts +1 -1
- package/src/device/payload.spec.ts +26 -2
- package/src/device/types.gen.ts +100 -0
- package/src/framer/adapter.ts +7 -4
- package/src/framer/client.ts +15 -9
- package/src/framer/codec.spec.ts +25 -5
- package/src/framer/codec.ts +11 -9
- package/src/framer/deleter.spec.ts +0 -15
- package/src/framer/external.ts +1 -1
- package/src/framer/frame.ts +44 -36
- package/src/framer/reader.spec.ts +2 -2
- package/src/framer/reader.ts +6 -6
- package/src/framer/streamer.spec.ts +98 -0
- package/src/framer/streamer.ts +10 -0
- package/src/framer/types.gen.ts +20 -0
- package/src/framer/writer.ts +14 -8
- package/src/group/client.ts +1 -1
- package/src/group/external.ts +1 -1
- package/src/group/group.spec.ts +1 -1
- package/src/{access/role/payload.ts → group/types.gen.ts} +11 -11
- package/src/label/client.ts +2 -5
- package/src/label/label.spec.ts +12 -3
- package/src/label/payload.ts +3 -1
- package/src/lineplot/client.ts +9 -11
- package/src/lineplot/external.ts +1 -1
- package/src/lineplot/lineplot.spec.ts +40 -0
- package/src/lineplot/types.gen.ts +42 -0
- package/src/log/client.ts +9 -18
- package/src/log/external.ts +1 -1
- package/src/log/log.spec.ts +38 -0
- package/src/log/types.gen.ts +42 -0
- package/src/ontology/payload.ts +5 -29
- package/src/ontology/types.gen.ts +41 -0
- package/src/rack/client.ts +26 -10
- package/src/rack/external.ts +1 -1
- package/src/rack/rack.spec.ts +37 -0
- package/src/rack/types.gen.ts +62 -0
- package/src/range/alias/types.gen.ts +30 -0
- package/src/range/kv/types.gen.ts +28 -0
- package/src/ranger/alias/client.ts +1 -1
- package/src/ranger/alias/external.ts +3 -10
- package/src/ranger/alias/payload.spec.ts +52 -0
- package/src/ranger/alias/payload.ts +11 -10
- package/src/ranger/alias/types.gen.ts +30 -0
- package/src/ranger/client.ts +34 -45
- package/src/ranger/external.ts +3 -3
- package/src/ranger/kv/client.ts +3 -3
- package/src/ranger/kv/external.ts +3 -7
- package/src/ranger/kv/payload.ts +1 -6
- package/src/ranger/kv/types.gen.ts +28 -0
- package/src/ranger/payload.ts +2 -46
- package/src/ranger/ranger.spec.ts +2 -4
- package/src/ranger/types.gen.ts +66 -0
- package/src/ranger/writer.ts +2 -1
- package/src/schematic/client.ts +11 -14
- package/src/schematic/external.ts +1 -1
- package/src/schematic/schematic.spec.ts +54 -2
- package/src/schematic/symbol/client.ts +2 -4
- package/src/schematic/symbol/external.ts +1 -1
- package/src/schematic/symbol/types.gen.ts +124 -0
- package/src/schematic/types.gen.ts +44 -0
- package/src/status/client.ts +4 -3
- package/src/status/payload.ts +5 -4
- package/src/status/status.spec.ts +106 -11
- package/src/table/client.ts +10 -19
- package/src/table/external.ts +1 -1
- package/src/table/table.spec.ts +38 -0
- package/src/table/types.gen.ts +42 -0
- package/src/task/client.ts +29 -24
- package/src/task/external.ts +1 -1
- package/src/task/payload.spec.ts +19 -19
- package/src/task/task.spec.ts +127 -9
- package/src/task/types.gen.ts +169 -0
- package/src/user/client.ts +2 -2
- package/src/user/external.ts +1 -1
- package/src/user/types.gen.ts +49 -0
- package/src/util/decodeJSONString.ts +1 -1
- package/src/util/retrieve.ts +2 -2
- package/src/view/client.ts +2 -7
- package/src/view/external.ts +1 -1
- package/src/view/types.gen.ts +44 -0
- package/src/workspace/client.ts +10 -14
- package/src/workspace/external.ts +1 -1
- package/src/workspace/types.gen.ts +45 -0
- package/src/workspace/workspace.spec.ts +37 -0
- package/tsconfig.json +1 -3
- package/vite.config.ts +9 -2
- package/dist/src/access/payload.d.ts.map +0 -1
- package/dist/src/access/policy/payload.d.ts +0 -156
- package/dist/src/access/policy/payload.d.ts.map +0 -1
- package/dist/src/access/role/payload.d.ts +0 -27
- package/dist/src/access/role/payload.d.ts.map +0 -1
- package/dist/src/arc/payload.d.ts +0 -167
- package/dist/src/arc/payload.d.ts.map +0 -1
- package/dist/src/device/payload.d.ts +0 -281
- package/dist/src/device/payload.d.ts.map +0 -1
- package/dist/src/framer/payload.d.ts +0 -7
- package/dist/src/framer/payload.d.ts.map +0 -1
- package/dist/src/group/payload.d.ts +0 -16
- package/dist/src/group/payload.d.ts.map +0 -1
- package/dist/src/lineplot/payload.d.ts +0 -28
- package/dist/src/lineplot/payload.d.ts.map +0 -1
- package/dist/src/log/payload.d.ts +0 -28
- package/dist/src/log/payload.d.ts.map +0 -1
- package/dist/src/rack/payload.d.ts +0 -243
- package/dist/src/rack/payload.d.ts.map +0 -1
- package/dist/src/schematic/payload.d.ts +0 -38
- package/dist/src/schematic/payload.d.ts.map +0 -1
- package/dist/src/schematic/symbol/payload.d.ts +0 -169
- package/dist/src/schematic/symbol/payload.d.ts.map +0 -1
- package/dist/src/table/payload.d.ts +0 -33
- package/dist/src/table/payload.d.ts.map +0 -1
- package/dist/src/task/payload.d.ts +0 -123
- package/dist/src/task/payload.d.ts.map +0 -1
- package/dist/src/user/payload.d.ts +0 -22
- package/dist/src/user/payload.d.ts.map +0 -1
- package/dist/src/view/payload.d.ts +0 -20
- package/dist/src/view/payload.d.ts.map +0 -1
- package/dist/src/workspace/payload.d.ts +0 -33
- package/dist/src/workspace/payload.d.ts.map +0 -1
- package/src/access/policy/payload.ts +0 -37
- package/src/arc/payload.ts +0 -73
- package/src/device/payload.ts +0 -83
- package/src/group/payload.ts +0 -24
- package/src/lineplot/payload.ts +0 -29
- package/src/log/payload.ts +0 -29
- package/src/rack/payload.ts +0 -30
- package/src/schematic/payload.ts +0 -34
- package/src/schematic/symbol/payload.ts +0 -70
- package/src/table/payload.ts +0 -33
- package/src/task/payload.ts +0 -127
- package/src/user/payload.ts +0 -29
- package/src/view/payload.ts +0 -25
- package/src/workspace/payload.ts +0 -33
package/src/ranger/client.ts
CHANGED
|
@@ -21,20 +21,18 @@ import { type channel } from "@/channel";
|
|
|
21
21
|
import { QueryError } from "@/errors";
|
|
22
22
|
import { type framer } from "@/framer";
|
|
23
23
|
import { label } from "@/label";
|
|
24
|
-
import { ontology } from "@/ontology";
|
|
25
|
-
import { Client as AliasClient } from "@/ranger/alias/client";
|
|
26
|
-
import { Client as KVClient } from "@/ranger/kv/client";
|
|
24
|
+
import { type ontology } from "@/ontology";
|
|
25
|
+
import { type Client as AliasClient } from "@/ranger/alias/client";
|
|
26
|
+
import { type Client as KVClient } from "@/ranger/kv/client";
|
|
27
|
+
import { type Name, type Params } from "@/ranger/payload";
|
|
27
28
|
import {
|
|
28
29
|
type Key,
|
|
29
|
-
type Keys,
|
|
30
30
|
keyZ,
|
|
31
|
-
type Name,
|
|
32
|
-
type Names,
|
|
33
31
|
type New,
|
|
34
|
-
|
|
32
|
+
ontologyID,
|
|
35
33
|
type Payload,
|
|
36
34
|
payloadZ,
|
|
37
|
-
} from "@/ranger/
|
|
35
|
+
} from "@/ranger/types.gen";
|
|
38
36
|
import { type CreateOptions, type Writer } from "@/ranger/writer";
|
|
39
37
|
import { checkForMultipleOrNoResults } from "@/util/retrieve";
|
|
40
38
|
|
|
@@ -56,8 +54,8 @@ export class Range {
|
|
|
56
54
|
name: string;
|
|
57
55
|
readonly kv: KVClient;
|
|
58
56
|
readonly timeRange: TimeRange;
|
|
59
|
-
readonly color
|
|
60
|
-
readonly parent
|
|
57
|
+
readonly color?: color.Color;
|
|
58
|
+
readonly parent?: Payload;
|
|
61
59
|
readonly labels?: label.Label[];
|
|
62
60
|
readonly channels: channel.Retriever;
|
|
63
61
|
private readonly aliaser: AliasClient;
|
|
@@ -67,7 +65,7 @@ export class Range {
|
|
|
67
65
|
private readonly rangeClient: Client;
|
|
68
66
|
|
|
69
67
|
constructor(
|
|
70
|
-
{ name, timeRange = TimeRange.ZERO, key, color, parent, labels }: Payload,
|
|
68
|
+
{ name, timeRange = TimeRange.ZERO, key, color: color_, parent, labels }: Payload,
|
|
71
69
|
{
|
|
72
70
|
frameClient,
|
|
73
71
|
kv,
|
|
@@ -84,7 +82,7 @@ export class Range {
|
|
|
84
82
|
this.parent = parent;
|
|
85
83
|
this.labels = labels;
|
|
86
84
|
this.frameClient = frameClient;
|
|
87
|
-
this.color =
|
|
85
|
+
this.color = color_;
|
|
88
86
|
this.kv = kv;
|
|
89
87
|
this.aliaser = aliaser;
|
|
90
88
|
this.channels = channels;
|
|
@@ -98,18 +96,17 @@ export class Range {
|
|
|
98
96
|
}
|
|
99
97
|
|
|
100
98
|
get payload(): Payload {
|
|
101
|
-
|
|
102
|
-
if (this.parent != null)
|
|
103
|
-
if ("payload" in this.parent) parent = (this.parent as Range).payload;
|
|
104
|
-
else parent = this.parent;
|
|
105
|
-
return {
|
|
99
|
+
const r: Payload = {
|
|
106
100
|
key: this.key,
|
|
107
101
|
name: this.name,
|
|
108
102
|
timeRange: this.timeRange,
|
|
109
103
|
color: this.color,
|
|
110
104
|
labels: this.labels,
|
|
111
|
-
parent,
|
|
112
105
|
};
|
|
106
|
+
if (this.parent != null)
|
|
107
|
+
if ("payload" in this.parent) r.parent = (this.parent as Range).payload;
|
|
108
|
+
else r.parent = this.parent;
|
|
109
|
+
return r;
|
|
113
110
|
}
|
|
114
111
|
|
|
115
112
|
async setAlias(channel: channel.Key | Name, alias: string): Promise<void> {
|
|
@@ -195,7 +192,7 @@ const retrieveArgsZ = retrieveRequestZ
|
|
|
195
192
|
|
|
196
193
|
export type RetrieveArgs = z.input<typeof retrieveArgsZ>;
|
|
197
194
|
|
|
198
|
-
const retrieveResZ = z.object({ ranges: array.
|
|
195
|
+
const retrieveResZ = z.object({ ranges: array.nullishToEmpty(payloadZ) });
|
|
199
196
|
|
|
200
197
|
export class Client {
|
|
201
198
|
readonly type: string = "range";
|
|
@@ -205,6 +202,8 @@ export class Client {
|
|
|
205
202
|
private readonly channels: channel.Retriever;
|
|
206
203
|
private readonly labelClient: label.Client;
|
|
207
204
|
private readonly ontologyClient: ontology.Client;
|
|
205
|
+
private readonly createAliasClient: (key: Key) => AliasClient;
|
|
206
|
+
private readonly createKVClient: (key: Key) => KVClient;
|
|
208
207
|
|
|
209
208
|
constructor(
|
|
210
209
|
frameClient: framer.Client,
|
|
@@ -213,6 +212,8 @@ export class Client {
|
|
|
213
212
|
channels: channel.Retriever,
|
|
214
213
|
labelClient: label.Client,
|
|
215
214
|
ontologyClient: ontology.Client,
|
|
215
|
+
createAliasClient: (key: Key) => AliasClient,
|
|
216
|
+
createKVClient: (key: Key) => KVClient,
|
|
216
217
|
) {
|
|
217
218
|
this.frameClient = frameClient;
|
|
218
219
|
this.writer = writer;
|
|
@@ -220,6 +221,8 @@ export class Client {
|
|
|
220
221
|
this.channels = channels;
|
|
221
222
|
this.labelClient = labelClient;
|
|
222
223
|
this.ontologyClient = ontologyClient;
|
|
224
|
+
this.createAliasClient = createAliasClient;
|
|
225
|
+
this.createKVClient = createKVClient;
|
|
223
226
|
}
|
|
224
227
|
|
|
225
228
|
async create(range: New, options?: CreateOptions): Promise<Range>;
|
|
@@ -236,12 +239,12 @@ export class Client {
|
|
|
236
239
|
await this.writer.rename(key, name);
|
|
237
240
|
}
|
|
238
241
|
|
|
239
|
-
async delete(key: Key |
|
|
242
|
+
async delete(key: Key | Key[]): Promise<void> {
|
|
240
243
|
await this.writer.delete(array.toArray(key));
|
|
241
244
|
}
|
|
242
245
|
|
|
243
246
|
async retrieve(params: Key | Name): Promise<Range>;
|
|
244
|
-
async retrieve(params:
|
|
247
|
+
async retrieve(params: Key[] | Name[]): Promise<Range[]>;
|
|
245
248
|
async retrieve(params: CrudeTimeRange): Promise<Range[]>;
|
|
246
249
|
async retrieve(params: RetrieveRequest): Promise<Range[]>;
|
|
247
250
|
async retrieve(params: RetrieveArgs): Promise<Range | Range[]> {
|
|
@@ -259,7 +262,7 @@ export class Client {
|
|
|
259
262
|
}
|
|
260
263
|
|
|
261
264
|
getKV(range: Key): KVClient {
|
|
262
|
-
return
|
|
265
|
+
return this.createKVClient(range);
|
|
263
266
|
}
|
|
264
267
|
|
|
265
268
|
async retrieveParent(range: Key): Promise<Range | null> {
|
|
@@ -275,7 +278,7 @@ export class Client {
|
|
|
275
278
|
}
|
|
276
279
|
|
|
277
280
|
async retrieveAlias(range: Key, channel: channel.Key): Promise<string> {
|
|
278
|
-
const aliaser =
|
|
281
|
+
const aliaser = this.createAliasClient(range);
|
|
279
282
|
return await aliaser.retrieve(channel);
|
|
280
283
|
}
|
|
281
284
|
|
|
@@ -283,30 +286,26 @@ export class Client {
|
|
|
283
286
|
range: Key,
|
|
284
287
|
channels: channel.Key[],
|
|
285
288
|
): Promise<Record<channel.Key, string>> {
|
|
286
|
-
|
|
287
|
-
return await aliaser.retrieve(channels);
|
|
289
|
+
return await this.createAliasClient(range).retrieve(channels);
|
|
288
290
|
}
|
|
289
291
|
|
|
290
292
|
async listAliases(range: Key): Promise<Record<channel.Key, string>> {
|
|
291
|
-
|
|
292
|
-
return await aliaser.list();
|
|
293
|
+
return await this.createAliasClient(range).list();
|
|
293
294
|
}
|
|
294
295
|
|
|
295
296
|
async setAlias(range: Key, channel: channel.Key, alias: string): Promise<void> {
|
|
296
|
-
|
|
297
|
-
await aliaser.set({ [channel]: alias });
|
|
297
|
+
await this.createAliasClient(range).set({ [channel]: alias });
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
async deleteAlias(range: Key, channels: channel.Key | channel.Key[]): Promise<void> {
|
|
301
|
-
|
|
302
|
-
await aliaser.delete(channels);
|
|
301
|
+
await this.createAliasClient(range).delete(channels);
|
|
303
302
|
}
|
|
304
303
|
|
|
305
304
|
sugarOne(payload: Payload): Range {
|
|
306
305
|
return new Range(payload, {
|
|
307
306
|
frameClient: this.frameClient,
|
|
308
|
-
kv:
|
|
309
|
-
aliaser:
|
|
307
|
+
kv: this.createKVClient(payload.key),
|
|
308
|
+
aliaser: this.createAliasClient(payload.key),
|
|
310
309
|
channels: this.channels,
|
|
311
310
|
labelClient: this.labelClient,
|
|
312
311
|
ontologyClient: this.ontologyClient,
|
|
@@ -319,20 +318,10 @@ export class Client {
|
|
|
319
318
|
}
|
|
320
319
|
|
|
321
320
|
resourceToRange(resource: ontology.Resource): Range {
|
|
322
|
-
return this.sugarOne(
|
|
323
|
-
key: resource.id.key,
|
|
324
|
-
name: resource.data?.name as string,
|
|
325
|
-
timeRange: new TimeRange(resource.data?.timeRange as CrudeTimeRange),
|
|
326
|
-
color: resource.data?.color as color.Color,
|
|
327
|
-
labels: [],
|
|
328
|
-
parent: null,
|
|
329
|
-
});
|
|
321
|
+
return this.sugarOne(convertOntologyResourceToPayload(resource));
|
|
330
322
|
}
|
|
331
323
|
}
|
|
332
324
|
|
|
333
|
-
export const ontologyID = ontology.createIDFactory<Key>("range");
|
|
334
|
-
export const TYPE_ONTOLOGY_ID = ontologyID("");
|
|
335
|
-
|
|
336
325
|
export const aliasOntologyID = (key: Key): ontology.ID => ({
|
|
337
326
|
type: "range-alias",
|
|
338
327
|
key,
|
|
@@ -351,6 +340,6 @@ export const convertOntologyResourceToPayload = ({
|
|
|
351
340
|
timeRange,
|
|
352
341
|
color: c.success ? c.data : undefined,
|
|
353
342
|
labels: [],
|
|
354
|
-
parent:
|
|
343
|
+
parent: undefined,
|
|
355
344
|
};
|
|
356
345
|
};
|
package/src/ranger/external.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
|
+
export * from "@/ranger/alias";
|
|
10
11
|
export * from "@/ranger/alias";
|
|
11
12
|
export {
|
|
12
13
|
/** @deprecated Use {@link alias.createKey} instead. */
|
|
@@ -20,17 +21,16 @@ export {
|
|
|
20
21
|
} from "@/ranger/alias/payload";
|
|
21
22
|
export * from "@/ranger/client";
|
|
22
23
|
export * from "@/ranger/kv";
|
|
24
|
+
export * from "@/ranger/kv";
|
|
23
25
|
export {
|
|
24
26
|
/** @deprecated Use {@link kv.DELETE_CHANNEL_NAME} instead. */
|
|
25
27
|
DELETE_CHANNEL_NAME as KV_DELETE_CHANNEL,
|
|
26
28
|
/** @deprecated Use {@link kv.SET_CHANNEL_NAME} instead. */
|
|
27
29
|
SET_CHANNEL_NAME as KV_SET_CHANNEL,
|
|
28
30
|
/** @deprecated Use {@link kv.Pair} instead. */
|
|
29
|
-
type Pair as KVPair,
|
|
30
31
|
/** @deprecated Use {@link kv.createPairKey} instead. */
|
|
31
32
|
createPairKey as kvPairKey,
|
|
32
|
-
/** @deprecated Use {@link kv.pairZ} instead. */
|
|
33
|
-
pairZ as kvPairZ,
|
|
34
33
|
} from "@/ranger/kv/payload";
|
|
35
34
|
export * from "@/ranger/payload";
|
|
35
|
+
export * from "@/ranger/types.gen";
|
|
36
36
|
export * from "@/ranger/writer";
|
package/src/ranger/kv/client.ts
CHANGED
|
@@ -11,11 +11,11 @@ import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
|
11
11
|
import { array } from "@synnaxlabs/x";
|
|
12
12
|
import { z } from "zod";
|
|
13
13
|
|
|
14
|
-
import { type Pair, pairZ } from "@/ranger/kv/
|
|
15
|
-
import { type Key, keyZ } from "@/ranger/
|
|
14
|
+
import { type Pair, pairZ } from "@/ranger/kv/types.gen";
|
|
15
|
+
import { type Key, keyZ } from "@/ranger/types.gen";
|
|
16
16
|
|
|
17
17
|
const getReqZ = z.object({ range: keyZ, keys: z.string().array() });
|
|
18
|
-
const getResZ = z.object({ pairs: array.
|
|
18
|
+
const getResZ = z.object({ pairs: array.nullishToEmpty(pairZ) });
|
|
19
19
|
const setReqZ = z.object({ range: keyZ, pairs: pairZ.array() });
|
|
20
20
|
const deleteReqZ = z.object({ range: keyZ, keys: z.string().array() });
|
|
21
21
|
|
|
@@ -7,10 +7,6 @@
|
|
|
7
7
|
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
type Pair,
|
|
14
|
-
pairZ,
|
|
15
|
-
SET_CHANNEL_NAME as SET_CHANNEL,
|
|
16
|
-
} from "@/ranger/kv/payload";
|
|
10
|
+
export * from "@/ranger/kv/client";
|
|
11
|
+
export * from "@/ranger/kv/payload";
|
|
12
|
+
export * from "@/ranger/kv/types.gen";
|
package/src/ranger/kv/payload.ts
CHANGED
|
@@ -7,16 +7,11 @@
|
|
|
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 {
|
|
11
|
-
|
|
12
|
-
import { keyZ } from "@/ranger/payload";
|
|
10
|
+
import { type Pair, pairZ } from "@/ranger/kv/types.gen";
|
|
13
11
|
|
|
14
12
|
export const SET_CHANNEL_NAME = "sy_range_kv_set";
|
|
15
13
|
export const DELETE_CHANNEL_NAME = "sy_range_kv_delete";
|
|
16
14
|
|
|
17
|
-
export const pairZ = z.object({ range: keyZ, key: z.string(), value: z.string() });
|
|
18
|
-
export interface Pair extends z.infer<typeof pairZ> {}
|
|
19
|
-
|
|
20
15
|
export const createPairKey = ({ range, key }: Omit<Pair, "value">) =>
|
|
21
16
|
`${range}<--->${key}`;
|
|
22
17
|
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
// Code generated by Oracle. DO NOT EDIT.
|
|
11
|
+
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
|
|
14
|
+
import { keyZ } from "@/ranger/types.gen";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Pair is a key-value metadata pair associated with a specific range, enabling
|
|
18
|
+
* arbitrary metadata storage on time ranges.
|
|
19
|
+
*/
|
|
20
|
+
export const pairZ = z.object({
|
|
21
|
+
/** range is the unique identifier of the range owning this key-value pair. */
|
|
22
|
+
range: keyZ,
|
|
23
|
+
/** key is the metadata key name. */
|
|
24
|
+
key: z.string(),
|
|
25
|
+
/** value is the metadata value stored as a string for flexibility. */
|
|
26
|
+
value: z.string(),
|
|
27
|
+
});
|
|
28
|
+
export interface Pair extends z.infer<typeof pairZ> {}
|
package/src/ranger/payload.ts
CHANGED
|
@@ -7,54 +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 { color, math, TimeRange } from "@synnaxlabs/x";
|
|
11
10
|
import { z } from "zod";
|
|
12
11
|
|
|
13
|
-
import {
|
|
12
|
+
import { type Key } from "@/ranger/types.gen";
|
|
14
13
|
|
|
15
|
-
export const keyZ = z.uuid();
|
|
16
|
-
export type Key = z.infer<typeof keyZ>;
|
|
17
14
|
export const nameZ = z.string().min(1);
|
|
18
15
|
export type Name = z.infer<typeof nameZ>;
|
|
19
|
-
export type
|
|
20
|
-
export type Names = Name[];
|
|
21
|
-
export type Params = Key | Name | Keys | Names;
|
|
22
|
-
|
|
23
|
-
export const payloadZ = z.object({
|
|
24
|
-
key: keyZ,
|
|
25
|
-
name: nameZ,
|
|
26
|
-
timeRange: TimeRange.z
|
|
27
|
-
.refine(({ isValid }) => isValid, {
|
|
28
|
-
error: "Time range start time must be before or equal to time range end time",
|
|
29
|
-
})
|
|
30
|
-
.refine(({ end }) => end.valueOf() <= math.MAX_INT64, {
|
|
31
|
-
error:
|
|
32
|
-
"Time range end time must be less than or equal to the maximum value of an int64",
|
|
33
|
-
})
|
|
34
|
-
.refine(({ start }) => start.valueOf() >= math.MIN_INT64, {
|
|
35
|
-
error:
|
|
36
|
-
"Time range start time must be greater than or equal to the minimum value of an int64",
|
|
37
|
-
}),
|
|
38
|
-
color: color.colorZ.optional(),
|
|
39
|
-
labels: label.labelZ
|
|
40
|
-
.array()
|
|
41
|
-
.or(z.null().transform(() => undefined))
|
|
42
|
-
.optional(),
|
|
43
|
-
get parent(): z.ZodUnion<readonly [z.ZodNull, typeof payloadZ]> {
|
|
44
|
-
// Using as unknown is bad, but unfortunately resolving the output type of this
|
|
45
|
-
// transform is nearly impossible.
|
|
46
|
-
return payloadZ
|
|
47
|
-
.optional()
|
|
48
|
-
.nullable()
|
|
49
|
-
.transform((p) => (p === undefined ? null : p)) as unknown as z.ZodUnion<
|
|
50
|
-
readonly [z.ZodNull, typeof payloadZ]
|
|
51
|
-
>;
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
export type Payload = z.infer<typeof payloadZ>;
|
|
56
|
-
|
|
57
|
-
export const newZ = payloadZ
|
|
58
|
-
.omit({ parent: true, labels: true })
|
|
59
|
-
.partial({ key: true });
|
|
60
|
-
export interface New extends z.input<typeof newZ> {}
|
|
16
|
+
export type Params = Key | Name | Key[] | Name[];
|
|
@@ -16,7 +16,7 @@ import { createTestClient } from "@/testutil/client";
|
|
|
16
16
|
|
|
17
17
|
const client = createTestClient();
|
|
18
18
|
|
|
19
|
-
describe("
|
|
19
|
+
describe("range", () => {
|
|
20
20
|
describe("payload", () => {
|
|
21
21
|
it("should validate the time range", () => {
|
|
22
22
|
const payload = ranger.payloadZ.parse({
|
|
@@ -215,9 +215,7 @@ describe("Ranger", () => {
|
|
|
215
215
|
const val = await rng.kv.get("foo");
|
|
216
216
|
expect(val).toEqual("bar");
|
|
217
217
|
await rng.kv.delete("foo");
|
|
218
|
-
await expect(async () => await rng.kv.get("foo")).rejects.
|
|
219
|
-
NotFoundError,
|
|
220
|
-
);
|
|
218
|
+
await expect(async () => await rng.kv.get("foo")).rejects.toThrow(NotFoundError);
|
|
221
219
|
});
|
|
222
220
|
|
|
223
221
|
it("should set and get multiple keys", async () => {
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
// Code generated by Oracle. DO NOT EDIT.
|
|
11
|
+
|
|
12
|
+
import { color, label, telem, zod } from "@synnaxlabs/x";
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
|
|
15
|
+
import { ontology } from "@/ontology";
|
|
16
|
+
|
|
17
|
+
export const keyZ = z.uuid();
|
|
18
|
+
export type Key = z.infer<typeof keyZ>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Base is a user-defined region of time in the Synnax cluster. Ranges act as a
|
|
22
|
+
* method for labeling and categorizing telemetry data within specific time
|
|
23
|
+
* periods.
|
|
24
|
+
*/
|
|
25
|
+
export const baseZ = z.object({
|
|
26
|
+
/** key is the unique identifier for this range. */
|
|
27
|
+
key: keyZ,
|
|
28
|
+
/** name is a human-readable name for the range. */
|
|
29
|
+
name: z.string().min(1),
|
|
30
|
+
/**
|
|
31
|
+
* timeRange is the temporal extent of the range, defining its start and end
|
|
32
|
+
* timestamps.
|
|
33
|
+
*/
|
|
34
|
+
timeRange: telem.timeRangeZ,
|
|
35
|
+
/**
|
|
36
|
+
* color is an optional display color for visual identification of the range
|
|
37
|
+
* in user interfaces.
|
|
38
|
+
*/
|
|
39
|
+
color: color.colorZ.optional(),
|
|
40
|
+
});
|
|
41
|
+
export interface Base extends z.infer<typeof baseZ> {}
|
|
42
|
+
|
|
43
|
+
export const apiRangeZ = baseZ.extend({
|
|
44
|
+
labels: zod.nullToUndefined(label.labelZ.array()),
|
|
45
|
+
get parent(): z.ZodOptional<typeof apiRangeZ> {
|
|
46
|
+
return apiRangeZ.optional();
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
export interface APIRange extends z.infer<typeof apiRangeZ> {}
|
|
50
|
+
|
|
51
|
+
export const payloadZ = baseZ.omit({ timeRange: true }).extend({
|
|
52
|
+
labels: zod.nullToUndefined(label.labelZ.array()),
|
|
53
|
+
get parent(): z.ZodOptional<typeof payloadZ> {
|
|
54
|
+
return payloadZ.optional();
|
|
55
|
+
},
|
|
56
|
+
timeRange: telem.timeRangeBoundedZ,
|
|
57
|
+
});
|
|
58
|
+
export interface Payload extends z.infer<typeof payloadZ> {}
|
|
59
|
+
|
|
60
|
+
export const newZ = payloadZ
|
|
61
|
+
.omit({ parent: true, labels: true })
|
|
62
|
+
.partial({ key: true });
|
|
63
|
+
export interface New extends z.input<typeof newZ> {}
|
|
64
|
+
|
|
65
|
+
export const ontologyID = ontology.createIDFactory<Key>("range");
|
|
66
|
+
export const TYPE_ONTOLOGY_ID = ontologyID("");
|
package/src/ranger/writer.ts
CHANGED
|
@@ -11,7 +11,8 @@ import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
|
|
13
13
|
import { ontology } from "@/ontology";
|
|
14
|
-
import {
|
|
14
|
+
import { nameZ } from "@/ranger/payload";
|
|
15
|
+
import { keyZ, type New, newZ, type Payload, payloadZ } from "@/ranger/types.gen";
|
|
15
16
|
|
|
16
17
|
const createResZ = z.object({ ranges: payloadZ.array() });
|
|
17
18
|
|
package/src/schematic/client.ts
CHANGED
|
@@ -8,27 +8,27 @@
|
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
10
|
import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
|
-
import { array,
|
|
11
|
+
import { array, caseconv, record } from "@synnaxlabs/x";
|
|
12
12
|
import { z } from "zod";
|
|
13
13
|
|
|
14
|
-
import {
|
|
14
|
+
import { symbol } from "@/schematic/symbol";
|
|
15
15
|
import {
|
|
16
16
|
type Key,
|
|
17
17
|
keyZ,
|
|
18
18
|
type New,
|
|
19
19
|
newZ,
|
|
20
|
-
type Params,
|
|
21
|
-
remoteZ,
|
|
22
20
|
type Schematic,
|
|
23
21
|
schematicZ,
|
|
24
|
-
} from "@/schematic/
|
|
25
|
-
import { symbol } from "@/schematic/symbol";
|
|
22
|
+
} from "@/schematic/types.gen";
|
|
26
23
|
import { checkForMultipleOrNoResults } from "@/util/retrieve";
|
|
27
24
|
import { workspace } from "@/workspace";
|
|
28
25
|
|
|
29
26
|
const renameReqZ = z.object({ key: keyZ, name: z.string() });
|
|
30
27
|
|
|
31
|
-
const setDataReqZ = z.object({
|
|
28
|
+
const setDataReqZ = z.object({
|
|
29
|
+
key: keyZ,
|
|
30
|
+
data: caseconv.preserveCase(record.unknownZ()),
|
|
31
|
+
});
|
|
32
32
|
const deleteReqZ = z.object({ keys: keyZ.array() });
|
|
33
33
|
|
|
34
34
|
const copyReqZ = z.object({
|
|
@@ -48,13 +48,13 @@ export type RetrieveSingleParams = z.input<typeof singleRetrieveArgsZ>;
|
|
|
48
48
|
export type RetrieveMultipleParams = z.input<typeof retrieveReqZ>;
|
|
49
49
|
export type CopyArgs = z.input<typeof copyReqZ>;
|
|
50
50
|
|
|
51
|
-
const retrieveResZ = z.object({ schematics: array
|
|
51
|
+
const retrieveResZ = z.object({ schematics: schematicZ.array() });
|
|
52
52
|
|
|
53
53
|
const createReqZ = z.object({
|
|
54
54
|
workspace: workspace.keyZ,
|
|
55
55
|
schematics: newZ.array(),
|
|
56
56
|
});
|
|
57
|
-
const createResZ = z.object({ schematics:
|
|
57
|
+
const createResZ = z.object({ schematics: schematicZ.array() });
|
|
58
58
|
|
|
59
59
|
const copyResZ = z.object({ schematic: schematicZ });
|
|
60
60
|
const emptyResZ = z.object({});
|
|
@@ -99,7 +99,7 @@ export class Client {
|
|
|
99
99
|
await sendRequired(
|
|
100
100
|
this.client,
|
|
101
101
|
"/schematic/set-data",
|
|
102
|
-
{ key, data
|
|
102
|
+
{ key, data },
|
|
103
103
|
setDataReqZ,
|
|
104
104
|
emptyResZ,
|
|
105
105
|
);
|
|
@@ -122,7 +122,7 @@ export class Client {
|
|
|
122
122
|
return isSingle ? res.schematics[0] : res.schematics;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
async delete(keys:
|
|
125
|
+
async delete(keys: Key | Key[]): Promise<void> {
|
|
126
126
|
await sendRequired(
|
|
127
127
|
this.client,
|
|
128
128
|
"/schematic/delete",
|
|
@@ -143,6 +143,3 @@ export class Client {
|
|
|
143
143
|
return res.schematic;
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
|
|
147
|
-
export const ontologyID = ontology.createIDFactory<Key>("schematic");
|
|
148
|
-
export const TYPE_ONTOLOGY_ID = ontologyID("");
|
|
@@ -24,13 +24,18 @@ describe("Schematic", () => {
|
|
|
24
24
|
});
|
|
25
25
|
const schematic = await client.schematics.create(ws.key, {
|
|
26
26
|
name: "Schematic",
|
|
27
|
-
data: {
|
|
27
|
+
data: { One: 1 },
|
|
28
28
|
});
|
|
29
29
|
expect(schematic.name).toEqual("Schematic");
|
|
30
30
|
expect(schematic.key).not.toEqual(uuid.ZERO);
|
|
31
|
-
expect(schematic.data.
|
|
31
|
+
expect(schematic.data.One).toEqual(1);
|
|
32
|
+
const retrieved = await client.schematics.retrieve({
|
|
33
|
+
key: schematic.key,
|
|
34
|
+
});
|
|
35
|
+
expect(retrieved.data.One).toEqual(1);
|
|
32
36
|
});
|
|
33
37
|
});
|
|
38
|
+
|
|
34
39
|
describe("rename", () => {
|
|
35
40
|
test("rename one", async () => {
|
|
36
41
|
const ws = await client.workspaces.create({
|
|
@@ -48,6 +53,7 @@ describe("Schematic", () => {
|
|
|
48
53
|
expect(res.name).toEqual("Schematic2");
|
|
49
54
|
});
|
|
50
55
|
});
|
|
56
|
+
|
|
51
57
|
describe("setData", () => {
|
|
52
58
|
test("set data", async () => {
|
|
53
59
|
const ws = await client.workspaces.create({
|
|
@@ -65,6 +71,7 @@ describe("Schematic", () => {
|
|
|
65
71
|
expect(res.data.two).toEqual(2);
|
|
66
72
|
});
|
|
67
73
|
});
|
|
74
|
+
|
|
68
75
|
describe("delete", () => {
|
|
69
76
|
test("delete one", async () => {
|
|
70
77
|
const ws = await client.workspaces.create({
|
|
@@ -81,6 +88,50 @@ describe("Schematic", () => {
|
|
|
81
88
|
);
|
|
82
89
|
});
|
|
83
90
|
});
|
|
91
|
+
describe("case preservation", () => {
|
|
92
|
+
test("should preserve key casing in data field on create/retrieve cycle", async () => {
|
|
93
|
+
const ws = await client.workspaces.create({
|
|
94
|
+
name: "CaseTest",
|
|
95
|
+
layout: {},
|
|
96
|
+
});
|
|
97
|
+
const schematic = await client.schematics.create(ws.key, {
|
|
98
|
+
name: "CaseTest",
|
|
99
|
+
data: {
|
|
100
|
+
camelCaseKey: "value1",
|
|
101
|
+
PascalCaseKey: "value2",
|
|
102
|
+
snake_case_key: "value3",
|
|
103
|
+
nested: {
|
|
104
|
+
innerCamelCase: 123,
|
|
105
|
+
InnerPascalCase: { deepKey: true },
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
const retrieved = await client.schematics.retrieve({
|
|
111
|
+
key: schematic.key,
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const data = retrieved.data as Record<string, unknown>;
|
|
115
|
+
expect(data.camelCaseKey).toEqual("value1");
|
|
116
|
+
expect(data.PascalCaseKey).toEqual("value2");
|
|
117
|
+
expect(data.snake_case_key).toEqual("value3");
|
|
118
|
+
expect((data.nested as Record<string, unknown>).innerCamelCase).toEqual(123);
|
|
119
|
+
expect(
|
|
120
|
+
(
|
|
121
|
+
(data.nested as Record<string, unknown>).InnerPascalCase as Record<
|
|
122
|
+
string,
|
|
123
|
+
unknown
|
|
124
|
+
>
|
|
125
|
+
).deepKey,
|
|
126
|
+
).toEqual(true);
|
|
127
|
+
expect(Object.keys(data)).toContain("camelCaseKey");
|
|
128
|
+
expect(Object.keys(data)).toContain("PascalCaseKey");
|
|
129
|
+
expect(Object.keys(data)).toContain("snake_case_key");
|
|
130
|
+
expect(Object.keys(data)).not.toContain("camel_case_key");
|
|
131
|
+
expect(Object.keys(data)).not.toContain("pascal_case_key");
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
|
|
84
135
|
describe("copy", () => {
|
|
85
136
|
test("copy one", async () => {
|
|
86
137
|
const ws = await client.workspaces.create({
|
|
@@ -100,6 +151,7 @@ describe("Schematic", () => {
|
|
|
100
151
|
expect(schematic2.key).not.toEqual(uuid.ZERO);
|
|
101
152
|
expect(schematic2.data.one).toEqual(1);
|
|
102
153
|
});
|
|
154
|
+
|
|
103
155
|
describe("snapshot", () => {
|
|
104
156
|
it("should not allow the caller to edit the snapshot", async () => {
|
|
105
157
|
const ws = await client.workspaces.create({
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
newZ,
|
|
21
21
|
type Symbol,
|
|
22
22
|
symbolZ,
|
|
23
|
-
} from "@/schematic/symbol/
|
|
23
|
+
} from "@/schematic/symbol/types.gen";
|
|
24
24
|
import { checkForMultipleOrNoResults } from "@/util/retrieve";
|
|
25
25
|
|
|
26
26
|
const createReqZ = z.object({ symbols: newZ.array(), parent: ontology.idZ });
|
|
@@ -42,7 +42,7 @@ export type RetrieveArgs = z.input<typeof retrieveArgsZ>;
|
|
|
42
42
|
export type RetrieveSingleParams = z.input<typeof singleRetrieveArgsZ>;
|
|
43
43
|
export type RetrieveMultipleParams = z.input<typeof retrieveRequestZ>;
|
|
44
44
|
|
|
45
|
-
const retrieveResZ = z.object({ symbols: array.
|
|
45
|
+
const retrieveResZ = z.object({ symbols: array.nullishToEmpty(symbolZ) });
|
|
46
46
|
const createResZ = z.object({ symbols: symbolZ.array() });
|
|
47
47
|
const emptyResZ = z.object({});
|
|
48
48
|
const retrieveGroupReqZ = z.object({});
|
|
@@ -128,5 +128,3 @@ export class Client {
|
|
|
128
128
|
return res.group;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
|
|
132
|
-
export const ontologyID = ontology.createIDFactory<Key>("schematic_symbol");
|