@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.
Files changed (245) hide show
  1. package/.turbo/turbo-build.log +7 -7
  2. package/dist/access/payload.d.ts +1 -1
  3. package/dist/access/payload.d.ts.map +1 -1
  4. package/dist/access/policy/client.d.ts +263 -6
  5. package/dist/access/policy/client.d.ts.map +1 -1
  6. package/dist/access/policy/external.d.ts +0 -1
  7. package/dist/access/policy/external.d.ts.map +1 -1
  8. package/dist/access/policy/payload.d.ts +105 -93
  9. package/dist/access/policy/payload.d.ts.map +1 -1
  10. package/dist/auth/auth.d.ts +1 -1
  11. package/dist/auth/auth.d.ts.map +1 -1
  12. package/dist/channel/client.d.ts +23 -17
  13. package/dist/channel/client.d.ts.map +1 -1
  14. package/dist/channel/payload.d.ts +151 -21
  15. package/dist/channel/payload.d.ts.map +1 -1
  16. package/dist/channel/retriever.d.ts +9 -16
  17. package/dist/channel/retriever.d.ts.map +1 -1
  18. package/dist/channel/writer.d.ts +1 -1
  19. package/dist/channel/writer.d.ts.map +1 -1
  20. package/dist/client.cjs +27 -135
  21. package/dist/client.d.ts +3 -3
  22. package/dist/client.d.ts.map +1 -1
  23. package/dist/client.js +8657 -28963
  24. package/dist/connection/checker.d.ts +1 -1
  25. package/dist/connection/checker.d.ts.map +1 -1
  26. package/dist/control/client.d.ts +1 -0
  27. package/dist/control/client.d.ts.map +1 -1
  28. package/dist/control/state.d.ts +6 -6
  29. package/dist/control/state.d.ts.map +1 -1
  30. package/dist/errors.d.ts +18 -5
  31. package/dist/errors.d.ts.map +1 -1
  32. package/dist/framer/adapter.d.ts +3 -3
  33. package/dist/framer/adapter.d.ts.map +1 -1
  34. package/dist/framer/client.d.ts +4 -13
  35. package/dist/framer/client.d.ts.map +1 -1
  36. package/dist/framer/codec.d.ts +1 -1
  37. package/dist/framer/codec.d.ts.map +1 -1
  38. package/dist/framer/deleter.d.ts +5 -5
  39. package/dist/framer/deleter.d.ts.map +1 -1
  40. package/dist/framer/frame.d.ts +5 -7
  41. package/dist/framer/frame.d.ts.map +1 -1
  42. package/dist/framer/streamProxy.d.ts +1 -1
  43. package/dist/framer/streamProxy.d.ts.map +1 -1
  44. package/dist/framer/streamer.d.ts +235 -20
  45. package/dist/framer/streamer.d.ts.map +1 -1
  46. package/dist/framer/writer.d.ts +302 -33
  47. package/dist/framer/writer.d.ts.map +1 -1
  48. package/dist/hardware/device/client.d.ts +49 -28
  49. package/dist/hardware/device/client.d.ts.map +1 -1
  50. package/dist/hardware/device/payload.d.ts +126 -46
  51. package/dist/hardware/device/payload.d.ts.map +1 -1
  52. package/dist/hardware/rack/client.d.ts +78 -22
  53. package/dist/hardware/rack/client.d.ts.map +1 -1
  54. package/dist/hardware/rack/payload.d.ts +99 -56
  55. package/dist/hardware/rack/payload.d.ts.map +1 -1
  56. package/dist/hardware/task/client.d.ts +100 -41
  57. package/dist/hardware/task/client.d.ts.map +1 -1
  58. package/dist/hardware/task/payload.d.ts +83 -61
  59. package/dist/hardware/task/payload.d.ts.map +1 -1
  60. package/dist/index.d.ts +2 -2
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/label/client.d.ts +138 -20
  63. package/dist/label/client.d.ts.map +1 -1
  64. package/dist/label/external.d.ts +0 -2
  65. package/dist/label/external.d.ts.map +1 -1
  66. package/dist/label/payload.d.ts +4 -5
  67. package/dist/label/payload.d.ts.map +1 -1
  68. package/dist/ontology/client.d.ts +45 -135
  69. package/dist/ontology/client.d.ts.map +1 -1
  70. package/dist/ontology/group/group.d.ts +3 -3
  71. package/dist/ontology/group/group.d.ts.map +1 -1
  72. package/dist/ontology/group/payload.d.ts +3 -27
  73. package/dist/ontology/group/payload.d.ts.map +1 -1
  74. package/dist/ontology/payload.d.ts +114 -243
  75. package/dist/ontology/payload.d.ts.map +1 -1
  76. package/dist/ontology/writer.d.ts +4 -4
  77. package/dist/ontology/writer.d.ts.map +1 -1
  78. package/dist/ranger/alias.d.ts +15 -5
  79. package/dist/ranger/alias.d.ts.map +1 -1
  80. package/dist/ranger/client.d.ts +91 -30
  81. package/dist/ranger/client.d.ts.map +1 -1
  82. package/dist/ranger/external.d.ts +1 -1
  83. package/dist/ranger/external.d.ts.map +1 -1
  84. package/dist/ranger/kv.d.ts +11 -12
  85. package/dist/ranger/kv.d.ts.map +1 -1
  86. package/dist/ranger/payload.d.ts +19 -44
  87. package/dist/ranger/payload.d.ts.map +1 -1
  88. package/dist/ranger/writer.d.ts +22 -19
  89. package/dist/ranger/writer.d.ts.map +1 -1
  90. package/dist/testutil/client.d.ts +4 -0
  91. package/dist/testutil/client.d.ts.map +1 -0
  92. package/dist/user/client.d.ts +59 -6
  93. package/dist/user/client.d.ts.map +1 -1
  94. package/dist/user/payload.d.ts +4 -6
  95. package/dist/user/payload.d.ts.map +1 -1
  96. package/dist/user/retriever.d.ts +2 -2
  97. package/dist/user/retriever.d.ts.map +1 -1
  98. package/dist/util/decodeJSONString.d.ts +2 -2
  99. package/dist/util/decodeJSONString.d.ts.map +1 -1
  100. package/dist/util/parseWithoutKeyConversion.d.ts +2 -2
  101. package/dist/util/parseWithoutKeyConversion.d.ts.map +1 -1
  102. package/dist/util/retrieve.d.ts +1 -1
  103. package/dist/util/retrieve.d.ts.map +1 -1
  104. package/dist/util/zod.d.ts +1 -1
  105. package/dist/util/zod.d.ts.map +1 -1
  106. package/dist/workspace/client.d.ts +17 -6
  107. package/dist/workspace/client.d.ts.map +1 -1
  108. package/dist/workspace/lineplot/client.d.ts +2 -2
  109. package/dist/workspace/lineplot/client.d.ts.map +1 -1
  110. package/dist/workspace/lineplot/payload.d.ts +8 -9
  111. package/dist/workspace/lineplot/payload.d.ts.map +1 -1
  112. package/dist/workspace/log/client.d.ts +2 -2
  113. package/dist/workspace/log/client.d.ts.map +1 -1
  114. package/dist/workspace/log/payload.d.ts +8 -9
  115. package/dist/workspace/log/payload.d.ts.map +1 -1
  116. package/dist/workspace/payload.d.ts +10 -11
  117. package/dist/workspace/payload.d.ts.map +1 -1
  118. package/dist/workspace/schematic/client.d.ts +2 -2
  119. package/dist/workspace/schematic/client.d.ts.map +1 -1
  120. package/dist/workspace/schematic/payload.d.ts +10 -11
  121. package/dist/workspace/schematic/payload.d.ts.map +1 -1
  122. package/dist/workspace/table/client.d.ts +2 -2
  123. package/dist/workspace/table/client.d.ts.map +1 -1
  124. package/dist/workspace/table/payload.d.ts +10 -11
  125. package/dist/workspace/table/payload.d.ts.map +1 -1
  126. package/examples/node/package-lock.json +47 -39
  127. package/examples/node/package.json +2 -1
  128. package/examples/node/streamWrite.js +5 -11
  129. package/package.json +14 -13
  130. package/src/access/payload.ts +1 -1
  131. package/src/access/policy/client.ts +87 -32
  132. package/src/access/policy/external.ts +0 -1
  133. package/src/access/policy/payload.ts +4 -4
  134. package/src/access/policy/policy.spec.ts +86 -83
  135. package/src/auth/auth.spec.ts +29 -18
  136. package/src/auth/auth.ts +1 -1
  137. package/src/channel/batchRetriever.spec.ts +4 -9
  138. package/src/channel/channel.spec.ts +24 -6
  139. package/src/channel/client.ts +52 -51
  140. package/src/channel/payload.ts +15 -16
  141. package/src/channel/retriever.ts +26 -41
  142. package/src/channel/writer.ts +7 -4
  143. package/src/client.ts +4 -4
  144. package/src/connection/checker.ts +1 -1
  145. package/src/connection/connection.spec.ts +31 -23
  146. package/src/control/client.ts +2 -2
  147. package/src/control/state.spec.ts +3 -3
  148. package/src/control/state.ts +1 -1
  149. package/src/errors.spec.ts +9 -5
  150. package/src/errors.ts +28 -15
  151. package/src/framer/adapter.spec.ts +118 -9
  152. package/src/framer/adapter.ts +24 -11
  153. package/src/framer/client.spec.ts +125 -2
  154. package/src/framer/client.ts +41 -47
  155. package/src/framer/codec.ts +1 -1
  156. package/src/framer/deleter.spec.ts +2 -2
  157. package/src/framer/deleter.ts +1 -1
  158. package/src/framer/frame.ts +1 -4
  159. package/src/framer/iterator.spec.ts +8 -8
  160. package/src/framer/iterator.ts +1 -1
  161. package/src/framer/streamProxy.ts +1 -1
  162. package/src/framer/streamer.spec.ts +185 -36
  163. package/src/framer/streamer.ts +28 -36
  164. package/src/framer/writer.spec.ts +7 -6
  165. package/src/framer/writer.ts +97 -111
  166. package/src/hardware/device/client.ts +45 -131
  167. package/src/hardware/device/device.spec.ts +163 -52
  168. package/src/hardware/device/payload.ts +10 -21
  169. package/src/hardware/rack/client.ts +87 -105
  170. package/src/hardware/rack/payload.ts +4 -13
  171. package/src/hardware/rack/rack.spec.ts +28 -35
  172. package/src/hardware/task/client.ts +335 -291
  173. package/src/hardware/task/payload.ts +86 -62
  174. package/src/hardware/task/task.spec.ts +208 -32
  175. package/src/index.ts +2 -1
  176. package/src/label/client.ts +100 -95
  177. package/src/label/external.ts +0 -2
  178. package/src/label/label.spec.ts +8 -6
  179. package/src/label/payload.ts +3 -4
  180. package/src/ontology/client.ts +41 -324
  181. package/src/ontology/group/group.spec.ts +2 -2
  182. package/src/ontology/group/group.ts +4 -5
  183. package/src/ontology/group/payload.ts +2 -25
  184. package/src/ontology/group/writer.ts +1 -1
  185. package/src/ontology/ontology.spec.ts +355 -41
  186. package/src/ontology/payload.ts +77 -112
  187. package/src/ontology/writer.ts +8 -17
  188. package/src/ranger/alias.ts +45 -37
  189. package/src/ranger/client.ts +144 -149
  190. package/src/ranger/external.ts +1 -1
  191. package/src/ranger/kv.ts +9 -27
  192. package/src/ranger/payload.ts +23 -37
  193. package/src/ranger/ranger.spec.ts +37 -56
  194. package/src/ranger/writer.ts +1 -1
  195. package/src/{signals/index.ts → testutil/client.ts} +11 -1
  196. package/src/user/client.ts +122 -47
  197. package/src/user/payload.ts +2 -5
  198. package/src/user/retriever.ts +1 -1
  199. package/src/user/user.spec.ts +31 -31
  200. package/src/user/writer.ts +1 -1
  201. package/src/util/decodeJSONString.ts +3 -3
  202. package/src/util/parseWithoutKeyConversion.ts +2 -2
  203. package/src/util/retrieve.ts +1 -1
  204. package/src/util/zod.ts +1 -1
  205. package/src/workspace/client.ts +20 -36
  206. package/src/workspace/lineplot/client.ts +5 -7
  207. package/src/workspace/lineplot/lineplot.spec.ts +2 -2
  208. package/src/workspace/lineplot/payload.ts +4 -7
  209. package/src/workspace/log/client.ts +5 -7
  210. package/src/workspace/log/log.spec.ts +2 -2
  211. package/src/workspace/log/payload.ts +4 -7
  212. package/src/workspace/payload.ts +4 -7
  213. package/src/workspace/schematic/client.ts +5 -7
  214. package/src/workspace/schematic/payload.ts +4 -7
  215. package/src/workspace/schematic/schematic.spec.ts +2 -2
  216. package/src/workspace/table/client.ts +5 -7
  217. package/src/workspace/table/payload.ts +4 -7
  218. package/src/workspace/table/table.spec.ts +2 -2
  219. package/src/workspace/workspace.spec.ts +2 -2
  220. package/dist/access/policy/ontology.d.ts +0 -5
  221. package/dist/access/policy/ontology.d.ts.map +0 -1
  222. package/dist/access/policy/retriever.d.ts +0 -40
  223. package/dist/access/policy/retriever.d.ts.map +0 -1
  224. package/dist/access/policy/writer.d.ts +0 -9
  225. package/dist/access/policy/writer.d.ts.map +0 -1
  226. package/dist/label/retriever.d.ts +0 -14
  227. package/dist/label/retriever.d.ts.map +0 -1
  228. package/dist/label/writer.d.ts +0 -54
  229. package/dist/label/writer.d.ts.map +0 -1
  230. package/dist/setupspecs.d.ts +0 -5
  231. package/dist/setupspecs.d.ts.map +0 -1
  232. package/dist/signals/external.d.ts +0 -2
  233. package/dist/signals/external.d.ts.map +0 -1
  234. package/dist/signals/index.d.ts +0 -2
  235. package/dist/signals/index.d.ts.map +0 -1
  236. package/dist/signals/observable.d.ts +0 -12
  237. package/dist/signals/observable.d.ts.map +0 -1
  238. package/src/access/policy/ontology.ts +0 -17
  239. package/src/access/policy/retriever.ts +0 -44
  240. package/src/access/policy/writer.ts +0 -65
  241. package/src/label/retriever.ts +0 -63
  242. package/src/label/writer.ts +0 -95
  243. package/src/setupspecs.ts +0 -27
  244. package/src/signals/external.ts +0 -10
  245. 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 UnknownRecord } from "@synnaxlabs/x/record";
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): UnknownRecord =>
18
+ export const parseWithoutKeyConversion = (s: string): record.Unknown =>
19
19
  s ? JSON.parse(s) : {};
@@ -33,7 +33,7 @@ type TypeName<T> = T extends string
33
33
  ? "boolean"
34
34
  : T extends undefined
35
35
  ? "undefined"
36
- : T extends Function
36
+ : T extends (...args: any[]) => any
37
37
  ? "function"
38
38
  : "object";
39
39
 
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/v4";
10
+ import { z } from "zod";
11
11
 
12
12
  export const nullableArrayZ = <Z extends z.ZodType>(item: Z) =>
13
13
  z.union([
@@ -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 UnknownRecord } from "@synnaxlabs/x";
12
- import { type AsyncTermSearcher } from "@synnaxlabs/x/search";
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
- search: z.string().optional(),
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 class Client implements AsyncTermSearcher<string, Key, Workspace> {
57
- readonly type = ONTOLOGY_TYPE;
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: UnknownRecord): Promise<void> {
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(keys: Params): Promise<Workspace | Workspace[]> {
109
- const isMany = Array.isArray(keys);
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
- { keys: array.toArray(keys) },
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 UnknownRecord } from "@synnaxlabs/x";
12
- import { z } from "zod/v4";
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: UnknownRecord): Promise<void> {
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 { newClient } from "@/setupspecs";
13
+ import { createTestClient } from "@/testutil/client";
14
14
 
15
- const client = newClient();
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 { unknownRecordZ } from "@synnaxlabs/x/record";
11
- import { z } from "zod/v4";
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.string().uuid();
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: unknownRecordZ.or(z.string().transform(parseWithoutKeyConversion)),
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 UnknownRecord } from "@synnaxlabs/x";
12
- import { z } from "zod/v4";
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: UnknownRecord): Promise<void> {
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 { newClient } from "@/setupspecs";
13
+ import { createTestClient } from "@/testutil/client";
14
14
 
15
- const client = newClient();
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 { unknownRecordZ } from "@synnaxlabs/x/record";
11
- import { z } from "zod/v4";
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.string().uuid();
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: unknownRecordZ.or(z.string().transform(parseWithoutKeyConversion)),
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;
@@ -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 { unknownRecordZ } from "@synnaxlabs/x/record";
11
- import { z } from "zod/v4";
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.string().uuid();
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: unknownRecordZ.or(z.string().transform(parseWithoutKeyConversion)),
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 UnknownRecord } from "@synnaxlabs/x";
12
- import { z } from "zod/v4";
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: UnknownRecord): Promise<void> {
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 { unknownRecordZ } from "@synnaxlabs/x/record";
11
- import { z } from "zod/v4";
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.string().uuid();
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: unknownRecordZ.or(z.string().transform(parseWithoutKeyConversion)),
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 { newClient } from "@/setupspecs";
14
+ import { createTestClient } from "@/testutil/client";
15
15
 
16
- const client = newClient();
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 UnknownRecord } from "@synnaxlabs/x";
12
- import { z } from "zod/v4";
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: UnknownRecord): Promise<void> {
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 { unknownRecordZ } from "@synnaxlabs/x/record";
11
- import { z } from "zod/v4";
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.string().uuid();
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: unknownRecordZ.or(z.string().transform(parseWithoutKeyConversion)),
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 { newClient } from "@/setupspecs";
13
+ import { createTestClient } from "@/testutil/client";
14
14
 
15
- const client = newClient();
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 { newClient } from "@/setupspecs";
13
+ import { createTestClient } from "@/testutil/client";
14
14
 
15
- const client = newClient();
15
+ const client = createTestClient();
16
16
 
17
17
  describe("Workspace", () => {
18
18
  describe("create", () => {
@@ -1,5 +0,0 @@
1
- export declare const ONTOLOGY_TYPE = "policy";
2
- export type OntologyType = typeof ONTOLOGY_TYPE;
3
- export declare const ALLOW_ALL_ONTOLOGY_TYPE = "allow_all";
4
- export type AllowAllOntologyType = typeof ALLOW_ALL_ONTOLOGY_TYPE;
5
- //# sourceMappingURL=ontology.d.ts.map
@@ -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"}