@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.
Files changed (69) hide show
  1. package/.turbo/turbo-build.log +5 -5
  2. package/dist/auth/auth.d.ts +2 -2
  3. package/dist/client.cjs +11 -11
  4. package/dist/client.cjs.map +1 -1
  5. package/dist/client.d.ts +14 -4
  6. package/dist/client.js +5437 -5436
  7. package/dist/client.js.map +1 -1
  8. package/dist/framer/frame.d.ts +280 -24
  9. package/dist/framer/writer.d.ts +203 -15
  10. package/dist/hardware/rack/client.d.ts +1 -1
  11. package/dist/hardware/task/payload.d.ts +5 -5
  12. package/dist/ontology/retriever.d.ts +1 -1
  13. package/dist/ranger/active.d.ts +1 -1
  14. package/dist/ranger/payload.d.ts +308 -20
  15. package/dist/workspace/client.d.ts +2 -2
  16. package/dist/workspace/lineplot/client.d.ts +2 -2
  17. package/dist/workspace/lineplot/payload.d.ts +3 -16
  18. package/dist/workspace/lineplot/retriever.d.ts +0 -1
  19. package/dist/workspace/lineplot/writer.d.ts +9 -14
  20. package/dist/workspace/payload.d.ts +3 -3
  21. package/dist/workspace/pid/client.d.ts +2 -2
  22. package/dist/workspace/pid/payload.d.ts +3 -3
  23. package/dist/workspace/pid/retriever.d.ts +0 -1
  24. package/dist/workspace/pid/writer.d.ts +12 -18
  25. package/dist/workspace/writer.d.ts +14 -6
  26. package/examples/node/basicReadWriter.js +34 -5
  27. package/examples/node/package-lock.json +23 -23
  28. package/examples/node/package.json +1 -1
  29. package/package.json +3 -3
  30. package/src/auth/auth.ts +5 -4
  31. package/src/channel/client.ts +0 -1
  32. package/src/channel/creator.ts +1 -0
  33. package/src/channel/retriever.ts +2 -2
  34. package/src/client.ts +2 -2
  35. package/src/connection/checker.ts +1 -1
  36. package/src/framer/client.ts +1 -1
  37. package/src/framer/frame.ts +4 -4
  38. package/src/hardware/device/retriever.ts +3 -3
  39. package/src/hardware/device/writer.ts +3 -1
  40. package/src/hardware/rack/client.ts +3 -4
  41. package/src/hardware/rack/retriever.ts +3 -0
  42. package/src/hardware/rack/writer.ts +2 -0
  43. package/src/hardware/task/payload.ts +5 -4
  44. package/src/hardware/task/retriever.ts +10 -7
  45. package/src/hardware/task/writer.ts +3 -1
  46. package/src/label/retriever.ts +1 -0
  47. package/src/label/writer.ts +4 -0
  48. package/src/ontology/group/writer.ts +18 -5
  49. package/src/ontology/retriever.ts +9 -9
  50. package/src/ontology/writer.ts +25 -11
  51. package/src/ranger/active.ts +26 -8
  52. package/src/ranger/alias.ts +9 -13
  53. package/src/ranger/client.ts +0 -1
  54. package/src/ranger/kv.ts +4 -1
  55. package/src/ranger/retriever.ts +1 -1
  56. package/src/ranger/writer.ts +3 -0
  57. package/src/workspace/client.ts +3 -3
  58. package/src/workspace/lineplot/client.ts +2 -2
  59. package/src/workspace/lineplot/payload.ts +1 -7
  60. package/src/workspace/lineplot/retriever.ts +10 -11
  61. package/src/workspace/lineplot/writer.ts +13 -8
  62. package/src/workspace/payload.ts +1 -1
  63. package/src/workspace/pid/client.ts +2 -2
  64. package/src/workspace/pid/payload.ts +1 -1
  65. package/src/workspace/pid/retriever.ts +8 -10
  66. package/src/workspace/pid/writer.ts +12 -5
  67. package/src/workspace/retriever.ts +2 -4
  68. package/src/workspace/workspace.spec.ts +4 -4
  69. 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
- const [res, err] = await this.client.send(Retriever.ENDPOINT, request, resZ);
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 pid = await client.workspaces.create({
21
+ const ws = await client.workspaces.create({
22
22
  name: "PID",
23
23
  layout: { one: 1 },
24
24
  });
25
- expect(pid.name).toEqual("PID");
26
- expect(pid.key).not.toEqual(ZERO_UUID);
27
- expect(pid.layout.one).toEqual(1);
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", () => {
@@ -13,13 +13,15 @@ import { z } from "zod";
13
13
 
14
14
  import { type Workspace, workspaceZ, keyZ, workspaceRemoteZ } from "./payload";
15
15
 
16
- const crudeWorkspaceZ = workspaceZ.partial({ key: true });
17
- const workspaceWriteZ = workspaceRemoteZ.partial({ key: true });
16
+ const newWorkspaceZ = workspaceZ.partial({ key: true }).transform((w) => ({
17
+ ...w,
18
+ layout: JSON.stringify(w.layout),
19
+ }));
18
20
 
19
- export type CrudeWorkspace = z.infer<typeof crudeWorkspaceZ>;
21
+ export type NewWorkspace = z.input<typeof newWorkspaceZ>;
20
22
 
21
23
  const createReqZ = z.object({
22
- workspaces: workspaceWriteZ.partial({ key: true }).array(),
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: CrudeWorkspace | CrudeWorkspace[]): Promise<Workspace[]> {
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: ws },
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
  }