@synnaxlabs/client 0.53.1 → 0.54.1

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 (390) hide show
  1. package/.turbo/turbo-build.log +14 -8
  2. package/dist/client.cjs +48 -54
  3. package/dist/client.js +12361 -15508
  4. package/dist/src/access/action/index.d.ts +2 -0
  5. package/dist/src/access/action/index.d.ts.map +1 -0
  6. package/dist/src/access/{payload.d.ts → action/types.gen.d.ts} +2 -1
  7. package/dist/src/access/action/types.gen.d.ts.map +1 -0
  8. package/dist/src/access/enforce.d.ts +2 -2
  9. package/dist/src/access/enforce.d.ts.map +1 -1
  10. package/dist/src/access/external.d.ts +1 -1
  11. package/dist/src/access/external.d.ts.map +1 -1
  12. package/dist/src/access/policy/client.d.ts +233 -389
  13. package/dist/src/access/policy/client.d.ts.map +1 -1
  14. package/dist/src/access/policy/external.d.ts +1 -1
  15. package/dist/src/access/policy/external.d.ts.map +1 -1
  16. package/dist/src/access/policy/types.gen.d.ts +120 -0
  17. package/dist/src/access/policy/types.gen.d.ts.map +1 -0
  18. package/dist/src/access/role/client.d.ts +1 -1
  19. package/dist/src/access/role/client.d.ts.map +1 -1
  20. package/dist/src/access/role/external.d.ts +1 -1
  21. package/dist/src/access/role/external.d.ts.map +1 -1
  22. package/dist/src/access/role/types.gen.d.ts +34 -0
  23. package/dist/src/access/role/types.gen.d.ts.map +1 -0
  24. package/dist/src/arc/client.d.ts +2 -2
  25. package/dist/src/arc/client.d.ts.map +1 -1
  26. package/dist/src/arc/compiler/index.d.ts +2 -0
  27. package/dist/src/arc/compiler/index.d.ts.map +1 -0
  28. package/dist/src/arc/compiler/types.gen.d.ts +12 -0
  29. package/dist/src/arc/compiler/types.gen.d.ts.map +1 -0
  30. package/dist/src/arc/external.d.ts +6 -1
  31. package/dist/src/arc/external.d.ts.map +1 -1
  32. package/dist/src/arc/graph/index.d.ts +2 -0
  33. package/dist/src/arc/graph/index.d.ts.map +1 -0
  34. package/dist/src/arc/graph/types.gen.d.ts +644 -0
  35. package/dist/src/arc/graph/types.gen.d.ts.map +1 -0
  36. package/dist/src/arc/ir/index.d.ts +2 -0
  37. package/dist/src/arc/ir/index.d.ts.map +1 -0
  38. package/dist/src/arc/ir/types.gen.d.ts +2988 -0
  39. package/dist/src/arc/ir/types.gen.d.ts.map +1 -0
  40. package/dist/src/arc/module/index.d.ts +2 -0
  41. package/dist/src/arc/module/index.d.ts.map +1 -0
  42. package/dist/src/arc/module/types.gen.d.ts +1138 -0
  43. package/dist/src/arc/module/types.gen.d.ts.map +1 -0
  44. package/dist/src/arc/program/index.d.ts +2 -0
  45. package/dist/src/arc/program/index.d.ts.map +1 -0
  46. package/dist/src/arc/program/types.gen.d.ts +1138 -0
  47. package/dist/src/arc/program/types.gen.d.ts.map +1 -0
  48. package/dist/src/arc/text/index.d.ts +2 -0
  49. package/dist/src/arc/text/index.d.ts.map +1 -0
  50. package/dist/src/arc/text/types.gen.d.ts +8 -0
  51. package/dist/src/arc/text/types.gen.d.ts.map +1 -0
  52. package/dist/src/arc/types/index.d.ts +2 -0
  53. package/dist/src/arc/types/index.d.ts.map +1 -0
  54. package/dist/src/arc/types/types.gen.d.ts +237 -0
  55. package/dist/src/arc/types/types.gen.d.ts.map +1 -0
  56. package/dist/src/arc/types.gen.d.ts +2394 -0
  57. package/dist/src/arc/types.gen.d.ts.map +1 -0
  58. package/dist/src/channel/client.d.ts +5 -4
  59. package/dist/src/channel/client.d.ts.map +1 -1
  60. package/dist/src/channel/external.d.ts +1 -0
  61. package/dist/src/channel/external.d.ts.map +1 -1
  62. package/dist/src/channel/payload.d.ts +95 -178
  63. package/dist/src/channel/payload.d.ts.map +1 -1
  64. package/dist/src/channel/retriever.d.ts +3 -2
  65. package/dist/src/channel/retriever.d.ts.map +1 -1
  66. package/dist/src/channel/types.gen.d.ts +155 -0
  67. package/dist/src/channel/types.gen.d.ts.map +1 -0
  68. package/dist/src/channel/writer.d.ts +1 -1
  69. package/dist/src/channel/writer.d.ts.map +1 -1
  70. package/dist/src/client.d.ts.map +1 -1
  71. package/dist/src/cluster/index.d.ts +2 -0
  72. package/dist/src/cluster/index.d.ts.map +1 -0
  73. package/dist/src/cluster/types.gen.d.ts +4 -0
  74. package/dist/src/cluster/types.gen.d.ts.map +1 -0
  75. package/dist/src/control/state.d.ts +14 -9
  76. package/dist/src/control/state.d.ts.map +1 -1
  77. package/dist/src/device/client.d.ts +7 -12
  78. package/dist/src/device/client.d.ts.map +1 -1
  79. package/dist/src/device/external.d.ts +1 -1
  80. package/dist/src/device/external.d.ts.map +1 -1
  81. package/dist/src/device/types.gen.d.ts +163 -0
  82. package/dist/src/device/types.gen.d.ts.map +1 -0
  83. package/dist/src/framer/adapter.d.ts +2 -2
  84. package/dist/src/framer/adapter.d.ts.map +1 -1
  85. package/dist/src/framer/client.d.ts +7 -7
  86. package/dist/src/framer/client.d.ts.map +1 -1
  87. package/dist/src/framer/codec.d.ts +5 -5
  88. package/dist/src/framer/codec.d.ts.map +1 -1
  89. package/dist/src/framer/external.d.ts +1 -1
  90. package/dist/src/framer/external.d.ts.map +1 -1
  91. package/dist/src/framer/frame.d.ts +18 -18
  92. package/dist/src/framer/frame.d.ts.map +1 -1
  93. package/dist/src/framer/reader.d.ts +1 -1
  94. package/dist/src/framer/reader.d.ts.map +1 -1
  95. package/dist/src/framer/streamer.d.ts +181 -114
  96. package/dist/src/framer/streamer.d.ts.map +1 -1
  97. package/dist/src/framer/types.gen.d.ts +9 -0
  98. package/dist/src/framer/types.gen.d.ts.map +1 -0
  99. package/dist/src/framer/writer.d.ts +196 -128
  100. package/dist/src/framer/writer.d.ts.map +1 -1
  101. package/dist/src/group/client.d.ts +17 -17
  102. package/dist/src/group/client.d.ts.map +1 -1
  103. package/dist/src/group/external.d.ts +1 -1
  104. package/dist/src/group/external.d.ts.map +1 -1
  105. package/dist/src/group/types.gen.d.ts +23 -0
  106. package/dist/src/group/types.gen.d.ts.map +1 -0
  107. package/dist/src/label/client.d.ts +51 -72
  108. package/dist/src/label/client.d.ts.map +1 -1
  109. package/dist/src/label/payload.d.ts +30 -8
  110. package/dist/src/label/payload.d.ts.map +1 -1
  111. package/dist/src/lineplot/client.d.ts +2 -11
  112. package/dist/src/lineplot/client.d.ts.map +1 -1
  113. package/dist/src/lineplot/external.d.ts +1 -1
  114. package/dist/src/lineplot/external.d.ts.map +1 -1
  115. package/dist/src/lineplot/types.gen.d.ts +33 -0
  116. package/dist/src/lineplot/types.gen.d.ts.map +1 -0
  117. package/dist/src/log/client.d.ts +2 -11
  118. package/dist/src/log/client.d.ts.map +1 -1
  119. package/dist/src/log/external.d.ts +1 -1
  120. package/dist/src/log/external.d.ts.map +1 -1
  121. package/dist/src/log/types.gen.d.ts +33 -0
  122. package/dist/src/log/types.gen.d.ts.map +1 -0
  123. package/dist/src/ontology/client.d.ts +31 -31
  124. package/dist/src/ontology/payload.d.ts +74 -99
  125. package/dist/src/ontology/payload.d.ts.map +1 -1
  126. package/dist/src/ontology/types.gen.d.ts +30 -0
  127. package/dist/src/ontology/types.gen.d.ts.map +1 -0
  128. package/dist/src/ontology/writer.d.ts +80 -80
  129. package/dist/src/rack/client.d.ts +22 -11
  130. package/dist/src/rack/client.d.ts.map +1 -1
  131. package/dist/src/rack/external.d.ts +1 -1
  132. package/dist/src/rack/external.d.ts.map +1 -1
  133. package/dist/src/rack/types.gen.d.ts +72 -0
  134. package/dist/src/rack/types.gen.d.ts.map +1 -0
  135. package/dist/src/range/alias/types.gen.d.ts +14 -0
  136. package/dist/src/range/alias/types.gen.d.ts.map +1 -0
  137. package/dist/src/range/kv/types.gen.d.ts +13 -0
  138. package/dist/src/range/kv/types.gen.d.ts.map +1 -0
  139. package/dist/src/ranger/alias/client.d.ts +1 -1
  140. package/dist/src/ranger/alias/client.d.ts.map +1 -1
  141. package/dist/src/ranger/alias/external.d.ts +3 -1
  142. package/dist/src/ranger/alias/external.d.ts.map +1 -1
  143. package/dist/src/ranger/alias/payload.d.ts +5 -9
  144. package/dist/src/ranger/alias/payload.d.ts.map +1 -1
  145. package/dist/src/ranger/alias/payload.spec.d.ts +2 -0
  146. package/dist/src/ranger/alias/payload.spec.d.ts.map +1 -0
  147. package/dist/src/ranger/alias/types.gen.d.ts +14 -0
  148. package/dist/src/ranger/alias/types.gen.d.ts.map +1 -0
  149. package/dist/src/ranger/client.d.ts +10 -15
  150. package/dist/src/ranger/client.d.ts.map +1 -1
  151. package/dist/src/ranger/external.d.ts +4 -4
  152. package/dist/src/ranger/external.d.ts.map +1 -1
  153. package/dist/src/ranger/kv/client.d.ts +1 -1
  154. package/dist/src/ranger/kv/client.d.ts.map +1 -1
  155. package/dist/src/ranger/kv/external.d.ts +3 -1
  156. package/dist/src/ranger/kv/external.d.ts.map +1 -1
  157. package/dist/src/ranger/kv/payload.d.ts +6 -13
  158. package/dist/src/ranger/kv/payload.d.ts.map +1 -1
  159. package/dist/src/ranger/kv/types.gen.d.ts +13 -0
  160. package/dist/src/ranger/kv/types.gen.d.ts.map +1 -0
  161. package/dist/src/ranger/payload.d.ts +2 -97
  162. package/dist/src/ranger/payload.d.ts.map +1 -1
  163. package/dist/src/ranger/types.gen.d.ts +219 -0
  164. package/dist/src/ranger/types.gen.d.ts.map +1 -0
  165. package/dist/src/ranger/writer.d.ts +25 -25
  166. package/dist/src/ranger/writer.d.ts.map +1 -1
  167. package/dist/src/schematic/client.d.ts +2 -11
  168. package/dist/src/schematic/client.d.ts.map +1 -1
  169. package/dist/src/schematic/external.d.ts +1 -1
  170. package/dist/src/schematic/external.d.ts.map +1 -1
  171. package/dist/src/schematic/symbol/client.d.ts +1 -2
  172. package/dist/src/schematic/symbol/client.d.ts.map +1 -1
  173. package/dist/src/schematic/symbol/external.d.ts +1 -1
  174. package/dist/src/schematic/symbol/external.d.ts.map +1 -1
  175. package/dist/src/schematic/symbol/types.gen.d.ts +277 -0
  176. package/dist/src/schematic/symbol/types.gen.d.ts.map +1 -0
  177. package/dist/src/schematic/types.gen.d.ts +35 -0
  178. package/dist/src/schematic/types.gen.d.ts.map +1 -0
  179. package/dist/src/status/client.d.ts +2 -0
  180. package/dist/src/status/client.d.ts.map +1 -1
  181. package/dist/src/status/payload.d.ts +25 -54
  182. package/dist/src/status/payload.d.ts.map +1 -1
  183. package/dist/src/table/client.d.ts +2 -11
  184. package/dist/src/table/client.d.ts.map +1 -1
  185. package/dist/src/table/external.d.ts +1 -1
  186. package/dist/src/table/external.d.ts.map +1 -1
  187. package/dist/src/table/types.gen.d.ts +33 -0
  188. package/dist/src/table/types.gen.d.ts.map +1 -0
  189. package/dist/src/task/client.d.ts +15 -20
  190. package/dist/src/task/client.d.ts.map +1 -1
  191. package/dist/src/task/external.d.ts +1 -1
  192. package/dist/src/task/external.d.ts.map +1 -1
  193. package/dist/src/task/types.gen.d.ts +155 -0
  194. package/dist/src/task/types.gen.d.ts.map +1 -0
  195. package/dist/src/user/client.d.ts +3 -3
  196. package/dist/src/user/client.d.ts.map +1 -1
  197. package/dist/src/user/external.d.ts +1 -1
  198. package/dist/src/user/external.d.ts.map +1 -1
  199. package/dist/src/user/types.gen.d.ts +35 -0
  200. package/dist/src/user/types.gen.d.ts.map +1 -0
  201. package/dist/src/util/decodeJSONString.d.ts.map +1 -1
  202. package/dist/src/view/client.d.ts +1 -10
  203. package/dist/src/view/client.d.ts.map +1 -1
  204. package/dist/src/view/external.d.ts +1 -1
  205. package/dist/src/view/external.d.ts.map +1 -1
  206. package/dist/src/view/types.gen.d.ts +35 -0
  207. package/dist/src/view/types.gen.d.ts.map +1 -0
  208. package/dist/src/workspace/client.d.ts +2 -11
  209. package/dist/src/workspace/client.d.ts.map +1 -1
  210. package/dist/src/workspace/external.d.ts +1 -1
  211. package/dist/src/workspace/external.d.ts.map +1 -1
  212. package/dist/src/workspace/types.gen.d.ts +34 -0
  213. package/dist/src/workspace/types.gen.d.ts.map +1 -0
  214. package/package.json +11 -11
  215. package/src/access/action/index.ts +11 -0
  216. package/src/access/{payload.ts → action/types.gen.ts} +4 -1
  217. package/src/access/enforce.spec.ts +1 -2
  218. package/src/access/enforce.ts +2 -2
  219. package/src/access/external.ts +1 -1
  220. package/src/access/policy/client.ts +2 -2
  221. package/src/access/policy/external.ts +1 -1
  222. package/src/access/policy/types.gen.ts +44 -0
  223. package/src/access/role/client.ts +2 -2
  224. package/src/access/role/external.ts +1 -1
  225. package/src/access/role/types.gen.ts +46 -0
  226. package/src/arc/access.spec.ts +18 -6
  227. package/src/arc/client.ts +3 -3
  228. package/src/{framer/payload.ts → arc/compiler/index.ts} +1 -6
  229. package/src/arc/compiler/types.gen.ts +27 -0
  230. package/src/arc/external.ts +6 -1
  231. package/src/arc/graph/index.ts +10 -0
  232. package/src/arc/graph/types.gen.ts +59 -0
  233. package/src/arc/ir/index.ts +10 -0
  234. package/src/arc/ir/types.gen.ts +166 -0
  235. package/src/arc/module/index.ts +10 -0
  236. package/src/arc/module/types.gen.ts +18 -0
  237. package/src/arc/program/index.ts +10 -0
  238. package/src/arc/program/types.gen.ts +18 -0
  239. package/src/arc/text/index.ts +10 -0
  240. package/src/arc/text/types.gen.ts +19 -0
  241. package/src/arc/types/index.ts +10 -0
  242. package/src/arc/types/types.gen.ts +132 -0
  243. package/src/arc/types.gen.ts +85 -0
  244. package/src/channel/client.ts +14 -15
  245. package/src/channel/external.ts +1 -0
  246. package/src/channel/payload.spec.ts +19 -16
  247. package/src/channel/payload.ts +14 -82
  248. package/src/channel/retriever.ts +9 -18
  249. package/src/channel/types.gen.ts +137 -0
  250. package/src/channel/writer.ts +2 -2
  251. package/src/client.ts +4 -0
  252. package/src/cluster/index.ts +10 -0
  253. package/src/cluster/types.gen.ts +16 -0
  254. package/src/control/state.ts +8 -6
  255. package/src/device/client.ts +14 -11
  256. package/src/device/device.spec.ts +95 -1
  257. package/src/device/external.ts +1 -1
  258. package/src/device/payload.spec.ts +26 -2
  259. package/src/device/types.gen.ts +100 -0
  260. package/src/framer/adapter.ts +7 -4
  261. package/src/framer/client.ts +15 -9
  262. package/src/framer/codec.spec.ts +25 -5
  263. package/src/framer/codec.ts +11 -9
  264. package/src/framer/deleter.spec.ts +0 -15
  265. package/src/framer/external.ts +1 -1
  266. package/src/framer/frame.ts +44 -36
  267. package/src/framer/reader.spec.ts +2 -2
  268. package/src/framer/reader.ts +6 -6
  269. package/src/framer/streamer.spec.ts +98 -0
  270. package/src/framer/streamer.ts +10 -0
  271. package/src/framer/types.gen.ts +20 -0
  272. package/src/framer/writer.ts +14 -8
  273. package/src/group/client.ts +1 -1
  274. package/src/group/external.ts +1 -1
  275. package/src/group/group.spec.ts +1 -1
  276. package/src/{access/role/payload.ts → group/types.gen.ts} +11 -11
  277. package/src/label/client.ts +2 -5
  278. package/src/label/label.spec.ts +12 -3
  279. package/src/label/payload.ts +3 -1
  280. package/src/lineplot/client.ts +9 -11
  281. package/src/lineplot/external.ts +1 -1
  282. package/src/lineplot/lineplot.spec.ts +40 -0
  283. package/src/lineplot/types.gen.ts +42 -0
  284. package/src/log/client.ts +9 -18
  285. package/src/log/external.ts +1 -1
  286. package/src/log/log.spec.ts +38 -0
  287. package/src/log/types.gen.ts +42 -0
  288. package/src/ontology/payload.ts +5 -29
  289. package/src/ontology/types.gen.ts +41 -0
  290. package/src/rack/client.ts +26 -10
  291. package/src/rack/external.ts +1 -1
  292. package/src/rack/rack.spec.ts +37 -0
  293. package/src/rack/types.gen.ts +62 -0
  294. package/src/range/alias/types.gen.ts +30 -0
  295. package/src/range/kv/types.gen.ts +28 -0
  296. package/src/ranger/alias/client.ts +1 -1
  297. package/src/ranger/alias/external.ts +3 -10
  298. package/src/ranger/alias/payload.spec.ts +52 -0
  299. package/src/ranger/alias/payload.ts +11 -10
  300. package/src/ranger/alias/types.gen.ts +30 -0
  301. package/src/ranger/client.ts +34 -45
  302. package/src/ranger/external.ts +3 -3
  303. package/src/ranger/kv/client.ts +3 -3
  304. package/src/ranger/kv/external.ts +3 -7
  305. package/src/ranger/kv/payload.ts +1 -6
  306. package/src/ranger/kv/types.gen.ts +28 -0
  307. package/src/ranger/payload.ts +2 -46
  308. package/src/ranger/ranger.spec.ts +2 -4
  309. package/src/ranger/types.gen.ts +66 -0
  310. package/src/ranger/writer.ts +2 -1
  311. package/src/schematic/client.ts +11 -14
  312. package/src/schematic/external.ts +1 -1
  313. package/src/schematic/schematic.spec.ts +54 -2
  314. package/src/schematic/symbol/client.ts +2 -4
  315. package/src/schematic/symbol/external.ts +1 -1
  316. package/src/schematic/symbol/types.gen.ts +124 -0
  317. package/src/schematic/types.gen.ts +44 -0
  318. package/src/status/client.ts +4 -3
  319. package/src/status/payload.ts +5 -4
  320. package/src/status/status.spec.ts +106 -11
  321. package/src/table/client.ts +10 -19
  322. package/src/table/external.ts +1 -1
  323. package/src/table/table.spec.ts +38 -0
  324. package/src/table/types.gen.ts +42 -0
  325. package/src/task/client.ts +29 -24
  326. package/src/task/external.ts +1 -1
  327. package/src/task/payload.spec.ts +19 -19
  328. package/src/task/task.spec.ts +127 -9
  329. package/src/task/types.gen.ts +169 -0
  330. package/src/user/client.ts +2 -2
  331. package/src/user/external.ts +1 -1
  332. package/src/user/types.gen.ts +49 -0
  333. package/src/util/decodeJSONString.ts +1 -1
  334. package/src/util/retrieve.ts +2 -2
  335. package/src/view/client.ts +2 -7
  336. package/src/view/external.ts +1 -1
  337. package/src/view/types.gen.ts +44 -0
  338. package/src/workspace/client.ts +10 -14
  339. package/src/workspace/external.ts +1 -1
  340. package/src/workspace/types.gen.ts +45 -0
  341. package/src/workspace/workspace.spec.ts +37 -0
  342. package/tsconfig.json +1 -3
  343. package/vite.config.ts +9 -2
  344. package/dist/src/access/payload.d.ts.map +0 -1
  345. package/dist/src/access/policy/payload.d.ts +0 -156
  346. package/dist/src/access/policy/payload.d.ts.map +0 -1
  347. package/dist/src/access/role/payload.d.ts +0 -27
  348. package/dist/src/access/role/payload.d.ts.map +0 -1
  349. package/dist/src/arc/payload.d.ts +0 -167
  350. package/dist/src/arc/payload.d.ts.map +0 -1
  351. package/dist/src/device/payload.d.ts +0 -281
  352. package/dist/src/device/payload.d.ts.map +0 -1
  353. package/dist/src/framer/payload.d.ts +0 -7
  354. package/dist/src/framer/payload.d.ts.map +0 -1
  355. package/dist/src/group/payload.d.ts +0 -16
  356. package/dist/src/group/payload.d.ts.map +0 -1
  357. package/dist/src/lineplot/payload.d.ts +0 -28
  358. package/dist/src/lineplot/payload.d.ts.map +0 -1
  359. package/dist/src/log/payload.d.ts +0 -28
  360. package/dist/src/log/payload.d.ts.map +0 -1
  361. package/dist/src/rack/payload.d.ts +0 -243
  362. package/dist/src/rack/payload.d.ts.map +0 -1
  363. package/dist/src/schematic/payload.d.ts +0 -38
  364. package/dist/src/schematic/payload.d.ts.map +0 -1
  365. package/dist/src/schematic/symbol/payload.d.ts +0 -169
  366. package/dist/src/schematic/symbol/payload.d.ts.map +0 -1
  367. package/dist/src/table/payload.d.ts +0 -33
  368. package/dist/src/table/payload.d.ts.map +0 -1
  369. package/dist/src/task/payload.d.ts +0 -123
  370. package/dist/src/task/payload.d.ts.map +0 -1
  371. package/dist/src/user/payload.d.ts +0 -22
  372. package/dist/src/user/payload.d.ts.map +0 -1
  373. package/dist/src/view/payload.d.ts +0 -20
  374. package/dist/src/view/payload.d.ts.map +0 -1
  375. package/dist/src/workspace/payload.d.ts +0 -33
  376. package/dist/src/workspace/payload.d.ts.map +0 -1
  377. package/src/access/policy/payload.ts +0 -37
  378. package/src/arc/payload.ts +0 -73
  379. package/src/device/payload.ts +0 -83
  380. package/src/group/payload.ts +0 -24
  381. package/src/lineplot/payload.ts +0 -29
  382. package/src/log/payload.ts +0 -29
  383. package/src/rack/payload.ts +0 -30
  384. package/src/schematic/payload.ts +0 -34
  385. package/src/schematic/symbol/payload.ts +0 -70
  386. package/src/table/payload.ts +0 -33
  387. package/src/task/payload.ts +0 -127
  388. package/src/user/payload.ts +0 -29
  389. package/src/view/payload.ts +0 -25
  390. package/src/workspace/payload.ts +0 -33
@@ -21,7 +21,7 @@ import { z } from "zod";
21
21
 
22
22
  import { type framer } from "@/framer";
23
23
  import { ontology } from "@/ontology";
24
- import { keyZ as rackKeyZ } from "@/rack/payload";
24
+ import { type Key as RackKey, keyZ as rackKeyZ } from "@/rack/types.gen";
25
25
  import { type ranger } from "@/ranger";
26
26
  import { status } from "@/status";
27
27
  import {
@@ -29,20 +29,28 @@ import {
29
29
  keyZ,
30
30
  type New,
31
31
  newZ,
32
+ ontologyID,
32
33
  type Payload,
33
- type Schemas,
34
+ type PayloadSchemas as Schemas,
35
+ payloadZ,
34
36
  type Status,
35
37
  statusZ,
36
- taskZ,
37
- } from "@/task/payload";
38
+ } from "@/task/types.gen";
38
39
  import { checkForMultipleOrNoResults } from "@/util/retrieve";
39
40
 
41
+ export type { PayloadSchemas as Schemas } from "@/task/types.gen";
42
+
40
43
  export const COMMAND_CHANNEL_NAME = "sy_task_cmd";
41
44
  export const SET_CHANNEL_NAME = "sy_task_set";
42
45
  export const DELETE_CHANNEL_NAME = "sy_task_delete";
43
46
 
44
47
  const NOT_CREATED_ERROR = new Error("Task not created");
45
48
 
49
+ export const rackKey = (key: Key): RackKey => Number(BigInt(key) >> 32n);
50
+
51
+ export const newKey = (rackKey: RackKey, taskKey: number = 0): Key =>
52
+ ((BigInt(rackKey) << 32n) + BigInt(taskKey)).toString();
53
+
46
54
  const retrieveSnapshottedTo = async (taskKey: Key, ontologyClient: ontology.Client) => {
47
55
  const parents = await ontologyClient.retrieveParents(ontologyID(taskKey));
48
56
  if (parents.length === 0) return null;
@@ -119,10 +127,10 @@ export class Task<S extends Schemas = Schemas> {
119
127
  this.schemas =
120
128
  schemas ??
121
129
  ({
122
- type: z.string() as unknown as S["type"],
123
- config: z.unknown() as S["config"],
124
- statusData: z.unknown() as S["statusData"],
125
- } as S);
130
+ type: z.string(),
131
+ config: z.unknown(),
132
+ statusData: z.unknown(),
133
+ } as unknown as S);
126
134
  this.internal = internal;
127
135
  this.snapshot = snapshot;
128
136
  this.status = status;
@@ -228,19 +236,19 @@ interface RetrieveSchemas<S extends Schemas = Schemas> {
228
236
  }
229
237
 
230
238
  const retrieveResZ = <S extends Schemas = Schemas>(schemas?: S) =>
231
- z.object({ tasks: array.nullableZ(taskZ(schemas)) });
239
+ z.object({ tasks: array.nullishToEmpty(payloadZ(schemas)) });
232
240
 
233
241
  export interface RetrieveRequest extends z.infer<typeof retrieveReqZ> {}
234
242
 
235
243
  const createReqZ = <S extends Schemas = Schemas>(schemas?: S) =>
236
244
  z.object({ tasks: newZ(schemas).array() });
237
245
  const createResZ = <S extends Schemas = Schemas>(schemas?: S) =>
238
- z.object({ tasks: taskZ(schemas).array() });
246
+ z.object({ tasks: payloadZ(schemas).array() });
239
247
  const deleteReqZ = z.object({ keys: keyZ.array() });
240
248
  const deleteResZ = z.object({});
241
249
  const copyReqZ = z.object({ key: keyZ, name: z.string(), snapshot: z.boolean() });
242
250
  const copyResZ = <S extends Schemas = Schemas>(schemas?: S) =>
243
- z.object({ task: taskZ(schemas) });
251
+ z.object({ task: payloadZ(schemas) });
244
252
 
245
253
  export class Client {
246
254
  private readonly client: UnaryClient;
@@ -320,7 +328,7 @@ export class Client {
320
328
  return isSingle ? sugared[0] : sugared;
321
329
  }
322
330
 
323
- async copy(key: string, name: string, snapshot: boolean): Promise<Task> {
331
+ async copy(key: Key, name: string, snapshot: boolean): Promise<Task> {
324
332
  const copyRes = copyResZ();
325
333
  const response = await sendRequired(
326
334
  this.client,
@@ -329,7 +337,7 @@ export class Client {
329
337
  copyReqZ,
330
338
  copyRes,
331
339
  );
332
- return this.sugar(response.task as Payload);
340
+ return this.sugar(response.task);
333
341
  }
334
342
 
335
343
  async list(rack?: number): Promise<Task[]> {
@@ -385,15 +393,15 @@ export class Client {
385
393
  return await executeCommand({ ...params, frameClient: this.frameClient });
386
394
  }
387
395
 
388
- async executeCommandSync<StatusData extends z.ZodType = z.ZodType>(
396
+ async executeCommandSync<StatusData extends z.ZodType = z.ZodNever>(
389
397
  params: ExecuteCommandsSyncParams<StatusData>,
390
398
  ): Promise<Status<StatusData>[]>;
391
399
 
392
- async executeCommandSync<StatusData extends z.ZodType = z.ZodType>(
400
+ async executeCommandSync<StatusData extends z.ZodType = z.ZodNever>(
393
401
  params: ExecuteCommandSyncParams<StatusData>,
394
402
  ): Promise<Status<StatusData>>;
395
403
 
396
- async executeCommandSync<StatusData extends z.ZodType = z.ZodType>(
404
+ async executeCommandSync<StatusData extends z.ZodType = z.ZodNever>(
397
405
  params:
398
406
  | ExecuteCommandsSyncParams<StatusData>
399
407
  | ExecuteCommandSyncParams<StatusData>,
@@ -423,9 +431,6 @@ export class Client {
423
431
  }
424
432
  }
425
433
 
426
- export const ontologyID = ontology.createIDFactory<Key>("task");
427
- export const TYPE_ONTOLOGY_ID = ontologyID("");
428
-
429
434
  export const statusKey = (key: Key): string => ontology.idToString(ontologyID(key));
430
435
 
431
436
  interface ExecuteCommandInternalParams {
@@ -466,14 +471,14 @@ const executeCommands = async ({
466
471
  return cmds.map((c) => c.key);
467
472
  };
468
473
 
469
- interface ExecuteCommandSyncInternalParams<StatusData extends z.ZodType = z.ZodType>
474
+ interface ExecuteCommandSyncInternalParams<StatusData extends z.ZodType = z.ZodNever>
470
475
  extends
471
476
  Omit<ExecuteCommandsSyncInternalParams<StatusData>, "commands">,
472
477
  TaskExecuteCommandSyncParams {
473
478
  task: Key;
474
479
  }
475
480
 
476
- const executeCommandSync = async <StatusData extends z.ZodType = z.ZodType>({
481
+ const executeCommandSync = async <StatusData extends z.ZodType = z.ZodNever>({
477
482
  frameClient,
478
483
  task,
479
484
  type,
@@ -492,7 +497,7 @@ const executeCommandSync = async <StatusData extends z.ZodType = z.ZodType>({
492
497
  })
493
498
  )[0];
494
499
 
495
- interface ExecuteCommandsSyncInternalParams<StatusData extends z.ZodType = z.ZodType> {
500
+ interface ExecuteCommandsSyncInternalParams<StatusData extends z.ZodType = z.ZodNever> {
496
501
  frameClient: framer.Client | null;
497
502
  commands: NewCommand[];
498
503
  timeout?: CrudeTimeSpan;
@@ -500,7 +505,7 @@ interface ExecuteCommandsSyncInternalParams<StatusData extends z.ZodType = z.Zod
500
505
  name: string | string[] | (() => Promise<string | string[]>);
501
506
  }
502
507
 
503
- const executeCommandsSync = async <StatusData extends z.ZodType = z.ZodType>({
508
+ const executeCommandsSync = async <StatusData extends z.ZodType = z.ZodNever>({
504
509
  frameClient,
505
510
  commands,
506
511
  timeout = TimeSpan.seconds(10),
@@ -559,7 +564,7 @@ const formatTimeoutError = async (
559
564
  } catch (e) {
560
565
  console.error("Failed to retrieve task name for timeout error:", e);
561
566
  return new Error(
562
- `${formattedType} command to task with key ${strings.naturalLanguageJoin(key)} timed out after ${formattedTimeout}`,
567
+ `${formattedType} command to task with key ${strings.naturalLanguageJoin(array.toArray(key).map((k) => k.toString()))} timed out after ${formattedTimeout}`,
563
568
  );
564
569
  }
565
570
  };
@@ -8,4 +8,4 @@
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
10
  export * from "@/task/client";
11
- export * from "@/task/payload";
11
+ export * from "@/task/types.gen";
@@ -9,7 +9,7 @@
9
9
 
10
10
  import { describe, expect, it } from "vitest";
11
11
 
12
- import { newKey, rackKey } from "@/task/payload";
12
+ import { task } from "@/task";
13
13
 
14
14
  describe("newKey", () => {
15
15
  describe("basic key generation", () => {
@@ -24,7 +24,7 @@ describe("newKey", () => {
24
24
  ];
25
25
  cases.forEach(({ rackKey: r, taskKey: t, expected }) => {
26
26
  it(`should combine rackKey=${r} and taskKey=${t}`, () => {
27
- expect(newKey(r, t)).toBe(expected);
27
+ expect(task.newKey(r, t)).toBe(expected);
28
28
  });
29
29
  });
30
30
  });
@@ -34,7 +34,7 @@ describe("newKey", () => {
34
34
  const rackKeys = [0, 1, 42, 1000];
35
35
  rackKeys.forEach((r) => {
36
36
  it(`should default taskKey to 0 for rackKey=${r}`, () => {
37
- expect(newKey(r)).toBe(newKey(r, 0));
37
+ expect(task.newKey(r)).toBe(task.newKey(r, 0));
38
38
  });
39
39
  });
40
40
  });
@@ -49,10 +49,10 @@ describe("newKey", () => {
49
49
  { rack: 100, task: 50000 },
50
50
  { rack: 2147483647, task: 2147483647 }, // max 32-bit signed integers
51
51
  ];
52
- cases.forEach(({ rack, task }) => {
53
- it(`should extract rack=${rack} from key generated with task=${task}`, () => {
54
- const key = newKey(rack, task);
55
- expect(rackKey(key)).toBe(rack);
52
+ cases.forEach(({ rack, task: tsk }) => {
53
+ it(`should extract rack=${rack} from key generated with task=${tsk}`, () => {
54
+ const key = task.newKey(rack, tsk);
55
+ expect(task.rackKey(key)).toBe(rack);
56
56
  });
57
57
  });
58
58
  });
@@ -61,22 +61,22 @@ describe("newKey", () => {
61
61
  // Verifies behavior at boundary values to ensure no overflow or precision issues.
62
62
  it("should handle max 32-bit unsigned rack key", () => {
63
63
  const maxUint32 = 0xffffffff;
64
- const key = newKey(maxUint32, 0);
65
- expect(rackKey(key)).toBe(maxUint32);
64
+ const key = task.newKey(maxUint32, 0);
65
+ expect(task.rackKey(key)).toBe(maxUint32);
66
66
  });
67
67
 
68
68
  it("should handle max 32-bit unsigned task key", () => {
69
69
  const maxUint32 = 0xffffffff;
70
- const key = newKey(1, maxUint32);
70
+ const key = task.newKey(1, maxUint32);
71
71
  expect(key).toBe(((1n << 32n) + BigInt(maxUint32)).toString());
72
72
  });
73
73
 
74
74
  it("should handle both max 32-bit values", () => {
75
75
  const maxUint32 = 0xffffffff;
76
- const key = newKey(maxUint32, maxUint32);
76
+ const key = task.newKey(maxUint32, maxUint32);
77
77
  const expected = ((BigInt(maxUint32) << 32n) + BigInt(maxUint32)).toString();
78
78
  expect(key).toBe(expected);
79
- expect(rackKey(key)).toBe(maxUint32);
79
+ expect(task.rackKey(key)).toBe(maxUint32);
80
80
  });
81
81
  });
82
82
  });
@@ -86,28 +86,28 @@ describe("rackKey", () => {
86
86
  // Keys can be string, bigint, or number per keyZ schema.
87
87
  describe("key format handling", () => {
88
88
  const rack = 42;
89
- const task = 100;
90
- const expectedKey = newKey(rack, task);
89
+ const tsk = 100;
90
+ const expectedKey = task.newKey(rack, tsk);
91
91
 
92
92
  it("should extract rack from string key", () => {
93
- expect(rackKey(expectedKey)).toBe(rack);
93
+ expect(task.rackKey(expectedKey)).toBe(rack);
94
94
  });
95
95
 
96
96
  it("should extract rack from numeric string", () => {
97
97
  const numericKey = ((42n << 32n) + 100n).toString();
98
- expect(rackKey(numericKey)).toBe(42);
98
+ expect(task.rackKey(numericKey)).toBe(42);
99
99
  });
100
100
  });
101
101
 
102
102
  describe("zero handling", () => {
103
103
  // Verifies correct behavior when rack or task portions are zero.
104
104
  it("should return 0 for key with zero rack", () => {
105
- expect(rackKey("100")).toBe(0);
105
+ expect(task.rackKey("100")).toBe(0);
106
106
  });
107
107
 
108
108
  it("should return rack when task portion is zero", () => {
109
- const key = newKey(5, 0);
110
- expect(rackKey(key)).toBe(5);
109
+ const key = task.newKey(5, 0);
110
+ expect(task.rackKey(key)).toBe(5);
111
111
  });
112
112
  });
113
113
  });
@@ -9,6 +9,7 @@
9
9
 
10
10
  import { TimeStamp } from "@synnaxlabs/x";
11
11
  import { beforeAll, describe, expect, it } from "vitest";
12
+ import { z } from "zod";
12
13
 
13
14
  import { ontology } from "@/ontology";
14
15
  import { task } from "@/task";
@@ -46,17 +47,20 @@ describe("Task", async () => {
46
47
  expect(m.config).toStrictEqual(config);
47
48
  });
48
49
  it("should create a task with a custom status", async () => {
50
+ const customStatus = {
51
+ key: "",
52
+ name: "",
53
+ variant: "success" as const,
54
+ message: "Custom task status",
55
+ description: "Task is running",
56
+ time: TimeStamp.now(),
57
+ details: { running: true, data: { customData: true } },
58
+ };
49
59
  const m = await testRack.createTask({
50
60
  name: "task-with-status",
51
61
  config: { test: true },
52
62
  type: "ni",
53
- status: {
54
- variant: "success",
55
- message: "Custom task status",
56
- description: "Task is running",
57
- time: TimeStamp.now(),
58
- details: { running: true, data: { customData: true } },
59
- },
63
+ status: customStatus,
60
64
  });
61
65
  expect(m.key).not.toHaveLength(0);
62
66
  const retrieved = await client.tasks.retrieve({
@@ -78,8 +82,10 @@ describe("Task", async () => {
78
82
  config: { a: "dog" },
79
83
  type: "ni",
80
84
  });
85
+ // Exclude status, internal, snapshot when updating - these have different input/output types
86
+ const { status: _, internal: __, snapshot: ___, ...taskFields } = m;
81
87
  const updated = await client.tasks.create({
82
- ...m,
88
+ ...taskFields,
83
89
  name: "updated",
84
90
  });
85
91
  expect(updated.name).toBe("updated");
@@ -119,7 +125,7 @@ describe("Task", async () => {
119
125
  key: ontology.idToString(task.ontologyID(t.key)),
120
126
  name: "test",
121
127
  variant: "success",
122
- details: { task: t.key, running: false, data: {} },
128
+ details: { task: t.key, running: false, data: undefined },
123
129
  message: "test",
124
130
  time: TimeStamp.now(),
125
131
  };
@@ -522,4 +528,116 @@ describe("Task", async () => {
522
528
  );
523
529
  });
524
530
  });
531
+
532
+ describe("with schemas", () => {
533
+ const schemas = {
534
+ type: z.literal("sensor_task"),
535
+ config: z.object({
536
+ sampleRate: z.number(),
537
+ channels: z.array(z.string()),
538
+ enabled: z.boolean(),
539
+ }),
540
+ statusData: z.object({
541
+ samplesCollected: z.number().optional(),
542
+ }),
543
+ };
544
+
545
+ it("should create and retrieve a task with typed config", async () => {
546
+ const config = {
547
+ sampleRate: 1000,
548
+ channels: ["ch1", "ch2"],
549
+ enabled: true,
550
+ };
551
+ const t = await testRack.createTask(
552
+ {
553
+ name: "typed-config-task",
554
+ type: "sensor_task",
555
+ config,
556
+ },
557
+ schemas,
558
+ );
559
+ expect(t.config.sampleRate).toBe(1000);
560
+ expect(t.config.channels).toEqual(["ch1", "ch2"]);
561
+ expect(t.config.enabled).toBe(true);
562
+
563
+ const retrieved = await client.tasks.retrieve({
564
+ key: t.key,
565
+ schemas,
566
+ });
567
+ expect(retrieved.config.sampleRate).toBe(1000);
568
+ expect(retrieved.config.channels).toEqual(["ch1", "ch2"]);
569
+ expect(retrieved.type).toBe("sensor_task");
570
+ });
571
+
572
+ it("should retrieve multiple tasks with schemas", async () => {
573
+ const t1 = await testRack.createTask(
574
+ {
575
+ name: "multi-schema-1",
576
+ type: "sensor_task",
577
+ config: { sampleRate: 100, channels: ["a"], enabled: true },
578
+ },
579
+ schemas,
580
+ );
581
+ const t2 = await testRack.createTask(
582
+ {
583
+ name: "multi-schema-2",
584
+ type: "sensor_task",
585
+ config: { sampleRate: 200, channels: ["b", "c"], enabled: false },
586
+ },
587
+ schemas,
588
+ );
589
+
590
+ const retrieved = await client.tasks.retrieve({
591
+ keys: [t1.key, t2.key],
592
+ schemas,
593
+ });
594
+ expect(retrieved).toHaveLength(2);
595
+ expect(retrieved[0].config.sampleRate).toBe(100);
596
+ expect(retrieved[1].config.sampleRate).toBe(200);
597
+ });
598
+
599
+ it("should retrieve task by name with schemas", async () => {
600
+ const uniqueName = `schema-name-test-${Date.now()}`;
601
+ await testRack.createTask(
602
+ {
603
+ name: uniqueName,
604
+ type: "sensor_task",
605
+ config: { sampleRate: 500, channels: ["x"], enabled: true },
606
+ },
607
+ schemas,
608
+ );
609
+
610
+ const retrieved = await client.tasks.retrieve({
611
+ name: uniqueName,
612
+ schemas,
613
+ });
614
+ expect(retrieved.name).toBe(uniqueName);
615
+ expect(retrieved.config.sampleRate).toBe(500);
616
+ });
617
+
618
+ it("should retrieve task by type with schemas", async () => {
619
+ const customSchemas = {
620
+ type: z.literal("unique_type_test"),
621
+ config: z.object({ value: z.number() }),
622
+ statusData: z.unknown(),
623
+ };
624
+
625
+ await testRack.createTask(
626
+ {
627
+ name: "type-filter-test",
628
+ type: "unique_type_test",
629
+ config: { value: 42 },
630
+ },
631
+ customSchemas,
632
+ );
633
+
634
+ const retrieved = await client.tasks.retrieve({
635
+ type: "unique_type_test",
636
+ rack: testRack.key,
637
+ schemas: customSchemas,
638
+ });
639
+ expect(retrieved.type).toBe("unique_type_test");
640
+ expect(retrieved.config.value).toBe(42);
641
+ });
642
+ });
525
643
  });
@@ -0,0 +1,169 @@
1
+ // Copyright 2026 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.
9
+
10
+ // Code generated by Oracle. DO NOT EDIT.
11
+
12
+ import { caseconv, type optional, record, status, zod } from "@synnaxlabs/x";
13
+ import { z } from "zod";
14
+
15
+ import { ontology } from "@/ontology";
16
+
17
+ export const keyZ = z
18
+ .string()
19
+ .or(z.number().transform(String).or(z.bigint().transform(String)));
20
+ export type Key = z.infer<typeof keyZ>;
21
+
22
+ export type StatusDetailsZodObject<Data extends z.ZodType = z.ZodNever> = z.ZodObject<{
23
+ task: typeof keyZ;
24
+ running: z.ZodBoolean;
25
+ cmd: z.ZodOptional<z.ZodString>;
26
+ data: [Data] extends [z.ZodNever] ? z.ZodOptional<z.ZodUnknown> : Data;
27
+ }>;
28
+
29
+ export interface StatusDetailsZFunction {
30
+ <Data extends z.ZodType>(data: Data): StatusDetailsZodObject<Data>;
31
+ <Data extends z.ZodType = z.ZodNever>(data?: Data): StatusDetailsZodObject<Data>;
32
+ }
33
+
34
+ export const statusDetailsZ: StatusDetailsZFunction = <Data extends z.ZodType>(
35
+ data?: Data,
36
+ ) =>
37
+ z.object({
38
+ task: keyZ,
39
+ running: z.boolean(),
40
+ cmd: z.string().optional(),
41
+ data: data ?? z.unknown().optional(),
42
+ });
43
+ export type StatusDetails<Data extends z.ZodType = z.ZodNever> = {
44
+ task: Key;
45
+ running: boolean;
46
+ cmd?: string;
47
+ } & ([Data] extends [z.ZodNever] ? {} : { data: z.infer<Data> });
48
+
49
+ export type NewStatusDetailsZodObject<Data extends z.ZodType = z.ZodNever> =
50
+ z.ZodObject<{
51
+ task: z.ZodOptional<typeof keyZ>;
52
+ running: z.ZodBoolean;
53
+ cmd: z.ZodOptional<z.ZodString>;
54
+ data: [Data] extends [z.ZodNever] ? z.ZodOptional<z.ZodUnknown> : Data;
55
+ }>;
56
+
57
+ export interface NewStatusDetailsZFunction {
58
+ <Data extends z.ZodType>(data: Data): NewStatusDetailsZodObject<Data>;
59
+ <Data extends z.ZodType = z.ZodNever>(data?: Data): NewStatusDetailsZodObject<Data>;
60
+ }
61
+
62
+ export const newStatusDetailsZ: NewStatusDetailsZFunction = <Data extends z.ZodType>(
63
+ data?: Data,
64
+ ) =>
65
+ z.object({
66
+ task: keyZ.optional(),
67
+ running: z.boolean(),
68
+ cmd: z.string().optional(),
69
+ data: data ?? z.unknown().optional(),
70
+ });
71
+ export type NewStatusDetails<Data extends z.ZodType = z.ZodNever> = {
72
+ task?: Key;
73
+ running: boolean;
74
+ cmd?: string;
75
+ } & ([Data] extends [z.ZodNever] ? {} : { data: z.infer<Data> });
76
+
77
+ /** Command is a command to execute on a task in the Driver system. */
78
+ export const commandZ = z.object({
79
+ /** task is the key of the target task. */
80
+ task: keyZ,
81
+ /** type is the command type (e.g., 'start', 'stop', 'configure'). */
82
+ type: z.string(),
83
+ /** key is a unique identifier for this command instance. */
84
+ key: z.string(),
85
+ /** args contains optional arguments for the command. */
86
+ args: caseconv.preserveCase(zod.nullToUndefined(record.unknownZ())),
87
+ });
88
+ export interface Command extends z.infer<typeof commandZ> {}
89
+
90
+ export const statusZ = <Data extends z.ZodType = z.ZodNever>(data?: Data) =>
91
+ status.statusZ({ details: statusDetailsZ(data) });
92
+ export type Status<Data extends z.ZodType = z.ZodNever> = z.infer<
93
+ ReturnType<typeof statusZ<Data>>
94
+ >;
95
+
96
+ export const newStatusZ = <Data extends z.ZodType = z.ZodNever>(data?: Data) =>
97
+ status.newZ({ details: newStatusDetailsZ(data) });
98
+ export type NewStatus<Data extends z.ZodType = z.ZodNever> = z.infer<
99
+ ReturnType<typeof newStatusZ<Data>>
100
+ >;
101
+
102
+ export interface PayloadSchemas<
103
+ Type extends z.ZodType<string> = z.ZodType<string>,
104
+ Config extends z.ZodType<record.Unknown> = z.ZodType<record.Unknown>,
105
+ StatusData extends z.ZodType = z.ZodType,
106
+ > {
107
+ type: Type;
108
+ config: Config;
109
+ statusData: StatusData;
110
+ }
111
+
112
+ export const payloadZ = <
113
+ Type extends z.ZodType<string> = z.ZodString,
114
+ Config extends z.ZodType<record.Unknown> = z.ZodType<record.Unknown>,
115
+ StatusData extends z.ZodType = z.ZodNever,
116
+ >({
117
+ type,
118
+ config,
119
+ statusData,
120
+ }: Partial<PayloadSchemas<Type, Config, StatusData>> = {}) =>
121
+ z.object({
122
+ key: keyZ,
123
+ name: z.string(),
124
+ type: type ?? z.string(),
125
+ config: config ?? record.nullishToEmpty(),
126
+ internal: z.boolean().optional(),
127
+ snapshot: z.boolean().optional(),
128
+ status: status.statusZ({ details: statusDetailsZ(statusData) }).optional(),
129
+ });
130
+ export interface Payload<S extends PayloadSchemas = PayloadSchemas> {
131
+ key: Key;
132
+ name: string;
133
+ type: z.infer<S["type"]>;
134
+ config: z.infer<S["config"]>;
135
+ internal?: boolean;
136
+ snapshot?: boolean;
137
+ status?: Status<S["statusData"]>;
138
+ }
139
+
140
+ export interface NewSchemas<
141
+ Type extends z.ZodType<string> = z.ZodType<string>,
142
+ Config extends z.ZodType<record.Unknown> = z.ZodType<record.Unknown>,
143
+ StatusData extends z.ZodType = z.ZodType,
144
+ > {
145
+ type: Type;
146
+ config: Config;
147
+ statusData: StatusData;
148
+ }
149
+
150
+ export const newZ = <
151
+ Type extends z.ZodType<string> = z.ZodString,
152
+ Config extends z.ZodType<record.Unknown> = z.ZodType<record.Unknown>,
153
+ StatusData extends z.ZodType = z.ZodNever,
154
+ >({ type, config, statusData }: Partial<NewSchemas<Type, Config, StatusData>> = {}) =>
155
+ payloadZ({ type, config, statusData })
156
+ .omit({ internal: true, snapshot: true, status: true })
157
+ .partial({ key: true })
158
+ .extend({
159
+ status: status.newZ({ details: newStatusDetailsZ(statusData) }).optional(),
160
+ });
161
+ export type New<S extends NewSchemas = NewSchemas> = optional.Optional<
162
+ Omit<Payload<S>, "internal" | "snapshot" | "status">,
163
+ "key"
164
+ > & {
165
+ status?: NewStatus<S["statusData"]>;
166
+ };
167
+
168
+ export const ontologyID = ontology.createIDFactory<Key>("task");
169
+ export const TYPE_ONTOLOGY_ID = ontologyID("");
@@ -13,7 +13,7 @@ import { z } from "zod";
13
13
 
14
14
  import { MultipleFoundError, NotFoundError } from "@/errors";
15
15
  import { ontology } from "@/ontology";
16
- import { type Key, keyZ, type New, newZ, type User, userZ } from "@/user/payload";
16
+ import { type Key, keyZ, type New, newZ, type User, userZ } from "@/user/types.gen";
17
17
 
18
18
  const retrieveRequestZ = z.object({
19
19
  keys: keyZ.array().optional(),
@@ -53,7 +53,7 @@ export type RetrieveArgs = z.input<typeof retrieveArgsZ>;
53
53
 
54
54
  export interface RetrieveRequest extends z.infer<typeof retrieveRequestZ> {}
55
55
 
56
- const retrieveResZ = z.object({ users: array.nullableZ(userZ) });
56
+ const retrieveResZ = z.object({ users: array.nullishToEmpty(userZ) });
57
57
 
58
58
  const createReqZ = z.object({ users: newZ.array() });
59
59
  const createResZ = z.object({ users: userZ.array() });
@@ -19,4 +19,4 @@ export {
19
19
  type UsernameRetrieveRequest,
20
20
  type UsernamesRetrieveRequest,
21
21
  } from "@/user/client";
22
- export * from "@/user/payload";
22
+ export * from "@/user/types.gen";