@synnaxlabs/client 0.38.0 → 0.39.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 +7 -7
- package/dist/access/payload.d.ts +6 -6
- package/dist/access/payload.d.ts.map +1 -1
- package/dist/access/policy/client.d.ts +5 -3
- package/dist/access/policy/client.d.ts.map +1 -1
- package/dist/access/policy/external.d.ts +1 -0
- package/dist/access/policy/external.d.ts.map +1 -1
- package/dist/access/policy/ontology.d.ts +5 -0
- package/dist/access/policy/ontology.d.ts.map +1 -0
- package/dist/access/policy/payload.d.ts +86 -89
- package/dist/access/policy/payload.d.ts.map +1 -1
- package/dist/access/policy/retriever.d.ts +7 -6
- package/dist/access/policy/retriever.d.ts.map +1 -1
- package/dist/access/policy/writer.d.ts +2 -2
- package/dist/access/policy/writer.d.ts.map +1 -1
- package/dist/auth/auth.d.ts +2 -1
- package/dist/auth/auth.d.ts.map +1 -1
- package/dist/channel/client.d.ts +8 -7
- package/dist/channel/client.d.ts.map +1 -1
- package/dist/channel/payload.d.ts +13 -11
- package/dist/channel/payload.d.ts.map +1 -1
- package/dist/channel/retriever.d.ts +9 -6
- package/dist/channel/retriever.d.ts.map +1 -1
- package/dist/channel/writer.d.ts +6 -4
- package/dist/channel/writer.d.ts.map +1 -1
- package/dist/client.cjs +30 -30
- package/dist/client.d.ts +4 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +3488 -3500
- package/dist/connection/checker.d.ts +5 -4
- package/dist/connection/checker.d.ts.map +1 -1
- package/dist/control/state.d.ts +10 -8
- package/dist/control/state.d.ts.map +1 -1
- package/dist/errors.d.ts +5 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/framer/adapter.d.ts +14 -15
- package/dist/framer/adapter.d.ts.map +1 -1
- package/dist/framer/client.d.ts +13 -15
- package/dist/framer/client.d.ts.map +1 -1
- package/dist/framer/deleter.d.ts +3 -2
- package/dist/framer/deleter.d.ts.map +1 -1
- package/dist/framer/frame.d.ts +31 -27
- package/dist/framer/frame.d.ts.map +1 -1
- package/dist/framer/iterator.d.ts +4 -5
- package/dist/framer/iterator.d.ts.map +1 -1
- package/dist/framer/streamer.d.ts +5 -6
- package/dist/framer/streamer.d.ts.map +1 -1
- package/dist/framer/writer.d.ts +42 -39
- package/dist/framer/writer.d.ts.map +1 -1
- package/dist/hardware/device/client.d.ts +17 -12
- package/dist/hardware/device/client.d.ts.map +1 -1
- package/dist/hardware/device/payload.d.ts +19 -16
- package/dist/hardware/device/payload.d.ts.map +1 -1
- package/dist/hardware/rack/client.d.ts +15 -15
- package/dist/hardware/rack/client.d.ts.map +1 -1
- package/dist/hardware/rack/payload.d.ts +9 -8
- package/dist/hardware/rack/payload.d.ts.map +1 -1
- package/dist/hardware/task/client.d.ts +38 -29
- package/dist/hardware/task/client.d.ts.map +1 -1
- package/dist/hardware/task/payload.d.ts +58 -53
- package/dist/hardware/task/payload.d.ts.map +1 -1
- package/dist/label/client.d.ts +4 -3
- package/dist/label/client.d.ts.map +1 -1
- package/dist/label/payload.d.ts +4 -4
- package/dist/label/payload.d.ts.map +1 -1
- package/dist/label/retriever.d.ts.map +1 -1
- package/dist/label/writer.d.ts +13 -10
- package/dist/label/writer.d.ts.map +1 -1
- package/dist/ontology/client.d.ts +12 -10
- package/dist/ontology/client.d.ts.map +1 -1
- package/dist/ontology/group/client.d.ts +5 -4
- package/dist/ontology/group/client.d.ts.map +1 -1
- package/dist/ontology/group/group.d.ts +7 -5
- package/dist/ontology/group/group.d.ts.map +1 -1
- package/dist/ontology/group/payload.d.ts +6 -5
- package/dist/ontology/group/payload.d.ts.map +1 -1
- package/dist/ontology/group/writer.d.ts +8 -8
- package/dist/ontology/group/writer.d.ts.map +1 -1
- package/dist/ontology/payload.d.ts +72 -62
- package/dist/ontology/payload.d.ts.map +1 -1
- package/dist/ontology/writer.d.ts.map +1 -1
- package/dist/ranger/alias.d.ts +9 -10
- package/dist/ranger/alias.d.ts.map +1 -1
- package/dist/ranger/client.d.ts +18 -18
- package/dist/ranger/client.d.ts.map +1 -1
- package/dist/ranger/external.d.ts +1 -1
- package/dist/ranger/external.d.ts.map +1 -1
- package/dist/ranger/kv.d.ts +18 -14
- package/dist/ranger/kv.d.ts.map +1 -1
- package/dist/ranger/payload.d.ts +13 -13
- package/dist/ranger/payload.d.ts.map +1 -1
- package/dist/ranger/writer.d.ts +14 -14
- package/dist/ranger/writer.d.ts.map +1 -1
- package/dist/setupspecs.d.ts.map +1 -1
- package/dist/signals/observable.d.ts +3 -1
- package/dist/signals/observable.d.ts.map +1 -1
- package/dist/user/client.d.ts +5 -3
- package/dist/user/client.d.ts.map +1 -1
- package/dist/user/payload.d.ts +7 -6
- package/dist/user/payload.d.ts.map +1 -1
- package/dist/user/retriever.d.ts +2 -1
- package/dist/user/retriever.d.ts.map +1 -1
- package/dist/user/writer.d.ts +2 -2
- package/dist/user/writer.d.ts.map +1 -1
- package/dist/util/decodeJSONString.d.ts +3 -0
- package/dist/util/decodeJSONString.d.ts.map +1 -0
- package/dist/util/parseWithoutKeyConversion.d.ts +3 -0
- package/dist/util/parseWithoutKeyConversion.d.ts.map +1 -0
- package/dist/util/retrieve.d.ts +1 -1
- package/dist/util/retrieve.d.ts.map +1 -1
- package/dist/util/telem.d.ts.map +1 -1
- package/dist/util/zod.d.ts.map +1 -1
- package/dist/workspace/client.d.ts +6 -60
- package/dist/workspace/client.d.ts.map +1 -1
- package/dist/workspace/external.d.ts +3 -0
- package/dist/workspace/external.d.ts.map +1 -0
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/index.d.ts.map +1 -1
- package/dist/workspace/lineplot/client.d.ts +5 -44
- package/dist/workspace/lineplot/client.d.ts.map +1 -1
- package/dist/workspace/lineplot/external.d.ts +3 -0
- package/dist/workspace/lineplot/external.d.ts.map +1 -0
- package/dist/workspace/lineplot/index.d.ts +1 -1
- package/dist/workspace/lineplot/index.d.ts.map +1 -1
- package/dist/workspace/lineplot/payload.d.ts +45 -0
- package/dist/workspace/lineplot/payload.d.ts.map +1 -0
- package/dist/workspace/log/client.d.ts +5 -44
- package/dist/workspace/log/client.d.ts.map +1 -1
- package/dist/workspace/log/external.d.ts +3 -0
- package/dist/workspace/log/external.d.ts.map +1 -0
- package/dist/workspace/log/index.d.ts +1 -1
- package/dist/workspace/log/index.d.ts.map +1 -1
- package/dist/workspace/log/payload.d.ts +45 -0
- package/dist/workspace/log/payload.d.ts.map +1 -0
- package/dist/workspace/payload.d.ts +60 -0
- package/dist/workspace/payload.d.ts.map +1 -0
- package/dist/workspace/schematic/client.d.ts +5 -68
- package/dist/workspace/schematic/client.d.ts.map +1 -1
- package/dist/workspace/schematic/external.d.ts +3 -0
- package/dist/workspace/schematic/external.d.ts.map +1 -0
- package/dist/workspace/schematic/index.d.ts +1 -1
- package/dist/workspace/schematic/index.d.ts.map +1 -1
- package/dist/workspace/schematic/payload.d.ts +71 -0
- package/dist/workspace/schematic/payload.d.ts.map +1 -0
- package/dist/workspace/table/client.d.ts +5 -57
- package/dist/workspace/table/client.d.ts.map +1 -1
- package/dist/workspace/table/external.d.ts +3 -0
- package/dist/workspace/table/external.d.ts.map +1 -0
- package/dist/workspace/table/index.d.ts +1 -1
- package/dist/workspace/table/index.d.ts.map +1 -1
- package/dist/workspace/table/payload.d.ts +60 -0
- package/dist/workspace/table/payload.d.ts.map +1 -0
- package/eslint.config.js +1 -1
- package/examples/node/basicReadWrite.js +27 -27
- package/examples/node/liveStream.js +16 -16
- package/examples/node/seriesAndFrames.js +39 -39
- package/examples/node/streamWrite.js +48 -46
- package/package.json +14 -12
- 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 +13 -13
- package/src/access/policy/client.ts +14 -13
- package/src/access/policy/external.ts +2 -1
- package/src/access/policy/index.ts +1 -1
- package/src/access/policy/ontology.ts +17 -0
- package/src/access/policy/payload.ts +8 -20
- package/src/access/policy/policy.spec.ts +17 -17
- package/src/access/policy/retriever.ts +3 -2
- package/src/access/policy/writer.ts +5 -5
- package/src/auth/auth.spec.ts +28 -24
- package/src/auth/auth.ts +8 -12
- package/src/auth/index.ts +1 -1
- package/src/channel/batchRetriever.spec.ts +26 -23
- package/src/channel/channel.spec.ts +1 -1
- package/src/channel/client.ts +24 -24
- package/src/channel/external.ts +1 -1
- package/src/channel/index.ts +1 -1
- package/src/channel/payload.ts +17 -21
- package/src/channel/retriever.ts +21 -22
- package/src/channel/writer.ts +12 -14
- package/src/client.ts +7 -17
- package/src/connection/checker.ts +10 -12
- package/src/connection/connection.spec.ts +18 -6
- 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 +9 -10
- package/src/errors.spec.ts +2 -2
- package/src/errors.ts +9 -1
- package/src/framer/adapter.spec.ts +29 -24
- package/src/framer/adapter.ts +38 -42
- package/src/framer/client.spec.ts +6 -12
- package/src/framer/client.ts +35 -39
- package/src/framer/deleter.spec.ts +1 -1
- package/src/framer/deleter.ts +6 -7
- package/src/framer/external.ts +1 -1
- package/src/framer/frame.spec.ts +1 -1
- package/src/framer/frame.ts +63 -51
- package/src/framer/index.ts +1 -1
- package/src/framer/iterator.spec.ts +1 -1
- package/src/framer/iterator.ts +12 -17
- package/src/framer/streamProxy.ts +2 -2
- package/src/framer/streamer.spec.ts +3 -11
- package/src/framer/streamer.ts +16 -20
- package/src/framer/writer.spec.ts +49 -8
- package/src/framer/writer.ts +40 -32
- package/src/hardware/client.ts +1 -1
- package/src/hardware/device/client.ts +65 -40
- package/src/hardware/device/device.spec.ts +50 -34
- package/src/hardware/device/external.ts +1 -1
- package/src/hardware/device/index.ts +1 -1
- package/src/hardware/device/payload.ts +30 -30
- package/src/hardware/external.ts +1 -1
- package/src/hardware/index.ts +1 -1
- package/src/hardware/rack/client.ts +53 -66
- package/src/hardware/rack/external.ts +1 -1
- package/src/hardware/rack/index.ts +1 -1
- package/src/hardware/rack/payload.ts +10 -19
- package/src/hardware/rack/rack.spec.ts +13 -1
- package/src/hardware/task/client.ts +161 -132
- package/src/hardware/task/external.ts +1 -1
- package/src/hardware/task/index.ts +1 -1
- package/src/hardware/task/payload.ts +50 -69
- package/src/hardware/task/task.spec.ts +99 -82
- package/src/index.ts +1 -1
- package/src/label/client.ts +13 -16
- 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 +4 -10
- package/src/label/retriever.ts +4 -8
- package/src/label/writer.ts +9 -16
- package/src/ontology/client.ts +31 -29
- package/src/ontology/external.ts +1 -1
- package/src/ontology/group/client.ts +6 -6
- package/src/ontology/group/external.ts +1 -1
- package/src/ontology/group/group.spec.ts +5 -5
- package/src/ontology/group/group.ts +11 -8
- package/src/ontology/group/index.ts +1 -1
- package/src/ontology/group/payload.ts +12 -36
- package/src/ontology/group/writer.ts +23 -27
- package/src/ontology/index.ts +1 -1
- package/src/ontology/ontology.spec.ts +16 -16
- package/src/ontology/payload.ts +68 -44
- package/src/ontology/writer.ts +17 -24
- package/src/ranger/alias.ts +26 -43
- package/src/ranger/client.ts +34 -41
- package/src/ranger/external.ts +2 -2
- package/src/ranger/index.ts +1 -1
- package/src/ranger/kv.ts +10 -33
- package/src/ranger/payload.ts +15 -37
- package/src/ranger/ranger.spec.ts +2 -3
- package/src/ranger/writer.ts +9 -27
- 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 +4 -5
- package/src/transport.ts +1 -1
- package/src/user/client.ts +9 -5
- package/src/user/external.ts +1 -1
- package/src/user/index.ts +1 -1
- package/src/user/payload.ts +6 -10
- package/src/user/retriever.ts +2 -2
- package/src/user/user.spec.ts +18 -16
- package/src/user/writer.ts +4 -11
- package/src/util/decodeJSONString.ts +13 -0
- package/src/util/parseWithoutKeyConversion.ts +19 -0
- package/src/util/retrieve.spec.ts +4 -14
- package/src/util/retrieve.ts +3 -13
- package/src/util/telem.ts +2 -2
- package/src/util/zod.ts +1 -1
- package/src/vite-env.d.ts +2 -1
- package/src/workspace/client.ts +39 -57
- package/src/workspace/external.ts +11 -0
- package/src/workspace/index.ts +2 -2
- package/src/workspace/lineplot/client.ts +31 -36
- package/src/workspace/lineplot/external.ts +11 -0
- package/src/workspace/lineplot/index.ts +2 -2
- package/src/workspace/lineplot/linePlot.spec.ts +2 -3
- package/src/workspace/lineplot/payload.ts +32 -0
- package/src/workspace/log/client.ts +34 -39
- package/src/workspace/log/external.ts +11 -0
- package/src/workspace/log/index.ts +2 -2
- package/src/workspace/log/log.spec.ts +6 -19
- package/src/workspace/log/payload.ts +32 -0
- package/src/workspace/payload.ts +36 -0
- package/src/workspace/schematic/client.ts +39 -56
- package/src/workspace/schematic/external.ts +11 -0
- package/src/workspace/schematic/index.ts +2 -2
- package/src/workspace/schematic/payload.ts +37 -0
- package/src/workspace/schematic/schematic.spec.ts +16 -7
- package/src/workspace/table/client.ts +36 -50
- package/src/workspace/table/external.ts +11 -0
- package/src/workspace/table/index.ts +2 -2
- package/src/workspace/table/payload.ts +36 -0
- package/src/workspace/table/table.spec.ts +1 -1
- package/src/workspace/workspace.spec.ts +2 -3
- package/vite.config.ts +1 -1
- package/dist/channel/creator.d.ts +0 -9
- package/dist/channel/creator.d.ts.map +0 -1
- package/src/channel/creator.ts +0 -37
package/src/ontology/payload.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,43 +10,65 @@
|
|
|
10
10
|
import { type change, type UnknownRecord } from "@synnaxlabs/x";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
|
|
13
|
+
import {
|
|
14
|
+
ALLOW_ALL_ONTOLOGY_TYPE as ALLOW_ALL_TYPE,
|
|
15
|
+
ONTOLOGY_TYPE as POLICY_TYPE,
|
|
16
|
+
} from "@/access/policy/ontology";
|
|
17
|
+
import { ONTOLOGY_TYPE as CHANNEL_TYPE } from "@/channel/payload";
|
|
18
|
+
import { ONTOLOGY_TYPE as FRAMER_TYPE } from "@/framer/frame";
|
|
19
|
+
import { ONTOLOGY_TYPE as DEVICE_TYPE } from "@/hardware/device/payload";
|
|
20
|
+
import { ONTOLOGY_TYPE as RACK_TYPE } from "@/hardware/rack/payload";
|
|
21
|
+
import { ONTOLOGY_TYPE as TASK_TYPE } from "@/hardware/task/payload";
|
|
22
|
+
import { ONTOLOGY_TYPE as LABEL_TYPE } from "@/label/payload";
|
|
23
|
+
import { ONTOLOGY_TYPE as GROUP_TYPE } from "@/ontology/group/payload";
|
|
24
|
+
import {
|
|
25
|
+
ALIAS_ONTOLOGY_TYPE as RANGE_ALIAS_TYPE,
|
|
26
|
+
ONTOLOGY_TYPE as RANGE_TYPE,
|
|
27
|
+
} from "@/ranger/payload";
|
|
28
|
+
import { ONTOLOGY_TYPE as USER_TYPE } from "@/user/payload";
|
|
29
|
+
import { ONTOLOGY_TYPE as LINE_PLOT_TYPE } from "@/workspace/lineplot/payload";
|
|
30
|
+
import { ONTOLOGY_TYPE as LOG_TYPE } from "@/workspace/log/payload";
|
|
31
|
+
import { ONTOLOGY_TYPE as WORKSPACE_TYPE } from "@/workspace/payload";
|
|
32
|
+
import { ONTOLOGY_TYPE as SCHEMATIC_TYPE } from "@/workspace/schematic/payload";
|
|
33
|
+
import { ONTOLOGY_TYPE as TABLE_TYPE } from "@/workspace/table/payload";
|
|
34
|
+
|
|
13
35
|
export type ResourceChange = change.Change<ID, Resource>;
|
|
14
|
-
export
|
|
15
|
-
export
|
|
36
|
+
export interface ResourceSet extends change.Set<ID, Resource> {}
|
|
37
|
+
export interface ResourceDelete extends change.Delete<ID, Resource> {}
|
|
16
38
|
export type RelationshipChange = change.Change<Relationship, undefined>;
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
export const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
export interface RelationshipSet extends change.Set<Relationship, undefined> {}
|
|
40
|
+
export interface RelationshipDelete extends change.Delete<Relationship, undefined> {}
|
|
41
|
+
|
|
42
|
+
export const BUILTIN_TYPE = "builtin";
|
|
43
|
+
export const CLUSTER_TYPE = "cluster";
|
|
44
|
+
export const NODE_TYPE = "node";
|
|
45
|
+
|
|
46
|
+
export const resourceTypeZ = z.enum([
|
|
47
|
+
LABEL_TYPE,
|
|
48
|
+
LOG_TYPE,
|
|
49
|
+
ALLOW_ALL_TYPE,
|
|
50
|
+
BUILTIN_TYPE,
|
|
51
|
+
CLUSTER_TYPE,
|
|
52
|
+
CHANNEL_TYPE,
|
|
53
|
+
NODE_TYPE,
|
|
54
|
+
GROUP_TYPE,
|
|
55
|
+
RANGE_TYPE,
|
|
56
|
+
FRAMER_TYPE,
|
|
57
|
+
RANGE_ALIAS_TYPE,
|
|
58
|
+
USER_TYPE,
|
|
59
|
+
WORKSPACE_TYPE,
|
|
60
|
+
SCHEMATIC_TYPE,
|
|
61
|
+
LINE_PLOT_TYPE,
|
|
62
|
+
RACK_TYPE,
|
|
63
|
+
DEVICE_TYPE,
|
|
64
|
+
TASK_TYPE,
|
|
65
|
+
POLICY_TYPE,
|
|
66
|
+
TABLE_TYPE,
|
|
41
67
|
]);
|
|
42
68
|
export type ResourceType = z.infer<typeof resourceTypeZ>;
|
|
43
69
|
|
|
44
|
-
export const BUILTIN_TYPE: ResourceType = "builtin";
|
|
45
|
-
export const CLUSTER_TYPE: ResourceType = "cluster";
|
|
46
|
-
export const NODE_TYPE: ResourceType = "node";
|
|
47
|
-
|
|
48
70
|
export const idZ = z.object({ type: resourceTypeZ, key: z.string() });
|
|
49
|
-
export
|
|
71
|
+
export interface IDPayload extends z.infer<typeof idZ> {}
|
|
50
72
|
|
|
51
73
|
export const stringIDZ = z.string().transform((v) => {
|
|
52
74
|
const [type, key] = v.split(":");
|
|
@@ -95,19 +117,18 @@ export class ID {
|
|
|
95
117
|
static readonly z = z.union([z.instanceof(ID), crudeIDZ.transform((v) => new ID(v))]);
|
|
96
118
|
}
|
|
97
119
|
|
|
98
|
-
export const
|
|
120
|
+
export const ROOT_ID = new ID({ type: BUILTIN_TYPE, key: "root" });
|
|
99
121
|
|
|
100
122
|
export const schemaFieldZ = z.object({ type: z.number() });
|
|
101
|
-
|
|
102
|
-
export type SchemaField = z.infer<typeof schemaFieldZ>;
|
|
123
|
+
export interface SchemaField extends z.infer<typeof schemaFieldZ> {}
|
|
103
124
|
|
|
104
125
|
export const schemaZ = z.object({
|
|
105
126
|
type: resourceTypeZ,
|
|
106
127
|
fields: z.record(schemaFieldZ),
|
|
107
128
|
});
|
|
108
|
-
export
|
|
129
|
+
export interface Schema extends z.infer<typeof schemaZ> {}
|
|
109
130
|
|
|
110
|
-
export const
|
|
131
|
+
export const resourceZ = z
|
|
111
132
|
.object({
|
|
112
133
|
id: ID.z,
|
|
113
134
|
name: z.string(),
|
|
@@ -115,16 +136,19 @@ export const resourceSchemaZ = z
|
|
|
115
136
|
data: z.record(z.unknown()).optional().nullable(),
|
|
116
137
|
})
|
|
117
138
|
.transform((resource) => ({ key: resource.id.toString(), ...resource }));
|
|
139
|
+
export interface Resource<T extends UnknownRecord = UnknownRecord>
|
|
140
|
+
extends Omit<z.output<typeof resourceZ>, "data"> {
|
|
141
|
+
data?: T | null;
|
|
142
|
+
}
|
|
118
143
|
|
|
119
|
-
export
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
export type RelationshipDirection = "from" | "to";
|
|
144
|
+
export const TO_RELATIONSHIP_DIRECTION = "to";
|
|
145
|
+
export const FROM_RELATIONSHIP_DIRECTION = "from";
|
|
146
|
+
export type RelationshipDirection =
|
|
147
|
+
| typeof TO_RELATIONSHIP_DIRECTION
|
|
148
|
+
| typeof FROM_RELATIONSHIP_DIRECTION;
|
|
125
149
|
|
|
126
150
|
export const relationshipSchemaZ = z.object({ from: ID.z, type: z.string(), to: ID.z });
|
|
127
|
-
export
|
|
151
|
+
export interface Relationship extends z.infer<typeof relationshipSchemaZ> {}
|
|
128
152
|
|
|
129
153
|
export const parseRelationship = (str: string): Relationship => {
|
|
130
154
|
const [from, type, to] = str.split("->");
|
package/src/ontology/writer.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,22 +12,15 @@ import { z } from "zod";
|
|
|
12
12
|
|
|
13
13
|
import { type CrudeID, ID, idZ } from "@/ontology/payload";
|
|
14
14
|
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
MOVE_CHILDREN: "/ontology/move-children",
|
|
19
|
-
};
|
|
15
|
+
const ADD_CHILDREN_ENDPOINT = "/ontology/add-children";
|
|
16
|
+
const REMOVE_CHILDREN_ENDPOINT = "/ontology/remove-children";
|
|
17
|
+
const MOVE_CHILDREN_ENDPOINT = "/ontology/move-children";
|
|
20
18
|
|
|
21
|
-
const addRemoveChildrenReqZ = z.object({
|
|
22
|
-
id: idZ,
|
|
23
|
-
children: idZ.array(),
|
|
24
|
-
});
|
|
19
|
+
const addRemoveChildrenReqZ = z.object({ id: idZ, children: idZ.array() });
|
|
25
20
|
|
|
26
|
-
const moveChildrenReqZ = z.object({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
children: idZ.array(),
|
|
30
|
-
});
|
|
21
|
+
const moveChildrenReqZ = z.object({ from: idZ, to: idZ, children: idZ.array() });
|
|
22
|
+
|
|
23
|
+
const emptyResZ = z.object({});
|
|
31
24
|
|
|
32
25
|
export class Writer {
|
|
33
26
|
client: UnaryClient;
|
|
@@ -37,22 +30,22 @@ export class Writer {
|
|
|
37
30
|
}
|
|
38
31
|
|
|
39
32
|
async addChildren(id: CrudeID, ...children: CrudeID[]): Promise<void> {
|
|
40
|
-
await sendRequired<typeof addRemoveChildrenReqZ,
|
|
33
|
+
await sendRequired<typeof addRemoveChildrenReqZ, typeof emptyResZ>(
|
|
41
34
|
this.client,
|
|
42
|
-
|
|
35
|
+
ADD_CHILDREN_ENDPOINT,
|
|
43
36
|
{ id: new ID(id).payload, children: children.map((c) => new ID(c).payload) },
|
|
44
37
|
addRemoveChildrenReqZ,
|
|
45
|
-
|
|
38
|
+
emptyResZ,
|
|
46
39
|
);
|
|
47
40
|
}
|
|
48
41
|
|
|
49
42
|
async removeChildren(id: CrudeID, ...children: CrudeID[]): Promise<void> {
|
|
50
|
-
await sendRequired<typeof addRemoveChildrenReqZ,
|
|
43
|
+
await sendRequired<typeof addRemoveChildrenReqZ, typeof emptyResZ>(
|
|
51
44
|
this.client,
|
|
52
|
-
|
|
45
|
+
REMOVE_CHILDREN_ENDPOINT,
|
|
53
46
|
{ id: new ID(id).payload, children: children.map((c) => new ID(c).payload) },
|
|
54
47
|
addRemoveChildrenReqZ,
|
|
55
|
-
|
|
48
|
+
emptyResZ,
|
|
56
49
|
);
|
|
57
50
|
}
|
|
58
51
|
|
|
@@ -66,12 +59,12 @@ export class Writer {
|
|
|
66
59
|
to: new ID(to).payload,
|
|
67
60
|
children: children.map((c) => new ID(c).payload),
|
|
68
61
|
};
|
|
69
|
-
await sendRequired(
|
|
62
|
+
await sendRequired<typeof moveChildrenReqZ, typeof emptyResZ>(
|
|
70
63
|
this.client,
|
|
71
|
-
|
|
64
|
+
MOVE_CHILDREN_ENDPOINT,
|
|
72
65
|
req,
|
|
73
66
|
moveChildrenReqZ,
|
|
74
|
-
|
|
67
|
+
emptyResZ,
|
|
75
68
|
);
|
|
76
69
|
}
|
|
77
70
|
}
|
package/src/ranger/alias.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.
|
|
@@ -11,73 +11,60 @@ import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
|
11
11
|
import { type change } from "@synnaxlabs/x/change";
|
|
12
12
|
import { z } from "zod";
|
|
13
13
|
|
|
14
|
-
import {
|
|
15
|
-
import { type
|
|
16
|
-
import { type Client as FrameClient } from "@/framer/client";
|
|
14
|
+
import { channel } from "@/channel";
|
|
15
|
+
import { type framer } from "@/framer";
|
|
17
16
|
import { type Key, keyZ } from "@/ranger/payload";
|
|
18
17
|
import { signals } from "@/signals";
|
|
19
18
|
|
|
20
|
-
export const
|
|
21
|
-
export const
|
|
19
|
+
export const SET_ALIAS_CHANNEL_NAME = "sy_range_alias_set";
|
|
20
|
+
export const DELETE_ALIAS_CHANNEL_NAME = "sy_range_alias_delete";
|
|
22
21
|
|
|
23
|
-
const resolveReqZ = z.object({
|
|
24
|
-
range: keyZ,
|
|
25
|
-
aliases: z.string().array(),
|
|
26
|
-
});
|
|
22
|
+
const resolveReqZ = z.object({ range: keyZ, aliases: z.string().array() });
|
|
27
23
|
|
|
28
|
-
const resolveResZ = z.object({
|
|
29
|
-
aliases: z.record(z.string(), channelKeyZ),
|
|
30
|
-
});
|
|
24
|
+
const resolveResZ = z.object({ aliases: z.record(z.string(), channel.keyZ) });
|
|
31
25
|
|
|
32
26
|
const setReqZ = z.object({
|
|
33
27
|
range: keyZ,
|
|
34
|
-
aliases: z.record(
|
|
28
|
+
aliases: z.record(channel.keyZ.or(z.string()), z.string()),
|
|
35
29
|
});
|
|
36
30
|
|
|
37
31
|
const setResZ = z.unknown();
|
|
38
32
|
|
|
39
|
-
const deleteReqZ = z.object({
|
|
40
|
-
range: keyZ,
|
|
41
|
-
channels: channelKeyZ.array(),
|
|
42
|
-
});
|
|
33
|
+
const deleteReqZ = z.object({ range: keyZ, channels: channel.keyZ.array() });
|
|
43
34
|
|
|
44
35
|
const deleteResZ = z.unknown();
|
|
45
36
|
|
|
46
|
-
const listReqZ = z.object({
|
|
47
|
-
range: keyZ,
|
|
48
|
-
});
|
|
37
|
+
const listReqZ = z.object({ range: keyZ });
|
|
49
38
|
|
|
50
|
-
const listResZ = z.object({
|
|
51
|
-
aliases: z.record(z.string(), z.string()),
|
|
52
|
-
});
|
|
39
|
+
const listResZ = z.object({ aliases: z.record(z.string(), z.string()) });
|
|
53
40
|
|
|
54
41
|
export class Aliaser {
|
|
55
42
|
private static readonly SET_ENDPOINT = "/range/alias/set";
|
|
56
43
|
private static readonly RESOLVE_ENDPOINT = "/range/alias/resolve";
|
|
57
44
|
private static readonly LIST_ENDPOINT = "/range/alias/list";
|
|
58
45
|
private static readonly DELETE_ENDPOINT = "/range/alias/delete";
|
|
59
|
-
private readonly frameClient:
|
|
60
|
-
private readonly cache = new Map<string,
|
|
46
|
+
private readonly frameClient: framer.Client;
|
|
47
|
+
private readonly cache = new Map<string, channel.Key>();
|
|
61
48
|
private readonly client: UnaryClient;
|
|
62
49
|
private readonly rangeKey: Key;
|
|
63
50
|
|
|
64
|
-
constructor(rangeKey: Key, frameClient:
|
|
51
|
+
constructor(rangeKey: Key, frameClient: framer.Client, client: UnaryClient) {
|
|
65
52
|
this.rangeKey = rangeKey;
|
|
66
53
|
this.cache = new Map();
|
|
67
54
|
this.client = client;
|
|
68
55
|
this.frameClient = frameClient;
|
|
69
56
|
}
|
|
70
57
|
|
|
71
|
-
resolve(aliases: string): Promise<
|
|
58
|
+
resolve(aliases: string): Promise<channel.Key>;
|
|
72
59
|
|
|
73
|
-
resolve(aliases: string[]): Promise<Record<string,
|
|
60
|
+
resolve(aliases: string[]): Promise<Record<string, channel.Key>>;
|
|
74
61
|
|
|
75
62
|
async resolve(
|
|
76
63
|
aliases: string | string[],
|
|
77
|
-
): Promise<
|
|
64
|
+
): Promise<channel.Key | Record<string, channel.Key>> {
|
|
78
65
|
const toFetch: string[] = [];
|
|
79
66
|
const isSingle = typeof aliases === "string";
|
|
80
|
-
const cached: Record<string,
|
|
67
|
+
const cached: Record<string, channel.Key> = {};
|
|
81
68
|
if (isSingle) {
|
|
82
69
|
const c = this.cache.get(aliases);
|
|
83
70
|
if (c != null) return c;
|
|
@@ -100,7 +87,7 @@ export class Aliaser {
|
|
|
100
87
|
return isSingle ? res.aliases[toFetch[0]] : { ...cached, ...res.aliases };
|
|
101
88
|
}
|
|
102
89
|
|
|
103
|
-
async set(aliases: Record<
|
|
90
|
+
async set(aliases: Record<channel.Key, string>): Promise<void> {
|
|
104
91
|
await sendRequired<typeof setReqZ, typeof setResZ>(
|
|
105
92
|
this.client,
|
|
106
93
|
Aliaser.SET_ENDPOINT,
|
|
@@ -110,7 +97,7 @@ export class Aliaser {
|
|
|
110
97
|
);
|
|
111
98
|
}
|
|
112
99
|
|
|
113
|
-
async list(): Promise<Record<
|
|
100
|
+
async list(): Promise<Record<channel.Key, string>> {
|
|
114
101
|
return (
|
|
115
102
|
await sendRequired<typeof listReqZ, typeof listResZ>(
|
|
116
103
|
this.client,
|
|
@@ -122,7 +109,7 @@ export class Aliaser {
|
|
|
122
109
|
).aliases;
|
|
123
110
|
}
|
|
124
111
|
|
|
125
|
-
async delete(aliases:
|
|
112
|
+
async delete(aliases: channel.Key[]): Promise<void> {
|
|
126
113
|
await sendRequired<typeof deleteReqZ, typeof deleteResZ>(
|
|
127
114
|
this.client,
|
|
128
115
|
Aliaser.DELETE_ENDPOINT,
|
|
@@ -135,8 +122,8 @@ export class Aliaser {
|
|
|
135
122
|
async openChangeTracker(): Promise<signals.Observable<string, Alias>> {
|
|
136
123
|
return await signals.openObservable<string, Alias>(
|
|
137
124
|
this.frameClient,
|
|
138
|
-
|
|
139
|
-
|
|
125
|
+
SET_ALIAS_CHANNEL_NAME,
|
|
126
|
+
DELETE_ALIAS_CHANNEL_NAME,
|
|
140
127
|
decodeAliasChanges(this.rangeKey),
|
|
141
128
|
);
|
|
142
129
|
}
|
|
@@ -150,13 +137,9 @@ export interface Alias {
|
|
|
150
137
|
|
|
151
138
|
export type AliasChange = change.Change<string, Alias>;
|
|
152
139
|
|
|
153
|
-
const aliasZ = z.object({
|
|
154
|
-
range: keyZ,
|
|
155
|
-
channel: channelKeyZ,
|
|
156
|
-
alias: z.string(),
|
|
157
|
-
});
|
|
140
|
+
const aliasZ = z.object({ range: keyZ, channel: channel.keyZ, alias: z.string() });
|
|
158
141
|
|
|
159
|
-
const
|
|
142
|
+
const separator = "---";
|
|
160
143
|
|
|
161
144
|
const decodeAliasChanges =
|
|
162
145
|
(rangeKey: Key): signals.Decoder<string, Alias> =>
|
|
@@ -164,7 +147,7 @@ const decodeAliasChanges =
|
|
|
164
147
|
if (variant === "delete")
|
|
165
148
|
return data
|
|
166
149
|
.toStrings()
|
|
167
|
-
.filter((k) => k.split(
|
|
150
|
+
.filter((k) => k.split(separator)[0] === rangeKey)
|
|
168
151
|
.map((alias) => ({
|
|
169
152
|
variant,
|
|
170
153
|
key: alias,
|
package/src/ranger/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.
|
|
@@ -14,25 +14,23 @@ import { type Series } from "@synnaxlabs/x/telem";
|
|
|
14
14
|
import { toArray } from "@synnaxlabs/x/toArray";
|
|
15
15
|
import { z } from "zod";
|
|
16
16
|
|
|
17
|
-
import { type
|
|
18
|
-
import { type Retriever as ChannelRetriever } from "@/channel/retriever";
|
|
17
|
+
import { type channel } from "@/channel";
|
|
19
18
|
import { MultipleFoundError, NotFoundError, QueryError } from "@/errors";
|
|
20
19
|
import { type framer } from "@/framer";
|
|
21
20
|
import { type label } from "@/label";
|
|
22
|
-
import {
|
|
23
|
-
import { type ontology } from "@/ontology";
|
|
24
|
-
import { type Resource } from "@/ontology/payload";
|
|
21
|
+
import { ontology } from "@/ontology";
|
|
25
22
|
import { type Alias, Aliaser } from "@/ranger/alias";
|
|
26
23
|
import { KV } from "@/ranger/kv";
|
|
27
24
|
import {
|
|
25
|
+
ALIAS_ONTOLOGY_TYPE,
|
|
28
26
|
analyzeParams,
|
|
29
27
|
type Key,
|
|
30
28
|
type Keys,
|
|
31
29
|
keyZ,
|
|
32
30
|
type Name,
|
|
33
31
|
type Names,
|
|
34
|
-
type
|
|
35
|
-
|
|
32
|
+
type New,
|
|
33
|
+
ONTOLOGY_TYPE,
|
|
36
34
|
type Params,
|
|
37
35
|
type Payload,
|
|
38
36
|
payloadZ,
|
|
@@ -47,7 +45,7 @@ export class Range {
|
|
|
47
45
|
readonly kv: KV;
|
|
48
46
|
readonly timeRange: TimeRange;
|
|
49
47
|
readonly color: string | undefined;
|
|
50
|
-
readonly channels:
|
|
48
|
+
readonly channels: channel.Retriever;
|
|
51
49
|
private readonly aliaser: Aliaser;
|
|
52
50
|
private readonly frameClient: framer.Client;
|
|
53
51
|
private readonly labelClient: label.Client;
|
|
@@ -62,7 +60,7 @@ export class Range {
|
|
|
62
60
|
_frameClient: framer.Client,
|
|
63
61
|
_kv: KV,
|
|
64
62
|
_aliaser: Aliaser,
|
|
65
|
-
_channels:
|
|
63
|
+
_channels: channel.Retriever,
|
|
66
64
|
_labelClient: label.Client,
|
|
67
65
|
_ontologyClient: ontology.Client,
|
|
68
66
|
_rangeClient: Client,
|
|
@@ -93,22 +91,21 @@ export class Range {
|
|
|
93
91
|
};
|
|
94
92
|
}
|
|
95
93
|
|
|
96
|
-
async setAlias(channel:
|
|
94
|
+
async setAlias(channel: channel.Key | Name, alias: string): Promise<void> {
|
|
97
95
|
const ch = await this.channels.retrieve(channel);
|
|
98
96
|
if (ch.length === 0) throw new QueryError(`Channel ${channel} does not exist`);
|
|
99
|
-
|
|
100
97
|
await this.aliaser.set({ [ch[0].key]: alias });
|
|
101
98
|
}
|
|
102
99
|
|
|
103
|
-
async deleteAlias(...channels:
|
|
100
|
+
async deleteAlias(...channels: channel.Key[]): Promise<void> {
|
|
104
101
|
await this.aliaser.delete(channels);
|
|
105
102
|
}
|
|
106
103
|
|
|
107
|
-
async listAliases(): Promise<Record<
|
|
104
|
+
async listAliases(): Promise<Record<channel.Key, string>> {
|
|
108
105
|
return await this.aliaser.list();
|
|
109
106
|
}
|
|
110
107
|
|
|
111
|
-
async resolveAlias(alias: string): Promise<
|
|
108
|
+
async resolveAlias(alias: string): Promise<channel.Key> {
|
|
112
109
|
return await this.aliaser.resolve(alias);
|
|
113
110
|
}
|
|
114
111
|
|
|
@@ -131,14 +128,12 @@ export class Range {
|
|
|
131
128
|
}
|
|
132
129
|
|
|
133
130
|
async read(channel: Key | Name): Promise<Series>;
|
|
134
|
-
|
|
135
131
|
async read(channels: Params): Promise<framer.Frame>;
|
|
136
|
-
|
|
137
132
|
async read(channels: Params): Promise<Series | framer.Frame> {
|
|
138
133
|
return await this.frameClient.read(this.timeRange, channels);
|
|
139
134
|
}
|
|
140
135
|
|
|
141
|
-
async labels(): Promise<Label[]> {
|
|
136
|
+
async labels(): Promise<label.Label[]> {
|
|
142
137
|
return await this.labelClient.retrieveFor(ontologyID(this.key));
|
|
143
138
|
}
|
|
144
139
|
|
|
@@ -161,7 +156,7 @@ export class Range {
|
|
|
161
156
|
dependents: initial,
|
|
162
157
|
resourceType: "range",
|
|
163
158
|
});
|
|
164
|
-
base.onChange((r: Resource[]) =>
|
|
159
|
+
base.onChange((r: ontology.Resource[]) =>
|
|
165
160
|
wrapper.notify(this.rangeClient.resourcesToRanges(r)),
|
|
166
161
|
);
|
|
167
162
|
wrapper.setCloser(async () => await base.close());
|
|
@@ -179,7 +174,7 @@ export class Range {
|
|
|
179
174
|
dependents: [resourceP],
|
|
180
175
|
relationshipDirection: "to",
|
|
181
176
|
});
|
|
182
|
-
base.onChange((resources: Resource[]) => {
|
|
177
|
+
base.onChange((resources: ontology.Resource[]) => {
|
|
183
178
|
const ranges = this.rangeClient.resourcesToRanges(resources);
|
|
184
179
|
if (ranges.length === 0) return;
|
|
185
180
|
const p = ranges[0];
|
|
@@ -202,20 +197,18 @@ const retrieveReqZ = z.object({
|
|
|
202
197
|
offset: z.number().int().optional(),
|
|
203
198
|
});
|
|
204
199
|
|
|
205
|
-
export
|
|
200
|
+
export interface RetrieveRequest extends z.infer<typeof retrieveReqZ> {}
|
|
206
201
|
|
|
207
202
|
const RETRIEVE_ENDPOINT = "/range/retrieve";
|
|
208
203
|
|
|
209
|
-
const retrieveResZ = z.object({
|
|
210
|
-
ranges: nullableArrayZ(payloadZ),
|
|
211
|
-
});
|
|
204
|
+
const retrieveResZ = z.object({ ranges: nullableArrayZ(payloadZ) });
|
|
212
205
|
|
|
213
206
|
export class Client implements AsyncTermSearcher<string, Key, Range> {
|
|
214
207
|
readonly type: string = "range";
|
|
215
208
|
private readonly frameClient: framer.Client;
|
|
216
209
|
private readonly writer: Writer;
|
|
217
210
|
private readonly unaryClient: UnaryClient;
|
|
218
|
-
private readonly channels:
|
|
211
|
+
private readonly channels: channel.Retriever;
|
|
219
212
|
private readonly labelClient: label.Client;
|
|
220
213
|
private readonly ontologyClient: ontology.Client;
|
|
221
214
|
|
|
@@ -223,7 +216,7 @@ export class Client implements AsyncTermSearcher<string, Key, Range> {
|
|
|
223
216
|
frameClient: framer.Client,
|
|
224
217
|
writer: Writer,
|
|
225
218
|
unary: UnaryClient,
|
|
226
|
-
channels:
|
|
219
|
+
channels: channel.Retriever,
|
|
227
220
|
labelClient: label.Client,
|
|
228
221
|
ontologyClient: ontology.Client,
|
|
229
222
|
) {
|
|
@@ -235,14 +228,9 @@ export class Client implements AsyncTermSearcher<string, Key, Range> {
|
|
|
235
228
|
this.ontologyClient = ontologyClient;
|
|
236
229
|
}
|
|
237
230
|
|
|
238
|
-
async create(range:
|
|
239
|
-
|
|
240
|
-
async create(ranges:
|
|
241
|
-
|
|
242
|
-
async create(
|
|
243
|
-
ranges: NewPayload | NewPayload[],
|
|
244
|
-
options?: CreateOptions,
|
|
245
|
-
): Promise<Range | Range[]> {
|
|
231
|
+
async create(range: New, options?: CreateOptions): Promise<Range>;
|
|
232
|
+
async create(ranges: New[], options?: CreateOptions): Promise<Range[]>;
|
|
233
|
+
async create(ranges: New | New[], options?: CreateOptions): Promise<Range | Range[]> {
|
|
246
234
|
const single = !Array.isArray(ranges);
|
|
247
235
|
const res = this.sugarMany(await this.writer.create(toArray(ranges), options));
|
|
248
236
|
return single ? res[0] : res;
|
|
@@ -265,11 +253,8 @@ export class Client implements AsyncTermSearcher<string, Key, Range> {
|
|
|
265
253
|
}
|
|
266
254
|
|
|
267
255
|
async retrieve(range: CrudeTimeRange): Promise<Range[]>;
|
|
268
|
-
|
|
269
256
|
async retrieve(range: Key | Name): Promise<Range>;
|
|
270
|
-
|
|
271
257
|
async retrieve(range: Keys | Names): Promise<Range[]>;
|
|
272
|
-
|
|
273
258
|
async retrieve(ranges: Params | CrudeTimeRange): Promise<Range | Range[]> {
|
|
274
259
|
if (typeof ranges === "object" && "start" in ranges)
|
|
275
260
|
return await this.execRetrieve({ overlapsWith: new TimeRange(ranges) });
|
|
@@ -278,9 +263,11 @@ export class Client implements AsyncTermSearcher<string, Key, Range> {
|
|
|
278
263
|
const retrieved = await this.execRetrieve({ [variant]: normalized });
|
|
279
264
|
if (!single) return retrieved;
|
|
280
265
|
if (retrieved.length === 0)
|
|
281
|
-
throw new NotFoundError(`range matching ${actual} not found`);
|
|
266
|
+
throw new NotFoundError(`range matching ${actual as string} not found`);
|
|
282
267
|
if (retrieved.length > 1)
|
|
283
|
-
throw new MultipleFoundError(
|
|
268
|
+
throw new MultipleFoundError(
|
|
269
|
+
`multiple ranges matching ${actual as string} found`,
|
|
270
|
+
);
|
|
284
271
|
return retrieved[0];
|
|
285
272
|
}
|
|
286
273
|
|
|
@@ -341,11 +328,11 @@ export class Client implements AsyncTermSearcher<string, Key, Range> {
|
|
|
341
328
|
);
|
|
342
329
|
}
|
|
343
330
|
|
|
344
|
-
resourcesToRanges(resources: Resource[]): Range[] {
|
|
331
|
+
resourcesToRanges(resources: ontology.Resource[]): Range[] {
|
|
345
332
|
return resources.map((r) => this.resourceToRange(r));
|
|
346
333
|
}
|
|
347
334
|
|
|
348
|
-
resourceToRange(resource: Resource): Range {
|
|
335
|
+
resourceToRange(resource: ontology.Resource): Range {
|
|
349
336
|
return this.sugarOne({
|
|
350
337
|
key: resource.id.key,
|
|
351
338
|
name: resource.data?.name as string,
|
|
@@ -354,3 +341,9 @@ export class Client implements AsyncTermSearcher<string, Key, Range> {
|
|
|
354
341
|
});
|
|
355
342
|
}
|
|
356
343
|
}
|
|
344
|
+
|
|
345
|
+
export const ontologyID = (key: Key): ontology.ID =>
|
|
346
|
+
new ontology.ID({ type: ONTOLOGY_TYPE, key });
|
|
347
|
+
|
|
348
|
+
export const aliasOntologyID = (key: Key): ontology.ID =>
|
|
349
|
+
new ontology.ID({ type: ALIAS_ONTOLOGY_TYPE, key });
|
package/src/ranger/external.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,7 +7,7 @@
|
|
|
7
7
|
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
|
-
export type
|
|
10
|
+
export { type Alias, type AliasChange } from "@/ranger/alias";
|
|
11
11
|
export * from "@/ranger/client";
|
|
12
12
|
export * from "@/ranger/kv";
|
|
13
13
|
export * from "@/ranger/payload";
|
package/src/ranger/index.ts
CHANGED