@synnaxlabs/client 0.43.1 → 0.44.2
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 +1 -1
- package/dist/access/payload.d.ts.map +1 -1
- package/dist/access/policy/client.d.ts +263 -6
- package/dist/access/policy/client.d.ts.map +1 -1
- package/dist/access/policy/external.d.ts +0 -1
- package/dist/access/policy/external.d.ts.map +1 -1
- package/dist/access/policy/payload.d.ts +105 -93
- package/dist/access/policy/payload.d.ts.map +1 -1
- package/dist/auth/auth.d.ts +1 -1
- package/dist/auth/auth.d.ts.map +1 -1
- package/dist/channel/client.d.ts +23 -17
- package/dist/channel/client.d.ts.map +1 -1
- package/dist/channel/payload.d.ts +151 -21
- package/dist/channel/payload.d.ts.map +1 -1
- package/dist/channel/retriever.d.ts +9 -16
- package/dist/channel/retriever.d.ts.map +1 -1
- package/dist/channel/writer.d.ts +1 -1
- package/dist/channel/writer.d.ts.map +1 -1
- package/dist/client.cjs +27 -135
- package/dist/client.d.ts +3 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +8657 -28963
- package/dist/connection/checker.d.ts +1 -1
- package/dist/connection/checker.d.ts.map +1 -1
- package/dist/control/client.d.ts +1 -0
- package/dist/control/client.d.ts.map +1 -1
- package/dist/control/state.d.ts +6 -6
- package/dist/control/state.d.ts.map +1 -1
- package/dist/errors.d.ts +18 -5
- package/dist/errors.d.ts.map +1 -1
- package/dist/framer/adapter.d.ts +3 -3
- package/dist/framer/adapter.d.ts.map +1 -1
- package/dist/framer/client.d.ts +4 -13
- package/dist/framer/client.d.ts.map +1 -1
- package/dist/framer/codec.d.ts +1 -1
- package/dist/framer/codec.d.ts.map +1 -1
- package/dist/framer/deleter.d.ts +5 -5
- package/dist/framer/deleter.d.ts.map +1 -1
- package/dist/framer/frame.d.ts +5 -7
- package/dist/framer/frame.d.ts.map +1 -1
- package/dist/framer/streamProxy.d.ts +1 -1
- package/dist/framer/streamProxy.d.ts.map +1 -1
- package/dist/framer/streamer.d.ts +235 -20
- package/dist/framer/streamer.d.ts.map +1 -1
- package/dist/framer/writer.d.ts +302 -33
- package/dist/framer/writer.d.ts.map +1 -1
- package/dist/hardware/device/client.d.ts +49 -28
- package/dist/hardware/device/client.d.ts.map +1 -1
- package/dist/hardware/device/payload.d.ts +126 -46
- package/dist/hardware/device/payload.d.ts.map +1 -1
- package/dist/hardware/rack/client.d.ts +78 -22
- package/dist/hardware/rack/client.d.ts.map +1 -1
- package/dist/hardware/rack/payload.d.ts +99 -56
- package/dist/hardware/rack/payload.d.ts.map +1 -1
- package/dist/hardware/task/client.d.ts +100 -41
- package/dist/hardware/task/client.d.ts.map +1 -1
- package/dist/hardware/task/payload.d.ts +83 -61
- package/dist/hardware/task/payload.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/label/client.d.ts +138 -20
- package/dist/label/client.d.ts.map +1 -1
- package/dist/label/external.d.ts +0 -2
- package/dist/label/external.d.ts.map +1 -1
- package/dist/label/payload.d.ts +4 -5
- package/dist/label/payload.d.ts.map +1 -1
- package/dist/ontology/client.d.ts +45 -135
- package/dist/ontology/client.d.ts.map +1 -1
- package/dist/ontology/group/group.d.ts +3 -3
- package/dist/ontology/group/group.d.ts.map +1 -1
- package/dist/ontology/group/payload.d.ts +3 -27
- package/dist/ontology/group/payload.d.ts.map +1 -1
- package/dist/ontology/payload.d.ts +114 -243
- package/dist/ontology/payload.d.ts.map +1 -1
- package/dist/ontology/writer.d.ts +4 -4
- package/dist/ontology/writer.d.ts.map +1 -1
- package/dist/ranger/alias.d.ts +15 -5
- package/dist/ranger/alias.d.ts.map +1 -1
- package/dist/ranger/client.d.ts +91 -30
- 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 +11 -12
- package/dist/ranger/kv.d.ts.map +1 -1
- package/dist/ranger/payload.d.ts +19 -44
- package/dist/ranger/payload.d.ts.map +1 -1
- package/dist/ranger/writer.d.ts +22 -19
- package/dist/ranger/writer.d.ts.map +1 -1
- package/dist/testutil/client.d.ts +4 -0
- package/dist/testutil/client.d.ts.map +1 -0
- package/dist/user/client.d.ts +59 -6
- package/dist/user/client.d.ts.map +1 -1
- package/dist/user/payload.d.ts +4 -6
- package/dist/user/payload.d.ts.map +1 -1
- package/dist/user/retriever.d.ts +2 -2
- package/dist/user/retriever.d.ts.map +1 -1
- package/dist/util/decodeJSONString.d.ts +2 -2
- package/dist/util/decodeJSONString.d.ts.map +1 -1
- package/dist/util/parseWithoutKeyConversion.d.ts +2 -2
- package/dist/util/parseWithoutKeyConversion.d.ts.map +1 -1
- package/dist/util/retrieve.d.ts +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 +17 -6
- package/dist/workspace/client.d.ts.map +1 -1
- package/dist/workspace/lineplot/client.d.ts +2 -2
- package/dist/workspace/lineplot/client.d.ts.map +1 -1
- package/dist/workspace/lineplot/payload.d.ts +8 -9
- package/dist/workspace/lineplot/payload.d.ts.map +1 -1
- package/dist/workspace/log/client.d.ts +2 -2
- package/dist/workspace/log/client.d.ts.map +1 -1
- package/dist/workspace/log/payload.d.ts +8 -9
- package/dist/workspace/log/payload.d.ts.map +1 -1
- package/dist/workspace/payload.d.ts +10 -11
- package/dist/workspace/payload.d.ts.map +1 -1
- package/dist/workspace/schematic/client.d.ts +2 -2
- package/dist/workspace/schematic/client.d.ts.map +1 -1
- package/dist/workspace/schematic/payload.d.ts +10 -11
- package/dist/workspace/schematic/payload.d.ts.map +1 -1
- package/dist/workspace/table/client.d.ts +2 -2
- package/dist/workspace/table/client.d.ts.map +1 -1
- package/dist/workspace/table/payload.d.ts +10 -11
- package/dist/workspace/table/payload.d.ts.map +1 -1
- package/examples/node/package-lock.json +47 -39
- package/examples/node/package.json +2 -1
- package/examples/node/streamWrite.js +5 -11
- package/package.json +14 -13
- package/src/access/payload.ts +1 -1
- package/src/access/policy/client.ts +87 -32
- package/src/access/policy/external.ts +0 -1
- package/src/access/policy/payload.ts +4 -4
- package/src/access/policy/policy.spec.ts +86 -83
- package/src/auth/auth.spec.ts +29 -18
- package/src/auth/auth.ts +1 -1
- package/src/channel/batchRetriever.spec.ts +4 -9
- package/src/channel/channel.spec.ts +24 -6
- package/src/channel/client.ts +52 -51
- package/src/channel/payload.ts +15 -16
- package/src/channel/retriever.ts +26 -41
- package/src/channel/writer.ts +7 -4
- package/src/client.ts +4 -4
- package/src/connection/checker.ts +1 -1
- package/src/connection/connection.spec.ts +31 -23
- package/src/control/client.ts +2 -2
- package/src/control/state.spec.ts +3 -3
- package/src/control/state.ts +1 -1
- package/src/errors.spec.ts +9 -5
- package/src/errors.ts +28 -15
- package/src/framer/adapter.spec.ts +118 -9
- package/src/framer/adapter.ts +24 -11
- package/src/framer/client.spec.ts +125 -2
- package/src/framer/client.ts +41 -47
- package/src/framer/codec.ts +1 -1
- package/src/framer/deleter.spec.ts +2 -2
- package/src/framer/deleter.ts +1 -1
- package/src/framer/frame.ts +1 -4
- package/src/framer/iterator.spec.ts +8 -8
- package/src/framer/iterator.ts +1 -1
- package/src/framer/streamProxy.ts +1 -1
- package/src/framer/streamer.spec.ts +185 -36
- package/src/framer/streamer.ts +28 -36
- package/src/framer/writer.spec.ts +7 -6
- package/src/framer/writer.ts +97 -111
- package/src/hardware/device/client.ts +45 -131
- package/src/hardware/device/device.spec.ts +163 -52
- package/src/hardware/device/payload.ts +10 -21
- package/src/hardware/rack/client.ts +87 -105
- package/src/hardware/rack/payload.ts +4 -13
- package/src/hardware/rack/rack.spec.ts +28 -35
- package/src/hardware/task/client.ts +335 -291
- package/src/hardware/task/payload.ts +86 -62
- package/src/hardware/task/task.spec.ts +208 -32
- package/src/index.ts +2 -1
- package/src/label/client.ts +100 -95
- package/src/label/external.ts +0 -2
- package/src/label/label.spec.ts +8 -6
- package/src/label/payload.ts +3 -4
- package/src/ontology/client.ts +41 -324
- package/src/ontology/group/group.spec.ts +2 -2
- package/src/ontology/group/group.ts +4 -5
- package/src/ontology/group/payload.ts +2 -25
- package/src/ontology/group/writer.ts +1 -1
- package/src/ontology/ontology.spec.ts +355 -41
- package/src/ontology/payload.ts +77 -112
- package/src/ontology/writer.ts +8 -17
- package/src/ranger/alias.ts +45 -37
- package/src/ranger/client.ts +144 -149
- package/src/ranger/external.ts +1 -1
- package/src/ranger/kv.ts +9 -27
- package/src/ranger/payload.ts +23 -37
- package/src/ranger/ranger.spec.ts +37 -56
- package/src/ranger/writer.ts +1 -1
- package/src/{signals/index.ts → testutil/client.ts} +11 -1
- package/src/user/client.ts +122 -47
- package/src/user/payload.ts +2 -5
- package/src/user/retriever.ts +1 -1
- package/src/user/user.spec.ts +31 -31
- package/src/user/writer.ts +1 -1
- package/src/util/decodeJSONString.ts +3 -3
- package/src/util/parseWithoutKeyConversion.ts +2 -2
- package/src/util/retrieve.ts +1 -1
- package/src/util/zod.ts +1 -1
- package/src/workspace/client.ts +20 -36
- package/src/workspace/lineplot/client.ts +5 -7
- package/src/workspace/lineplot/lineplot.spec.ts +2 -2
- package/src/workspace/lineplot/payload.ts +4 -7
- package/src/workspace/log/client.ts +5 -7
- package/src/workspace/log/log.spec.ts +2 -2
- package/src/workspace/log/payload.ts +4 -7
- package/src/workspace/payload.ts +4 -7
- package/src/workspace/schematic/client.ts +5 -7
- package/src/workspace/schematic/payload.ts +4 -7
- package/src/workspace/schematic/schematic.spec.ts +2 -2
- package/src/workspace/table/client.ts +5 -7
- package/src/workspace/table/payload.ts +4 -7
- package/src/workspace/table/table.spec.ts +2 -2
- package/src/workspace/workspace.spec.ts +2 -2
- package/dist/access/policy/ontology.d.ts +0 -5
- package/dist/access/policy/ontology.d.ts.map +0 -1
- package/dist/access/policy/retriever.d.ts +0 -40
- package/dist/access/policy/retriever.d.ts.map +0 -1
- package/dist/access/policy/writer.d.ts +0 -9
- package/dist/access/policy/writer.d.ts.map +0 -1
- package/dist/label/retriever.d.ts +0 -14
- package/dist/label/retriever.d.ts.map +0 -1
- package/dist/label/writer.d.ts +0 -54
- package/dist/label/writer.d.ts.map +0 -1
- package/dist/setupspecs.d.ts +0 -5
- package/dist/setupspecs.d.ts.map +0 -1
- package/dist/signals/external.d.ts +0 -2
- package/dist/signals/external.d.ts.map +0 -1
- package/dist/signals/index.d.ts +0 -2
- package/dist/signals/index.d.ts.map +0 -1
- package/dist/signals/observable.d.ts +0 -12
- package/dist/signals/observable.d.ts.map +0 -1
- package/src/access/policy/ontology.ts +0 -17
- package/src/access/policy/retriever.ts +0 -44
- package/src/access/policy/writer.ts +0 -65
- package/src/label/retriever.ts +0 -63
- package/src/label/writer.ts +0 -95
- package/src/setupspecs.ts +0 -27
- package/src/signals/external.ts +0 -10
- package/src/signals/observable.ts +0 -42
|
@@ -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
|
-
import { type
|
|
10
|
+
import { type record } from "@synnaxlabs/x/record";
|
|
11
11
|
|
|
12
12
|
// --- VERY IMPORTANT ---
|
|
13
13
|
// Synnax's encoders (in the binary package inside x) automatically convert the case of
|
|
@@ -15,5 +15,5 @@ import { type UnknownRecord } from "@synnaxlabs/x/record";
|
|
|
15
15
|
// respectively. This is done to ensure that the keys are consistent across all
|
|
16
16
|
// languages and platforms. Sometimes items have keys that are uuids, which have dashes,
|
|
17
17
|
// and those get messed up. So we just use regular JSON for these items.
|
|
18
|
-
export const parseWithoutKeyConversion = (s: string):
|
|
18
|
+
export const parseWithoutKeyConversion = (s: string): record.Unknown =>
|
|
19
19
|
s ? JSON.parse(s) : {};
|
package/src/util/retrieve.ts
CHANGED
package/src/util/zod.ts
CHANGED
|
@@ -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
|
-
import { z } from "zod
|
|
10
|
+
import { z } from "zod";
|
|
11
11
|
|
|
12
12
|
export const nullableArrayZ = <Z extends z.ZodType>(item: Z) =>
|
|
13
13
|
z.union([
|
package/src/workspace/client.ts
CHANGED
|
@@ -8,11 +8,10 @@
|
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
10
|
import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
|
-
import { array, type
|
|
12
|
-
import {
|
|
13
|
-
import { z } from "zod/v4";
|
|
11
|
+
import { array, type record } from "@synnaxlabs/x";
|
|
12
|
+
import { z } from "zod";
|
|
14
13
|
|
|
15
|
-
import { ontology } from "@/ontology";
|
|
14
|
+
import { type ontology } from "@/ontology";
|
|
16
15
|
import { type Key as UserKey, keyZ as userKeyZ } from "@/user/payload";
|
|
17
16
|
import { nullableArrayZ } from "@/util/zod";
|
|
18
17
|
import { linePlot } from "@/workspace/lineplot";
|
|
@@ -22,7 +21,6 @@ import {
|
|
|
22
21
|
keyZ,
|
|
23
22
|
type New,
|
|
24
23
|
newZ,
|
|
25
|
-
ONTOLOGY_TYPE,
|
|
26
24
|
type Params,
|
|
27
25
|
remoteZ,
|
|
28
26
|
type Workspace,
|
|
@@ -39,11 +37,12 @@ const DELETE_ENDPOINT = "/workspace/delete";
|
|
|
39
37
|
|
|
40
38
|
const retrieveReqZ = z.object({
|
|
41
39
|
keys: keyZ.array().optional(),
|
|
42
|
-
|
|
40
|
+
searchTerm: z.string().optional(),
|
|
43
41
|
author: userKeyZ.optional(),
|
|
44
42
|
offset: z.number().optional(),
|
|
45
43
|
limit: z.number().optional(),
|
|
46
44
|
});
|
|
45
|
+
export interface RetrieveRequest extends z.infer<typeof retrieveReqZ> {}
|
|
47
46
|
const createReqZ = z.object({ workspaces: newZ.array() });
|
|
48
47
|
const renameReqZ = z.object({ key: keyZ, name: z.string() });
|
|
49
48
|
const setLayoutReqZ = z.object({ key: keyZ, layout: z.string() });
|
|
@@ -53,8 +52,11 @@ const retrieveResZ = z.object({ workspaces: nullableArrayZ(workspaceZ) });
|
|
|
53
52
|
const createResZ = z.object({ workspaces: remoteZ.array() });
|
|
54
53
|
const emptyResZ = z.object({});
|
|
55
54
|
|
|
56
|
-
export
|
|
57
|
-
|
|
55
|
+
export const SET_CHANNEL_NAME = "sy_workspace_set";
|
|
56
|
+
export const DELETE_CHANNEL_NAME = "sy_workspace_delete";
|
|
57
|
+
|
|
58
|
+
export class Client {
|
|
59
|
+
readonly type = "workspace";
|
|
58
60
|
readonly schematic: schematic.Client;
|
|
59
61
|
readonly linePlot: linePlot.Client;
|
|
60
62
|
readonly log: log.Client;
|
|
@@ -93,7 +95,7 @@ export class Client implements AsyncTermSearcher<string, Key, Workspace> {
|
|
|
93
95
|
);
|
|
94
96
|
}
|
|
95
97
|
|
|
96
|
-
async setLayout(key: Key, layout:
|
|
98
|
+
async setLayout(key: Key, layout: record.Unknown): Promise<void> {
|
|
97
99
|
await sendRequired(
|
|
98
100
|
this.client,
|
|
99
101
|
SET_LAYOUT_ENDPOINT,
|
|
@@ -105,12 +107,17 @@ export class Client implements AsyncTermSearcher<string, Key, Workspace> {
|
|
|
105
107
|
|
|
106
108
|
async retrieve(key: Key): Promise<Workspace>;
|
|
107
109
|
async retrieve(keys: Key[]): Promise<Workspace[]>;
|
|
108
|
-
async retrieve(
|
|
109
|
-
|
|
110
|
+
async retrieve(req: RetrieveRequest): Promise<Workspace[]>;
|
|
111
|
+
async retrieve(keys: Params | RetrieveRequest): Promise<Workspace | Workspace[]> {
|
|
112
|
+
let req: RetrieveRequest;
|
|
113
|
+
const isMany: boolean = typeof keys !== "string";
|
|
114
|
+
if (typeof keys === "string" || Array.isArray(keys))
|
|
115
|
+
req = { keys: array.toArray(keys) };
|
|
116
|
+
else req = keys;
|
|
110
117
|
const res = await sendRequired(
|
|
111
118
|
this.client,
|
|
112
119
|
RETRIEVE_ENDPOINT,
|
|
113
|
-
|
|
120
|
+
req,
|
|
114
121
|
retrieveReqZ,
|
|
115
122
|
retrieveResZ,
|
|
116
123
|
);
|
|
@@ -128,28 +135,6 @@ export class Client implements AsyncTermSearcher<string, Key, Workspace> {
|
|
|
128
135
|
return res.workspaces;
|
|
129
136
|
}
|
|
130
137
|
|
|
131
|
-
async search(term: string): Promise<Workspace[]> {
|
|
132
|
-
const res = await sendRequired(
|
|
133
|
-
this.client,
|
|
134
|
-
RETRIEVE_ENDPOINT,
|
|
135
|
-
{ search: term },
|
|
136
|
-
retrieveReqZ,
|
|
137
|
-
retrieveResZ,
|
|
138
|
-
);
|
|
139
|
-
return res.workspaces;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
async page(offset: number, limit: number): Promise<Workspace[]> {
|
|
143
|
-
const res = await sendRequired(
|
|
144
|
-
this.client,
|
|
145
|
-
RETRIEVE_ENDPOINT,
|
|
146
|
-
{ offset, limit },
|
|
147
|
-
retrieveReqZ,
|
|
148
|
-
retrieveResZ,
|
|
149
|
-
);
|
|
150
|
-
return res.workspaces;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
138
|
async delete(key: Key): Promise<void>;
|
|
154
139
|
async delete(keys: Key[]): Promise<void>;
|
|
155
140
|
async delete(keys: Params): Promise<void> {
|
|
@@ -163,5 +148,4 @@ export class Client implements AsyncTermSearcher<string, Key, Workspace> {
|
|
|
163
148
|
}
|
|
164
149
|
}
|
|
165
150
|
|
|
166
|
-
export const ontologyID = (key: Key): ontology.ID =>
|
|
167
|
-
new ontology.ID({ type: ONTOLOGY_TYPE, key });
|
|
151
|
+
export const ontologyID = (key: Key): ontology.ID => ({ type: "workspace", key });
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
10
|
import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
|
-
import { array, type
|
|
12
|
-
import { z } from "zod
|
|
11
|
+
import { array, type record } from "@synnaxlabs/x";
|
|
12
|
+
import { z } from "zod";
|
|
13
13
|
|
|
14
|
-
import { ontology } from "@/ontology";
|
|
14
|
+
import { type ontology } from "@/ontology";
|
|
15
15
|
import { nullableArrayZ } from "@/util/zod";
|
|
16
16
|
import {
|
|
17
17
|
type Key,
|
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
linePlotZ,
|
|
21
21
|
type New,
|
|
22
22
|
newZ,
|
|
23
|
-
ONTOLOGY_TYPE,
|
|
24
23
|
type Params,
|
|
25
24
|
} from "@/workspace/lineplot/payload";
|
|
26
25
|
import { type Key as WorkspaceKey, keyZ as workspaceKeyZ } from "@/workspace/payload";
|
|
@@ -74,7 +73,7 @@ export class Client {
|
|
|
74
73
|
);
|
|
75
74
|
}
|
|
76
75
|
|
|
77
|
-
async setData(key: Key, data:
|
|
76
|
+
async setData(key: Key, data: record.Unknown): Promise<void> {
|
|
78
77
|
await sendRequired(
|
|
79
78
|
this.client,
|
|
80
79
|
SET_DATA_ENDPOINT,
|
|
@@ -111,5 +110,4 @@ export class Client {
|
|
|
111
110
|
}
|
|
112
111
|
}
|
|
113
112
|
|
|
114
|
-
export const ontologyID = (key: Key): ontology.ID =>
|
|
115
|
-
new ontology.ID({ type: ONTOLOGY_TYPE, key });
|
|
113
|
+
export const ontologyID = (key: Key): ontology.ID => ({ type: "lineplot", key });
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
import { uuid } from "@synnaxlabs/x";
|
|
11
11
|
import { describe, expect, test } from "vitest";
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { createTestClient } from "@/testutil/client";
|
|
14
14
|
|
|
15
|
-
const client =
|
|
15
|
+
const client = createTestClient();
|
|
16
16
|
|
|
17
17
|
describe("LinePlot", () => {
|
|
18
18
|
describe("create", () => {
|
|
@@ -7,19 +7,19 @@
|
|
|
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
|
-
import { z } from "zod
|
|
10
|
+
import { record } from "@synnaxlabs/x/record";
|
|
11
|
+
import { z } from "zod";
|
|
12
12
|
|
|
13
13
|
import { parseWithoutKeyConversion } from "@/util/parseWithoutKeyConversion";
|
|
14
14
|
|
|
15
|
-
export const keyZ = z.
|
|
15
|
+
export const keyZ = z.uuid();
|
|
16
16
|
export type Key = z.infer<typeof keyZ>;
|
|
17
17
|
export type Params = Key | Key[];
|
|
18
18
|
|
|
19
19
|
export const linePlotZ = z.object({
|
|
20
20
|
key: keyZ,
|
|
21
21
|
name: z.string(),
|
|
22
|
-
data:
|
|
22
|
+
data: record.unknownZ.or(z.string().transform(parseWithoutKeyConversion)),
|
|
23
23
|
});
|
|
24
24
|
export interface LinePlot extends z.infer<typeof linePlotZ> {}
|
|
25
25
|
|
|
@@ -27,6 +27,3 @@ export const newZ = linePlotZ
|
|
|
27
27
|
.partial({ key: true })
|
|
28
28
|
.transform((p) => ({ ...p, data: JSON.stringify(p.data) }));
|
|
29
29
|
export interface New extends z.input<typeof newZ> {}
|
|
30
|
-
|
|
31
|
-
export const ONTOLOGY_TYPE = "lineplot";
|
|
32
|
-
export type OntologyType = typeof ONTOLOGY_TYPE;
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
10
|
import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
|
-
import { array, type
|
|
12
|
-
import { z } from "zod
|
|
11
|
+
import { array, type record } from "@synnaxlabs/x";
|
|
12
|
+
import { z } from "zod";
|
|
13
13
|
|
|
14
|
-
import { ontology } from "@/ontology";
|
|
14
|
+
import { type ontology } from "@/ontology";
|
|
15
15
|
import {
|
|
16
16
|
type Key,
|
|
17
17
|
keyZ,
|
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
logZ,
|
|
20
20
|
type New,
|
|
21
21
|
newZ,
|
|
22
|
-
ONTOLOGY_TYPE,
|
|
23
22
|
type Params,
|
|
24
23
|
} from "@/workspace/log/payload";
|
|
25
24
|
import { type Key as WorkspaceKey, keyZ as workspaceKeyZ } from "@/workspace/payload";
|
|
@@ -71,7 +70,7 @@ export class Client {
|
|
|
71
70
|
);
|
|
72
71
|
}
|
|
73
72
|
|
|
74
|
-
async setData(key: Key, data:
|
|
73
|
+
async setData(key: Key, data: record.Unknown): Promise<void> {
|
|
75
74
|
await sendRequired(
|
|
76
75
|
this.client,
|
|
77
76
|
SET_DATA_ENDPOINT,
|
|
@@ -108,5 +107,4 @@ export class Client {
|
|
|
108
107
|
}
|
|
109
108
|
}
|
|
110
109
|
|
|
111
|
-
export const ontologyID = (key: Key): ontology.ID =>
|
|
112
|
-
new ontology.ID({ type: ONTOLOGY_TYPE, key });
|
|
110
|
+
export const ontologyID = (key: Key): ontology.ID => ({ type: "log", key });
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
import { uuid } from "@synnaxlabs/x";
|
|
11
11
|
import { describe, expect, test } from "vitest";
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { createTestClient } from "@/testutil/client";
|
|
14
14
|
|
|
15
|
-
const client =
|
|
15
|
+
const client = createTestClient();
|
|
16
16
|
|
|
17
17
|
describe("Log", () => {
|
|
18
18
|
describe("create", () => {
|
|
@@ -7,19 +7,19 @@
|
|
|
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
|
-
import { z } from "zod
|
|
10
|
+
import { record } from "@synnaxlabs/x/record";
|
|
11
|
+
import { z } from "zod";
|
|
12
12
|
|
|
13
13
|
import { parseWithoutKeyConversion } from "@/util/parseWithoutKeyConversion";
|
|
14
14
|
|
|
15
|
-
export const keyZ = z.
|
|
15
|
+
export const keyZ = z.uuid();
|
|
16
16
|
export type Key = z.infer<typeof keyZ>;
|
|
17
17
|
export type Params = Key | Key[];
|
|
18
18
|
|
|
19
19
|
export const logZ = z.object({
|
|
20
20
|
key: keyZ,
|
|
21
21
|
name: z.string(),
|
|
22
|
-
data:
|
|
22
|
+
data: record.unknownZ.or(z.string().transform(parseWithoutKeyConversion)),
|
|
23
23
|
});
|
|
24
24
|
export interface Log extends z.infer<typeof logZ> {}
|
|
25
25
|
|
|
@@ -27,6 +27,3 @@ export const newZ = logZ
|
|
|
27
27
|
.partial({ key: true })
|
|
28
28
|
.transform((p) => ({ ...p, data: JSON.stringify(p.data) }));
|
|
29
29
|
export interface New extends z.input<typeof newZ> {}
|
|
30
|
-
|
|
31
|
-
export const ONTOLOGY_TYPE = "log";
|
|
32
|
-
export type OntologyType = typeof ONTOLOGY_TYPE;
|
package/src/workspace/payload.ts
CHANGED
|
@@ -7,25 +7,22 @@
|
|
|
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
|
-
import { z } from "zod
|
|
10
|
+
import { record } from "@synnaxlabs/x/record";
|
|
11
|
+
import { z } from "zod";
|
|
12
12
|
|
|
13
13
|
import { parseWithoutKeyConversion } from "@/util/parseWithoutKeyConversion";
|
|
14
14
|
|
|
15
|
-
export const keyZ = z.
|
|
15
|
+
export const keyZ = z.uuid();
|
|
16
16
|
export type Key = z.infer<typeof keyZ>;
|
|
17
17
|
export type Params = Key | Key[];
|
|
18
18
|
|
|
19
19
|
export const workspaceZ = z.object({
|
|
20
20
|
key: keyZ,
|
|
21
21
|
name: z.string(),
|
|
22
|
-
layout:
|
|
22
|
+
layout: record.unknownZ.or(z.string().transform(parseWithoutKeyConversion)),
|
|
23
23
|
});
|
|
24
24
|
export interface Workspace extends z.infer<typeof workspaceZ> {}
|
|
25
25
|
|
|
26
|
-
export const ONTOLOGY_TYPE = "workspace";
|
|
27
|
-
export type OntologyType = typeof ONTOLOGY_TYPE;
|
|
28
|
-
|
|
29
26
|
export const newZ = workspaceZ
|
|
30
27
|
.partial({ key: true })
|
|
31
28
|
.transform((p) => ({ ...p, layout: JSON.stringify(p.layout) }));
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
10
|
import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
|
-
import { array, type
|
|
12
|
-
import { z } from "zod
|
|
11
|
+
import { array, type record } from "@synnaxlabs/x";
|
|
12
|
+
import { z } from "zod";
|
|
13
13
|
|
|
14
|
-
import { ontology } from "@/ontology";
|
|
14
|
+
import { type ontology } from "@/ontology";
|
|
15
15
|
import { nullableArrayZ } from "@/util/zod";
|
|
16
16
|
import { type Key as WorkspaceKey, keyZ as workspaceKeyZ } from "@/workspace/payload";
|
|
17
17
|
import {
|
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
keyZ,
|
|
20
20
|
type New,
|
|
21
21
|
newZ,
|
|
22
|
-
ONTOLOGY_TYPE,
|
|
23
22
|
type Params,
|
|
24
23
|
remoteZ,
|
|
25
24
|
type Schematic,
|
|
@@ -79,7 +78,7 @@ export class Client {
|
|
|
79
78
|
);
|
|
80
79
|
}
|
|
81
80
|
|
|
82
|
-
async setData(key: Key, data:
|
|
81
|
+
async setData(key: Key, data: record.Unknown): Promise<void> {
|
|
83
82
|
await sendRequired(
|
|
84
83
|
this.client,
|
|
85
84
|
SET_DATA_ENDPOINT,
|
|
@@ -127,5 +126,4 @@ export class Client {
|
|
|
127
126
|
}
|
|
128
127
|
}
|
|
129
128
|
|
|
130
|
-
export const ontologyID = (key: Key): ontology.ID =>
|
|
131
|
-
new ontology.ID({ type: ONTOLOGY_TYPE, key });
|
|
129
|
+
export const ontologyID = (key: Key): ontology.ID => ({ type: "schematic", key });
|
|
@@ -7,19 +7,19 @@
|
|
|
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
|
-
import { z } from "zod
|
|
10
|
+
import { record } from "@synnaxlabs/x/record";
|
|
11
|
+
import { z } from "zod";
|
|
12
12
|
|
|
13
13
|
import { parseWithoutKeyConversion } from "@/util/parseWithoutKeyConversion";
|
|
14
14
|
|
|
15
|
-
export const keyZ = z.
|
|
15
|
+
export const keyZ = z.uuid();
|
|
16
16
|
export type Key = z.infer<typeof keyZ>;
|
|
17
17
|
export type Params = Key | Key[];
|
|
18
18
|
|
|
19
19
|
export const schematicZ = z.object({
|
|
20
20
|
key: keyZ,
|
|
21
21
|
name: z.string(),
|
|
22
|
-
data:
|
|
22
|
+
data: record.unknownZ.or(z.string().transform(parseWithoutKeyConversion)),
|
|
23
23
|
snapshot: z.boolean(),
|
|
24
24
|
});
|
|
25
25
|
export interface Schematic extends z.infer<typeof schematicZ> {}
|
|
@@ -32,6 +32,3 @@ export interface New extends z.input<typeof newZ> {}
|
|
|
32
32
|
export const remoteZ = schematicZ.extend({
|
|
33
33
|
data: z.string().transform(parseWithoutKeyConversion),
|
|
34
34
|
});
|
|
35
|
-
|
|
36
|
-
export const ONTOLOGY_TYPE = "schematic";
|
|
37
|
-
export type OntologyType = typeof ONTOLOGY_TYPE;
|
|
@@ -11,9 +11,9 @@ import { uuid } from "@synnaxlabs/x";
|
|
|
11
11
|
import { describe, expect, it, test } from "vitest";
|
|
12
12
|
|
|
13
13
|
import { ValidationError } from "@/errors";
|
|
14
|
-
import {
|
|
14
|
+
import { createTestClient } from "@/testutil/client";
|
|
15
15
|
|
|
16
|
-
const client =
|
|
16
|
+
const client = createTestClient();
|
|
17
17
|
|
|
18
18
|
describe("Schematic", () => {
|
|
19
19
|
describe("create", () => {
|
|
@@ -8,17 +8,16 @@
|
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
10
|
import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
|
-
import { array, type
|
|
12
|
-
import { z } from "zod
|
|
11
|
+
import { array, type record } from "@synnaxlabs/x";
|
|
12
|
+
import { z } from "zod";
|
|
13
13
|
|
|
14
|
-
import { ontology } from "@/ontology";
|
|
14
|
+
import { type ontology } from "@/ontology";
|
|
15
15
|
import { type Key as WorkspaceKey, keyZ as workspaceKeyZ } from "@/workspace/payload";
|
|
16
16
|
import {
|
|
17
17
|
type Key,
|
|
18
18
|
keyZ,
|
|
19
19
|
type New,
|
|
20
20
|
newZ,
|
|
21
|
-
ONTOLOGY_TYPE,
|
|
22
21
|
type Params,
|
|
23
22
|
remoteZ,
|
|
24
23
|
type Table,
|
|
@@ -71,7 +70,7 @@ export class Client {
|
|
|
71
70
|
);
|
|
72
71
|
}
|
|
73
72
|
|
|
74
|
-
async setData(key: Key, data:
|
|
73
|
+
async setData(key: Key, data: record.Unknown): Promise<void> {
|
|
75
74
|
await sendRequired(
|
|
76
75
|
this.client,
|
|
77
76
|
SET_DATA_ENDPOINT,
|
|
@@ -108,5 +107,4 @@ export class Client {
|
|
|
108
107
|
}
|
|
109
108
|
}
|
|
110
109
|
|
|
111
|
-
export const ontologyID = (key: Key): ontology.ID =>
|
|
112
|
-
new ontology.ID({ type: ONTOLOGY_TYPE, key });
|
|
110
|
+
export const ontologyID = (key: Key): ontology.ID => ({ type: "table", key });
|
|
@@ -7,19 +7,19 @@
|
|
|
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
|
-
import { z } from "zod
|
|
10
|
+
import { record } from "@synnaxlabs/x/record";
|
|
11
|
+
import { z } from "zod";
|
|
12
12
|
|
|
13
13
|
import { parseWithoutKeyConversion } from "@/util/parseWithoutKeyConversion";
|
|
14
14
|
|
|
15
|
-
export const keyZ = z.
|
|
15
|
+
export const keyZ = z.uuid();
|
|
16
16
|
export type Key = z.infer<typeof keyZ>;
|
|
17
17
|
export type Params = Key | Key[];
|
|
18
18
|
|
|
19
19
|
export const tableZ = z.object({
|
|
20
20
|
key: keyZ,
|
|
21
21
|
name: z.string(),
|
|
22
|
-
data:
|
|
22
|
+
data: record.unknownZ.or(z.string().transform(parseWithoutKeyConversion)),
|
|
23
23
|
});
|
|
24
24
|
export interface Table extends z.infer<typeof tableZ> {}
|
|
25
25
|
|
|
@@ -31,6 +31,3 @@ export interface New extends z.input<typeof newZ> {}
|
|
|
31
31
|
export const remoteZ = tableZ.extend({
|
|
32
32
|
data: z.string().transform(parseWithoutKeyConversion),
|
|
33
33
|
});
|
|
34
|
-
|
|
35
|
-
export const ONTOLOGY_TYPE = "table";
|
|
36
|
-
export type OntologyType = typeof ONTOLOGY_TYPE;
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
import { uuid } from "@synnaxlabs/x";
|
|
11
11
|
import { describe, expect, test } from "vitest";
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { createTestClient } from "@/testutil/client";
|
|
14
14
|
|
|
15
|
-
const client =
|
|
15
|
+
const client = createTestClient();
|
|
16
16
|
|
|
17
17
|
describe("Table", () => {
|
|
18
18
|
describe("create", () => {
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
import { uuid } from "@synnaxlabs/x";
|
|
11
11
|
import { describe, expect, test } from "vitest";
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { createTestClient } from "@/testutil/client";
|
|
14
14
|
|
|
15
|
-
const client =
|
|
15
|
+
const client = createTestClient();
|
|
16
16
|
|
|
17
17
|
describe("Workspace", () => {
|
|
18
18
|
describe("create", () => {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ontology.d.ts","sourceRoot":"","sources":["../../../src/access/policy/ontology.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,aAAa,WAAW,CAAC;AACtC,MAAM,MAAM,YAAY,GAAG,OAAO,aAAa,CAAC;AAEhD,eAAO,MAAM,uBAAuB,cAAc,CAAC;AACnD,MAAM,MAAM,oBAAoB,GAAG,OAAO,uBAAuB,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { UnaryClient } from '@synnaxlabs/freighter';
|
|
2
|
-
import { z } from 'zod/v4';
|
|
3
|
-
import { Policy } from './payload';
|
|
4
|
-
declare const reqZ: z.ZodObject<{
|
|
5
|
-
keys: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
6
|
-
subjects: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
7
|
-
type: z.ZodEnum<{
|
|
8
|
-
policy: "policy";
|
|
9
|
-
allow_all: "allow_all";
|
|
10
|
-
channel: "channel";
|
|
11
|
-
group: "group";
|
|
12
|
-
framer: "framer";
|
|
13
|
-
rack: "rack";
|
|
14
|
-
device: "device";
|
|
15
|
-
task: "task";
|
|
16
|
-
label: "label";
|
|
17
|
-
range: "range";
|
|
18
|
-
"range-alias": "range-alias";
|
|
19
|
-
user: "user";
|
|
20
|
-
lineplot: "lineplot";
|
|
21
|
-
log: "log";
|
|
22
|
-
workspace: "workspace";
|
|
23
|
-
schematic: "schematic";
|
|
24
|
-
table: "table";
|
|
25
|
-
builtin: "builtin";
|
|
26
|
-
cluster: "cluster";
|
|
27
|
-
node: "node";
|
|
28
|
-
}>;
|
|
29
|
-
key: z.ZodString;
|
|
30
|
-
}, z.core.$strip>>>;
|
|
31
|
-
}, z.core.$strip>;
|
|
32
|
-
interface Request extends z.infer<typeof reqZ> {
|
|
33
|
-
}
|
|
34
|
-
export declare class Retriever {
|
|
35
|
-
private readonly client;
|
|
36
|
-
constructor(client: UnaryClient);
|
|
37
|
-
retrieve(req: Request): Promise<Policy[]>;
|
|
38
|
-
}
|
|
39
|
-
export {};
|
|
40
|
-
//# sourceMappingURL=retriever.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retriever.d.ts","sourceRoot":"","sources":["../../../src/access/policy/retriever.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EAAQ,KAAK,MAAM,EAAW,MAAM,yBAAyB,CAAC;AAIrE,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGR,CAAC;AACH,UAAU,OAAQ,SAAQ,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC;CAAG;AAMjD,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,EAAE,WAAW;IAIzB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAUhD"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { UnaryClient } from '@synnaxlabs/freighter';
|
|
2
|
-
import { Key, New, Policy } from './payload';
|
|
3
|
-
export declare class Writer {
|
|
4
|
-
private readonly client;
|
|
5
|
-
constructor(client: UnaryClient);
|
|
6
|
-
create(policies: New | New[]): Promise<Policy[]>;
|
|
7
|
-
delete(keys: Key | Key[]): Promise<void>;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=writer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../../src/access/policy/writer.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIvE,OAAO,EACL,KAAK,GAAG,EAER,KAAK,GAAG,EAER,KAAK,MAAM,EAEZ,MAAM,yBAAyB,CAAC;AAWjC,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,EAAE,WAAW;IAIzB,MAAM,CAAC,QAAQ,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAiBhD,MAAM,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAS/C"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { UnaryClient } from '@synnaxlabs/freighter';
|
|
2
|
-
import { Label, Params } from './payload';
|
|
3
|
-
import { ontology } from '../ontology';
|
|
4
|
-
export declare class Retriever {
|
|
5
|
-
private static readonly ENDPOINT;
|
|
6
|
-
private readonly client;
|
|
7
|
-
constructor(client: UnaryClient);
|
|
8
|
-
retrieve(labels: Params): Promise<Label[]>;
|
|
9
|
-
retrieveFor(id: ontology.ID): Promise<Label[]>;
|
|
10
|
-
search(term: string): Promise<Label[]>;
|
|
11
|
-
page(offset: number, limit: number): Promise<Label[]>;
|
|
12
|
-
private execute;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=retriever.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retriever.d.ts","sourceRoot":"","sources":["../../src/label/retriever.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIzD,OAAO,EAAQ,KAAK,KAAK,EAAU,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AActC,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IACrD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,EAAE,WAAW;IAIzB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAI1C,WAAW,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAI9C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAItC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;YAI7C,OAAO;CAUtB"}
|