@synnaxlabs/client 0.2.0 → 0.13.5

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 (409) hide show
  1. package/.eslintrc.cjs +18 -0
  2. package/.pytest_cache/README.md +8 -0
  3. package/.turbo/turbo-build.log +16 -0
  4. package/LICENSE +4 -21
  5. package/{build/main/lib → dist/auth}/auth.d.ts +16 -19
  6. package/dist/auth/index.d.ts +1 -0
  7. package/dist/cdc/external.d.ts +1 -0
  8. package/dist/cdc/index.d.ts +1 -0
  9. package/dist/cdc/observable.d.ts +17 -0
  10. package/dist/channel/client.d.ts +58 -0
  11. package/dist/channel/creator.d.ts +8 -0
  12. package/dist/channel/external.d.ts +4 -0
  13. package/dist/channel/index.d.ts +1 -0
  14. package/dist/channel/payload.d.ts +63 -0
  15. package/dist/channel/retriever.d.ts +49 -0
  16. package/dist/client.cjs.js +23050 -0
  17. package/dist/client.cjs.js.map +1 -0
  18. package/dist/client.d.ts +73 -0
  19. package/dist/client.es.js +23050 -0
  20. package/dist/client.es.js.map +1 -0
  21. package/dist/connection/checker.d.ts +66 -0
  22. package/dist/connection/index.d.ts +1 -0
  23. package/dist/control/authority.d.ts +6 -0
  24. package/dist/control/external.d.ts +2 -0
  25. package/dist/control/index.d.ts +1 -0
  26. package/dist/control/state.d.ts +81 -0
  27. package/{build/main/lib → dist}/errors.d.ts +6 -3
  28. package/dist/framer/adapter.d.ts +21 -0
  29. package/dist/framer/client.d.ts +44 -0
  30. package/dist/framer/external.d.ts +5 -0
  31. package/dist/framer/frame.d.ts +251 -0
  32. package/dist/framer/index.d.ts +1 -0
  33. package/{build/module/lib/segment → dist/framer}/iterator.d.ts +32 -64
  34. package/dist/framer/streamProxy.d.ts +12 -0
  35. package/dist/framer/streamer.d.ts +17 -0
  36. package/dist/framer/writer.d.ts +257 -0
  37. package/dist/index.d.ts +16 -0
  38. package/dist/label/client.d.ts +25 -0
  39. package/dist/label/external.d.ts +4 -0
  40. package/dist/label/index.d.ts +1 -0
  41. package/dist/label/payload.d.ts +20 -0
  42. package/dist/label/retriever.d.ts +13 -0
  43. package/dist/label/writer.d.ts +26 -0
  44. package/dist/ontology/cdc.d.ts +25 -0
  45. package/dist/ontology/client.d.ts +25 -0
  46. package/dist/ontology/external.d.ts +3 -0
  47. package/dist/ontology/group/client.d.ts +11 -0
  48. package/dist/ontology/group/external.d.ts +2 -0
  49. package/dist/ontology/group/group.d.ts +7 -0
  50. package/dist/ontology/group/index.d.ts +1 -0
  51. package/dist/ontology/group/payload.d.ts +40 -0
  52. package/dist/ontology/group/writer.d.ts +13 -0
  53. package/dist/ontology/index.d.ts +1 -0
  54. package/dist/ontology/ontology.spec.d.ts +1 -0
  55. package/dist/ontology/payload.d.ts +235 -0
  56. package/dist/ontology/retriever.d.ts +12 -0
  57. package/dist/ontology/signals.d.ts +25 -0
  58. package/dist/ontology/writer.d.ts +9 -0
  59. package/dist/ranger/active.d.ts +9 -0
  60. package/dist/ranger/alias.d.ts +32 -0
  61. package/dist/ranger/client.d.ts +31 -0
  62. package/dist/ranger/external.d.ts +6 -0
  63. package/dist/ranger/index.d.ts +1 -0
  64. package/dist/ranger/kv.d.ts +50 -0
  65. package/dist/ranger/payload.d.ts +94 -0
  66. package/dist/ranger/range.d.ts +29 -0
  67. package/dist/ranger/ranger.spec.d.ts +1 -0
  68. package/dist/ranger/retriever.d.ts +10 -0
  69. package/dist/ranger/writer.d.ts +9 -0
  70. package/{build/main → dist}/setupspecs.d.ts +2 -2
  71. package/dist/signals/external.d.ts +1 -0
  72. package/dist/signals/index.d.ts +1 -0
  73. package/dist/signals/observable.d.ts +17 -0
  74. package/dist/transport.d.ts +10 -0
  75. package/dist/user/index.d.ts +1 -0
  76. package/{build/main/lib → dist}/user/payload.d.ts +3 -3
  77. package/dist/util/telem.d.ts +2 -0
  78. package/dist/workspace/client.d.ts +22 -0
  79. package/dist/workspace/external.d.ts +2 -0
  80. package/dist/workspace/index.d.ts +1 -0
  81. package/dist/workspace/lineplot/client.d.ts +15 -0
  82. package/dist/workspace/lineplot/external.d.ts +2 -0
  83. package/dist/workspace/lineplot/index.d.ts +1 -0
  84. package/dist/workspace/lineplot/linePlot.spec.d.ts +1 -0
  85. package/dist/workspace/lineplot/payload.d.ts +31 -0
  86. package/dist/workspace/lineplot/retriever.d.ts +9 -0
  87. package/dist/workspace/lineplot/writer.d.ts +39 -0
  88. package/dist/workspace/payload.d.ts +31 -0
  89. package/dist/workspace/pid/client.d.ts +16 -0
  90. package/dist/workspace/pid/external.d.ts +2 -0
  91. package/dist/workspace/pid/index.d.ts +1 -0
  92. package/dist/workspace/pid/payload.d.ts +37 -0
  93. package/dist/workspace/pid/pid.spec.d.ts +1 -0
  94. package/dist/workspace/pid/retriever.d.ts +9 -0
  95. package/dist/workspace/pid/writer.d.ts +46 -0
  96. package/dist/workspace/retriever.d.ts +12 -0
  97. package/dist/workspace/workspace.spec.d.ts +1 -0
  98. package/dist/workspace/writer.d.ts +55 -0
  99. package/package.json +27 -98
  100. package/src/auth/auth.spec.ts +46 -0
  101. package/src/auth/auth.ts +83 -0
  102. package/src/auth/index.ts +10 -0
  103. package/src/cdc/external.ts +10 -0
  104. package/src/cdc/index.ts +10 -0
  105. package/src/cdc/observable.ts +80 -0
  106. package/src/channel/channel.spec.ts +82 -0
  107. package/src/channel/client.ts +209 -0
  108. package/src/channel/creator.ts +43 -0
  109. package/src/channel/external.ts +13 -0
  110. package/src/channel/index.ts +10 -0
  111. package/src/channel/payload.ts +52 -0
  112. package/src/channel/retriever.ts +160 -0
  113. package/src/client.ts +112 -0
  114. package/src/connection/checker.ts +104 -0
  115. package/src/connection/connection.spec.ts +35 -0
  116. package/src/connection/index.ts +10 -0
  117. package/src/control/authority.ts +25 -0
  118. package/src/control/external.ts +11 -0
  119. package/src/control/index.ts +10 -0
  120. package/src/control/state.spec.ts +24 -0
  121. package/src/control/state.ts +117 -0
  122. package/src/errors.ts +153 -0
  123. package/src/framer/adapter.ts +116 -0
  124. package/src/framer/client.ts +116 -0
  125. package/src/framer/external.ts +14 -0
  126. package/src/framer/frame.spec.ts +317 -0
  127. package/src/framer/frame.ts +412 -0
  128. package/src/framer/index.ts +10 -0
  129. package/src/framer/iterator.spec.ts +62 -0
  130. package/src/framer/iterator.ts +240 -0
  131. package/src/framer/streamProxy.ts +59 -0
  132. package/src/framer/streamer.spec.ts +42 -0
  133. package/src/framer/streamer.ts +86 -0
  134. package/src/framer/writer.spec.ts +52 -0
  135. package/src/framer/writer.ts +236 -0
  136. package/src/index.ts +43 -4
  137. package/src/ontology/cdc.ts +135 -0
  138. package/src/ontology/client.ts +103 -0
  139. package/src/ontology/external.ts +12 -0
  140. package/src/ontology/group/client.ts +40 -0
  141. package/src/ontology/group/external.ts +11 -0
  142. package/src/ontology/group/group.spec.ts +46 -0
  143. package/src/ontology/group/group.ts +27 -0
  144. package/src/ontology/group/index.ts +10 -0
  145. package/src/ontology/group/payload.ts +65 -0
  146. package/src/ontology/group/writer.ts +48 -0
  147. package/src/ontology/index.ts +10 -0
  148. package/src/ontology/ontology.spec.ts +114 -0
  149. package/src/ontology/payload.ts +121 -0
  150. package/src/ontology/retriever.ts +91 -0
  151. package/src/ontology/writer.ts +49 -0
  152. package/src/ranger/active.ts +56 -0
  153. package/src/ranger/alias.ts +183 -0
  154. package/src/ranger/client.ts +124 -0
  155. package/src/ranger/external.ts +15 -0
  156. package/src/ranger/index.ts +10 -0
  157. package/src/ranger/kv.ts +91 -0
  158. package/src/ranger/payload.ts +70 -0
  159. package/src/ranger/range.ts +74 -0
  160. package/src/ranger/ranger.spec.ts +167 -0
  161. package/src/ranger/retriever.ts +50 -0
  162. package/src/ranger/writer.ts +80 -0
  163. package/src/setupspecs.ts +14 -5
  164. package/src/transport.ts +39 -0
  165. package/src/user/index.ts +10 -0
  166. package/src/user/payload.ts +17 -0
  167. package/src/util/telem.ts +19 -0
  168. package/src/vite-env.d.ts +11 -0
  169. package/src/workspace/client.ts +75 -0
  170. package/src/workspace/external.ts +11 -0
  171. package/src/workspace/index.ts +10 -0
  172. package/src/workspace/lineplot/client.ts +51 -0
  173. package/src/workspace/lineplot/external.ts +11 -0
  174. package/src/workspace/lineplot/index.ts +10 -0
  175. package/src/workspace/lineplot/linePlot.spec.ts +78 -0
  176. package/src/workspace/lineplot/payload.ts +29 -0
  177. package/src/workspace/lineplot/retriever.ts +49 -0
  178. package/src/workspace/lineplot/writer.ts +109 -0
  179. package/src/workspace/payload.ts +29 -0
  180. package/src/workspace/pid/client.ts +55 -0
  181. package/src/workspace/pid/external.ts +11 -0
  182. package/src/workspace/pid/index.ts +10 -0
  183. package/src/workspace/pid/payload.ts +31 -0
  184. package/src/workspace/pid/pid.spec.ts +111 -0
  185. package/src/workspace/pid/retriever.ts +45 -0
  186. package/src/workspace/pid/writer.ts +130 -0
  187. package/src/workspace/retriever.ts +67 -0
  188. package/src/workspace/workspace.spec.ts +62 -0
  189. package/src/workspace/writer.ts +103 -0
  190. package/tsconfig.json +3 -43
  191. package/tsconfig.vite.json +4 -0
  192. package/vite.config.ts +25 -0
  193. package/.DS_Store +0 -0
  194. package/.editorconfig +0 -15
  195. package/.eslintrc.json +0 -33
  196. package/.gitignore +0 -9
  197. package/.nyc_output/20720f2d-6abe-420f-a3c5-304d52d60827.json +0 -1
  198. package/.nyc_output/4725921c-6f1b-4ae9-9819-e455f702d31c.json +0 -1
  199. package/.nyc_output/47478588-5ffd-4332-873c-facaa4a2fc38.json +0 -1
  200. package/.nyc_output/48180641-e0b2-49ab-a6eb-e7910e9eac2f.json +0 -1
  201. package/.nyc_output/cb0abf31-740f-47db-b94a-8e3f8f117cb8.json +0 -1
  202. package/.nyc_output/fc77fce2-dad0-49a8-8d4b-0a9014ecf8c5.json +0 -1
  203. package/.nyc_output/processinfo/20720f2d-6abe-420f-a3c5-304d52d60827.json +0 -1
  204. package/.nyc_output/processinfo/4725921c-6f1b-4ae9-9819-e455f702d31c.json +0 -1
  205. package/.nyc_output/processinfo/47478588-5ffd-4332-873c-facaa4a2fc38.json +0 -1
  206. package/.nyc_output/processinfo/48180641-e0b2-49ab-a6eb-e7910e9eac2f.json +0 -1
  207. package/.nyc_output/processinfo/cb0abf31-740f-47db-b94a-8e3f8f117cb8.json +0 -1
  208. package/.nyc_output/processinfo/fc77fce2-dad0-49a8-8d4b-0a9014ecf8c5.json +0 -1
  209. package/.nyc_output/processinfo/index.json +0 -1
  210. package/.prettierignore +0 -2
  211. package/CHANGELOG.md +0 -5
  212. package/build/main/index.d.ts +0 -4
  213. package/build/main/index.js +0 -35
  214. package/build/main/lib/auth.js +0 -62
  215. package/build/main/lib/auth.spec.js +0 -39
  216. package/build/main/lib/channel/channel.spec.js +0 -49
  217. package/build/main/lib/channel/client.d.ts +0 -94
  218. package/build/main/lib/channel/client.js +0 -134
  219. package/build/main/lib/channel/creator.d.ts +0 -19
  220. package/build/main/lib/channel/creator.js +0 -44
  221. package/build/main/lib/channel/payload.d.ts +0 -25
  222. package/build/main/lib/channel/payload.js +0 -18
  223. package/build/main/lib/channel/registry.d.ts +0 -9
  224. package/build/main/lib/channel/registry.js +0 -37
  225. package/build/main/lib/channel/retriever.d.ts +0 -11
  226. package/build/main/lib/channel/retriever.js +0 -39
  227. package/build/main/lib/client.d.ts +0 -30
  228. package/build/main/lib/client.js +0 -46
  229. package/build/main/lib/errors.js +0 -122
  230. package/build/main/lib/segment/client.d.ts +0 -62
  231. package/build/main/lib/segment/client.js +0 -95
  232. package/build/main/lib/segment/iterator.d.ts +0 -134
  233. package/build/main/lib/segment/iterator.js +0 -253
  234. package/build/main/lib/segment/iterator.spec.js +0 -73
  235. package/build/main/lib/segment/payload.d.ts +0 -16
  236. package/build/main/lib/segment/payload.js +0 -13
  237. package/build/main/lib/segment/splitter.d.ts +0 -7
  238. package/build/main/lib/segment/splitter.js +0 -25
  239. package/build/main/lib/segment/typed.d.ts +0 -15
  240. package/build/main/lib/segment/typed.js +0 -49
  241. package/build/main/lib/segment/validator.d.ts +0 -22
  242. package/build/main/lib/segment/validator.js +0 -64
  243. package/build/main/lib/segment/writer.d.ts +0 -98
  244. package/build/main/lib/segment/writer.js +0 -183
  245. package/build/main/lib/segment/writer.spec.js +0 -90
  246. package/build/main/lib/telem.d.ts +0 -395
  247. package/build/main/lib/telem.js +0 -553
  248. package/build/main/lib/telem.spec.js +0 -152
  249. package/build/main/lib/transport.d.ts +0 -10
  250. package/build/main/lib/transport.js +0 -22
  251. package/build/main/lib/user/payload.js +0 -9
  252. package/build/main/lib/util/telem.d.ts +0 -2
  253. package/build/main/lib/util/telem.js +0 -13
  254. package/build/main/setupspecs.js +0 -17
  255. package/build/module/index.d.ts +0 -4
  256. package/build/module/index.js +0 -5
  257. package/build/module/lib/auth.d.ts +0 -54
  258. package/build/module/lib/auth.js +0 -63
  259. package/build/module/lib/auth.spec.js +0 -34
  260. package/build/module/lib/channel/channel.spec.js +0 -44
  261. package/build/module/lib/channel/client.d.ts +0 -94
  262. package/build/module/lib/channel/client.js +0 -134
  263. package/build/module/lib/channel/creator.d.ts +0 -19
  264. package/build/module/lib/channel/creator.js +0 -42
  265. package/build/module/lib/channel/payload.d.ts +0 -25
  266. package/build/module/lib/channel/payload.js +0 -15
  267. package/build/module/lib/channel/registry.d.ts +0 -9
  268. package/build/module/lib/channel/registry.js +0 -36
  269. package/build/module/lib/channel/retriever.d.ts +0 -11
  270. package/build/module/lib/channel/retriever.js +0 -37
  271. package/build/module/lib/client.d.ts +0 -30
  272. package/build/module/lib/client.js +0 -44
  273. package/build/module/lib/errors.d.ts +0 -53
  274. package/build/module/lib/errors.js +0 -113
  275. package/build/module/lib/segment/client.d.ts +0 -62
  276. package/build/module/lib/segment/client.js +0 -94
  277. package/build/module/lib/segment/iterator.js +0 -248
  278. package/build/module/lib/segment/iterator.spec.js +0 -68
  279. package/build/module/lib/segment/payload.d.ts +0 -16
  280. package/build/module/lib/segment/payload.js +0 -10
  281. package/build/module/lib/segment/splitter.d.ts +0 -7
  282. package/build/module/lib/segment/splitter.js +0 -26
  283. package/build/module/lib/segment/typed.d.ts +0 -15
  284. package/build/module/lib/segment/typed.js +0 -49
  285. package/build/module/lib/segment/validator.d.ts +0 -22
  286. package/build/module/lib/segment/validator.js +0 -60
  287. package/build/module/lib/segment/writer.d.ts +0 -98
  288. package/build/module/lib/segment/writer.js +0 -183
  289. package/build/module/lib/segment/writer.spec.js +0 -85
  290. package/build/module/lib/telem.d.ts +0 -395
  291. package/build/module/lib/telem.js +0 -545
  292. package/build/module/lib/telem.spec.js +0 -147
  293. package/build/module/lib/transport.d.ts +0 -10
  294. package/build/module/lib/transport.js +0 -22
  295. package/build/module/lib/user/payload.d.ts +0 -12
  296. package/build/module/lib/user/payload.js +0 -6
  297. package/build/module/lib/util/telem.d.ts +0 -2
  298. package/build/module/lib/util/telem.js +0 -9
  299. package/build/module/setupspecs.d.ts +0 -4
  300. package/build/module/setupspecs.js +0 -16
  301. package/build/tsconfig.module.tsbuildinfo +0 -1
  302. package/build/tsconfig.tsbuildinfo +0 -1
  303. package/coverage/base.css +0 -224
  304. package/coverage/block-navigation.js +0 -87
  305. package/coverage/favicon.png +0 -0
  306. package/coverage/index.html +0 -191
  307. package/coverage/lcov-report/base.css +0 -224
  308. package/coverage/lcov-report/block-navigation.js +0 -87
  309. package/coverage/lcov-report/favicon.png +0 -0
  310. package/coverage/lcov-report/index.html +0 -191
  311. package/coverage/lcov-report/prettify.css +0 -1
  312. package/coverage/lcov-report/prettify.js +0 -2
  313. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  314. package/coverage/lcov-report/sorter.js +0 -196
  315. package/coverage/lcov-report/src/index.html +0 -116
  316. package/coverage/lcov-report/src/lib/auth.ts.html +0 -340
  317. package/coverage/lcov-report/src/lib/channel/client.ts.html +0 -604
  318. package/coverage/lcov-report/src/lib/channel/creator.ts.html +0 -304
  319. package/coverage/lcov-report/src/lib/channel/index.html +0 -176
  320. package/coverage/lcov-report/src/lib/channel/payload.ts.html +0 -139
  321. package/coverage/lcov-report/src/lib/channel/registry.ts.html +0 -202
  322. package/coverage/lcov-report/src/lib/channel/retriever.ts.html +0 -244
  323. package/coverage/lcov-report/src/lib/client.ts.html +0 -244
  324. package/coverage/lcov-report/src/lib/errors.ts.html +0 -484
  325. package/coverage/lcov-report/src/lib/index.html +0 -176
  326. package/coverage/lcov-report/src/lib/segment/client.ts.html +0 -463
  327. package/coverage/lcov-report/src/lib/segment/index.html +0 -206
  328. package/coverage/lcov-report/src/lib/segment/iterator.ts.html +0 -928
  329. package/coverage/lcov-report/src/lib/segment/payload.ts.html +0 -139
  330. package/coverage/lcov-report/src/lib/segment/splitter.ts.html +0 -181
  331. package/coverage/lcov-report/src/lib/segment/typed.ts.html +0 -307
  332. package/coverage/lcov-report/src/lib/segment/validator.ts.html +0 -331
  333. package/coverage/lcov-report/src/lib/segment/writer.ts.html +0 -727
  334. package/coverage/lcov-report/src/lib/telem.ts.html +0 -2056
  335. package/coverage/lcov-report/src/lib/transport.ts.html +0 -196
  336. package/coverage/lcov-report/src/lib/user/index.html +0 -116
  337. package/coverage/lcov-report/src/lib/user/payload.ts.html +0 -109
  338. package/coverage/lcov-report/src/lib/util/index.html +0 -116
  339. package/coverage/lcov-report/src/lib/util/telem.ts.html +0 -124
  340. package/coverage/lcov-report/src/setupspecs.ts.html +0 -133
  341. package/coverage/lcov.info +0 -1230
  342. package/coverage/prettify.css +0 -1
  343. package/coverage/prettify.js +0 -2
  344. package/coverage/sort-arrow-sprite.png +0 -0
  345. package/coverage/sorter.js +0 -196
  346. package/coverage/src/index.html +0 -116
  347. package/coverage/src/lib/auth.ts.html +0 -340
  348. package/coverage/src/lib/channel/client.ts.html +0 -604
  349. package/coverage/src/lib/channel/creator.ts.html +0 -304
  350. package/coverage/src/lib/channel/index.html +0 -176
  351. package/coverage/src/lib/channel/payload.ts.html +0 -139
  352. package/coverage/src/lib/channel/registry.ts.html +0 -202
  353. package/coverage/src/lib/channel/retriever.ts.html +0 -244
  354. package/coverage/src/lib/client.ts.html +0 -244
  355. package/coverage/src/lib/errors.ts.html +0 -484
  356. package/coverage/src/lib/index.html +0 -176
  357. package/coverage/src/lib/segment/client.ts.html +0 -463
  358. package/coverage/src/lib/segment/index.html +0 -206
  359. package/coverage/src/lib/segment/iterator.ts.html +0 -928
  360. package/coverage/src/lib/segment/payload.ts.html +0 -139
  361. package/coverage/src/lib/segment/splitter.ts.html +0 -181
  362. package/coverage/src/lib/segment/typed.ts.html +0 -307
  363. package/coverage/src/lib/segment/validator.ts.html +0 -331
  364. package/coverage/src/lib/segment/writer.ts.html +0 -727
  365. package/coverage/src/lib/telem.ts.html +0 -2056
  366. package/coverage/src/lib/transport.ts.html +0 -196
  367. package/coverage/src/lib/user/index.html +0 -116
  368. package/coverage/src/lib/user/payload.ts.html +0 -109
  369. package/coverage/src/lib/util/index.html +0 -116
  370. package/coverage/src/lib/util/telem.ts.html +0 -124
  371. package/coverage/src/setupspecs.ts.html +0 -133
  372. package/src/lib/.DS_Store +0 -0
  373. package/src/lib/auth.spec.ts +0 -36
  374. package/src/lib/auth.ts +0 -85
  375. package/src/lib/channel/channel.spec.ts +0 -49
  376. package/src/lib/channel/client.ts +0 -173
  377. package/src/lib/channel/creator.ts +0 -73
  378. package/src/lib/channel/payload.ts +0 -18
  379. package/src/lib/channel/registry.ts +0 -39
  380. package/src/lib/channel/retriever.ts +0 -53
  381. package/src/lib/client.ts +0 -53
  382. package/src/lib/errors.ts +0 -133
  383. package/src/lib/segment/client.ts +0 -126
  384. package/src/lib/segment/iterator.spec.ts +0 -78
  385. package/src/lib/segment/iterator.ts +0 -281
  386. package/src/lib/segment/payload.ts +0 -18
  387. package/src/lib/segment/splitter.ts +0 -32
  388. package/src/lib/segment/typed.ts +0 -74
  389. package/src/lib/segment/validator.ts +0 -82
  390. package/src/lib/segment/writer.spec.ts +0 -85
  391. package/src/lib/segment/writer.ts +0 -214
  392. package/src/lib/telem.spec.ts +0 -200
  393. package/src/lib/telem.ts +0 -657
  394. package/src/lib/transport.ts +0 -37
  395. package/src/lib/user/payload.ts +0 -8
  396. package/src/lib/util/telem.ts +0 -13
  397. package/tsconfig.module.json +0 -9
  398. package/yarn-error.log +0 -5756
  399. package/yarn.lock +0 -5936
  400. /package/{build/main/lib → dist/auth}/auth.spec.d.ts +0 -0
  401. /package/{build/main/lib → dist}/channel/channel.spec.d.ts +0 -0
  402. /package/{build/main/lib/segment/iterator.spec.d.ts → dist/connection/connection.spec.d.ts} +0 -0
  403. /package/{build/main/lib/segment/writer.spec.d.ts → dist/control/state.spec.d.ts} +0 -0
  404. /package/{build/main/lib/telem.spec.d.ts → dist/framer/frame.spec.d.ts} +0 -0
  405. /package/{build/module/lib/segment → dist/framer}/iterator.spec.d.ts +0 -0
  406. /package/{build/module/lib/auth.spec.d.ts → dist/framer/streamer.spec.d.ts} +0 -0
  407. /package/{build/module/lib/segment → dist/framer}/writer.spec.d.ts +0 -0
  408. /package/{build/module/lib/channel/channel.spec.d.ts → dist/label/label.spec.d.ts} +0 -0
  409. /package/{build/module/lib/telem.spec.d.ts → dist/ontology/group/group.spec.d.ts} +0 -0
@@ -1,4 +1,4 @@
1
- import Synnax, { SynnaxProps } from './lib/client';
1
+ import Synnax, { type SynnaxProps } from './client';
2
2
  export declare const HOST = "localhost";
3
- export declare const PORT = 8080;
3
+ export declare const PORT = 9090;
4
4
  export declare const newClient: (...props: SynnaxProps[]) => Synnax;
@@ -0,0 +1 @@
1
+ export * from '../signals/observable';
@@ -0,0 +1 @@
1
+ export * as signals from '../signals/external';
@@ -0,0 +1,17 @@
1
+ import { observe, type Destructor, type change, type Series } from "@synnaxlabs/x";
2
+ import { type channel } from '../channel';
3
+ import { type framer } from '../framer';
4
+ export type Decoder<K, V> = (variant: change.Variant, data: Series) => Array<change.Change<K, V>>;
5
+ export declare class Observable<K, V> implements observe.Observable<Array<change.Change<K, V>>> {
6
+ private readonly streamer;
7
+ private readonly decoder;
8
+ private readonly base;
9
+ private readonly closePromise;
10
+ private readonly deleteChannel?;
11
+ private readonly setChannel?;
12
+ private constructor();
13
+ onChange(handler: observe.Handler<Array<change.Change<K, V>>>): Destructor;
14
+ close(): Promise<void>;
15
+ stream(): Promise<void>;
16
+ static open<K, V>(client: framer.Client, setChannel: channel.Key | channel.Name, deleteChannel: channel.Key | channel.Name, ecd: Decoder<K, V>): Promise<Observable<K, V>>;
17
+ }
@@ -0,0 +1,10 @@
1
+ import { type Middleware, type StreamClient, type UnaryClient } from "@synnaxlabs/freighter";
2
+ import { type URL } from "@synnaxlabs/x";
3
+ export declare class Transport {
4
+ readonly url: URL;
5
+ readonly unary: UnaryClient;
6
+ readonly stream: StreamClient;
7
+ readonly secure: boolean;
8
+ constructor(url: URL, secure?: boolean);
9
+ use(...middleware: Middleware[]): void;
10
+ }
@@ -0,0 +1 @@
1
+ export * as user from '../user/payload';
@@ -1,5 +1,5 @@
1
- import { z } from 'zod';
2
- export declare const UserPayloadSchema: z.ZodObject<{
1
+ import { z } from "zod";
2
+ export declare const payloadZ: z.ZodObject<{
3
3
  key: z.ZodString;
4
4
  username: z.ZodString;
5
5
  }, "strip", z.ZodTypeAny, {
@@ -9,4 +9,4 @@ export declare const UserPayloadSchema: z.ZodObject<{
9
9
  key: string;
10
10
  username: string;
11
11
  }>;
12
- export declare type UserPayload = z.infer<typeof UserPayloadSchema>;
12
+ export type Payload = z.infer<typeof payloadZ>;
@@ -0,0 +1,2 @@
1
+ import { DataType, NativeTypedArray } from "@synnaxlabs/x";
2
+ export declare const randomSeries: (length: number, dataType: DataType) => NativeTypedArray;
@@ -0,0 +1,22 @@
1
+ import { type UnaryClient } from "@synnaxlabs/freighter";
2
+ import { type UnknownRecord, type AsyncTermSearcher } from "@synnaxlabs/x";
3
+ import { linePlot } from '../workspace/lineplot';
4
+ import { type Key, type Workspace } from '../workspace/payload';
5
+ import { pid } from '../workspace/pid';
6
+ import { type CrudeWorkspace } from '../workspace/writer';
7
+ export declare class Client implements AsyncTermSearcher<string, Key, Workspace> {
8
+ readonly pid: pid.Client;
9
+ readonly linePlot: linePlot.Client;
10
+ private readonly retriever;
11
+ private readonly writer;
12
+ constructor(client: UnaryClient);
13
+ search(term: string): Promise<Workspace[]>;
14
+ retrieveByAuthor(author: string): Promise<Workspace[]>;
15
+ retrieve(key: Key): Promise<Workspace>;
16
+ retrieve(keys: Key[]): Promise<Workspace[]>;
17
+ page(offset: number, limit: number): Promise<Workspace[]>;
18
+ create(workspace: CrudeWorkspace): Promise<Workspace>;
19
+ rename(key: Key, name: string): Promise<void>;
20
+ setLayout(key: Key, layout: UnknownRecord): Promise<void>;
21
+ delete(...keys: Key[]): Promise<void>;
22
+ }
@@ -0,0 +1,2 @@
1
+ export * from '../workspace/payload';
2
+ export * from '../workspace/client';
@@ -0,0 +1 @@
1
+ export * as workspace from '../workspace/external';
@@ -0,0 +1,15 @@
1
+ import { type UnaryClient } from "@synnaxlabs/freighter";
2
+ import { type UnknownRecord } from "@synnaxlabs/x";
3
+ import { type LinePlot, type Key, type Params } from '../../workspace/lineplot/payload';
4
+ import { type CrudeLinePlot } from '../../workspace/lineplot/writer';
5
+ export declare class Client {
6
+ private readonly writer;
7
+ private readonly retriever;
8
+ constructor(client: UnaryClient);
9
+ create(workspace: string, pid: CrudeLinePlot): Promise<LinePlot>;
10
+ rename(key: Key, name: string): Promise<void>;
11
+ setData(key: Key, data: UnknownRecord): Promise<void>;
12
+ retrieve(key: Key): Promise<LinePlot>;
13
+ retrieve(keys: Key[]): Promise<LinePlot[]>;
14
+ delete(keys: Params): Promise<void>;
15
+ }
@@ -0,0 +1,2 @@
1
+ export * from '../../workspace/lineplot/payload';
2
+ export * from '../../workspace/lineplot/client';
@@ -0,0 +1 @@
1
+ export * as linePlot from '../../workspace/lineplot/external';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ import { z } from "zod";
2
+ export declare const keyZ: z.ZodString;
3
+ export type Key = z.infer<typeof keyZ>;
4
+ export type Params = Key | Key[];
5
+ export declare const linePlotZ: z.ZodObject<{
6
+ key: z.ZodString;
7
+ name: z.ZodString;
8
+ data: z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodSymbol]>, z.ZodUnknown>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ name: string;
11
+ key: string;
12
+ data: Record<string | number | symbol, unknown>;
13
+ }, {
14
+ name: string;
15
+ key: string;
16
+ data: Record<string | number | symbol, unknown>;
17
+ }>;
18
+ export declare const linePlotRemoteZ: z.ZodObject<{
19
+ key: z.ZodString;
20
+ name: z.ZodString;
21
+ data: z.ZodEffects<z.ZodString, Partial<Record<import("@synnaxlabs/x").Key, unknown>>, string>;
22
+ }, "strip", z.ZodTypeAny, {
23
+ name: string;
24
+ key: string;
25
+ data: Partial<Record<import("@synnaxlabs/x").Key, unknown>>;
26
+ }, {
27
+ name: string;
28
+ key: string;
29
+ data: string;
30
+ }>;
31
+ export type LinePlot = z.infer<typeof linePlotZ>;
@@ -0,0 +1,9 @@
1
+ import { type UnaryClient } from "@synnaxlabs/freighter";
2
+ import { type LinePlot, type Params } from '../../workspace/lineplot/payload';
3
+ export declare class Retriever {
4
+ private readonly ENDPOINT;
5
+ private readonly client;
6
+ constructor(client: UnaryClient);
7
+ retrieve(params: Params): Promise<LinePlot[]>;
8
+ private execute;
9
+ }
@@ -0,0 +1,39 @@
1
+ import { type UnaryClient } from "@synnaxlabs/freighter";
2
+ import { type UnknownRecord } from "@synnaxlabs/x";
3
+ import { z } from "zod";
4
+ import { type LinePlot, type Params, type Key } from '../../workspace/lineplot/payload';
5
+ export declare const crudeLinePlotZ: z.ZodObject<{
6
+ name: z.ZodString;
7
+ key: z.ZodOptional<z.ZodString>;
8
+ data: z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodSymbol]>, z.ZodUnknown>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ name: string;
11
+ data: Record<string | number | symbol, unknown>;
12
+ key?: string | undefined;
13
+ }, {
14
+ name: string;
15
+ data: Record<string | number | symbol, unknown>;
16
+ key?: string | undefined;
17
+ }>;
18
+ export declare const linePlotWriteZ: z.ZodObject<{
19
+ name: z.ZodString;
20
+ key: z.ZodOptional<z.ZodString>;
21
+ data: z.ZodEffects<z.ZodString, Partial<Record<import("@synnaxlabs/x").Key, unknown>>, string>;
22
+ }, "strip", z.ZodTypeAny, {
23
+ name: string;
24
+ data: Partial<Record<import("@synnaxlabs/x").Key, unknown>>;
25
+ key?: string | undefined;
26
+ }, {
27
+ name: string;
28
+ data: string;
29
+ key?: string | undefined;
30
+ }>;
31
+ export type CrudeLinePlot = z.infer<typeof crudeLinePlotZ>;
32
+ export declare class Writer {
33
+ private readonly client;
34
+ constructor(client: UnaryClient);
35
+ create(workspace: string, plot: CrudeLinePlot): Promise<LinePlot>;
36
+ delete(params: Params): Promise<void>;
37
+ rename(pid: Key, name: string): Promise<void>;
38
+ setData(pid: Key, data: UnknownRecord): Promise<void>;
39
+ }
@@ -0,0 +1,31 @@
1
+ import { z } from "zod";
2
+ export declare const keyZ: z.ZodString;
3
+ export type Key = z.infer<typeof keyZ>;
4
+ export type Params = Key | Key[];
5
+ export declare const workspaceZ: z.ZodObject<{
6
+ name: z.ZodString;
7
+ key: z.ZodString;
8
+ layout: z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodSymbol]>, z.ZodUnknown>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ name: string;
11
+ key: string;
12
+ layout: Record<string | number | symbol, unknown>;
13
+ }, {
14
+ name: string;
15
+ key: string;
16
+ layout: Record<string | number | symbol, unknown>;
17
+ }>;
18
+ export declare const workspaceRemoteZ: z.ZodObject<{
19
+ name: z.ZodString;
20
+ key: z.ZodString;
21
+ layout: z.ZodEffects<z.ZodString, Partial<Record<import("@synnaxlabs/x").Key, unknown>>, string>;
22
+ }, "strip", z.ZodTypeAny, {
23
+ name: string;
24
+ key: string;
25
+ layout: Partial<Record<import("@synnaxlabs/x").Key, unknown>>;
26
+ }, {
27
+ name: string;
28
+ key: string;
29
+ layout: string;
30
+ }>;
31
+ export type Workspace = z.infer<typeof workspaceZ>;
@@ -0,0 +1,16 @@
1
+ import { type UnaryClient } from "@synnaxlabs/freighter";
2
+ import { type UnknownRecord } from "@synnaxlabs/x";
3
+ import { type Key, type Params, type PID } from '../../workspace/pid/payload';
4
+ import { type UncreatedPID } from '../../workspace/pid/writer';
5
+ export declare class Client {
6
+ private readonly writer;
7
+ private readonly retriever;
8
+ constructor(client: UnaryClient);
9
+ create(workspace: string, pid: UncreatedPID): Promise<PID>;
10
+ rename(key: Key, name: string): Promise<void>;
11
+ setData(key: Key, data: UnknownRecord): Promise<void>;
12
+ retrieve(key: Key): Promise<PID>;
13
+ retrieve(keys: Key[]): Promise<PID[]>;
14
+ delete(keys: Params): Promise<void>;
15
+ copy(key: Key, name: string, snapshot: boolean): Promise<PID>;
16
+ }
@@ -0,0 +1,2 @@
1
+ export * from '../../workspace/pid/payload';
2
+ export * from '../../workspace/pid/client';
@@ -0,0 +1 @@
1
+ export * as pid from '../../workspace/pid/external';
@@ -0,0 +1,37 @@
1
+ import { z } from "zod";
2
+ export declare const keyZ: z.ZodString;
3
+ export type Key = z.infer<typeof keyZ>;
4
+ export type Params = Key | Key[];
5
+ export declare const pidZ: z.ZodObject<{
6
+ key: z.ZodString;
7
+ name: z.ZodString;
8
+ data: z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodSymbol]>, z.ZodUnknown>;
9
+ snapshot: z.ZodBoolean;
10
+ }, "strip", z.ZodTypeAny, {
11
+ name: string;
12
+ key: string;
13
+ data: Record<string | number | symbol, unknown>;
14
+ snapshot: boolean;
15
+ }, {
16
+ name: string;
17
+ key: string;
18
+ data: Record<string | number | symbol, unknown>;
19
+ snapshot: boolean;
20
+ }>;
21
+ export declare const pidRemoteZ: z.ZodObject<{
22
+ key: z.ZodString;
23
+ name: z.ZodString;
24
+ snapshot: z.ZodBoolean;
25
+ data: z.ZodEffects<z.ZodString, Partial<Record<import("@synnaxlabs/x").Key, unknown>>, string>;
26
+ }, "strip", z.ZodTypeAny, {
27
+ name: string;
28
+ key: string;
29
+ data: Partial<Record<import("@synnaxlabs/x").Key, unknown>>;
30
+ snapshot: boolean;
31
+ }, {
32
+ name: string;
33
+ key: string;
34
+ data: string;
35
+ snapshot: boolean;
36
+ }>;
37
+ export type PID = z.infer<typeof pidZ>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import { type UnaryClient } from "@synnaxlabs/freighter";
2
+ import { type PID, type Params } from "./payload";
3
+ export declare class Retriever {
4
+ private readonly ENDPOINT;
5
+ private readonly client;
6
+ constructor(client: UnaryClient);
7
+ retrieve(params: Params): Promise<PID[]>;
8
+ private execute;
9
+ }
@@ -0,0 +1,46 @@
1
+ import { type UnaryClient } from "@synnaxlabs/freighter";
2
+ import { type UnknownRecord } from "@synnaxlabs/x";
3
+ import { z } from "zod";
4
+ import { type PID, type Params, type Key } from '../../workspace/pid/payload';
5
+ export declare const crudePIDz: z.ZodObject<{
6
+ name: z.ZodString;
7
+ key: z.ZodOptional<z.ZodString>;
8
+ data: z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodSymbol]>, z.ZodUnknown>;
9
+ snapshot: z.ZodBoolean;
10
+ }, "strip", z.ZodTypeAny, {
11
+ name: string;
12
+ data: Record<string | number | symbol, unknown>;
13
+ snapshot: boolean;
14
+ key?: string | undefined;
15
+ }, {
16
+ name: string;
17
+ data: Record<string | number | symbol, unknown>;
18
+ snapshot: boolean;
19
+ key?: string | undefined;
20
+ }>;
21
+ export declare const pidWriteZ: z.ZodObject<{
22
+ name: z.ZodString;
23
+ key: z.ZodOptional<z.ZodString>;
24
+ data: z.ZodEffects<z.ZodString, Partial<Record<import("@synnaxlabs/x").Key, unknown>>, string>;
25
+ snapshot: z.ZodOptional<z.ZodBoolean>;
26
+ }, "strip", z.ZodTypeAny, {
27
+ name: string;
28
+ data: Partial<Record<import("@synnaxlabs/x").Key, unknown>>;
29
+ key?: string | undefined;
30
+ snapshot?: boolean | undefined;
31
+ }, {
32
+ name: string;
33
+ data: string;
34
+ key?: string | undefined;
35
+ snapshot?: boolean | undefined;
36
+ }>;
37
+ export type UncreatedPID = z.infer<typeof pidWriteZ>;
38
+ export declare class Writer {
39
+ private readonly client;
40
+ constructor(client: UnaryClient);
41
+ create(workspace: string, pid: UncreatedPID): Promise<PID>;
42
+ copy(key: Key, name: string, snapshot: boolean): Promise<PID>;
43
+ delete(params: Params): Promise<void>;
44
+ rename(pid: Key, name: string): Promise<void>;
45
+ setData(pid: Key, data: UnknownRecord): Promise<void>;
46
+ }
@@ -0,0 +1,12 @@
1
+ import { type UnaryClient } from "@synnaxlabs/freighter";
2
+ import { type Params, type Workspace } from '../workspace/payload';
3
+ export declare class Retriever {
4
+ private static readonly ENDPOINT;
5
+ private readonly client;
6
+ constructor(client: UnaryClient);
7
+ retrieve(params: Params): Promise<Workspace[]>;
8
+ retrieveByAuthor(author: string): Promise<Workspace[]>;
9
+ search(term: string): Promise<Workspace[]>;
10
+ page(offset: number, limit: number): Promise<Workspace[]>;
11
+ private execute;
12
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,55 @@
1
+ import { type UnaryClient } from "@synnaxlabs/freighter";
2
+ import { type UnknownRecord } from "@synnaxlabs/x";
3
+ import { z } from "zod";
4
+ import { type Workspace } from "./payload";
5
+ declare const crudeWorkspaceZ: z.ZodObject<{
6
+ name: z.ZodString;
7
+ key: z.ZodOptional<z.ZodString>;
8
+ layout: z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodSymbol]>, z.ZodUnknown>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ name: string;
11
+ layout: Record<string | number | symbol, unknown>;
12
+ key?: string | undefined;
13
+ }, {
14
+ name: string;
15
+ layout: Record<string | number | symbol, unknown>;
16
+ key?: string | undefined;
17
+ }>;
18
+ export type CrudeWorkspace = z.infer<typeof crudeWorkspaceZ>;
19
+ declare const createResZ: z.ZodObject<{
20
+ workspaces: z.ZodArray<z.ZodObject<{
21
+ name: z.ZodString;
22
+ key: z.ZodString;
23
+ layout: z.ZodEffects<z.ZodString, Partial<Record<import("@synnaxlabs/x").Key, unknown>>, string>;
24
+ }, "strip", z.ZodTypeAny, {
25
+ name: string;
26
+ key: string;
27
+ layout: Partial<Record<import("@synnaxlabs/x").Key, unknown>>;
28
+ }, {
29
+ name: string;
30
+ key: string;
31
+ layout: string;
32
+ }>, "many">;
33
+ }, "strip", z.ZodTypeAny, {
34
+ workspaces: {
35
+ name: string;
36
+ key: string;
37
+ layout: Partial<Record<import("@synnaxlabs/x").Key, unknown>>;
38
+ }[];
39
+ }, {
40
+ workspaces: {
41
+ name: string;
42
+ key: string;
43
+ layout: string;
44
+ }[];
45
+ }>;
46
+ export type CreateResponse = z.infer<typeof createResZ>;
47
+ export declare class Writer {
48
+ private readonly client;
49
+ constructor(client: UnaryClient);
50
+ create(workspaces: CrudeWorkspace | CrudeWorkspace[]): Promise<Workspace[]>;
51
+ delete(keys: string | string[]): Promise<void>;
52
+ rename(key: string, name: string): Promise<void>;
53
+ setLayout(key: string, layout: UnknownRecord): Promise<void>;
54
+ }
55
+ export {};
package/package.json CHANGED
@@ -1,12 +1,10 @@
1
1
  {
2
2
  "name": "@synnaxlabs/client",
3
- "version": "0.2.1",
4
- "description": "synnax Client Library",
5
- "main": "build/main/index.js",
6
- "typings": "build/main/index.d.ts",
7
- "module": "build/module/index.js",
8
- "repository": "https://github.com/synnaxlabs/synnax",
9
- "license": "MIT",
3
+ "private": false,
4
+ "version": "0.13.5",
5
+ "type": "module",
6
+ "description": "The Client Library for Synnax",
7
+ "repository": "https://github.com/synnaxlabs/synnax/tree/main/client/ts",
10
8
  "keywords": [
11
9
  "synnax",
12
10
  "grpc",
@@ -17,99 +15,30 @@
17
15
  "telemetry",
18
16
  "control systems"
19
17
  ],
20
- "scripts": {
21
- "build": "run-p build:*",
22
- "build:main": "tsc -p tsconfig.json",
23
- "build:module": "tsc -p tsconfig.module.json",
24
- "fix": "run-s fix:*",
25
- "fix:prettier": "prettier \"src/**/*.ts\" --write",
26
- "fix:lint": "eslint src --ext .ts --fix",
27
- "test": "run-s build test:*",
28
- "test:lint": "eslint src --ext .ts",
29
- "test:prettier": "prettier \"src/**/*.ts\" --list-different",
30
- "test:unit": "nyc --silent ava",
31
- "check-cli": "run-s test diff-integration-tests check-integration-tests",
32
- "check-integration-tests": "run-s check-integration-test:*",
33
- "diff-integration-tests": "mkdir -p diff && rm -rf diff/test && cp -r test diff/test && rm -rf diff/test/test-*/.git && cd diff && git init --quiet && git add -A && git commit --quiet --no-verify --allow-empty -m 'WIP' && echo '\\n\\nCommitted most recent integration test output in the \"diff\" directory. Review the changes with \"cd diff && git diff HEAD\" or your preferred git diff viewer.'",
34
- "watch:build": "tsc -p tsconfig.json -w",
35
- "watch:test": "nyc --silent ava --watch",
36
- "cov": "run-s build test:unit cov:html cov:lcov",
37
- "cov:html": "nyc report --reporter=html",
38
- "cov:lcov": "nyc report --reporter=lcov",
39
- "cov:send": "run-s cov:lcov && codecov",
40
- "cov:check": "nyc report && nyc check-coverage --lines 100 --functions 100 --branches 100",
41
- "doc": "run-s doc:html && open-cli build/docs/index.html",
42
- "doc:html": "typedoc src/ --exclude **/*.spec.ts --target ES6 --mode file --out build/docs",
43
- "doc:json": "typedoc src/ --exclude **/*.spec.ts --target ES6 --mode file --json build/docs/typedoc.json",
44
- "doc:publish": "gh-pages -m \"[ci skip] Updates\" -d build/docs",
45
- "version": "standard-version",
46
- "reset-hard": "git clean -dfx && git reset --hard && yarn",
47
- "prepare-release": "run-s reset-hard test cov:check doc:html version doc:publish"
48
- },
49
- "engines": {
50
- "node": ">=10"
51
- },
52
18
  "dependencies": {
53
- "@synnaxlabs/freighter": "^0.2.0",
54
- "zod": "^3.19.1"
19
+ "zod": "3.22.4",
20
+ "@synnaxlabs/x": "0.7.0",
21
+ "@synnaxlabs/freighter": "0.4.0"
55
22
  },
56
23
  "devDependencies": {
57
- "@ava/typescript": "^1.1.1",
58
- "@istanbuljs/nyc-config-typescript": "^1.0.1",
59
- "@typescript-eslint/eslint-plugin": "^4.0.1",
60
- "@typescript-eslint/parser": "^4.0.1",
61
- "ava": "^3.12.1",
62
- "codecov": "^3.5.0",
63
- "cspell": "^4.1.0",
64
- "cz-conventional-changelog": "^3.3.0",
65
- "eslint": "^7.8.0",
66
- "eslint-config-prettier": "^6.11.0",
67
- "eslint-plugin-eslint-comments": "^3.2.0",
68
- "eslint-plugin-functional": "^3.0.2",
69
- "eslint-plugin-import": "^2.22.0",
70
- "gh-pages": "^3.1.0",
71
- "npm-run-all": "^4.1.5",
72
- "nyc": "^15.1.0",
73
- "open-cli": "^6.0.1",
74
- "prettier": "^2.1.1",
75
- "standard-version": "^9.0.0",
76
- "ts-node": "^9.0.0",
77
- "typedoc": "^0.19.0",
78
- "typescript": "^4.0.2"
79
- },
80
- "files": [
81
- "build/main",
82
- "build/module",
83
- "!**/*.spec.*",
84
- "!**/*.json",
85
- "CHANGELOG.md",
86
- "LICENSE",
87
- "README.md"
88
- ],
89
- "ava": {
90
- "failFast": true,
91
- "timeout": "60s",
92
- "typescript": {
93
- "rewritePaths": {
94
- "src/": "build/main/"
95
- }
96
- },
97
- "files": [
98
- "!build/module/**"
99
- ]
100
- },
101
- "config": {
102
- "commitizen": {
103
- "path": "cz-conventional-changelog"
104
- }
24
+ "@types/node": "^20.8.7",
25
+ "@vitest/coverage-v8": "^0.34.6",
26
+ "typescript": "^5.2.2",
27
+ "vite": "^4.5.0",
28
+ "vitest": "^0.34.6",
29
+ "@synnaxlabs/vite-plugin": "0.0.1",
30
+ "@synnaxlabs/tsconfig": "0.0.1",
31
+ "eslint-config-synnaxlabs": "0.0.0"
105
32
  },
106
- "prettier": {
107
- "singleQuote": true
108
- },
109
- "nyc": {
110
- "extends": "@istanbuljs/nyc-config-typescript",
111
- "exclude": [
112
- "**/*.spec.js"
113
- ]
33
+ "main": "dist/client.cjs.js",
34
+ "module": "dist/client.es.js",
35
+ "types": "dist/index.d.ts",
36
+ "scripts": {
37
+ "build": "tsc --noEmit && vite build",
38
+ "watch": "tsc --noEmit && vite build --watch",
39
+ "test": "vitest",
40
+ "cov": "vitest --coverage",
41
+ "lint": "eslint \"src/**/*.ts*\"",
42
+ "fix": "eslint \"src/**/*.ts*\" --fix"
114
43
  }
115
- }
44
+ }
@@ -0,0 +1,46 @@
1
+ // Copyright 2023 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
+ import { URL } from "@synnaxlabs/x";
11
+ import { describe, expect, test } from "vitest";
12
+
13
+ import { auth } from "@/auth";
14
+ import { AuthError } from "@/errors";
15
+ import { HOST, PORT } from "@/setupspecs";
16
+ import { Transport } from "@/transport";
17
+
18
+ describe("auth", () => {
19
+ test("valid credentials", async () => {
20
+ const transport = new Transport(new URL({ host: HOST, port: PORT }));
21
+ const client = new auth.Client(transport.unary, {
22
+ username: "synnax",
23
+ password: "seldon",
24
+ });
25
+ await client.authenticating;
26
+ expect(client.authenticated).toBeTruthy();
27
+ });
28
+
29
+ test("invalid credentials", async () => {
30
+ const transport = new Transport(new URL({ host: HOST, port: PORT }));
31
+ const client = new auth.Client(transport.unary, {
32
+ username: "synnax",
33
+ password: "wrong",
34
+ });
35
+ try {
36
+ await client.authenticating;
37
+ expect(client.authenticated).toBeFalsy();
38
+ } catch (e) {
39
+ expect(client.authenticated).toBeFalsy();
40
+ expect(e).toBeInstanceOf(AuthError);
41
+ if (e instanceof AuthError) {
42
+ expect(e.message).toEqual("Invalid authentication credentials");
43
+ }
44
+ }
45
+ });
46
+ });