@synnaxlabs/client 0.49.2 → 0.50.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 +10 -10
- package/CONTRIBUTING.md +1 -2
- package/README.md +1 -1
- package/dist/client.cjs +29 -29
- package/dist/client.js +3660 -3598
- 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 +5 -10
- package/dist/src/channel/client.d.ts.map +1 -1
- package/dist/src/channel/payload.d.ts +11 -9
- 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 +2 -0
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/device/client.d.ts +2 -2
- package/dist/src/device/payload.d.ts +1 -1
- package/dist/src/framer/client.d.ts +2 -2
- package/dist/src/framer/external.d.ts +1 -0
- package/dist/src/framer/external.d.ts.map +1 -1
- package/dist/src/framer/iterator.d.ts +5 -0
- package/dist/src/framer/iterator.d.ts.map +1 -1
- package/dist/src/framer/reader.d.ts +3 -1
- package/dist/src/framer/reader.d.ts.map +1 -1
- package/dist/src/framer/streamer.d.ts +1 -11
- package/dist/src/framer/streamer.d.ts.map +1 -1
- package/dist/src/framer/writer.d.ts +0 -10
- package/dist/src/framer/writer.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/label/client.d.ts +11 -8
- package/dist/src/label/client.d.ts.map +1 -1
- package/dist/src/ontology/client.d.ts +6 -4
- package/dist/src/ontology/client.d.ts.map +1 -1
- package/dist/src/ontology/group/client.d.ts +3 -2
- package/dist/src/ontology/group/client.d.ts.map +1 -1
- package/dist/src/ontology/group/payload.d.ts +1 -1
- package/dist/src/ontology/group/payload.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/ranger/client.d.ts +2 -2
- package/dist/src/ranger/writer.d.ts +3 -2
- package/dist/src/ranger/writer.d.ts.map +1 -1
- package/dist/src/status/payload.d.ts +2 -2
- 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 +1 -0
- 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 -3
- package/dist/src/workspace/lineplot/client.d.ts +2 -2
- package/dist/src/workspace/lineplot/payload.d.ts +3 -3
- package/dist/src/workspace/log/client.d.ts +2 -2
- package/dist/src/workspace/log/payload.d.ts +3 -3
- package/dist/src/workspace/payload.d.ts +3 -3
- package/dist/src/workspace/schematic/client.d.ts +2 -2
- package/dist/src/workspace/schematic/payload.d.ts +3 -3
- package/dist/src/workspace/table/client.d.ts +2 -2
- package/dist/src/workspace/table/payload.d.ts +3 -3
- package/eslint.config.ts +1 -1
- 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 +10 -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 +2 -5
- 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 +5 -36
- package/src/channel/external.ts +1 -1
- package/src/channel/index.ts +1 -1
- package/src/channel/payload.spec.ts +1 -1
- package/src/channel/payload.ts +12 -5
- package/src/channel/retriever.ts +5 -3
- package/src/channel/writer.ts +1 -1
- package/src/client.ts +8 -3
- 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 +1 -1
- 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.ts +1 -1
- package/src/errors.spec.ts +1 -1
- package/src/errors.ts +1 -1
- package/src/framer/adapter.spec.ts +1 -1
- package/src/framer/adapter.ts +1 -1
- 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 +2 -1
- package/src/framer/frame.spec.ts +1 -1
- package/src/framer/frame.ts +1 -1
- package/src/framer/index.ts +1 -1
- package/src/framer/iterator.spec.ts +68 -1
- package/src/framer/iterator.ts +8 -1
- package/src/framer/payload.ts +1 -1
- package/src/framer/reader.spec.ts +213 -84
- package/src/framer/reader.ts +14 -7
- 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/index.ts +2 -1
- package/src/label/access.spec.ts +1 -1
- package/src/label/client.ts +1 -1
- package/src/label/external.ts +1 -1
- package/src/label/index.ts +1 -1
- package/src/label/label.spec.ts +1 -1
- package/src/label/payload.ts +1 -1
- package/src/ontology/client.ts +6 -7
- package/src/ontology/external.ts +1 -1
- package/src/ontology/group/access.spec.ts +1 -1
- package/src/ontology/group/client.ts +1 -1
- package/src/ontology/group/external.ts +1 -1
- package/src/ontology/group/group.spec.ts +1 -1
- package/src/ontology/group/index.ts +1 -1
- package/src/ontology/group/payload.ts +1 -1
- package/src/ontology/index.ts +1 -1
- package/src/ontology/ontology.spec.ts +1 -1
- 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 +1 -1
- package/src/ranger/client.ts +1 -1
- package/src/ranger/external.ts +1 -1
- package/src/ranger/index.ts +1 -1
- package/src/ranger/kv.ts +1 -1
- package/src/ranger/payload.ts +1 -1
- package/src/ranger/ranger.spec.ts +1 -1
- package/src/ranger/writer.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 +1 -1
- package/src/status/status.spec.ts +1 -1
- 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 +10 -5
- 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 -1
- package/src/workspace/external.ts +1 -1
- package/src/workspace/index.ts +1 -1
- package/src/workspace/lineplot/access.spec.ts +1 -1
- package/src/workspace/lineplot/client.ts +1 -1
- package/src/workspace/lineplot/external.ts +1 -1
- package/src/workspace/lineplot/index.ts +1 -1
- package/src/workspace/lineplot/lineplot.spec.ts +1 -1
- package/src/workspace/lineplot/payload.ts +1 -1
- package/src/workspace/log/access.spec.ts +1 -1
- package/src/workspace/log/client.ts +1 -1
- package/src/workspace/log/external.ts +1 -1
- package/src/workspace/log/index.ts +1 -1
- package/src/workspace/log/log.spec.ts +1 -1
- package/src/workspace/log/payload.ts +1 -1
- package/src/workspace/payload.ts +1 -1
- package/src/workspace/schematic/access.spec.ts +1 -1
- package/src/workspace/schematic/client.ts +1 -1
- package/src/workspace/schematic/external.ts +1 -1
- package/src/workspace/schematic/index.ts +1 -1
- package/src/workspace/schematic/payload.ts +1 -1
- package/src/workspace/schematic/schematic.spec.ts +1 -1
- package/src/workspace/schematic/symbol/access.spec.ts +1 -1
- package/src/workspace/schematic/symbol/client.spec.ts +1 -1
- package/src/workspace/schematic/symbol/client.ts +1 -1
- package/src/workspace/schematic/symbol/external.ts +1 -1
- package/src/workspace/schematic/symbol/index.ts +1 -1
- package/src/workspace/schematic/symbol/payload.ts +1 -1
- package/src/workspace/table/access.spec.ts +1 -1
- package/src/workspace/table/client.ts +1 -1
- package/src/workspace/table/external.ts +1 -1
- package/src/workspace/table/index.ts +1 -1
- package/src/workspace/table/payload.ts +1 -1
- package/src/workspace/table/table.spec.ts +1 -1
- package/src/workspace/workspace.spec.ts +1 -1
- package/vite.config.ts +1 -1
package/src/access/role/index.ts
CHANGED
package/src/arc/access.spec.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.
|
|
@@ -31,7 +31,6 @@ describe("arc", () => {
|
|
|
31
31
|
edges: [],
|
|
32
32
|
},
|
|
33
33
|
text: { raw: "" },
|
|
34
|
-
deploy: false,
|
|
35
34
|
version: "1.0.0",
|
|
36
35
|
};
|
|
37
36
|
const randomArc = await client.arcs.create(a);
|
|
@@ -53,7 +52,6 @@ describe("arc", () => {
|
|
|
53
52
|
edges: [],
|
|
54
53
|
},
|
|
55
54
|
text: { raw: "" },
|
|
56
|
-
deploy: false,
|
|
57
55
|
version: "1.0.0",
|
|
58
56
|
});
|
|
59
57
|
const retrieved = await userClient.arcs.retrieve({ key: randomArc.key });
|
|
@@ -74,7 +72,6 @@ describe("arc", () => {
|
|
|
74
72
|
edges: [],
|
|
75
73
|
},
|
|
76
74
|
text: { raw: "" },
|
|
77
|
-
deploy: false,
|
|
78
75
|
version: "1.0.0",
|
|
79
76
|
});
|
|
80
77
|
});
|
|
@@ -93,7 +90,6 @@ describe("arc", () => {
|
|
|
93
90
|
edges: [],
|
|
94
91
|
},
|
|
95
92
|
text: { raw: "" },
|
|
96
|
-
deploy: false,
|
|
97
93
|
version: "1.0.0",
|
|
98
94
|
}),
|
|
99
95
|
).rejects.toThrow(AuthError);
|
|
@@ -112,7 +108,6 @@ describe("arc", () => {
|
|
|
112
108
|
edges: [],
|
|
113
109
|
},
|
|
114
110
|
text: { raw: "" },
|
|
115
|
-
deploy: false,
|
|
116
111
|
version: "1.0.0",
|
|
117
112
|
});
|
|
118
113
|
await userClient.arcs.delete(randomArc.key);
|
|
@@ -134,7 +129,6 @@ describe("arc", () => {
|
|
|
134
129
|
edges: [],
|
|
135
130
|
},
|
|
136
131
|
text: { raw: "" },
|
|
137
|
-
deploy: false,
|
|
138
132
|
version: "1.0.0",
|
|
139
133
|
});
|
|
140
134
|
await expect(userClient.arcs.delete(randomArc.key)).rejects.toThrow(AuthError);
|
package/src/arc/client.ts
CHANGED
package/src/arc/external.ts
CHANGED
package/src/arc/index.ts
CHANGED
package/src/arc/lsp.spec.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.
|
|
@@ -592,11 +592,8 @@ describe("Arc LSP", () => {
|
|
|
592
592
|
expect(diagnostics.length).toBeGreaterThan(0);
|
|
593
593
|
|
|
594
594
|
// Position should be mapped correctly (line 0 for original expression)
|
|
595
|
-
// Note: Parse errors may not be position-mapped correctly yet
|
|
596
|
-
// This is a known limitation - for now we just verify diagnostics exist
|
|
597
595
|
const firstDiag = diagnostics[0];
|
|
598
|
-
|
|
599
|
-
// expect(firstDiag.range.start.line).toBe(0);
|
|
596
|
+
expect(firstDiag.range.start.line).toBe(0);
|
|
600
597
|
}
|
|
601
598
|
|
|
602
599
|
stream.closeSend();
|
package/src/arc/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.
|
|
@@ -11,7 +11,6 @@ import { record, xy } from "@synnaxlabs/x";
|
|
|
11
11
|
import { z } from "zod/v4";
|
|
12
12
|
|
|
13
13
|
import { ontology } from "@/ontology";
|
|
14
|
-
import { statusZ as baseStatusZ } from "@/status/payload";
|
|
15
14
|
import { parseWithoutKeyConversion } from "@/util/parseWithoutKeyConversion";
|
|
16
15
|
|
|
17
16
|
export const irNodeZ = z.object({
|
|
@@ -48,27 +47,23 @@ export const keyZ = z.uuid();
|
|
|
48
47
|
export type Key = z.infer<typeof keyZ>;
|
|
49
48
|
export type Params = Key | Key[];
|
|
50
49
|
|
|
51
|
-
export const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
export const statusZ = baseStatusZ(statusDetailsZ);
|
|
56
|
-
|
|
57
|
-
export type Status = z.infer<typeof statusZ>;
|
|
50
|
+
export const modeZ = z
|
|
51
|
+
.enum(["graph", "text"])
|
|
52
|
+
.or(z.literal("").transform<"graph">(() => "graph"));
|
|
53
|
+
export type Mode = z.infer<typeof modeZ>;
|
|
58
54
|
|
|
59
55
|
export const arcZ = z.object({
|
|
60
56
|
key: keyZ,
|
|
61
57
|
name: z.string(),
|
|
62
58
|
graph: graphZ,
|
|
63
59
|
text: textZ,
|
|
64
|
-
deploy: z.boolean(),
|
|
65
60
|
version: z.string(),
|
|
66
|
-
|
|
61
|
+
mode: modeZ,
|
|
67
62
|
});
|
|
68
63
|
|
|
69
64
|
export interface Arc extends z.infer<typeof arcZ> {}
|
|
70
65
|
|
|
71
|
-
export const newZ = arcZ.partial({ key: true
|
|
66
|
+
export const newZ = arcZ.partial({ key: true, mode: true });
|
|
72
67
|
export interface New extends z.input<typeof newZ> {}
|
|
73
68
|
|
|
74
69
|
export const ONTOLOGY_TYPE = "arc";
|
package/src/auth/auth.spec.ts
CHANGED
package/src/auth/auth.ts
CHANGED
package/src/auth/index.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.
|
|
@@ -55,7 +55,6 @@ describe("channelchannel.Retriever", () => {
|
|
|
55
55
|
virtual: false,
|
|
56
56
|
expression: "",
|
|
57
57
|
operations: [],
|
|
58
|
-
requires: [],
|
|
59
58
|
}));
|
|
60
59
|
});
|
|
61
60
|
const retriever = new channel.DebouncedBatchRetriever(base, 10);
|
|
@@ -85,7 +84,6 @@ describe("channelchannel.Retriever", () => {
|
|
|
85
84
|
virtual: false,
|
|
86
85
|
expression: "",
|
|
87
86
|
operations: [],
|
|
88
|
-
requires: [],
|
|
89
87
|
}));
|
|
90
88
|
});
|
|
91
89
|
const retriever = new channel.DebouncedBatchRetriever(base, 10);
|
|
@@ -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.
|
|
@@ -11,7 +11,7 @@ import { DataType, id } from "@synnaxlabs/x";
|
|
|
11
11
|
import { describe, expect, it, test } from "vitest";
|
|
12
12
|
|
|
13
13
|
import { Channel } from "@/channel/client";
|
|
14
|
-
import { NotFoundError
|
|
14
|
+
import { NotFoundError } from "@/errors";
|
|
15
15
|
import { createTestClient } from "@/testutil/client";
|
|
16
16
|
|
|
17
17
|
const client = createTestClient();
|
|
@@ -51,24 +51,17 @@ describe("Channel", () => {
|
|
|
51
51
|
expect(calculatedCH.expression).toEqual(`return ${chOneName} * 2`);
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
test("create calculated
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
);
|
|
66
|
-
expect(PathError.matches(e)).toBe(true);
|
|
67
|
-
expect((e as PathError).path).toEqual(["requires"]);
|
|
68
|
-
expect((e as PathError).error.message).contain(
|
|
69
|
-
"calculated channels must require at least one channel",
|
|
70
|
-
);
|
|
71
|
-
}
|
|
54
|
+
test("create calculated channel with constant expression", async () => {
|
|
55
|
+
// Calculated channels can now have constant expressions that don't
|
|
56
|
+
// reference other channels
|
|
57
|
+
const calculatedCH = await client.channels.create({
|
|
58
|
+
name: id.create(),
|
|
59
|
+
virtual: true,
|
|
60
|
+
dataType: DataType.FLOAT32,
|
|
61
|
+
expression: `return 2`,
|
|
62
|
+
});
|
|
63
|
+
expect(calculatedCH.virtual).toEqual(true);
|
|
64
|
+
expect(calculatedCH.expression).toEqual(`return 2`);
|
|
72
65
|
});
|
|
73
66
|
|
|
74
67
|
test("create index and indexed pair", async () => {
|
package/src/channel/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.
|
|
@@ -111,12 +111,11 @@ export class Channel {
|
|
|
111
111
|
*/
|
|
112
112
|
readonly virtual: boolean;
|
|
113
113
|
/**
|
|
114
|
-
* Only used for calculated channels. Specifies the
|
|
114
|
+
* Only used for calculated channels. Specifies the Arc expression used to evaluate
|
|
115
115
|
* the calculated value
|
|
116
116
|
*/
|
|
117
117
|
readonly expression: string;
|
|
118
118
|
readonly operations: Operation[];
|
|
119
|
-
readonly requires: Key[];
|
|
120
119
|
/**
|
|
121
120
|
* The status of the channel.
|
|
122
121
|
*/
|
|
@@ -136,14 +135,12 @@ export class Channel {
|
|
|
136
135
|
status: argsStatus,
|
|
137
136
|
expression = "",
|
|
138
137
|
operations = [],
|
|
139
|
-
requires = [],
|
|
140
138
|
}: New & {
|
|
141
139
|
internal?: boolean;
|
|
142
140
|
frameClient?: framer.Client;
|
|
143
141
|
density?: CrudeDensity;
|
|
144
142
|
status?: status.Crude;
|
|
145
143
|
operations?: Operation[];
|
|
146
|
-
requires?: Key[];
|
|
147
144
|
}) {
|
|
148
145
|
this.key = keyZ.parse(key);
|
|
149
146
|
this.name = name;
|
|
@@ -156,7 +153,6 @@ export class Channel {
|
|
|
156
153
|
this.virtual = virtual;
|
|
157
154
|
this.expression = expression;
|
|
158
155
|
this.operations = operations;
|
|
159
|
-
this.requires = requires;
|
|
160
156
|
if (argsStatus != null) this.status = status.create(argsStatus);
|
|
161
157
|
this._frameClient = frameClient ?? null;
|
|
162
158
|
}
|
|
@@ -182,7 +178,6 @@ export class Channel {
|
|
|
182
178
|
isIndex: this.isIndex,
|
|
183
179
|
internal: this.internal,
|
|
184
180
|
virtual: this.virtual,
|
|
185
|
-
requires: this.requires,
|
|
186
181
|
expression: this.expression,
|
|
187
182
|
status: this.status,
|
|
188
183
|
operations: this.operations,
|
|
@@ -222,16 +217,14 @@ export class Channel {
|
|
|
222
217
|
}
|
|
223
218
|
}
|
|
224
219
|
|
|
225
|
-
export const CALCULATION_STATUS_CHANNEL_NAME = "sy_calculation_status";
|
|
226
|
-
|
|
227
220
|
const retrieveGroupReqZ = z.object({});
|
|
228
221
|
|
|
229
222
|
const retrieveGroupResZ = z.object({ group: group.groupZ });
|
|
230
223
|
|
|
231
224
|
/**
|
|
232
|
-
* The
|
|
233
|
-
*
|
|
234
|
-
*
|
|
225
|
+
* The main client class for executing channel operations against a Synnax Core. This
|
|
226
|
+
* class should not be instantiated directly, and instead should be used through the
|
|
227
|
+
* `channels` property of an {@link Synnax} client.
|
|
235
228
|
*/
|
|
236
229
|
export class Client {
|
|
237
230
|
private readonly frameClient: framer.Client;
|
|
@@ -437,27 +430,3 @@ export class Client {
|
|
|
437
430
|
|
|
438
431
|
export const isCalculated = ({ virtual, expression }: Payload): boolean =>
|
|
439
432
|
virtual && expression !== "";
|
|
440
|
-
|
|
441
|
-
export const isLegacyCalculated = (pld: Payload): boolean =>
|
|
442
|
-
isCalculated(pld) && pld.requires.length > 0;
|
|
443
|
-
|
|
444
|
-
export const resolveLegacyCalculatedIndex = async (
|
|
445
|
-
retrieve: (key: Key) => Promise<Payload | null>,
|
|
446
|
-
channel: Payload,
|
|
447
|
-
): Promise<Key | null> => {
|
|
448
|
-
if (!isCalculated(channel)) return channel.index;
|
|
449
|
-
for (const required of channel.requires) {
|
|
450
|
-
const requiredChannel = await retrieve(required);
|
|
451
|
-
if (requiredChannel == null) return null;
|
|
452
|
-
if (!requiredChannel.virtual) return requiredChannel.index;
|
|
453
|
-
}
|
|
454
|
-
for (const required of channel.requires) {
|
|
455
|
-
const requiredChannel = await retrieve(required);
|
|
456
|
-
if (requiredChannel == null) return null;
|
|
457
|
-
if (isCalculated(requiredChannel)) {
|
|
458
|
-
const index = await resolveLegacyCalculatedIndex(retrieve, requiredChannel);
|
|
459
|
-
if (index != null) return index;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
return null;
|
|
463
|
-
};
|
package/src/channel/external.ts
CHANGED
package/src/channel/index.ts
CHANGED
package/src/channel/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.
|
|
@@ -58,6 +58,13 @@ export type Operation = z.infer<typeof operationZ>;
|
|
|
58
58
|
|
|
59
59
|
export const statusZ = status.statusZ();
|
|
60
60
|
export type Status = z.infer<typeof statusZ>;
|
|
61
|
+
|
|
62
|
+
export const calculationStatusDetailsZ = z.object({ channel: keyZ });
|
|
63
|
+
export type CalculationStatusDetails = z.infer<typeof calculationStatusDetailsZ>;
|
|
64
|
+
export const calculationStatusZ = status.statusZ(calculationStatusDetailsZ);
|
|
65
|
+
export type CalculationStatus = z.infer<typeof calculationStatusZ>;
|
|
66
|
+
|
|
67
|
+
export const statusKey = (key: Key): string => ontology.idToString(ontologyID(key));
|
|
61
68
|
export const payloadZ = z.object({
|
|
62
69
|
name: z.string(),
|
|
63
70
|
key: keyZ,
|
|
@@ -71,7 +78,6 @@ export const payloadZ = z.object({
|
|
|
71
78
|
expression: z.string().default(""),
|
|
72
79
|
status: statusZ.optional(),
|
|
73
80
|
operations: array.nullableZ(operationZ),
|
|
74
|
-
requires: array.nullableZ(keyZ),
|
|
75
81
|
});
|
|
76
82
|
export interface Payload extends z.infer<typeof payloadZ> {}
|
|
77
83
|
|
|
@@ -85,11 +91,12 @@ export const newZ = payloadZ.extend({
|
|
|
85
91
|
virtual: z.boolean().default(false),
|
|
86
92
|
expression: z.string().default(""),
|
|
87
93
|
operations: array.nullableZ(operationZ).optional(),
|
|
88
|
-
requires: array.nullableZ(keyZ).optional(),
|
|
89
94
|
});
|
|
90
95
|
|
|
91
|
-
export interface New
|
|
92
|
-
|
|
96
|
+
export interface New extends Omit<
|
|
97
|
+
z.input<typeof newZ>,
|
|
98
|
+
"dataType" | "status" | "internal"
|
|
99
|
+
> {
|
|
93
100
|
dataType: CrudeDataType;
|
|
94
101
|
}
|
|
95
102
|
|
package/src/channel/retriever.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.
|
|
@@ -48,8 +48,10 @@ const reqZ = z.object({
|
|
|
48
48
|
});
|
|
49
49
|
export interface RetrieveRequest extends z.input<typeof reqZ> {}
|
|
50
50
|
|
|
51
|
-
export interface RetrieveOptions
|
|
52
|
-
|
|
51
|
+
export interface RetrieveOptions extends Omit<
|
|
52
|
+
RetrieveRequest,
|
|
53
|
+
"keys" | "names" | "search"
|
|
54
|
+
> {}
|
|
53
55
|
export interface PageOptions extends Omit<RetrieveOptions, "offset" | "limit"> {}
|
|
54
56
|
|
|
55
57
|
const resZ = z.object({ channels: array.nullableZ(payloadZ) });
|
package/src/channel/writer.ts
CHANGED
package/src/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.
|
|
@@ -27,6 +27,7 @@ import { status } from "@/status";
|
|
|
27
27
|
import { task } from "@/task";
|
|
28
28
|
import { Transport } from "@/transport";
|
|
29
29
|
import { user } from "@/user";
|
|
30
|
+
import { view } from "@/view";
|
|
30
31
|
import { workspace } from "@/workspace";
|
|
31
32
|
|
|
32
33
|
export const synnaxParamsZ = z.object({
|
|
@@ -71,6 +72,7 @@ export default class Synnax extends framer.Client {
|
|
|
71
72
|
readonly devices: device.Client;
|
|
72
73
|
readonly control: control.Client;
|
|
73
74
|
readonly arcs: arc.Client;
|
|
75
|
+
readonly views: view.Client;
|
|
74
76
|
static readonly connectivity = connection.Checker;
|
|
75
77
|
private readonly transport: Transport;
|
|
76
78
|
|
|
@@ -153,6 +155,7 @@ export default class Synnax extends framer.Client {
|
|
|
153
155
|
this.racks = new rack.Client(this.transport.unary, this.tasks);
|
|
154
156
|
this.devices = new device.Client(this.transport.unary);
|
|
155
157
|
this.arcs = new arc.Client(this.transport.unary, this.transport.stream);
|
|
158
|
+
this.views = new view.Client(this.transport.unary);
|
|
156
159
|
}
|
|
157
160
|
|
|
158
161
|
get key(): string {
|
|
@@ -164,8 +167,10 @@ export default class Synnax extends framer.Client {
|
|
|
164
167
|
}
|
|
165
168
|
}
|
|
166
169
|
|
|
167
|
-
export interface CheckConnectionParams
|
|
168
|
-
|
|
170
|
+
export interface CheckConnectionParams extends Pick<
|
|
171
|
+
SynnaxParams,
|
|
172
|
+
"host" | "port" | "secure" | "retry" | "name"
|
|
173
|
+
> {}
|
|
169
174
|
|
|
170
175
|
export const checkConnection = async (params: CheckConnectionParams) =>
|
|
171
176
|
await newConnectionChecker(params).check();
|
|
@@ -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.
|
|
@@ -48,7 +48,7 @@ const createWarning = (
|
|
|
48
48
|
const toUpgrade = clientIsNewer ? "Core" : "client";
|
|
49
49
|
return `Synnax Core version ${nodeVersion != null ? `${nodeVersion} ` : ""}is too ${clientIsNewer ? "old" : "new"} for client version ${clientVersion}.
|
|
50
50
|
This may cause compatibility issues. We recommend updating the ${toUpgrade}. For more information, see
|
|
51
|
-
https://docs.synnaxlabs.com/reference/
|
|
51
|
+
https://docs.synnaxlabs.com/reference/client/resources/troubleshooting#old-${toUpgrade}-version`;
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
/** Polls a synnax cluster for connectivity information. */
|
package/src/connection/index.ts
CHANGED
package/src/connection.spec.ts
CHANGED
package/src/control/client.ts
CHANGED
package/src/control/external.ts
CHANGED
package/src/control/index.ts
CHANGED
package/src/control/state.ts
CHANGED
package/src/device/client.ts
CHANGED
package/src/device/external.ts
CHANGED
package/src/device/index.ts
CHANGED
package/src/device/payload.ts
CHANGED
package/src/errors.spec.ts
CHANGED
package/src/errors.ts
CHANGED
package/src/framer/adapter.ts
CHANGED