@synnaxlabs/client 0.37.0 → 0.38.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 +7 -7
- package/dist/access/policy/payload.d.ts +10 -10
- package/dist/channel/client.d.ts +13 -1
- package/dist/channel/client.d.ts.map +1 -1
- package/dist/channel/payload.d.ts +14 -0
- package/dist/channel/payload.d.ts.map +1 -1
- package/dist/client.cjs +30 -30
- package/dist/client.js +2302 -2210
- package/dist/framer/frame.d.ts.map +1 -1
- package/dist/hardware/device/payload.d.ts +2 -2
- package/dist/hardware/device/payload.d.ts.map +1 -1
- package/dist/hardware/task/client.d.ts.map +1 -1
- package/dist/hardware/task/payload.d.ts +4 -4
- package/dist/hardware/task/payload.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/label/client.d.ts.map +1 -1
- package/dist/ontology/client.d.ts.map +1 -1
- package/dist/ontology/group/group.d.ts.map +1 -1
- package/dist/ontology/payload.d.ts.map +1 -1
- package/dist/ranger/client.d.ts.map +1 -1
- package/dist/ranger/payload.d.ts +2 -2
- package/dist/ranger/payload.d.ts.map +1 -1
- package/dist/util/retrieve.d.ts.map +1 -1
- package/dist/util/zod.d.ts +1 -1
- package/dist/util/zod.d.ts.map +1 -1
- package/dist/workspace/client.d.ts.map +1 -1
- package/dist/workspace/lineplot/client.d.ts.map +1 -1
- package/dist/workspace/log/client.d.ts.map +1 -1
- package/dist/workspace/schematic/client.d.ts.map +1 -1
- package/dist/workspace/table/client.d.ts.map +1 -1
- package/eslint.config.js +1 -1
- package/examples/node/basicReadWrite.js +1 -1
- package/examples/node/liveStream.js +1 -1
- package/examples/node/package-lock.json +56 -5509
- package/examples/node/package.json +1 -1
- package/examples/node/seriesAndFrames.js +1 -1
- package/examples/node/streamWrite.js +1 -1
- package/package.json +11 -15
- package/src/access/client.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/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/policy/policy.spec.ts +2 -5
- package/src/access/policy/retriever.ts +1 -1
- package/src/access/policy/writer.ts +1 -1
- 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/batchRetriever.spec.ts +5 -1
- package/src/channel/channel.spec.ts +109 -38
- package/src/channel/client.ts +48 -3
- package/src/channel/creator.ts +1 -1
- package/src/channel/external.ts +1 -1
- package/src/channel/index.ts +1 -1
- package/src/channel/payload.ts +6 -1
- package/src/channel/retriever.ts +1 -1
- package/src/channel/writer.ts +1 -1
- package/src/client.ts +1 -1
- package/src/connection/checker.ts +1 -1
- package/src/connection/connection.spec.ts +1 -1
- package/src/connection/index.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/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/deleter.spec.ts +1 -1
- package/src/framer/deleter.ts +1 -1
- package/src/framer/external.ts +1 -1
- package/src/framer/frame.spec.ts +1 -1
- package/src/framer/frame.ts +4 -5
- package/src/framer/index.ts +1 -1
- package/src/framer/iterator.spec.ts +1 -1
- package/src/framer/iterator.ts +1 -1
- package/src/framer/streamProxy.ts +2 -2
- package/src/framer/streamer.spec.ts +179 -1
- package/src/framer/streamer.ts +1 -1
- package/src/framer/writer.spec.ts +1 -1
- package/src/framer/writer.ts +1 -1
- package/src/hardware/client.ts +1 -1
- package/src/hardware/device/client.ts +1 -1
- package/src/hardware/device/device.spec.ts +1 -1
- package/src/hardware/device/external.ts +1 -1
- package/src/hardware/device/index.ts +1 -1
- package/src/hardware/device/payload.ts +1 -1
- package/src/hardware/external.ts +1 -1
- package/src/hardware/index.ts +1 -1
- package/src/hardware/rack/client.ts +1 -1
- package/src/hardware/rack/external.ts +1 -1
- package/src/hardware/rack/index.ts +1 -1
- package/src/hardware/rack/payload.ts +1 -1
- package/src/hardware/rack/rack.spec.ts +1 -1
- package/src/hardware/task/client.ts +4 -3
- package/src/hardware/task/external.ts +1 -1
- package/src/hardware/task/index.ts +1 -1
- package/src/hardware/task/payload.ts +1 -1
- package/src/hardware/task/task.spec.ts +1 -1
- package/src/index.ts +2 -2
- package/src/label/client.ts +3 -3
- 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/label/retriever.ts +1 -1
- package/src/label/writer.ts +1 -1
- package/src/ontology/client.ts +14 -7
- package/src/ontology/external.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/group.ts +4 -6
- package/src/ontology/group/index.ts +1 -1
- package/src/ontology/group/payload.ts +1 -1
- package/src/ontology/group/writer.ts +1 -1
- package/src/ontology/index.ts +1 -1
- package/src/ontology/ontology.spec.ts +1 -1
- package/src/ontology/payload.ts +2 -2
- package/src/ontology/writer.ts +1 -1
- package/src/ranger/alias.ts +1 -1
- package/src/ranger/client.ts +11 -14
- 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 +3 -3
- package/src/ranger/ranger.spec.ts +1 -1
- package/src/ranger/writer.ts +1 -1
- package/src/setupspecs.ts +1 -1
- package/src/signals/external.ts +1 -1
- package/src/signals/index.ts +1 -1
- package/src/signals/observable.ts +1 -1
- package/src/transport.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/retriever.ts +1 -1
- package/src/user/user.spec.ts +1 -1
- package/src/user/writer.ts +1 -1
- package/src/util/retrieve.spec.ts +1 -1
- package/src/util/retrieve.ts +3 -3
- package/src/util/telem.ts +1 -1
- package/src/util/zod.ts +5 -2
- package/src/vite-env.d.ts +1 -1
- package/src/workspace/client.ts +11 -2
- package/src/workspace/index.ts +1 -1
- package/src/workspace/lineplot/client.ts +9 -0
- package/src/workspace/lineplot/index.ts +1 -1
- package/src/workspace/lineplot/linePlot.spec.ts +1 -1
- package/src/workspace/log/client.ts +9 -0
- package/src/workspace/log/index.ts +1 -1
- package/src/workspace/log/log.spec.ts +1 -1
- package/src/workspace/schematic/client.ts +9 -0
- package/src/workspace/schematic/index.ts +1 -1
- package/src/workspace/schematic/schematic.spec.ts +1 -1
- package/src/workspace/table/client.ts +9 -0
- package/src/workspace/table/index.ts +1 -1
- package/src/workspace/table/table.spec.ts +1 -1
- package/src/workspace/workspace.spec.ts +1 -1
- package/vite.config.ts +6 -13
- package/api/client.api.md +0 -3473
- package/api-extractor.json +0 -7
- package/dist/hardware/task/ni/types.d.ts +0 -14495
- package/dist/hardware/task/ni/types.d.ts.map +0 -1
- package/dist/workspace/lineplot/payload.d.ts +0 -23
- package/dist/workspace/lineplot/payload.d.ts.map +0 -1
- package/src/hardware/task/ni/types.ts +0 -1716
- package/src/workspace/lineplot/payload.ts +0 -30
package/src/framer/adapter.ts
CHANGED
package/src/framer/client.ts
CHANGED
package/src/framer/deleter.ts
CHANGED
package/src/framer/external.ts
CHANGED
package/src/framer/frame.spec.ts
CHANGED
package/src/framer/frame.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2025 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -7,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
|
+
import { toArray, unique } from "@synnaxlabs/x";
|
|
10
11
|
import {
|
|
11
12
|
MultiSeries,
|
|
12
13
|
Series,
|
|
@@ -17,8 +18,6 @@ import {
|
|
|
17
18
|
TimeRange,
|
|
18
19
|
TimeStamp,
|
|
19
20
|
} from "@synnaxlabs/x/telem";
|
|
20
|
-
import { toArray } from "@synnaxlabs/x/toArray";
|
|
21
|
-
import { unique } from "@synnaxlabs/x/unique";
|
|
22
21
|
import { z } from "zod";
|
|
23
22
|
|
|
24
23
|
import {
|
|
@@ -177,7 +176,7 @@ export class Frame {
|
|
|
177
176
|
* error otherwise.
|
|
178
177
|
*/
|
|
179
178
|
get uniqueKeys(): Keys {
|
|
180
|
-
return unique(this.keys);
|
|
179
|
+
return unique.unique(this.keys);
|
|
181
180
|
}
|
|
182
181
|
|
|
183
182
|
/**
|
|
@@ -194,7 +193,7 @@ export class Frame {
|
|
|
194
193
|
* otherwise.
|
|
195
194
|
*/
|
|
196
195
|
get uniqueNames(): Names {
|
|
197
|
-
return unique(this.names);
|
|
196
|
+
return unique.unique(this.names);
|
|
198
197
|
}
|
|
199
198
|
|
|
200
199
|
/**
|
package/src/framer/index.ts
CHANGED
package/src/framer/iterator.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2025 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.
|
|
@@ -35,7 +35,7 @@ export class StreamProxy<RQ extends z.ZodTypeAny, RS extends z.ZodTypeAny> {
|
|
|
35
35
|
const [res, err] = await this.stream.receive();
|
|
36
36
|
if (res != null)
|
|
37
37
|
console.warn(
|
|
38
|
-
`${this.name} received unexpected response on closure.
|
|
38
|
+
`${this.name} received unexpected response on closure.
|
|
39
39
|
Please report this error to the Synnax team. ${JSON.stringify(res)}`,
|
|
40
40
|
);
|
|
41
41
|
if (err != null) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2025 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.
|
|
@@ -108,3 +108,181 @@ describe("Streamer", () => {
|
|
|
108
108
|
expect(Array.from(d.get(ch.key))).toEqual([1]);
|
|
109
109
|
});
|
|
110
110
|
});
|
|
111
|
+
|
|
112
|
+
describe("Streamer - Calculated Channels", () => {
|
|
113
|
+
test("basic calculated channel streaming", async () => {
|
|
114
|
+
// Create a timestamp index channel
|
|
115
|
+
const timeChannel = await client.channels.create({
|
|
116
|
+
name: "calc_test_time",
|
|
117
|
+
isIndex: true,
|
|
118
|
+
dataType: DataType.TIMESTAMP,
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// Create source channels with the timestamp index
|
|
122
|
+
const [channelA, channelB] = await client.channels.create([
|
|
123
|
+
{
|
|
124
|
+
name: "test_a",
|
|
125
|
+
dataType: DataType.FLOAT64,
|
|
126
|
+
index: timeChannel.key,
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: "test_b",
|
|
130
|
+
dataType: DataType.FLOAT64,
|
|
131
|
+
index: timeChannel.key,
|
|
132
|
+
},
|
|
133
|
+
]);
|
|
134
|
+
|
|
135
|
+
// Create calculated channel that adds the two source channels
|
|
136
|
+
const calcChannel = await client.channels.create({
|
|
137
|
+
name: "test_calc",
|
|
138
|
+
dataType: DataType.FLOAT64,
|
|
139
|
+
index: timeChannel.key,
|
|
140
|
+
virtual: true,
|
|
141
|
+
expression: "return test_a + test_b",
|
|
142
|
+
requires: [channelA.key, channelB.key],
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// Set up streamer to listen for calculated results
|
|
146
|
+
const streamer = await client.openStreamer(calcChannel.key);
|
|
147
|
+
|
|
148
|
+
// Give streamer time to initialize
|
|
149
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
150
|
+
|
|
151
|
+
// Write test data
|
|
152
|
+
const startTime = TimeStamp.now();
|
|
153
|
+
const writer = await client.openWriter({
|
|
154
|
+
start: startTime,
|
|
155
|
+
channels: [timeChannel.key, channelA.key, channelB.key],
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
try {
|
|
159
|
+
// Write test values - each source gets 2.5 so sum should be 5.0
|
|
160
|
+
await writer.write({
|
|
161
|
+
[timeChannel.key]: [startTime],
|
|
162
|
+
[channelA.key]: new Float64Array([2.5]),
|
|
163
|
+
[channelB.key]: new Float64Array([2.5]),
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// Read from streamer
|
|
167
|
+
const frame = await streamer.read();
|
|
168
|
+
|
|
169
|
+
// Verify calculated results
|
|
170
|
+
const calcData = Array.from(frame.get(calcChannel.key));
|
|
171
|
+
expect(calcData).toEqual([5.0]);
|
|
172
|
+
} finally {
|
|
173
|
+
await writer.close();
|
|
174
|
+
streamer.close();
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
test("calculated channel with constant", async () => {
|
|
178
|
+
// Create an index channel for timestamps
|
|
179
|
+
const timeChannel = await client.channels.create({
|
|
180
|
+
name: "calc_const_time",
|
|
181
|
+
isIndex: true,
|
|
182
|
+
dataType: DataType.TIMESTAMP,
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
// Create base channel with index
|
|
186
|
+
const baseChannel = await client.channels.create({
|
|
187
|
+
name: "base_channel",
|
|
188
|
+
dataType: DataType.FLOAT64,
|
|
189
|
+
index: timeChannel.key,
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
// Create calculated channel that adds 5
|
|
193
|
+
const calcChannel = await client.channels.create({
|
|
194
|
+
name: "calc_const_channel",
|
|
195
|
+
dataType: DataType.FLOAT64,
|
|
196
|
+
index: timeChannel.key,
|
|
197
|
+
virtual: true,
|
|
198
|
+
expression: `return ${baseChannel.name} + 5`,
|
|
199
|
+
requires: [baseChannel.key],
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
const streamer = await client.openStreamer(calcChannel.key);
|
|
203
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
204
|
+
|
|
205
|
+
const startTime = TimeStamp.now();
|
|
206
|
+
const writer = await client.openWriter({
|
|
207
|
+
start: startTime,
|
|
208
|
+
channels: [timeChannel.key, baseChannel.key],
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
try {
|
|
212
|
+
const timestamps = [
|
|
213
|
+
startTime,
|
|
214
|
+
new TimeStamp(startTime.valueOf() + BigInt(1000000000)),
|
|
215
|
+
new TimeStamp(startTime.valueOf() + BigInt(2000000000)),
|
|
216
|
+
];
|
|
217
|
+
|
|
218
|
+
await writer.write({
|
|
219
|
+
[timeChannel.key]: timestamps,
|
|
220
|
+
[baseChannel.key]: new Float64Array([1, 2, 3]),
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
const frame = await streamer.read();
|
|
224
|
+
const calcData = Array.from(frame.get(calcChannel.key));
|
|
225
|
+
expect(calcData).toEqual([6, 7, 8]); // Original values + 5
|
|
226
|
+
} finally {
|
|
227
|
+
await writer.close();
|
|
228
|
+
streamer.close();
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
test("calculated channel with multiple operations", async () => {
|
|
233
|
+
// Create timestamp channel
|
|
234
|
+
const timeChannel = await client.channels.create({
|
|
235
|
+
name: "calc_multi_time",
|
|
236
|
+
isIndex: true,
|
|
237
|
+
dataType: DataType.TIMESTAMP,
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
// Create source channels
|
|
241
|
+
const [channelA, channelB] = await client.channels.create([
|
|
242
|
+
{
|
|
243
|
+
name: "multi_test_a",
|
|
244
|
+
dataType: DataType.FLOAT64,
|
|
245
|
+
index: timeChannel.key,
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
name: "multi_test_b",
|
|
249
|
+
dataType: DataType.FLOAT64,
|
|
250
|
+
index: timeChannel.key,
|
|
251
|
+
},
|
|
252
|
+
]);
|
|
253
|
+
|
|
254
|
+
// Create calculated channel with multiple operations
|
|
255
|
+
const calcChannel = await client.channels.create({
|
|
256
|
+
name: "multi_calc",
|
|
257
|
+
dataType: DataType.FLOAT64,
|
|
258
|
+
index: timeChannel.key,
|
|
259
|
+
virtual: true,
|
|
260
|
+
expression: "return (multi_test_a * 2) + (multi_test_b / 2)",
|
|
261
|
+
requires: [channelA.key, channelB.key],
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
const streamer = await client.openStreamer(calcChannel.key);
|
|
265
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
266
|
+
|
|
267
|
+
const startTime = TimeStamp.now();
|
|
268
|
+
const writer = await client.openWriter({
|
|
269
|
+
start: startTime,
|
|
270
|
+
channels: [timeChannel.key, channelA.key, channelB.key],
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
try {
|
|
274
|
+
await writer.write({
|
|
275
|
+
[timeChannel.key]: [startTime],
|
|
276
|
+
[channelA.key]: new Float64Array([2.0]), // Will be multiplied by 2 = 4.0
|
|
277
|
+
[channelB.key]: new Float64Array([4.0]), // Will be divided by 2 = 2.0
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
const frame = await streamer.read();
|
|
281
|
+
const calcData = Array.from(frame.get(calcChannel.key));
|
|
282
|
+
expect(calcData).toEqual([6.0]); // (2.0 * 2) + (4.0 / 2) = 4.0 + 2.0 = 6.0
|
|
283
|
+
} finally {
|
|
284
|
+
await writer.close();
|
|
285
|
+
streamer.close();
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
});
|
package/src/framer/streamer.ts
CHANGED
package/src/framer/writer.ts
CHANGED
package/src/hardware/client.ts
CHANGED
package/src/hardware/external.ts
CHANGED
package/src/hardware/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2025 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.
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
commandZ,
|
|
25
25
|
type NewTask,
|
|
26
26
|
newTaskZ,
|
|
27
|
+
ontologyID as payloadOntologyID,
|
|
27
28
|
type Payload,
|
|
28
29
|
type State,
|
|
29
30
|
type StateObservable,
|
|
@@ -32,7 +33,7 @@ import {
|
|
|
32
33
|
taskKeyZ,
|
|
33
34
|
taskZ,
|
|
34
35
|
} from "@/hardware/task/payload";
|
|
35
|
-
import { ontology } from "@/ontology";
|
|
36
|
+
import { type ontology } from "@/ontology";
|
|
36
37
|
import { type ranger } from "@/ranger";
|
|
37
38
|
import { signals } from "@/signals";
|
|
38
39
|
import { analyzeParams, checkForMultipleOrNoResults } from "@/util/retrieve";
|
|
@@ -95,7 +96,7 @@ export class Task<
|
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
get ontologyID(): ontology.ID {
|
|
98
|
-
return
|
|
99
|
+
return payloadOntologyID(this.key);
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
async executeCommand(type: string, args?: UnknownRecord): Promise<string> {
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2025 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.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
export { access } from "@/access";
|
|
11
11
|
export { policy } from "@/access/policy";
|
|
12
12
|
export { channel } from "@/channel";
|
|
13
|
-
export { Channel } from "@/channel/client";
|
|
13
|
+
export { Channel, isCalculated } from "@/channel/client";
|
|
14
14
|
export { default as Synnax, type SynnaxProps, synnaxPropsZ } from "@/client";
|
|
15
15
|
export * from "@/connection";
|
|
16
16
|
export { control } from "@/control";
|
package/src/label/client.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2025 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -12,7 +12,7 @@ import { observe } from "@synnaxlabs/x";
|
|
|
12
12
|
import { type AsyncTermSearcher } from "@synnaxlabs/x/search";
|
|
13
13
|
|
|
14
14
|
import { type framer } from "@/framer";
|
|
15
|
-
import { type Key, type Label, labelZ } from "@/label/payload";
|
|
15
|
+
import { type Key, type Label, labelZ, ontologyID } from "@/label/payload";
|
|
16
16
|
import { Retriever } from "@/label/retriever";
|
|
17
17
|
import { type NewLabelPayload, type SetOptions, Writer } from "@/label/writer";
|
|
18
18
|
import { ontology } from "@/ontology";
|
|
@@ -105,7 +105,7 @@ export class Client implements AsyncTermSearcher<string, Key, Label> {
|
|
|
105
105
|
): Promise<observe.ObservableAsyncCloseable<Label[]>> {
|
|
106
106
|
const wrapper = new observe.Observer<Label[]>();
|
|
107
107
|
const initial = (await this.retrieveFor(id)).map((l) => ({
|
|
108
|
-
id:
|
|
108
|
+
id: ontologyID(l.key),
|
|
109
109
|
key: l.key,
|
|
110
110
|
name: l.name,
|
|
111
111
|
data: l,
|
package/src/label/external.ts
CHANGED
package/src/label/index.ts
CHANGED
package/src/label/label.spec.ts
CHANGED
package/src/label/payload.ts
CHANGED
package/src/label/retriever.ts
CHANGED
package/src/label/writer.ts
CHANGED
package/src/ontology/client.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2025 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.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
10
|
import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
|
-
import { observe, toArray } from "@synnaxlabs/x";
|
|
11
|
+
import { observe, strings, toArray } from "@synnaxlabs/x";
|
|
12
12
|
import { type AsyncTermSearcher } from "@synnaxlabs/x/search";
|
|
13
13
|
import { z } from "zod";
|
|
14
14
|
|
|
@@ -123,7 +123,11 @@ export class Client implements AsyncTermSearcher<string, string, Resource> {
|
|
|
123
123
|
const resources = await this.execRetrieve({ ids: parseIDs(ids), ...options });
|
|
124
124
|
if (Array.isArray(ids)) return resources;
|
|
125
125
|
if (resources.length === 0)
|
|
126
|
-
throw new QueryError(
|
|
126
|
+
throw new QueryError(
|
|
127
|
+
`No resource found with ID ${strings.naturalLanguageJoin(
|
|
128
|
+
toArray(ids).map((id) => new ID(id).toString()),
|
|
129
|
+
)}`,
|
|
130
|
+
);
|
|
127
131
|
return resources[0];
|
|
128
132
|
}
|
|
129
133
|
|
|
@@ -458,10 +462,13 @@ export class DependentTracker
|
|
|
458
462
|
c.key[oppositeDirection(this.relDir)].type === this.resourceType),
|
|
459
463
|
);
|
|
460
464
|
if (sets.length === 0) return this.notify(this.dependents);
|
|
461
|
-
this.client
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
+
this.client
|
|
466
|
+
.retrieve(sets.map((s) => s.key.to))
|
|
467
|
+
.then((resources) => {
|
|
468
|
+
this.dependents = this.dependents.concat(resources);
|
|
469
|
+
this.notify(this.dependents);
|
|
470
|
+
})
|
|
471
|
+
.catch(console.error);
|
|
465
472
|
};
|
|
466
473
|
|
|
467
474
|
async close(): Promise<void> {
|
package/src/ontology/external.ts
CHANGED