@synnaxlabs/client 0.27.0 → 0.29.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 (83) hide show
  1. package/.turbo/turbo-build.log +7 -7
  2. package/CONTRIBUTING.md +47 -0
  3. package/README.md +17 -32
  4. package/api/client.api.md +57 -15
  5. package/dist/channel/client.d.ts +10 -8
  6. package/dist/channel/client.d.ts.map +1 -1
  7. package/dist/channel/retriever.d.ts +1 -1
  8. package/dist/channel/retriever.d.ts.map +1 -1
  9. package/dist/client.cjs +20 -16
  10. package/dist/client.d.ts +4 -0
  11. package/dist/client.d.ts.map +1 -1
  12. package/dist/client.js +1880 -1722
  13. package/dist/connection/checker.d.ts +21 -1
  14. package/dist/connection/checker.d.ts.map +1 -1
  15. package/dist/control/state.d.ts.map +1 -1
  16. package/dist/framer/client.d.ts.map +1 -1
  17. package/dist/framer/deleter.d.ts.map +1 -1
  18. package/dist/framer/frame.d.ts.map +1 -1
  19. package/dist/framer/streamer.d.ts +2 -4
  20. package/dist/framer/streamer.d.ts.map +1 -1
  21. package/dist/framer/writer.d.ts.map +1 -1
  22. package/dist/hardware/task/client.d.ts +12 -2
  23. package/dist/hardware/task/client.d.ts.map +1 -1
  24. package/dist/hardware/task/ni/types.d.ts +14495 -0
  25. package/dist/hardware/task/ni/types.d.ts.map +1 -0
  26. package/dist/hardware/task/payload.d.ts +6 -0
  27. package/dist/hardware/task/payload.d.ts.map +1 -1
  28. package/dist/label/retriever.d.ts +1 -1
  29. package/dist/ontology/client.d.ts +16 -5
  30. package/dist/ontology/client.d.ts.map +1 -1
  31. package/dist/ontology/group/payload.d.ts +1 -1
  32. package/dist/ontology/group/writer.d.ts.map +1 -1
  33. package/dist/ontology/payload.d.ts +1 -2
  34. package/dist/ontology/payload.d.ts.map +1 -1
  35. package/dist/ranger/client.d.ts +3 -1
  36. package/dist/ranger/client.d.ts.map +1 -1
  37. package/dist/ranger/payload.d.ts +25 -25
  38. package/dist/ranger/payload.d.ts.map +1 -1
  39. package/dist/ranger/writer.d.ts.map +1 -1
  40. package/dist/workspace/lineplot/client.d.ts +1 -1
  41. package/dist/workspace/lineplot/client.d.ts.map +1 -1
  42. package/dist/workspace/lineplot/retriever.d.ts +1 -1
  43. package/dist/workspace/lineplot/retriever.d.ts.map +1 -1
  44. package/dist/workspace/lineplot/writer.d.ts +3 -3
  45. package/dist/workspace/lineplot/writer.d.ts.map +1 -1
  46. package/dist/workspace/retriever.d.ts +1 -1
  47. package/dist/workspace/retriever.d.ts.map +1 -1
  48. package/dist/workspace/schematic/retriever.d.ts +1 -1
  49. package/dist/workspace/schematic/retriever.d.ts.map +1 -1
  50. package/dist/workspace/schematic/writer.d.ts +1 -1
  51. package/dist/workspace/schematic/writer.d.ts.map +1 -1
  52. package/package.json +24 -16
  53. package/src/channel/client.ts +10 -8
  54. package/src/channel/retriever.ts +2 -2
  55. package/src/client.ts +13 -5
  56. package/src/connection/checker.ts +58 -1
  57. package/src/connection/connection.spec.ts +43 -3
  58. package/src/framer/client.ts +2 -3
  59. package/src/framer/streamer.spec.ts +2 -7
  60. package/src/framer/streamer.ts +5 -10
  61. package/src/hardware/rack/client.ts +3 -4
  62. package/src/hardware/task/client.ts +82 -6
  63. package/src/hardware/task/ni/types.ts +1716 -0
  64. package/src/hardware/task/payload.ts +1 -0
  65. package/src/hardware/task/task.spec.ts +45 -30
  66. package/src/label/client.ts +5 -5
  67. package/src/label/retriever.ts +2 -2
  68. package/src/ontology/client.ts +43 -31
  69. package/src/ontology/group/payload.ts +4 -4
  70. package/src/ontology/group/writer.ts +10 -12
  71. package/src/ontology/ontology.spec.ts +3 -5
  72. package/src/ontology/payload.ts +1 -1
  73. package/src/ranger/client.ts +55 -49
  74. package/src/ranger/payload.ts +4 -4
  75. package/src/vite-env.d.ts +1 -1
  76. package/src/workspace/lineplot/client.ts +2 -2
  77. package/src/workspace/lineplot/linePlot.spec.ts +12 -12
  78. package/src/workspace/lineplot/retriever.ts +2 -2
  79. package/src/workspace/lineplot/writer.ts +8 -8
  80. package/src/workspace/retriever.ts +2 -2
  81. package/src/workspace/schematic/retriever.ts +2 -2
  82. package/src/workspace/schematic/writer.ts +8 -6
  83. package/vite.config.ts +5 -0
@@ -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 { describe, expect,test } from "vitest";
10
+ import { describe, expect, test } from "vitest";
11
11
 
12
12
  import { newClient } from "@/setupspecs";
13
13
 
@@ -19,14 +19,14 @@ describe("LinePlot", () => {
19
19
  describe("create", () => {
20
20
  test("create one", async () => {
21
21
  const ws = await client.workspaces.create({
22
- name: "Schematic",
22
+ name: "Line Plot",
23
23
  layout: { one: 1 },
24
24
  });
25
25
  const linePlot = await client.workspaces.linePlot.create(ws.key, {
26
- name: "Schematic",
26
+ name: "Line Plot",
27
27
  data: { one: 1 },
28
28
  });
29
- expect(linePlot.name).toEqual("Schematic");
29
+ expect(linePlot.name).toEqual("Line Plot");
30
30
  expect(linePlot.key).not.toEqual(ZERO_UUID);
31
31
  expect(linePlot.data.one).toEqual(1);
32
32
  });
@@ -34,26 +34,26 @@ describe("LinePlot", () => {
34
34
  describe("rename", () => {
35
35
  test("rename one", async () => {
36
36
  const ws = await client.workspaces.create({
37
- name: "Schematic",
37
+ name: "Line Plot",
38
38
  layout: { one: 1 },
39
39
  });
40
40
  const linePlot = await client.workspaces.linePlot.create(ws.key, {
41
- name: "Schematic",
41
+ name: "Line Plot",
42
42
  data: { one: 1 },
43
43
  });
44
- await client.workspaces.linePlot.rename(linePlot.key, "Schematic2");
44
+ await client.workspaces.linePlot.rename(linePlot.key, "Line Plot2");
45
45
  const res = await client.workspaces.linePlot.retrieve(linePlot.key);
46
- expect(res.name).toEqual("Schematic2");
46
+ expect(res.name).toEqual("Line Plot2");
47
47
  });
48
48
  });
49
49
  describe("setData", () => {
50
50
  test("set data", async () => {
51
51
  const ws = await client.workspaces.create({
52
- name: "Schematic",
52
+ name: "Line Plot",
53
53
  layout: { one: 1 },
54
54
  });
55
55
  const linePlot = await client.workspaces.linePlot.create(ws.key, {
56
- name: "Schematic",
56
+ name: "Line Plot",
57
57
  data: { one: 1 },
58
58
  });
59
59
  await client.workspaces.linePlot.setData(linePlot.key, { two: 2 });
@@ -64,11 +64,11 @@ describe("LinePlot", () => {
64
64
  describe("delete", () => {
65
65
  test("delete one", async () => {
66
66
  const ws = await client.workspaces.create({
67
- name: "Schematic",
67
+ name: "Line Plot",
68
68
  layout: { one: 1 },
69
69
  });
70
70
  const linePlot = await client.workspaces.linePlot.create(ws.key, {
71
- name: "Schematic",
71
+ name: "Line Plot",
72
72
  data: { one: 1 },
73
73
  });
74
74
  await client.workspaces.linePlot.delete(linePlot.key);
@@ -25,8 +25,8 @@ export class Retriever {
25
25
  this.client = client;
26
26
  }
27
27
 
28
- async retrieve(params: Params): Promise<LinePlot[]> {
29
- const normalized = toArray(params);
28
+ async retrieve(linePlots: Params): Promise<LinePlot[]> {
29
+ const normalized = toArray(linePlots);
30
30
  return (
31
31
  await sendRequired(this.client, this.ENDPOINT, { keys: normalized }, reqZ, resZ)
32
32
  ).linePlots;
@@ -70,11 +70,11 @@ export class Writer {
70
70
  }
71
71
 
72
72
  async create(workspace: string, plot: NewLinePlot): Promise<LinePlot> {
73
- const schematic_ = { ...plot, data: JSON.stringify(plot.data) };
73
+ const linePlot = { ...plot, data: JSON.stringify(plot.data) };
74
74
  const res = await sendRequired<typeof createReqZ, typeof createResZ>(
75
75
  this.client,
76
76
  CREATE_ENDPOINT,
77
- { workspace, linePlots: [schematic_] },
77
+ { workspace, linePlots: [linePlot] },
78
78
  createReqZ,
79
79
  createResZ,
80
80
  );
@@ -82,8 +82,8 @@ export class Writer {
82
82
  return res.linePlots[0];
83
83
  }
84
84
 
85
- async delete(params: Params): Promise<void> {
86
- const normalized = toArray(params);
85
+ async delete(workspaces: Params): Promise<void> {
86
+ const normalized = toArray(workspaces);
87
87
  await sendRequired<typeof deleteReqZ, typeof deleteResZ>(
88
88
  this.client,
89
89
  DELETE_ENDPOINT,
@@ -93,21 +93,21 @@ export class Writer {
93
93
  );
94
94
  }
95
95
 
96
- async rename(schematic: Key, name: string): Promise<void> {
96
+ async rename(plot: Key, name: string): Promise<void> {
97
97
  await sendRequired<typeof renameReqZ, typeof renameResZ>(
98
98
  this.client,
99
99
  RENAME_ENDPOINT,
100
- { key: schematic, name },
100
+ { key: plot, name },
101
101
  renameReqZ,
102
102
  renameResZ,
103
103
  );
104
104
  }
105
105
 
106
- async setData(schematic: Key, data: UnknownRecord): Promise<void> {
106
+ async setData(plot: Key, data: UnknownRecord): Promise<void> {
107
107
  await sendRequired<typeof setDataReqZ, typeof setDataResZ>(
108
108
  this.client,
109
109
  SET_DATA_ENDPOINT,
110
- { key: schematic, data: JSON.stringify(data) },
110
+ { key: plot, data: JSON.stringify(data) },
111
111
  setDataReqZ,
112
112
  setDataResZ,
113
113
  );
@@ -40,8 +40,8 @@ export class Retriever {
40
40
  this.client = client;
41
41
  }
42
42
 
43
- async retrieve(params: Params): Promise<Workspace[]> {
44
- const normalized = toArray(params);
43
+ async retrieve(workspaces: Params): Promise<Workspace[]> {
44
+ const normalized = toArray(workspaces);
45
45
  return await this.execute({ keys: normalized });
46
46
  }
47
47
 
@@ -28,12 +28,12 @@ export class Retriever {
28
28
  this.client = client;
29
29
  }
30
30
 
31
- async retrieve(params: Params): Promise<Schematic[]> {
31
+ async retrieve(schematics: Params): Promise<Schematic[]> {
32
32
  return (
33
33
  await sendRequired(
34
34
  this.client,
35
35
  this.ENDPOINT,
36
- { keys: toArray(params) },
36
+ { keys: toArray(schematics) },
37
37
  reqZ,
38
38
  resZ,
39
39
  )
@@ -22,10 +22,12 @@ import {
22
22
  schematicZ,
23
23
  } from "@/workspace/schematic/payload";
24
24
 
25
- export const newSchematicZ = schematicZ.partial({ key: true, snapshot: true }).transform((p) => ({
26
- ...p,
27
- data: JSON.stringify(p.data),
28
- }));
25
+ export const newSchematicZ = schematicZ
26
+ .partial({ key: true, snapshot: true })
27
+ .transform((p) => ({
28
+ ...p,
29
+ data: JSON.stringify(p.data),
30
+ }));
29
31
 
30
32
  export type NewSchematic = z.input<typeof newSchematicZ>;
31
33
 
@@ -105,8 +107,8 @@ export class Writer {
105
107
  return res.schematic;
106
108
  }
107
109
 
108
- async delete(params: Params): Promise<void> {
109
- const normalized = toArray(params);
110
+ async delete(schematics: Params): Promise<void> {
111
+ const normalized = toArray(schematics);
110
112
  await sendRequired<typeof deleteReqZ, typeof deleteResZ>(
111
113
  this.client,
112
114
  DELETE_ENDPOINT,
package/vite.config.ts CHANGED
@@ -10,7 +10,12 @@
10
10
  import { lib } from "@synnaxlabs/vite-plugin";
11
11
  import { defineConfig } from "vite";
12
12
 
13
+ import packageJSON from "./package.json";
14
+
13
15
  export default defineConfig({
16
+ define: {
17
+ __VERSION__: JSON.stringify(packageJSON.version),
18
+ },
14
19
  plugins: [lib({ name: "client" })],
15
20
  build: {
16
21
  rollupOptions: {