@synnaxlabs/client 0.22.0 → 0.23.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 (229) hide show
  1. package/.turbo/turbo-build.log +7 -6
  2. package/dist/auth/auth.d.ts.map +1 -1
  3. package/dist/channel/client.d.ts +14 -4
  4. package/dist/channel/client.d.ts.map +1 -1
  5. package/dist/channel/creator.d.ts +1 -1
  6. package/dist/channel/creator.d.ts.map +1 -1
  7. package/dist/channel/external.d.ts +1 -1
  8. package/dist/channel/external.d.ts.map +1 -1
  9. package/dist/channel/payload.d.ts +21 -8
  10. package/dist/channel/payload.d.ts.map +1 -1
  11. package/dist/channel/retriever.d.ts +6 -6
  12. package/dist/channel/retriever.d.ts.map +1 -1
  13. package/dist/channel/writer.d.ts +13 -1
  14. package/dist/channel/writer.d.ts.map +1 -1
  15. package/dist/client.cjs +17 -18
  16. package/dist/client.d.ts +4 -2
  17. package/dist/client.d.ts.map +1 -1
  18. package/dist/client.js +5487 -13607
  19. package/dist/connection/checker.d.ts +4 -4
  20. package/dist/control/client.d.ts +9 -0
  21. package/dist/control/client.d.ts.map +1 -0
  22. package/dist/control/external.d.ts +1 -1
  23. package/dist/control/external.d.ts.map +1 -1
  24. package/dist/control/state.d.ts +17 -52
  25. package/dist/control/state.d.ts.map +1 -1
  26. package/dist/errors.d.ts +6 -0
  27. package/dist/errors.d.ts.map +1 -1
  28. package/dist/framer/adapter.d.ts +1 -1
  29. package/dist/framer/adapter.d.ts.map +1 -1
  30. package/dist/framer/client.d.ts +7 -5
  31. package/dist/framer/client.d.ts.map +1 -1
  32. package/dist/framer/deleter.d.ts +68 -0
  33. package/dist/framer/deleter.d.ts.map +1 -0
  34. package/dist/framer/deleter.spec.d.ts +2 -0
  35. package/dist/framer/deleter.spec.d.ts.map +1 -0
  36. package/dist/framer/frame.d.ts +45 -241
  37. package/dist/framer/frame.d.ts.map +1 -1
  38. package/dist/framer/iterator.d.ts +1 -1
  39. package/dist/framer/iterator.d.ts.map +1 -1
  40. package/dist/framer/streamProxy.d.ts.map +1 -1
  41. package/dist/framer/streamer.d.ts.map +1 -1
  42. package/dist/framer/writer.d.ts +86 -231
  43. package/dist/framer/writer.d.ts.map +1 -1
  44. package/dist/hardware/device/client.d.ts +9 -7
  45. package/dist/hardware/device/client.d.ts.map +1 -1
  46. package/dist/hardware/task/client.d.ts +17 -14
  47. package/dist/hardware/task/client.d.ts.map +1 -1
  48. package/dist/index.d.ts +12 -11
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/label/client.d.ts.map +1 -1
  51. package/dist/label/external.d.ts +2 -2
  52. package/dist/label/external.d.ts.map +1 -1
  53. package/dist/label/writer.d.ts +4 -2
  54. package/dist/label/writer.d.ts.map +1 -1
  55. package/dist/ontology/client.d.ts +8 -8
  56. package/dist/ontology/client.d.ts.map +1 -1
  57. package/dist/ontology/group/client.d.ts +1 -1
  58. package/dist/ontology/group/client.d.ts.map +1 -1
  59. package/dist/ontology/group/external.d.ts +1 -1
  60. package/dist/ontology/group/external.d.ts.map +1 -1
  61. package/dist/ontology/group/writer.d.ts +1 -1
  62. package/dist/ontology/group/writer.d.ts.map +1 -1
  63. package/dist/ontology/payload.d.ts +14 -26
  64. package/dist/ontology/payload.d.ts.map +1 -1
  65. package/dist/ontology/writer.d.ts.map +1 -1
  66. package/dist/ranger/active.d.ts +1 -1
  67. package/dist/ranger/active.d.ts.map +1 -1
  68. package/dist/ranger/alias.d.ts.map +1 -1
  69. package/dist/ranger/client.d.ts +16 -100
  70. package/dist/ranger/client.d.ts.map +1 -1
  71. package/dist/ranger/external.d.ts +2 -2
  72. package/dist/ranger/external.d.ts.map +1 -1
  73. package/dist/ranger/kv.d.ts.map +1 -1
  74. package/dist/ranger/payload.d.ts +34 -270
  75. package/dist/ranger/payload.d.ts.map +1 -1
  76. package/dist/ranger/range.d.ts +1 -1
  77. package/dist/ranger/range.d.ts.map +1 -1
  78. package/dist/ranger/writer.d.ts.map +1 -1
  79. package/dist/transport.d.ts.map +1 -1
  80. package/dist/util/retrieve.d.ts.map +1 -1
  81. package/dist/util/zod.d.ts +1 -1
  82. package/dist/util/zod.d.ts.map +1 -1
  83. package/dist/workspace/client.d.ts.map +1 -1
  84. package/dist/workspace/external.d.ts +1 -1
  85. package/dist/workspace/external.d.ts.map +1 -1
  86. package/dist/workspace/lineplot/client.d.ts +1 -1
  87. package/dist/workspace/lineplot/client.d.ts.map +1 -1
  88. package/dist/workspace/lineplot/external.d.ts +1 -1
  89. package/dist/workspace/lineplot/external.d.ts.map +1 -1
  90. package/dist/workspace/lineplot/payload.d.ts +2 -2
  91. package/dist/workspace/lineplot/retriever.d.ts.map +1 -1
  92. package/dist/workspace/lineplot/writer.d.ts +4 -4
  93. package/dist/workspace/lineplot/writer.d.ts.map +1 -1
  94. package/dist/workspace/payload.d.ts +6 -4
  95. package/dist/workspace/payload.d.ts.map +1 -1
  96. package/dist/workspace/retriever.d.ts.map +1 -1
  97. package/dist/workspace/schematic/client.d.ts.map +1 -1
  98. package/dist/workspace/schematic/external.d.ts +1 -1
  99. package/dist/workspace/schematic/external.d.ts.map +1 -1
  100. package/dist/workspace/schematic/payload.d.ts +2 -2
  101. package/dist/workspace/schematic/retriever.d.ts +1 -1
  102. package/dist/workspace/schematic/retriever.d.ts.map +1 -1
  103. package/dist/workspace/schematic/writer.d.ts +4 -4
  104. package/dist/workspace/schematic/writer.d.ts.map +1 -1
  105. package/dist/workspace/writer.d.ts +7 -5
  106. package/dist/workspace/writer.d.ts.map +1 -1
  107. package/eslint.config.js +12 -0
  108. package/examples/node/basicReadWrite.js +11 -2
  109. package/examples/node/liveStream.js +13 -4
  110. package/examples/node/seriesAndFrames.js +12 -3
  111. package/examples/node/streamWrite.js +15 -6
  112. package/package.json +11 -8
  113. package/src/auth/auth.spec.ts +7 -6
  114. package/src/auth/auth.ts +17 -13
  115. package/src/auth/index.ts +1 -1
  116. package/src/channel/batchRetriever.spec.ts +16 -5
  117. package/src/channel/channel.spec.ts +42 -4
  118. package/src/channel/client.ts +26 -9
  119. package/src/channel/creator.ts +2 -2
  120. package/src/channel/external.ts +2 -2
  121. package/src/channel/index.ts +1 -1
  122. package/src/channel/payload.ts +3 -1
  123. package/src/channel/retriever.ts +6 -4
  124. package/src/channel/writer.ts +23 -4
  125. package/src/client.ts +5 -3
  126. package/src/connection/checker.ts +1 -1
  127. package/src/connection/connection.spec.ts +1 -1
  128. package/src/connection/index.ts +1 -1
  129. package/src/control/client.ts +17 -0
  130. package/src/control/external.ts +2 -2
  131. package/src/control/index.ts +1 -1
  132. package/src/control/state.spec.ts +2 -3
  133. package/src/control/state.ts +20 -84
  134. package/src/errors.ts +18 -7
  135. package/src/framer/adapter.spec.ts +9 -0
  136. package/src/framer/adapter.ts +3 -3
  137. package/src/framer/client.spec.ts +1 -1
  138. package/src/framer/client.ts +34 -14
  139. package/src/framer/deleter.spec.ts +129 -0
  140. package/src/framer/deleter.ts +49 -0
  141. package/src/framer/external.ts +1 -1
  142. package/src/framer/frame.spec.ts +1 -1
  143. package/src/framer/frame.ts +14 -14
  144. package/src/framer/index.ts +1 -1
  145. package/src/framer/iterator.spec.ts +2 -2
  146. package/src/framer/iterator.ts +2 -2
  147. package/src/framer/streamProxy.ts +2 -4
  148. package/src/framer/streamer.spec.ts +2 -2
  149. package/src/framer/streamer.ts +6 -5
  150. package/src/framer/writer.spec.ts +18 -1
  151. package/src/framer/writer.ts +19 -27
  152. package/src/hardware/device/client.ts +2 -2
  153. package/src/hardware/device/index.ts +1 -1
  154. package/src/hardware/external.ts +1 -1
  155. package/src/hardware/index.ts +1 -1
  156. package/src/hardware/rack/rack.spec.ts +1 -1
  157. package/src/hardware/task/client.ts +3 -3
  158. package/src/hardware/task/task.spec.ts +2 -2
  159. package/src/index.ts +26 -25
  160. package/src/label/client.ts +2 -2
  161. package/src/label/external.ts +3 -3
  162. package/src/label/index.ts +1 -1
  163. package/src/label/label.spec.ts +1 -1
  164. package/src/label/payload.ts +1 -1
  165. package/src/label/retriever.ts +1 -1
  166. package/src/label/writer.ts +1 -1
  167. package/src/ontology/client.ts +7 -7
  168. package/src/ontology/external.ts +1 -1
  169. package/src/ontology/group/client.ts +3 -3
  170. package/src/ontology/group/external.ts +2 -2
  171. package/src/ontology/group/group.spec.ts +2 -2
  172. package/src/ontology/group/group.ts +1 -1
  173. package/src/ontology/group/index.ts +1 -1
  174. package/src/ontology/group/payload.ts +1 -1
  175. package/src/ontology/group/writer.ts +22 -6
  176. package/src/ontology/index.ts +1 -1
  177. package/src/ontology/ontology.spec.ts +2 -2
  178. package/src/ontology/payload.ts +3 -3
  179. package/src/ontology/writer.ts +2 -2
  180. package/src/ranger/active.ts +2 -2
  181. package/src/ranger/alias.ts +2 -2
  182. package/src/ranger/client.ts +15 -16
  183. package/src/ranger/external.ts +3 -3
  184. package/src/ranger/index.ts +1 -1
  185. package/src/ranger/kv.ts +2 -2
  186. package/src/ranger/payload.ts +1 -1
  187. package/src/ranger/range.ts +2 -2
  188. package/src/ranger/ranger.spec.ts +1 -1
  189. package/src/ranger/writer.ts +3 -3
  190. package/src/setupspecs.ts +1 -1
  191. package/src/signals/external.ts +1 -1
  192. package/src/signals/index.ts +1 -1
  193. package/src/signals/observable.ts +1 -1
  194. package/src/transport.ts +2 -2
  195. package/src/user/index.ts +1 -1
  196. package/src/user/payload.ts +1 -1
  197. package/src/util/retrieve.spec.ts +1 -1
  198. package/src/util/retrieve.ts +1 -1
  199. package/src/util/telem.ts +1 -1
  200. package/src/util/zod.ts +11 -2
  201. package/src/vite-env.d.ts +2 -2
  202. package/src/workspace/client.ts +2 -2
  203. package/src/workspace/external.ts +2 -2
  204. package/src/workspace/index.ts +1 -1
  205. package/src/workspace/lineplot/client.ts +2 -2
  206. package/src/workspace/lineplot/external.ts +2 -2
  207. package/src/workspace/lineplot/index.ts +1 -1
  208. package/src/workspace/lineplot/linePlot.spec.ts +2 -2
  209. package/src/workspace/lineplot/payload.ts +1 -1
  210. package/src/workspace/lineplot/retriever.ts +4 -10
  211. package/src/workspace/lineplot/writer.ts +4 -4
  212. package/src/workspace/payload.ts +11 -6
  213. package/src/workspace/retriever.ts +12 -6
  214. package/src/workspace/schematic/client.ts +2 -2
  215. package/src/workspace/schematic/external.ts +2 -2
  216. package/src/workspace/schematic/index.ts +1 -1
  217. package/src/workspace/schematic/payload.ts +1 -1
  218. package/src/workspace/schematic/retriever.ts +17 -18
  219. package/src/workspace/schematic/schematic.spec.ts +2 -2
  220. package/src/workspace/schematic/writer.ts +5 -5
  221. package/src/workspace/workspace.spec.ts +2 -2
  222. package/src/workspace/writer.ts +3 -3
  223. package/vite.config.ts +3 -4
  224. package/.eslintrc.cjs +0 -18
  225. package/dist/client.cjs.map +0 -1
  226. package/dist/client.js.map +0 -1
  227. package/dist/control/authority.d.ts +0 -8
  228. package/dist/control/authority.d.ts.map +0 -1
  229. package/src/control/authority.ts +0 -26
@@ -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 { it, describe, expect } from "vitest";
10
+ import { describe, expect,it } from "vitest";
11
11
  import { type Primitive } from "zod";
12
12
 
13
13
  import {
@@ -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 { toArray, type Primitive } from "@synnaxlabs/x";
10
+ import { type Primitive,toArray } from "@synnaxlabs/x";
11
11
 
12
12
  import { MultipleFoundError, NotFoundError } from "@/errors";
13
13
 
package/src/util/telem.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
package/src/util/zod.ts CHANGED
@@ -1,4 +1,13 @@
1
- import { z } from "zod";
1
+ // Copyright 2024 Synnax Labs, Inc.
2
+ //
3
+ // Use of this software is governed by the Business Source License included in the file
4
+ // licenses/BSL.txt.
5
+ //
6
+ // As of the Change Date specified in that file, in accordance with the Business Source
7
+ // License, use of this software will be governed by the Apache License, Version 2.0,
8
+ // included in the file licenses/APL.txt.
2
9
 
10
+ import { z } from "zod";
3
11
 
4
- export const nullableArrayZ = <Z extends z.ZodTypeAny>(item: Z) => z.union([z.null().transform(() => []), item.array()]);
12
+ export const nullableArrayZ = <Z extends z.ZodTypeAny>(item: Z) =>
13
+ z.union([z.null().transform(() => [] as z.output<Z>[]), item.array()]);
package/src/vite-env.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -7,5 +7,5 @@
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
- // eslint-disable-next-line @typescript-eslint/triple-slash-reference
10
+
11
11
  /// <reference types="vite/client" />
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -13,8 +13,8 @@ import { type AsyncTermSearcher } from "@synnaxlabs/x/search";
13
13
 
14
14
  import { linePlot } from "@/workspace/lineplot";
15
15
  import { type Key, type Workspace } from "@/workspace/payload";
16
- import { schematic } from "@/workspace/schematic";
17
16
  import { Retriever } from "@/workspace/retriever";
17
+ import { schematic } from "@/workspace/schematic";
18
18
  import { type NewWorkspace, Writer } from "@/workspace/writer";
19
19
 
20
20
  export class Client implements AsyncTermSearcher<string, Key, Workspace> {
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -7,5 +7,5 @@
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
- export * from "@/workspace/payload";
11
10
  export * from "@/workspace/client";
11
+ export * from "@/workspace/payload";
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -10,7 +10,7 @@
10
10
  import { type UnaryClient } from "@synnaxlabs/freighter";
11
11
  import { type UnknownRecord } from "@synnaxlabs/x/record";
12
12
 
13
- import { type LinePlot, type Key, type Params } from "@/workspace/lineplot/payload";
13
+ import { type Key, type LinePlot, type Params } from "@/workspace/lineplot/payload";
14
14
  import { Retriever } from "@/workspace/lineplot/retriever";
15
15
  import { type NewLinePlot, Writer } from "@/workspace/lineplot/writer";
16
16
 
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -7,5 +7,5 @@
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
- export * from "@/workspace/lineplot/payload";
11
10
  export * from "@/workspace/lineplot/client";
11
+ export * from "@/workspace/lineplot/payload";
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -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, test, expect } from "vitest";
10
+ import { describe, expect,test } from "vitest";
11
11
 
12
12
  import { newClient } from "@/setupspecs";
13
13
 
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -11,17 +11,11 @@ import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
11
11
  import { toArray } from "@synnaxlabs/x/toArray";
12
12
  import { z } from "zod";
13
13
 
14
- import { type LinePlot, type Params, linePlotZ } from "@/workspace/lineplot/payload";
14
+ import { type LinePlot, linePlotZ, type Params } from "@/workspace/lineplot/payload";
15
15
 
16
- const reqZ = z.object({
17
- keys: z.string().array(),
18
- });
16
+ const reqZ = z.object({ keys: z.string().array() });
19
17
 
20
- type Request = z.infer<typeof reqZ>;
21
-
22
- const resZ = z.object({
23
- linePlots: linePlotZ.array(),
24
- });
18
+ const resZ = z.object({ linePlots: linePlotZ.array() });
25
19
 
26
20
  export class Retriever {
27
21
  private readonly ENDPOINT = "/workspace/lineplot/retrieve";
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -13,11 +13,11 @@ import { toArray } from "@synnaxlabs/x/toArray";
13
13
  import { z } from "zod";
14
14
 
15
15
  import {
16
- linePlotZ,
16
+ type Key,
17
+ keyZ,
17
18
  type LinePlot,
19
+ linePlotZ,
18
20
  type Params,
19
- keyZ,
20
- type Key,
21
21
  } from "@/workspace/lineplot/payload";
22
22
  import { keyZ as workspaceKeyZ } from "@/workspace/payload";
23
23
 
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -7,7 +7,6 @@
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 { binary } from "@synnaxlabs/x/binary";
11
10
  import { type UnknownRecord, unknownRecordZ } from "@synnaxlabs/x/record";
12
11
  import { z } from "zod";
13
12
 
@@ -17,16 +16,22 @@ export type Key = z.infer<typeof keyZ>;
17
16
 
18
17
  export type Params = Key | Key[];
19
18
 
19
+ // --- VERY IMPORTANT ---
20
+ // Synnax's encoders (in the binary package inside x) automatically convert the case
21
+ // of keys in objects to snake_case and back to camelCase when encoding and decoding
22
+ // respectively. This is done to ensure that the keys are consistent across all
23
+ // languages and platforms. Sometimes workspaces have keys that are uuids, which have
24
+ // dashes, and those get messed up. So we just use regular JSON for workspaces.
25
+ const parse = (s: string): UnknownRecord => JSON.parse(s) as UnknownRecord;
26
+
20
27
  export const workspaceZ = z.object({
21
28
  name: z.string(),
22
29
  key: keyZ,
23
- layout: unknownRecordZ.or(
24
- z.string().transform((s) => binary.JSON_ECD.decodeString(s) as UnknownRecord),
25
- ),
30
+ layout: unknownRecordZ.or(z.string().transform((s) => parse(s) as UnknownRecord)),
26
31
  });
27
32
 
28
33
  export const workspaceRemoteZ = workspaceZ.omit({ layout: true }).extend({
29
- layout: z.string().transform((s) => binary.JSON_ECD.decodeString(s) as UnknownRecord),
34
+ layout: z.string().transform((s) => parse(s) as UnknownRecord),
30
35
  });
31
36
 
32
37
  export type Workspace = z.infer<typeof workspaceZ>;
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -11,10 +11,11 @@ import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
11
11
  import { toArray } from "@synnaxlabs/x/toArray";
12
12
  import { z } from "zod";
13
13
 
14
+ import { nullableArrayZ } from "@/util/zod";
14
15
  import {
16
+ keyZ,
15
17
  type Params,
16
18
  type Workspace,
17
- keyZ,
18
19
  workspaceRemoteZ,
19
20
  } from "@/workspace/payload";
20
21
 
@@ -28,9 +29,7 @@ const reqZ = z.object({
28
29
 
29
30
  type Request = z.infer<typeof reqZ>;
30
31
 
31
- const resZ = z.object({
32
- workspaces: workspaceRemoteZ.array(),
33
- });
32
+ const resZ = z.object({ workspaces: nullableArrayZ(workspaceRemoteZ) });
34
33
 
35
34
  export class Retriever {
36
35
  private static readonly ENDPOINT = "/workspace/retrieve";
@@ -59,6 +58,13 @@ export class Retriever {
59
58
  }
60
59
 
61
60
  private async execute(request: Request): Promise<Workspace[]> {
62
- return (await sendRequired(this.client, Retriever.ENDPOINT, request, reqZ, resZ)).workspaces;
61
+ const res = await sendRequired(
62
+ this.client,
63
+ Retriever.ENDPOINT,
64
+ request,
65
+ reqZ,
66
+ resZ,
67
+ );
68
+ return res.workspaces;
63
69
  }
64
70
  }
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -12,7 +12,7 @@ import { type UnknownRecord } from "@synnaxlabs/x/record";
12
12
 
13
13
  import { type Key, type Params, type Schematic } from "@/workspace/schematic/payload";
14
14
  import { Retriever } from "@/workspace/schematic/retriever";
15
- import { Writer, type NewSchematic } from "@/workspace/schematic/writer";
15
+ import { type NewSchematic,Writer } from "@/workspace/schematic/writer";
16
16
 
17
17
  export class Client {
18
18
  private readonly writer: Writer;
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -7,5 +7,5 @@
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
- export * from "@/workspace/schematic/payload";
11
10
  export * from "@/workspace/schematic/client";
11
+ export * from "@/workspace/schematic/payload";
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -11,17 +11,14 @@ import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
11
11
  import { toArray } from "@synnaxlabs/x/toArray";
12
12
  import { z } from "zod";
13
13
 
14
- import { type Schematic, type Params, schematicRemoteZ } from "@/workspace/schematic/payload";
14
+ import {
15
+ type Params,
16
+ type Schematic,
17
+ schematicRemoteZ,
18
+ } from "@/workspace/schematic/payload";
15
19
 
16
- const reqZ = z.object({
17
- keys: z.string().array(),
18
- });
19
-
20
- type Request = z.infer<typeof reqZ>;
21
-
22
- const resZ = z.object({
23
- schematics: schematicRemoteZ.array(),
24
- });
20
+ const reqZ = z.object({ keys: z.string().array() });
21
+ const resZ = z.object({ schematics: schematicRemoteZ.array() });
25
22
 
26
23
  export class Retriever {
27
24
  private readonly ENDPOINT = "/workspace/schematic/retrieve";
@@ -32,12 +29,14 @@ export class Retriever {
32
29
  }
33
30
 
34
31
  async retrieve(params: Params): Promise<Schematic[]> {
35
- return (await sendRequired(
36
- this.client,
37
- this.ENDPOINT,
38
- { keys: toArray(params) },
39
- reqZ,
40
- resZ,
41
- )).schematics;
32
+ return (
33
+ await sendRequired(
34
+ this.client,
35
+ this.ENDPOINT,
36
+ { keys: toArray(params) },
37
+ reqZ,
38
+ resZ,
39
+ )
40
+ ).schematics;
42
41
  }
43
42
  }
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -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, test, expect, it } from "vitest";
10
+ import { describe, expect, it,test } from "vitest";
11
11
 
12
12
  import { ValidationError } from "@/errors";
13
13
  import { newClient } from "@/setupspecs";
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -14,12 +14,12 @@ import { z } from "zod";
14
14
 
15
15
  import { keyZ as workspaceKeyZ } from "@/workspace/payload";
16
16
  import {
17
- schematicZ,
18
- type Schematic,
19
- type Params,
20
- keyZ,
21
17
  type Key,
18
+ keyZ,
19
+ type Params,
20
+ type Schematic,
22
21
  schematicRemoteZ,
22
+ schematicZ,
23
23
  } from "@/workspace/schematic/payload";
24
24
 
25
25
  export const newSchematicZ = schematicZ.partial({ key: true, snapshot: true }).transform((p) => ({
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -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, test, expect } from "vitest";
10
+ import { describe, expect,test } from "vitest";
11
11
 
12
12
  import { newClient } from "@/setupspecs";
13
13
 
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -13,10 +13,10 @@ import { toArray } from "@synnaxlabs/x/toArray";
13
13
  import { z } from "zod";
14
14
 
15
15
  import {
16
- type Workspace,
17
- workspaceZ,
18
16
  keyZ,
17
+ type Workspace,
19
18
  workspaceRemoteZ,
19
+ workspaceZ,
20
20
  } from "@/workspace/payload";
21
21
 
22
22
  const newWorkspaceZ = workspaceZ.partial({ key: true }).transform((w) => ({
package/vite.config.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Synnax Labs, Inc.
1
+ // Copyright 2024 Synnax Labs, Inc.
2
2
  //
3
3
  // Use of this software is governed by the Business Source License included in the file
4
4
  // licenses/BSL.txt.
@@ -7,15 +7,14 @@
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 { lib } from "@synnaxlabs/vite-plugin";
10
+ import { isProd, lib } from "@synnaxlabs/vite-plugin";
11
11
  import { defineConfig } from "vite";
12
12
 
13
13
  export default defineConfig({
14
14
  plugins: [lib({ name: "client" })],
15
15
  build: {
16
- minify: true,
17
16
  rollupOptions: {
18
- external: "zod",
17
+ external: ["zod"],
19
18
  },
20
19
  },
21
20
  test: {
package/.eslintrc.cjs DELETED
@@ -1,18 +0,0 @@
1
- /*
2
- * Copyright 2023 Synnax Labs, Inc.
3
- *
4
- * Use of this software is governed by the Business Source License included in the file
5
- * licenses/BSL.txt.
6
- *
7
- * As of the Change Date specified in that file, in accordance with the Business Source
8
- * License, use of this software will be governed by the Apache License, Version 2.0,
9
- * included in the file licenses/APL.txt.
10
- */
11
-
12
- module.exports = {
13
- root: true,
14
- extends: ["synnaxlabs"],
15
- parserOptions: {
16
- project: "./tsconfig.json",
17
- },
18
- };