@synnaxlabs/client 0.42.3 → 0.43.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 (180) hide show
  1. package/.turbo/turbo-build.log +7 -7
  2. package/.vscode/settings.json +2 -2
  3. package/CONTRIBUTING.md +6 -5
  4. package/README.md +7 -8
  5. package/dist/access/payload.d.ts +1 -1
  6. package/dist/access/payload.d.ts.map +1 -1
  7. package/dist/access/policy/payload.d.ts +9 -9
  8. package/dist/access/policy/payload.d.ts.map +1 -1
  9. package/dist/access/policy/retriever.d.ts +3 -3
  10. package/dist/access/policy/retriever.d.ts.map +1 -1
  11. package/dist/auth/auth.d.ts +2 -2
  12. package/dist/auth/auth.d.ts.map +1 -1
  13. package/dist/channel/client.d.ts +1 -0
  14. package/dist/channel/client.d.ts.map +1 -1
  15. package/dist/channel/payload.d.ts +21 -8
  16. package/dist/channel/payload.d.ts.map +1 -1
  17. package/dist/channel/retriever.d.ts +5 -5
  18. package/dist/channel/retriever.d.ts.map +1 -1
  19. package/dist/channel/writer.d.ts +3 -3
  20. package/dist/channel/writer.d.ts.map +1 -1
  21. package/dist/client.cjs +135 -39
  22. package/dist/client.d.ts +8 -8
  23. package/dist/client.d.ts.map +1 -1
  24. package/dist/client.js +28505 -9345
  25. package/dist/connection/checker.d.ts +5 -5
  26. package/dist/connection/checker.d.ts.map +1 -1
  27. package/dist/control/state.d.ts +46 -3
  28. package/dist/control/state.d.ts.map +1 -1
  29. package/dist/framer/adapter.d.ts +2 -2
  30. package/dist/framer/adapter.d.ts.map +1 -1
  31. package/dist/framer/client.d.ts +2 -0
  32. package/dist/framer/client.d.ts.map +1 -1
  33. package/dist/framer/codec.d.ts +3 -3
  34. package/dist/framer/codec.d.ts.map +1 -1
  35. package/dist/framer/deleter.d.ts +8 -8
  36. package/dist/framer/deleter.d.ts.map +1 -1
  37. package/dist/framer/frame.d.ts +17 -17
  38. package/dist/framer/frame.d.ts.map +1 -1
  39. package/dist/framer/streamProxy.d.ts +3 -3
  40. package/dist/framer/streamProxy.d.ts.map +1 -1
  41. package/dist/framer/streamer.d.ts +103 -22
  42. package/dist/framer/streamer.d.ts.map +1 -1
  43. package/dist/framer/writer.d.ts +25 -25
  44. package/dist/framer/writer.d.ts.map +1 -1
  45. package/dist/hardware/device/client.d.ts +3 -3
  46. package/dist/hardware/device/client.d.ts.map +1 -1
  47. package/dist/hardware/device/payload.d.ts +65 -18
  48. package/dist/hardware/device/payload.d.ts.map +1 -1
  49. package/dist/hardware/rack/client.d.ts.map +1 -1
  50. package/dist/hardware/rack/payload.d.ts +87 -30
  51. package/dist/hardware/rack/payload.d.ts.map +1 -1
  52. package/dist/hardware/task/client.d.ts +3 -3
  53. package/dist/hardware/task/client.d.ts.map +1 -1
  54. package/dist/hardware/task/payload.d.ts +14 -15
  55. package/dist/hardware/task/payload.d.ts.map +1 -1
  56. package/dist/label/payload.d.ts +2 -2
  57. package/dist/label/payload.d.ts.map +1 -1
  58. package/dist/label/writer.d.ts +4 -4
  59. package/dist/label/writer.d.ts.map +1 -1
  60. package/dist/ontology/client.d.ts +3 -3
  61. package/dist/ontology/client.d.ts.map +1 -1
  62. package/dist/ontology/group/payload.d.ts +2 -2
  63. package/dist/ontology/group/payload.d.ts.map +1 -1
  64. package/dist/ontology/payload.d.ts +25 -25
  65. package/dist/ontology/payload.d.ts.map +1 -1
  66. package/dist/ranger/client.d.ts +8 -8
  67. package/dist/ranger/client.d.ts.map +1 -1
  68. package/dist/ranger/kv.d.ts +6 -6
  69. package/dist/ranger/kv.d.ts.map +1 -1
  70. package/dist/ranger/payload.d.ts +15 -15
  71. package/dist/ranger/payload.d.ts.map +1 -1
  72. package/dist/ranger/writer.d.ts +10 -10
  73. package/dist/ranger/writer.d.ts.map +1 -1
  74. package/dist/testutil/{indexedPair.d.ts → channels.d.ts} +1 -1
  75. package/dist/testutil/channels.d.ts.map +1 -0
  76. package/dist/user/payload.d.ts +3 -3
  77. package/dist/user/payload.d.ts.map +1 -1
  78. package/dist/user/retriever.d.ts +2 -2
  79. package/dist/user/retriever.d.ts.map +1 -1
  80. package/dist/util/retrieve.d.ts +6 -6
  81. package/dist/util/retrieve.d.ts.map +1 -1
  82. package/dist/util/zod.d.ts +2 -2
  83. package/dist/util/zod.d.ts.map +1 -1
  84. package/dist/workspace/client.d.ts.map +1 -1
  85. package/dist/workspace/lineplot/client.d.ts.map +1 -1
  86. package/dist/workspace/lineplot/lineplot.spec.d.ts +2 -0
  87. package/dist/workspace/lineplot/lineplot.spec.d.ts.map +1 -0
  88. package/dist/workspace/lineplot/payload.d.ts +5 -5
  89. package/dist/workspace/lineplot/payload.d.ts.map +1 -1
  90. package/dist/workspace/log/client.d.ts.map +1 -1
  91. package/dist/workspace/log/payload.d.ts +5 -5
  92. package/dist/workspace/log/payload.d.ts.map +1 -1
  93. package/dist/workspace/payload.d.ts +6 -6
  94. package/dist/workspace/payload.d.ts.map +1 -1
  95. package/dist/workspace/schematic/client.d.ts.map +1 -1
  96. package/dist/workspace/schematic/payload.d.ts +7 -7
  97. package/dist/workspace/schematic/payload.d.ts.map +1 -1
  98. package/dist/workspace/table/client.d.ts.map +1 -1
  99. package/dist/workspace/table/payload.d.ts +6 -6
  100. package/dist/workspace/table/payload.d.ts.map +1 -1
  101. package/package.json +11 -12
  102. package/src/access/payload.ts +1 -1
  103. package/src/access/policy/client.ts +3 -3
  104. package/src/access/policy/payload.ts +1 -1
  105. package/src/access/policy/retriever.ts +1 -1
  106. package/src/access/policy/writer.ts +7 -7
  107. package/src/auth/auth.ts +1 -1
  108. package/src/channel/client.ts +6 -4
  109. package/src/channel/payload.ts +10 -18
  110. package/src/channel/retriever.ts +2 -2
  111. package/src/channel/writer.ts +11 -2
  112. package/src/client.ts +3 -3
  113. package/src/connection/checker.ts +1 -1
  114. package/src/connection/connection.spec.ts +1 -1
  115. package/src/control/client.ts +1 -1
  116. package/src/control/state.ts +4 -5
  117. package/src/errors.spec.ts +2 -3
  118. package/src/errors.ts +2 -2
  119. package/src/framer/adapter.ts +2 -2
  120. package/src/framer/client.ts +4 -3
  121. package/src/framer/codec.spec.ts +2 -2
  122. package/src/framer/codec.ts +5 -9
  123. package/src/framer/deleter.spec.ts +1 -1
  124. package/src/framer/deleter.ts +1 -1
  125. package/src/framer/frame.ts +15 -15
  126. package/src/framer/iterator.spec.ts +1 -1
  127. package/src/framer/iterator.ts +1 -1
  128. package/src/framer/streamProxy.ts +4 -4
  129. package/src/framer/streamer.spec.ts +420 -215
  130. package/src/framer/streamer.ts +119 -21
  131. package/src/framer/writer.spec.ts +1 -1
  132. package/src/framer/writer.ts +15 -8
  133. package/src/hardware/device/client.ts +5 -5
  134. package/src/hardware/device/device.spec.ts +28 -30
  135. package/src/hardware/device/payload.ts +5 -5
  136. package/src/hardware/rack/client.ts +4 -4
  137. package/src/hardware/rack/payload.ts +6 -6
  138. package/src/hardware/rack/rack.spec.ts +1 -1
  139. package/src/hardware/task/client.ts +21 -19
  140. package/src/hardware/task/payload.ts +8 -6
  141. package/src/label/payload.ts +1 -1
  142. package/src/label/retriever.ts +3 -3
  143. package/src/label/writer.ts +4 -4
  144. package/src/ontology/client.ts +4 -4
  145. package/src/ontology/group/payload.ts +3 -3
  146. package/src/ontology/group/writer.ts +1 -1
  147. package/src/ontology/payload.ts +2 -2
  148. package/src/ontology/writer.ts +1 -1
  149. package/src/ranger/alias.ts +1 -1
  150. package/src/ranger/client.ts +6 -4
  151. package/src/ranger/kv.ts +4 -4
  152. package/src/ranger/payload.ts +3 -3
  153. package/src/ranger/writer.ts +1 -1
  154. package/src/user/client.ts +3 -3
  155. package/src/user/payload.ts +1 -1
  156. package/src/user/retriever.ts +1 -1
  157. package/src/user/writer.ts +4 -4
  158. package/src/util/retrieve.spec.ts +7 -4
  159. package/src/util/retrieve.ts +10 -10
  160. package/src/util/zod.ts +3 -3
  161. package/src/workspace/client.ts +5 -5
  162. package/src/workspace/lineplot/client.ts +5 -5
  163. package/src/workspace/lineplot/{linePlot.spec.ts → lineplot.spec.ts} +2 -2
  164. package/src/workspace/lineplot/payload.ts +1 -1
  165. package/src/workspace/log/client.ts +5 -5
  166. package/src/workspace/log/log.spec.ts +2 -2
  167. package/src/workspace/log/payload.ts +1 -1
  168. package/src/workspace/payload.ts +1 -1
  169. package/src/workspace/schematic/client.ts +5 -5
  170. package/src/workspace/schematic/payload.ts +1 -1
  171. package/src/workspace/schematic/schematic.spec.ts +3 -3
  172. package/src/workspace/table/client.ts +5 -5
  173. package/src/workspace/table/payload.ts +1 -1
  174. package/src/workspace/table/table.spec.ts +2 -2
  175. package/src/workspace/workspace.spec.ts +2 -2
  176. package/tsconfig.json +3 -5
  177. package/dist/testutil/indexedPair.d.ts.map +0 -1
  178. package/dist/workspace/lineplot/linePlot.spec.d.ts +0 -2
  179. package/dist/workspace/lineplot/linePlot.spec.d.ts.map +0 -1
  180. /package/src/testutil/{indexedPair.ts → channels.ts} +0 -0
@@ -10,10 +10,11 @@
10
10
  import {
11
11
  binary,
12
12
  type observe,
13
+ status,
13
14
  type UnknownRecord,
14
15
  unknownRecordZ,
15
16
  } from "@synnaxlabs/x";
16
- import { z } from "zod";
17
+ import { z } from "zod/v4";
17
18
 
18
19
  import { type Key as RackKey } from "@/hardware/rack/payload";
19
20
  import { decodeJSONString } from "@/util/decodeJSONString";
@@ -26,18 +27,16 @@ export const keyZ = z.union([
26
27
  ]);
27
28
  export type Key = z.infer<typeof keyZ>;
28
29
 
29
- export const statusZ = z.enum(["info", "success", "error", "warning"]);
30
- export type Status = z.infer<typeof statusZ>;
31
-
32
30
  export const stateZ = z.object({
33
31
  task: keyZ,
34
- variant: statusZ,
32
+ variant: status.variantZ,
35
33
  key: z.string().optional(),
36
34
  details: unknownRecordZ
37
35
  .or(z.string().transform(parseWithoutKeyConversion))
38
36
  .or(z.array(z.unknown()))
39
37
  .or(z.null()) as z.ZodType<UnknownRecord | undefined>,
40
38
  });
39
+
41
40
  export interface State<Details extends {} = UnknownRecord>
42
41
  extends Omit<z.infer<typeof stateZ>, "details"> {
43
42
  details?: Details;
@@ -52,11 +51,12 @@ export const taskZ = z.object({
52
51
  state: stateZ.optional().nullable(),
53
52
  snapshot: z.boolean().optional(),
54
53
  });
54
+
55
55
  export interface Payload<
56
56
  Config extends UnknownRecord = UnknownRecord,
57
57
  Details extends {} = UnknownRecord,
58
58
  Type extends string = string,
59
- > extends Omit<z.output<typeof taskZ>, "config" | "type" | "state"> {
59
+ > extends Omit<z.infer<typeof taskZ>, "config" | "type" | "state"> {
60
60
  type: Type;
61
61
  config: Config;
62
62
  state?: State<Details> | null;
@@ -66,6 +66,7 @@ export const newZ = taskZ.omit({ key: true }).extend({
66
66
  key: keyZ.transform((k) => k.toString()).optional(),
67
67
  config: z.unknown().transform((c) => binary.JSON_CODEC.encodeString(c)),
68
68
  });
69
+
69
70
  export interface New<
70
71
  Config extends UnknownRecord = UnknownRecord,
71
72
  Type extends string = string,
@@ -84,6 +85,7 @@ export const commandZ = z.object({
84
85
  .or(z.null())
85
86
  .optional() as z.ZodOptional<z.ZodType<UnknownRecord>>,
86
87
  });
88
+
87
89
  export interface Command<Args extends {} = UnknownRecord>
88
90
  extends Omit<z.infer<typeof commandZ>, "args"> {
89
91
  args?: Args;
@@ -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/v4";
11
11
 
12
12
  export const keyZ = z.string().uuid();
13
13
  export type Key = z.infer<typeof keyZ>;
@@ -8,8 +8,8 @@
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
10
  import { type UnaryClient } from "@synnaxlabs/freighter";
11
- import { toArray } from "@synnaxlabs/x/toArray";
12
- import { z } from "zod";
11
+ import { array } from "@synnaxlabs/x/array";
12
+ import { z } from "zod/v4";
13
13
 
14
14
  import { keyZ, type Label, labelZ, type Params } from "@/label/payload";
15
15
  import { ontology } from "@/ontology";
@@ -35,7 +35,7 @@ export class Retriever {
35
35
  }
36
36
 
37
37
  async retrieve(labels: Params): Promise<Label[]> {
38
- return await this.execute({ keys: toArray(labels) });
38
+ return await this.execute({ keys: array.toArray(labels) });
39
39
  }
40
40
 
41
41
  async retrieveFor(id: ontology.ID): Promise<Label[]> {
@@ -8,8 +8,8 @@
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
10
  import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
11
- import { toArray } from "@synnaxlabs/x/toArray";
12
- import { z } from "zod";
11
+ import { array } from "@synnaxlabs/x/array";
12
+ import { z } from "zod/v4";
13
13
 
14
14
  import { type Key, keyZ, type Label, labelZ } from "@/label/payload";
15
15
  import { ontology } from "@/ontology";
@@ -52,7 +52,7 @@ export class Writer {
52
52
  const res = await sendRequired<typeof createReqZ, typeof createResZ>(
53
53
  this.client,
54
54
  CREATE_ENDPOINT,
55
- { labels: toArray(labels) },
55
+ { labels: array.toArray(labels) },
56
56
  createReqZ,
57
57
  createResZ,
58
58
  );
@@ -63,7 +63,7 @@ export class Writer {
63
63
  await sendRequired<typeof deleteReqZ, typeof emptyResZ>(
64
64
  this.client,
65
65
  DELETE_ENDPOINT,
66
- { keys: toArray(keys) },
66
+ { keys: array.toArray(keys) },
67
67
  deleteReqZ,
68
68
  emptyResZ,
69
69
  );
@@ -8,9 +8,9 @@
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
10
  import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
11
- import { observe, strings, toArray } from "@synnaxlabs/x";
11
+ import { array, observe, strings } from "@synnaxlabs/x";
12
12
  import { type AsyncTermSearcher } from "@synnaxlabs/x/search";
13
- import { z } from "zod";
13
+ import { z } from "zod/v4";
14
14
 
15
15
  import { QueryError } from "@/errors";
16
16
  import { type framer } from "@/framer";
@@ -51,7 +51,7 @@ export interface RetrieveOptions
51
51
  const retrieveResZ = z.object({ resources: resourceZ.array() });
52
52
 
53
53
  export const parseIDs = (ids: CrudeID | CrudeID[] | string | string[]): IDPayload[] =>
54
- toArray(ids).map((id) => new ID(id).payload);
54
+ array.toArray(ids).map((id) => new ID(id).payload);
55
55
 
56
56
  /** The core client class for executing queries against a Synnax cluster ontology */
57
57
  export class Client implements AsyncTermSearcher<string, string, Resource> {
@@ -120,7 +120,7 @@ export class Client implements AsyncTermSearcher<string, string, Resource> {
120
120
  if (resources.length === 0)
121
121
  throw new QueryError(
122
122
  `No resource found with ID ${strings.naturalLanguageJoin(
123
- toArray(ids).map((id) => new ID(id).toString()),
123
+ array.toArray(ids).map((id) => new ID(id).toString()),
124
124
  )}`,
125
125
  );
126
126
  return resources[0];
@@ -7,8 +7,8 @@
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 { toArray } from "@synnaxlabs/x/toArray";
11
- import { z } from "zod";
10
+ import { array } from "@synnaxlabs/x/array";
11
+ import { z } from "zod/v4";
12
12
 
13
13
  export const keyZ = z.string().uuid();
14
14
  export type Key = z.infer<typeof keyZ>;
@@ -28,7 +28,7 @@ export type ParamAnalysisResult =
28
28
  | { single: false; variant: "names"; normalized: Names; actual: Names };
29
29
 
30
30
  export const analyzeParams = (groups: Params): ParamAnalysisResult => {
31
- const normal = toArray(groups) as Keys | Names;
31
+ const normal = array.toArray(groups) as Keys | Names;
32
32
  if (normal.length === 0) throw new Error("No groups specified");
33
33
  const isKey = keyZ.safeParse(normal[0]).success;
34
34
  return {
@@ -8,7 +8,7 @@
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
10
  import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
11
- import { z } from "zod";
11
+ import { z } from "zod/v4";
12
12
 
13
13
  import {
14
14
  groupZ,
@@ -8,7 +8,7 @@
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
10
  import { type change, type UnknownRecord, unknownRecordZ } from "@synnaxlabs/x";
11
- import { z } from "zod";
11
+ import { z } from "zod/v4";
12
12
 
13
13
  import {
14
14
  ALLOW_ALL_ONTOLOGY_TYPE as ALLOW_ALL_TYPE,
@@ -137,7 +137,7 @@ export const resourceZ = z
137
137
  })
138
138
  .transform((resource) => ({ key: resource.id.toString(), ...resource }));
139
139
  export interface Resource<T extends UnknownRecord = UnknownRecord>
140
- extends Omit<z.output<typeof resourceZ>, "data"> {
140
+ extends Omit<z.infer<typeof resourceZ>, "data"> {
141
141
  data?: T | null;
142
142
  }
143
143
 
@@ -8,7 +8,7 @@
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
10
  import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
11
- import { z } from "zod";
11
+ import { z } from "zod/v4";
12
12
 
13
13
  import { type CrudeID, ID, idZ } from "@/ontology/payload";
14
14
 
@@ -9,7 +9,7 @@
9
9
 
10
10
  import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
11
11
  import { type change } from "@synnaxlabs/x/change";
12
- import { z } from "zod";
12
+ import { z } from "zod/v4";
13
13
 
14
14
  import { channel } from "@/channel";
15
15
  import { type framer } from "@/framer";
@@ -9,10 +9,10 @@
9
9
 
10
10
  import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
11
11
  import { type CrudeTimeRange, observe, sortTimeRange, TimeRange } from "@synnaxlabs/x";
12
+ import { array } from "@synnaxlabs/x/array";
12
13
  import { type AsyncTermSearcher } from "@synnaxlabs/x/search";
13
14
  import { type Series } from "@synnaxlabs/x/telem";
14
- import { toArray } from "@synnaxlabs/x/toArray";
15
- import { z } from "zod";
15
+ import { z } from "zod/v4";
16
16
 
17
17
  import { type channel } from "@/channel";
18
18
  import { MultipleFoundError, NotFoundError, QueryError } from "@/errors";
@@ -233,7 +233,9 @@ export class Client implements AsyncTermSearcher<string, Key, Range> {
233
233
  async create(ranges: New[], options?: CreateOptions): Promise<Range[]>;
234
234
  async create(ranges: New | New[], options?: CreateOptions): Promise<Range | Range[]> {
235
235
  const single = !Array.isArray(ranges);
236
- const res = this.sugarMany(await this.writer.create(toArray(ranges), options));
236
+ const res = this.sugarMany(
237
+ await this.writer.create(array.toArray(ranges), options),
238
+ );
237
239
  return single ? res[0] : res;
238
240
  }
239
241
 
@@ -242,7 +244,7 @@ export class Client implements AsyncTermSearcher<string, Key, Range> {
242
244
  }
243
245
 
244
246
  async delete(key: Key | Keys): Promise<void> {
245
- await this.writer.delete(toArray(key));
247
+ await this.writer.delete(array.toArray(key));
246
248
  }
247
249
 
248
250
  async search(term: string): Promise<Range[]> {
package/src/ranger/kv.ts CHANGED
@@ -8,9 +8,9 @@
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
10
  import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
11
+ import { array } from "@synnaxlabs/x/array";
11
12
  import { isObject } from "@synnaxlabs/x/identity";
12
- import { toArray } from "@synnaxlabs/x/toArray";
13
- import { z } from "zod";
13
+ import { z } from "zod/v4";
14
14
 
15
15
  import { type framer } from "@/framer";
16
16
  import { type Key, keyZ } from "@/ranger/payload";
@@ -51,7 +51,7 @@ export class KV {
51
51
  const res = await sendRequired(
52
52
  this.client,
53
53
  KV.GET_ENDPOINT,
54
- { range: this.rangeKey, keys: toArray(keys) },
54
+ { range: this.rangeKey, keys: array.toArray(keys) },
55
55
  getReqZ,
56
56
  getResZ,
57
57
  );
@@ -87,7 +87,7 @@ export class KV {
87
87
  await sendRequired(
88
88
  this.client,
89
89
  KV.DELETE_ENDPOINT,
90
- { range: this.rangeKey, keys: toArray(key) },
90
+ { range: this.rangeKey, keys: array.toArray(key) },
91
91
  deleteReqZ,
92
92
  z.unknown(),
93
93
  );
@@ -7,9 +7,9 @@
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 { array } from "@synnaxlabs/x/array";
10
11
  import { TimeRange } from "@synnaxlabs/x/telem";
11
- import { toArray } from "@synnaxlabs/x/toArray";
12
- import { z } from "zod";
12
+ import { z } from "zod/v4";
13
13
 
14
14
  export const keyZ = z.string().uuid();
15
15
  export type Key = z.infer<typeof keyZ>;
@@ -43,7 +43,7 @@ export type ParamAnalysisResult =
43
43
  };
44
44
 
45
45
  export const analyzeParams = (ranges: Params): ParamAnalysisResult => {
46
- const normal = toArray(ranges) as Keys | Names;
46
+ const normal = array.toArray(ranges) as Keys | Names;
47
47
  const empty = normal.length === 0;
48
48
  let isKey = false;
49
49
  if (!empty) isKey = keyZ.safeParse(normal[0]).success;
@@ -8,7 +8,7 @@
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
10
  import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
11
- import { z } from "zod";
11
+ import { z } from "zod/v4";
12
12
 
13
13
  import { ontology } from "@/ontology";
14
14
  import { keyZ, nameZ, type New, newZ, type Payload, payloadZ } from "@/ranger/payload";
@@ -8,7 +8,7 @@
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
10
  import { type UnaryClient } from "@synnaxlabs/freighter";
11
- import { toArray } from "@synnaxlabs/x";
11
+ import { array } from "@synnaxlabs/x";
12
12
 
13
13
  import { MultipleFoundError, NotFoundError } from "@/errors";
14
14
  import { ontology } from "@/ontology";
@@ -45,7 +45,7 @@ export class Client {
45
45
 
46
46
  async retrieve(keys: Key | Key[]): Promise<User | User[]> {
47
47
  const isMany = Array.isArray(keys);
48
- const res = await this.reader.retrieve({ keys: toArray(keys) });
48
+ const res = await this.reader.retrieve({ keys: array.toArray(keys) });
49
49
  if (isMany) return res;
50
50
  if (res.length === 0) throw new NotFoundError(`No user with key ${keys} found`);
51
51
  if (res.length > 1)
@@ -59,7 +59,7 @@ export class Client {
59
59
 
60
60
  async retrieveByName(usernames: string | string[]): Promise<User | User[]> {
61
61
  const isMany = Array.isArray(usernames);
62
- const res = await this.reader.retrieve({ usernames: toArray(usernames) });
62
+ const res = await this.reader.retrieve({ usernames: array.toArray(usernames) });
63
63
  if (isMany) return res;
64
64
  if (res.length === 0)
65
65
  throw new NotFoundError(`No user with username ${usernames} found`);
@@ -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/v4";
11
11
 
12
12
  export const keyZ = z.string().uuid();
13
13
  export type Key = z.infer<typeof keyZ>;
@@ -8,7 +8,7 @@
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
10
  import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
11
- import { z } from "zod";
11
+ import { z } from "zod/v4";
12
12
 
13
13
  import { keyZ, type User, userZ } from "@/user/payload";
14
14
  import { nullableArrayZ } from "@/util/zod";
@@ -8,8 +8,8 @@
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
10
  import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
11
- import { toArray } from "@synnaxlabs/x/toArray";
12
- import { z } from "zod";
11
+ import { array } from "@synnaxlabs/x/array";
12
+ import { z } from "zod/v4";
13
13
 
14
14
  import { type Key, keyZ, type New, newZ, type User, userZ } from "@/user/payload";
15
15
 
@@ -45,7 +45,7 @@ export class Writer {
45
45
  const res = await sendRequired<typeof createReqZ, typeof createResZ>(
46
46
  this.client,
47
47
  CREATE_ENDPOINT,
48
- { users: toArray(users) },
48
+ { users: array.toArray(users) },
49
49
  createReqZ,
50
50
  createResZ,
51
51
  );
@@ -76,7 +76,7 @@ export class Writer {
76
76
  await sendRequired<typeof deleteReqZ, typeof deleteResZ>(
77
77
  this.client,
78
78
  DELETE_ENDPOINT,
79
- { keys: toArray(keys) },
79
+ { keys: array.toArray(keys) },
80
80
  deleteReqZ,
81
81
  deleteResZ,
82
82
  );
@@ -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 Primitive } from "@synnaxlabs/x";
10
+ import { type primitive } from "@synnaxlabs/x";
11
11
  import { describe, expect, it } from "vitest";
12
12
 
13
13
  import {
@@ -19,9 +19,12 @@ import {
19
19
  describe("retrieve utils", () => {
20
20
  describe("analyze params", () => {
21
21
  interface Spec {
22
- args: Primitive extends any ? any : never;
23
- variantMap: PartialTypeNameRecord<Primitive>;
24
- expected: ParamAnalysisResult<Primitive, PartialTypeNameRecord<Primitive>>;
22
+ args: primitive.Value;
23
+ variantMap: PartialTypeNameRecord<primitive.Value>;
24
+ expected: ParamAnalysisResult<
25
+ primitive.Value,
26
+ PartialTypeNameRecord<primitive.Value>
27
+ >;
25
28
  }
26
29
 
27
30
  const SPECS: Spec[] = [
@@ -7,21 +7,21 @@
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 Primitive, toArray } from "@synnaxlabs/x";
10
+ import { array, type primitive } from "@synnaxlabs/x";
11
11
 
12
12
  import { MultipleFoundError, NotFoundError } from "@/errors";
13
13
 
14
14
  export type SingleParamAnalysisResult<
15
- T extends Primitive,
15
+ T extends primitive.Value,
16
16
  K extends PartialTypeNameRecord<T>,
17
- > = T extends any
17
+ > = T extends unknown
18
18
  ? { single: true; variant: K[keyof K]; normalized: T[]; actual: T }
19
19
  : never;
20
20
 
21
21
  export type MultiParamAnalysisResult<
22
- T extends Primitive,
22
+ T extends primitive.Value,
23
23
  K extends PartialTypeNameRecord<T>,
24
- > = T extends any
24
+ > = T extends unknown
25
25
  ? { single: false; variant: K[keyof K]; normalized: T[]; actual: T[] }
26
26
  : never;
27
27
 
@@ -37,12 +37,12 @@ type TypeName<T> = T extends string
37
37
  ? "function"
38
38
  : "object";
39
39
 
40
- export type PartialTypeNameRecord<T extends Primitive> = Partial<
40
+ export type PartialTypeNameRecord<T extends primitive.Value> = Partial<
41
41
  Record<TypeName<T>, string>
42
42
  >;
43
43
 
44
44
  export type ParamAnalysisResult<
45
- T extends Primitive,
45
+ T extends primitive.Value,
46
46
  K extends PartialTypeNameRecord<T> = PartialTypeNameRecord<T>,
47
47
  > = SingleParamAnalysisResult<T, K> | MultiParamAnalysisResult<T, K>;
48
48
 
@@ -51,15 +51,15 @@ export interface AnalyzeParamsOptions {
51
51
  }
52
52
 
53
53
  export const analyzeParams = <
54
- T extends Primitive = Primitive,
54
+ T extends primitive.Value = primitive.Value,
55
55
  K extends PartialTypeNameRecord<T> = PartialTypeNameRecord<T>,
56
56
  >(
57
- args: T extends any ? T | T[] : never,
57
+ args: T extends unknown ? T | T[] : never,
58
58
  variantMap: K,
59
59
  { convertNumericStrings = true }: AnalyzeParamsOptions = {},
60
60
  ): ParamAnalysisResult<T, K> => {
61
61
  const isSingle = !Array.isArray(args);
62
- let normal = toArray(args);
62
+ let normal = array.toArray(args);
63
63
  const first = normal[0];
64
64
  const t = typeof first;
65
65
  let variant: K[keyof K];
package/src/util/zod.ts CHANGED
@@ -7,10 +7,10 @@
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/v4";
11
11
 
12
- export const nullableArrayZ = <Z extends z.ZodTypeAny>(item: Z) =>
12
+ export const nullableArrayZ = <Z extends z.ZodType>(item: Z) =>
13
13
  z.union([
14
- z.union([z.null(), z.undefined()]).transform(() => [] as z.output<Z>[]),
14
+ z.union([z.null(), z.undefined()]).transform<z.infer<Z>[]>(() => []),
15
15
  item.array(),
16
16
  ]);
@@ -8,9 +8,9 @@
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
10
  import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
11
- import { toArray, type UnknownRecord } from "@synnaxlabs/x";
11
+ import { array, type UnknownRecord } from "@synnaxlabs/x";
12
12
  import { type AsyncTermSearcher } from "@synnaxlabs/x/search";
13
- import { z } from "zod";
13
+ import { z } from "zod/v4";
14
14
 
15
15
  import { ontology } from "@/ontology";
16
16
  import { type Key as UserKey, keyZ as userKeyZ } from "@/user/payload";
@@ -76,7 +76,7 @@ export class Client implements AsyncTermSearcher<string, Key, Workspace> {
76
76
  const res = await sendRequired(
77
77
  this.client,
78
78
  CREATE_ENDPOINT,
79
- { workspaces: toArray(workspaces) },
79
+ { workspaces: array.toArray(workspaces) },
80
80
  createReqZ,
81
81
  createResZ,
82
82
  );
@@ -110,7 +110,7 @@ export class Client implements AsyncTermSearcher<string, Key, Workspace> {
110
110
  const res = await sendRequired(
111
111
  this.client,
112
112
  RETRIEVE_ENDPOINT,
113
- { keys: toArray(keys) },
113
+ { keys: array.toArray(keys) },
114
114
  retrieveReqZ,
115
115
  retrieveResZ,
116
116
  );
@@ -156,7 +156,7 @@ export class Client implements AsyncTermSearcher<string, Key, Workspace> {
156
156
  await sendRequired(
157
157
  this.client,
158
158
  DELETE_ENDPOINT,
159
- { keys: toArray(keys) },
159
+ { keys: array.toArray(keys) },
160
160
  deleteReqZ,
161
161
  emptyResZ,
162
162
  );
@@ -8,8 +8,8 @@
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
10
  import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
11
- import { toArray, type UnknownRecord } from "@synnaxlabs/x";
12
- import { z } from "zod";
11
+ import { array, type UnknownRecord } from "@synnaxlabs/x";
12
+ import { z } from "zod/v4";
13
13
 
14
14
  import { ontology } from "@/ontology";
15
15
  import { nullableArrayZ } from "@/util/zod";
@@ -57,7 +57,7 @@ export class Client {
57
57
  const res = await sendRequired(
58
58
  this.client,
59
59
  CREATE_ENDPOINT,
60
- { workspace, linePlots: toArray(linePlots) },
60
+ { workspace, linePlots: array.toArray(linePlots) },
61
61
  createReqZ,
62
62
  createResZ,
63
63
  );
@@ -91,7 +91,7 @@ export class Client {
91
91
  const res = await sendRequired(
92
92
  this.client,
93
93
  RETRIEVE_ENDPOINT,
94
- { keys: toArray(keys) },
94
+ { keys: array.toArray(keys) },
95
95
  retrieveReqZ,
96
96
  retrieveResZ,
97
97
  );
@@ -104,7 +104,7 @@ export class Client {
104
104
  await sendRequired(
105
105
  this.client,
106
106
  DELETE_ENDPOINT,
107
- { keys: toArray(keys) },
107
+ { keys: array.toArray(keys) },
108
108
  deleteReqZ,
109
109
  emptyResZ,
110
110
  );
@@ -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 { NIL as ZERO_UUID } from "uuid";
10
+ import { uuid } from "@synnaxlabs/x";
11
11
  import { describe, expect, test } from "vitest";
12
12
 
13
13
  import { newClient } from "@/setupspecs";
@@ -26,7 +26,7 @@ describe("LinePlot", () => {
26
26
  data: { one: 1 },
27
27
  });
28
28
  expect(linePlot.name).toEqual("Line Plot");
29
- expect(linePlot.key).not.toEqual(ZERO_UUID);
29
+ expect(linePlot.key).not.toEqual(uuid.ZERO);
30
30
  expect(linePlot.data.one).toEqual(1);
31
31
  });
32
32
  });
@@ -8,7 +8,7 @@
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
10
  import { unknownRecordZ } from "@synnaxlabs/x/record";
11
- import { z } from "zod";
11
+ import { z } from "zod/v4";
12
12
 
13
13
  import { parseWithoutKeyConversion } from "@/util/parseWithoutKeyConversion";
14
14
 
@@ -8,8 +8,8 @@
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
10
  import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
11
- import { toArray, type UnknownRecord } from "@synnaxlabs/x";
12
- import { z } from "zod";
11
+ import { array, type UnknownRecord } from "@synnaxlabs/x";
12
+ import { z } from "zod/v4";
13
13
 
14
14
  import { ontology } from "@/ontology";
15
15
  import {
@@ -54,7 +54,7 @@ export class Client {
54
54
  const res = await sendRequired(
55
55
  this.client,
56
56
  CREATE_ENDPOINT,
57
- { workspace, logs: toArray(logs) },
57
+ { workspace, logs: array.toArray(logs) },
58
58
  createReqZ,
59
59
  createResZ,
60
60
  );
@@ -88,7 +88,7 @@ export class Client {
88
88
  const res = await sendRequired(
89
89
  this.client,
90
90
  RETRIEVE_ENDPOINT,
91
- { keys: toArray(keys) },
91
+ { keys: array.toArray(keys) },
92
92
  retrieveReqZ,
93
93
  retrieveResZ,
94
94
  );
@@ -101,7 +101,7 @@ export class Client {
101
101
  await sendRequired(
102
102
  this.client,
103
103
  DELETE_ENDPOINT,
104
- { keys: toArray(keys) },
104
+ { keys: array.toArray(keys) },
105
105
  deleteReqZ,
106
106
  emptyResZ,
107
107
  );
@@ -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 { NIL as ZERO_UUID } from "uuid";
10
+ import { uuid } from "@synnaxlabs/x";
11
11
  import { describe, expect, test } from "vitest";
12
12
 
13
13
  import { newClient } from "@/setupspecs";
@@ -23,7 +23,7 @@ describe("Log", () => {
23
23
  data: { one: 1 },
24
24
  });
25
25
  expect(log.name).toEqual("Log");
26
- expect(log.key).not.toEqual(ZERO_UUID);
26
+ expect(log.key).not.toEqual(uuid.ZERO);
27
27
  expect(log.data.one).toEqual(1);
28
28
  });
29
29
  });