@synnaxlabs/client 0.16.4 → 0.17.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 +5 -5
- package/dist/auth/auth.d.ts +2 -2
- package/dist/client.cjs +11 -11
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +14 -4
- package/dist/client.js +5437 -5436
- package/dist/client.js.map +1 -1
- package/dist/framer/frame.d.ts +280 -24
- package/dist/framer/writer.d.ts +203 -15
- package/dist/hardware/rack/client.d.ts +1 -1
- package/dist/hardware/task/payload.d.ts +5 -5
- package/dist/ontology/retriever.d.ts +1 -1
- package/dist/ranger/active.d.ts +1 -1
- package/dist/ranger/payload.d.ts +308 -20
- package/dist/workspace/client.d.ts +2 -2
- package/dist/workspace/lineplot/client.d.ts +2 -2
- package/dist/workspace/lineplot/payload.d.ts +3 -16
- package/dist/workspace/lineplot/retriever.d.ts +0 -1
- package/dist/workspace/lineplot/writer.d.ts +9 -14
- package/dist/workspace/payload.d.ts +3 -3
- package/dist/workspace/pid/client.d.ts +2 -2
- package/dist/workspace/pid/payload.d.ts +3 -3
- package/dist/workspace/pid/retriever.d.ts +0 -1
- package/dist/workspace/pid/writer.d.ts +12 -18
- package/dist/workspace/writer.d.ts +14 -6
- package/examples/node/basicReadWriter.js +34 -5
- package/examples/node/package-lock.json +23 -23
- package/examples/node/package.json +1 -1
- package/package.json +3 -3
- package/src/auth/auth.ts +5 -4
- package/src/channel/client.ts +0 -1
- package/src/channel/creator.ts +1 -0
- package/src/channel/retriever.ts +2 -2
- package/src/client.ts +2 -2
- package/src/connection/checker.ts +1 -1
- package/src/framer/client.ts +1 -1
- package/src/framer/frame.ts +4 -4
- package/src/hardware/device/retriever.ts +3 -3
- package/src/hardware/device/writer.ts +3 -1
- package/src/hardware/rack/client.ts +3 -4
- package/src/hardware/rack/retriever.ts +3 -0
- package/src/hardware/rack/writer.ts +2 -0
- package/src/hardware/task/payload.ts +5 -4
- package/src/hardware/task/retriever.ts +10 -7
- package/src/hardware/task/writer.ts +3 -1
- package/src/label/retriever.ts +1 -0
- package/src/label/writer.ts +4 -0
- package/src/ontology/group/writer.ts +18 -5
- package/src/ontology/retriever.ts +9 -9
- package/src/ontology/writer.ts +25 -11
- package/src/ranger/active.ts +26 -8
- package/src/ranger/alias.ts +9 -13
- package/src/ranger/client.ts +0 -1
- package/src/ranger/kv.ts +4 -1
- package/src/ranger/retriever.ts +1 -1
- package/src/ranger/writer.ts +3 -0
- package/src/workspace/client.ts +3 -3
- package/src/workspace/lineplot/client.ts +2 -2
- package/src/workspace/lineplot/payload.ts +1 -7
- package/src/workspace/lineplot/retriever.ts +10 -11
- package/src/workspace/lineplot/writer.ts +13 -8
- package/src/workspace/payload.ts +1 -1
- package/src/workspace/pid/client.ts +2 -2
- package/src/workspace/pid/payload.ts +1 -1
- package/src/workspace/pid/retriever.ts +8 -10
- package/src/workspace/pid/writer.ts +12 -5
- package/src/workspace/retriever.ts +2 -4
- package/src/workspace/workspace.spec.ts +4 -4
- package/src/workspace/writer.ts +12 -10
|
@@ -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 UnaryClient } from "@synnaxlabs/freighter";
|
|
10
|
+
import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
|
|
11
11
|
import { toArray } from "@synnaxlabs/x";
|
|
12
12
|
import { z } from "zod";
|
|
13
13
|
|
|
@@ -59,8 +59,6 @@ export class Retriever {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
private async execute(request: Request): Promise<Workspace[]> {
|
|
62
|
-
|
|
63
|
-
if (err != null) throw err;
|
|
64
|
-
return res.workspaces;
|
|
62
|
+
return (await sendRequired(this.client, Retriever.ENDPOINT, request, reqZ, resZ)).workspaces;
|
|
65
63
|
}
|
|
66
64
|
}
|
|
@@ -18,13 +18,13 @@ const ZERO_UUID = "00000000-0000-0000-0000-000000000000";
|
|
|
18
18
|
describe("Workspace", () => {
|
|
19
19
|
describe("create", () => {
|
|
20
20
|
test("create one", async () => {
|
|
21
|
-
const
|
|
21
|
+
const ws = await client.workspaces.create({
|
|
22
22
|
name: "PID",
|
|
23
23
|
layout: { one: 1 },
|
|
24
24
|
});
|
|
25
|
-
expect(
|
|
26
|
-
expect(
|
|
27
|
-
expect(
|
|
25
|
+
expect(ws.name).toEqual("PID");
|
|
26
|
+
expect(ws.key).not.toEqual(ZERO_UUID);
|
|
27
|
+
expect(ws.layout.one).toEqual(1);
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
describe("rename", () => {
|
package/src/workspace/writer.ts
CHANGED
|
@@ -13,13 +13,15 @@ import { z } from "zod";
|
|
|
13
13
|
|
|
14
14
|
import { type Workspace, workspaceZ, keyZ, workspaceRemoteZ } from "./payload";
|
|
15
15
|
|
|
16
|
-
const
|
|
17
|
-
|
|
16
|
+
const newWorkspaceZ = workspaceZ.partial({ key: true }).transform((w) => ({
|
|
17
|
+
...w,
|
|
18
|
+
layout: JSON.stringify(w.layout),
|
|
19
|
+
}));
|
|
18
20
|
|
|
19
|
-
export type
|
|
21
|
+
export type NewWorkspace = z.input<typeof newWorkspaceZ>;
|
|
20
22
|
|
|
21
23
|
const createReqZ = z.object({
|
|
22
|
-
workspaces:
|
|
24
|
+
workspaces: newWorkspaceZ.array(),
|
|
23
25
|
});
|
|
24
26
|
|
|
25
27
|
const createResZ = z.object({
|
|
@@ -60,15 +62,12 @@ export class Writer {
|
|
|
60
62
|
this.client = client;
|
|
61
63
|
}
|
|
62
64
|
|
|
63
|
-
async create(workspaces:
|
|
64
|
-
const ws = toArray(workspaces).map((w) => ({
|
|
65
|
-
...w,
|
|
66
|
-
layout: JSON.stringify(w.layout),
|
|
67
|
-
}));
|
|
65
|
+
async create(workspaces: NewWorkspace | NewWorkspace[]): Promise<Workspace[]> {
|
|
68
66
|
const res = await sendRequired<typeof createReqZ, typeof createResZ>(
|
|
69
67
|
this.client,
|
|
70
68
|
CREATE_ENDPOINT,
|
|
71
|
-
{ workspaces:
|
|
69
|
+
{ workspaces: toArray(workspaces) },
|
|
70
|
+
createReqZ,
|
|
72
71
|
createResZ,
|
|
73
72
|
);
|
|
74
73
|
return res.workspaces;
|
|
@@ -79,6 +78,7 @@ export class Writer {
|
|
|
79
78
|
this.client,
|
|
80
79
|
DELETE_ENDPOINT,
|
|
81
80
|
{ keys: toArray(keys) },
|
|
81
|
+
deleteReqZ,
|
|
82
82
|
deleteResZ,
|
|
83
83
|
);
|
|
84
84
|
}
|
|
@@ -88,6 +88,7 @@ export class Writer {
|
|
|
88
88
|
this.client,
|
|
89
89
|
RENAME_ENDPOINT,
|
|
90
90
|
{ key, name },
|
|
91
|
+
renameReqZ,
|
|
91
92
|
renameResZ,
|
|
92
93
|
);
|
|
93
94
|
}
|
|
@@ -97,6 +98,7 @@ export class Writer {
|
|
|
97
98
|
this.client,
|
|
98
99
|
SET_LAYOUT_ENDPOINT,
|
|
99
100
|
{ key, layout: JSON.stringify(layout) },
|
|
101
|
+
setLayoutReqZ,
|
|
100
102
|
setLayoutResZ,
|
|
101
103
|
);
|
|
102
104
|
}
|