@synnaxlabs/client 0.43.0 → 0.44.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 (245) hide show
  1. package/.turbo/turbo-build.log +7 -7
  2. package/dist/access/payload.d.ts +1 -1
  3. package/dist/access/payload.d.ts.map +1 -1
  4. package/dist/access/policy/client.d.ts +263 -6
  5. package/dist/access/policy/client.d.ts.map +1 -1
  6. package/dist/access/policy/external.d.ts +0 -1
  7. package/dist/access/policy/external.d.ts.map +1 -1
  8. package/dist/access/policy/payload.d.ts +105 -93
  9. package/dist/access/policy/payload.d.ts.map +1 -1
  10. package/dist/auth/auth.d.ts +1 -1
  11. package/dist/auth/auth.d.ts.map +1 -1
  12. package/dist/channel/client.d.ts +12 -13
  13. package/dist/channel/client.d.ts.map +1 -1
  14. package/dist/channel/payload.d.ts +77 -19
  15. package/dist/channel/payload.d.ts.map +1 -1
  16. package/dist/channel/retriever.d.ts +9 -16
  17. package/dist/channel/retriever.d.ts.map +1 -1
  18. package/dist/channel/writer.d.ts +1 -1
  19. package/dist/channel/writer.d.ts.map +1 -1
  20. package/dist/client.cjs +27 -135
  21. package/dist/client.d.ts +3 -3
  22. package/dist/client.d.ts.map +1 -1
  23. package/dist/client.js +8619 -28938
  24. package/dist/connection/checker.d.ts +1 -1
  25. package/dist/connection/checker.d.ts.map +1 -1
  26. package/dist/control/client.d.ts +1 -0
  27. package/dist/control/client.d.ts.map +1 -1
  28. package/dist/control/state.d.ts +6 -6
  29. package/dist/control/state.d.ts.map +1 -1
  30. package/dist/errors.d.ts +18 -5
  31. package/dist/errors.d.ts.map +1 -1
  32. package/dist/framer/adapter.d.ts +3 -3
  33. package/dist/framer/adapter.d.ts.map +1 -1
  34. package/dist/framer/client.d.ts +4 -13
  35. package/dist/framer/client.d.ts.map +1 -1
  36. package/dist/framer/codec.d.ts +1 -1
  37. package/dist/framer/codec.d.ts.map +1 -1
  38. package/dist/framer/deleter.d.ts +5 -5
  39. package/dist/framer/deleter.d.ts.map +1 -1
  40. package/dist/framer/frame.d.ts +5 -7
  41. package/dist/framer/frame.d.ts.map +1 -1
  42. package/dist/framer/streamProxy.d.ts +1 -1
  43. package/dist/framer/streamProxy.d.ts.map +1 -1
  44. package/dist/framer/streamer.d.ts +139 -20
  45. package/dist/framer/streamer.d.ts.map +1 -1
  46. package/dist/framer/writer.d.ts +222 -33
  47. package/dist/framer/writer.d.ts.map +1 -1
  48. package/dist/hardware/device/client.d.ts +49 -28
  49. package/dist/hardware/device/client.d.ts.map +1 -1
  50. package/dist/hardware/device/payload.d.ts +126 -46
  51. package/dist/hardware/device/payload.d.ts.map +1 -1
  52. package/dist/hardware/rack/client.d.ts +78 -22
  53. package/dist/hardware/rack/client.d.ts.map +1 -1
  54. package/dist/hardware/rack/payload.d.ts +99 -56
  55. package/dist/hardware/rack/payload.d.ts.map +1 -1
  56. package/dist/hardware/task/client.d.ts +100 -41
  57. package/dist/hardware/task/client.d.ts.map +1 -1
  58. package/dist/hardware/task/payload.d.ts +83 -61
  59. package/dist/hardware/task/payload.d.ts.map +1 -1
  60. package/dist/index.d.ts +2 -2
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/label/client.d.ts +138 -20
  63. package/dist/label/client.d.ts.map +1 -1
  64. package/dist/label/external.d.ts +0 -2
  65. package/dist/label/external.d.ts.map +1 -1
  66. package/dist/label/payload.d.ts +4 -5
  67. package/dist/label/payload.d.ts.map +1 -1
  68. package/dist/ontology/client.d.ts +45 -135
  69. package/dist/ontology/client.d.ts.map +1 -1
  70. package/dist/ontology/group/group.d.ts +3 -3
  71. package/dist/ontology/group/group.d.ts.map +1 -1
  72. package/dist/ontology/group/payload.d.ts +3 -27
  73. package/dist/ontology/group/payload.d.ts.map +1 -1
  74. package/dist/ontology/payload.d.ts +113 -243
  75. package/dist/ontology/payload.d.ts.map +1 -1
  76. package/dist/ontology/writer.d.ts +4 -4
  77. package/dist/ontology/writer.d.ts.map +1 -1
  78. package/dist/ranger/alias.d.ts +11 -5
  79. package/dist/ranger/alias.d.ts.map +1 -1
  80. package/dist/ranger/client.d.ts +87 -30
  81. package/dist/ranger/client.d.ts.map +1 -1
  82. package/dist/ranger/external.d.ts +1 -1
  83. package/dist/ranger/external.d.ts.map +1 -1
  84. package/dist/ranger/kv.d.ts +10 -12
  85. package/dist/ranger/kv.d.ts.map +1 -1
  86. package/dist/ranger/payload.d.ts +23 -44
  87. package/dist/ranger/payload.d.ts.map +1 -1
  88. package/dist/ranger/writer.d.ts +22 -19
  89. package/dist/ranger/writer.d.ts.map +1 -1
  90. package/dist/testutil/client.d.ts +4 -0
  91. package/dist/testutil/client.d.ts.map +1 -0
  92. package/dist/user/client.d.ts +59 -6
  93. package/dist/user/client.d.ts.map +1 -1
  94. package/dist/user/payload.d.ts +4 -6
  95. package/dist/user/payload.d.ts.map +1 -1
  96. package/dist/user/retriever.d.ts +2 -2
  97. package/dist/user/retriever.d.ts.map +1 -1
  98. package/dist/util/decodeJSONString.d.ts +2 -2
  99. package/dist/util/decodeJSONString.d.ts.map +1 -1
  100. package/dist/util/parseWithoutKeyConversion.d.ts +2 -2
  101. package/dist/util/parseWithoutKeyConversion.d.ts.map +1 -1
  102. package/dist/util/retrieve.d.ts +1 -1
  103. package/dist/util/retrieve.d.ts.map +1 -1
  104. package/dist/util/zod.d.ts +1 -1
  105. package/dist/util/zod.d.ts.map +1 -1
  106. package/dist/workspace/client.d.ts +17 -6
  107. package/dist/workspace/client.d.ts.map +1 -1
  108. package/dist/workspace/lineplot/client.d.ts +2 -2
  109. package/dist/workspace/lineplot/client.d.ts.map +1 -1
  110. package/dist/workspace/lineplot/payload.d.ts +8 -9
  111. package/dist/workspace/lineplot/payload.d.ts.map +1 -1
  112. package/dist/workspace/log/client.d.ts +2 -2
  113. package/dist/workspace/log/client.d.ts.map +1 -1
  114. package/dist/workspace/log/payload.d.ts +8 -9
  115. package/dist/workspace/log/payload.d.ts.map +1 -1
  116. package/dist/workspace/payload.d.ts +10 -11
  117. package/dist/workspace/payload.d.ts.map +1 -1
  118. package/dist/workspace/schematic/client.d.ts +2 -2
  119. package/dist/workspace/schematic/client.d.ts.map +1 -1
  120. package/dist/workspace/schematic/payload.d.ts +10 -11
  121. package/dist/workspace/schematic/payload.d.ts.map +1 -1
  122. package/dist/workspace/table/client.d.ts +2 -2
  123. package/dist/workspace/table/client.d.ts.map +1 -1
  124. package/dist/workspace/table/payload.d.ts +10 -11
  125. package/dist/workspace/table/payload.d.ts.map +1 -1
  126. package/examples/node/package-lock.json +47 -39
  127. package/examples/node/package.json +2 -1
  128. package/examples/node/streamWrite.js +5 -11
  129. package/package.json +14 -13
  130. package/src/access/payload.ts +1 -1
  131. package/src/access/policy/client.ts +87 -32
  132. package/src/access/policy/external.ts +0 -1
  133. package/src/access/policy/payload.ts +4 -4
  134. package/src/access/policy/policy.spec.ts +86 -83
  135. package/src/auth/auth.spec.ts +29 -18
  136. package/src/auth/auth.ts +1 -1
  137. package/src/channel/batchRetriever.spec.ts +4 -9
  138. package/src/channel/channel.spec.ts +24 -6
  139. package/src/channel/client.ts +31 -46
  140. package/src/channel/payload.ts +13 -14
  141. package/src/channel/retriever.ts +26 -41
  142. package/src/channel/writer.ts +3 -3
  143. package/src/client.ts +4 -4
  144. package/src/connection/checker.ts +1 -1
  145. package/src/connection/connection.spec.ts +31 -23
  146. package/src/control/client.ts +2 -2
  147. package/src/control/state.spec.ts +3 -3
  148. package/src/control/state.ts +1 -1
  149. package/src/errors.spec.ts +9 -5
  150. package/src/errors.ts +28 -15
  151. package/src/framer/adapter.spec.ts +118 -9
  152. package/src/framer/adapter.ts +24 -11
  153. package/src/framer/client.spec.ts +125 -2
  154. package/src/framer/client.ts +41 -47
  155. package/src/framer/codec.ts +1 -1
  156. package/src/framer/deleter.spec.ts +2 -2
  157. package/src/framer/deleter.ts +1 -1
  158. package/src/framer/frame.ts +1 -4
  159. package/src/framer/iterator.spec.ts +8 -8
  160. package/src/framer/iterator.ts +1 -1
  161. package/src/framer/streamProxy.ts +1 -1
  162. package/src/framer/streamer.spec.ts +185 -36
  163. package/src/framer/streamer.ts +28 -36
  164. package/src/framer/writer.spec.ts +6 -6
  165. package/src/framer/writer.ts +97 -111
  166. package/src/hardware/device/client.ts +45 -131
  167. package/src/hardware/device/device.spec.ts +163 -52
  168. package/src/hardware/device/payload.ts +10 -21
  169. package/src/hardware/rack/client.ts +87 -105
  170. package/src/hardware/rack/payload.ts +4 -13
  171. package/src/hardware/rack/rack.spec.ts +28 -35
  172. package/src/hardware/task/client.ts +335 -291
  173. package/src/hardware/task/payload.ts +86 -62
  174. package/src/hardware/task/task.spec.ts +208 -32
  175. package/src/index.ts +2 -1
  176. package/src/label/client.ts +100 -95
  177. package/src/label/external.ts +0 -2
  178. package/src/label/label.spec.ts +8 -6
  179. package/src/label/payload.ts +3 -4
  180. package/src/ontology/client.ts +41 -324
  181. package/src/ontology/group/group.spec.ts +2 -2
  182. package/src/ontology/group/group.ts +4 -5
  183. package/src/ontology/group/payload.ts +2 -25
  184. package/src/ontology/group/writer.ts +1 -1
  185. package/src/ontology/ontology.spec.ts +355 -41
  186. package/src/ontology/payload.ts +74 -112
  187. package/src/ontology/writer.ts +8 -17
  188. package/src/ranger/alias.ts +19 -37
  189. package/src/ranger/client.ts +118 -150
  190. package/src/ranger/external.ts +9 -1
  191. package/src/ranger/kv.ts +6 -27
  192. package/src/ranger/payload.ts +21 -37
  193. package/src/ranger/ranger.spec.ts +37 -56
  194. package/src/ranger/writer.ts +1 -1
  195. package/src/{signals/index.ts → testutil/client.ts} +11 -1
  196. package/src/user/client.ts +122 -47
  197. package/src/user/payload.ts +2 -5
  198. package/src/user/retriever.ts +1 -1
  199. package/src/user/user.spec.ts +31 -31
  200. package/src/user/writer.ts +1 -1
  201. package/src/util/decodeJSONString.ts +3 -3
  202. package/src/util/parseWithoutKeyConversion.ts +2 -2
  203. package/src/util/retrieve.ts +1 -1
  204. package/src/util/zod.ts +1 -1
  205. package/src/workspace/client.ts +20 -36
  206. package/src/workspace/lineplot/client.ts +5 -7
  207. package/src/workspace/lineplot/lineplot.spec.ts +2 -2
  208. package/src/workspace/lineplot/payload.ts +4 -7
  209. package/src/workspace/log/client.ts +5 -7
  210. package/src/workspace/log/log.spec.ts +2 -2
  211. package/src/workspace/log/payload.ts +4 -7
  212. package/src/workspace/payload.ts +4 -7
  213. package/src/workspace/schematic/client.ts +5 -7
  214. package/src/workspace/schematic/payload.ts +4 -7
  215. package/src/workspace/schematic/schematic.spec.ts +2 -2
  216. package/src/workspace/table/client.ts +5 -7
  217. package/src/workspace/table/payload.ts +4 -7
  218. package/src/workspace/table/table.spec.ts +2 -2
  219. package/src/workspace/workspace.spec.ts +2 -2
  220. package/dist/access/policy/ontology.d.ts +0 -5
  221. package/dist/access/policy/ontology.d.ts.map +0 -1
  222. package/dist/access/policy/retriever.d.ts +0 -40
  223. package/dist/access/policy/retriever.d.ts.map +0 -1
  224. package/dist/access/policy/writer.d.ts +0 -9
  225. package/dist/access/policy/writer.d.ts.map +0 -1
  226. package/dist/label/retriever.d.ts +0 -14
  227. package/dist/label/retriever.d.ts.map +0 -1
  228. package/dist/label/writer.d.ts +0 -54
  229. package/dist/label/writer.d.ts.map +0 -1
  230. package/dist/setupspecs.d.ts +0 -5
  231. package/dist/setupspecs.d.ts.map +0 -1
  232. package/dist/signals/external.d.ts +0 -2
  233. package/dist/signals/external.d.ts.map +0 -1
  234. package/dist/signals/index.d.ts +0 -2
  235. package/dist/signals/index.d.ts.map +0 -1
  236. package/dist/signals/observable.d.ts +0 -12
  237. package/dist/signals/observable.d.ts.map +0 -1
  238. package/src/access/policy/ontology.ts +0 -17
  239. package/src/access/policy/retriever.ts +0 -44
  240. package/src/access/policy/writer.ts +0 -65
  241. package/src/label/retriever.ts +0 -63
  242. package/src/label/writer.ts +0 -95
  243. package/src/setupspecs.ts +0 -27
  244. package/src/signals/external.ts +0 -10
  245. package/src/signals/observable.ts +0 -42
@@ -9,7 +9,16 @@
9
9
  "version": "1.0.0",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
- "@synnaxlabs/client": "^0.37.0"
12
+ "@synnaxlabs/client": "^0.43.0"
13
+ }
14
+ },
15
+ "node_modules/@msgpack/msgpack": {
16
+ "version": "3.1.2",
17
+ "resolved": "https://registry.npmjs.org/@msgpack/msgpack/-/msgpack-3.1.2.tgz",
18
+ "integrity": "sha512-JEW4DEtBzfe8HvUYecLU9e6+XJnKDlUAIve8FvPzF3Kzs6Xo/KuZkZJsDH0wJXl/qEZbeeE7edxDNY3kMs39hQ==",
19
+ "license": "ISC",
20
+ "engines": {
21
+ "node": ">= 18"
13
22
  }
14
23
  },
15
24
  "node_modules/@opentelemetry/api": {
@@ -22,50 +31,49 @@
22
31
  }
23
32
  },
24
33
  "node_modules/@synnaxlabs/alamos": {
25
- "version": "0.37.0",
26
- "resolved": "https://registry.npmjs.org/@synnaxlabs/alamos/-/alamos-0.37.0.tgz",
27
- "integrity": "sha512-t37+2ZPUVIST2jMKN8tqil68nrV9BIRhIpPjJrOPDUC2Nl81xBb58i0yc0308vJ4uS2oO/WdhQVRAvdJtpEH/Q==",
34
+ "version": "0.43.0",
35
+ "resolved": "https://registry.npmjs.org/@synnaxlabs/alamos/-/alamos-0.43.0.tgz",
36
+ "integrity": "sha512-NSBfO4eGLqEUuMvGqYEq8mdoezA/+mSFZR2+NJ7yQMbAsDE4yUWLol2RaakiZNV8rZk5vszEI/rc2BhY7RMdug==",
28
37
  "license": "MIT",
29
38
  "dependencies": {
30
39
  "@opentelemetry/api": "^1.9.0",
31
- "@synnaxlabs/x": "0.37.0"
32
- },
33
- "engines": {
34
- "node": ">=18"
40
+ "@synnaxlabs/x": "0.43.0"
35
41
  }
36
42
  },
37
43
  "node_modules/@synnaxlabs/client": {
38
- "version": "0.37.0",
39
- "resolved": "https://registry.npmjs.org/@synnaxlabs/client/-/client-0.37.0.tgz",
40
- "integrity": "sha512-XTIZpPLEL6iVjjtIhn0Nv67yiEHl03B0DAYn3lBXjMBqkIDJ25bMwuSc/RaF72B9QRKe8xrBSXHX1H3ZxRPj0Q==",
44
+ "version": "0.43.0",
45
+ "resolved": "https://registry.npmjs.org/@synnaxlabs/client/-/client-0.43.0.tgz",
46
+ "integrity": "sha512-u+1IlU+R2jmy/sFJKc/9T9AeHvTERLhtVF2dWK3CcxrjyjNVNEzfOMBQXlEF4CZJtuMmiv4cgw5S7UL64hCW3w==",
41
47
  "license": "BUSL-1.1",
42
48
  "dependencies": {
43
- "@synnaxlabs/freighter": "0.37.0",
44
- "@synnaxlabs/x": "0.37.0",
49
+ "@synnaxlabs/freighter": "0.43.0",
50
+ "@synnaxlabs/x": "0.43.0",
45
51
  "async-mutex": "^0.5.0",
46
- "uuid": "^11.0.3",
47
- "zod": "^3.24.1"
52
+ "zod": "^3.25.63"
48
53
  }
49
54
  },
50
55
  "node_modules/@synnaxlabs/freighter": {
51
- "version": "0.37.0",
52
- "resolved": "https://registry.npmjs.org/@synnaxlabs/freighter/-/freighter-0.37.0.tgz",
53
- "integrity": "sha512-gQ7eBdA9NwurAJVvZK5jKvrARds9omL+xu71eHj+g20a18mnce7oBvZPA5y/mSz5A3HmiQnikuxLwIdbZ1vToA==",
56
+ "version": "0.43.0",
57
+ "resolved": "https://registry.npmjs.org/@synnaxlabs/freighter/-/freighter-0.43.0.tgz",
58
+ "integrity": "sha512-b/TPZjgg1M9fdK1B8AkofhJ+fC47XqdUfjN/xPvVHzKx371bkr+LeYnVBN+FPhWP+20uL6SPxlGK5R/zWra6oQ==",
54
59
  "dependencies": {
55
- "@synnaxlabs/alamos": "0.37.0",
56
- "@synnaxlabs/x": "0.37.0",
60
+ "@synnaxlabs/alamos": "0.43.0",
61
+ "@synnaxlabs/x": "0.43.0",
57
62
  "node-fetch": "^2.7.0",
58
- "ws": "^8.18.0",
59
- "zod": "^3.24.1"
63
+ "ws": "^8.18.2",
64
+ "zod": "^3.25.63"
60
65
  }
61
66
  },
62
67
  "node_modules/@synnaxlabs/x": {
63
- "version": "0.37.0",
64
- "resolved": "https://registry.npmjs.org/@synnaxlabs/x/-/x-0.37.0.tgz",
65
- "integrity": "sha512-Xhpmj3myoIUeyAGveYZlhAr5AsWtuN4XdZJkDTwQ0x0nPhp0HvOFsM1I9Eora2gUEglas930V0ptBhZTCRni5Q==",
68
+ "version": "0.43.0",
69
+ "resolved": "https://registry.npmjs.org/@synnaxlabs/x/-/x-0.43.0.tgz",
70
+ "integrity": "sha512-DsMuFjKtTvscfjEq3PeUhMdkHf9CuPUEyYGjGJhthqn19KftNRzoFqlPvvQsngq9bjv7shd4p0qaMOm4y/FimQ==",
66
71
  "dependencies": {
67
- "nanoid": "^5.0.9",
68
- "zod": "^3.24.1"
72
+ "@msgpack/msgpack": "^3.1.2",
73
+ "async-mutex": "^0.5.0",
74
+ "nanoid": "^5.1.5",
75
+ "uuid": "^11.1.0",
76
+ "zod": "^3.25.63"
69
77
  }
70
78
  },
71
79
  "node_modules/async-mutex": {
@@ -78,9 +86,9 @@
78
86
  }
79
87
  },
80
88
  "node_modules/nanoid": {
81
- "version": "5.0.9",
82
- "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.0.9.tgz",
83
- "integrity": "sha512-Aooyr6MXU6HpvvWXKoVoXwKMs/KyVakWwg7xQfv5/S/RIgJMy0Ifa45H9qqYy7pTCszrHzP21Uk4PZq2HpEM8Q==",
89
+ "version": "5.1.5",
90
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.1.5.tgz",
91
+ "integrity": "sha512-Ir/+ZpE9fDsNH0hQ3C68uyThDXzYcim2EqcZ8zn8Chtt1iylPT9xXJB0kPCnqzgcEGikO9RxSrh63MsmVCU7Fw==",
84
92
  "funding": [
85
93
  {
86
94
  "type": "github",
@@ -128,9 +136,9 @@
128
136
  "license": "0BSD"
129
137
  },
130
138
  "node_modules/uuid": {
131
- "version": "11.0.5",
132
- "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.0.5.tgz",
133
- "integrity": "sha512-508e6IcKLrhxKdBbcA2b4KQZlLVp2+J5UwQ6F7Drckkc5N9ZJwFa4TgWtsww9UG8fGHbm6gbV19TdM5pQ4GaIA==",
139
+ "version": "11.1.0",
140
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz",
141
+ "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==",
134
142
  "funding": [
135
143
  "https://github.com/sponsors/broofa",
136
144
  "https://github.com/sponsors/ctavan"
@@ -157,9 +165,9 @@
157
165
  }
158
166
  },
159
167
  "node_modules/ws": {
160
- "version": "8.18.0",
161
- "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz",
162
- "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==",
168
+ "version": "8.18.2",
169
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.2.tgz",
170
+ "integrity": "sha512-DMricUmwGZUVr++AEAe2uiVM7UoO9MAVZMDu05UQOaUII0lp+zOzLLU4Xqh/JvTqklB1T4uELaaPBKyjE1r4fQ==",
163
171
  "license": "MIT",
164
172
  "engines": {
165
173
  "node": ">=10.0.0"
@@ -178,9 +186,9 @@
178
186
  }
179
187
  },
180
188
  "node_modules/zod": {
181
- "version": "3.24.1",
182
- "resolved": "https://registry.npmjs.org/zod/-/zod-3.24.1.tgz",
183
- "integrity": "sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==",
189
+ "version": "3.25.64",
190
+ "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.64.tgz",
191
+ "integrity": "sha512-hbP9FpSZf7pkS7hRVUrOjhwKJNyampPgtXKc3AN6DsWtoHsg2Sb4SQaS4Tcay380zSwd2VPo9G9180emBACp5g==",
184
192
  "license": "MIT",
185
193
  "funding": {
186
194
  "url": "https://github.com/sponsors/colinhacks"
@@ -4,6 +4,7 @@
4
4
  "version": "1.0.0",
5
5
  "description": "",
6
6
  "main": "index.js",
7
+ "private": true,
7
8
  "scripts": {
8
9
  "main": "node index.js"
9
10
  },
@@ -11,6 +12,6 @@
11
12
  "author": "",
12
13
  "license": "ISC",
13
14
  "dependencies": {
14
- "@synnaxlabs/client": "^0.38.0"
15
+ "@synnaxlabs/client": "^0.43.0"
15
16
  }
16
17
  }
@@ -74,17 +74,11 @@ try {
74
74
  const timestamp = TimeStamp.now();
75
75
  const data1 = Math.sin(i / 10);
76
76
  const data2 = i % 2;
77
- if (
78
- !(await writer.write({
79
- [timeChannel.key]: timestamp,
80
- [dataChannel1.key]: data1,
81
- [dataChannel2.key]: data2,
82
- }))
83
- ) {
84
- console.error("Failed to write");
85
- break;
86
- }
87
-
77
+ await writer.write({
78
+ [timeChannel.key]: timestamp,
79
+ [dataChannel1.key]: data1,
80
+ [dataChannel2.key]: data2,
81
+ });
88
82
  if (i % 60 == 0) console.log(`Writing sample ${i} at ${timestamp.toISOString()}`);
89
83
  }
90
84
  } finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synnaxlabs/client",
3
- "version": "0.43.0",
3
+ "version": "0.44.1",
4
4
  "description": "The Synnax Client Library",
5
5
  "keywords": [
6
6
  "synnax",
@@ -25,20 +25,21 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "async-mutex": "^0.5.0",
28
- "zod": "^3.25.63",
29
- "@synnaxlabs/freighter": "0.43.0",
30
- "@synnaxlabs/x": "0.43.0"
28
+ "zod": "^4.0.2",
29
+ "@synnaxlabs/freighter": "^0.44.0",
30
+ "@synnaxlabs/x": "^0.44.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@types/node": "^24.0.1",
34
- "eslint": "^9.28.0",
33
+ "@vitest/coverage-v8": "^3.2.4",
34
+ "@types/node": "^24.0.12",
35
+ "eslint": "^9.30.1",
35
36
  "madge": "^8.0.0",
36
37
  "typescript": "^5.8.3",
37
- "vite": "^6.3.5",
38
- "vitest": "^3.2.3",
39
- "@synnaxlabs/tsconfig": "0.0.2",
40
- "@synnaxlabs/vite-plugin": "0.43.0",
41
- "eslint-config-synnaxlabs": "0.43.0"
38
+ "vite": "^7.0.4",
39
+ "vitest": "^3.2.4",
40
+ "@synnaxlabs/tsconfig": "^0.43.0",
41
+ "@synnaxlabs/vite-plugin": "^0.43.0",
42
+ "eslint-config-synnaxlabs": "^0.43.0"
42
43
  },
43
44
  "type": "module",
44
45
  "types": "dist/index.d.ts",
@@ -48,8 +49,8 @@
48
49
  "check-types": "tsc --noEmit",
49
50
  "watch": "tsc --noEmit && vite build --watch",
50
51
  "test": "vitest",
51
- "lint": "eslint --cache",
52
- "fix": "eslint --cache --fix",
52
+ "lint": "eslint",
53
+ "fix": "eslint --fix",
53
54
  "madge": "madge --circular src"
54
55
  }
55
56
  }
@@ -7,7 +7,7 @@
7
7
  // License, use of this software will be governed by the Apache License, Version 2.0,
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
- import { z } from "zod/v4";
10
+ import { z } from "zod";
11
11
 
12
12
  export const ALL_ACTION = "all";
13
13
  export const CREATE_ACTION = "create";
@@ -7,60 +7,115 @@
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 UnaryClient } from "@synnaxlabs/freighter";
10
+ import { sendRequired, type UnaryClient } from "@synnaxlabs/freighter";
11
11
  import { array } from "@synnaxlabs/x";
12
+ import { z } from "zod";
12
13
 
13
- import { ALLOW_ALL_ONTOLOGY_TYPE, ONTOLOGY_TYPE } from "@/access/policy/ontology";
14
- import { type Key, type New, type Policy } from "@/access/policy/payload";
15
- import { Retriever } from "@/access/policy/retriever";
16
- import { Writer } from "@/access/policy/writer";
14
+ import {
15
+ type Key,
16
+ keyZ,
17
+ type New,
18
+ newZ,
19
+ type Policy,
20
+ policyZ,
21
+ } from "@/access/policy/payload";
17
22
  import { ontology } from "@/ontology";
23
+ import { nullableArrayZ } from "@/util/zod";
24
+
25
+ const retrieveRequestZ = z.object({
26
+ keys: keyZ.array().optional(),
27
+ subjects: ontology.idZ.array().optional(),
28
+ });
29
+
30
+ const keyRetrieveRequestZ = z
31
+ .object({ key: keyZ })
32
+ .transform(({ key }) => ({ keys: [key] }));
33
+
34
+ const listRetrieveArgsZ = z.union([
35
+ z
36
+ .object({ for: ontology.idZ })
37
+ .transform(({ for: forId }) => ({ subjects: [forId] })),
38
+ z
39
+ .object({ for: ontology.idZ.array() })
40
+ .transform(({ for: forIds }) => ({ subjects: forIds })),
41
+ retrieveRequestZ,
42
+ ]);
43
+
44
+ export type SingleRetrieveArgs = z.input<typeof keyRetrieveRequestZ>;
45
+ export type ListRetrieveArgs = z.input<typeof listRetrieveArgsZ>;
46
+
47
+ const retrieveArgsZ = z.union([keyRetrieveRequestZ, listRetrieveArgsZ]);
48
+
49
+ export type RetrieveArgs = z.input<typeof retrieveArgsZ>;
50
+
51
+ const retrieveResZ = z.object({ policies: nullableArrayZ(policyZ) });
52
+
53
+ const createReqZ = z.object({ policies: policyZ.partial({ key: true }).array() });
54
+ const createResZ = z.object({ policies: policyZ.array() });
55
+ const deleteReqZ = z.object({ keys: keyZ.array() });
56
+ const deleteResZ = z.object({});
57
+
58
+ const RETRIEVE_ENDPOINT = "/access/policy/retrieve";
59
+ const CREATE_ENDPOINT = "/access/policy/create";
60
+ const DELETE_ENDPOINT = "/access/policy/delete";
18
61
 
19
62
  export class Client {
20
- private readonly retriever: Retriever;
21
- private readonly writer: Writer;
63
+ private readonly client: UnaryClient;
22
64
 
23
65
  constructor(client: UnaryClient) {
24
- this.retriever = new Retriever(client);
25
- this.writer = new Writer(client);
66
+ this.client = client;
26
67
  }
27
68
 
28
69
  async create(policy: New): Promise<Policy>;
29
70
  async create(policies: New[]): Promise<Policy[]>;
30
71
  async create(policies: New | New[]): Promise<Policy | Policy[]> {
31
72
  const isMany = Array.isArray(policies);
32
- const createdPolicies = await this.writer.create(policies);
33
- return isMany ? createdPolicies : createdPolicies[0];
73
+ const parsedPolicies = newZ.array().parse(array.toArray(policies));
74
+ const req = parsedPolicies.map((policy) => ({
75
+ objects: array.toArray(policy.objects),
76
+ actions: array.toArray(policy.actions),
77
+ subjects: array.toArray(policy.subjects),
78
+ }));
79
+ const res = await sendRequired<typeof createReqZ, typeof createResZ>(
80
+ this.client,
81
+ CREATE_ENDPOINT,
82
+ { policies: req },
83
+ createReqZ,
84
+ createResZ,
85
+ );
86
+ return isMany ? res.policies : res.policies[0];
34
87
  }
35
88
 
36
- async retrieve(key: Key): Promise<Policy>;
37
- async retrieve(keys: Key[]): Promise<Policy[]>;
38
- async retrieve(keys: Key | Key[]): Promise<Policy | Policy[]> {
39
- const isMany = Array.isArray(keys);
40
- const res = await this.retriever.retrieve({ keys: array.toArray(keys) });
41
- return isMany ? res : res[0];
42
- }
43
-
44
- async retrieveFor(subject: ontology.CrudeID): Promise<Policy[]>;
45
- async retrieveFor(subjects: ontology.CrudeID[]): Promise<Policy[]>;
46
- async retrieveFor(
47
- subjects: ontology.CrudeID | ontology.CrudeID[],
48
- ): Promise<Policy[]> {
49
- const newIds = array.toArray(subjects).map((id) => new ontology.ID(id).payload);
50
- return await this.retriever.retrieve({ subjects: newIds });
89
+ async retrieve(args: SingleRetrieveArgs): Promise<Policy>;
90
+ async retrieve(args: ListRetrieveArgs): Promise<Policy[]>;
91
+ async retrieve(args: RetrieveArgs): Promise<Policy | Policy[]> {
92
+ const isSingle = "key" in args;
93
+ const res = await sendRequired<typeof retrieveArgsZ, typeof retrieveResZ>(
94
+ this.client,
95
+ RETRIEVE_ENDPOINT,
96
+ args,
97
+ retrieveArgsZ,
98
+ retrieveResZ,
99
+ );
100
+ return isSingle ? res.policies[0] : res.policies;
51
101
  }
52
102
 
53
103
  async delete(key: Key): Promise<void>;
54
104
  async delete(keys: Key[]): Promise<void>;
55
105
  async delete(keys: Key | Key[]): Promise<void> {
56
- await this.writer.delete(keys);
106
+ await sendRequired<typeof deleteReqZ, typeof deleteResZ>(
107
+ this.client,
108
+ DELETE_ENDPOINT,
109
+ { keys: array.toArray(keys) },
110
+ deleteReqZ,
111
+ deleteResZ,
112
+ );
57
113
  }
58
114
  }
59
115
 
60
- export const ontologyID = (key: Key): ontology.ID =>
61
- new ontology.ID({ type: ONTOLOGY_TYPE, key });
116
+ export const ontologyID = (key: Key): ontology.ID => ({ type: "policy", key });
62
117
 
63
- export const ALLOW_ALL_ONTOLOGY_ID = new ontology.ID({
64
- type: ALLOW_ALL_ONTOLOGY_TYPE,
118
+ export const ALLOW_ALL_ONTOLOGY_ID: ontology.ID = {
119
+ type: "allow_all",
65
120
  key: "",
66
- });
121
+ };
@@ -8,5 +8,4 @@
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
10
  export * from "@/access/policy/client";
11
- export * from "@/access/policy/ontology";
12
11
  export * from "@/access/policy/payload";
@@ -7,13 +7,13 @@
7
7
  // License, use of this software will be governed by the Apache License, Version 2.0,
8
8
  // included in the file licenses/APL.txt.
9
9
 
10
- import { z } from "zod/v4";
10
+ import { z } from "zod";
11
11
 
12
12
  import { actionZ } from "@/access/payload";
13
13
  import { ontology } from "@/ontology";
14
14
  import { nullableArrayZ } from "@/util/zod";
15
15
 
16
- export const keyZ = z.string().uuid();
16
+ export const keyZ = z.uuid();
17
17
  export type Key = z.infer<typeof keyZ>;
18
18
 
19
19
  export const policyZ = z.object({
@@ -26,8 +26,8 @@ export interface Policy extends z.infer<typeof policyZ> {}
26
26
 
27
27
  export const newZ = z.object({
28
28
  key: keyZ.optional(),
29
- subjects: ontology.crudeIDZ.array().or(ontology.crudeIDZ),
30
- objects: ontology.crudeIDZ.array().or(ontology.crudeIDZ),
29
+ subjects: ontology.idZ.array().or(ontology.idZ),
30
+ objects: ontology.idZ.array().or(ontology.idZ),
31
31
  actions: actionZ.array().or(actionZ),
32
32
  });
33
33
  export interface New extends z.input<typeof newZ> {}