@synnaxlabs/client 0.53.1 → 0.54.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/.turbo/turbo-build.log +14 -8
- package/dist/client.cjs +48 -54
- package/dist/client.js +12361 -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 +95 -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 +155 -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 +181 -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 +196 -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
|
@@ -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 module from "@/arc/module/types.gen";
|
|
@@ -0,0 +1,18 @@
|
|
|
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 { type z } from "zod";
|
|
13
|
+
|
|
14
|
+
import { compiler } from "@/arc/compiler";
|
|
15
|
+
import { ir } from "@/arc/ir";
|
|
16
|
+
|
|
17
|
+
export const moduleZ = ir.irZ.extend(compiler.outputZ.shape);
|
|
18
|
+
export interface Module extends z.infer<typeof moduleZ> {}
|
|
@@ -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 program from "@/arc/program/types.gen";
|
|
@@ -0,0 +1,18 @@
|
|
|
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 { type z } from "zod";
|
|
13
|
+
|
|
14
|
+
import { compiler } from "@/arc/compiler";
|
|
15
|
+
import { ir } from "@/arc/ir";
|
|
16
|
+
|
|
17
|
+
export const programZ = ir.irZ.extend(compiler.outputZ.shape);
|
|
18
|
+
export interface Program extends z.infer<typeof programZ> {}
|
|
@@ -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 text from "@/arc/text/types.gen";
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
/** Text is text-based Arc source code with optional parsed AST for compilation. */
|
|
15
|
+
export const textZ = z.object({
|
|
16
|
+
/** raw is the raw Arc source code in text form. */
|
|
17
|
+
raw: z.string(),
|
|
18
|
+
});
|
|
19
|
+
export interface Text extends z.infer<typeof textZ> {}
|
|
@@ -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 types from "@/arc/types/types.gen";
|
|
@@ -0,0 +1,132 @@
|
|
|
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 { array, zod } from "@synnaxlabs/x";
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
|
|
15
|
+
export enum Kind {
|
|
16
|
+
invalid = 0,
|
|
17
|
+
u8 = 1,
|
|
18
|
+
u16 = 2,
|
|
19
|
+
u32 = 3,
|
|
20
|
+
u64 = 4,
|
|
21
|
+
i8 = 5,
|
|
22
|
+
i16 = 6,
|
|
23
|
+
i32 = 7,
|
|
24
|
+
i64 = 8,
|
|
25
|
+
f32 = 9,
|
|
26
|
+
f64 = 10,
|
|
27
|
+
string = 11,
|
|
28
|
+
chan = 14,
|
|
29
|
+
series = 15,
|
|
30
|
+
variable = 16,
|
|
31
|
+
numeric_constant = 17,
|
|
32
|
+
integer_constant = 18,
|
|
33
|
+
float_constant = 19,
|
|
34
|
+
exact_integer_float_constant = 20,
|
|
35
|
+
function = 21,
|
|
36
|
+
sequence = 22,
|
|
37
|
+
stage = 23,
|
|
38
|
+
}
|
|
39
|
+
export const kindZ = z.enum(Kind);
|
|
40
|
+
|
|
41
|
+
export enum ChanDirection {
|
|
42
|
+
none = 0,
|
|
43
|
+
read = 1,
|
|
44
|
+
write = 2,
|
|
45
|
+
}
|
|
46
|
+
export const chanDirectionZ = z.enum(ChanDirection);
|
|
47
|
+
|
|
48
|
+
/** Channels contains channel declarations for reading from and writing to Synnax channels. */
|
|
49
|
+
export const channelsZ = z.object({
|
|
50
|
+
/** read contains readable channel indices mapped to parameter names. */
|
|
51
|
+
read: z.record(z.uint32(), z.string()),
|
|
52
|
+
/** write contains writable channel indices mapped to parameter names. */
|
|
53
|
+
write: z.record(z.uint32(), z.string()),
|
|
54
|
+
});
|
|
55
|
+
export interface Channels extends z.infer<typeof channelsZ> {}
|
|
56
|
+
|
|
57
|
+
/** Dimensions contains physical dimension exponents for dimensional analysis (SI base quantities). */
|
|
58
|
+
export const dimensionsZ = z.object({
|
|
59
|
+
/** length is the length dimension exponent (meters). */
|
|
60
|
+
length: zod.int8,
|
|
61
|
+
/** mass is the mass dimension exponent (kilograms). */
|
|
62
|
+
mass: zod.int8,
|
|
63
|
+
/** time is the time dimension exponent (seconds). */
|
|
64
|
+
time: zod.int8,
|
|
65
|
+
/** current is the electric current dimension exponent (amperes). */
|
|
66
|
+
current: zod.int8,
|
|
67
|
+
/** temperature is the temperature dimension exponent (kelvin). */
|
|
68
|
+
temperature: zod.int8,
|
|
69
|
+
/** angle is the angle dimension exponent (radians). */
|
|
70
|
+
angle: zod.int8,
|
|
71
|
+
/** count is the count dimension exponent (dimensionless quantity). */
|
|
72
|
+
count: zod.int8,
|
|
73
|
+
/** data is the data size dimension exponent (bytes). */
|
|
74
|
+
data: zod.int8,
|
|
75
|
+
});
|
|
76
|
+
export interface Dimensions extends z.infer<typeof dimensionsZ> {}
|
|
77
|
+
|
|
78
|
+
/** Unit is a physical unit with dimensions and scale factor for unit-aware computation. */
|
|
79
|
+
export const unitZ = z.object({
|
|
80
|
+
/** dimensions contains physical dimension exponents. */
|
|
81
|
+
dimensions: dimensionsZ,
|
|
82
|
+
/** scale is the scale factor relative to SI base units. */
|
|
83
|
+
scale: z.number(),
|
|
84
|
+
/** name is the unit name (e.g., 'psi', 'ns', 'm/s'). */
|
|
85
|
+
name: z.string(),
|
|
86
|
+
});
|
|
87
|
+
export interface Unit extends z.infer<typeof unitZ> {}
|
|
88
|
+
|
|
89
|
+
/** FunctionProperties contains common parameter definitions for function-like types. */
|
|
90
|
+
export const functionPropertiesZ = z.object({
|
|
91
|
+
/** inputs contains input parameter definitions. */
|
|
92
|
+
get inputs(): z.ZodOptional<typeof paramsZ> {
|
|
93
|
+
return paramsZ.optional();
|
|
94
|
+
},
|
|
95
|
+
/** outputs contains output parameter definitions. */
|
|
96
|
+
get outputs(): z.ZodOptional<typeof paramsZ> {
|
|
97
|
+
return paramsZ.optional();
|
|
98
|
+
},
|
|
99
|
+
/** config contains configuration parameter definitions. */
|
|
100
|
+
get config(): z.ZodOptional<typeof paramsZ> {
|
|
101
|
+
return paramsZ.optional();
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
export interface FunctionProperties extends z.infer<typeof functionPropertiesZ> {}
|
|
105
|
+
|
|
106
|
+
export const typeZ = functionPropertiesZ.extend({
|
|
107
|
+
kind: kindZ,
|
|
108
|
+
name: z.string(),
|
|
109
|
+
get elem(): z.ZodOptional<typeof typeZ> {
|
|
110
|
+
return typeZ.optional();
|
|
111
|
+
},
|
|
112
|
+
unit: unitZ.optional(),
|
|
113
|
+
get constraint(): z.ZodOptional<typeof typeZ> {
|
|
114
|
+
return typeZ.optional();
|
|
115
|
+
},
|
|
116
|
+
chanDirection: chanDirectionZ.optional(),
|
|
117
|
+
});
|
|
118
|
+
export interface Type extends z.infer<typeof typeZ> {}
|
|
119
|
+
|
|
120
|
+
/** Param is a named, typed parameter with optional default value. */
|
|
121
|
+
export const paramZ = z.object({
|
|
122
|
+
/** name is the parameter name. */
|
|
123
|
+
name: z.string(),
|
|
124
|
+
/** type is the parameter type. */
|
|
125
|
+
type: typeZ,
|
|
126
|
+
/** value is an optional default value. */
|
|
127
|
+
value: z.unknown().optional(),
|
|
128
|
+
});
|
|
129
|
+
export interface Param extends z.infer<typeof paramZ> {}
|
|
130
|
+
|
|
131
|
+
export const paramsZ = array.nullishToEmpty(paramZ);
|
|
132
|
+
export type Params = z.infer<typeof paramsZ>;
|
|
@@ -0,0 +1,85 @@
|
|
|
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 { status } from "@synnaxlabs/x";
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
|
|
15
|
+
import { graph } from "@/arc/graph";
|
|
16
|
+
import { program } from "@/arc/program";
|
|
17
|
+
import { text } from "@/arc/text";
|
|
18
|
+
import { ontology } from "@/ontology";
|
|
19
|
+
|
|
20
|
+
export const MODES = ["text", "graph"] as const;
|
|
21
|
+
export const modeZ = z.enum(MODES);
|
|
22
|
+
export type Mode = z.infer<typeof modeZ>;
|
|
23
|
+
|
|
24
|
+
/** StatusDetails contains Arc-specific status details for execution state. */
|
|
25
|
+
export const statusDetailsZ = z.object({
|
|
26
|
+
/** running indicates whether the Arc module is currently executing. */
|
|
27
|
+
running: z.boolean(),
|
|
28
|
+
});
|
|
29
|
+
export interface StatusDetails extends z.infer<typeof statusDetailsZ> {}
|
|
30
|
+
|
|
31
|
+
export const keyZ = z.uuid();
|
|
32
|
+
export type Key = z.infer<typeof keyZ>;
|
|
33
|
+
|
|
34
|
+
export const statusZ = status.statusZ({ details: statusDetailsZ });
|
|
35
|
+
export type Status = z.infer<typeof statusZ>;
|
|
36
|
+
|
|
37
|
+
/** New contains parameters for creating a new Arc module. */
|
|
38
|
+
export const newZ = z.object({
|
|
39
|
+
/**
|
|
40
|
+
* key is an optional key for the module. If not provided, one will be
|
|
41
|
+
* automatically assigned.
|
|
42
|
+
*/
|
|
43
|
+
key: keyZ.optional(),
|
|
44
|
+
/** name is a human-readable name for the module. */
|
|
45
|
+
name: z.string(),
|
|
46
|
+
/**
|
|
47
|
+
* mode specifies the representation mode for this module.
|
|
48
|
+
* Either "text" for text-based Arc code or "graph" for visual dataflow.
|
|
49
|
+
*/
|
|
50
|
+
mode: modeZ,
|
|
51
|
+
/** graph is the visual dataflow graph representation. */
|
|
52
|
+
graph: graph.graphZ,
|
|
53
|
+
/** text is the text-based Arc source code. */
|
|
54
|
+
text: text.textZ,
|
|
55
|
+
});
|
|
56
|
+
export interface New extends z.input<typeof newZ> {}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Arc is an Arc module combining visual graph representation and text-based
|
|
60
|
+
* source code for reactive control systems. Compiles to WebAssembly for
|
|
61
|
+
* sandboxed execution.
|
|
62
|
+
*/
|
|
63
|
+
export const arcZ = z.object({
|
|
64
|
+
/** key is the unique identifier for this module. */
|
|
65
|
+
key: keyZ,
|
|
66
|
+
/** name is a human-readable name for the module. */
|
|
67
|
+
name: z.string(),
|
|
68
|
+
/**
|
|
69
|
+
* mode specifies the representation mode for this module.
|
|
70
|
+
* Either "text" for text-based Arc code or "graph" for visual dataflow.
|
|
71
|
+
*/
|
|
72
|
+
mode: modeZ,
|
|
73
|
+
/** graph is the visual dataflow graph representation of the module. */
|
|
74
|
+
graph: graph.graphZ,
|
|
75
|
+
/** text is the text-based Arc source code. */
|
|
76
|
+
text: text.textZ,
|
|
77
|
+
/** program is the compiled module output including IR and WebAssembly bytecode. */
|
|
78
|
+
program: program.programZ.optional(),
|
|
79
|
+
/** status is the current execution status of the module. */
|
|
80
|
+
status: statusZ.optional(),
|
|
81
|
+
});
|
|
82
|
+
export interface Arc extends z.infer<typeof arcZ> {}
|
|
83
|
+
|
|
84
|
+
export const ontologyID = ontology.createIDFactory<Key>("arc");
|
|
85
|
+
export const TYPE_ONTOLOGY_ID = ontologyID("");
|
package/src/channel/client.ts
CHANGED
|
@@ -20,18 +20,7 @@ import {
|
|
|
20
20
|
} from "@synnaxlabs/x";
|
|
21
21
|
import { z } from "zod";
|
|
22
22
|
|
|
23
|
-
import {
|
|
24
|
-
type Key,
|
|
25
|
-
type KeyOrName,
|
|
26
|
-
keyZ,
|
|
27
|
-
type New,
|
|
28
|
-
ontologyID,
|
|
29
|
-
type Operation,
|
|
30
|
-
type Params,
|
|
31
|
-
type Payload,
|
|
32
|
-
payloadZ,
|
|
33
|
-
type Status,
|
|
34
|
-
} from "@/channel/payload";
|
|
23
|
+
import { type Params } from "@/channel/payload";
|
|
35
24
|
import {
|
|
36
25
|
analyzeParams,
|
|
37
26
|
CacheRetriever,
|
|
@@ -41,6 +30,16 @@ import {
|
|
|
41
30
|
type Retriever,
|
|
42
31
|
type RetrieveRequest,
|
|
43
32
|
} from "@/channel/retriever";
|
|
33
|
+
import {
|
|
34
|
+
type Key,
|
|
35
|
+
keyZ,
|
|
36
|
+
type Name,
|
|
37
|
+
type New,
|
|
38
|
+
ontologyID,
|
|
39
|
+
type Operation,
|
|
40
|
+
type Payload,
|
|
41
|
+
payloadZ,
|
|
42
|
+
} from "@/channel/types.gen";
|
|
44
43
|
import { type Writer } from "@/channel/writer";
|
|
45
44
|
import { ValidationError } from "@/errors";
|
|
46
45
|
import { type framer } from "@/framer";
|
|
@@ -117,7 +116,7 @@ export class Channel {
|
|
|
117
116
|
/**
|
|
118
117
|
* The status of the channel.
|
|
119
118
|
*/
|
|
120
|
-
readonly status?: Status;
|
|
119
|
+
readonly status?: status.Status;
|
|
121
120
|
|
|
122
121
|
constructor({
|
|
123
122
|
dataType,
|
|
@@ -137,7 +136,7 @@ export class Channel {
|
|
|
137
136
|
internal?: boolean;
|
|
138
137
|
frameClient?: framer.Client;
|
|
139
138
|
density?: CrudeDensity;
|
|
140
|
-
status?: status.
|
|
139
|
+
status?: status.New;
|
|
141
140
|
operations?: Operation[];
|
|
142
141
|
}) {
|
|
143
142
|
this.key = keyZ.parse(key);
|
|
@@ -344,7 +343,7 @@ export class Client {
|
|
|
344
343
|
* const channel = await client.channels.retrieve(1);
|
|
345
344
|
* ```
|
|
346
345
|
*/
|
|
347
|
-
async retrieve(params:
|
|
346
|
+
async retrieve(params: Key | Name, options?: RetrieveOptions): Promise<Channel>;
|
|
348
347
|
|
|
349
348
|
/**
|
|
350
349
|
* Retrieves multiple channels from the database using the provided keys or the
|
package/src/channel/external.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { DataType } from "@synnaxlabs/x";
|
|
11
11
|
import { describe, expect, it } from "vitest";
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { channel } from "@/channel";
|
|
14
14
|
|
|
15
15
|
describe("nameZ", () => {
|
|
16
16
|
describe("valid names", () => {
|
|
@@ -31,7 +31,7 @@ describe("nameZ", () => {
|
|
|
31
31
|
];
|
|
32
32
|
validNames.forEach(([name, description]) => {
|
|
33
33
|
it(`should accept ${name} (${description})`, () => {
|
|
34
|
-
const result = nameZ.safeParse(name);
|
|
34
|
+
const result = channel.nameZ.safeParse(name);
|
|
35
35
|
expect(result.success).toBe(true);
|
|
36
36
|
});
|
|
37
37
|
});
|
|
@@ -39,9 +39,9 @@ describe("nameZ", () => {
|
|
|
39
39
|
|
|
40
40
|
describe("invalid names", () => {
|
|
41
41
|
it("should reject empty string", () => {
|
|
42
|
-
const result = nameZ.safeParse("");
|
|
42
|
+
const result = channel.nameZ.safeParse("");
|
|
43
43
|
expect(result.success).toBe(false);
|
|
44
|
-
expect(result.error?.issues[0].message).toContain("Name
|
|
44
|
+
expect(result.error?.issues[0].message).toContain("Name is required");
|
|
45
45
|
});
|
|
46
46
|
});
|
|
47
47
|
});
|
|
@@ -55,17 +55,17 @@ describe("newZ", () => {
|
|
|
55
55
|
|
|
56
56
|
describe("name validation", () => {
|
|
57
57
|
it("should accept valid channel names", () => {
|
|
58
|
-
const result = newZ.safeParse(validNewChannel);
|
|
58
|
+
const result = channel.newZ.safeParse(validNewChannel);
|
|
59
59
|
expect(result.success).toBe(true);
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
it("should reject empty name", () => {
|
|
63
|
-
const result = newZ.safeParse({ ...validNewChannel, name: "" });
|
|
63
|
+
const result = channel.newZ.safeParse({ ...validNewChannel, name: "" });
|
|
64
64
|
expect(result.success).toBe(false);
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
it("should accept name with underscores", () => {
|
|
68
|
-
const result = newZ.safeParse({
|
|
68
|
+
const result = channel.newZ.safeParse({
|
|
69
69
|
...validNewChannel,
|
|
70
70
|
name: "sensor_temp_123",
|
|
71
71
|
});
|
|
@@ -73,42 +73,45 @@ describe("newZ", () => {
|
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
it("should accept name starting with underscore", () => {
|
|
76
|
-
const result = newZ.safeParse({
|
|
76
|
+
const result = channel.newZ.safeParse({
|
|
77
|
+
...validNewChannel,
|
|
78
|
+
name: "_private_sensor",
|
|
79
|
+
});
|
|
77
80
|
expect(result.success).toBe(true);
|
|
78
81
|
});
|
|
79
82
|
});
|
|
80
83
|
});
|
|
81
84
|
describe("escapeInvalidName", () => {
|
|
82
85
|
it("should escape invalid name", () => {
|
|
83
|
-
const result = escapeInvalidName("sensor-temp");
|
|
86
|
+
const result = channel.escapeInvalidName("sensor-temp");
|
|
84
87
|
expect(result).toBe("sensor_temp");
|
|
85
88
|
});
|
|
86
89
|
it("should escape name starting with digit", () => {
|
|
87
|
-
const result = escapeInvalidName("1sensor");
|
|
90
|
+
const result = channel.escapeInvalidName("1sensor");
|
|
88
91
|
expect(result).toBe("_1sensor");
|
|
89
92
|
});
|
|
90
93
|
it("should escape name with spaces", () => {
|
|
91
|
-
const result = escapeInvalidName("my channel");
|
|
94
|
+
const result = channel.escapeInvalidName("my channel");
|
|
92
95
|
expect(result).toBe("my_channel");
|
|
93
96
|
});
|
|
94
97
|
it("should escape name with special characters", () => {
|
|
95
|
-
const result = escapeInvalidName("sensor!");
|
|
98
|
+
const result = channel.escapeInvalidName("sensor!");
|
|
96
99
|
expect(result).toBe("sensor_");
|
|
97
100
|
});
|
|
98
101
|
it("should escape name with hyphens", () => {
|
|
99
|
-
const result = escapeInvalidName("sensor-temp");
|
|
102
|
+
const result = channel.escapeInvalidName("sensor-temp");
|
|
100
103
|
expect(result).toBe("sensor_temp");
|
|
101
104
|
});
|
|
102
105
|
it("should escape name with dots", () => {
|
|
103
|
-
const result = escapeInvalidName("sensor.temp");
|
|
106
|
+
const result = channel.escapeInvalidName("sensor.temp");
|
|
104
107
|
expect(result).toBe("sensor_temp");
|
|
105
108
|
});
|
|
106
109
|
it("should allow an empty string by default", () => {
|
|
107
|
-
const result = escapeInvalidName("");
|
|
110
|
+
const result = channel.escapeInvalidName("");
|
|
108
111
|
expect(result).toBe("");
|
|
109
112
|
});
|
|
110
113
|
it("should change empty string to underscore when changeEmptyToUnderscore is true", () => {
|
|
111
|
-
const result = escapeInvalidName("", true);
|
|
114
|
+
const result = channel.escapeInvalidName("", true);
|
|
112
115
|
expect(result).toBe("_");
|
|
113
116
|
});
|
|
114
117
|
});
|
package/src/channel/payload.ts
CHANGED
|
@@ -7,89 +7,21 @@
|
|
|
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
|
-
array,
|
|
12
|
-
type CrudeDataType,
|
|
13
|
-
DataType,
|
|
14
|
-
math,
|
|
15
|
-
status,
|
|
16
|
-
TimeSpan,
|
|
17
|
-
zod,
|
|
18
|
-
} from "@synnaxlabs/x";
|
|
10
|
+
import { zod } from "@synnaxlabs/x";
|
|
19
11
|
import { z } from "zod";
|
|
20
12
|
|
|
13
|
+
import {
|
|
14
|
+
type Key,
|
|
15
|
+
keyZ,
|
|
16
|
+
type Name,
|
|
17
|
+
nameZ,
|
|
18
|
+
ontologyID,
|
|
19
|
+
type Payload,
|
|
20
|
+
payloadZ,
|
|
21
|
+
} from "@/channel/types.gen";
|
|
21
22
|
import { ontology } from "@/ontology";
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
export const keyZ = z.uint32().or(
|
|
25
|
-
z
|
|
26
|
-
.string()
|
|
27
|
-
.refine((val) => !isNaN(Number(val)), { message: errorMessage })
|
|
28
|
-
.transform(Number)
|
|
29
|
-
.refine((val) => val < math.MAX_UINT32, { message: errorMessage }),
|
|
30
|
-
);
|
|
31
|
-
export type Key = z.infer<typeof keyZ>;
|
|
32
|
-
export type Keys = Key[];
|
|
33
|
-
export const nameZ = z.string().min(1, "Name must not be empty");
|
|
34
|
-
export type KeyOrName = Key | string;
|
|
35
|
-
export type KeysOrNames = Keys | string[];
|
|
36
|
-
export type PrimitiveParams = KeyOrName | KeysOrNames;
|
|
37
|
-
|
|
38
|
-
export const OPERATION_TYPES = ["min", "max", "avg", "none"] as const;
|
|
39
|
-
export const operationType = z.enum(OPERATION_TYPES);
|
|
40
|
-
export type OperationType = z.infer<typeof operationType>;
|
|
41
|
-
|
|
42
|
-
export const operationZ = z.object({
|
|
43
|
-
type: operationType,
|
|
44
|
-
resetChannel: keyZ.optional(),
|
|
45
|
-
duration: TimeSpan.z.optional(),
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
export type Operation = z.infer<typeof operationZ>;
|
|
49
|
-
|
|
50
|
-
export const statusZ = status.statusZ();
|
|
51
|
-
export type Status = z.infer<typeof statusZ>;
|
|
52
|
-
|
|
53
|
-
export const calculationStatusDetailsZ = z.object({ channel: keyZ });
|
|
54
|
-
export type CalculationStatusDetails = z.infer<typeof calculationStatusDetailsZ>;
|
|
55
|
-
export const calculationStatusZ = status.statusZ(calculationStatusDetailsZ);
|
|
56
|
-
export type CalculationStatus = z.infer<typeof calculationStatusZ>;
|
|
57
|
-
|
|
58
|
-
export const statusKey = (key: Key): string => ontology.idToString(ontologyID(key));
|
|
59
|
-
export const payloadZ = z.object({
|
|
60
|
-
name: z.string(),
|
|
61
|
-
key: keyZ,
|
|
62
|
-
dataType: DataType.z,
|
|
63
|
-
leaseholder: zod.uint12,
|
|
64
|
-
index: keyZ,
|
|
65
|
-
isIndex: z.boolean(),
|
|
66
|
-
internal: z.boolean(),
|
|
67
|
-
virtual: z.boolean(),
|
|
68
|
-
alias: z.string().optional(),
|
|
69
|
-
expression: z.string().default(""),
|
|
70
|
-
status: statusZ.optional(),
|
|
71
|
-
operations: array.nullableZ(operationZ),
|
|
72
|
-
});
|
|
73
|
-
export interface Payload extends z.infer<typeof payloadZ> {}
|
|
74
|
-
|
|
75
|
-
export const newZ = payloadZ.extend({
|
|
76
|
-
key: keyZ.optional(),
|
|
77
|
-
name: nameZ,
|
|
78
|
-
leaseholder: zod.uint12.optional(),
|
|
79
|
-
index: keyZ.optional(),
|
|
80
|
-
isIndex: z.boolean().optional(),
|
|
81
|
-
internal: z.boolean().default(false),
|
|
82
|
-
virtual: z.boolean().default(false),
|
|
83
|
-
expression: z.string().default(""),
|
|
84
|
-
operations: array.nullableZ(operationZ).optional(),
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
export interface New extends Omit<
|
|
88
|
-
z.input<typeof newZ>,
|
|
89
|
-
"dataType" | "status" | "internal"
|
|
90
|
-
> {
|
|
91
|
-
dataType: CrudeDataType;
|
|
92
|
-
}
|
|
24
|
+
export type PrimitiveParams = Key | Name | Key[] | Name[];
|
|
93
25
|
|
|
94
26
|
export const paramsZ = z.union([
|
|
95
27
|
zod.toArray(keyZ),
|
|
@@ -98,9 +30,6 @@ export const paramsZ = z.union([
|
|
|
98
30
|
]);
|
|
99
31
|
export type Params = PrimitiveParams | Payload | Payload[];
|
|
100
32
|
|
|
101
|
-
export const ontologyID = ontology.createIDFactory<Key>("channel");
|
|
102
|
-
export const TYPE_ONTOLOGY_ID = ontologyID(0);
|
|
103
|
-
|
|
104
33
|
const CHAR_REGEX = /[a-zA-Z0-9_]/;
|
|
105
34
|
|
|
106
35
|
const VALID_NAME_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
@@ -117,3 +46,6 @@ export const escapeInvalidName = (name: string, changeEmptyToUnderscore = false)
|
|
|
117
46
|
if (result[0].match(/^\d/)) result = `_${result}`;
|
|
118
47
|
return result;
|
|
119
48
|
};
|
|
49
|
+
|
|
50
|
+
export const statusKey = (channel: Key): string =>
|
|
51
|
+
ontology.idToString(ontologyID(channel));
|